use of com.verdantartifice.primalmagick.common.blockstates.properties.TimePhase in project PrimalMagick by daedalus4096.
the class AbstractPhasingBlock 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 AbstractPhasingLeavesBlock method updateShape.
@Override
public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) {
// Determine if the blockstate needs to be updated with a new distance
int i = getDistance(facingState) + 1;
if (i != 1 || stateIn.getValue(DISTANCE) != i) {
worldIn.scheduleTick(currentPos, this, 1);
}
// Immediately check to see if the block's phase needs to be updated when one of its neighbors changes
TimePhase newPhase = this.getCurrentPhase(worldIn);
if (newPhase != stateIn.getValue(PHASE)) {
stateIn = stateIn.setValue(PHASE, newPhase);
}
return stateIn;
}
use of com.verdantartifice.primalmagick.common.blockstates.properties.TimePhase in project PrimalMagick by daedalus4096.
the class AbstractPhasingLogBlock 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 AbstractPhasingPillarBlock 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 AbstractPhasingSlabBlock 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