Update SlopeTestBlock.java

This commit is contained in:
Meredith Espinosa 2019-06-19 11:47:42 -07:00
parent 07abe31ea4
commit 78e355d7a1

View File

@ -62,11 +62,12 @@ public class SlopeTestBlock extends Block implements BlockEntityProvider {
ItemStack stack = player.getStackInHand(hand); ItemStack stack = player.getStackInHand(hand);
if (stack.getItem() instanceof BlockItem) { if (stack.getItem() instanceof BlockItem) {
Block block = ((BlockItem)stack.getItem()).getBlock(); Block block = ((BlockItem)stack.getItem()).getBlock();
if (block.getDefaultState().getOutlineShape(world, pos) == VoxelShapes.fullCube() && !(block instanceof BlockEntityProvider)) { ItemPlacementContext ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hit));
BlockState placementState = block.getPlacementState(ctx);
if (placementState.getOutlineShape(world, pos) == VoxelShapes.fullCube() && !(block instanceof BlockEntityProvider)) {
SlopeTestEntity be = (SlopeTestEntity) world.getBlockEntity(pos); SlopeTestEntity be = (SlopeTestEntity) world.getBlockEntity(pos);
if (be.getRenderedState().getBlock() == Blocks.AIR) { if (be.getRenderedState().getBlock() == Blocks.AIR) {
ItemPlacementContext ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hit)); be.setRenderedState(placementState);
be.setRenderedState(block.getPlacementState(ctx));
if (!player.abilities.creativeMode) stack.decrement(1); if (!player.abilities.creativeMode) stack.decrement(1);
} }
} }