use of net.minecraft.world.level.block.state.properties.IntegerProperty in project Tropicraft by Tropicraft.
the class HummingbirdEntity method tryGrowPlant.
private void tryGrowPlant(BlockPos pos) {
BlockState state = level.getBlockState(pos);
IntegerProperty age = getPlantAgeProperty(state);
if (age != null) {
int nextAge = state.getValue(age) + 1;
if (age.getPossibleValues().contains(nextAge)) {
level.levelEvent(LevelEvent.PARTICLES_PLANT_GROWTH, pos, 0);
level.setBlockAndUpdate(pos, state.setValue(age, nextAge));
}
}
}
Aggregations