use of com.verdantartifice.primalmagick.common.blockstates.properties.TimePhase in project PrimalMagick by daedalus4096.
the class AbstractPhasingStairsBlock method updateShape.
@Override
public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) {
// Immediately check to see if the block's phase needs to be updated when one of its neighbors changes
BlockState state = super.updateShape(stateIn, facing, facingState, worldIn, currentPos, facingPos);
TimePhase newPhase = this.getCurrentPhase(worldIn);
if (newPhase != state.getValue(PHASE)) {
state = state.setValue(PHASE, newPhase);
}
return state;
}
use of com.verdantartifice.primalmagick.common.blockstates.properties.TimePhase in project PrimalMagick by daedalus4096.
the class AbstractPhasingBlock method updateShape.
@SuppressWarnings("deprecation")
@Override
public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) {
// Immediately check to see if the block's phase needs to be updated when one of its neighbors changes
BlockState state = super.updateShape(stateIn, facing, facingState, worldIn, currentPos, facingPos);
TimePhase newPhase = this.getCurrentPhase(worldIn);
if (newPhase != state.getValue(PHASE)) {
state = state.setValue(PHASE, newPhase);
}
return state;
}
use of com.verdantartifice.primalmagick.common.blockstates.properties.TimePhase in project PrimalMagick by daedalus4096.
the class AbstractPhasingLeavesBlock method randomTick.
@Override
public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, Random random) {
// Remove the leaves if too far from a log
if (!state.getValue(PERSISTENT) && state.getValue(DISTANCE) == 7) {
dropResources(state, worldIn, pos);
worldIn.removeBlock(pos, false);
}
// Periodically check to see if the block's phase needs to be updated
TimePhase newPhase = this.getCurrentPhase(worldIn);
if (newPhase != state.getValue(PHASE)) {
worldIn.setBlock(pos, state.setValue(PHASE, newPhase), Block.UPDATE_ALL);
}
}
use of com.verdantartifice.primalmagick.common.blockstates.properties.TimePhase in project PrimalMagick by daedalus4096.
the class AbstractPhasingLogBlock method randomTick.
@SuppressWarnings("deprecation")
@Override
public void randomTick(BlockState state, ServerLevel worldIn, BlockPos pos, Random random) {
// Periodically check to see if the block's phase needs to be updated
super.randomTick(state, worldIn, pos, random);
TimePhase newPhase = this.getCurrentPhase(worldIn);
if (newPhase != state.getValue(PHASE)) {
worldIn.setBlock(pos, state.setValue(PHASE, newPhase), Block.UPDATE_ALL);
}
}
use of com.verdantartifice.primalmagick.common.blockstates.properties.TimePhase in project PrimalMagick by daedalus4096.
the class AbstractPhasingPillarBlock method updateShape.
@Override
public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) {
// Immediately check to see if the block's phase needs to be updated when one of its neighbors changes
BlockState state = super.updateShape(stateIn, facing, facingState, worldIn, currentPos, facingPos);
TimePhase newPhase = this.getCurrentPhase(worldIn);
if (newPhase != state.getValue(PHASE)) {
state = state.setValue(PHASE, newPhase);
}
return state;
}
Aggregations