Check by setting blocks with BlockBagExtend for changed materials.

Dieser Commit ist enthalten in:
JOO200 2018-12-05 17:09:06 +01:00 committet von IronApollo
Ursprung b276907dcd
Commit 63bf01fdaf

Datei anzeigen

@ -86,18 +86,16 @@ public class BlockBagExtent extends AbstractDelegateExtent {
}
@Override
//<<<<<<< HEAD
public boolean setBlock(BlockVector3 pos, BlockStateHolder block) throws WorldEditException {
return setBlock(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(), block);
}
//=======
// public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
// if (blockBag != null) {
// BlockState existing = getExtent().getBlock(position);
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
@Override
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
if(blockBag != null) {
BlockStateHolder lazyBlock = getExtent().getLazyBlock(x, y, z);
BlockType fromType = lazyBlock.getBlockType();
if(!block.getBlockType().equals(fromType)) {
BlockType type = block.getBlockType();
if (!type.getMaterial().isAir()) {
try {
@ -110,8 +108,7 @@ public class BlockBagExtent extends AbstractDelegateExtent {
}
}
if (mine) {
BlockStateHolder lazyBlock = getExtent().getLazyBlock(x, y, z);
BlockType fromType = lazyBlock.getBlockType();
if (!fromType.getMaterial().isAir()) {
try {
blockBag.storeDroppedBlock(fromType.getDefaultState());
@ -119,6 +116,8 @@ public class BlockBagExtent extends AbstractDelegateExtent {
}
}
}
}
}
return getExtent().setBlock(x, y, z, block);
}