Search in sources :

Example 6 with IFlower

use of binnie.botany.api.genetics.IFlower in project Binnie by ForestryMC.

the class FlowerRoot method addConversion.

@Override
public void addConversion(ItemStack itemstack, IAllele[] template) {
    IFlower flower = getFlower(templateAsGenome(template));
    conversions.put(itemstack, flower);
}
Also used : IFlower(binnie.botany.api.genetics.IFlower)

Example 7 with IFlower

use of binnie.botany.api.genetics.IFlower in project Binnie by ForestryMC.

the class FlowerAlyzerPlugin method drawAnalyticsPage2.

@SideOnly(Side.CLIENT)
@Override
public void drawAnalyticsPage2(GuiScreen gui, ItemStack itemStack) {
    lastTopOffset = 0;
    guiLeft = (gui.width - 246) / 2;
    guiTop = (gui.height - 238) / 2;
    IFlower flower = BotanyAPI.flowerRoot.getMember(itemStack);
    if (flower == null) {
        return;
    }
    for (EnumFlowerChromosome chromosome : secondPageColorChromosome) {
        drawChromosome(gui, chromosome, flower);
        RenderUtil.drawSolidRect(new Area(guiLeft + COLUMN_1, guiTop + lastTopOffset + MARGIN, 50, 10), ((IAlleleInteger) flower.getGenome().getActiveAllele(chromosome)).getValue());
        RenderUtil.drawSolidRect(new Area(guiLeft + COLUMN_2, guiTop + lastTopOffset + MARGIN, 50, 10), ((IAlleleInteger) flower.getGenome().getInactiveAllele(chromosome)).getValue());
        newLine();
    }
    for (EnumFlowerChromosome chromosome : secondPageToleranceChromosome) {
        drawChromosome(gui, chromosome, flower);
        newLine();
    }
}
Also used : Area(binnie.core.gui.geometry.Area) IFlower(binnie.botany.api.genetics.IFlower) EnumFlowerChromosome(binnie.botany.api.genetics.EnumFlowerChromosome) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 8 with IFlower

use of binnie.botany.api.genetics.IFlower in project Binnie by ForestryMC.

the class PigmentRecipe method getCraftingResult.

@Override
public ItemStack getCraftingResult(InventoryCrafting crafting) {
    int n = 0;
    ItemStack stack = ItemStack.EMPTY;
    for (int i = 0; i < crafting.getSizeInventory(); ++i) {
        ItemStack stackInSlot = crafting.getStackInSlot(i);
        if (!stackInSlot.isEmpty()) {
            if (++n > 1) {
                return ItemStack.EMPTY;
            }
            if (BotanyAPI.flowerRoot.isMember(stackInSlot)) {
                IFlower flower = BotanyAPI.flowerRoot.getMember(stackInSlot);
                if (flower != null && flower.getAge() >= 1) {
                    stack = new ItemStack(ModuleCeramic.pigment, 1, flower.getGenome().getPrimaryColor().getID());
                }
            }
        }
    }
    return stack;
}
Also used : IFlower(binnie.botany.api.genetics.IFlower) ItemStack(net.minecraft.item.ItemStack)

Example 9 with IFlower

use of binnie.botany.api.genetics.IFlower in project Binnie by ForestryMC.

the class ModuleFlowers method onPlantVanilla.

@Deprecated
public void onPlantVanilla(PlayerInteractEvent.RightClickBlock event) {
    BlockPos pos = event.getPos();
    World world = event.getWorld();
    EntityPlayer player = event.getEntityPlayer();
    ItemStack heldItem = player.getHeldItemMainhand();
    if (event.getWorld().isRemote) {
        return;
    }
    if (heldItem.isEmpty()) {
        return;
    }
    Block block = world.getBlockState(pos).getBlock();
    int py = -1;
    if (block instanceof IBlockSoil && (world.isAirBlock(pos.up()) || block.isReplaceable(world, pos))) {
        py = 1;
    }
    if (py < 0) {
        return;
    }
    IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
    IFlower flower = flowerRoot.getConversion(heldItem);
    if (flower != null && flowerRoot.plant(world, pos.add(0, py, 0), flower, player.getGameProfile()) && !player.capabilities.isCreativeMode) {
        heldItem.shrink(1);
    }
}
Also used : IBlockSoil(binnie.botany.api.gardening.IBlockSoil) IFlower(binnie.botany.api.genetics.IFlower) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Block(net.minecraft.block.Block) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World) ItemStack(net.minecraft.item.ItemStack) IFlowerRoot(binnie.botany.api.genetics.IFlowerRoot)

Example 10 with IFlower

use of binnie.botany.api.genetics.IFlower in project Binnie by ForestryMC.

the class ModuleFlowers method onShearFlower.

@SubscribeEvent
public void onShearFlower(PlayerInteractEvent.RightClickBlock event) {
    EntityPlayer player = event.getEntityPlayer();
    if (player == null) {
        return;
    }
    ItemStack heldItem = player.getHeldItemMainhand();
    if (heldItem.isEmpty()) {
        return;
    }
    TileEntity tile = event.getWorld().getTileEntity(event.getPos());
    if (!(tile instanceof TileEntityFlower)) {
        return;
    }
    TileEntityFlower flower = (TileEntityFlower) tile;
    if (heldItem.getItem() == Items.SHEARS) {
        flower.onShear();
        heldItem.damageItem(1, player);
    } else if (heldItem.getItem() == pollen) {
        IFlower pollen = BotanyCore.getFlowerRoot().getMember(heldItem);
        if (pollen != null && flower.canMateWith(pollen)) {
            flower.mateWith(pollen);
            if (!player.capabilities.isCreativeMode) {
                heldItem.shrink(1);
            }
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IFlower(binnie.botany.api.genetics.IFlower) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) TileEntityFlower(binnie.botany.tile.TileEntityFlower) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

IFlower (binnie.botany.api.genetics.IFlower)24 ItemStack (net.minecraft.item.ItemStack)10 IFlowerRoot (binnie.botany.api.genetics.IFlowerRoot)6 TileEntity (net.minecraft.tileentity.TileEntity)6 IFlowerGenome (binnie.botany.api.genetics.IFlowerGenome)5 TileEntityFlower (binnie.botany.tile.TileEntityFlower)5 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4 Block (net.minecraft.block.Block)3 BlockPos (net.minecraft.util.math.BlockPos)3 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)3 EnumFlowerChromosome (binnie.botany.api.genetics.EnumFlowerChromosome)2 IAlleleFlowerSpecies (binnie.botany.api.genetics.IAlleleFlowerSpecies)2 Area (binnie.core.gui.geometry.Area)2 World (net.minecraft.world.World)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 EnumSoilType (binnie.botany.api.gardening.EnumSoilType)1 IBlockSoil (binnie.botany.api.gardening.IBlockSoil)1 FlowerRenderInfo (binnie.botany.tile.FlowerRenderInfo)1 ControlText (binnie.core.gui.controls.ControlText)1