use of crazypants.enderio.base.recipe.IRecipe 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.IRecipe 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.IRecipe in project EnderIO by SleepyTrousers.
the class SagMillRecipeManager method addRecipe.
public void addRecipe(@Nonnull Recipe recipe) {
if (!recipe.isValid()) {
Log.debug("Could not add invalid recipe: " + recipe);
return;
}
IRecipe rec = getRecipeForInput(getInput(recipe));
if (rec != null) {
Log.warn("Not adding supplied recipe as a recipe already exists for the input: " + getInput(recipe));
return;
}
recipes.add(recipe);
}
use of crazypants.enderio.base.recipe.IRecipe in project EnderIO by SleepyTrousers.
the class AlloyRecipeCategory method register.
public static void register(IModRegistry registry, IGuiHelper guiHelper) {
registry.addRecipeCategories(new AlloyRecipeCategory(guiHelper));
registry.handleRecipes(IRecipe.class, AlloyRecipe::new, AlloyRecipeCategory.UID);
registry.addRecipeClickArea(GuiAlloySmelter.class, 155, 42, 16, 16, AlloyRecipeCategory.UID);
registry.addRecipeCategoryCraftingItem(new ItemStack(block_alloy_smelter.getBlockNN()), AlloyRecipeCategory.UID, VanillaRecipeCategoryUid.SMELTING);
registry.addRecipeCategoryCraftingItem(new ItemStack(block_simple_alloy_smelter.getBlockNN()), AlloyRecipeCategory.UID);
long start = System.nanoTime();
List<IRecipe> result = new ArrayList<IRecipe>();
for (IManyToOneRecipe rec : AlloyRecipeManager.getInstance().getRecipes()) {
if (!rec.isSynthetic()) {
result.add(rec);
}
}
result.addAll(AlloyRecipeManager.getInstance().getVanillaRecipe().getAllRecipes());
long end = System.nanoTime();
registry.addRecipes(result, UID);
registry.getRecipeTransferRegistry().addRecipeTransferHandler(ContainerAlloySmelter.Normal.class, AlloyRecipeCategory.UID, FIRST_RECIPE_SLOT, NUM_RECIPE_SLOT, FIRST_INVENTORY_SLOT, NUM_INVENTORY_SLOT);
registry.getRecipeTransferRegistry().addRecipeTransferHandler(ContainerAlloySmelter.Simple.class, AlloyRecipeCategory.UID, FIRST_RECIPE_SLOT, NUM_RECIPE_SLOT, FIRST_INVENTORY_SLOT - 1, NUM_INVENTORY_SLOT);
registry.getRecipeTransferRegistry().addRecipeTransferHandler(ContainerAlloySmelter.Normal.class, VanillaRecipeCategoryUid.SMELTING, FIRST_RECIPE_SLOT, NUM_RECIPE_SLOT, FIRST_INVENTORY_SLOT, NUM_INVENTORY_SLOT);
Log.info(String.format("AlloyRecipeCategory: Added %d alloy smelter recipes to JEI in %.3f seconds.", result.size(), (end - start) / 1000000000d));
}
Aggregations