use of crazypants.enderio.base.recipe.RecipeOutput in project EnderIO by SleepyTrousers.
the class RecipeWrapper method getIngredients.
@Override
public void getIngredients(@Nonnull IIngredients ingredients) {
List<List<ItemStack>> inputStacks = recipe.getInputStackAlternatives();
ingredients.setInputLists(ItemStack.class, inputStacks);
List<ItemStack> outputs = new ArrayList<ItemStack>();
for (RecipeOutput out : recipe.getOutputs()) {
if (Prep.isValid(out.getOutput())) {
outputs.add(out.getOutput());
}
}
ingredients.setOutputs(ItemStack.class, outputs);
List<FluidStack> inputFluidStacks = recipe.getInputFluidStacks();
if (inputFluidStacks != null) {
ingredients.setInputs(FluidStack.class, inputFluidStacks);
}
List<FluidStack> fluidOutputs = new ArrayList<FluidStack>();
for (RecipeOutput out : recipe.getOutputs()) {
if (out.getFluidOutput() != null) {
fluidOutputs.add(out.getFluidOutput());
}
}
ingredients.setOutputs(FluidStack.class, fluidOutputs);
}
use of crazypants.enderio.base.recipe.RecipeOutput in project EnderIO by SleepyTrousers.
the class Sagmilling method register.
@Override
public void register(@Nonnull String recipeName) {
if (isValid() && isActive()) {
ThingsRecipeInput recipeInput = new ThingsRecipeInput(input.getThing());
NNList<RecipeOutput> recipeOutputs = new NNList<>();
for (Output output : getOutputs()) {
if (output instanceof OutputWithChance) {
recipeOutputs.add(new RecipeOutput(output.getItemStack(), ((OutputWithChance) output).getChance()));
} else {
recipeOutputs.add(new RecipeOutput(output.getItemStack(), 1));
}
}
Recipe recipe = new Recipe(recipeInput, energy, bonus, recipeOutputs.toArray(new RecipeOutput[0]));
SagMillRecipeManager.getInstance().addRecipe(recipe);
}
}
use of crazypants.enderio.base.recipe.RecipeOutput in project EnderIO by SleepyTrousers.
the class VanillaSmeltingRecipe method getAllRecipes.
public List<IRecipe> getAllRecipes() {
List<IRecipe> result = new ArrayList<IRecipe>();
Map<ItemStack, ItemStack> metaList = FurnaceRecipes.instance().getSmeltingList();
for (Entry<ItemStack, ItemStack> entry : metaList.entrySet()) {
ItemStack output = entry.getValue();
int stackSize = output.getCount();
output.setCount(stackSize);
final ItemStack key = NullHelper.notnullM(entry.getKey(), "null item stack in furnace recipes");
result.add(new Recipe(new RecipeInput(key), RF_PER_ITEM, RecipeBonusType.NONE, new RecipeOutput(output)));
}
return result;
}
use of crazypants.enderio.base.recipe.RecipeOutput in project EnderIO by SleepyTrousers.
the class VatRecipeManager method getMultiplierForInput.
public float getMultiplierForInput(Fluid inputFluid, @Nonnull ItemStack input, Fluid output) {
if (Prep.isValid(input) || output != null) {
for (IRecipe recipe : recipes) {
RecipeOutput out = recipe.getOutputs()[0];
IRecipeInput in = recipe.getInputs()[recipe.getInputs().length - 1];
final FluidStack fluidOutput = out.getFluidOutput();
if ((inputFluid == null || FluidUtil.areFluidsTheSame(in.getFluidInput().getFluid(), inputFluid) && (output == null || (fluidOutput != null && FluidUtil.areFluidsTheSame(fluidOutput.getFluid(), output))))) {
for (IRecipeInput ri : recipe.getInputs()) {
if (ri.isInput(input)) {
return ri.getMulitplier();
}
}
}
}
}
// no fluid or not an input for this fluid: best guess
// (after all, the item IS in the input slot)
float found = -1f;
for (IRecipe recipe : recipes) {
for (IRecipeInput ri : recipe.getInputs()) {
if (ri.isInput(input)) {
if (found < 0f || found > ri.getMulitplier()) {
found = ri.getMulitplier();
}
}
}
}
return found > 0 ? found : 0;
}
use of crazypants.enderio.base.recipe.RecipeOutput in project EnderIO by SleepyTrousers.
the class SagMillRecipeCategory method setRecipe.
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull SagRecipe recipeWrapper, @Nonnull IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.addTooltipCallback(this);
IGuiIngredientGroup<EnergyIngredient> group = recipeLayout.getIngredientsGroup(EnergyIngredient.class);
guiItemStacks.init(0, true, 79 - xOff, 11 - yOff);
guiItemStacks.init(1, false, 48 - xOff, 58 - yOff);
guiItemStacks.init(2, false, 69 - xOff, 58 - yOff);
guiItemStacks.init(3, false, 90 - xOff, 58 - yOff);
guiItemStacks.init(4, false, 111 - xOff, 58 - yOff);
guiItemStacks.init(5, true, 121 - xOff, 22 - yOff);
group.init(6, true, EnergyIngredientRenderer.INSTANCE, 134 - xOff, 58 - yOff, 60, 10, 0, 0);
guiItemStacks.addTooltipCallback(new ITooltipCallback<ItemStack>() {
@Override
public void onTooltip(int slotIndex, boolean input, @Nonnull ItemStack ingredient, @Nonnull List<String> tooltip) {
switch(slotIndex) {
case 1:
case 2:
case 3:
case 4:
if (slotIndex <= recipeWrapper.getRecipe().getOutputs().length) {
RecipeOutput output = recipeWrapper.getRecipe().getOutputs()[slotIndex - 1];
float chance = output.getChance();
if (chance > 0 && chance < 1) {
int chanceInt = (int) (chance * 100);
Object[] objects = { chanceInt };
tooltip.add(TextFormatting.GRAY + MessageFormat.format(Lang.JEI_SAGMILL_CHANCE.get(), objects));
}
}
return;
case 5:
if (ballsTT.shouldHandleItem(ingredient)) {
ballsTT.addDetailedEntries(ingredient, Minecraft.getMinecraft().player, tooltip, true);
}
return;
default:
return;
}
}
});
guiItemStacks.set(ingredients);
group.set(ingredients);
}
Aggregations