When a piston tries to push some blocks, a light block in the way will prevent the push, like obsidian does.
How to reproduce
Build this
[media]
Power the piston
→ ❌ It won't push
Expected result
It pushes through the light block just like air
Linked issues
is duplicated by 2
Attachments
Comments 16
Light blocks in general cannot be pushed or pulled, unlike in bedrock. This doesn't require the additional block.
Code analysis (Mojang mappings, 1.20.2): This is because pistons can't push blocks that are unbreakable (have a destroy time of -1):
net.minecraft.world.level.block.piston.PistonBaseBlock.java
...
public static boolean isPushable(...) {
...
if ($$0.is(Blocks.PISTON) || $$0.is(Blocks.STICKY_PISTON)) {
...
} else {
if ($$0.getDestroySpeed($$1, $$2) == -1.0f) {
return false;
}
...
}
return !$$0.hasBlockEntity();
}
...
Since light blocks have a destroy speed of -1, they can't be pushed. This could be fixed by adding a check for light blocks before:
if (blockState.is(Blocks.LIGHT)) {
return true;
}
This, of course, assumes that light blocks should be able to be pushed by pistons, which is what occurs in Bedrock Edition.
Can confirm. The light block is basically unmovable by pistons. Would make sense if it gets destroyed. On bedrock it can be moved like a normal block. MCPE-59059