Search in sources :

Example 1 with IButterflyRoot

use of forestry.api.lepidopterology.IButterflyRoot in project ForestryMC by ForestryMC.

the class EntityButterfly method getPickedResult.

@Override
public ItemStack getPickedResult(RayTraceResult target) {
    if (species == null) {
        return ItemStack.EMPTY;
    }
    IButterflyRoot root = species.getRoot();
    IAllele[] template = root.getTemplate(species);
    IButterfly butterfly = root.templateAsIndividual(template);
    return root.getMemberStack(butterfly, EnumFlutterType.BUTTERFLY);
}
Also used : IAllele(forestry.api.genetics.IAllele) IButterfly(forestry.api.lepidopterology.IButterfly) IButterflyRoot(forestry.api.lepidopterology.IButterflyRoot)

Example 2 with IButterflyRoot

use of forestry.api.lepidopterology.IButterflyRoot in project ForestryMC by ForestryMC.

the class EntityButterfly method processInteract.

/* INTERACTION */
@Override
protected boolean processInteract(EntityPlayer player, EnumHand hand) {
    if (isDead) {
        return false;
    }
    ItemStack stack = player.getHeldItem(hand);
    if ((stack.getItem() instanceof IToolScoop)) {
        if (!world.isRemote) {
            IButterflyRoot root = contained.getGenome().getPrimary().getRoot();
            ILepidopteristTracker tracker = root.getBreedingTracker(world, player.getGameProfile());
            ItemStack itemStack = root.getMemberStack(contained.copy(), EnumFlutterType.BUTTERFLY);
            tracker.registerCatch(contained);
            ItemStackUtil.dropItemStackAsEntity(itemStack, world, posX, posY, posZ);
            setDead();
        } else {
            player.swingArm(hand);
        }
        return true;
    }
    return false;
}
Also used : IButterflyRoot(forestry.api.lepidopterology.IButterflyRoot) ILepidopteristTracker(forestry.api.lepidopterology.ILepidopteristTracker) IToolScoop(forestry.api.core.IToolScoop) ItemStack(net.minecraft.item.ItemStack)

Aggregations

IButterflyRoot (forestry.api.lepidopterology.IButterflyRoot)2 IToolScoop (forestry.api.core.IToolScoop)1 IAllele (forestry.api.genetics.IAllele)1 IButterfly (forestry.api.lepidopterology.IButterfly)1 ILepidopteristTracker (forestry.api.lepidopterology.ILepidopteristTracker)1 ItemStack (net.minecraft.item.ItemStack)1