Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,20 @@ protected int getCurrentHeight(Level world, BlockPos pos) {

return count;
}

@Override
public void destroy(LevelAccessor world, BlockPos pos, BlockState state) {
var roof = BlockReference.of(world, pos.above());

if (roof.isOf(this)) {
roof.setProperty(LIFE_STAGE, getLowestLifeStage(world, pos.below(), state.getValue(LIFE_STAGE)));
roof.update(world);
}

scheduleBreakCheck(world, pos);

@Override
protected void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean movedByPiston) {
if (!state.is(newState.getBlock())) {
var roof = BlockReference.of(level, pos.above());

if (roof.isOf(this)) {
roof.setProperty(LIFE_STAGE, getLowestLifeStage(level, pos.below(), state.getValue(LIFE_STAGE)));
roof.update(level);
}

scheduleBreakCheck(level, pos);
}
super.onRemove(state, level, pos, newState, movedByPiston);
}

public LifeStage getLowestLifeStage(LevelAccessor world, BlockPos pos, LifeStage stage) {
Expand Down