tutorial:waterloggable
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tutorial:waterloggable [2022/01/31 01:04] – created solidblock | tutorial:waterloggable [2023/09/06 08:21] (current) – Fix syntax error drakonkinst | ||
---|---|---|---|
Line 8: | Line 8: | ||
</ | </ | ||
- | In this case, we store the '' | + | In this case, we store the '' |
<code java> | <code java> | ||
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)) { | ||
- | world.getFluidTickScheduler().schedule(pos, | + | |
+ | 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.1643591081.txt.gz · Last modified: 2022/01/31 01:04 by solidblock