geforkt von Mirrors/Paper
net.minecraft.world.level.chunk.status
Dieser Commit ist enthalten in:
Ursprung
773f7aada7
Commit
1b5b2d8d45
@ -1,46 +1,38 @@
|
||||
--- a/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
|
||||
+++ b/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
|
||||
@@ -36,7 +36,7 @@
|
||||
static CompletableFuture<ChunkAccess> generateStructureStarts(WorldGenContext context, ChunkStep step, StaticCache2D<GenerationChunkHolder> chunks, ChunkAccess chunk) {
|
||||
ServerLevel worldserver = context.level();
|
||||
|
||||
- if (worldserver.getServer().getWorldData().worldGenOptions().generateStructures()) {
|
||||
+ if (worldserver.serverLevelData.worldGenOptions().generateStructures()) { // CraftBukkit
|
||||
context.generator().createStructures(worldserver.registryAccess(), worldserver.getChunkSource().getGeneratorState(), worldserver.structureManager(), chunk, context.structureManager(), worldserver.dimension());
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
if (protochunk instanceof ImposterProtoChunk protochunkextension) {
|
||||
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());
|
||||
@@ -35,7 +_,7 @@
|
||||
WorldGenContext worldGenContext, ChunkStep step, StaticCache2D<GenerationChunkHolder> cache, ChunkAccess chunk
|
||||
) {
|
||||
ServerLevel serverLevel = worldGenContext.level();
|
||||
- if (serverLevel.getServer().getWorldData().worldGenOptions().generateStructures()) {
|
||||
+ if (serverLevel.serverLevelData.worldGenOptions().generateStructures()) { // CraftBukkit
|
||||
worldGenContext.generator()
|
||||
.createStructures(
|
||||
serverLevel.registryAccess(),
|
||||
@@ -196,9 +_,60 @@
|
||||
}, worldGenContext.mainThreadExecutor());
|
||||
}
|
||||
|
||||
- private static void postLoadProtoChunk(ServerLevel world, List<CompoundTag> entities) {
|
||||
+ public static void postLoadProtoChunk(ServerLevel world, List<CompoundTag> entities) { // Paper - public
|
||||
if (!entities.isEmpty()) {
|
||||
- world.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(entities, world, EntitySpawnReason.LOAD));
|
||||
- private static void postLoadProtoChunk(ServerLevel level, List<CompoundTag> entityTags) {
|
||||
+ public static void postLoadProtoChunk(ServerLevel level, List<CompoundTag> entityTags) { // Paper - public
|
||||
if (!entityTags.isEmpty()) {
|
||||
- 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
|
||||
+ world.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(entities, world, EntitySpawnReason.LOAD).filter((entity) -> {
|
||||
+ level.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(entityTags, level, EntitySpawnReason.LOAD).filter((entity) -> {
|
||||
+ boolean needsRemoval = false;
|
||||
+ net.minecraft.server.dedicated.DedicatedServer server = world.getCraftServer().getServer();
|
||||
+ if (!world.getChunkSource().spawnFriendlies && (entity instanceof net.minecraft.world.entity.animal.Animal || entity instanceof net.minecraft.world.entity.animal.WaterAnimal)) {
|
||||
+ net.minecraft.server.dedicated.DedicatedServer server = level.getCraftServer().getServer();
|
||||
+ 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
|
||||
+ needsRemoval = true;
|
||||
+ }
|
||||
+ checkDupeUUID(world, entity); // Paper - duplicate uuid resolving
|
||||
+ checkDupeUUID(level, entity); // Paper - duplicate uuid resolving
|
||||
+ return !needsRemoval;
|
||||
+ }));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Paper start - duplicate uuid resolving
|
||||
+ // 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()
|
||||
+ && 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.discard(null);
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren