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);
}
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();
}
}
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;
}
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);
}
}
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);
}
}
}
}
Aggregations