Skip to content

Commit

Permalink
bug: Fixed some waterloggable blocks not becoming waterlogged when pl…
Browse files Browse the repository at this point in the history
…aced in water
  • Loading branch information
rbasamoyai committed Dec 30, 2024
1 parent f9fbf6e commit ad7734c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ and freedom tastes of reality..."* \
- Fixed Quick-Firing Breech smoke on assembled cannons not persisting
- Fixed Quick-Firing Breech side lever not actually ejecting the contents
- Fixed Quick-Firing Breech accepting input from the sides
- Fixed some waterloggable blocks not becoming waterlogged when placed in water

## [5.7.2] - 2024-12-18

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.DirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
Expand Down Expand Up @@ -42,7 +46,9 @@ public void onRemove(BlockState state, Level level, BlockPos pos, BlockState new

@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
return this.defaultBlockState().setValue(FACING, context.getNearestLookingDirection().getOpposite());
boolean waterlogged = context.getLevel().getFluidState(context.getClickedPos()).getType() == Fluids.WATER;
return this.defaultBlockState().setValue(FACING, context.getNearestLookingDirection().getOpposite())
.setValue(BlockStateProperties.WATERLOGGED, waterlogged);
}

@Override public BlockState rotate(BlockState state, Rotation rotation) { return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt
@Override
@Nullable
public BlockState getStateForPlacement(BlockPlaceContext context) {
return this.defaultBlockState().setValue(AXIS, context.getHorizontalDirection().getAxis());
boolean waterlogged = context.getLevel().getFluidState(context.getClickedPos()).getType() == Fluids.WATER;
return this.defaultBlockState().setValue(AXIS, context.getHorizontalDirection().getAxis())
.setValue(WATERLOGGED, waterlogged);
}

@Override
Expand Down

0 comments on commit ad7734c

Please sign in to comment.