Fixup porting issue in vanillaBiomeProvider impl (#11185)

This commit is contained in:
Jason Penilla 2024-08-31 10:59:17 -07:00 committed by GitHub
parent 25621248d3
commit e01ddf4627
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 83 additions and 43 deletions

View file

@ -17,6 +17,19 @@ index 6ad7c34513034c87059f8a0790aea3231dd0d2a9..188b1844ca6ee5a97f7a588121255417
if (biomeProvider == null && gen != null) { if (biomeProvider == null && gen != null) {
biomeProvider = gen.getDefaultBiomeProvider(worldInfo); biomeProvider = gen.getDefaultBiomeProvider(worldInfo);
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 3c947dc0aea06d66a00aeca51355ea41e8d98f88..60a77bd04489ee592ec61d3d739cb3062c1eefbb 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -369,7 +369,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.serverLevelData.setWorld(this);
if (biomeProvider != null) {
- BiomeSource worldChunkManager = new CustomWorldChunkManager(this.getWorld(), biomeProvider, this.server.registryAccess().registryOrThrow(Registries.BIOME));
+ BiomeSource worldChunkManager = new CustomWorldChunkManager(this.getWorld(), biomeProvider, this.server.registryAccess().registryOrThrow(Registries.BIOME), chunkgenerator.getBiomeSource()); // Paper - add vanillaBiomeProvider
if (chunkgenerator instanceof NoiseBasedChunkGenerator cga) {
chunkgenerator = new NoiseBasedChunkGenerator(worldChunkManager, cga.settings);
} else if (chunkgenerator instanceof FlatLevelSource cpf) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9707b24da58fdc56732d6372038055e8676e9e0d..05dbcff299d42dc05e3a8db0265fb607197731e7 100644 index 9707b24da58fdc56732d6372038055e8676e9e0d..05dbcff299d42dc05e3a8db0265fb607197731e7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@ -31,10 +44,10 @@ index 9707b24da58fdc56732d6372038055e8676e9e0d..05dbcff299d42dc05e3a8db0265fb607
biomeProvider = generator.getDefaultBiomeProvider(worldInfo); biomeProvider = generator.getDefaultBiomeProvider(worldInfo);
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 0c2734c1d06b6c5dff383f9c6139c0389f220a76..da556cdbd7eecfd0743924d9ab79142c41f08d0a 100644 index 0c2734c1d06b6c5dff383f9c6139c0389f220a76..110a5d92d6154bc39c1916006a5cb74798092445 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -212,6 +212,29 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -212,6 +212,39 @@ public class CraftWorld extends CraftRegionAccessor implements World {
public int getPlayerCount() { public int getPlayerCount() {
return world.players().size(); return world.players().size();
} }
@ -43,16 +56,26 @@ index 0c2734c1d06b6c5dff383f9c6139c0389f220a76..da556cdbd7eecfd0743924d9ab79142c
+ public BiomeProvider vanillaBiomeProvider() { + public BiomeProvider vanillaBiomeProvider() {
+ net.minecraft.server.level.ServerChunkCache serverCache = this.getHandle().chunkSource; + net.minecraft.server.level.ServerChunkCache serverCache = this.getHandle().chunkSource;
+ +
+ final net.minecraft.world.level.biome.BiomeSource biomeSource = serverCache.getGenerator().getBiomeSource(); + final net.minecraft.world.level.chunk.ChunkGenerator gen = serverCache.getGenerator();
+ net.minecraft.world.level.biome.BiomeSource biomeSource;
+ if (gen instanceof org.bukkit.craftbukkit.generator.CustomChunkGenerator custom) {
+ biomeSource = custom.getDelegate().getBiomeSource();
+ } else {
+ biomeSource = gen.getBiomeSource();
+ }
+ if (biomeSource instanceof org.bukkit.craftbukkit.generator.CustomWorldChunkManager customBiomeSource) {
+ biomeSource = customBiomeSource.vanillaBiomeSource;
+ }
+ final net.minecraft.world.level.biome.BiomeSource finalBiomeSource = biomeSource;
+ final net.minecraft.world.level.biome.Climate.Sampler sampler = serverCache.randomState().sampler(); + final net.minecraft.world.level.biome.Climate.Sampler sampler = serverCache.randomState().sampler();
+ +
+ final List<Biome> possibleBiomes = biomeSource.possibleBiomes().stream() + final List<Biome> possibleBiomes = finalBiomeSource.possibleBiomes().stream()
+ .map(biome -> org.bukkit.craftbukkit.block.CraftBiome.minecraftHolderToBukkit(biome)) + .map(CraftBiome::minecraftHolderToBukkit)
+ .toList(); + .toList();
+ return new BiomeProvider() { + return new BiomeProvider() {
+ @Override + @Override
+ public Biome getBiome(final org.bukkit.generator.WorldInfo worldInfo, final int x, final int y, final int z) { + public Biome getBiome(final org.bukkit.generator.WorldInfo worldInfo, final int x, final int y, final int z) {
+ return org.bukkit.craftbukkit.block.CraftBiome.minecraftHolderToBukkit(biomeSource.getNoiseBiome(x >> 2, y >> 2, z >> 2, sampler)); + return CraftBiome.minecraftHolderToBukkit(finalBiomeSource.getNoiseBiome(x >> 2, y >> 2, z >> 2, sampler));
+ } + }
+ +
+ @Override + @Override
@ -135,3 +158,20 @@ index 5d655d6cd3e23e0287069f8bdf77601487e862fd..cf57c6e9ce63f7b1d95d91ead2453409
+ } + }
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomWorldChunkManager.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomWorldChunkManager.java
index 0063c4c17d05a77adf81164fb9307a29860cbe12..0bac128d6faff0063b03f595b82deea78d1ae161 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CustomWorldChunkManager.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomWorldChunkManager.java
@@ -31,7 +31,11 @@ public class CustomWorldChunkManager extends BiomeSource {
return biomeBases;
}
- public CustomWorldChunkManager(WorldInfo worldInfo, BiomeProvider biomeProvider, Registry<net.minecraft.world.level.biome.Biome> registry) {
+ // Paper start - add vanillaBiomeProvider
+ public final BiomeSource vanillaBiomeSource;
+ public CustomWorldChunkManager(WorldInfo worldInfo, BiomeProvider biomeProvider, Registry<net.minecraft.world.level.biome.Biome> registry, BiomeSource vanillaBiomeSource) {
+ this.vanillaBiomeSource = vanillaBiomeSource;
+ // Paper end - add vanillaBiomeProvider
this.worldInfo = worldInfo;
this.biomeProvider = biomeProvider;
this.registry = registry;

View file

@ -11,10 +11,10 @@ Restores the API behavior from previous versions of the server
public net.minecraft.world.entity.item.FallingBlockEntity <init>(Lnet/minecraft/world/level/Level;DDDLnet/minecraft/world/level/block/state/BlockState;)V public net.minecraft.world.entity.item.FallingBlockEntity <init>(Lnet/minecraft/world/level/Level;DDDLnet/minecraft/world/level/block/state/BlockState;)V
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index da556cdbd7eecfd0743924d9ab79142c41f08d0a..c0c26825865404231f57883447328c84cdf32d82 100644 index 110a5d92d6154bc39c1916006a5cb74798092445..a1912eb5fd26898d7e9848ffb2052fce2fa10868 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1383,7 +1383,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1393,7 +1393,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
Preconditions.checkArgument(material != null, "Material cannot be null"); Preconditions.checkArgument(material != null, "Material cannot be null");
Preconditions.checkArgument(material.isBlock(), "Material.%s must be a block", material); Preconditions.checkArgument(material.isBlock(), "Material.%s must be a block", material);
@ -28,7 +28,7 @@ index da556cdbd7eecfd0743924d9ab79142c41f08d0a..c0c26825865404231f57883447328c84
return (FallingBlock) entity.getBukkitEntity(); return (FallingBlock) entity.getBukkitEntity();
} }
@@ -1392,7 +1397,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1402,7 +1407,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
Preconditions.checkArgument(location != null, "Location cannot be null"); Preconditions.checkArgument(location != null, "Location cannot be null");
Preconditions.checkArgument(data != null, "BlockData cannot be null"); Preconditions.checkArgument(data != null, "BlockData cannot be null");

View file

@ -18,10 +18,10 @@ index b4111bcc6a676dc42b233761aa667708669c2ab8..cc92d2e8b77c75da1d8b850c3bc251e8
private static boolean isOutsideSpawnableHeight(int y) { private static boolean isOutsideSpawnableHeight(int y) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index c0c26825865404231f57883447328c84cdf32d82..0c5a583f2ced1ae5e1e92a045ef2ef1cd5b35496 100644 index a1912eb5fd26898d7e9848ffb2052fce2fa10868..cb28a7504e809a8b1e8ab6e34e14e414c542055f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -295,9 +295,24 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -305,9 +305,24 @@ public class CraftWorld extends CraftRegionAccessor implements World {
public boolean setSpawnLocation(int x, int y, int z) { public boolean setSpawnLocation(int x, int y, int z) {
return this.setSpawnLocation(x, y, z, 0.0F); return this.setSpawnLocation(x, y, z, 0.0F);
} }
@ -46,7 +46,7 @@ index c0c26825865404231f57883447328c84cdf32d82..0c5a583f2ced1ae5e1e92a045ef2ef1c
// Paper start - add ticket to hold chunk for a little while longer if plugin accesses it // Paper start - add ticket to hold chunk for a little while longer if plugin accesses it
net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z); net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z);
if (chunk == null) { if (chunk == null) {
@@ -403,6 +418,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -413,6 +428,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
if (!unloadChunk0(x, z, false)) { if (!unloadChunk0(x, z, false)) {
return false; return false;
} }
@ -54,7 +54,7 @@ index c0c26825865404231f57883447328c84cdf32d82..0c5a583f2ced1ae5e1e92a045ef2ef1c
final long chunkKey = ChunkCoordIntPair.pair(x, z); final long chunkKey = ChunkCoordIntPair.pair(x, z);
world.getChunkProvider().unloadQueue.remove(chunkKey); world.getChunkProvider().unloadQueue.remove(chunkKey);
@@ -476,6 +492,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -486,6 +502,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public boolean loadChunk(int x, int z, boolean generate) { public boolean loadChunk(int x, int z, boolean generate) {
org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot
@ -62,7 +62,7 @@ index c0c26825865404231f57883447328c84cdf32d82..0c5a583f2ced1ae5e1e92a045ef2ef1c
ChunkAccess chunk = this.world.getChunkSource().getChunk(x, z, generate || isChunkGenerated(x, z) ? ChunkStatus.FULL : ChunkStatus.EMPTY, true); // Paper ChunkAccess chunk = this.world.getChunkSource().getChunk(x, z, generate || isChunkGenerated(x, z) ? ChunkStatus.FULL : ChunkStatus.EMPTY, true); // Paper
// If generate = false, but the chunk already exists, we will get this back. // If generate = false, but the chunk already exists, we will get this back.
@@ -508,6 +525,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -518,6 +535,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public boolean addPluginChunkTicket(int x, int z, Plugin plugin) { public boolean addPluginChunkTicket(int x, int z, Plugin plugin) {
@ -70,7 +70,7 @@ index c0c26825865404231f57883447328c84cdf32d82..0c5a583f2ced1ae5e1e92a045ef2ef1c
Preconditions.checkArgument(plugin != null, "null plugin"); Preconditions.checkArgument(plugin != null, "null plugin");
Preconditions.checkArgument(plugin.isEnabled(), "plugin is not enabled"); Preconditions.checkArgument(plugin.isEnabled(), "plugin is not enabled");
@@ -608,6 +626,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -618,6 +636,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setChunkForceLoaded(int x, int z, boolean forced) { public void setChunkForceLoaded(int x, int z, boolean forced) {
@ -78,7 +78,7 @@ index c0c26825865404231f57883447328c84cdf32d82..0c5a583f2ced1ae5e1e92a045ef2ef1c
this.getHandle().setChunkForced(x, z, forced); this.getHandle().setChunkForced(x, z, forced);
} }
@@ -936,6 +955,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -946,6 +965,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) { public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) {
@ -86,7 +86,7 @@ index c0c26825865404231f57883447328c84cdf32d82..0c5a583f2ced1ae5e1e92a045ef2ef1c
// Transient load for this tick // Transient load for this tick
return this.world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z); return this.world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z);
} }
@@ -2333,6 +2353,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2343,6 +2363,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// Spigot end // Spigot end
// Paper start // Paper start
public java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent) { public java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent) {

View file

@ -68,10 +68,10 @@ index 71733f918ed84b9879ac1b142ef6205c5e768a9c..c856384019eff2f2d0bb831ebe1ccb0f
break; break;
case BONE_MEAL_USE: case BONE_MEAL_USE:
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 0c5a583f2ced1ae5e1e92a045ef2ef1cd5b35496..5c83ca573ccaa75a1d4e8129c96a24e3cf0f3266 100644 index cb28a7504e809a8b1e8ab6e34e14e414c542055f..28458a499702989d640d88de8fa7e8861be95189 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1360,7 +1360,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1370,7 +1370,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
public <T> void playEffect(Location loc, Effect effect, T data, int radius) { public <T> void playEffect(Location loc, Effect effect, T data, int radius) {
if (data != null) { if (data != null) {
Preconditions.checkArgument(effect.getData() != null, "Effect.%s does not have a valid Data", effect); Preconditions.checkArgument(effect.getData() != null, "Effect.%s does not have a valid Data", effect);

View file

@ -47,10 +47,10 @@ index c978f3b2d42f512e982f289e76c2422e41b7eec6..bb8e962e63c7a2d931f9bd7f7c002aa3
Vec3 vec3d = raytrace1.getFrom().subtract(raytrace1.getTo()); Vec3 vec3d = raytrace1.getFrom().subtract(raytrace1.getTo());
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 5c83ca573ccaa75a1d4e8129c96a24e3cf0f3266..29fa82c15411fbdae09e45e334209dcc93aa1789 100644 index 28458a499702989d640d88de8fa7e8861be95189..166458785b507208caa7ecf8ee8b60650ca3523a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1094,9 +1094,15 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1104,9 +1104,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance, double raySize, Predicate<? super Entity> filter) { public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance, double raySize, Predicate<? super Entity> filter) {
@ -68,7 +68,7 @@ index 5c83ca573ccaa75a1d4e8129c96a24e3cf0f3266..29fa82c15411fbdae09e45e334209dcc
Preconditions.checkArgument(direction != null, "Vector direction cannot be null"); Preconditions.checkArgument(direction != null, "Vector direction cannot be null");
direction.checkFinite(); direction.checkFinite();
@@ -1146,9 +1152,16 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1156,9 +1162,16 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks) { public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks) {
@ -87,7 +87,7 @@ index 5c83ca573ccaa75a1d4e8129c96a24e3cf0f3266..29fa82c15411fbdae09e45e334209dcc
Preconditions.checkArgument(direction != null, "Vector direction cannot be null"); Preconditions.checkArgument(direction != null, "Vector direction cannot be null");
direction.checkFinite(); direction.checkFinite();
@@ -1161,16 +1174,23 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1171,16 +1184,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {
} }
Vector dir = direction.clone().normalize().multiply(maxDistance); Vector dir = direction.clone().normalize().multiply(maxDistance);

View file

@ -45,10 +45,10 @@ index 0471d9c85af02133f99cca4e181b83b58a3f1abc..4f701788bd21b61cad251a3a88f9bc41
BlockState iblockdata = BaseFireBlock.getState(this.level(), blockposition); BlockState iblockdata = BaseFireBlock.getState(this.level(), blockposition);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 29fa82c15411fbdae09e45e334209dcc93aa1789..612dc787880e58e8325a658a63f9fe7536d0860c 100644 index 166458785b507208caa7ecf8ee8b60650ca3523a..7200c336de27ffd4d37231768ff5192956ede972 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -726,7 +726,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -736,7 +736,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
LightningBolt lightning = EntityType.LIGHTNING_BOLT.create(this.world); LightningBolt lightning = EntityType.LIGHTNING_BOLT.create(this.world);
lightning.moveTo(loc.getX(), loc.getY(), loc.getZ()); lightning.moveTo(loc.getX(), loc.getY(), loc.getZ());

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add Structure check API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 612dc787880e58e8325a658a63f9fe7536d0860c..7d54a29047d210170edf61c6182a6a8d02aa5f72 100644 index 7200c336de27ffd4d37231768ff5192956ede972..cb85180daaa2b40cba2474784548d650bc4d639b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -236,6 +236,15 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -246,6 +246,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
}; };
} }
// Paper end // Paper end

View file

@ -86,10 +86,10 @@ index b8ce1c1c2447f9cff1717bfcfd6eb911ade0d4b3..51f21af9d75769abdcba713b9aa33392
+ // Paper end - more Raid API + // Paper end - more Raid API
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index c664e8ca115c0a0f64e6b54478a0a2e88e8a58b7..1beb22285857778f7b0f33daa265046f657be854 100644 index cb85180daaa2b40cba2474784548d650bc4d639b..50b84939eee044ddadca046079286a72de5c8e04 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2301,6 +2301,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2311,6 +2311,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return (raid == null) ? null : new CraftRaid(raid); return (raid == null) ? null : new CraftRaid(raid);
} }

View file

@ -25574,7 +25574,7 @@ index 1d849ce4e2c85f149af25318b8ffb6dcef6c6788..12d86f27d04bffed8c3844e36b42fbc2
if (!list.equals(this.lastPassengers)) { if (!list.equals(this.lastPassengers)) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index c97292f22a3402dbd59cef4af554954dc1d4f91a..b2c5ead035f583585b79f7eba51d66da89bf1259 100644 index 81f0a0dfefd9e1698548a68679dab0974921c37a..24d5e741aed1677d0df59c1455fbfc60a29e8e3c 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -184,7 +184,7 @@ import org.bukkit.event.weather.LightningStrikeEvent; @@ -184,7 +184,7 @@ import org.bukkit.event.weather.LightningStrikeEvent;
@ -26935,7 +26935,7 @@ index 50040c497a819cd1229042ab3cb057d34a32cacc..15c5164d0ef41a978c16ee317fa73e97
+ // Paper end - block counting + // Paper end - block counting
} }
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index cf43f02aa705fdd71ebcdc9d028bacae73a11f42..9928c5f0814aa2206dfe7540a3fe2465b4446359 100644 index ef05c75d86ce3a7e4d4438dcd6f98c778568634a..0d4e1a90dbdca72df5776b1294e87c85434e53ac 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -167,7 +167,7 @@ import org.bukkit.event.player.PlayerTeleportEvent; @@ -167,7 +167,7 @@ import org.bukkit.event.player.PlayerTeleportEvent;
@ -32762,10 +32762,10 @@ index d8b842bfd1507ace84943ff1f9ddc6ea153e54db..266b720ffe2a684dcf54456e3a198f90
// Paper start - Adventure // Paper start - Adventure
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 1beb22285857778f7b0f33daa265046f657be854..f8d9446acd34d8f1d2e58288d742dbb4da2691ce 100644 index 50b84939eee044ddadca046079286a72de5c8e04..15e075fc3a9b18e62e04f41fcadbe62e05cd8c79 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -451,10 +451,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -461,10 +461,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z)); ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z));
if (playerChunk == null) return false; if (playerChunk == null) return false;
@ -32783,7 +32783,7 @@ index 1beb22285857778f7b0f33daa265046f657be854..f8d9446acd34d8f1d2e58288d742dbb4
ClientboundLevelChunkWithLightPacket refreshPacket = new ClientboundLevelChunkWithLightPacket(chunk, this.world.getLightEngine(), null, null); ClientboundLevelChunkWithLightPacket refreshPacket = new ClientboundLevelChunkWithLightPacket(chunk, this.world.getLightEngine(), null, null);
for (ServerPlayer player : playersInRange) { for (ServerPlayer player : playersInRange) {
@@ -462,8 +466,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -472,8 +476,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
player.connection.send(refreshPacket); player.connection.send(refreshPacket);
} }
@ -32793,7 +32793,7 @@ index 1beb22285857778f7b0f33daa265046f657be854..f8d9446acd34d8f1d2e58288d742dbb4
return true; return true;
} }
@@ -567,20 +570,8 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -577,20 +580,8 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public Collection<Plugin> getPluginChunkTickets(int x, int z) { public Collection<Plugin> getPluginChunkTickets(int x, int z) {
DistanceManager chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager; DistanceManager chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager;
@ -32815,7 +32815,7 @@ index 1beb22285857778f7b0f33daa265046f657be854..f8d9446acd34d8f1d2e58288d742dbb4
} }
@Override @Override
@@ -588,7 +579,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -598,7 +589,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
Map<Plugin, ImmutableList.Builder<Chunk>> ret = new HashMap<>(); Map<Plugin, ImmutableList.Builder<Chunk>> ret = new HashMap<>();
DistanceManager chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager; DistanceManager chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager;
@ -32824,7 +32824,7 @@ index 1beb22285857778f7b0f33daa265046f657be854..f8d9446acd34d8f1d2e58288d742dbb4
long chunkKey = chunkTickets.getLongKey(); long chunkKey = chunkTickets.getLongKey();
SortedArraySet<Ticket<?>> tickets = chunkTickets.getValue(); SortedArraySet<Ticket<?>> tickets = chunkTickets.getValue();
@@ -1285,12 +1276,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1295,12 +1286,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public int getViewDistance() { public int getViewDistance() {
@ -32839,7 +32839,7 @@ index 1beb22285857778f7b0f33daa265046f657be854..f8d9446acd34d8f1d2e58288d742dbb4
} }
public BlockMetadataStore getBlockMetadata() { public BlockMetadataStore getBlockMetadata() {
@@ -2428,17 +2419,20 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2438,17 +2429,20 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setSimulationDistance(final int simulationDistance) { public void setSimulationDistance(final int simulationDistance) {

View file

@ -1104,7 +1104,7 @@ index 183b2191fa1c1b27adedf39593e1b5a223fb1279..8ead66c134688b11dca15f6509147e72
private ClientboundLevelChunkWithLightPacket(RegistryFriendlyByteBuf buf) { private ClientboundLevelChunkWithLightPacket(RegistryFriendlyByteBuf buf) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 3880ca95731c82bf48bb460f4c59a2c61970930b..4fea1670cb7b731145c0769cf9c2e2485bdd1d6b 100644 index eadbf175c69b6bb2d0df723afac96a517ebf0d83..1f611e7c877bf89f598148db69c1d4166b00f8ac 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -491,7 +491,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -491,7 +491,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@ -1587,10 +1587,10 @@ index 266b720ffe2a684dcf54456e3a198f90baf96ba3..05001bb637d55aaf36359b37a42ef33e
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index f8d9446acd34d8f1d2e58288d742dbb4da2691ce..0b9e4f68df87e89bda458ce715982c6db780ebc4 100644 index 15e075fc3a9b18e62e04f41fcadbe62e05cd8c79..8221597951c5e768fa8af23adc1a57871c76f3a6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -460,11 +460,16 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -470,11 +470,16 @@ public class CraftWorld extends CraftRegionAccessor implements World {
List<ServerPlayer> playersInRange = playerChunk.playerProvider.getPlayers(playerChunk.getPos(), false); List<ServerPlayer> playersInRange = playerChunk.playerProvider.getPlayers(playerChunk.getPos(), false);
if (playersInRange.isEmpty()) return true; // Paper - chunk system if (playersInRange.isEmpty()) return true; // Paper - chunk system

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Fix CraftWorld#isChunkGenerated
The upstream implementation is returning true for non-full chunks. The upstream implementation is returning true for non-full chunks.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 0b9e4f68df87e89bda458ce715982c6db780ebc4..7f523399774ba395a6bc99d92553c6e4def80eab 100644 index 8221597951c5e768fa8af23adc1a57871c76f3a6..90d4834f97d3ba996d46493246b1947511553424 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -362,11 +362,28 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -372,11 +372,28 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public boolean isChunkGenerated(int x, int z) { public boolean isChunkGenerated(int x, int z) {