net.minecraft.world.level.chunk.status
This commit is contained in:
@ -1,46 +1,38 @@
|
|||||||
--- a/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
|
--- a/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
|
||||||
+++ b/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
|
+++ b/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
|
||||||
@@ -36,7 +36,7 @@
|
@@ -35,7 +_,7 @@
|
||||||
static CompletableFuture<ChunkAccess> generateStructureStarts(WorldGenContext context, ChunkStep step, StaticCache2D<GenerationChunkHolder> chunks, ChunkAccess chunk) {
|
WorldGenContext worldGenContext, ChunkStep step, StaticCache2D<GenerationChunkHolder> cache, ChunkAccess chunk
|
||||||
ServerLevel worldserver = context.level();
|
) {
|
||||||
|
ServerLevel serverLevel = worldGenContext.level();
|
||||||
- if (worldserver.getServer().getWorldData().worldGenOptions().generateStructures()) {
|
- if (serverLevel.getServer().getWorldData().worldGenOptions().generateStructures()) {
|
||||||
+ if (worldserver.serverLevelData.worldGenOptions().generateStructures()) { // CraftBukkit
|
+ if (serverLevel.serverLevelData.worldGenOptions().generateStructures()) { // CraftBukkit
|
||||||
context.generator().createStructures(worldserver.registryAccess(), worldserver.getChunkSource().getGeneratorState(), worldserver.structureManager(), chunk, context.structureManager(), worldserver.dimension());
|
worldGenContext.generator()
|
||||||
}
|
.createStructures(
|
||||||
|
serverLevel.registryAccess(),
|
||||||
@@ -151,7 +151,7 @@
|
@@ -196,9 +_,60 @@
|
||||||
if (protochunk instanceof ImposterProtoChunk protochunkextension) {
|
}, worldGenContext.mainThreadExecutor());
|
||||||
chunk1 = protochunkextension.getWrapped();
|
|
||||||
} else {
|
|
||||||
- chunk1 = new LevelChunk(worldserver, protochunk, (chunk1) -> {
|
|
||||||
+ chunk1 = new LevelChunk(worldserver, protochunk, ($) -> { // Paper - decompile fix
|
|
||||||
ChunkStatusTasks.postLoadProtoChunk(worldserver, protochunk.getEntities());
|
|
||||||
});
|
|
||||||
generationchunkholder.replaceProtoChunk(new ImposterProtoChunk(chunk1, false));
|
|
||||||
@@ -168,10 +168,61 @@
|
|
||||||
}, context.mainThreadExecutor());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- private static void postLoadProtoChunk(ServerLevel world, List<CompoundTag> entities) {
|
- private static void postLoadProtoChunk(ServerLevel level, List<CompoundTag> entityTags) {
|
||||||
+ public static void postLoadProtoChunk(ServerLevel world, List<CompoundTag> entities) { // Paper - public
|
+ public static void postLoadProtoChunk(ServerLevel level, List<CompoundTag> entityTags) { // Paper - public
|
||||||
if (!entities.isEmpty()) {
|
if (!entityTags.isEmpty()) {
|
||||||
- world.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(entities, world, EntitySpawnReason.LOAD));
|
- level.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(entityTags, level, EntitySpawnReason.LOAD));
|
||||||
|
- }
|
||||||
|
- }
|
||||||
+ // CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities
|
+ // CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities
|
||||||
+ world.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(entities, world, EntitySpawnReason.LOAD).filter((entity) -> {
|
+ level.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(entityTags, level, EntitySpawnReason.LOAD).filter((entity) -> {
|
||||||
+ boolean needsRemoval = false;
|
+ boolean needsRemoval = false;
|
||||||
+ net.minecraft.server.dedicated.DedicatedServer server = world.getCraftServer().getServer();
|
+ net.minecraft.server.dedicated.DedicatedServer server = level.getCraftServer().getServer();
|
||||||
+ if (!world.getChunkSource().spawnFriendlies && (entity instanceof net.minecraft.world.entity.animal.Animal || entity instanceof net.minecraft.world.entity.animal.WaterAnimal)) {
|
+ if (!level.getChunkSource().spawnFriendlies && (entity instanceof net.minecraft.world.entity.animal.Animal || entity instanceof net.minecraft.world.entity.animal.WaterAnimal)) {
|
||||||
+ entity.discard(null); // CraftBukkit - add Bukkit remove cause
|
+ entity.discard(null); // CraftBukkit - add Bukkit remove cause
|
||||||
+ needsRemoval = true;
|
+ needsRemoval = true;
|
||||||
+ }
|
+ }
|
||||||
+ checkDupeUUID(world, entity); // Paper - duplicate uuid resolving
|
+ checkDupeUUID(level, entity); // Paper - duplicate uuid resolving
|
||||||
+ return !needsRemoval;
|
+ return !needsRemoval;
|
||||||
+ }));
|
+ }));
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
}
|
+ }
|
||||||
|
+ }
|
||||||
}
|
|
||||||
+
|
+
|
||||||
+ // Paper start - duplicate uuid resolving
|
+ // Paper start - duplicate uuid resolving
|
||||||
+ // rets true if to prevent the entity from being added
|
+ // rets true if to prevent the entity from being added
|
||||||
@ -58,7 +50,7 @@
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (mode == io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode.SAFE_REGEN && other != null && !other.isRemoved()
|
+ if (mode == io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DuplicateUUID.DuplicateUUIDMode.SAFE_REGEN && other != null && !other.isRemoved()
|
||||||
+ && Objects.equals(other.getEncodeId(), entity.getEncodeId())
|
+ && java.util.Objects.equals(other.getEncodeId(), entity.getEncodeId())
|
||||||
+ && entity.getBukkitEntity().getLocation().distance(other.getBukkitEntity().getLocation()) < level.paperConfig().entities.spawning.duplicateUuid.safeRegenDeleteRange
|
+ && entity.getBukkitEntity().getLocation().distance(other.getBukkitEntity().getLocation()) < level.paperConfig().entities.spawning.duplicateUuid.safeRegenDeleteRange
|
||||||
+ ) {
|
+ ) {
|
||||||
+ entity.discard(null);
|
+ entity.discard(null);
|
||||||
Reference in New Issue
Block a user