use of binnie.genetics.item.ItemSerum in project Binnie by ForestryMC.
the class InoculatorRecipeCategory method setRecipe.
@Override
public void setRecipe(IRecipeLayout recipeLayout, InoculatorRecipeWrapper recipeWrapper, IIngredients ingredients) {
if (!splicer) {
IDrawable tank = GeneticsJeiPlugin.drawables.getTank();
IDrawable tankOverlay = GeneticsJeiPlugin.drawables.getTankOverlay();
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
fluidStacks.init(Inoculator.TANK_VEKTOR, true, 1, 1, 16, 58, 100, false, tankOverlay);
fluidStacks.setBackground(Inoculator.TANK_VEKTOR, tank);
fluidStacks.set(ingredients);
}
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 22, 0);
itemStacks.init(1, true, 42, 21);
itemStacks.init(2, false, 92, 21);
IDrawable slot = GeneticsJeiPlugin.guiHelper.getSlotDrawable();
for (int i = 0; i <= 2; i++) {
itemStacks.setBackground(i, slot);
}
recipeWrapper.setCurrentIngredients(itemStacks.getGuiIngredients());
IFocus<?> focus = recipeLayout.getFocus();
if (focus != null) {
Object focusValue = focus.getValue();
if (focusValue instanceof ItemStack) {
ItemStack focusStack = (ItemStack) focusValue;
if (AlleleManager.alleleRegistry.isIndividual(focusStack)) {
if (focus.getMode() == IFocus.Mode.INPUT) {
ItemStack serum = recipeWrapper.getInputSerum();
ItemStack output = InoculatorLogic.applySerum(focusStack, serum);
itemStacks.set(0, serum);
itemStacks.set(1, focusStack);
itemStacks.set(2, output);
return;
} else if (focus.getMode() == IFocus.Mode.OUTPUT) {
IIndividual individual = AlleleManager.alleleRegistry.getIndividual(focusStack);
if (individual != null) {
ISpeciesRoot speciesRoot = individual.getGenome().getSpeciesRoot();
IAlleleSpecies species = individual.getGenome().getPrimary();
ItemStack serum = ItemSerum.create(new Gene(species, speciesRoot.getSpeciesChromosomeType(), speciesRoot));
// set fully charged
serum.setItemDamage(0);
itemStacks.set(0, serum);
itemStacks.set(1, recipeWrapper.getWildcardTarget());
itemStacks.set(2, focusStack);
return;
}
}
} else if (focusStack.getItem() instanceof ItemSerum) {
ItemStack input = recipeWrapper.getWildcardTarget();
ItemStack output = InoculatorLogic.applySerum(input, focusStack);
itemStacks.set(0, focusStack);
itemStacks.set(1, input);
itemStacks.set(2, output);
return;
}
}
}
itemStacks.set(ingredients);
}
Aggregations