Skip to content

Commit

Permalink
fixed some blooming stem placement issues
Browse files Browse the repository at this point in the history
  • Loading branch information
NewJumper committed Jan 10, 2025
1 parent f7ba277 commit 031fcf3
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public BlockState getStateForPlacement(BlockPlaceContext context) {
BlockState belowState = level.getBlockState(pos.below());
Direction clickedFace = context.getClickedFace();

if(validBase(belowState)) return this.defaultBlockState().setValue(DOWN, true);
if(validBase(belowState) && clickedFace == Direction.UP) return this.defaultBlockState().setValue(DOWN, true);
return this.defaultBlockState().setValue(PipeBlock.PROPERTY_BY_DIRECTION.get(clickedFace.getOpposite()), true);
}

Expand Down Expand Up @@ -157,12 +157,12 @@ protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, Ran

@Override
public boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) {
if(validBase(level.getBlockState(pos.below()))) return true;
if(validBase(level.getBlockState(pos.below())) && state.getValue(DOWN)) return true;

for(Direction direction : Direction.Plane.HORIZONTAL) {
BlockState adjacent = level.getBlockState(pos.relative(direction));
BlockState belowAdjacent = level.getBlockState(pos.relative(direction).below());
if(isStem(adjacent) && validBase(belowAdjacent) && state.getValue(PipeBlock.PROPERTY_BY_DIRECTION.get(direction))) return true;
if(isStem(adjacent) && validBase(belowAdjacent) && adjacent.getValue(DOWN) && state.getValue(PipeBlock.PROPERTY_BY_DIRECTION.get(direction))) return true;
}

return false;
Expand Down

0 comments on commit 031fcf3

Please sign in to comment.