Upstream and debugging changes.

This commit is contained in:
MattBDev
2020-01-02 16:30:44 -05:00
parent 9efdd886c5
commit 0d1e32efcb
16 changed files with 196 additions and 117 deletions

View File

@ -29,7 +29,6 @@ import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.DataException;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -55,11 +54,10 @@ public class AnvilChunk implements Chunk {
/**
* Construct the chunk with a compound tag.
*
* @param world the world to construct the chunk for
* @param tag the tag to read
* @throws DataException on a data error
*/
public AnvilChunk(World world, CompoundTag tag) throws DataException {
public AnvilChunk(CompoundTag tag) throws DataException {
rootTag = tag;
rootX = NBTUtils.getChildTag(rootTag.getValue(), "xPos", IntTag.class).getValue();
@ -261,13 +259,11 @@ public class AnvilChunk implements Chunk {
WorldEdit.logger.warn("Unknown legacy block " + id + ":" + data + " found when loading legacy anvil chunk.");
return BlockTypes.AIR.getDefaultState().toBaseBlock();
}
if (state.getMaterial().hasContainer()) {
CompoundTag tileEntity = getBlockTileEntity(position);
if (tileEntity != null) {
return state.toBaseBlock(tileEntity);
}
}
return state.toBaseBlock();
}

View File

@ -226,9 +226,9 @@ public class AnvilChunk13 implements Chunk {
BlockState[] sectionBlocks = blocks[section];
BlockState state = sectionBlocks != null ? sectionBlocks[(yIndex << 8) | (z << 4) | x] : BlockTypes.AIR.getDefaultState();
if (state.getMaterial().hasContainer()) {
CompoundTag tileEntity = getBlockTileEntity(position);
if (tileEntity != null) {
return state.toBaseBlock(tileEntity);
}

View File

@ -28,7 +28,6 @@ import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.DataException;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -55,11 +54,10 @@ public class OldChunk implements Chunk {
/**
* Construct the chunk with a compound tag.
*
* @param world the world
* @param tag the tag
* @throws DataException
*/
public OldChunk(World world, CompoundTag tag) throws DataException {
public OldChunk(CompoundTag tag) throws DataException {
rootTag = tag;
blocks = NBTUtils.getChildTag(rootTag.getValue(), "Blocks", ByteArrayTag.class).getValue();
@ -185,13 +183,12 @@ public class OldChunk implements Chunk {
WorldEdit.logger.warn("Unknown legacy block " + id + ":" + dataVal + " found when loading legacy anvil chunk.");
return BlockTypes.AIR.getDefaultState().toBaseBlock();
}
if (state.getBlockType().getMaterial().hasContainer()) {
CompoundTag tileEntity = getBlockTileEntity(position);
if (tileEntity != null) {
return state.toBaseBlock(tileEntity);
}
}
return state.toBaseBlock();
}