mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 17:27:41 +01:00
SPIGOT-7131: Chunk snapshot returned by World#getEmptyChunkSnapshot(int,int,boolean,boolean) thinks every block has PLAINS biome
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
parent
8f8c4a60b5
commit
b09234ee3f
@ -344,7 +344,7 @@ public class CraftChunk implements Chunk {
|
||||
}
|
||||
|
||||
public static ChunkSnapshot getEmptyChunkSnapshot(int x, int z, CraftWorld world, boolean includeBiome, boolean includeBiomeTempRain) {
|
||||
IChunkAccess actual = world.getHandle().getChunk(x, z, ChunkStatus.EMPTY);
|
||||
IChunkAccess actual = world.getHandle().getChunk(x, z, (includeBiome || includeBiomeTempRain) ? ChunkStatus.BIOMES : ChunkStatus.EMPTY);
|
||||
|
||||
/* Fill with empty data */
|
||||
int hSection = actual.getSectionsCount();
|
||||
@ -354,6 +354,7 @@ public class CraftChunk implements Chunk {
|
||||
boolean[] empty = new boolean[hSection];
|
||||
IRegistry<BiomeBase> iregistry = world.getHandle().registryAccess().registryOrThrow(IRegistry.BIOME_REGISTRY);
|
||||
DataPaletteBlock<Holder<BiomeBase>>[] biome = (includeBiome || includeBiomeTempRain) ? new DataPaletteBlock[hSection] : null;
|
||||
Codec<PalettedContainerRO<Holder<BiomeBase>>> biomeCodec = DataPaletteBlock.codecRO(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), DataPaletteBlock.d.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS));
|
||||
|
||||
for (int i = 0; i < hSection; i++) {
|
||||
blockIDs[i] = emptyBlockIDs;
|
||||
@ -362,7 +363,7 @@ public class CraftChunk implements Chunk {
|
||||
empty[i] = true;
|
||||
|
||||
if (biome != null) {
|
||||
biome[i] = new DataPaletteBlock<>(iregistry.asHolderIdMap(), iregistry.getHolderOrThrow(Biomes.PLAINS), DataPaletteBlock.d.SECTION_BIOMES);
|
||||
biome[i] = (DataPaletteBlock<Holder<BiomeBase>>) biomeCodec.parse(DynamicOpsNBT.INSTANCE, biomeCodec.encodeStart(DynamicOpsNBT.INSTANCE, actual.getSection(i).getBiomes()).get().left().get()).get().left().get();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user