9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-27 02:49:15 +00:00

fix(block): 压力板移除时正确更新红石信号

This commit is contained in:
jhqwqmc
2025-07-13 15:19:27 +08:00
parent cf2fa2b333
commit 8854d8afc3

View File

@@ -182,6 +182,21 @@ public class PressurePlateBlockBehavior extends BukkitBlockBehavior {
}
}
@Override
public void onRemove(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
Object state = args[0];
Object level = args[1];
Object pos = args[2];
Object newState = args[3];
boolean movedByPiston = (boolean) args[4];
if (!movedByPiston && !FastNMS.INSTANCE.method$BlockStateBase$is(state, FastNMS.INSTANCE.method$BlockState$getBlock(newState))) {
if (this.getSignalForState(state) > 0) {
this.updateNeighbours(level, pos, thisBlock);
}
superMethod.call();
}
}
private void updateNeighbours(Object level, Object pos, Object thisBlock) {
FastNMS.INSTANCE.method$Level$updateNeighborsAt(level, pos, thisBlock);
FastNMS.INSTANCE.method$Level$updateNeighborsAt(level, LocationUtils.below(pos), thisBlock);