Search in sources :

Example 1 with IOwnedTile

use of forestry.core.owner.IOwnedTile in project Binnie by ForestryMC.

the class GardenLogic method trySetCrop.

private boolean trySetCrop(World world, BlockPos position, FarmDirection direction, IFarmHousing housing) {
    for (IFarmable farmable : farmables) {
        if (!housing.plantGermling(farmable, world, position, direction)) {
            continue;
        }
        if (housing instanceof IOwnedTile) {
            TileEntity tile = world.getTileEntity(position);
            if (tile instanceof TileEntityFlower) {
                TileEntityFlower flower = (TileEntityFlower) tile;
                IOwnedTile owned = (IOwnedTile) housing;
                flower.setOwner(owned.getOwnerHandler().getOwner());
            }
        }
        return true;
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IFarmable(forestry.api.farming.IFarmable) IOwnedTile(forestry.core.owner.IOwnedTile) TileEntityFlower(binnie.botany.tile.TileEntityFlower)

Aggregations

TileEntityFlower (binnie.botany.tile.TileEntityFlower)1 IFarmable (forestry.api.farming.IFarmable)1 IOwnedTile (forestry.core.owner.IOwnedTile)1 TileEntity (net.minecraft.tileentity.TileEntity)1