Search in sources :

Example 1 with IntegerProperty

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));
        }
    }
}
Also used : IntegerProperty(net.minecraft.world.level.block.state.properties.IntegerProperty) BlockState(net.minecraft.world.level.block.state.BlockState)

Aggregations

BlockState (net.minecraft.world.level.block.state.BlockState)1 IntegerProperty (net.minecraft.world.level.block.state.properties.IntegerProperty)1