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