aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/registration
diff options
context:
space:
mode:
authorJordan Byrne <draknyte1@hotmail.com>2017-12-07 16:31:29 +1000
committerJordan Byrne <draknyte1@hotmail.com>2017-12-07 16:31:29 +1000
commitc964170c46c7242097fcd3076ba61a7851191472 (patch)
tree81eb22545824445311f35eccc02b5f0a65f40e6c /src/Java/gtPlusPlus/xmod/gregtech/registration
parentdd5b8fefd5901d89982bb98455460900ccab6a7c (diff)
downloadGT5-Unofficial-c964170c46c7242097fcd3076ba61a7851191472.tar.gz
GT5-Unofficial-c964170c46c7242097fcd3076ba61a7851191472.tar.bz2
GT5-Unofficial-c964170c46c7242097fcd3076ba61a7851191472.zip
+ Added the component assembler. (Makes Motors, Pistons, etc.)
% More Nitro work.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/registration')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java130
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechNitroDieselFix.java46
2 files changed, 159 insertions, 17 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java
new file mode 100644
index 0000000000..d1483f54e3
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java
@@ -0,0 +1,130 @@
+package gtPlusPlus.xmod.gregtech.registration.gregtech;
+
+import java.util.ArrayList;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_GT_Recipe;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.Recipe_GT;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.item.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.oredict.OreDictionary;
+
+public class GregtechComponentAssembler {
+
+ public static void run(){
+ GregtechItemList.Machine_LV_Component_Maker.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(985, "basicmachine.componentmaker.tier.01", "Basic Component Maker", 1, "Components, Unite!", Recipe_GT.Gregtech_Recipe_Map.sComponentAssemblerRecipes, 6, 1, 16000, 0, 1, "Assembler.png", "", false, false, 0, "ASSEMBLER", new Object[]{"ACA", "VMV", "WCW", 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.PISTON, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE4}).getStackForm(1L));
+ GregtechItemList.Machine_MV_Component_Maker.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(986, "basicmachine.componentmaker.tier.02", "Advanced Component Maker", 2, "Components, Unite!", Recipe_GT.Gregtech_Recipe_Map.sComponentAssemblerRecipes, 6, 1, 16000, 0, 1, "Assembler.png", "", false, false, 0, "ASSEMBLER", new Object[]{"ACA", "VMV", "WCW", 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.PISTON, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE4}).getStackForm(1L));
+ GregtechItemList.Machine_HV_Component_Maker.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(987, "basicmachine.componentmaker.tier.03", "Advanced Component Maker II", 3, "Components, Unite!", Recipe_GT.Gregtech_Recipe_Map.sComponentAssemblerRecipes, 6, 1, 16000, 0, 1, "Assembler.png", "", false, false, 0, "ASSEMBLER", new Object[]{"ACA", "VMV", "WCW", 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.PISTON, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE4}).getStackForm(1L));
+ GregtechItemList.Machine_EV_Component_Maker.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(988, "basicmachine.componentmaker.tier.04", "Advanced Component Maker III", 4, "Components, Unite!", Recipe_GT.Gregtech_Recipe_Map.sComponentAssemblerRecipes, 6, 1, 16000, 0, 1, "Assembler.png", "", false, false, 0, "ASSEMBLER", new Object[]{"ACA", "VMV", "WCW", 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.PISTON, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE4}).getStackForm(1L));
+ GregtechItemList.Machine_IV_Component_Maker.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(989, "basicmachine.componentmaker.tier.05", "Advanced Component Maker IV", 5, "Components, Unite!", Recipe_GT.Gregtech_Recipe_Map.sComponentAssemblerRecipes, 6, 1, 16000, 0, 1, "Assembler.png", "", false, false, 0, "ASSEMBLER", new Object[]{"ACA", "VMV", "WCW", 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.PISTON, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE4}).getStackForm(1L));
+
+ addRecipeMotor(1, Materials.Copper, 1, Materials.Tin, 1, Materials.Iron, Materials.IronMagnetic);
+ addRecipeMotor(2, Materials.Copper, 2, Materials.Copper, 1, Materials.Aluminium, Materials.SteelMagnetic);
+ addRecipeMotor(3, Materials.Copper, 4, Materials.Gold, 1, Materials.StainlessSteel, Materials.SteelMagnetic);
+ addRecipeMotor(4, Materials.Copper, 8, Materials.Aluminium, 1, Materials.Titanium, Materials.NeodymiumMagnetic);
+ addRecipeMotor(5, Materials.Copper, 16, Materials.Tungsten, 1, Materials.TungstenSteel, Materials.NeodymiumMagnetic);
+
+ addRecipePiston(1, Materials.Steel, Materials.Tin);
+ addRecipePiston(2, Materials.Aluminium, Materials.Copper);
+ addRecipePiston(3, Materials.StainlessSteel, Materials.Gold);
+ addRecipePiston(4, Materials.Titanium, Materials.Aluminium);
+ addRecipePiston(5, Materials.TungstenSteel, Materials.Tungsten);
+
+ addRecipeConveyor(1, Materials.Tin);
+ addRecipeConveyor(2, Materials.Copper);
+ addRecipeConveyor(3, Materials.Gold);
+ addRecipeConveyor(4, Materials.Aluminium);
+ addRecipeConveyor(5, Materials.Tungsten);
+
+
+
+
+
+
+
+
+
+
+
+ }
+
+ private static boolean addRecipeMotor(int tier, Materials wire, int wirethickness, Materials cable, int cablethickness, Materials stick, Materials magstick){
+ String mWT = ""+wirethickness;
+ String mCT = ""+cablethickness;
+
+ if (wirethickness < 10){
+ mWT = "0"+wirethickness;
+ }
+ if (cablethickness < 10){
+ mCT = "0"+cablethickness;
+ }
+
+ OrePrefixes prefixWire = OrePrefixes.getOrePrefix("wireGt"+mWT);
+ OrePrefixes prefixCable = OrePrefixes.getOrePrefix("cableGt"+mCT);
+
+ ItemStack wireStack = ItemUtils.getGregtechOreStack(prefixWire, wire, 4);
+ ItemStack cableStack = ItemUtils.getGregtechOreStack(prefixCable, cable, 2);
+ ItemStack rodStack = ItemUtils.getGregtechOreStack(OrePrefixes.rod, stick, 2);
+ ItemStack magrodStack = ItemUtils.getGregtechOreStack(OrePrefixes.rod, magstick, 1);
+
+ ItemStack Input[] = {wireStack, cableStack, rodStack, magrodStack};
+
+ return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, ItemList.valueOf("Electric_Motor_"+GT_Values.VN[tier]).get(1), 100, (int) GT_Values.V[tier]);
+ }
+
+ private static boolean addRecipePiston(int tier, Materials mat, Materials cable){
+
+ OrePrefixes prefixCable = OrePrefixes.cableGt01;
+ ItemStack cableStack = ItemUtils.getGregtechOreStack(prefixCable, cable, 2);
+ ItemStack rodStack = ItemUtils.getGregtechOreStack(OrePrefixes.rod, mat, 2);
+ ItemStack plateStack = ItemUtils.getGregtechOreStack(OrePrefixes.plate, mat, 3);
+ ItemStack gearStack = ItemUtils.getGregtechOreStack(OrePrefixes.gearGtSmall, mat, 1);
+ ItemStack motorStack = ItemList.valueOf("Electric_Motor_"+GT_Values.VN[tier]).get(1);
+
+ ItemStack Input[] = {plateStack, cableStack, rodStack, gearStack, motorStack};
+
+ return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, ItemList.valueOf("Electric_Piston_"+GT_Values.VN[tier]).get(1), 100, (int) GT_Values.V[tier]);
+ }
+
+ private static boolean addRecipeConveyor(int tier, Materials cable){
+ OrePrefixes prefixCable = OrePrefixes.cableGt01;
+ ItemStack cableStack = ItemUtils.getGregtechOreStack(prefixCable, cable, 1);
+ ItemStack motorStack = ItemList.valueOf("Electric_Motor_"+GT_Values.VN[tier]).get(2);
+ boolean mAdd[];
+ final ArrayList<ItemStack> oreDictList = OreDictionary.getOres("plateAnyRubber");
+ if (!oreDictList.isEmpty()){
+ int mcount = 0;
+ mAdd = new boolean[oreDictList.size()];
+ for (ItemStack mRubberType : oreDictList){
+ final ItemStack returnValue = mRubberType.copy();
+ returnValue.stackSize = 6;
+ ItemStack Input[] = {cableStack, motorStack, returnValue};
+ mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, ItemList.valueOf("Electric_Conveyor_"+GT_Values.VN[tier]).get(1), 100, (int) GT_Values.V[tier]);
+ }
+ int added = 0;
+ for (boolean y : mAdd){
+ if (y){
+ added++;
+ }
+ }
+ if (added >= (oreDictList.size()/2)){
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ ItemStack Input[] = {cableStack, motorStack, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateRubber", 6)};
+ return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, ItemList.valueOf("Electric_Piston_"+GT_Values.VN[tier]).get(1), 100, (int) GT_Values.V[tier]);
+ }
+
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechNitroDieselFix.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechNitroDieselFix.java
index 452f622498..1c40e98e4e 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechNitroDieselFix.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechNitroDieselFix.java
@@ -28,6 +28,7 @@ public class GregtechNitroDieselFix {
@SuppressWarnings("unchecked")
public static void run(){
if (CORE.configSwitches.enableNitroFix){
+ Utils.LOG_INFO("Gregtech5u Content | Attempting to Fix Nitro-Diesel production.");
if (GT_Mod.VERSION == 509){
Utils.LOG_INFO("[Nitro] Found GT 5.09.");
@@ -51,14 +52,14 @@ public class GregtechNitroDieselFix {
Utils.LOG_INFO("[Nitro] Created new instance of Material builder, for Nitro fix.");
//Get Methods
- Method addFluid = mb.getMethod("addFluid");
- Method addCell = mb.getMethod("addCell");
- Method setColour = mb.getMethod("setColour", Dyes.class);
- Method setFuelPower = mb.getMethod("setFuelPower", int.class);
- Method setMaterials = mb.getMethod("setMaterialList", List.class);
- Method setTemp = mb.getMethod("setLiquidTemperature", int.class);
- Method setRGB = mb.getMethod("setRGB", int.class, int.class, int.class);
- Method construct = mb.getMethod("constructMaterial");
+ Method addFluid = mb.getDeclaredMethod("addFluid");
+ Method addCell = mb.getDeclaredMethod("addCell");
+ Method setColour = mb.getDeclaredMethod("setColor", Dyes.class);
+ Method setFuelPower = mb.getDeclaredMethod("setFuelPower", int.class);
+ Method setMaterials = mb.getDeclaredMethod("setMaterialList", List.class);
+ Method setTemp = mb.getDeclaredMethod("setLiquidTemperature", int.class);
+ Method setRGB = mb.getDeclaredMethod("setRGB", int.class, int.class, int.class);
+ Method construct = mb.getDeclaredMethod("constructMaterial");
Utils.LOG_INFO("[Nitro] Got internal methods for setting fields.");
//Invoke the methods
@@ -69,10 +70,10 @@ public class GregtechNitroDieselFix {
setMaterials.invoke(df, Arrays.asList(new MaterialStack(Materials.Glyceryl, 1), new MaterialStack(Materials.Fuel, 4)));
setTemp.invoke(df, 295);
setRGB.invoke(df, 200, 255, 0);
- construct.invoke(df);
+ Materials mNitroFix = (Materials) construct.invoke(df);
Utils.LOG_INFO("[Nitro] Invoked 8 method calls successfully.");
- GT_Mod.gregtechproxy.addFluid("NitroFuel_Old", "Nitro Diesel [Old]", ((Materials) df), 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, ((Materials) df), 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000);
+ GT_Mod.gregtechproxy.addFluid("NitroFuel_Old", "Nitro Diesel [Old]", mNitroFix, 1, 295, GT_OreDictUnificator.get(OrePrefixes.cell, mNitroFix, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000);
Utils.LOG_INFO("[Nitro] Added a fluid.");
@@ -131,13 +132,22 @@ public class GregtechNitroDieselFix {
Materials mFuels[] = {Materials.LightFuel, Materials.Fuel, Materials.Diesel};
for (Materials fuel : mFuels){
boolean didAdd[] = new boolean[3];
- Utils.LOG_INFO("[Nitro] Getting ready to add back in the old nitro-diesel recipe, using "+fuel.mDefaultLocalName+" as the fuel input.");
- didAdd[0] = GT_Values.RA.addMixerRecipe(fuel.getCells(4), Materials.Glycerol.getCells(1), GT_Values.NI, GT_Values.NI, GT_Values.NF, GT_Values.NF, ((Materials) df).getCells(5), 20, 30);
- didAdd[1] = GT_Values.RA.addMixerRecipe(fuel.getCells(4), GT_Values.NI, GT_Values.NI, GT_Values.NI, Materials.Glycerol.getFluid(1000L),((Materials) df).getFluid(5000L), ItemList.Cell_Empty.get(4L), 20, 30);
- didAdd[2] = GT_Values.RA.addMixerRecipe(Materials.Glycerol.getCells(1), GT_Values.NI,GT_Values.NI,GT_Values.NI, fuel.getFluid(4000L),((Materials) df).getFluid(5000L), ItemList.Cell_Empty.get(1L), 20, 30);
- Utils.LOG_INFO("[Nitro] Did the recipe add? 1: "+didAdd[0]+" | 2: "+didAdd[1]+" | 3: "+didAdd[2]);
+ Utils.LOG_INFO("[Nitro] Getting ready to add back in the old nitro-diesel recipe to the mixer, using "+fuel.mDefaultLocalName+" as the fuel input.");
+ didAdd[0] = GT_Values.RA.addMixerRecipe(fuel.getCells(4), Materials.Glycerol.getCells(1), GT_Values.NI, GT_Values.NI, GT_Values.NF, GT_Values.NF, mNitroFix.getCells(5), 20, 30);
+ didAdd[1] = GT_Values.RA.addMixerRecipe(fuel.getCells(4), GT_Values.NI, GT_Values.NI, GT_Values.NI, Materials.Glycerol.getFluid(1000L),mNitroFix.getFluid(5000L), ItemList.Cell_Empty.get(4L), 20, 30);
+ didAdd[2] = GT_Values.RA.addMixerRecipe(Materials.Glycerol.getCells(1), GT_Values.NI,GT_Values.NI,GT_Values.NI, fuel.getFluid(4000L),mNitroFix.getFluid(5000L), ItemList.Cell_Empty.get(1L), 20, 30);
+ Utils.LOG_INFO("[Nitro] Did the recipes add? 1: "+didAdd[0]+" | 2: "+didAdd[1]+" | 3: "+didAdd[2]);
+ }
+
+ for (Materials fuel : mFuels){
+ boolean didAdd[] = new boolean[3];
+ Utils.LOG_INFO("[Nitro] Getting ready to add back in the old nitro-diesel recipe to the chemical reactors, using "+fuel.mDefaultLocalName+" as the fuel input.");
+ didAdd[0] = GT_Values.RA.addChemicalRecipe(fuel.getCells(4), Materials.Glycerol.getCells(1), GT_Values.NF, GT_Values.NF, mNitroFix.getCells(5), 20, 30);
+ didAdd[1] = GT_Values.RA.addChemicalRecipe(fuel.getCells(4), GT_Values.NI, Materials.Glycerol.getFluid(1000L),mNitroFix.getFluid(5000L), ItemList.Cell_Empty.get(4L), 20, 30);
+ didAdd[2] = GT_Values.RA.addChemicalRecipe(Materials.Glycerol.getCells(1), GT_Values.NI, fuel.getFluid(4000L),mNitroFix.getFluid(5000L), ItemList.Cell_Empty.get(1L), 20, 30);
+ Utils.LOG_INFO("[Nitro] Did the recipes add? 1: "+didAdd[0]+" | 2: "+didAdd[1]+" | 3: "+didAdd[2]);
+ }
- }
Utils.LOG_INFO("[Nitro] Getting ready to add back in the old glycerol recipe!");
GT_Values.RA.addChemicalRecipe(Materials.Nitrogen.getCells(1), Materials.Carbon.getDust(1), Materials.Water.getFluid(2000L), Materials.Glycerol.getFluid(3000L), ItemList.Cell_Empty.get(1), 3000, 30);
Utils.LOG_INFO("[Nitro] Added recipes.");
@@ -153,7 +163,9 @@ public class GregtechNitroDieselFix {
}
}
catch (ClassNotFoundException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
-
+ Utils.LOG_INFO("[Nitro] ================ Error ================");
+ e.printStackTrace();
+ Utils.LOG_INFO("[Nitro] ================ Error ================");
}
}
}