diff --git a/build.gradle b/build.gradle index 0ce06aa7e..e60149b4c 100644 --- a/build.gradle +++ b/build.gradle @@ -83,6 +83,10 @@ repositories { name = "mobiusstrip" url = "http://default.mobiusstrip.eu/maven/" } + ivy { + name 'MineTweaker3' + artifactPattern "http://minetweaker3.powerofbytes.com/download/[module]-[classifier]-[revision].[ext]" + } } dependencies { @@ -90,6 +94,7 @@ dependencies { shade "org.jetbrains.kotlin:kotlin-runtime:$kotlin_version" shade "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "mcp.mobius.waila:Waila:1.5.11-RC2-NONEI_1.7.10:dev" + compile name: 'MineTweaker3', version: '1.7.10-3.0.10B', classifier: 'Dev', ext: 'jar' } jar { diff --git a/src/main/java/mods/eln/Eln.java b/src/main/java/mods/eln/Eln.java index e277dc5fe..c06ec03d5 100644 --- a/src/main/java/mods/eln/Eln.java +++ b/src/main/java/mods/eln/Eln.java @@ -10,6 +10,9 @@ import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; +import mods.eln.api.Utilities; +import mods.eln.api.recipe.Recipe; +import mods.eln.api.recipe.RecipesList; import mods.eln.cable.CableRenderDescriptor; import mods.eln.client.ClientKeyHandler; import mods.eln.client.SoundLoader; @@ -25,6 +28,7 @@ import mods.eln.ghost.GhostManagerNbt; import mods.eln.gridnode.electricalpole.ElectricalPoleDescriptor; import mods.eln.i18n.I18N; +import mods.eln.integration.minetweaker.MinetweakerIntegration; import mods.eln.item.*; import mods.eln.item.electricalinterface.ItemEnergyInventoryProcess; import mods.eln.item.electricalitem.*; @@ -941,7 +945,7 @@ private boolean recipeExists(ItemStack stack) { IRecipe r = (IRecipe) o; if (r.getRecipeOutput() == null) continue; - if (Utils.areSame(stack, r.getRecipeOutput())) + if (Utilities.areSame(stack, r.getRecipeOutput())) return true; } } @@ -956,7 +960,10 @@ private boolean recipeExists(ItemStack stack) { public void postInit(FMLPostInitializationEvent event) { serverEventListener = new ServerEventListener(); - + + if(Loader.isModLoaded("MineTweaker3")){ + MinetweakerIntegration.INSTANCE.initialize(); + } } /* diff --git a/src/main/java/mods/eln/api/Fuel.java b/src/main/java/mods/eln/api/Fuel.java new file mode 100644 index 000000000..95fddc041 --- /dev/null +++ b/src/main/java/mods/eln/api/Fuel.java @@ -0,0 +1,118 @@ +package mods.eln.api; + +import cpw.mods.fml.common.FMLLog; +import net.minecraft.item.ItemStack; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.Map; + +public class Fuel { + /** + * Gives the energy equivalent of a fuel in J. Returns 0 if the item cannot be burned. + * @param fuel The ItemStack of fuel to determine the energy equivalent of. + * @return fuel's energy equivalent in J. + */ + public static double getEnergyEquivalent(ItemStack fuel){ + try { + Class c = Class.forName("mods.eln.misc.Utils"); + Method energy = c.getDeclaredMethod("getItemEnergie", ItemStack.class); + return Double.valueOf(energy.invoke(c, fuel).toString()); + } + catch(ClassNotFoundException e){ + FMLLog.warning("ELN isn't loaded. Someone just tried to use its API."); + e.printStackTrace(); + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + e.printStackTrace(); + } + return 0; + } + + /** + * Add a fuel to the gasoline fuels list (turbine and fuel generator). + * @param name The name of the fuel in the fuel registry + * @param heatingValue The energy for 1L of the fuel + * @return true if the addition succeeded, false otherwise. + */ + public static boolean addGasolineFuel(String name, Double heatingValue) { + try { + Class FuelRegistry = Class.forName("mods.eln.fluid.FuelRegistry"); + Field gasolineList = FuelRegistry.getDeclaredField("gasolineList"); + Utilities.makeModifiable(gasolineList); + String[] gasolineArray = ((String[]) gasolineList.get(null)); + String[] newArray = Arrays.copyOf(gasolineArray, gasolineArray.length + 1); + newArray[newArray.length - 1] = name; + gasolineList.set(null, newArray); + + Field gasolineFuels = FuelRegistry.getDeclaredField("gasolineFuels"); + Utilities.makeModifiable(gasolineFuels); + Map gasolineMap = (Map) gasolineFuels.get(null); + gasolineMap.put(name, heatingValue); + return true; + } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + return false; + } + + /** + * Add a fuel to the gas fuels list (gas turbine). + * @param name The name of the fuel in the fuel registry + * @param heatingValue The energy of the fuel in MJ per cubic meter + * @return true if the addition succeeded, false otherwise. + */ + public static boolean addGasFuel(String name, Double heatingValue) { + try { + Class FuelRegistry = Class.forName("mods.eln.fluid.FuelRegistry"); + Field gasList = FuelRegistry.getDeclaredField("gasList"); + Utilities.makeModifiable(gasList); + String[] gasArray = (String[]) gasList.get(null); + String[] newList = Arrays.copyOf(gasArray, gasArray.length + 1); + newList[newList.length - 1] = name; + gasList.set(null, newList); + + Field gasFuels = FuelRegistry.getDeclaredField("gasFuels"); + Utilities.makeModifiable(gasFuels); + Map gasMap = (Map) gasFuels.get(null); + gasMap.put(name, heatingValue); + gasFuels.set(null, gasMap); + return true; + } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + return false; + } + + + /** + * Add a fuel to the diesels list. + * @param name The name of the fuel in the fuel registry + * @param heatingValue Energy for 1L of the fuel + * @return true if the addition succeeded, false otherwise. + */ + public static boolean addDieselFuel(String name, Double heatingValue) { + try { + Class FuelRegistry = Class.forName("mods.eln.fluid.FuelRegistry"); + Field dieselFuels = FuelRegistry.getDeclaredField("dieselFuels"); + Utilities.makeModifiable(dieselFuels); + Map dieselMap = (Map) dieselFuels.get(null); + dieselMap.put(name, heatingValue); + dieselFuels.set(null, dieselMap); + + Field dieselList = FuelRegistry.getDeclaredField("dieselList"); + Utilities.makeModifiable(dieselList); + String[] dieselArray = (String[]) dieselList.get(null); + String[] newList = Arrays.copyOf(dieselArray, dieselArray.length + 1); + newList[newList.length - 1] = name; + dieselList.set(null, newList); + return true; + } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + + return false; + } + +} diff --git a/src/main/java/mods/eln/api/Misc.java b/src/main/java/mods/eln/api/Misc.java new file mode 100644 index 000000000..0da460baf --- /dev/null +++ b/src/main/java/mods/eln/api/Misc.java @@ -0,0 +1,48 @@ +package mods.eln.api; + +import java.lang.reflect.Field; + +/** + * Created by Gregory Maddra on 2016-11-16. + */ +public class Misc { + + public static Object getRecipeList(String list){ + try { + Class Eln = getEln(); + Object instanceObject = getElnInstance(Eln); + Field recipeList = Eln.getDeclaredField(list); + recipeList.setAccessible(true); + return Eln != null ? recipeList.get(instanceObject) : null; + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + return null; + } + + public static Double getElectricalFurnaceProcessEnergyNeededPerSmelt(){ + try { + Class ElectricalFurnaceProcess = Class.forName("mods.eln.transparentnode.electricalfurnace.ElectricalFurnaceProcess"); + return ElectricalFurnaceProcess.getDeclaredField("energyNeededPerSmelt").getDouble(null); + } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + return 0D; + } + + public static Class getEln(){ + try { + return Class.forName("mods.eln.Eln"); + } catch (ClassNotFoundException e) { + return null; + } + } + + public static Object getElnInstance(Class Eln){ + try { + return Eln.getDeclaredField("instance").get(null); + } catch (NoSuchFieldException | IllegalAccessException e) { + return null; + } + } +} diff --git a/src/main/java/mods/eln/api/Utilities.java b/src/main/java/mods/eln/api/Utilities.java new file mode 100644 index 000000000..0da0fe042 --- /dev/null +++ b/src/main/java/mods/eln/api/Utilities.java @@ -0,0 +1,45 @@ +package mods.eln.api; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +/** + * Utilities + * @author Gregory Maddra + * 2016-11-18 + */ +public class Utilities { + + public static void makeModifiable(Field field){ + field.setAccessible(true); + int modifiers = field.getModifiers(); + try { + Field modifiersField = field.getClass().getDeclaredField("modifiers"); + modifiers = modifiers & ~Modifier.FINAL; + modifiersField.setAccessible(true); + modifiersField.setInt(field, modifiers); + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + + } + + public static boolean areSame(ItemStack stack, ItemStack output) { + try { + if (stack.getItem() == output.getItem() && stack.getItemDamage() == output.getItemDamage()) return true; + int[] stackIds = OreDictionary.getOreIDs(stack); + int[] outputIds = OreDictionary.getOreIDs(output); + // System.out.println(Arrays.toString(stackIds) + " " + Arrays.toString(outputIds)); + for (int i : outputIds) { + for (int j : stackIds) { + if (i == j) return true; + } + } + } catch (Exception ignored) { + } + return false; + } +} diff --git a/src/main/java/mods/eln/api/package-info.java b/src/main/java/mods/eln/api/package-info.java new file mode 100644 index 000000000..7fc4e4352 --- /dev/null +++ b/src/main/java/mods/eln/api/package-info.java @@ -0,0 +1,3 @@ +@API(owner = "Eln", apiVersion = "1.0", provides = "ElectricalAge|API") +package mods.eln.api; +import cpw.mods.fml.common.API; diff --git a/src/main/java/mods/eln/api/recipe/CompressorRecipeList.java b/src/main/java/mods/eln/api/recipe/CompressorRecipeList.java new file mode 100644 index 000000000..3935e076e --- /dev/null +++ b/src/main/java/mods/eln/api/recipe/CompressorRecipeList.java @@ -0,0 +1,82 @@ +package mods.eln.api.recipe; + +import mods.eln.api.Misc; +import net.minecraft.item.ItemStack; + +import java.util.ArrayList; + +public class CompressorRecipeList implements IELNMachineRecipeList { + private static RecipesList recipes = (RecipesList) Misc.getRecipeList("compressorRecipes"); + + /** + * Adds a new recipe to the compressor + * @param input an ItemStack representing the input of the recipe + * @param output an ItemStack[] representing the outputs of the recipe + * @param energy a double representing the energy cost of the recipe in J. + */ + public void addRecipe(ItemStack input, ItemStack[] output, double energy){ + if(input == null || output == null || energy < 0){ + throw new IllegalArgumentException("Invalid Arguments"); + } + if(output.length > 4){ + throw new IllegalArgumentException("Too many recipe outputs: " + output.length); + } + if(energy == 0){ + energy = 0.001; + } + Recipe recipe = new Recipe(input, output, energy); + recipes.addRecipe(recipe); + } + + public void addRecipe(ItemStack input, ItemStack output, double energy){ + if(input == null || output == null || energy < 0){ + throw new IllegalArgumentException("Invalid Inputs"); + } + if(energy == 0){ + energy = 0.001; + } + Recipe recipe = new Recipe(input, output, energy); + recipes.addRecipe(recipe); + } + + public void addRecipe(Recipe recipe) { + //Maintain existing checks + addRecipe(recipe.input, recipe.output, recipe.energy); + } + + /** + * Removes a recipe from the compressor + * @param input an ItemStack representing the input of the recipe + */ + public void removeRecipe(ItemStack input){ + if(input == null){ + System.out.println("Unable to remove recipe: invalid input ItemStack"); + return; + } + Recipe r = recipes.getRecipe(input); + recipes.getRecipes().remove(r); + } + + /** + * Removes recipes from the compressor by their output ItemStacks + * @param output the ItemStack who's recipes will be removed + */ + public void removeRecipeByOutput(ItemStack output){ + if (output == null){ + System.out.println("Unable to remove recipe: invalid output ItemStack"); + return; + } + ArrayList r = recipes.getRecipeFromOutput(output); + for (Recipe recipe : r){ + recipes.getRecipes().remove(recipe); + } + } + + /** + * Returns all recipes from the compressor + * @return an ArrayList of all the machine's recipes + */ + public ArrayList getRecipes(){ + return recipes.getRecipes(); + } +} diff --git a/src/main/java/mods/eln/api/recipe/IELNMachineRecipeList.java b/src/main/java/mods/eln/api/recipe/IELNMachineRecipeList.java new file mode 100644 index 000000000..5e8d8c714 --- /dev/null +++ b/src/main/java/mods/eln/api/recipe/IELNMachineRecipeList.java @@ -0,0 +1,28 @@ +package mods.eln.api.recipe; + +import net.minecraft.item.ItemStack; + +import java.util.ArrayList; + +/** + * Interface for ELN machines to use in the API + * @author bloxgate + * + */ +public interface IELNMachineRecipeList { + + + void addRecipe(ItemStack input, ItemStack[] output, double energy) throws IllegalArgumentException; + + void addRecipe(ItemStack input, ItemStack output, double energy) throws IllegalArgumentException; + + void addRecipe(Recipe recipe); + + void removeRecipe(ItemStack input); + + void removeRecipeByOutput(ItemStack output); + + ArrayList getRecipes(); + + +} diff --git a/src/main/java/mods/eln/api/recipe/MaceratorRecipeList.java b/src/main/java/mods/eln/api/recipe/MaceratorRecipeList.java new file mode 100644 index 000000000..28559171e --- /dev/null +++ b/src/main/java/mods/eln/api/recipe/MaceratorRecipeList.java @@ -0,0 +1,87 @@ +package mods.eln.api.recipe; + +import mods.eln.api.Misc; +import net.minecraft.item.ItemStack; + +import java.util.ArrayList; + +public class MaceratorRecipeList implements IELNMachineRecipeList { + + private static RecipesList recipes = (RecipesList) Misc.getRecipeList("maceratorRecipes"); + + /** + * Adds a new recipe to the macerator + * @param input an ItemStack representing the input of the recipe + * @param output an ItemStack[] with up to 4 items, containing the output of the recipe + * @param energy a double representing the energy cost of the recipe in J + */ + public void addRecipe(ItemStack input, ItemStack[] output, double energy){ + if(input == null || output == null || energy < 0){ + throw new IllegalArgumentException("Invalid Arguments"); + } + if(output.length > 4){ + throw new IllegalArgumentException("Too many recipe outputs: " + output.length); + } + if(energy == 0){ + energy = 0.001; + } + Recipe recipe = new Recipe(input, output, energy); + System.out.println("Added recipe to macerator!"); + recipes.addRecipe(recipe); + } + + @Override + public void addRecipe(ItemStack input, ItemStack output, double energy) { + if(input == null || output == null || energy < 0){ + throw new IllegalArgumentException("Invalid Inputs"); + } + if(energy == 0){ + energy = 0.001; + } + Recipe recipe = new Recipe(input, output, energy); + recipes.addRecipe(recipe); + System.out.println("Added recipe to macerator!"); + } + + public void addRecipe(Recipe recipe) { + //Maintain existing checks + addRecipe(recipe.input, recipe.output, recipe.energy); + } + + /** + * Removes a recipe from the macerator + * @param input an ItemStack representing the input of the recipe + */ + public void removeRecipe(ItemStack input){ + if(input == null){ + System.out.println("Unable to remove recipe: invalid input ItemStack"); + return; + } + Recipe r = recipes.getRecipe(input); + recipes.getRecipes().remove(r); + } + + /** + * Removes recipes from the macerator by their output ItemStacks + * @param output the ItemStack who's recipes will be removed + */ + public void removeRecipeByOutput(ItemStack output){ + if (output == null){ + System.out.println("Unable to remove recipe: invalid output ItemStack[]"); + return; + } + ArrayList r = recipes.getRecipeFromOutput(output); + for (Recipe recipe : r){ + recipes.getRecipes().remove(recipe); + } + } + + /** + * Returns all recipes from the macerator + * @return an ArrayList of all the machine's recipes + */ + public ArrayList getRecipes(){ + return recipes.getRecipes(); + } + +} diff --git a/src/main/java/mods/eln/api/recipe/MagnetizerRecipeList.java b/src/main/java/mods/eln/api/recipe/MagnetizerRecipeList.java new file mode 100644 index 000000000..a499054a6 --- /dev/null +++ b/src/main/java/mods/eln/api/recipe/MagnetizerRecipeList.java @@ -0,0 +1,82 @@ +package mods.eln.api.recipe; + +import mods.eln.api.Misc; +import net.minecraft.item.ItemStack; + +import java.util.ArrayList; + +public class MagnetizerRecipeList implements IELNMachineRecipeList { + private static RecipesList recipes = (RecipesList) Misc.getRecipeList("magnetizerRecipes"); + + /** + * Adds a new recipe to the magnetizer + * @param input an ItemStack representing the input of the recipe + * @param output an ItemStack[] representing the outputs of the recipe + * @param energy a double representing the energy cost of the recipe in J. + */ + public void addRecipe(ItemStack input, ItemStack[] output, double energy){ + if(input == null || output == null || energy < 0){ + throw new IllegalArgumentException("Invalid Arguments"); + } + if(output.length > 4){ + throw new IllegalArgumentException("Too many recipe outputs: " + output.length); + } + if(energy == 0){ + energy = 0.001; + } + Recipe recipe = new Recipe(input, output, energy); + recipes.addRecipe(recipe); + } + + public void addRecipe(ItemStack input, ItemStack output, double energy){ + if(input == null || output == null || energy < 0){ + throw new IllegalArgumentException("Invalid Inputs"); + } + if(energy == 0){ + energy = 0.001; + } + Recipe recipe = new Recipe(input, output, energy); + recipes.addRecipe(recipe); + } + + public void addRecipe(Recipe recipe) { + //Maintain existing checks + addRecipe(recipe.input, recipe.output, recipe.energy); + } + + /** + * Removes a recipe from the magnetizer + * @param input an ItemStack representing the input of the recipe + */ + public void removeRecipe(ItemStack input){ + if(input == null){ + System.out.println("Unable to remove recipe: invalid input ItemStack"); + return; + } + Recipe r = recipes.getRecipe(input); + recipes.getRecipes().remove(r); + } + + /** + * Removes recipes from the magnetizer by their output ItemStacks + * @param output the ItemStack who's recipes will be removed + */ + public void removeRecipeByOutput(ItemStack output){ + if (output == null){ + System.out.println("Unable to remove recipe: invalid output ItemStack"); + return; + } + ArrayList r = recipes.getRecipeFromOutput(output); + for (Recipe recipe : r){ + recipes.getRecipes().remove(recipe); + } + } + + /** + * Returns all recipes from the magnetizer + * @return an ArrayList of all the machine's recipes + */ + public ArrayList getRecipes(){ + return recipes.getRecipes(); + } +} diff --git a/src/main/java/mods/eln/api/recipe/PlateMachineRecipeList.java b/src/main/java/mods/eln/api/recipe/PlateMachineRecipeList.java new file mode 100644 index 000000000..f917e7e65 --- /dev/null +++ b/src/main/java/mods/eln/api/recipe/PlateMachineRecipeList.java @@ -0,0 +1,82 @@ +package mods.eln.api.recipe; + +import mods.eln.api.Misc; +import net.minecraft.item.ItemStack; + +import java.util.ArrayList; + +public class PlateMachineRecipeList implements IELNMachineRecipeList { + private static RecipesList recipes = (RecipesList) Misc.getRecipeList("plateMachineRecipes"); + + /** + * Adds a new recipe to the plate machine + * @param input an ItemStack representing the input of the recipe + * @param output an ItemStack[] representing the outputs of the recipe + * @param energy a double representing the energy cost of the recipe in J. + */ + public void addRecipe(ItemStack input, ItemStack[] output, double energy){ + if(input == null || output == null || energy < 0){ + throw new IllegalArgumentException("Invalid Arguments"); + } + if(output.length > 4){ + throw new IllegalArgumentException("Too many recipe outputs: " + output.length); + } + if(energy == 0){ + energy = 0.001; + } + Recipe recipe = new Recipe(input, output, energy); + recipes.addRecipe(recipe); + } + + public void addRecipe(ItemStack input, ItemStack output, double energy){ + if(input == null || output == null || energy < 0){ + throw new IllegalArgumentException("Invalid Inputs"); + } + if(energy == 0){ + energy = 0.001; + } + Recipe recipe = new Recipe(input, output, energy); + recipes.addRecipe(recipe); + } + + public void addRecipe(Recipe recipe) { + //Maintain existing checks + addRecipe(recipe.input, recipe.output, recipe.energy); + } + + /** + * Removes a recipe from the plate machine + * @param input an ItemStack representing the input of the recipe + */ + public void removeRecipe(ItemStack input){ + if(input == null){ + System.out.println("Unable to remove recipe: invalid input ItemStack"); + return; + } + Recipe r = recipes.getRecipe(input); + recipes.getRecipes().remove(r); + } + + /** + * Removes recipes from the plate machine by their output ItemStacks + * @param output the ItemStack who's recipes will be removed + */ + public void removeRecipeByOutput(ItemStack output){ + if (output == null){ + System.out.println("Unable to remove recipe: invalid output ItemStack"); + return; + } + ArrayList r = recipes.getRecipeFromOutput(output); + for (Recipe recipe : r){ + recipes.getRecipes().remove(recipe); + } + } + + /** + * Returns all recipes from the plate machine + * @return an ArrayList of all the machine's recipes + */ + public ArrayList getRecipes(){ + return recipes.getRecipes(); + } +} diff --git a/src/main/java/mods/eln/misc/Recipe.java b/src/main/java/mods/eln/api/recipe/Recipe.java similarity index 75% rename from src/main/java/mods/eln/misc/Recipe.java rename to src/main/java/mods/eln/api/recipe/Recipe.java index bdbe6a51a..16a32ee06 100644 --- a/src/main/java/mods/eln/misc/Recipe.java +++ b/src/main/java/mods/eln/api/recipe/Recipe.java @@ -1,5 +1,6 @@ -package mods.eln.misc; +package mods.eln.api.recipe; +import mods.eln.api.Utilities; import net.minecraft.item.ItemStack; import java.util.ArrayList; @@ -9,6 +10,7 @@ public class Recipe { public ItemStack input; public ItemStack[] output; public double energy; + public ArrayList machineList = new ArrayList(); public Recipe(ItemStack input, ItemStack[] output, double energy) { this.input = input; @@ -23,19 +25,17 @@ public Recipe(ItemStack input, ItemStack output, double energy) { } public boolean canBeCraftedBy(ItemStack stack) { - if (stack == null) return false; - return input.stackSize <= stack.stackSize && Utils.areSame(stack, input); - } + if(stack == null) return false; + return input.stackSize <= stack.stackSize && Utilities.areSame(stack, input); + } public ItemStack[] getOutputCopy() { ItemStack[] cpy = new ItemStack[output.length]; - for (int idx = 0; idx < output.length; idx++) { - cpy[idx] = output[idx].copy(); - } - return cpy; - } - - public ArrayList machineList = new ArrayList(); + for(int idx = 0; idx machineList) { this.machineList = machineList; diff --git a/src/main/java/mods/eln/misc/RecipesList.java b/src/main/java/mods/eln/api/recipe/RecipesList.java similarity index 91% rename from src/main/java/mods/eln/misc/RecipesList.java rename to src/main/java/mods/eln/api/recipe/RecipesList.java index 76bd5d207..ce9efbf06 100644 --- a/src/main/java/mods/eln/misc/RecipesList.java +++ b/src/main/java/mods/eln/api/recipe/RecipesList.java @@ -1,7 +1,8 @@ -package mods.eln.misc; +package mods.eln.api.recipe; import mods.eln.Eln; -import mods.eln.transparentnode.electricalfurnace.ElectricalFurnaceProcess; +import mods.eln.api.Misc; +import mods.eln.api.Utilities; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; @@ -21,43 +22,6 @@ public RecipesList() { listOfList.add(this); } - public ArrayList getRecipes() { - return recipeList; - } - - public ArrayList getMachines() { - return machineList; - } - - public void addRecipe(Recipe recipe) { - recipeList.add(recipe); - recipe.setMachineList(machineList); - } - - public void addMachine(ItemStack machine) { - machineList.add(machine); - } - - public Recipe getRecipe(ItemStack input) { - for (Recipe r : recipeList) { - if (r.canBeCraftedBy(input)) return r; - } - return null; - } - - public ArrayList getRecipeFromOutput(ItemStack output) { - ArrayList list = new ArrayList(); - for (Recipe r : recipeList) { - for (ItemStack stack : r.getOutputCopy()) { - if (Utils.areSame(stack, output)) { - list.add(r); - break; - } - } - } - return list; - } - public static ArrayList getGlobalRecipeWithOutput(ItemStack output) { output = output.copy(); output.stackSize = 1; @@ -76,8 +40,8 @@ public static ArrayList getGlobalRecipeWithOutput(ItemStack output) { Recipe recipe; // List, ItemStack ItemStack stack = (ItemStack) pairs.getValue(); ItemStack li = (ItemStack) pairs.getKey(); - if (Utils.areSame(output, stack)) { - list.add(recipe = new Recipe(li.copy(), output, ElectricalFurnaceProcess.energyNeededPerSmelt)); + if (Utilities.areSame(output, stack)) { + list.add(recipe = new Recipe(li.copy(), output, Misc.getElectricalFurnaceProcessEnergyNeededPerSmelt())); recipe.setMachineList(Eln.instance.furnaceList); } } catch (Exception e) { @@ -106,7 +70,7 @@ public static ArrayList getGlobalRecipeWithInput(ItemStack input) { try { ItemStack input1 = input.copy(); input1.stackSize = 1; - list.add(smeltRecipe = new Recipe(input1, smeltResult, ElectricalFurnaceProcess.energyNeededPerSmelt)); + list.add(smeltRecipe = new Recipe(input1, smeltResult, Misc.getElectricalFurnaceProcessEnergyNeededPerSmelt())); smeltRecipe.machineList.addAll(Eln.instance.furnaceList); } catch (Exception e) { // TODO: handle exception @@ -115,6 +79,43 @@ public static ArrayList getGlobalRecipeWithInput(ItemStack input) { return list; } + + public ArrayList getRecipes() { + return recipeList; + } + + public ArrayList getMachines() { + return machineList; + } + + public void addRecipe(Recipe recipe) { + recipeList.add(recipe); + recipe.setMachineList(machineList); + } + + public void addMachine(ItemStack machine) { + machineList.add(machine); + } + + public ArrayList getRecipeFromOutput(ItemStack output) { + ArrayList list = new ArrayList(); + for (Recipe r : recipeList) { + for (ItemStack stack : r.getOutputCopy()) { + if (Utilities.areSame(stack, output)) { + list.add(r); + break; + } + } + } + return list; + } + + public Recipe getRecipe(ItemStack input) { + for (Recipe r : recipeList) { + if (r.canBeCraftedBy(input)) return r; + } + return null; + } } /* FurnaceRecipes.smelting().addSmelting(in.itemID, in.getItemDamage(), findItemStack("Copper ingot"), 0);*/ diff --git a/src/main/java/mods/eln/integration/minetweaker/MinetweakerIntegration.kt b/src/main/java/mods/eln/integration/minetweaker/MinetweakerIntegration.kt new file mode 100644 index 000000000..19ef2521f --- /dev/null +++ b/src/main/java/mods/eln/integration/minetweaker/MinetweakerIntegration.kt @@ -0,0 +1,18 @@ +package mods.eln.integration.minetweaker + +import minetweaker.MineTweakerAPI +import mods.eln.integration.minetweaker.machines.Compressor +import mods.eln.integration.minetweaker.machines.Macerator +import mods.eln.integration.minetweaker.machines.Magnetizer +import mods.eln.integration.minetweaker.machines.PlateMachine + +object MinetweakerIntegration { + + fun initialize() { + MineTweakerAPI.registerClass(Macerator::class.java) + MineTweakerAPI.registerClass(Compressor::class.java) + MineTweakerAPI.registerClass(Magnetizer::class.java) + MineTweakerAPI.registerClass(PlateMachine::class.java) + } + +} diff --git a/src/main/java/mods/eln/integration/minetweaker/machines/Compressor.java b/src/main/java/mods/eln/integration/minetweaker/machines/Compressor.java new file mode 100644 index 000000000..e22133df9 --- /dev/null +++ b/src/main/java/mods/eln/integration/minetweaker/machines/Compressor.java @@ -0,0 +1,23 @@ +package mods.eln.integration.minetweaker.machines; + +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import mods.eln.integration.minetweaker.utils.MinetweakerMachine; + +@ZenClass("mods.electricalage.Compressor") +public class Compressor { + + @ZenMethod + public static void addRecipe(IIngredient input, double energy, IItemStack[] output) + { + MinetweakerMachine.COMPRESSOR.addRecipe(input, energy, output); + } + + @ZenMethod + public static void removeRecipe(IIngredient input) + { + MinetweakerMachine.COMPRESSOR.removeRecipe(input); + } +} diff --git a/src/main/java/mods/eln/integration/minetweaker/machines/Macerator.java b/src/main/java/mods/eln/integration/minetweaker/machines/Macerator.java new file mode 100644 index 000000000..88a974afb --- /dev/null +++ b/src/main/java/mods/eln/integration/minetweaker/machines/Macerator.java @@ -0,0 +1,24 @@ +package mods.eln.integration.minetweaker.machines; + +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import mods.eln.integration.minetweaker.utils.MinetweakerMachine; + +@ZenClass("mods.electricalage.Macerator") +public class Macerator { + + @ZenMethod + public static void addRecipe(IIngredient input, double energy, IItemStack[] output) + { + MinetweakerMachine.MACERATOR.addRecipe(input, energy, output); + } + + @ZenMethod + public static void removeRecipe(IIngredient input) + { + MinetweakerMachine.MACERATOR.removeRecipe(input); + } + +} diff --git a/src/main/java/mods/eln/integration/minetweaker/machines/Magnetizer.java b/src/main/java/mods/eln/integration/minetweaker/machines/Magnetizer.java new file mode 100644 index 000000000..ed84872ac --- /dev/null +++ b/src/main/java/mods/eln/integration/minetweaker/machines/Magnetizer.java @@ -0,0 +1,24 @@ +package mods.eln.integration.minetweaker.machines; + +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import mods.eln.integration.minetweaker.utils.MinetweakerMachine; + +@ZenClass("mods.electricalage.Magnetizer") +public class Magnetizer { + + @ZenMethod + public static void addRecipe(IIngredient input, double energy, IItemStack[] output) + { + MinetweakerMachine.MAGNETIZER.addRecipe(input, energy, output); + } + + @ZenMethod + public static void removeRecipe(IIngredient input) + { + MinetweakerMachine.MAGNETIZER.removeRecipe(input); + } + +} diff --git a/src/main/java/mods/eln/integration/minetweaker/machines/PlateMachine.java b/src/main/java/mods/eln/integration/minetweaker/machines/PlateMachine.java new file mode 100644 index 000000000..ab78d102a --- /dev/null +++ b/src/main/java/mods/eln/integration/minetweaker/machines/PlateMachine.java @@ -0,0 +1,24 @@ +package mods.eln.integration.minetweaker.machines; + +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import mods.eln.integration.minetweaker.utils.MinetweakerMachine; + +@ZenClass("mods.electricalage.PlateMachine") +public class PlateMachine { + + @ZenMethod + public static void addRecipe(IIngredient input, double energy, IItemStack[] output) + { + MinetweakerMachine.PLATEMACHINE.addRecipe(input, energy, output); + } + + @ZenMethod + public static void removeRecipe(IIngredient input) + { + MinetweakerMachine.PLATEMACHINE.removeRecipe(input); + } + +} diff --git a/src/main/java/mods/eln/integration/minetweaker/utils/AddRecipe.java b/src/main/java/mods/eln/integration/minetweaker/utils/AddRecipe.java new file mode 100644 index 000000000..79339d595 --- /dev/null +++ b/src/main/java/mods/eln/integration/minetweaker/utils/AddRecipe.java @@ -0,0 +1,23 @@ +package mods.eln.integration.minetweaker.utils; + +import mods.eln.api.recipe.Recipe; + +public class AddRecipe extends BasicUndoableAction { + Recipe recipe; + + public AddRecipe(MinetweakerMachine machine, Recipe recipe) { + super(machine); + this.recipe = recipe; + } + + @Override + public void apply() { + machine.recipes.addRecipe(recipe); + } + + @Override + public void undo() { + machine.recipes.removeRecipe(recipe.input); + } + +} diff --git a/src/main/java/mods/eln/integration/minetweaker/utils/BasicUndoableAction.java b/src/main/java/mods/eln/integration/minetweaker/utils/BasicUndoableAction.java new file mode 100644 index 000000000..ecf7afc41 --- /dev/null +++ b/src/main/java/mods/eln/integration/minetweaker/utils/BasicUndoableAction.java @@ -0,0 +1,32 @@ +package mods.eln.integration.minetweaker.utils; + +import minetweaker.IUndoableAction; + +public abstract class BasicUndoableAction implements IUndoableAction { + MinetweakerMachine machine; + + public BasicUndoableAction(MinetweakerMachine machine) { + this.machine = machine; + } + + @Override + public boolean canUndo() { + return true; + } + + @Override + public String describe() { + return machine.addDesc; + } + + @Override + public String describeUndo() { + return "Undo" + machine.removeDesc; + } + + @Override + public Object getOverrideKey() { + return null; + } + +} diff --git a/src/main/java/mods/eln/integration/minetweaker/utils/MinetweakerMachine.java b/src/main/java/mods/eln/integration/minetweaker/utils/MinetweakerMachine.java new file mode 100644 index 000000000..6d43e54a9 --- /dev/null +++ b/src/main/java/mods/eln/integration/minetweaker/utils/MinetweakerMachine.java @@ -0,0 +1,45 @@ +package mods.eln.integration.minetweaker.utils; + +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IIngredient; +import minetweaker.api.item.IItemStack; +import minetweaker.api.minecraft.MineTweakerMC; +import mods.eln.api.recipe.*; +import net.minecraft.item.ItemStack; + +public class MinetweakerMachine { + + public static MinetweakerMachine MACERATOR = new MinetweakerMachine(new MaceratorRecipeList(), "Adding Macerator Recipe", "Removing Macerator Recipe"); + public static MinetweakerMachine COMPRESSOR = new MinetweakerMachine(new CompressorRecipeList(), "Adding Compressor Recipe", "Removing Compressor Recipe"); + public static MinetweakerMachine MAGNETIZER = new MinetweakerMachine(new MagnetizerRecipeList(), "Adding Magnetizer Recipe", "Removing Magnetizer Recipe"); + public static MinetweakerMachine PLATEMACHINE = new MinetweakerMachine(new PlateMachineRecipeList(), "Adding Plate Machine Recipe", "Removing Plate Machine Recipe"); + + public IELNMachineRecipeList recipes; + public String removeDesc; + public String addDesc; + + public MinetweakerMachine(IELNMachineRecipeList recipeList, String addDesc, String removeDesc) { + this.recipes = recipeList; + this.addDesc = addDesc; + this.removeDesc = removeDesc; + } + + public void addRecipe(IIngredient input, double energy, IItemStack[] output) + { + ItemStack inStack = MineTweakerMC.getItemStack(input); + ItemStack[] outStacks = new ItemStack[output.length]; + for (int i = 0; i < output.length; i++) { + outStacks[i] = MineTweakerMC.getItemStack(output[i]); + } + + Recipe recipe = new Recipe(inStack, outStacks, energy); + + MineTweakerAPI.apply(new AddRecipe(this, recipe)); + } + + public void removeRecipe(IIngredient input) + { + MineTweakerAPI.apply(new RemoveRecipe(this, input)); + } + +} diff --git a/src/main/java/mods/eln/integration/minetweaker/utils/RemoveRecipe.java b/src/main/java/mods/eln/integration/minetweaker/utils/RemoveRecipe.java new file mode 100644 index 000000000..4918efcbc --- /dev/null +++ b/src/main/java/mods/eln/integration/minetweaker/utils/RemoveRecipe.java @@ -0,0 +1,40 @@ +package mods.eln.integration.minetweaker.utils; + +import minetweaker.api.item.IIngredient; +import minetweaker.api.minecraft.MineTweakerMC; +import mods.eln.api.recipe.Recipe; + +import java.util.ArrayList; + + +public class RemoveRecipe extends BasicUndoableAction{ + IIngredient input; + ArrayList toRemove; + + public RemoveRecipe(MinetweakerMachine machine, IIngredient input) { + super(machine); + this.input = input; + this.toRemove = new ArrayList<>(); + } + + @Override + public void apply() { + for (Recipe recipe : machine.recipes.getRecipes()) { + if (input.matches(MineTweakerMC.getIItemStack(recipe.input))) { + toRemove.add(recipe); + } + } + for (Recipe recipe : toRemove) { + machine.recipes.removeRecipe(recipe.input); + } + } + + @Override + public void undo() { + for (Recipe recipe : toRemove) { + machine.recipes.addRecipe(recipe); + } + toRemove = new ArrayList<>(); + } + +} diff --git a/src/main/java/mods/eln/mechanical/Turbines.kt b/src/main/java/mods/eln/mechanical/Turbines.kt index 2547f3b29..af4334aa7 100644 --- a/src/main/java/mods/eln/mechanical/Turbines.kt +++ b/src/main/java/mods/eln/mechanical/Turbines.kt @@ -28,7 +28,7 @@ abstract class TurbineDescriptor(baseName: String, obj: Obj3D) : // How we describe the fluid in the tooltip. abstract val fluidDescription: String // The fluids actually accepted. - abstract val fluidTypes: Array + abstract val fluidTypes: () -> Array // Width of the efficiency curve. // <1 means "Can't be started without power". abstract val efficiencyCurve: Float @@ -37,7 +37,7 @@ abstract class TurbineDescriptor(baseName: String, obj: Obj3D) : val optimalRads = absoluteMaximumShaftSpeed * 0.8f // Power stats val power: List by lazy { - fluidTypes.map { FuelRegistry.heatEnergyPerMilliBucket(it) * fluidConsumption } + fluidTypes.invoke().map { FuelRegistry.heatEnergyPerMilliBucket(it) * fluidConsumption } } val maxFluidPower: Double by lazy { power.max() ?: 0.0 @@ -82,7 +82,7 @@ class SteamTurbineDescriptor(baseName: String, obj: Obj3D) : // bonus because you're using Electrical Age you crazy person you. // This pretty much fills up a VHV line. The generator drag gives us a bit of leeway. override val fluidDescription = "steam" - override val fluidTypes = FuelRegistry.steamList + override val fluidTypes = { FuelRegistry.steamList } // Steam turbines can, just barely, be started without power. override val efficiencyCurve = 1.1f override val sound = "eln:steam_turbine" @@ -97,7 +97,7 @@ class GasTurbineDescriptor(basename: String, obj: Obj3D) : override val fluidConsumption = 4f override val fluidDescription = "gasoline" // It runs on puns. - override val fluidTypes = FuelRegistry.gasolineList + FuelRegistry.gasList + override val fluidTypes = { FuelRegistry.gasolineList + FuelRegistry.gasList } // Gas turbines are finicky about turbine speed. override val efficiencyCurve = 0.5f // And need to be spun up before working. @@ -156,7 +156,7 @@ class TurbineElement(node: TransparentNode, desc_: TransparentNodeDescriptor) : } init { - tank.setFilter(FuelRegistry.fluidListToFluids(desc.fluidTypes)) + tank.setFilter(FuelRegistry.fluidListToFluids(desc.fluidTypes.invoke())) slowProcessList.add(turbineSlowProcess) electricalLoadList.add(throttle) } diff --git a/src/main/java/mods/eln/misc/Utils.java b/src/main/java/mods/eln/misc/Utils.java index 053efe08c..58f23a93e 100644 --- a/src/main/java/mods/eln/misc/Utils.java +++ b/src/main/java/mods/eln/misc/Utils.java @@ -3,6 +3,7 @@ import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.Side; import mods.eln.Eln; +import mods.eln.api.Utilities; import mods.eln.generic.GenericItemBlockUsingDamage; import mods.eln.generic.GenericItemUsingDamage; import mods.eln.misc.Obj3D.Obj3DPart; @@ -40,7 +41,6 @@ import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; import org.lwjgl.opengl.GL11; @@ -918,22 +918,6 @@ public static float modbusToFloat(short first, short second) { return Float.intBitsToFloat(bit); } - public static boolean areSame(ItemStack stack, ItemStack output) { - try { - if (stack.getItem() == output.getItem() && stack.getItemDamage() == output.getItemDamage()) return true; - int[] stackIds = OreDictionary.getOreIDs(stack); - int[] outputIds = OreDictionary.getOreIDs(output); - // System.out.println(Arrays.toString(stackIds) + " " + Arrays.toString(outputIds)); - for (int i : outputIds) { - for (int j : stackIds) { - if (i == j) return true; - } - } - } catch (Exception e) { - } - return false; - } - public static Vec3 getVec05(Coordonate c) { return Vec3.createVectorHelper(c.x + (c.x < 0 ? -1 : 1) * 0.5, c.y + (c.y < 0 ? -1 : 1) * 0.5, c.z + (c.z < 0 ? -1 : 1) * 0.5); } @@ -1394,9 +1378,9 @@ public static float[] getSixNodePinDistance(Obj3DPart obj) { return new float[]{Math.abs(obj.zMin * 16), Math.abs(obj.zMax * 16), Math.abs(obj.yMin * 16), Math.abs(obj.yMax * 16)}; } - public static boolean isWrench(ItemStack stack) { - return areSame(stack, Eln.instance.wrenchItemStack) || stack.getDisplayName().toLowerCase().contains("wrench"); - } + public static boolean isWrench(ItemStack stack) { + return Utilities.areSame(stack, Eln.instance.wrenchItemStack) || stack.getDisplayName().toLowerCase().contains("wrench"); + } // @SideOnly(Side.SERVER) public static boolean isPlayerUsingWrench(EntityPlayer player) { diff --git a/src/main/java/mods/eln/sim/ElectricalStackMachineProcess.java b/src/main/java/mods/eln/sim/ElectricalStackMachineProcess.java index 9fd42eb37..217f212a6 100644 --- a/src/main/java/mods/eln/sim/ElectricalStackMachineProcess.java +++ b/src/main/java/mods/eln/sim/ElectricalStackMachineProcess.java @@ -1,7 +1,7 @@ package mods.eln.sim; -import mods.eln.misc.Recipe; -import mods.eln.misc.RecipesList; +import mods.eln.api.recipe.Recipe; +import mods.eln.api.recipe.RecipesList; import mods.eln.misc.Utils; import mods.eln.sim.mna.component.Resistor; import net.minecraft.inventory.IInventory; diff --git a/src/main/java/mods/eln/transparentnode/FuelGenerator.kt b/src/main/java/mods/eln/transparentnode/FuelGenerator.kt index e2398ea26..7741f2161 100644 --- a/src/main/java/mods/eln/transparentnode/FuelGenerator.kt +++ b/src/main/java/mods/eln/transparentnode/FuelGenerator.kt @@ -60,7 +60,7 @@ class FuelGeneratorDescriptor(name: String, internal val obj: Obj3D?, internal v internal val switch = obj?.getPart("switch") internal val cableRenderDescriptor = cable.render - internal val fuels = FuelRegistry.gasolineList + internal val fuels = { FuelRegistry.gasolineList } init { voltageLevelColor = VoltageLevelColor.fromCable(cable) @@ -115,7 +115,7 @@ class FuelGeneratorElement(transparentNode: TransparentNode, descriptor_: Transp internal var powerSource = PowerSource("powerSource", positiveLoad) internal var slowProcess = FuelGeneratorSlowProcess(this) internal var descriptor = descriptor_ as FuelGeneratorDescriptor - internal val fuels = FuelRegistry.fluidListToFluids(descriptor.fuels).map { it.id } + internal val fuels = FuelRegistry.fluidListToFluids(descriptor.fuels.invoke()).map { it.id } internal var tankLevel = 0.0 internal var tankFluid = FluidRegistry.getFluid("lava").id internal var on by published(false) diff --git a/src/main/java/mods/eln/transparentnode/FuelHeatFurnace.kt b/src/main/java/mods/eln/transparentnode/FuelHeatFurnace.kt index 1fc567924..8926c36b4 100644 --- a/src/main/java/mods/eln/transparentnode/FuelHeatFurnace.kt +++ b/src/main/java/mods/eln/transparentnode/FuelHeatFurnace.kt @@ -152,7 +152,7 @@ class FuelHeatFurnaceElement(transparentNode: TransparentNode, descriptor: Trans slowProcessList.add(NodePeriodicPublishProcess(transparentNode, 2.0, 1.0)) slowProcessList.add(thermalWatchdog) - tank.setFilter(FuelRegistry.fluidListToFluids(FuelRegistry.gasolineList + FuelRegistry.dieselList)) + tank.setFilter(FuelRegistry.fluidListToFluids({ FuelRegistry.gasolineList + FuelRegistry.dieselList }.invoke())) thermalWatchdog.set(thermalLoad).setLimit((descriptor as FuelHeatFurnaceDescriptor).thermal) .set(WorldExplosion(this).machineExplosion()) diff --git a/src/main/java/mods/eln/transparentnode/electricalmachine/CompressorDescriptor.java b/src/main/java/mods/eln/transparentnode/electricalmachine/CompressorDescriptor.java index f30c87a30..65712195e 100644 --- a/src/main/java/mods/eln/transparentnode/electricalmachine/CompressorDescriptor.java +++ b/src/main/java/mods/eln/transparentnode/electricalmachine/CompressorDescriptor.java @@ -2,6 +2,8 @@ import mods.eln.misc.*; import mods.eln.misc.Obj3D.Obj3DPart; +import mods.eln.api.recipe.RecipesList; +import mods.eln.misc.UtilsClient; import mods.eln.sim.ThermalLoadInitializer; import mods.eln.sixnode.electricalcable.ElectricalCableDescriptor; import net.minecraft.entity.item.EntityItem; diff --git a/src/main/java/mods/eln/transparentnode/electricalmachine/ElectricalMachineDescriptor.java b/src/main/java/mods/eln/transparentnode/electricalmachine/ElectricalMachineDescriptor.java index 2a20d1e5a..7db3808bd 100644 --- a/src/main/java/mods/eln/transparentnode/electricalmachine/ElectricalMachineDescriptor.java +++ b/src/main/java/mods/eln/transparentnode/electricalmachine/ElectricalMachineDescriptor.java @@ -3,6 +3,9 @@ import mods.eln.cable.CableRenderDescriptor; import mods.eln.gui.GuiLabel; import mods.eln.misc.*; +import mods.eln.api.recipe.Recipe; +import mods.eln.api.recipe.RecipesList; +import mods.eln.misc.Utils; import mods.eln.node.transparent.TransparentNodeDescriptor; import mods.eln.sim.ElectricalLoad; import mods.eln.sim.ElectricalStackMachineProcess; diff --git a/src/main/java/mods/eln/transparentnode/electricalmachine/MaceratorDescriptor.java b/src/main/java/mods/eln/transparentnode/electricalmachine/MaceratorDescriptor.java index dc56d6298..1fc07297c 100644 --- a/src/main/java/mods/eln/transparentnode/electricalmachine/MaceratorDescriptor.java +++ b/src/main/java/mods/eln/transparentnode/electricalmachine/MaceratorDescriptor.java @@ -1,8 +1,12 @@ package mods.eln.transparentnode.electricalmachine; import mods.eln.Eln; -import mods.eln.misc.*; +import mods.eln.api.recipe.RecipesList; +import mods.eln.misc.Direction; +import mods.eln.misc.Obj3D; import mods.eln.misc.Obj3D.Obj3DPart; +import mods.eln.misc.RcInterpolator; +import mods.eln.misc.UtilsClient; import mods.eln.sim.ThermalLoadInitializer; import mods.eln.sixnode.electricalcable.ElectricalCableDescriptor; import net.minecraft.entity.item.EntityItem; @@ -25,11 +29,6 @@ public MaceratorDescriptor(String name, String modelName, double nominalU, doubl } } - class MaceratorDescriptorHandle { - float counter = 0, itemCounter = 0; - final RcInterpolator interpolator = new RcInterpolator(0.5f); - } - @Override Object newDrawHandle() { return new MaceratorDescriptorHandle(); @@ -68,4 +67,9 @@ void refresh(float deltaT, ElectricalMachineRender render, Object handleO, Entit public boolean powerLrdu(Direction side, Direction front) { return side != front && side != front.getInverse(); } + + class MaceratorDescriptorHandle { + final RcInterpolator interpolator = new RcInterpolator(0.5f); + float counter = 0, itemCounter = 0; + } } diff --git a/src/main/java/mods/eln/transparentnode/electricalmachine/MagnetizerDescriptor.java b/src/main/java/mods/eln/transparentnode/electricalmachine/MagnetizerDescriptor.java index 9855096b2..a06bb67fa 100644 --- a/src/main/java/mods/eln/transparentnode/electricalmachine/MagnetizerDescriptor.java +++ b/src/main/java/mods/eln/transparentnode/electricalmachine/MagnetizerDescriptor.java @@ -4,7 +4,7 @@ import mods.eln.misc.Obj3D; import mods.eln.misc.Obj3D.Obj3DPart; import mods.eln.misc.RcInterpolator; -import mods.eln.misc.RecipesList; +import mods.eln.api.recipe.RecipesList; import mods.eln.misc.UtilsClient; import mods.eln.sim.ThermalLoadInitializer; import mods.eln.sixnode.electricalcable.ElectricalCableDescriptor; diff --git a/src/main/java/mods/eln/transparentnode/electricalmachine/PlateMachineDescriptor.java b/src/main/java/mods/eln/transparentnode/electricalmachine/PlateMachineDescriptor.java index ecb39c3d3..47b324dc9 100644 --- a/src/main/java/mods/eln/transparentnode/electricalmachine/PlateMachineDescriptor.java +++ b/src/main/java/mods/eln/transparentnode/electricalmachine/PlateMachineDescriptor.java @@ -2,6 +2,8 @@ import mods.eln.misc.*; import mods.eln.misc.Obj3D.Obj3DPart; +import mods.eln.api.recipe.RecipesList; +import mods.eln.misc.UtilsClient; import mods.eln.sim.ThermalLoadInitializer; import mods.eln.sixnode.electricalcable.ElectricalCableDescriptor; import net.minecraft.entity.item.EntityItem; diff --git a/src/main/java/mods/eln/wiki/ItemDefault.java b/src/main/java/mods/eln/wiki/ItemDefault.java index c78d60170..31e45b677 100644 --- a/src/main/java/mods/eln/wiki/ItemDefault.java +++ b/src/main/java/mods/eln/wiki/ItemDefault.java @@ -2,8 +2,8 @@ import mods.eln.gui.GuiLabel; import mods.eln.gui.IGuiObject; -import mods.eln.misc.Recipe; -import mods.eln.misc.RecipesList; +import mods.eln.api.recipe.Recipe; +import mods.eln.api.recipe.RecipesList; import mods.eln.misc.Utils; import net.minecraft.client.gui.GuiScreen; import net.minecraft.item.ItemStack;