Search in sources :

Example 6 with EnumSoilType

use of binnie.botany.api.gardening.EnumSoilType in project Binnie by ForestryMC.

the class BlockSoil method degrade.

@Override
public boolean degrade(World world, BlockPos pos, EnumSoilType minLevel) {
    EnumSoilType type = getType(world, pos);
    if (type.ordinal() <= minLevel.ordinal()) {
        return false;
    }
    IBlockState old = world.getBlockState(pos);
    IBlockState newState = BotanyCore.getGardening().getSoil(minLevel, weedKilled, old.getValue(MOISTURE), old.getValue(ACIDITY));
    return world.setBlockState(pos, newState, 2);
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) EnumSoilType(binnie.botany.api.gardening.EnumSoilType)

Example 7 with EnumSoilType

use of binnie.botany.api.gardening.EnumSoilType in project Binnie by ForestryMC.

the class TileEntityFlower method checkIfDead.

public boolean checkIfDead(boolean wasCut) {
    if (getSection() != 0) {
        return getRoot().checkIfDead(wasCut);
    }
    EnumSoilType soil = BotanyCore.getGardening().getSoilType(world, pos);
    int maxAge = (int) (flower.getMaxAge() * (1.0f + soil.ordinal() * 0.25f));
    if (flower.getAge() > maxAge) {
        if (!wasCut && flower.getMate() != null) {
            world.setBlockToAir(pos);
            IFlower offspring = flower.getOffspring(world, pos.down());
            TileEntity above = world.getTileEntity(pos.up());
            if (above instanceof TileEntityFlower) {
                world.setBlockToAir(pos.up());
            }
            BotanyCore.getFlowerRoot().plant(world, pos, offspring, getOwner());
        } else {
            kill();
        }
        return true;
    }
    return false;
}
Also used : SPacketUpdateTileEntity(net.minecraft.network.play.server.SPacketUpdateTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) IFlower(binnie.botany.api.genetics.IFlower) EnumSoilType(binnie.botany.api.gardening.EnumSoilType)

Aggregations

EnumSoilType (binnie.botany.api.gardening.EnumSoilType)7 IBlockState (net.minecraft.block.state.IBlockState)3 EnumAcidity (binnie.botany.api.gardening.EnumAcidity)2 IGardeningManager (binnie.botany.api.gardening.IGardeningManager)2 EnumFertiliserType (binnie.botany.api.gardening.EnumFertiliserType)1 EnumMoisture (binnie.botany.api.gardening.EnumMoisture)1 IBlockSoil (binnie.botany.api.gardening.IBlockSoil)1 IFlower (binnie.botany.api.genetics.IFlower)1 Map (java.util.Map)1 ItemStack (net.minecraft.item.ItemStack)1 SPacketUpdateTileEntity (net.minecraft.network.play.server.SPacketUpdateTileEntity)1 TileEntity (net.minecraft.tileentity.TileEntity)1