mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 20:11:35 +01:00
Fix schematicannon bedrock breaking with doors, tall flowers and beds
This commit is contained in:
parent
fb7b2e64b2
commit
25bce3fc17
1 changed files with 13 additions and 4 deletions
|
@ -688,9 +688,18 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
|||
}
|
||||
|
||||
protected boolean shouldPlace(BlockPos pos, BlockState state) {
|
||||
if (world == null)
|
||||
return false;
|
||||
BlockState toReplace = world.getBlockState(pos);
|
||||
boolean placingAir = state.getBlock() == Blocks.AIR;
|
||||
|
||||
BlockState toReplaceOther = null;
|
||||
if (state.has(BlockStateProperties.BED_PART) && state.has(BlockStateProperties.HORIZONTAL_FACING) && state.get(BlockStateProperties.BED_PART) == BedPart.FOOT)
|
||||
toReplaceOther = world.getBlockState(pos.offset(state.get(BlockStateProperties.HORIZONTAL_FACING)));
|
||||
if (state.has(BlockStateProperties.DOUBLE_BLOCK_HALF)
|
||||
&& state.get(BlockStateProperties.DOUBLE_BLOCK_HALF) == DoubleBlockHalf.LOWER)
|
||||
toReplaceOther = world.getBlockState(pos.up());
|
||||
|
||||
if (!world.isBlockPresent(pos))
|
||||
return false;
|
||||
if (!world.getWorldBorder()
|
||||
|
@ -698,11 +707,11 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
|||
return false;
|
||||
if (toReplace == state)
|
||||
return false;
|
||||
if (toReplace.getBlockHardness(world, pos) == -1)
|
||||
if (toReplace.getBlockHardness(world, pos) == -1 || (toReplaceOther != null && toReplaceOther.getBlockHardness(world, pos) == -1))
|
||||
return false;
|
||||
if (pos.withinDistance(getPos(), 2f))
|
||||
return false;
|
||||
if (!replaceTileEntities && toReplace.hasTileEntity())
|
||||
if (!replaceTileEntities && (toReplace.hasTileEntity() || (toReplaceOther != null && toReplaceOther.hasTileEntity())))
|
||||
return false;
|
||||
|
||||
if (shouldIgnoreBlockState(state))
|
||||
|
@ -713,10 +722,10 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
|||
if (replaceMode == 2 && !placingAir)
|
||||
return true;
|
||||
if (replaceMode == 1
|
||||
&& (state.isNormalCube(blockReader, pos.subtract(schematicAnchor)) || !toReplace.isNormalCube(world, pos))
|
||||
&& (state.isNormalCube(blockReader, pos.subtract(schematicAnchor)) || (!toReplace.isNormalCube(world, pos) && (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos))))
|
||||
&& !placingAir)
|
||||
return true;
|
||||
if (replaceMode == 0 && !toReplace.isNormalCube(world, pos) && !placingAir)
|
||||
if (replaceMode == 0 && !toReplace.isNormalCube(world, pos) && (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos)) && !placingAir)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue