More verbosely get block data and ensure biome layer isn't null

This commit is contained in:
dordsor21 2021-12-21 18:00:09 +00:00
parent 9ec829eddf
commit 28f3bc61ea
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
3 changed files with 15 additions and 2 deletions

View File

@ -243,7 +243,12 @@ public final class PaperweightFaweAdapter extends CachedBukkitAdapter implements
LevelChunk chunk = handle.getChunk(x >> 4, z >> 4); LevelChunk chunk = handle.getChunk(x >> 4, z >> 4);
final BlockPos blockPos = new BlockPos(x, y, z); final BlockPos blockPos = new BlockPos(x, y, z);
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(blockPos); final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(blockPos);
return adapt(blockData); BlockState state = adapt(blockData);
if (state == null) {
org.bukkit.block.Block bukkitBlock = location.getBlock();
state = BukkitAdapter.adapt(bukkitBlock.getBlockData());
}
return state;
} }
@Override @Override

View File

@ -553,6 +553,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
copy.storeBiomes(currentBiomes); copy.storeBiomes(currentBiomes);
} }
for (int layer = 0; layer < 16; layer++) { for (int layer = 0; layer < 16; layer++) {
if (biomes[layer] == null) {
continue;
}
for (int y = 0, i = 0; y < 4; y++) { for (int y = 0, i = 0; y < 4; y++) {
for (int z = 0; z < 4; z++) { for (int z = 0; z < 4; z++) {
for (int x = 0; x < 4; x++, i++) { for (int x = 0; x < 4; x++, i++) {

View File

@ -242,7 +242,12 @@ public final class PaperweightFaweAdapter extends CachedBukkitAdapter implements
LevelChunk chunk = handle.getChunk(x >> 4, z >> 4); LevelChunk chunk = handle.getChunk(x >> 4, z >> 4);
final BlockPos blockPos = new BlockPos(x, y, z); final BlockPos blockPos = new BlockPos(x, y, z);
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(blockPos); final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(blockPos);
return adapt(blockData); BlockState state = adapt(blockData);
if (state == null) {
org.bukkit.block.Block bukkitBlock = location.getBlock();
state = BukkitAdapter.adapt(bukkitBlock.getBlockData());
}
return state;
} }
@Override @Override