This commit is contained in:
modmuss50 2017-06-11 21:22:07 +01:00
parent b6cf2a2c59
commit 29cf9fa90b
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
68 changed files with 220 additions and 222 deletions

View file

@ -30,6 +30,7 @@ import minetweaker.api.item.IItemStack;
import minetweaker.api.oredict.IOreDictEntry;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import reborncore.common.util.ItemUtils;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ -38,29 +39,34 @@ import techreborn.api.TechRebornAPI;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ZenClass("mods.techreborn.rollingMachine")
public class CTRollingMachine {
@ZenMethod
public static void addShaped(IItemStack output, IIngredient[][] ingredients) {
TechRebornAPI.addRollingOreMachinceRecipe(toStack(output), toShapedObjects(ingredients));
}
@ZenMethod
public static void addShapeless(IItemStack output, IIngredient[] ingredients) {
TechRebornAPI.addShapelessOreRollingMachinceRecipe(toStack(output), toObjects(ingredients));
}
//TODO 1.12 Crafttweaker
// @ZenMethod
// public static void addShaped(IItemStack output, IIngredient[][] ingredients) {
// TechRebornAPI.addRollingOreMachinceRecipe(toStack(output), toShapedObjects(ingredients));
// }
// @ZenMethod
// public static void addShapeless(IItemStack output, IIngredient[] ingredients) {
// TechRebornAPI.addShapelessOreRollingMachinceRecipe(toStack(output), toObjects(ingredients));
// }
@ZenMethod
public static void removeRecipe(IItemStack output) {
List<IRecipe> toRemove = new ArrayList<>();
for (IRecipe recipe : RollingMachineRecipe.instance.getRecipeList()) {
if (ItemUtils.isItemEqual(recipe.getRecipeOutput(), CraftTweakerCompat.toStack(output), true, false)) {
toRemove.add(recipe);
List<ResourceLocation> toRemove = new ArrayList<>();
for (Map.Entry<ResourceLocation, IRecipe> recipe : RollingMachineRecipe.instance.getRecipeList().entrySet()) {
if (ItemUtils.isItemEqual(recipe.getValue().getRecipeOutput(), CraftTweakerCompat.toStack(output), true, false)) {
toRemove.add(recipe.getKey());
}
}
RollingMachineRecipe.instance.getRecipeList().removeAll(toRemove);
for(ResourceLocation resourceLocation : toRemove){
RollingMachineRecipe.instance.getRecipeList().remove(resourceLocation);
}
}
public static ItemStack toStack(IItemStack iStack) {

View file

@ -26,11 +26,13 @@ package techreborn.compat.jei.rollingMachine;
import mezz.jei.api.IJeiHelpers;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import techreborn.api.RollingMachineRecipe;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class RollingMachineRecipeMaker {
private RollingMachineRecipeMaker() {
@ -41,8 +43,8 @@ public class RollingMachineRecipeMaker {
@Nonnull
IJeiHelpers jeiHelpers) {
List<Object> recipes = new ArrayList<>();
for (IRecipe recipe : RollingMachineRecipe.instance.getRecipeList()) {
RollingMachineRecipeWrapper recipeWrapper = RollingMachineRecipeWrapper.create(jeiHelpers, recipe);
for (Map.Entry<ResourceLocation, IRecipe> recipe : RollingMachineRecipe.instance.getRecipeList().entrySet()) {
RollingMachineRecipeWrapper recipeWrapper = RollingMachineRecipeWrapper.create(jeiHelpers, recipe.getValue());
if (recipeWrapper != null) {
recipes.add(recipeWrapper);
}