Search in sources :

Example 1 with IMixinBlockCrops

use of com.almuradev.almura.feature.complex.item.almanac.asm.interfaces.IMixinBlockCrops in project Almura by AlmuraDev.

the class IngameFarmersAlmanac method getGrowthStage.

private static Optional<Tuple<Integer, Integer>> getGrowthStage(IBlockState blockState) {
    final Block block = blockState.getBlock();
    if (block instanceof IMixinBlockCrops) {
        final BlockCrops blockCrops = (BlockCrops) block;
        final PropertyInteger ageProperty = ((IMixinBlockCrops) block).getAgePropertyDirect();
        if (blockState.getProperties().containsKey(ageProperty)) {
            return Optional.of(Tuple.of((blockState.getValue(ageProperty)), blockCrops.getMaxAge()));
        }
    }
    return Optional.empty();
}
Also used : BlockCrops(net.minecraft.block.BlockCrops) IMixinBlockCrops(com.almuradev.almura.feature.complex.item.almanac.asm.interfaces.IMixinBlockCrops) PropertyInteger(net.minecraft.block.properties.PropertyInteger) Block(net.minecraft.block.Block) IMixinBlockCrops(com.almuradev.almura.feature.complex.item.almanac.asm.interfaces.IMixinBlockCrops)

Aggregations

IMixinBlockCrops (com.almuradev.almura.feature.complex.item.almanac.asm.interfaces.IMixinBlockCrops)1 Block (net.minecraft.block.Block)1 BlockCrops (net.minecraft.block.BlockCrops)1 PropertyInteger (net.minecraft.block.properties.PropertyInteger)1