@@ -7,7 +7,6 @@ import net.minecraft.core.BlockPosition;
|
||||
import net.minecraft.core.IRegistry;
|
||||
import net.minecraft.world.level.biome.BiomeBase;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.chunk.BiomeStorage;
|
||||
import net.minecraft.world.level.chunk.DataPaletteBlock;
|
||||
import net.minecraft.world.level.levelgen.HeightMap;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
@@ -32,9 +31,9 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
private final boolean[] empty;
|
||||
private final HeightMap hmap; // Height map
|
||||
private final long captureFulltime;
|
||||
private final BiomeStorage biome;
|
||||
private final DataPaletteBlock<BiomeBase>[] biome;
|
||||
|
||||
CraftChunkSnapshot(int x, int z, int minHeight, int maxHeight, String wname, long wtime, DataPaletteBlock<IBlockData>[] sectionBlockIDs, byte[][] sectionSkyLights, byte[][] sectionEmitLights, boolean[] sectionEmpty, HeightMap hmap, BiomeStorage biome) {
|
||||
CraftChunkSnapshot(int x, int z, int minHeight, int maxHeight, String wname, long wtime, DataPaletteBlock<IBlockData>[] sectionBlockIDs, byte[][] sectionSkyLights, byte[][] sectionEmitLights, boolean[] sectionEmpty, HeightMap hmap, DataPaletteBlock<BiomeBase>[] biome) {
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
this.minHeight = minHeight;
|
||||
@@ -70,7 +69,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
|
||||
Predicate<IBlockData> nms = Predicates.equalTo(((CraftBlockData) block).getState());
|
||||
for (DataPaletteBlock<IBlockData> palette : blockids) {
|
||||
if (palette.contains(nms)) {
|
||||
if (palette.maybeHas(nms)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -82,21 +81,21 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
public Material getBlockType(int x, int y, int z) {
|
||||
validateChunkCoordinates(x, y, z);
|
||||
|
||||
return CraftMagicNumbers.getMaterial(blockids[getSectionIndex(y)].a(x, y & 0xF, z).getBlock());
|
||||
return CraftMagicNumbers.getMaterial(blockids[getSectionIndex(y)].get(x, y & 0xF, z).getBlock());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final BlockData getBlockData(int x, int y, int z) {
|
||||
validateChunkCoordinates(x, y, z);
|
||||
|
||||
return CraftBlockData.fromData(blockids[getSectionIndex(y)].a(x, y & 0xF, z));
|
||||
return CraftBlockData.fromData(blockids[getSectionIndex(y)].get(x, y & 0xF, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getData(int x, int y, int z) {
|
||||
validateChunkCoordinates(x, y, z);
|
||||
|
||||
return CraftMagicNumbers.toLegacyData(blockids[getSectionIndex(y)].a(x, y & 0xF, z));
|
||||
return CraftMagicNumbers.toLegacyData(blockids[getSectionIndex(y)].get(x, y & 0xF, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,7 +119,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
Preconditions.checkState(hmap != null, "ChunkSnapshot created without height map. Please call getSnapshot with includeMaxblocky=true");
|
||||
validateChunkCoordinates(x, 0, z);
|
||||
|
||||
return hmap.a(x, z);
|
||||
return hmap.getFirstAvailable(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,7 +132,8 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
Preconditions.checkState(biome != null, "ChunkSnapshot created without biome. Please call getSnapshot with includeBiome=true");
|
||||
validateChunkCoordinates(x, y, z);
|
||||
|
||||
return CraftBlock.biomeBaseToBiome((IRegistry<BiomeBase>) biome.biomeRegistry, biome.getBiome(x >> 2, y >> 2, z >> 2));
|
||||
DataPaletteBlock<BiomeBase> biome = this.biome[getSectionIndex(y)];
|
||||
return CraftBlock.biomeBaseToBiome((IRegistry<BiomeBase>) biome.registry, biome.get(x >> 2, y >> 2, z >> 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,7 +146,8 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
Preconditions.checkState(biome != null, "ChunkSnapshot created without biome. Please call getSnapshot with includeBiome=true");
|
||||
validateChunkCoordinates(x, y, z);
|
||||
|
||||
return biome.getBiome(x >> 2, y >> 2, z >> 2).getAdjustedTemperature(new BlockPosition((this.x << 4) | x, y, (this.z << 4) | z));
|
||||
DataPaletteBlock<BiomeBase> biome = this.biome[getSectionIndex(y)];
|
||||
return biome.get(x >> 2, y >> 2, z >> 2).getTemperature(new BlockPosition((this.x << 4) | x, y, (this.z << 4) | z));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user