Skip to content

Commit

Permalink
improved blooming stems 2
Browse files Browse the repository at this point in the history
  • Loading branch information
NewJumper committed Dec 12, 2024
1 parent 59fa399 commit f3a81e4
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,10 @@ public BlockState getStateForPlacement(BlockPlaceContext context) {
BlockGetter level = context.getLevel();

BlockState belowState = level.getBlockState(pos.below());
BlockState northState = level.getBlockState(pos.north());
BlockState eastState = level.getBlockState(pos.east());
BlockState southState = level.getBlockState(pos.south());
BlockState westState = level.getBlockState(pos.west());
Direction clickedDir = context.getClickedFace();

if(validBase(belowState)) return this.defaultBlockState().setValue(DOWN, true);
return this.defaultBlockState().setValue(NORTH, isStem(northState)).setValue(EAST, isStem(eastState)).setValue(SOUTH, isStem(southState)).setValue(WEST, isStem(westState));
return this.defaultBlockState().setValue(PipeBlock.PROPERTY_BY_DIRECTION.get(clickedDir.getOpposite()), true);
}

@Override
Expand All @@ -89,9 +86,13 @@ public BlockState updateShape(BlockState state, Direction direction, BlockState
return super.updateShape(state, direction, neighborState, level, pos, neighborPos);
}

if(direction == Direction.DOWN && neighborState.is(DDBlocks.BLOOMING_SCULK_STONE.get())) return state.setValue(DOWN, true);
if(direction.getAxis().isHorizontal() && isStem(neighborState) && validBase(level.getBlockState(neighborPos.below()))) return state;
return state.setValue(PipeBlock.PROPERTY_BY_DIRECTION.get(direction), isStem(neighborState));
if(isStem(neighborState) && neighborState.getValue(PipeBlock.PROPERTY_BY_DIRECTION.get(direction.getOpposite()))) {
return state.setValue(PipeBlock.PROPERTY_BY_DIRECTION.get(direction), true);
}
if(!isStem(neighborState)) {
return state.setValue(PipeBlock.PROPERTY_BY_DIRECTION.get(direction), false);
}
return state;
}

@Override
Expand Down

0 comments on commit f3a81e4

Please sign in to comment.