Search in sources :

Example 21 with IBee

use of forestry.api.apiculture.IBee in project ForestryMC by ForestryMC.

the class Bee method spawnDrones.

@Override
public List<IBee> spawnDrones(IBeeHousing housing) {
    World world = housing.getWorldObj();
    // We need a mated queen to produce offspring.
    if (mate == null) {
        return Collections.emptyList();
    }
    List<IBee> bees = new ArrayList<>();
    BlockPos housingPos = housing.getCoordinates();
    int toCreate = BeeManager.beeRoot.getBeekeepingMode(world).getFinalFertility(this, world, housingPos);
    if (toCreate <= 0) {
        toCreate = 1;
    }
    for (int i = 0; i < toCreate; i++) {
        IBee offspring = createOffspring(housing, mate, 0);
        offspring.setIsNatural(true);
        bees.add(offspring);
    }
    return bees;
}
Also used : ArrayList(java.util.ArrayList) BlockPos(net.minecraft.util.math.BlockPos) IBee(forestry.api.apiculture.IBee) World(net.minecraft.world.World)

Example 22 with IBee

use of forestry.api.apiculture.IBee in project ForestryMC by ForestryMC.

the class BeeAlyzerPlugin method drawAnalyticsPage3.

@SideOnly(Side.CLIENT)
@Override
public void drawAnalyticsPage3(GuiScreen gui, ItemStack itemStack) {
    if (gui instanceof GuiAlyzer) {
        GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
        IBee bee = BeeManager.beeRoot.getMember(itemStack);
        if (bee == null) {
            return;
        }
        TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
        WidgetManager widgetManager = guiAlyzer.getWidgetManager();
        textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
        textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.produce") + ":", GuiAlyzer.COLUMN_0);
        textLayout.newLine();
        int x = GuiAlyzer.COLUMN_0;
        for (ItemStack stack : bee.getProduceList()) {
            widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
            x += 18;
            if (x > 148) {
                x = GuiAlyzer.COLUMN_0;
                textLayout.newLine();
            }
        }
        textLayout.newLine();
        textLayout.newLine();
        textLayout.newLine();
        textLayout.newLine();
        textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.specialty") + ":", GuiAlyzer.COLUMN_0);
        textLayout.newLine();
        x = GuiAlyzer.COLUMN_0;
        for (ItemStack stack : bee.getSpecialtyList()) {
            widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
            x += 18;
            if (x > 148) {
                x = GuiAlyzer.COLUMN_0;
                textLayout.newLine();
            }
        }
        textLayout.endPage();
    }
}
Also used : TextLayoutHelper(forestry.core.gui.TextLayoutHelper) ItemStackWidget(forestry.core.gui.widgets.ItemStackWidget) WidgetManager(forestry.core.gui.widgets.WidgetManager) IBee(forestry.api.apiculture.IBee) GuiAlyzer(forestry.core.gui.GuiAlyzer) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 23 with IBee

use of forestry.api.apiculture.IBee in project ForestryMC by ForestryMC.

the class BeeRoot method registerTemplate.

@Override
public void registerTemplate(String identifier, IAllele[] template) {
    IBeeGenome beeGenome = BeeManager.beeRoot.templateAsGenome(template);
    IBee bee = new Bee(beeGenome);
    beeTemplates.add(bee);
    speciesTemplates.put(identifier, template);
}
Also used : IBee(forestry.api.apiculture.IBee) IBee(forestry.api.apiculture.IBee) IBeeGenome(forestry.api.apiculture.IBeeGenome)

Example 24 with IBee

use of forestry.api.apiculture.IBee in project ForestryMC by ForestryMC.

the class WorldgenBeekeepingLogic method doBeeFX.

@Override
@SideOnly(Side.CLIENT)
public void doBeeFX() {
    IBee queen = housing.getContainedBee();
    queen.doFX(effectData, housing);
}
Also used : IBee(forestry.api.apiculture.IBee) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 25 with IBee

use of forestry.api.apiculture.IBee in project ForestryMC by ForestryMC.

the class Bee method mate.

@Override
public void mate(IIndividual individual) {
    if (!(individual instanceof IBee)) {
        return;
    }
    IBee drone = (IBee) individual;
    mate = drone.getGenome();
}
Also used : IBee(forestry.api.apiculture.IBee)

Aggregations

IBee (forestry.api.apiculture.IBee)33 ItemStack (net.minecraft.item.ItemStack)17 IBeeGenome (forestry.api.apiculture.IBeeGenome)7 EnumBeeType (forestry.api.apiculture.EnumBeeType)6 World (net.minecraft.world.World)6 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)5 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)4 IBeeHousingInventory (forestry.api.apiculture.IBeeHousingInventory)3 IBeeRoot (forestry.api.apiculture.IBeeRoot)3 IAllele (forestry.api.genetics.IAllele)3 GuiAlyzer (forestry.core.gui.GuiAlyzer)3 TextLayoutHelper (forestry.core.gui.TextLayoutHelper)3 ArrayList (java.util.ArrayList)3 IBeekeepingMode (forestry.api.apiculture.IBeekeepingMode)2 IHiveDrop (forestry.api.apiculture.IHiveDrop)2 IHiveFrame (forestry.api.apiculture.IHiveFrame)2 IChromosome (forestry.api.genetics.IChromosome)2 Random (java.util.Random)2 Item (net.minecraft.item.Item)2 IncubatorRecipe (binnie.genetics.machine.incubator.IncubatorRecipe)1