tutorial:waterloggable
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| tutorial:waterloggable [2024/08/24 14:23] – upadte code solidblock | tutorial:waterloggable [2024/10/27 14:25] (current) – update solidblock | ||
|---|---|---|---|
| Line 48: | Line 48: | ||
| Override '' | Override '' | ||
| + | |||
| + | //For versions 1.21.1 and below, write like this:// | ||
| < | < | ||
| @Override | @Override | ||
| public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, | public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, | ||
| if (state.get(WATERLOGGED)) { | if (state.get(WATERLOGGED)) { | ||
| - | // This is for 1.17 and below: world.getFluidTickScheduler().schedule(pos, | + | // For 1.17 and below: |
| + | // world.getFluidTickScheduler().schedule(pos, | ||
| + | // For versions since 1.18 below 1.21.2: | ||
| world.method_39281(pos, | world.method_39281(pos, | ||
| } | } | ||
| return super.getStateForNeighborUpdate(state, | return super.getStateForNeighborUpdate(state, | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | //For versions 1.21.2 and above, write like this:// | ||
| + | < | ||
| + | @Override | ||
| + | public BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, | ||
| + | if (state.get(WATERLOGGED)) { | ||
| + | // For versions since 1.21.2: | ||
| + | tickView.scheduleFluidTick(pos, | ||
| + | } | ||
| + | |||
| + | return super.getStateForNeighborUpdate(state, | ||
| } | } | ||
| </ | </ | ||
| Now the block becomes waterloggable, | Now the block becomes waterloggable, | ||
tutorial/waterloggable.1724509436.txt.gz · Last modified: 2024/08/24 14:23 by solidblock