-
Bug
-
Resolution: Fixed
-
Snapshot 13w24b, Snapshot 13w26a, Minecraft 1.6.1, Minecraft 1.6.2, Minecraft 1.6.4, Minecraft 13w36a, Minecraft 13w36b, Minecraft 13w39b, Minecraft 13w41a, Minecraft 13w41b, Minecraft 13w42b, Minecraft 13w43a, Minecraft 1.7, Minecraft 1.7.1, Minecraft 1.7.2, Minecraft 13w48a, Minecraft 13w48b, Minecraft 13w49a, Minecraft 1.7.3, Minecraft 1.7.4, Minecraft 14w02b, Minecraft 14w02c, Minecraft 14w03a, Minecraft 14w05b, Minecraft 14w06b, Minecraft 14w07a, Minecraft 14w08a, Minecraft 1.7.5, Minecraft 14w10b, Minecraft 14w10c, Minecraft 14w11a, Minecraft 14w11b, Minecraft 1.7.9, Minecraft 14w17a, Minecraft 14w18a, Minecraft 14w19a, Minecraft 14w20a, Minecraft 14w20b, Minecraft 14w21b, Minecraft 1.7.10-pre4, Minecraft 14w25b, Minecraft 14w26b, Minecraft 14w26c, Minecraft 1.7.10, Minecraft 14w27a, Minecraft 14w27b, Minecraft 14w28a, Minecraft 14w28b, Minecraft 14w29a, Minecraft 14w30b, Minecraft 14w30c, Minecraft 14w33c, Minecraft 14w34a, Minecraft 14w34b, Minecraft 14w34c, Minecraft 14w34d, Minecraft 1.8-pre1, Minecraft 1.8.7, Minecraft 15w41b, Minecraft 1.10.2, Minecraft 16w41a, Minecraft 16w42a, Minecraft 1.11.2, Minecraft 1.12 Pre-Release 6, Minecraft 1.12, Minecraft 1.12.1, Minecraft 1.12.2
-
Confirmed
The bug
Blocks requiring any support block, like carpets or signs, normally do not drop when the supporting block is moved (see MC-8836 which may be intended), however they do break when the supporting block is the piston head which retracts even though a different block is pulled beneath them.
For carpets this happens as well when the carpet itself is moved because it is on top of an upwards facing piston.
See also the attached video Carpets and signs dropping when supporting piston head retracts.mp4.
How to reproduce
- Place an upwards facing sticky piston
- Place a carpet on top
- Power the piston
→ The carpet drops - Now place a slime block between the piston and carpet
- Power the piston
→ The carpet does not drop as expected
Code analysis
Based on 1.11.2 decompiled using MCP 9.37
The problem is that the methods BlockPistonBase.eventReceived(IBlockState, World, BlockPos, int, int) and BlockPistonBase.doMove(World, BlockPos, EnumFacing, boolean) update neighboring blocks when setting blockstates.
Suggested fix
Note: It would be good if someone familiar with expected piston behavior and their use in farms or slime block machines could verify that this fix solves this problem as expected.
/** * Called on both Client and Server when World#addBlockEvent is called. On the Server, this may perform additional * changes to the world, like pistons replacing the block with an extended base. On the client, the update may * involve replacing tile entities, playing sounds, or performing other visual actions to reflect the server side * changes. */ public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int id, int param) { EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); // ... if (id == 0) { // ... } else if (id == 1) { // ... // Comment: Replaced this // worldIn.setBlockState(pos, Blocks.PISTON_EXTENSION.getDefaultState().withProperty(BlockPistonMoving.FACING, enumfacing).withProperty(BlockPistonMoving.TYPE, this.isSticky ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT), 3); worldIn.setBlockState(pos, Blocks.PISTON_EXTENSION.getDefaultState().withProperty(BlockPistonMoving.FACING, enumfacing).withProperty(BlockPistonMoving.TYPE, this.isSticky ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT), 2); worldIn.setTileEntity(pos, BlockPistonMoving.createTilePiston(this.getStateFromMeta(param), enumfacing, false, true)); if (this.isSticky) { // ... if (!flag1 && iblockstate.getMaterial() != Material.AIR && canPush(iblockstate, worldIn, blockpos, enumfacing.getOpposite(), false) && (iblockstate.getMobilityFlag() == EnumPushReaction.NORMAL || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) { this.doMove(worldIn, pos, enumfacing, false); } // Comment: Added this else { worldIn.setBlockToAir(pos.offset(enumfacing)); } } else { worldIn.setBlockToAir(pos.offset(enumfacing)); } worldIn.playSound((EntityPlayer)null, pos, SoundEvents.BLOCK_PISTON_CONTRACT, SoundCategory.BLOCKS, 0.5F, worldIn.rand.nextFloat() * 0.15F + 0.6F); } return true; }
private boolean doMove(World worldIn, BlockPos pos, EnumFacing direction, boolean extending) { if (!extending) { // Comment: Replaced this // worldIn.setBlockToAir(pos.offset(direction)); worldIn.setBlockState(pos.offset(direction), Blocks.AIR.getDefaultState(), 2); } // ... }
- is duplicated by
-
MC-17971 carpet and sticky pistons
- Resolved
-
MC-17996 carpet destroyed if retract by piston
- Resolved
-
MC-18108 Carpets breaking when pulled down by sticky piston
- Resolved
-
MC-18235 carpets can't move down with sticky pistons
- Resolved
-
MC-18901 Carpet non compadible upward with pistons whilst compadible sideways
- Resolved
-
MC-19403 Carpets can be placed on the rod of sideways pistons, but break when the piston retracts
- Resolved
-
MC-19406 Carpet piston bug
- Resolved
-
MC-23510 Carpets and Sticky Pistons
- Resolved
-
MC-31187 Carpet can be pushed up, but not pulled down
- Resolved
-
MC-71923 Carpets breaks when blocks under them is moved by piston
- Resolved
- relates to
-
MC-8836 Signs and carpet do not drop when the underlying block is moved by piston
- Resolved