tutorial:waterloggable
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:waterloggable [2022/03/20 13:39] – solidblock | tutorial:waterloggable [2023/09/06 08:21] (current) – Fix syntax error drakonkinst | ||
---|---|---|---|
Line 17: | Line 17: | ||
public VerticalSlabBlock(Settings settings) { | public VerticalSlabBlock(Settings settings) { | ||
super(settings); | super(settings); | ||
- | setDefaultState(this.stateManager.getDefaultState() | + | setDefaultState(getDefaultState() |
.with(Properties.HORIZONTAL_FACING, | .with(Properties.HORIZONTAL_FACING, | ||
.with(WATERLOGGED, | .with(WATERLOGGED, | ||
Line 24: | Line 24: | ||
// Make the block recognize the property, otherwise setting the property will through exceptions. | // Make the block recognize the property, otherwise setting the property will through exceptions. | ||
@Override | @Override | ||
- | protected void appendProperties(StateManager.Builder< | + | protected void appendProperties(StateManager.Builder< |
- | | + | |
} | } | ||
</ | </ | ||
Line 35: | Line 35: | ||
return (BlockState)this.getDefaultState() | return (BlockState)this.getDefaultState() | ||
.with(Properties.HORIZONTAL_FACING, | .with(Properties.HORIZONTAL_FACING, | ||
- | .with(WATERLOGGED, | + | .with(WATERLOGGED, |
} | } | ||
</ | </ | ||
- | |||
Override '' | Override '' | ||
Line 49: | Line 48: | ||
Override '' | Override '' | ||
- | <code java> | + | <yarncode |
@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, | // This is for 1.17 and below: world.getFluidTickScheduler().schedule(pos, | ||
- | world.createAndScheduleFluidTick(pos, Fluids.WATER, | + | world.method_39281(pos, Fluids.WATER, |
} | } | ||
return super.getStateForNeighborUpdate(state, | return super.getStateForNeighborUpdate(state, | ||
} | } | ||
- | </code> | + | </yarncode> |
Now the block becomes waterloggable, | Now the block becomes waterloggable, |
tutorial/waterloggable.1647783562.txt.gz · Last modified: 2022/03/20 13:39 by solidblock