diff options
author | Martin Robertz <dream-master@gmx.net> | 2021-12-21 23:19:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-21 23:19:04 +0100 |
commit | ef8ac539395ce5067edfcf1b8a98ae746c476fc1 (patch) | |
tree | af4167cbb06d109743d76a506c005910ce6d42d6 | |
parent | 62676f57093ed476b9c378615560749c6e0136e3 (diff) | |
parent | 06c8eb6bf1e2c634033d21e1d50ff7a8d8474550 (diff) | |
download | GT5-Unofficial-ef8ac539395ce5067edfcf1b8a98ae746c476fc1.tar.gz GT5-Unofficial-ef8ac539395ce5067edfcf1b8a98ae746c476fc1.tar.bz2 GT5-Unofficial-ef8ac539395ce5067edfcf1b8a98ae746c476fc1.zip |
Merge pull request #74 from GTNewHorizons/New-Multis
New multis
42 files changed, 2005 insertions, 329 deletions
diff --git a/dependencies.gradle b/dependencies.gradle index 4bb879b076..0aae3ec70b 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -48,4 +48,7 @@ dependencies { compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:Chisel:master-SNAPSHOT:dev") { + transitive = false + } } diff --git a/src/main/java/gtPlusPlus/GTplusplus.java b/src/main/java/gtPlusPlus/GTplusplus.java index 9787a38504..1513a0999c 100644 --- a/src/main/java/gtPlusPlus/GTplusplus.java +++ b/src/main/java/gtPlusPlus/GTplusplus.java @@ -228,6 +228,22 @@ public class GTplusplus implements ActionListener { Logger.INFO( "Finally, we are finished. Have some cripsy bacon as a reward." ); + + // Log free GT++ Meta IDs + if (CORE.DEVENV) { + // 750 - 999 are reserved for Alkalus. + for (int i=750; i<1000;i++) { + if (gregtech.api.GregTech_API.METATILEENTITIES[i] == null) { + Logger.INFO("MetaID "+i+" is free."); + } + } + // 30000 - 31999 are reserved for Alkalus. + for (int i=30000; i<32000;i++) { + if (gregtech.api.GregTech_API.METATILEENTITIES[i] == null) { + Logger.INFO("MetaID "+i+" is free."); + } + } + } } @EventHandler diff --git a/src/main/java/gtPlusPlus/core/config/ConfigHandler.java b/src/main/java/gtPlusPlus/core/config/ConfigHandler.java index 61610a03e9..382b63e2c3 100644 --- a/src/main/java/gtPlusPlus/core/config/ConfigHandler.java +++ b/src/main/java/gtPlusPlus/core/config/ConfigHandler.java @@ -225,6 +225,8 @@ public class ConfigHandler { pollutionPerSecondMultiMassFabricator = config.get("pollution", "pollutionPerSecondMultiMassFabricator", pollutionPerSecondMultiMassFabricator,"pollution rate in gibbl/s for the Matter fabrication CPU").getInt(pollutionPerSecondMultiMassFabricator); pollutionPerSecondMultiRefinery = config.get("pollution", "pollutionPerSecondMultiRefinery", pollutionPerSecondMultiRefinery,"pollution rate in gibbl/s for the Reactor fuel processing plant").getInt(pollutionPerSecondMultiRefinery); //pollutionPerSecondMultiGeneratorArray; + pollutionPerSecondMultiIndustrialRockBreaker = config.get("pollution", "pollutionPerSecondMultiIndustrialRockBreaker", pollutionPerSecondMultiIndustrialRockBreaker,"pollution rate in gibbl/s for the Industrial Rock Breaker").getInt(pollutionPerSecondMultiIndustrialRockBreaker); + pollutionPerSecondMultiIndustrialChisel = config.get("pollution", "pollutionPerSecondMultiIndustrialChisel", pollutionPerSecondMultiIndustrialChisel,"pollution rate in gibbl/s for the Industrial Chisel").getInt(pollutionPerSecondMultiIndustrialChisel); pollutionPerSecondMultiTreeFarm = config.get("pollution", "pollutionPerSecondMultiTreeFarm", pollutionPerSecondMultiTreeFarm,"pollution rate in gibbl/s for the Tree growth simulator").getInt(pollutionPerSecondMultiTreeFarm); pollutionPerSecondMultiFrothFlotationCell = config.get("pollution", "pollutionPerSecondMultiFrothFlotationCell", pollutionPerSecondMultiFrothFlotationCell,"pollution rate in gibbl/s for the Flotation cell regulator").getInt(pollutionPerSecondMultiFrothFlotationCell); pollutionPerSecondMultiAutoCrafter = config.get("pollution", "pollutionPerSecondMultiAutoCrafter", pollutionPerSecondMultiAutoCrafter,"pollution rate in gibbl/s for the Large-Scale auto assembler v1.01").getInt(pollutionPerSecondMultiAutoCrafter); diff --git a/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index 53d63499a6..bb47bb2380 100644 --- a/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -160,6 +160,8 @@ public class COMPAT_HANDLER { GregtechIsaMill.run(); GregtechSteamMultis.run(); //GregtechIndustrialElementDuplicator.run(); + GregtechIndustrialRockBreaker.run(); + GregtechIndustrialChisel.run(); //New Horizons Content NewHorizonsAccelerator.run(); diff --git a/src/main/java/gtPlusPlus/core/item/ModItems.java b/src/main/java/gtPlusPlus/core/item/ModItems.java index 47278c559d..fca4c5d3c6 100644 --- a/src/main/java/gtPlusPlus/core/item/ModItems.java +++ b/src/main/java/gtPlusPlus/core/item/ModItems.java @@ -14,6 +14,7 @@ import gtPlusPlus.core.common.compat.COMPAT_Baubles; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.item.base.*; import gtPlusPlus.core.item.base.BaseItemComponent.ComponentTypes; +import gtPlusPlus.core.item.base.cell.BaseItemCell; import gtPlusPlus.core.item.base.dusts.BaseItemDust; import gtPlusPlus.core.item.base.foil.BaseItemFoil; import gtPlusPlus.core.item.base.foods.BaseItemFood; @@ -203,6 +204,8 @@ public final class ModItems { public static Item dustIgnis; public static Item dustTerra; public static Item dustAqua; + + public static Item cellHydrogenChlorideMix; public static BaseEuItem metaItem2; @@ -712,7 +715,10 @@ public final class ModItems { dustAer = ItemUtils.generateSpecialUseDusts(ELEMENT.getInstance().AER, true)[0]; dustIgnis = ItemUtils.generateSpecialUseDusts(ELEMENT.getInstance().IGNIS, true)[0]; dustTerra = ItemUtils.generateSpecialUseDusts(ELEMENT.getInstance().TERRA, true)[0]; - dustAqua = ItemUtils.generateSpecialUseDusts(ELEMENT.getInstance().AQUA, true)[0]; + dustAqua = ItemUtils.generateSpecialUseDusts(ELEMENT.getInstance().AQUA, true)[0]; + + ItemUtils.generateSpecialUseDusts(MISC_MATERIALS.WOODS_GLASS, false); + cellHydrogenChlorideMix = new BaseItemCell("hydrogenchloridemix", "Hydrogen Chloride Mix", MISC_MATERIALS.HYDROGEN_CHLORIDE.getRGB()); //Nuclear Fuel Dusts dustLithiumCarbonate = ItemUtils.generateSpecialUseDusts("LithiumCarbonate", "Lithium Carbonate", "Li2CO3", Utils.rgbtoHexValue(240, 240, 240))[0]; //https://en.wikipedia.org/wiki/Lithium_carbonate diff --git a/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemCell.java b/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemCell.java index 688483b831..ad47adcf64 100644 --- a/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemCell.java +++ b/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemCell.java @@ -12,6 +12,7 @@ import gtPlusPlus.core.util.minecraft.ItemUtils; import ic2.core.Ic2Items; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; public class BaseItemCell extends BaseItemComponent{ @@ -26,7 +27,10 @@ public class BaseItemCell extends BaseItemComponent{ public BaseItemCell(final String unlocalName, final String localName, final short[] RGBa) { super(unlocalName, localName, RGBa); this.fluidColour = RGBa; - FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(unlocalName.toLowerCase(), 0), ItemUtils.getSimpleStack(this), Ic2Items.cell.copy()); + FluidStack aFluid = FluidUtils.getFluidStack(unlocalName.toLowerCase(), 1000); + if (aFluid != null) { + FluidContainerRegistry.registerFluidContainer(aFluid, ItemUtils.getSimpleStack(this), Ic2Items.cell.copy()); + } } public BaseItemCell(final String unlocalName, final String localName, final short[] RGBa, final Fluid cellFluid) { diff --git a/src/main/java/gtPlusPlus/core/lib/CORE.java b/src/main/java/gtPlusPlus/core/lib/CORE.java index 1ef04aa154..7508b9fc8f 100644 --- a/src/main/java/gtPlusPlus/core/lib/CORE.java +++ b/src/main/java/gtPlusPlus/core/lib/CORE.java @@ -300,6 +300,8 @@ public class CORE { public static int pollutionPerSecondMultiAutoCrafter = 500; public static int pollutionPerSecondMultiThermalBoiler = 700; public static int pollutionPerSecondMultiAlgaePond = 0; + public static int pollutionPerSecondMultiIndustrialRockBreaker = 100; + public static int pollutionPerSecondMultiIndustrialChisel = 50; //pollution single blocks public static int basePollutionPerSecondSemiFluidGenerator = 40; public static double[] pollutionReleasedByTierSemiFluidGenerator = new double[]{0,2.0,4.0,8.0}; diff --git a/src/main/java/gtPlusPlus/core/lib/LoadedMods.java b/src/main/java/gtPlusPlus/core/lib/LoadedMods.java index 1eb8351d65..4f7a10be78 100644 --- a/src/main/java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/main/java/gtPlusPlus/core/lib/LoadedMods.java @@ -60,6 +60,7 @@ public class LoadedMods { public static boolean CropsPlusPlus = false; //Barts Crop Mod public static boolean Reliquary = false; public static boolean SpiceOfLife = false; + public static boolean RemoteIO = false; @@ -322,6 +323,11 @@ public class LoadedMods { Witchery = true; Logger.INFO("Components enabled for: Witchery"); totalMods++; + } + if (isModLoaded("RIO")){ + RemoteIO = true; + Logger.INFO("Components enabled for: RemoteIO"); + totalMods++; } Logger.INFO("Content found for "+totalMods+" mods"); diff --git a/src/main/java/gtPlusPlus/core/material/ELEMENT.java b/src/main/java/gtPlusPlus/core/material/ELEMENT.java index 54af01ef6e..01d3fd5330 100644 --- a/src/main/java/gtPlusPlus/core/material/ELEMENT.java +++ b/src/main/java/gtPlusPlus/core/material/ELEMENT.java @@ -236,13 +236,14 @@ public final class ELEMENT { 0, false, new MaterialStack[]{ - new MaterialStack(getInstance().OXYGEN, 30), - new MaterialStack(getInstance().IRON, 20), - new MaterialStack(getInstance().SILICONDIOXIDE, 20), - new MaterialStack(getInstance().ALUMINIUMOXIDE, 10), - new MaterialStack(getInstance().POTASSIUM, 10), - new MaterialStack(getInstance().CALCIUM, 5), - new MaterialStack(getInstance().SODIUM, 5) + new MaterialStack(getInstance().OXYGEN, 16), + new MaterialStack(getInstance().IRON, 10), + new MaterialStack(getInstance().SILICONDIOXIDE, 10), + new MaterialStack(getInstance().ALUMINIUMOXIDE, 6), + new MaterialStack(getInstance().POTASSIUM, 6), + new MaterialStack(getInstance().CALCIUM, 4), + new MaterialStack(getInstance().SODIUM, 4), + new MaterialStack(getInstance().YTTERBIUM, 2) });//Not a GT Inherited Material public static final Material RUNITE = new Material("Runite", MaterialState.SOLID, TextureSet.SET_FINE, new short[] {60, 200, 190}, 6750, 11550, 73, 87, true, "ยง", 0);//Not a GT Inherited Material diff --git a/src/main/java/gtPlusPlus/core/material/MISC_MATERIALS.java b/src/main/java/gtPlusPlus/core/material/MISC_MATERIALS.java index 19e8499f02..2740f49d71 100644 --- a/src/main/java/gtPlusPlus/core/material/MISC_MATERIALS.java +++ b/src/main/java/gtPlusPlus/core/material/MISC_MATERIALS.java @@ -114,6 +114,26 @@ public final class MISC_MATERIALS { new MaterialStack(ELEMENT.getInstance().CARBON, 1), new MaterialStack(ELEMENT.getInstance().OXYGEN, 2) }); + + public static final Material WOODS_GLASS = new Material( + "Wood's Glass", //Material Name + MaterialState.SOLID, //State + TextureSets.GEM_A.get(), //Texture Set + new short[] {220, 60, 255}, //Material Colour + -1, + -1, + -1, + -1, + false, + "Si4Ba3Na2Ni", + 0, + false, + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().SILICON, 40), + new MaterialStack(ELEMENT.getInstance().BARIUM, 30), + new MaterialStack(ELEMENT.getInstance().SODIUM, 20), + new MaterialStack(ELEMENT.getInstance().NICKEL, 10), + }); /* diff --git a/src/main/java/gtPlusPlus/core/material/ORES.java b/src/main/java/gtPlusPlus/core/material/ORES.java index 0186c23a07..82757b2ee6 100644 --- a/src/main/java/gtPlusPlus/core/material/ORES.java +++ b/src/main/java/gtPlusPlus/core/material/ORES.java @@ -486,10 +486,11 @@ public final class ORES { -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), + new MaterialStack(ELEMENT.getInstance().YTTERBIUM, 3), new MaterialStack(ELEMENT.getInstance().GADOLINIUM, 2), new MaterialStack(ELEMENT.getInstance().DYSPROSIUM, 2), new MaterialStack(ELEMENT.getInstance().URANIUM235, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN,32), + new MaterialStack(ELEMENT.getInstance().OXYGEN,29), new MaterialStack(ELEMENT.getInstance().HYDROGEN, 24) }); diff --git a/src/main/java/gtPlusPlus/core/recipe/LOADER_Machine_Components.java b/src/main/java/gtPlusPlus/core/recipe/LOADER_Machine_Components.java index 460b29e802..c77db21800 100644 --- a/src/main/java/gtPlusPlus/core/recipe/LOADER_Machine_Components.java +++ b/src/main/java/gtPlusPlus/core/recipe/LOADER_Machine_Components.java @@ -68,6 +68,13 @@ public class LOADER_Machine_Components { CI.sensor_HV = ItemList.Sensor_HV.get(1); CI.sensor_EV = ItemList.Sensor_EV.get(1); CI.sensor_IV = ItemList.Sensor_IV.get(1); + if(CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + CI.fluidRegulator_LV = ItemUtils.getValueOfItemList("FluidRegulator_LV", ItemList.Pump_LV).get(1); + CI.fluidRegulator_MV = ItemUtils.getValueOfItemList("FluidRegulator_MV", ItemList.Pump_MV).get(1); + CI.fluidRegulator_HV = ItemUtils.getValueOfItemList("FluidRegulator_HV", ItemList.Pump_HV).get(1); + CI.fluidRegulator_EV = ItemUtils.getValueOfItemList("FluidRegulator_EV", ItemList.Pump_EV).get(1); + CI.fluidRegulator_IV = ItemUtils.getValueOfItemList("FluidRegulator_IV", ItemList.Pump_IV).get(1); + } } private static void registerGTExperimentalComponents(){ @@ -96,7 +103,13 @@ public class LOADER_Machine_Components { CI.sensor_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32695, 1); CI.sensor_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32696, 1); CI.sensor_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32697, 1); - + + if(CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + CI.fluidRegulator_LuV = ItemUtils.getValueOfItemList("FluidRegulator_LuV", ItemList.Pump_LuV).get(1); + CI.fluidRegulator_ZPM = ItemUtils.getValueOfItemList("FluidRegulator_ZPM", ItemList.Pump_ZPM).get(1); + CI.fluidRegulator_UV = ItemUtils.getValueOfItemList("FluidRegulator_UV", ItemList.Pump_UV).get(1); + } + registerComponentsULV(); registerComponentsMAX(); } @@ -135,6 +148,12 @@ public class LOADER_Machine_Components { CI.sensor_UV = GregtechItemList.Sensor_UV.get(1); CI.sensor_MAX = GregtechItemList.Sensor_MAX.get(1); + if(CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + CI.fluidRegulator_LuV = ItemUtils.getValueOfItemList("FluidRegulator_LuV", ItemList.Pump_LuV).get(1); + CI.fluidRegulator_ZPM = ItemUtils.getValueOfItemList("FluidRegulator_ZPM", ItemList.Pump_ZPM).get(1); + CI.fluidRegulator_UV = ItemUtils.getValueOfItemList("FluidRegulator_UV", ItemList.Pump_UV).get(1); + } + registerComponentsULV(); } @@ -171,6 +190,12 @@ public class LOADER_Machine_Components { CI.sensor_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32695, 1); CI.sensor_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32696, 1); CI.sensor_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32697, 1); + + if(CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + CI.fluidRegulator_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32665, 1); + CI.fluidRegulator_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32666, 1); + CI.fluidRegulator_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32667, 1); + } // Thanks 0lafe CI.electricMotor_MAX = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32596, 1); diff --git a/src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index 3d0e6aebfd..f8c923fc7a 100644 --- a/src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -93,6 +93,7 @@ public class RECIPES_GREGTECH { fluidheaterRecipes(); chemplantRecipes(); packagerRecipes(); + alloySmelterRecipes(); /** @@ -109,7 +110,17 @@ public class RECIPES_GREGTECH { addFuels(); } + private static void alloySmelterRecipes() { + + //Wood's Glass Laser Lens + GT_Values.RA.addAlloySmelterRecipe( + MISC_MATERIALS.WOODS_GLASS.getDust(5), + ItemList.Shape_Mold_Ball.get(0), + GregtechItemList.Laser_Lens_WoodsGlass.get(1), + 20 * 300, + MaterialUtils.getVoltageForTier(3)); + } private static void packagerRecipes() { @@ -1122,29 +1133,6 @@ public class RECIPES_GREGTECH { 20 * 120, 480*4); - - //Wood's Glass Laser Lens - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(5), - ItemList.Shape_Mold_Ball.get(0), - ELEMENT.getInstance().BARIUM.getDust(1), - ELEMENT.getInstance().SODIUM.getDust(1), - ELEMENT.getInstance().SILICON.getDust(2), - ELEMENT.getInstance().NICKEL.getDust(1), - ItemUtils.getItemStackOfAmountFromOreDict("dustGlass", 5) - }, - FluidUtils.getUUM(1000), - null, - new ItemStack[] { - GregtechItemList.Laser_Lens_WoodsGlass.get(1) - }, - new int[] {10000}, - 20 * 300, - (int) GT_Values.V[3]); - - - } private static void fluidcannerRecipes() { diff --git a/src/main/java/gtPlusPlus/core/recipe/RECIPES_General.java b/src/main/java/gtPlusPlus/core/recipe/RECIPES_General.java index 1c95467770..d47b65391c 100644 --- a/src/main/java/gtPlusPlus/core/recipe/RECIPES_General.java +++ b/src/main/java/gtPlusPlus/core/recipe/RECIPES_General.java @@ -439,12 +439,6 @@ public class RECIPES_General { generatePipeRecipes(e.mDefaultLocalName, e.getMass(), tVoltageMultiplier); } - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[4], "rotorGtStainlessSteel", CI.component_Plate[4], - CI.getTieredCircuitOreDictName(3), CI.machineHull_HV, CI.getTieredCircuitOreDictName(3), - CI.component_Plate[4], CI.electricPump_HV, CI.component_Plate[4], - GregtechItemList.Hatch_Air_Intake.get(1L, new Object[0])); - RecipeUtils.addShapedGregtechRecipe(CI.component_Plate[6], ALLOY.MARAGING250.getGear(1), CI.component_Plate[6], CI.getTieredCircuitOreDictName(4), GregtechItemList.Casing_AdvancedVacuum.get(1), CI.getTieredCircuitOreDictName(4), CI.component_Plate[5], ItemList.Hatch_Input_IV.get(1), diff --git a/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 14001d86bd..6e042a71b1 100644 --- a/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -253,7 +253,9 @@ public class RECIPES_Machines { chemPlant(); zyngen(); milling(); - sparging(); + sparging(); + chisels(); + rockBreaker(); } @@ -1404,14 +1406,24 @@ public class RECIPES_Machines { } //Air Intake Hatch - ItemList FluidRegulator_IV = ItemUtils.getValueOfItemList("FluidRegulator_IV", ItemList.Pump_IV); - ItemStack aTieredFluidRegulator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? FluidRegulator_IV.get(1) : ItemList.Pump_IV.get(1); RecipeUtils.addShapedGregtechRecipe( CI.component_Plate[6], ItemList.Casing_Grate.get(1), CI.component_Plate[6], - CI.component_Plate[6], aTieredFluidRegulator, CI.component_Plate[6], - CI.getTieredCircuit(4), ItemList.Hatch_Input_IV.get(1), CI.getTieredCircuit(4), + CI.component_Plate[6], CI.getFluidRegulator(5, 1), CI.component_Plate[6], + CI.getTieredCircuit(5), ItemList.Hatch_Input_IV.get(1), CI.getTieredCircuit(5), GregtechItemList.Hatch_Air_Intake.get(1)); - + + + RecipeUtils.addShapedGregtechRecipe( + CI.getPlate(6, 1), ItemList.Casing_Gearbox_Titanium, CI.getPlate(6, 1), + CI.getPlate(6, 1), CI.getFluidRegulator(5, 1), CI.getPlate(6, 1), + CI.getTieredCircuit(6), ItemList.Hatch_Input_IV.get(1), CI.getTieredCircuit(6), + GregtechItemList.Hatch_Reservoir.get(1)); + + RecipeUtils.addShapedGregtechRecipe( + CI.getPlate(7, 1), GregtechItemList.Hatch_Air_Intake.get(1), CI.getPlate(7, 1), + CI.getPlate(7, 1), CI.getFluidRegulator(7, 1), CI.getPlate(7, 1), + CI.getTieredCircuit(7), ItemList.Hatch_Input_ZPM.get(1), CI.getTieredCircuit(7), + GregtechItemList.Hatch_Air_Intake_Extreme.get(1)); if (CORE.ConfigSwitches.enableMultiblock_LiquidFluorideThoriumReactor){ //Thorium Reactor @@ -2637,6 +2649,78 @@ public class RECIPES_Machines { 60 * 20 * 2, MaterialUtils.getVoltageForTier(5)); } + + private static void chisels() { + ItemStack[] aChisels = new ItemStack[] { + GregtechItemList.GT_Chisel_LV.get(1), + GregtechItemList.GT_Chisel_MV.get(1), + GregtechItemList.GT_Chisel_HV.get(1), + }; + for (int i=1;i<4;i++) { + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + CI.getNumberedBioCircuit(10+i), + CI.getTieredMachineCasing(i), + CI.getPlate(i, 4), + CI.getElectricMotor(i, 2), + CI.getConveyor(i, 2), + CI.getRobotArm(i, 1) + }, + CI.getTieredFluid(i, 144 * 4), + aChisels[i-1], + 20 * 20, + MaterialUtils.getVoltageForTier(i)); + } + + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + CI.getNumberedBioCircuit(14), + aChisels[2], + CI.getPlate(4, 8), + CI.getElectricMotor(4, 8), + CI.getConveyor(4, 8), + CI.getRobotArm(4, 4) + }, + CI.getTieredFluid(4, 144 * 8), + GregtechItemList.Controller_IndustrialAutoChisel.get(1), + 20 * 20, + MaterialUtils.getVoltageForTier(4)); + + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + CI.getNumberedBioCircuit(14), + ItemList.Casing_SolidSteel.get(2), + CI.getPlate(4, 2), + CI.getTieredComponent(OrePrefixes.plate, 3, 4), + CI.getTieredComponent(OrePrefixes.ring, 3, 8), + CI.getTieredComponent(OrePrefixes.rod, 2, 4), + }, + CI.getTieredFluid(2, 144 * 2), + GregtechItemList.Casing_IndustrialAutoChisel.get(1), + 20 * 20, + MaterialUtils.getVoltageForTier(3)); + + + + } + + private static void rockBreaker() { + + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + CI.getNumberedAdvancedCircuit(12), + ItemList.Machine_EV_RockBreaker.get(1), + ALLOY.STAINLESS_STEEL.getPlate(8), + ALLOY.STAINLESS_STEEL.getRing(4), + CI.getTieredComponentOfMaterial(Materials.Aluminium, OrePrefixes.plateDouble, 8), + ALLOY.EGLIN_STEEL.getScrew(8), + }, + ELEMENT.getInstance().ALUMINIUM.getFluidStack(144 * 8), + GregtechItemList.Controller_IndustrialRockBreaker.get(1), + 60 * 20 * 2, + MaterialUtils.getVoltageForTier(4)); + + } private static void fakeMachineCasingCovers() { GregtechItemList[] mMachineCasingCovers = new GregtechItemList[] { @@ -2680,11 +2764,11 @@ public class RECIPES_Machines { return; } Class ModBlocksClass = ReflectionUtils.getClass("com.riciJak.Ztones.init.ModBlocks"); - Block agon = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "agonBlock")); - Block korp = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "korpBlock")); - Block jelt = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "jeltBlock")); - Block bitt = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "bittBlock")); - Block iszm = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "iszmBlock")); + Block agon = ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "agonBlock")); + Block korp = ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "korpBlock")); + Block jelt = ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "jeltBlock")); + Block bitt = ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "bittBlock")); + Block iszm = ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "iszmBlock")); // "agon", "iszm", "korp", "jelt", "bitt" diff --git a/src/main/java/gtPlusPlus/core/recipe/RECIPES_RareEarthProcessing.java b/src/main/java/gtPlusPlus/core/recipe/RECIPES_RareEarthProcessing.java index 864d0bcca8..860a87deae 100644 --- a/src/main/java/gtPlusPlus/core/recipe/RECIPES_RareEarthProcessing.java +++ b/src/main/java/gtPlusPlus/core/recipe/RECIPES_RareEarthProcessing.java @@ -13,6 +13,7 @@ import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.MISC_MATERIALS; @@ -118,12 +119,25 @@ public class RECIPES_RareEarthProcessing { null, new int[] {10000, 10000, 10000}, 20 * 30, - (int) GT_Values.V[2]); + 120); // Generate Special Laser Recipe + CORE.RA.addMixerRecipe( + CI.getNumberedBioCircuit(2), + ItemUtils.getItemStackOfAmountFromOreDict("cellChlorine", 1), + ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogen", 1), + null, + null, + null, + ItemUtils.getSimpleStack(ModItems.cellHydrogenChlorideMix, 2), + null, + null, + null, + 20 * 10, + 480); + CORE.RA.addUvLaserRecipe( - ELEMENT.getInstance().CHLORINE.getCell(2), - ELEMENT.getInstance().HYDROGEN.getCell(2), + ItemUtils.getSimpleStack(ModItems.cellHydrogenChlorideMix, 4), ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenChloride", 4), 20 * 30, 480); diff --git a/src/main/java/gtPlusPlus/core/recipe/common/CI.java b/src/main/java/gtPlusPlus/core/recipe/common/CI.java index 0a1b762a97..f6af91a040 100644 --- a/src/main/java/gtPlusPlus/core/recipe/common/CI.java +++ b/src/main/java/gtPlusPlus/core/recipe/common/CI.java @@ -128,6 +128,15 @@ public class CI { public static ItemStack sensor_ZPM; public static ItemStack sensor_UV; public static ItemStack sensor_MAX; + + public static ItemStack fluidRegulator_LV; + public static ItemStack fluidRegulator_MV; + public static ItemStack fluidRegulator_HV; + public static ItemStack fluidRegulator_EV; + public static ItemStack fluidRegulator_IV; + public static ItemStack fluidRegulator_LuV; + public static ItemStack fluidRegulator_ZPM; + public static ItemStack fluidRegulator_UV; //Machine Casings public static ItemStack machineCasing_ULV; @@ -881,6 +890,48 @@ public class CI { } return ItemUtils.getSimpleStack(aType, aSize); } + + public static ItemStack getFluidRegulator(int aTier, int aSize) { + if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + return CI.getElectricPump(aTier, aSize); + } + ItemStack aType; + int aLazyTier = 0; + if (aTier == aLazyTier++) { + aType = CI.fluidRegulator_LV; + } + else if (aTier == aLazyTier++) { + aType = CI.fluidRegulator_LV; + } + else if (aTier == aLazyTier++) { + aType = CI.fluidRegulator_MV; + } + else if (aTier == aLazyTier++) { + aType = CI.fluidRegulator_HV; + } + else if (aTier == aLazyTier++) { + aType = CI.fluidRegulator_EV; + } + else if (aTier == aLazyTier++) { + aType = CI.fluidRegulator_IV; + } + else if (aTier == aLazyTier++) { + aType = CI.fluidRegulator_LuV; + } + else if (aTier == aLazyTier++) { + aType = CI.fluidRegulator_ZPM; + } + else if (aTier == aLazyTier++) { + aType = CI.fluidRegulator_UV; + } + else if (aTier == aLazyTier++) { + aType = CI.fluidRegulator_UV; + } + else { + aType = CI.fluidRegulator_LV; + } + return ItemUtils.getSimpleStack(aType, aSize); + } public static ItemStack getElectricPiston(int aTier, int aSize) { ItemStack aType; diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/HazmatUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/HazmatUtils.java index b322036ef7..0e2fff3f35 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/HazmatUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/HazmatUtils.java @@ -254,7 +254,7 @@ public class HazmatUtils { aItemFields.add(ReflectionUtils.getField(aItemsGravisuite, "graviChestPlate")); AutoMap<ItemStack> aGravisuite = new AutoMap<ItemStack>(); for (Field aItemField : aItemFields) { - Item aItemObject = (Item) ReflectionUtils.getFieldValue(aItemField); + Item aItemObject = ReflectionUtils.getFieldValue(aItemField); if (aItemObject != null) { aGravisuite.add(ItemUtils.getSimpleStack(aItemObject)); } @@ -274,7 +274,7 @@ public class HazmatUtils { aItemFields.add(ReflectionUtils.getField(aItemsEMT, "ultimateSolarHelmet")); AutoMap<ItemStack> aASP = new AutoMap<ItemStack>(); for (Field aItemField : aItemFields) { - Item aItemObject = (Item) ReflectionUtils.getFieldValue(aItemField); + Item aItemObject = ReflectionUtils.getFieldValue(aItemField); if (aItemObject != null) { aASP.add(ItemUtils.getSimpleStack(aItemObject)); } diff --git a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 1ef925f793..92804d72ec 100644 --- a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -1060,13 +1060,13 @@ public class ReflectionUtils { return false; } - public static Object getFieldValue(Field field) { + public static <T> T getFieldValue(Field field) { return getFieldValue(field, null); } - public static Object getFieldValue(Field field, Object instance) { + public static <T> T getFieldValue(Field field, Object instance) { try { - return field.get(instance); + return (T) field.get(instance); } catch (IllegalArgumentException | IllegalAccessException e) { } return null; diff --git a/src/main/java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java b/src/main/java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java index 22568e6de7..b52f4eb67e 100644 --- a/src/main/java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java +++ b/src/main/java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java @@ -76,8 +76,8 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin { Preloader_Logger.INFO("Running on "+gtPlusPlus.preloader.CORE_Preloader.JAVA_VERSION+" | Development Environment: "+CORE_Preloader.DEV_ENVIRONMENT); Locale aDefaultLocale = Locale.getDefault(); NumberFormat aFormat = NumberFormat.getInstance(); - Locale aDisplayLocale = (Locale) ReflectionUtils.getFieldValue(ReflectionUtils.getField(Locale.class, "defaultDisplayLocale")); - Locale aFormatLocale = (Locale) ReflectionUtils.getFieldValue(ReflectionUtils.getField(Locale.class, "defaultFormatLocale")); + Locale aDisplayLocale = ReflectionUtils.getFieldValue(ReflectionUtils.getField(Locale.class, "defaultDisplayLocale")); + Locale aFormatLocale = ReflectionUtils.getFieldValue(ReflectionUtils.getField(Locale.class, "defaultFormatLocale")); Preloader_Logger.INFO("Locale: "+aDefaultLocale+" | Test: "+aFormat.format(1000000000)+" | Display: "+aDisplayLocale+" | Format: "+aFormatLocale); } diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TT_ThaumicRestorer.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TT_ThaumicRestorer.java index 05b8054ff8..86a22ce4b9 100644 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TT_ThaumicRestorer.java +++ b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TT_ThaumicRestorer.java @@ -82,7 +82,7 @@ public class ClassTransformer_TT_ThaumicRestorer { mTookLastTick = ReflectionUtils.getField(mTileRepairerClass, "tookLastTick"); mDamageLastTick = ReflectionUtils.getField(mTileRepairerClass, "dmgLastTick"); mProxyTC = ReflectionUtils.getField(mThaumicTinkerer, "tcProxy"); - repairTConTools = (boolean) ReflectionUtils.getFieldValue(mRepairTiconTools); + repairTConTools = ReflectionUtils.getFieldValue(mRepairTiconTools); mInit = true; } if (mInit) { diff --git a/src/main/java/gtPlusPlus/preloader/keyboard/BetterKeyboard.java b/src/main/java/gtPlusPlus/preloader/keyboard/BetterKeyboard.java index e25c06653c..532d20f1b2 100644 --- a/src/main/java/gtPlusPlus/preloader/keyboard/BetterKeyboard.java +++ b/src/main/java/gtPlusPlus/preloader/keyboard/BetterKeyboard.java @@ -68,7 +68,7 @@ public class BetterKeyboard { Field aKeyNameSize = ReflectionUtils.getField(Keyboard.class, "keyName"); Field aKeyMapSize = ReflectionUtils.getField(Keyboard.class, "keyMap"); Field aKeyDownBuffer = ReflectionUtils.getField(Keyboard.class, "keyDownBuffer"); - String[] aOldKeyNameArray = (String[]) ReflectionUtils.getFieldValue(aKeyNameSize); + String[] aOldKeyNameArray = ReflectionUtils.getFieldValue(aKeyNameSize); if (aOldKeyNameArray != null && aOldKeyNameArray.length < Short.MAX_VALUE) { String[] aNewKeyNameArray = new String[Short.MAX_VALUE]; for (int i=0;i<aOldKeyNameArray.length;i++) { @@ -82,7 +82,7 @@ public class BetterKeyboard { FMLRelaunchLog.log("[GT++ ASM] LWJGL Keybinding index out of bounds fix", Level.INFO, "Failed Patching Field: "+aKeyDownBuffer.getName()); } } - Map<String, Integer> aOldKeyMapArray = (Map<String, Integer>) ReflectionUtils.getFieldValue(aKeyMapSize); + Map<String, Integer> aOldKeyMapArray = ReflectionUtils.getFieldValue(aKeyMapSize); if (aOldKeyNameArray != null && aOldKeyMapArray.size() < Short.MAX_VALUE) { Map<String, Integer> aNewKeyMapArray = new HashMap<String, Integer>(Short.MAX_VALUE); aNewKeyMapArray.putAll(aOldKeyMapArray); @@ -94,7 +94,7 @@ public class BetterKeyboard { FMLRelaunchLog.log("[GT++ ASM] LWJGL Keybinding index out of bounds fix", Level.INFO, "Failed Patching Field: "+aKeyDownBuffer.getName()); } } - ByteBuffer aOldByteBuffer = (ByteBuffer) ReflectionUtils.getFieldValue(aKeyDownBuffer); + ByteBuffer aOldByteBuffer = ReflectionUtils.getFieldValue(aKeyDownBuffer); if (aOldByteBuffer != null && aOldByteBuffer.capacity() == Keyboard.KEYBOARD_SIZE) { ByteBuffer aNewByteBuffer = BufferUtils.createByteBuffer(Short.MAX_VALUE); try { diff --git a/src/main/java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java b/src/main/java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java index 95067300c8..52f498988c 100644 --- a/src/main/java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java +++ b/src/main/java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java @@ -91,7 +91,7 @@ public class HANDLER_BiomesOPlenty { Field aBopColouredSapling = ReflectionUtils.getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "colorizedSaplings"); if (aBopMiscItem != null) { - Item aMiscItem = (Item) ReflectionUtils.getFieldValue(aBopMiscItem); + Item aMiscItem = ReflectionUtils.getFieldValue(aBopMiscItem); if (aMiscItem != null) { mPineCone = aMiscItem; } @@ -99,25 +99,25 @@ public class HANDLER_BiomesOPlenty { if (aBopBlock1 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopBlock1); + Block aBlock = ReflectionUtils.getFieldValue(aBopBlock1); if (aBlock != null) { logs1 = aBlock; } } if (aBopBlock2 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopBlock2); + Block aBlock = ReflectionUtils.getFieldValue(aBopBlock2); if (aBlock != null) { logs2 = aBlock; } } if (aBopBlock3 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopBlock3); + Block aBlock = ReflectionUtils.getFieldValue(aBopBlock3); if (aBlock != null) { logs3 = aBlock; } } if (aBopBlock4 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopBlock4); + Block aBlock = ReflectionUtils.getFieldValue(aBopBlock4); if (aBlock != null) { logs4 = aBlock; } @@ -125,25 +125,25 @@ public class HANDLER_BiomesOPlenty { if (aBopLeaves1 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopLeaves1); + Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves1); if (aBlock != null) { leaves1 = aBlock; } } if (aBopLeaves2 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopLeaves2); + Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves2); if (aBlock != null) { leaves2 = aBlock; } } if (aBopLeaves3 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopLeaves3); + Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves3); if (aBlock != null) { leaves3 = aBlock; } } if (aBopLeaves4 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopLeaves4); + Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves4); if (aBlock != null) { leaves4 = aBlock; } @@ -151,13 +151,13 @@ public class HANDLER_BiomesOPlenty { if (aBopColouredLeaves1 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopColouredLeaves1); + Block aBlock = ReflectionUtils.getFieldValue(aBopColouredLeaves1); if (aBlock != null) { colorizedLeaves1 = aBlock; } } if (aBopColouredLeaves2 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopColouredLeaves2); + Block aBlock = ReflectionUtils.getFieldValue(aBopColouredLeaves2); if (aBlock != null) { colorizedLeaves2 = aBlock; } @@ -165,13 +165,13 @@ public class HANDLER_BiomesOPlenty { if (aBopSapling != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopSapling); + Block aBlock = ReflectionUtils.getFieldValue(aBopSapling); if (aBlock != null) { saplings = aBlock; } } if (aBopColouredSapling != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopColouredSapling); + Block aBlock = ReflectionUtils.getFieldValue(aBopColouredSapling); if (aBlock != null) { colorizedSaplings = aBlock; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 8c814489f2..a8ee2e24ad 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -409,6 +409,13 @@ public enum GregtechItemList implements GregtechItemContainer { // Big Steam Macerator Controller_SteamMaceratorMulti, + + // Industrial Rock Breaker + Controller_IndustrialRockBreaker, + + // Industrial Chisel + Controller_IndustrialAutoChisel, + Casing_IndustrialAutoChisel, // Custom Machine Casings Casing_Machine_Custom_1, @@ -431,6 +438,10 @@ public enum GregtechItemList implements GregtechItemContainer { //Air Intake hatch Hatch_Air_Intake, + Hatch_Air_Intake_Extreme, + + //Reservoir Hatch + Hatch_Reservoir, //XL Turbine Rotor Hatch /*Hatch_Turbine_Rotor,*/ @@ -705,6 +716,12 @@ public enum GregtechItemList implements GregtechItemContainer { //GT RTG RTG, + + // Chisel Machines + GT_Chisel_LV, + GT_Chisel_MV, + GT_Chisel_HV, + //Plasma Tank /*Plasma_Tank,*/ diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java index 6bf048320f..dfc1e58975 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java @@ -306,8 +306,8 @@ public interface IGregtech_RecipeAdder { public boolean addVacuumFurnaceRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aLevel); - public boolean addUvLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu); - public boolean addIrLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu); + public boolean addUvLaserRecipe(ItemStack aInput1, ItemStack aOutput, int time, long eu); + public boolean addIrLaserRecipe(ItemStack aInput1, ItemStack aOutput, int time, long eu); public boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aTier); public boolean addChemicalPlantRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int[] aChances, int time, long eu, int aTier); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java index 5fb3b11d08..02b7a03f3b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java @@ -1,165 +1,65 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; -import java.lang.reflect.Field; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.api.objects.random.XSTR; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_Input { - - private static XSTR floatGen; - public int mProgresstime = 0, mMaxProgresstime = 0; +public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_FluidGenerator { - public GT_MetaTileEntity_Hatch_AirIntake(final int aID, final String aName, final String aNameRegional, - final int aTier) { + public GT_MetaTileEntity_Hatch_AirIntake(final int aID, final String aName, final String aNameRegional, final int aTier) { super(aID, aName, aNameRegional, aTier); } - public GT_MetaTileEntity_Hatch_AirIntake(final String aName, final int aTier, final String aDescription, - final ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_AirIntake(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } - /*public GT_MetaTileEntity_Hatch_AirIntake(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - }*/ - - private static String[] S; - private static Field F; - - public synchronized String[] getDescription() { - try { - if (F == null || S == null) { - Field t = ReflectionUtils.getField(this.getClass(), "mDescriptionArray"); - if (t != null) { - F = t; - } - else { - F = ReflectionUtils.getField(this.getClass(), "mDescription"); - } - if (S == null && F != null) { - Object o = F.get(this); - if (o instanceof String[]) { - S = (String[]) o; - } - else if (o instanceof String) { - S = new String[] {(String) o}; - } - } - - } - } - catch (Throwable t) { - - } - if (S != null) { - final String[] desc = new String[S.length + 4]; - System.arraycopy(S, 0, desc, 0, S.length); - desc[S.length] = "DO NOT OBSTRUCT THE INPUT!"; - desc[S.length + 1] = "Draws in Air from the surrounding environment"; - desc[S.length + 2] = "Creates 1000L of Air every 4 ticks"; - desc[S.length + 3] = CORE.GT_Tooltip; - return desc; - } - else { - return new String[] {"DO NOT OBSTRUCT THE INPUT!", "Draws in Air from the surrounding environment", "Creates 1000L of Air every 4 ticks", CORE.GT_Tooltip}; - } - - } - - public ITexture[] getTexturesActive(final ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, - new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.OVERLAY_MUFFLER)}; - } - - public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, - new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.OVERLAY_MUFFLER)}; - } - - public boolean isSimpleMachine() { - return true; - } - - public boolean isFacingValid(final byte aFacing) { - return true; + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_AirIntake(this.mName, this.mTier, this.mDescription, this.mTextures); } - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; + @Override + public String[] getCustomTooltip() { + String[] aTooltip = new String[3]; + aTooltip[0] = "DO NOT OBSTRUCT THE INPUT!"; + aTooltip[1] = "Draws in Air from the surrounding environment"; + aTooltip[2] = "Creates "+getAmountOfFluidToGenerate()+"L of Air every "+getMaxTickTime()+" ticks"; + return aTooltip; } - public boolean isValidSlot(final int aIndex) { - return false; + @Override + public Fluid getFluidToGenerate() { + return FluidUtils.getAir(1).getFluid(); } - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_AirIntake(this.mName, this.mTier, this.mDescription, this.mTextures); + @Override + public int getAmountOfFluidToGenerate() { + return 1000; } - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, - final ItemStack aStack) { - return false; + @Override + public int getMaxTickTime() { + return 4; } - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, - final ItemStack aStack) { - return false; + @Override + public int getCapacity() { + return 128000; } - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - - if (!aBaseMetaTileEntity.isAllowedToWork()) { - aBaseMetaTileEntity.setActive(false); - mProgresstime = 0; - mMaxProgresstime = 0; - } - else { - aBaseMetaTileEntity.setActive(true); - mMaxProgresstime = 4; - if (++mProgresstime >= mMaxProgresstime) { - addAirToHatch(aTick); - mProgresstime = 0; - } - } + @Override + public boolean doesHatchMeetConditionsToGenerate() { + return this.getBaseMetaTileEntity().getAirAtSide(this.getBaseMetaTileEntity().getFrontFacing()); } - - @Override - public int getProgresstime() { - return mProgresstime; - } - - @Override - public int maxProgresstime() { - return mMaxProgresstime; - } - @Override - public int increaseProgress(int aProgress) { - mProgresstime += aProgress; - return mMaxProgresstime - mProgresstime; - } - - public void pollutionParticles(final World aWorld, final String name) { + @Override + public void generateParticles(World aWorld, String name) { if (this.getBaseMetaTileEntity().isServerSide()) { return; } @@ -207,97 +107,4 @@ public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_I (double) -ySpd, (double) zSpd); } - static { - GT_MetaTileEntity_Hatch_AirIntake.floatGen = new XSTR(); - } - - public int getTankPressure() { - return 100; - } - - public int getCapacity() { - return 128000; - } - - @Override - public boolean canTankBeEmptied() { - return true; - } - - private static Fluid AIR; - - public boolean isAirInHatch() { - if (this.mFluid != null) { - if (AIR == null) { - AIR = FluidUtils.getAir(1).getFluid(); - } - if (AIR == this.mFluid.getFluid()) { - return true; - } - } - return false; - } - - public boolean addAirToHatch(long aTick) { - if (!this.getBaseMetaTileEntity().getAirAtSide(this.getBaseMetaTileEntity().getFrontFacing())) { - return false; - } - boolean didFill = this.fill(FluidUtils.getAir(1000), true) > 0; - if (didFill) { - this.pollutionParticles(this.getBaseMetaTileEntity().getWorld(), "cloud"); - } - return didFill; - } - - @Override - public boolean canTankBeFilled() { - if (this.mFluid == null || (this.mFluid != null && (this.mFluid.amount <= this.getCapacity()))) { - return true; - } - return false; - } - - @Override - public boolean doesEmptyContainers() { - return false; - } - - @Override - public boolean doesFillContainers() { - return true; - } - - @Override - public int fill(FluidStack aFluid, boolean doFill) { - return super.fill(aFluid, doFill); - } - - @Override - public boolean canFill(ForgeDirection aSide, Fluid aFluid) { - return false; - } - - @Override - public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) { - return 0; - } - - @Override - public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - return 0; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mProgresstime", mProgresstime); - aNBT.setInteger("mMaxProgresstime", mMaxProgresstime); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - mProgresstime = aNBT.getInteger("mProgresstime"); - mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); - super.loadNBTData(aNBT); - } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java new file mode 100644 index 0000000000..45611d9e05 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java @@ -0,0 +1,32 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; + +public class GT_MetaTileEntity_Hatch_AirIntake_Extreme extends GT_MetaTileEntity_Hatch_AirIntake { + + public GT_MetaTileEntity_Hatch_AirIntake_Extreme(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier); + } + + public GT_MetaTileEntity_Hatch_AirIntake_Extreme(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_AirIntake_Extreme(this.mName, this.mTier, this.mDescription, this.mTextures); + } + + @Override + public int getAmountOfFluidToGenerate() { + return 8000; + } + + @Override + public int getCapacity() { + return 256000; + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java new file mode 100644 index 0000000000..d4b8b3a064 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java @@ -0,0 +1,252 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import java.lang.reflect.Field; + +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.objects.GT_RenderedTexture; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.random.XSTR; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +public abstract class GT_MetaTileEntity_Hatch_FluidGenerator extends GT_MetaTileEntity_Hatch_Input { + + protected static XSTR floatGen = new XSTR(); + public int mProgresstime = 0, mMaxProgresstime = 0; + + public GT_MetaTileEntity_Hatch_FluidGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier); + } + + public GT_MetaTileEntity_Hatch_FluidGenerator(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + private static String[] S; + private static Field F; + + public abstract String[] getCustomTooltip(); + + public abstract Fluid getFluidToGenerate(); + + public abstract int getAmountOfFluidToGenerate(); + + public abstract int getMaxTickTime(); + + public synchronized String[] getDescription() { + try { + if (F == null || S == null) { + Field t = ReflectionUtils.getField(this.getClass(), "mDescriptionArray"); + if (t != null) { + F = t; + } + else { + F = ReflectionUtils.getField(this.getClass(), "mDescription"); + } + if (S == null && F != null) { + Object o = F.get(this); + if (o instanceof String[]) { + S = (String[]) o; + } + else if (o instanceof String) { + S = new String[] {(String) o}; + } + } + + } + } + catch (Throwable t) { + Logger.INFO("1"); + t.printStackTrace(); + } + try { + if (S != null) { + String[] aCustomTips = getCustomTooltip(); + final String[] desc = new String[S.length + aCustomTips.length + 1]; + System.arraycopy(S, 0, desc, 0, S.length); + for (int i=0;i<aCustomTips.length;i++) { + desc[S.length + i] = aCustomTips[i]; + } + desc[S.length + aCustomTips.length] = CORE.GT_Tooltip; + return desc; + } + } + catch (Throwable t) { + Logger.INFO("2"); + t.printStackTrace(); + } + + return new String[] {"Broken Tooltip - Report on Github"}; + + } + + public ITexture[] getTexturesActive(final ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, + new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.OVERLAY_MUFFLER)}; + } + + public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, + new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.OVERLAY_MUFFLER)}; + } + + public boolean isSimpleMachine() { + return true; + } + + public boolean isFacingValid(final byte aFacing) { + return true; + } + + public boolean isAccessAllowed(final EntityPlayer aPlayer) { + return true; + } + + public boolean isValidSlot(final int aIndex) { + return false; + } + + public abstract MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity); + + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { + return false; + } + + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { + return false; + } + + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + + if (!aBaseMetaTileEntity.isAllowedToWork()) { + aBaseMetaTileEntity.setActive(false); + mProgresstime = 0; + mMaxProgresstime = 0; + } + else { + aBaseMetaTileEntity.setActive(true); + mMaxProgresstime = getMaxTickTime(); + if (++mProgresstime >= mMaxProgresstime) { + addFluidToHatch(aTick); + mProgresstime = 0; + } + } + } + + @Override + public int getProgresstime() { + return mProgresstime; + } + + @Override + public int maxProgresstime() { + return mMaxProgresstime; + } + + @Override + public int increaseProgress(int aProgress) { + mProgresstime += aProgress; + return mMaxProgresstime - mProgresstime; + } + + public abstract void generateParticles(final World aWorld, final String name); + + public int getTankPressure() { + return 100; + } + + public abstract int getCapacity(); + + @Override + public boolean canTankBeEmptied() { + return true; + } + + public abstract boolean doesHatchMeetConditionsToGenerate(); + + public boolean addFluidToHatch(long aTick) { + if (!doesHatchMeetConditionsToGenerate()) { + return false; + } + boolean didFill = false; + if (canTankBeFilled()) { + didFill = this.fill(FluidUtils.getFluidStack(getFluidToGenerate(), getAmountOfFluidToGenerate()), true) > 0; + if (didFill) { + this.generateParticles(this.getBaseMetaTileEntity().getWorld(), "cloud"); + } + } + return didFill; + } + + @Override + public boolean canTankBeFilled() { + //Logger.INFO("Total Space: "+this.getCapacity()); + //Logger.INFO("Current capacity: "+this.getFluidAmount()); + //Logger.INFO("To add: "+this.getAmountOfFluidToGenerate()); + //Logger.INFO("Space Free: "+(this.getCapacity()-this.getFluidAmount())); + if (this.mFluid == null || (this.mFluid != null && (this.getCapacity() - this.getFluidAmount() >= this.getAmountOfFluidToGenerate()))) { + return true; + } + return false; + } + + @Override + public boolean doesEmptyContainers() { + return false; + } + + @Override + public boolean doesFillContainers() { + return true; + } + + @Override + public int fill(FluidStack aFluid, boolean doFill) { + return super.fill(aFluid, doFill); + } + + @Override + public boolean canFill(ForgeDirection aSide, Fluid aFluid) { + return false; + } + + @Override + public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) { + return 0; + } + + @Override + public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { + return 0; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setInteger("mProgresstime", mProgresstime); + aNBT.setInteger("mMaxProgresstime", mMaxProgresstime); + super.saveNBTData(aNBT); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + mProgresstime = aNBT.getInteger("mProgresstime"); + mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); + super.loadNBTData(aNBT); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java new file mode 100644 index 0000000000..75c5dbb9ee --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java @@ -0,0 +1,123 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.objects.GT_RenderedTexture; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.IFluidHandler; + +public class GT_MetaTileEntity_Hatch_Reservoir extends GT_MetaTileEntity_Hatch_FluidGenerator { + + private static Block sBlock_EIO; + private static Block sBlock_RIO; + + public GT_MetaTileEntity_Hatch_Reservoir(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier); + } + + public GT_MetaTileEntity_Hatch_Reservoir(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_Reservoir(this.mName, this.mTier, this.mDescription, this.mTextures); + } + + @Override + public String[] getCustomTooltip() { + String[] aTooltip = new String[3]; + aTooltip[0] = "Requires a Block of water facing the intake"; + aTooltip[1] = "Infinite water supply hatch"; + aTooltip[2] = "Creates 8000L of Water every 4 ticks"; + return aTooltip; + } + + @Override + public Fluid getFluidToGenerate() { + return FluidRegistry.WATER; + } + + @Override + public int getAmountOfFluidToGenerate() { + return 8000; + } + + @Override + public int getMaxTickTime() { + return 4; + } + + @Override + public int getCapacity() { + return 256000; + } + + private static void setCrossModData() { + if (LoadedMods.EnderIO && sBlock_EIO == null) { + sBlock_EIO = GameRegistry.findBlock("EnderIO", "blockReservoir"); + } + if (LoadedMods.RemoteIO && sBlock_RIO == null) { + sBlock_RIO = GameRegistry.findBlock("RIO", "machine"); + } + } + + public static boolean isTileValid(TileEntity aTile) { + if (aTile != null) { + if (aTile instanceof IFluidHandler) { + IFluidHandler aFluidHandler = (IFluidHandler) aTile; + return aFluidHandler.canDrain(ForgeDirection.UNKNOWN, FluidRegistry.WATER); + } + } + return false; + } + + @Override + public boolean doesHatchMeetConditionsToGenerate() { + Block aWater = this.getBaseMetaTileEntity().getBlockAtSide(this.getBaseMetaTileEntity().getFrontFacing()); + if (aWater != null && aWater != Blocks.air) { + if (!this.canTankBeFilled()) { + return false; + } + setCrossModData(); + if (LoadedMods.EnderIO) { + if (aWater == sBlock_EIO) { + return isTileValid(this.getBaseMetaTileEntity().getTileEntityAtSide(this.getBaseMetaTileEntity().getFrontFacing())); + } + } + if (LoadedMods.RemoteIO) { + if (aWater == sBlock_RIO && this.getBaseMetaTileEntity().getMetaIDAtSide(this.getBaseMetaTileEntity().getFrontFacing()) == 0) { + return isTileValid(this.getBaseMetaTileEntity().getTileEntityAtSide(this.getBaseMetaTileEntity().getFrontFacing())); + } + } + return aWater == Blocks.water || aWater == Blocks.flowing_water; + } + return false; + } + + @Override + public void generateParticles(World aWorld, String name) { + + } + + public ITexture[] getTexturesActive(final ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, + new GT_RenderedTexture(TexturesGtBlock.Overlay_Water)}; + } + + public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, + new GT_RenderedTexture(TexturesGtBlock.Overlay_Water)}; + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java index 8cd6dd0ca8..76bd57b3fa 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java @@ -46,6 +46,10 @@ extends GregtechMetaCasingBlocksAbstract { public GregtechMetaCasingBlocks3() { super(GregtechMetaCasingItemBlocks3.class, "gtplusplus.blockcasings.3", GT_Material_Casings.INSTANCE); for (byte i = 0; i < 16; i = (byte) (i + 1)) { + // Free up Redox casing in TAE + if (i >= 4 && i <= 8) { + continue; + } TAE.registerTexture(2, i, new GT_CopiedBlockTexture(this, 6, i)); } GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Aquatic Casing"); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java index 61c71ba552..3d15e5cf58 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java @@ -18,7 +18,8 @@ import net.minecraft.world.IBlockAccess; public class GregtechMetaCasingBlocks5 extends GregtechMetaCasingBlocksAbstract { - //Free Indexes within TAE: 90, 91, 92, 94, 114, 116, 117, 118, 119, 120, 121, 124, 125, 126, 127 + // Free Indexes within TAE: 91, 92, 94, 100, 101, 102, 103, 104, 114, 116, 117, 118, 119, 120, 121, 124, 125, 126, 127 + // 19 Free Indexes private static final TexturesGrinderMultiblock mGrinderOverlayHandler = new TexturesGrinderMultiblock(); public GregtechMetaCasingBlocks5() { @@ -31,7 +32,8 @@ extends GregtechMetaCasingBlocksAbstract { TAE.registerTexture(0, 3, new GT_CopiedBlockTexture(this, 6, 3)); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Sparge Tower Exterior Casing"); // Sparge Tower Casing TAE.registerTexture(0, 4, new GT_CopiedBlockTexture(this, 6, 4)); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", ""); // Unused + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Sturdy Printer Casing"); // Unused + TAE.registerTexture(1, 10, new GT_CopiedBlockTexture(this, 6, 5)); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", ""); // Unused GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", ""); // Unused GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", ""); // Unused @@ -48,6 +50,7 @@ extends GregtechMetaCasingBlocksAbstract { GregtechItemList.Casing_IsaMill_Gearbox.set(new ItemStack(this, 1, 2)); GregtechItemList.Casing_ElementalDuplicator.set(new ItemStack(this, 1, 3)); GregtechItemList.Casing_Sparge_Tower_Exterior.set(new ItemStack(this, 1, 4)); + GregtechItemList.Casing_IndustrialAutoChisel.set(new ItemStack(this, 1, 5)); } @Override @@ -69,6 +72,8 @@ extends GregtechMetaCasingBlocksAbstract { return TexturesGtBlock.TEXTURE_TECH_PANEL_D.getIcon(); case 4: return TexturesGtBlock.Casing_Machine_Metal_Sheet_H.getIcon(); + case 5: + return TexturesGtBlock.Casing_Machine_Metal_Sheet_I.getIcon(); } } return Textures.BlockIcons.RENDERING_ERROR.getIcon(); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java index 518ffe0eae..8b372dff0c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java @@ -445,6 +445,8 @@ public class TexturesGtBlock { private static final CustomIcon Internal_Overlay_Oil = new CustomIcon("TileEntities/adv_machine_oil"); public static final CustomIcon Overlay_Oil = Internal_Overlay_Oil; + private static final CustomIcon Internal_Overlay_Water = new CustomIcon("TileEntities/adv_machine_water"); + public static final CustomIcon Overlay_Water = Internal_Overlay_Water; private static final CustomIcon Internal_Overlay_UU_Matter = new CustomIcon("TileEntities/adv_machine_uum"); public static final CustomIcon Overlay_UU_Matter = Internal_Overlay_UU_Matter; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_AutoChisel.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_AutoChisel.java new file mode 100644 index 0000000000..f2fc0cce7a --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_AutoChisel.java @@ -0,0 +1,155 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; + +import java.util.List; + +import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.item.ItemStack; +import team.chisel.carving.Carving; + +public class GregtechMetaTileEntity_AutoChisel extends GT_MetaTileEntity_BasicMachine { + + private ItemStack mInputCache; + private ItemStack mOutputCache; + + public GregtechMetaTileEntity_AutoChisel(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 1, "Chisels things, Gregtech style", 1, 1, "Compressor.png", "", + new ITexture[]{ + new GT_RenderedTexture(BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE), + new GT_RenderedTexture(BlockIcons.OVERLAY_SIDE_MASSFAB), + new GT_RenderedTexture(BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE), + new GT_RenderedTexture(BlockIcons.OVERLAY_FRONT_MULTI_SMELTER), + new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active), + new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab), + new GT_RenderedTexture(BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE), + new GT_RenderedTexture(BlockIcons.OVERLAY_BOTTOM_MASSFAB) + }); + } + + public GregtechMetaTileEntity_AutoChisel(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_AutoChisel(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName); + } + + @Override + public String[] getDescription() { + String[] A = new String[]{ + this.mDescription, + "What you want to chisel goes in slot 1", + "What you want to get goes in the special slot (bottom right)", + "If special slot is empty, first chisel result is used" + }; + return A; + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeList() { + return null; + } + + private boolean hasValidCache(ItemStack aStack, ItemStack aSpecialSlot, boolean aClearOnFailure) { + if (mInputCache != null && mOutputCache != null) { + if (GT_Utility.areStacksEqual(aStack, mInputCache) && GT_Utility.areStacksEqual(aSpecialSlot, mOutputCache)) { + return true; + } + } + // clear cache if it was invalid + if (aClearOnFailure) { + mInputCache = null; + mOutputCache = null; + } + return false; + } + + private void cacheItem(ItemStack mInputItem, ItemStack mOutputItem) { + mOutputCache = mOutputItem.copy(); + mInputCache = mInputItem.copy(); + } + + @Override + protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return hasValidCache(aStack, this.getSpecialSlot(), false) ? true : super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && hasChiselResults(aStack); + } + + // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target + private static boolean canBeMadeFrom(ItemStack from, ItemStack to) { + List<ItemStack> results = getItemsForChiseling(from); + for (ItemStack s : results) { + if (s.getItem() == to.getItem() && s.getItemDamage() == to.getItemDamage()) { + return true; + } + } + return false; + } + + // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target + private static boolean hasChiselResults(ItemStack from) { + List<ItemStack> results = getItemsForChiseling(from); + return results.size() > 0; + } + + private static List<ItemStack> getItemsForChiseling(ItemStack aStack){ + return Carving.chisel.getItemsForChiseling(aStack); + } + + private static ItemStack getChiselOutput(ItemStack aInput, ItemStack aTarget) { + ItemStack tOutput = null; + if (aTarget != null && canBeMadeFrom(aInput, aTarget)) { + tOutput = aTarget; + } + else if (aTarget != null && !canBeMadeFrom(aInput, aTarget)) { + tOutput = null; + } + else { + tOutput = getItemsForChiseling(aInput).get(0); + } + return tOutput; + } + + @Override + public int checkRecipe() { + ItemStack tOutput = null; + ItemStack aInput = getInputAt(0); + ItemStack aTarget = getSpecialSlot(); + boolean tIsCached = hasValidCache(aInput, aTarget, true); + if (aInput != null && hasChiselResults(aInput) && aInput.stackSize > 0) { + tOutput = tIsCached ? mOutputCache.copy() : getChiselOutput(aInput, aTarget); + if (tOutput != null) { + tOutput = tOutput.copy(); + tOutput.stackSize = 1; + // We can chisel this + if (canOutput(tOutput)) { + getInputAt(0).stackSize -= 1; + calculateOverclockedNess(16, 20); + //In case recipe is too OP for that machine + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) { + return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; + } + if (!tIsCached) { + cacheItem(ItemUtils.getSimpleStack(aInput, 1), ItemUtils.getSimpleStack(tOutput, 1)); + } + this.mOutputItems[0] = tOutput.copy(); + return FOUND_AND_SUCCESSFULLY_USED_RECIPE; + } + else { + mOutputBlocked++; + return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; + } + } + } + return DID_NOT_FIND_RECIPE; + } + +}
\ No newline at end of file diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java new file mode 100644 index 0000000000..b59bf61301 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java @@ -0,0 +1,474 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; + +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.ArrayUtils; + +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; + +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GTPP_Recipe; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import team.chisel.carving.Carving; + +public class GregtechMetaTileEntity_IndustrialChisel extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialChisel> { + + private int mCasing; + private IStructureDefinition<GregtechMetaTileEntity_IndustrialChisel> STRUCTURE_DEFINITION = null; + private ItemStack mInputCache; + private ItemStack mOutputCache; + private GTPP_Recipe mCachedRecipe; + + public GregtechMetaTileEntity_IndustrialChisel(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntity_IndustrialChisel(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_IndustrialChisel(this.mName); + } + + @Override + public String getMachineType() { + return "Chisel"; + } + + @Override + protected GT_Multiblock_Tooltip_Builder createTooltip() { + GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType(getMachineType()) + .addInfo("Factory Grade Auto Chisel") + .addInfo("Target block goes in GUI slot") + .addInfo("If no target provided, firdt chisel result is used") + .addInfo("Speed: 200% | Eu Usage: 75% | Parallel: Tier x 16") + .addPollutionAmount(getPollutionPerSecond(null)) + .addSeparator() + .beginStructureBlock(3, 3, 3, true) + .addController("Front center") + .addCasingInfo("Sturdy Printer Casing", 10) + .addInputBus("Any casing", 1) + .addOutputBus("Any casing", 1) + .addEnergyHatch("Any casing", 1) + .addMaintenanceHatch("Any casing", 1) + .addMufflerHatch("Any casing", 1) + .toolTipFinisher(CORE.GT_Tooltip_Builder); + return tt; + } + + @Override + public IStructureDefinition<GregtechMetaTileEntity_IndustrialChisel> getStructureDefinition() { + if (STRUCTURE_DEFINITION == null) { + STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialChisel>builder() + .addShape(mName, transpose(new String[][]{ + {"CCC", "CCC", "CCC"}, + {"C~C", "C-C", "CCC"}, + {"CCC", "CCC", "CCC"}, + })) + .addElement( + 'C', + ofChain( + ofHatchAdder( + GregtechMetaTileEntity_IndustrialChisel::addAdvChiselList, 90, 1 + ), + onElementPass( + x -> ++x.mCasing, + ofBlock( + ModBlocks.blockCasings5Misc, 5 + ) + ) + ) + ) + .build(); + } + return STRUCTURE_DEFINITION; + } + + public final boolean addAdvChiselList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } else { + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){ + return addToMachineList(aTileEntity, aBaseCasingIndex); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { + return addToMachineList(aTileEntity, aBaseCasingIndex); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){ + return addToMachineList(aTileEntity, aBaseCasingIndex); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){ + return addToMachineList(aTileEntity, aBaseCasingIndex); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { + return addToMachineList(aTileEntity, aBaseCasingIndex); + } + } + return false; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + mCasing = 0; + return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch(); + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(90), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)}; + } + return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(90)}; + } + + @Override + public boolean hasSlotInGUI() { + return true; + } + + @Override + public String getCustomGUIResourceName() { + return "ImplosionCompressor"; + } + + @Override + public boolean requiresVanillaGtGUI() { + return true; + } + + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return null; + } + + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + private boolean hasValidCache(ItemStack aStack, ItemStack aSpecialSlot, boolean aClearOnFailure) { + if (mInputCache != null && mOutputCache != null && mCachedRecipe != null) { + if (GT_Utility.areStacksEqual(aStack, mInputCache) && GT_Utility.areStacksEqual(aSpecialSlot, mOutputCache)) { + return true; + } + } + // clear cache if it was invalid + if (aClearOnFailure) { + mInputCache = null; + mOutputCache = null; + mCachedRecipe = null; + } + return false; + } + + private void cacheItem(ItemStack aInputItem, ItemStack aOutputItem, GTPP_Recipe aRecipe) { + mInputCache = aInputItem.copy(); + mOutputCache = aOutputItem.copy(); + mCachedRecipe = aRecipe; + } + + // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target + private static boolean canBeMadeFrom(ItemStack from, ItemStack to) { + List<ItemStack> results = getItemsForChiseling(from); + for (ItemStack s : results) { + if (s.getItem() == to.getItem() && s.getItemDamage() == to.getItemDamage()) { + return true; + } + } + return false; + } + + // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target + private static boolean hasChiselResults(ItemStack from) { + List<ItemStack> results = getItemsForChiseling(from); + return results.size() > 0; + } + + private static List<ItemStack> getItemsForChiseling(ItemStack aStack){ + return Carving.chisel.getItemsForChiseling(aStack); + } + + private static ItemStack getChiselOutput(ItemStack aInput, ItemStack aTarget) { + ItemStack tOutput = null; + if (aTarget != null && canBeMadeFrom(aInput, aTarget)) { + tOutput = aTarget; + } + else if (aTarget != null && !canBeMadeFrom(aInput, aTarget)) { + tOutput = null; + } + else { + tOutput = getItemsForChiseling(aInput).get(0); + } + return tOutput; + } + + private GTPP_Recipe generateChiselRecipe(ItemStack aInput, ItemStack aTarget) { + boolean tIsCached = hasValidCache(aInput, aTarget, true); + if (tIsCached || aInput != null && hasChiselResults(aInput)) { + ItemStack tOutput = tIsCached ? mOutputCache.copy() : getChiselOutput(aInput, aTarget); + if (tOutput != null) { + if (mCachedRecipe != null && GT_Utility.areStacksEqual(aInput, mInputCache) && GT_Utility.areStacksEqual(tOutput, mOutputCache)) { + return mCachedRecipe; + } + // We can chisel this + GTPP_Recipe aRecipe = new GTPP_Recipe( + false, + new ItemStack[] {ItemUtils.getSimpleStack(aInput, 1)}, + new ItemStack[] {ItemUtils.getSimpleStack(tOutput, 1)}, + null, + new int[] {10000}, + new FluidStack[] {}, + new FluidStack[] {}, + 20, + 16, + 0); + + // Cache it + cacheItem(aInput, tOutput, aRecipe); + return aRecipe; + } + } + return null; + } + + public boolean checkRecipe(final ItemStack aStack) { + ArrayList<ItemStack> aItems = this.getStoredInputs(); + if (!aItems.isEmpty()) { + + GT_Recipe tRecipe = generateChiselRecipe(aItems.get(0), this.getGUIItemStack()); + + if (tRecipe == null) { + log("BAD RETURN - 0"); + return false; + } + + // Based on the Processing Array. A bit overkill, but very flexible. + ItemStack[] aItemInputs = aItems.toArray(new ItemStack[aItems.size()]); + FluidStack[] aFluidInputs = new FluidStack[] {}; + + // Reset outputs and progress stats + this.mEUt = 0; + this.mMaxProgresstime = 0; + this.mOutputItems = new ItemStack[]{}; + this.mOutputFluids = new FluidStack[]{}; + + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + long tEnergy = getMaxInputEnergy(); + log("Running checkRecipeGeneric(0)"); + + log("Running checkRecipeGeneric(1)"); + // Remember last recipe - an optimization for findRecipe() + this.mLastRecipe = tRecipe; + + int aMaxParallelRecipes = getMaxParallelRecipes(); + int aEUPercent = getEuDiscountForParallelism(); + int aSpeedBonusPercent = 200; + + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { + log("BAD RETURN - 2"); + return false; + } + + // EU discount + float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f; + float tTotalEUt = 0.0f; + + int parallelRecipes = 0; + + log("parallelRecipes: "+parallelRecipes); + log("aMaxParallelRecipes: "+aMaxParallelRecipes); + log("tTotalEUt: "+tTotalEUt); + log("tVoltage: "+tVoltage); + log("tRecipeEUt: "+tRecipeEUt); + // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits + for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) { + if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) { + log("Broke at "+parallelRecipes+"."); + break; + } + log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+"."); + tTotalEUt += tRecipeEUt; + } + + if (parallelRecipes == 0) { + log("BAD RETURN - 3"); + return false; + } + + // -- Try not to fail after this point - inputs have already been consumed! -- + log("parallelRecipes: "+parallelRecipes); + log("aMaxParallelRecipes: "+aMaxParallelRecipes); + log("tTotalEUt: "+tTotalEUt); + log("tVoltage: "+tVoltage); + log("tRecipeEUt: "+tRecipeEUt); + + + // Convert speed bonus to duration multiplier + // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. + aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); + float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent); + this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor); + + this.mEUt = (int)Math.ceil(tTotalEUt); + + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + // Overclock + if (this.mEUt <= 16) { + this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1)); + } else { + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + + // Collect fluid outputs + FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length]; + for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) { + if (tRecipe.getFluidOutput(h) != null) { + tOutputFluids[h] = tRecipe.getFluidOutput(h).copy(); + tOutputFluids[h].amount *= parallelRecipes; + } + } + + // Collect output item types + ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length]; + for (int h = 0; h < tRecipe.mOutputs.length; h++) { + if (tRecipe.getOutput(h) != null) { + tOutputItems[h] = tRecipe.getOutput(h).copy(); + tOutputItems[h].stackSize = 0; + } + } + + // Set output item stack sizes (taking output chance into account) + for (int f = 0; f < tOutputItems.length; f++) { + if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) { + for (int g = 0; g < parallelRecipes; g++) { + if (getBaseMetaTileEntity().getRandomNumber(10000) <= tRecipe.getOutputChance(f)) + tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize; + } + } + } + + tOutputItems = removeNulls(tOutputItems); + + // Sanitize item stack size, splitting any stacks greater than max stack size + List<ItemStack> splitStacks = new ArrayList<ItemStack>(); + for (ItemStack tItem : tOutputItems) { + while (tItem.getMaxStackSize() < tItem.stackSize) { + ItemStack tmp = tItem.copy(); + tmp.stackSize = tmp.getMaxStackSize(); + tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize(); + splitStacks.add(tmp); + } + } + + if (splitStacks.size() > 0) { + ItemStack[] tmp = new ItemStack[splitStacks.size()]; + tmp = splitStacks.toArray(tmp); + tOutputItems = ArrayUtils.addAll(tOutputItems, tmp); + } + + // Strip empty stacks + List<ItemStack> tSList = new ArrayList<ItemStack>(); + for (ItemStack tS : tOutputItems) { + if (tS.stackSize > 0) tSList.add(tS); + } + tOutputItems = tSList.toArray(new ItemStack[tSList.size()]); + + // Commit outputs + this.mOutputItems = tOutputItems; + this.mOutputFluids = tOutputFluids; + updateSlots(); + + // Play sounds (GT++ addition - GT multiblocks play no sounds) + startProcess(); + + log("GOOD RETURN - 1"); + return true; + } + + return false; + } + + @Override + public int getMaxParallelRecipes() { + return (16 * GT_Utility.getTier(this.getMaxInputVoltage())); + } + + @Override + public int getEuDiscountForParallelism() { + return 75; + } + + private static String sChiselSound = null; + + private static final String getChiselSound() { + if (sChiselSound == null) { + sChiselSound = Carving.chisel.getVariationSound(Blocks.stone, 0); + } + return sChiselSound; + } + + @Override + public String getSound() { + return getChiselSound(); + } + + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + public int getPollutionPerSecond(ItemStack aStack) { + return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialChisel; + } + + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + +}
\ No newline at end of file diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialRockBreaker.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialRockBreaker.java new file mode 100644 index 0000000000..1b8835f289 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialRockBreaker.java @@ -0,0 +1,559 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; + +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; + +import org.apache.commons.lang3.ArrayUtils; + +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.TAE; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GTPP_Recipe; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map_Microwave; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +public class GregtechMetaTileEntity_IndustrialRockBreaker extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialRockBreaker> { + + private int mCasing; + private IStructureDefinition<GregtechMetaTileEntity_IndustrialRockBreaker> STRUCTURE_DEFINITION = null; + + + public GregtechMetaTileEntity_IndustrialRockBreaker(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntity_IndustrialRockBreaker(final String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_IndustrialRockBreaker(this.mName); + } + + @Override + public String getMachineType() { + return "Rock Breaker"; + } + + @Override + protected GT_Multiblock_Tooltip_Builder createTooltip() { + GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType(getMachineType()) + .addInfo("Controller Block for the Industrial Rock Breaker") + .addInfo("Speed: 200% | Eu Usage: 75% | Parallel: Tier x 8") + .addInfo("Circuit goes in the Input Bus or GUI slot") + .addInfo("1 = cobble, 2 = stone, 3 = obsidian") + .addInfo("Supply Water/Lava") + .addPollutionAmount(getPollutionPerSecond(null)) + .addSeparator() + .beginStructureBlock(3, 4, 3, true) + .addController("Bottom Center") + .addCasingInfo("Thermal Processing Casing", 9) + .addCasingInfo("Thermal Containment Casing", 16) + .addInputBus("Any Casing", 1) + .addInputHatch("Any Casing", 1) + .addOutputBus("Any Casing", 1) + .addEnergyHatch("Any Casing", 1) + .addMaintenanceHatch("Any Casing", 1) + .addMufflerHatch("Any Casing", 1) + .toolTipFinisher(CORE.GT_Tooltip_Builder); + return tt; + } + + @Override + public IStructureDefinition<GregtechMetaTileEntity_IndustrialRockBreaker> getStructureDefinition() { + if (STRUCTURE_DEFINITION == null) { + STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialRockBreaker>builder() + .addShape(mName, transpose(new String[][]{ + {"CCC", "CCC", "CCC"}, + {"HHH", "H-H", "HHH"}, + {"HHH", "H-H", "HHH"}, + {"C~C", "CCC", "CCC"}, + })) + .addElement( + 'C', + ofChain( + ofHatchAdder( + GregtechMetaTileEntity_IndustrialRockBreaker::addRockBreakerList, TAE.GTPP_INDEX(16), 1 + ), + onElementPass( + x -> ++x.mCasing, + ofBlock( + ModBlocks.blockCasings2Misc, 0 + ) + ) + ) + ) + .addElement( + 'H', + ofBlock( + ModBlocks.blockCasings2Misc, 11 + ) + ) + .build(); + } + return STRUCTURE_DEFINITION; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + buildPiece(mName , stackSize, hintsOnly, 1, 3, 0); + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + mCasing = 0; + boolean aCheckPiece = checkPiece(mName, 1, 3, 0); + boolean aCasingCount = mCasing >= 9; + boolean aCheckHatch = checkHatch(); + log(""+aCheckPiece+", "+aCasingCount+", "+aCheckHatch); + return aCheckPiece && aCasingCount && aCheckHatch; + } + + public final boolean addRockBreakerList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } else { + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){ + return addToMachineList(aTileEntity, aBaseCasingIndex); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){ + return addToMachineList(aTileEntity, aBaseCasingIndex); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){ + return addToMachineList(aTileEntity, aBaseCasingIndex); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { + return addToMachineList(aTileEntity, aBaseCasingIndex); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + return addToMachineList(aTileEntity, aBaseCasingIndex); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { + return addToMachineList(aTileEntity, aBaseCasingIndex); + } + } + return false; + } + + + @Override + public String getSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(208)); + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(16)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)}; + } + return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(16))}; + } + + @Override + public boolean hasSlotInGUI() { + return true; + } + + @Override + public boolean requiresVanillaGtGUI() { + return true; + } + + @Override + public String getCustomGUIResourceName() { + return "ElectricBlastFurnace"; + } + + private static final GT_Recipe_Map sFakeRecipeMap = new GT_Recipe_Map(new HashSet<>(0), "gt.recipe.fakerockbreaker", "Rock Breaker", "smelting", RES_PATH_GUI + "basicmachines/E_Furnace", 1, 1, 0, 0, 1, E, 1, E, true, false); + + private static void generateRecipeMap() { + if (sRecipe_Cobblestone == null || sRecipe_SmoothStone == null || sRecipe_Redstone == null) { + generateRecipes(); + } + FluidStack[] aInputFluids = new FluidStack[] {FluidUtils.getWater(1000), FluidUtils.getLava(1000)}; + GT_Recipe aTemp = sRecipe_Cobblestone.copy(); + aTemp.mFluidInputs = aInputFluids; + sFakeRecipeMap.add(aTemp); + aTemp = sRecipe_SmoothStone.copy(); + aTemp.mFluidInputs = aInputFluids; + sFakeRecipeMap.add(aTemp); + aTemp = sRecipe_Redstone.copy(); + aTemp.mFluidInputs = aInputFluids; + sFakeRecipeMap.add(aTemp); + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + if (sFakeRecipeMap.mRecipeList.isEmpty()) { + generateRecipeMap(); + } + return sFakeRecipeMap; + } + + @Override + public boolean isCorrectMachinePart(final ItemStack aStack) { + return true; + } + + private static GT_Recipe sRecipe_Cobblestone; + private static GT_Recipe sRecipe_SmoothStone; + private static GT_Recipe sRecipe_Redstone; + + private static final void generateRecipes() { + sRecipe_Cobblestone = new GTPP_Recipe( + false, + new ItemStack[] { + CI.getNumberedCircuit(1) + }, + new ItemStack[] { + ItemUtils.getSimpleStack(Blocks.cobblestone) + }, + null, + new int[] {10000}, + null, + null, + 16, + 32, + 0); + sRecipe_SmoothStone = new GTPP_Recipe( + false, + new ItemStack[] { + CI.getNumberedCircuit(2) + }, + new ItemStack[] { + ItemUtils.getSimpleStack(Blocks.stone) + }, + null, + new int[] {10000}, + null, + null, + 16, + 32, + 0); + sRecipe_Redstone = new GTPP_Recipe( + false, + new ItemStack[] { + CI.getNumberedCircuit(3), + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L) + }, + new ItemStack[] { + ItemUtils.getSimpleStack(Blocks.obsidian) + }, + null, + new int[] {10000}, + null, + null, + 128, + 32, + 0); + } + + @Override + public boolean checkRecipe(final ItemStack aStack) { + ArrayList<FluidStack> aFluids = this.getStoredFluids(); + if (!aFluids.isEmpty()) { + boolean aHasWater = false; + boolean aHasLava = false; + for (FluidStack aFluid : aFluids) { + if (aFluid.getFluid() == FluidRegistry.WATER) { + aHasWater = true; + } + else if (aFluid.getFluid() == FluidRegistry.LAVA) { + aHasLava = true; + } + } + ArrayList<ItemStack> aItems = this.getStoredInputs(); + boolean aHasRedstone = false; + if (!aItems.isEmpty()) { + for (ItemStack aItem : aItems) { + if (GT_Utility.areStacksEqual(aItem, GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L))) { + aHasRedstone = true; + break; + } + } + } + + if (!aHasWater || !aHasLava) { + log("BAD RETURN - 0-1"); + return false; + } + ItemStack aGuiCircuit = this.getGUIItemStack(); + if (aGuiCircuit == null || !ItemUtils.isControlCircuit(aGuiCircuit)) { + log("BAD RETURN - 0-2"); + return false; + } + + if (sRecipe_Cobblestone == null || sRecipe_SmoothStone == null || sRecipe_Redstone == null) { + generateRecipes(); + } + + int aCircuit = aGuiCircuit.getItemDamage(); + + GT_Recipe tRecipe = null; + switch (aCircuit) { + case 1: + tRecipe = sRecipe_Cobblestone; + break; + case 2: + tRecipe = sRecipe_SmoothStone; + break; + case 3: + if (aHasRedstone) { + tRecipe = sRecipe_Redstone; + } + break; + } + + if (tRecipe == null) { + log("BAD RETURN - 0-3"); + return false; + } + + // Based on the Processing Array. A bit overkill, but very flexible. + ItemStack[] aItemInputs = aItems.toArray(new ItemStack[aItems.size()]); + FluidStack[] aFluidInputs = new FluidStack[] {}; + + // Reset outputs and progress stats + this.mEUt = 0; + this.mMaxProgresstime = 0; + this.mOutputItems = new ItemStack[]{}; + this.mOutputFluids = new FluidStack[]{}; + + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + long tEnergy = getMaxInputEnergy(); + log("Running checkRecipeGeneric(0)"); + + log("Running checkRecipeGeneric(1)"); + // Remember last recipe - an optimization for findRecipe() + this.mLastRecipe = tRecipe; + + int aMaxParallelRecipes = getMaxParallelRecipes(); + int aEUPercent = getEuDiscountForParallelism(); + int aSpeedBonusPercent = 200; + + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { + log("BAD RETURN - 2"); + return false; + } + + // EU discount + float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f; + float tTotalEUt = 0.0f; + + int parallelRecipes = 0; + + log("parallelRecipes: "+parallelRecipes); + log("aMaxParallelRecipes: "+aMaxParallelRecipes); + log("tTotalEUt: "+tTotalEUt); + log("tVoltage: "+tVoltage); + log("tRecipeEUt: "+tRecipeEUt); + + if (aItems.size() > 0 && aCircuit == 3) { + // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits + for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) { + if (!this.depleteInput(tRecipe.mInputs[1])) { + break; + } + log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+"."); + tTotalEUt += tRecipeEUt; + } + } + else if (aCircuit >= 1 && aCircuit <= 2) { + for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) { + log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+"."); + tTotalEUt += tRecipeEUt; + } + } + + log("Broke at "+parallelRecipes+"."); + if (parallelRecipes == 0) { + log("BAD RETURN - 3"); + return false; + } + + // -- Try not to fail after this point - inputs have already been consumed! -- + + + + // Convert speed bonus to duration multiplier + // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. + aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); + float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent); + this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor); + + this.mEUt = (int)Math.ceil(tTotalEUt); + + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + // Overclock + if (this.mEUt <= 16) { + this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1)); + } else { + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + + // Collect fluid outputs + FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length]; + for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) { + if (tRecipe.getFluidOutput(h) != null) { + tOutputFluids[h] = tRecipe.getFluidOutput(h).copy(); + tOutputFluids[h].amount *= parallelRecipes; + } + } + + // Collect output item types + ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length]; + for (int h = 0; h < tRecipe.mOutputs.length; h++) { + if (tRecipe.getOutput(h) != null) { + tOutputItems[h] = tRecipe.getOutput(h).copy(); + tOutputItems[h].stackSize = 0; + } + } + + // Set output item stack sizes (taking output chance into account) + for (int f = 0; f < tOutputItems.length; f++) { + if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) { + for (int g = 0; g < parallelRecipes; g++) { + if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) + tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize; + } + } + } + + tOutputItems = removeNulls(tOutputItems); + + // Sanitize item stack size, splitting any stacks greater than max stack size + List<ItemStack> splitStacks = new ArrayList<ItemStack>(); + for (ItemStack tItem : tOutputItems) { + while (tItem.getMaxStackSize() < tItem.stackSize) { + ItemStack tmp = tItem.copy(); + tmp.stackSize = tmp.getMaxStackSize(); + tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize(); + splitStacks.add(tmp); + } + } + + if (splitStacks.size() > 0) { + ItemStack[] tmp = new ItemStack[splitStacks.size()]; + tmp = splitStacks.toArray(tmp); + tOutputItems = ArrayUtils.addAll(tOutputItems, tmp); + } + + // Strip empty stacks + List<ItemStack> tSList = new ArrayList<ItemStack>(); + for (ItemStack tS : tOutputItems) { + if (tS.stackSize > 0) tSList.add(tS); + } + tOutputItems = tSList.toArray(new ItemStack[tSList.size()]); + + // Commit outputs + this.mOutputItems = tOutputItems; + this.mOutputFluids = tOutputFluids; + updateSlots(); + + // Play sounds (GT++ addition - GT multiblocks play no sounds) + startProcess(); + + log("GOOD RETURN - 1"); + return true; + } + + return false; + } + + @Override + public int getMaxParallelRecipes() { + return (8 * GT_Utility.getTier(this.getMaxInputVoltage())); + } + + @Override + public int getEuDiscountForParallelism() { + return 75; + } + + @Override + public int getMaxEfficiency(final ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerSecond(final ItemStack aStack) { + return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialRockBreaker; + } + + @Override + public int getDamageToComponent(final ItemStack aStack) { + return 0; + } + + @Override + public int getAmountOfOutputs() { + return 2; + } + + @Override + public boolean explodesOnComponentBreak(final ItemStack aStack) { + return false; + } + + @Override + public ArrayList<ItemStack> getStoredInputs() { + ArrayList<ItemStack> aInputs = super.getStoredInputs(); + if (this.hasSlotInGUI() && this.getGUIItemStack() != null) { + aInputs.add(this.getGUIItemStack()); + } + return aInputs; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index be4d6a8f7d..2b324fc172 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -658,14 +658,6 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { if (((aInput1 == null) && (aFluidInput == null)) || ((aOutput1 == null) && (aFluidOutput == null))) { return false; } - if ((aOutput1 != null) - && ((aDuration = GregTech_API.sRecipeFile.get("advancedmixer", aOutput1, aDuration)) <= 0)) { - return false; - } - if ((aFluidOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("advancedmixer", - aFluidOutput.getFluid().getName(), aDuration)) <= 0)) { - return false; - } GTPP_Recipe aSpecialRecipe = new GTPP_Recipe( true, new ItemStack[] { aInput1, aInput2, aInput3, aInput4 }, @@ -678,17 +670,9 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { Math.max(1, aEUt), 0); - int aSize = GTPP_Recipe.GTPP_Recipe_Map.sAdvancedMixerRecipes.mRecipeList.size(); - int aSize2 = aSize; - GTPP_Recipe.GTPP_Recipe_Map.sAdvancedMixerRecipes.add(aSpecialRecipe); - aSize = GTPP_Recipe.GTPP_Recipe_Map.sAdvancedMixerRecipes.mRecipeList.size(); - - /*GTPP_Recipe.GTPP_Recipe_Map.sAdvancedMixerRecipes.addRecipe(true, - new ItemStack[] { aInput1, aInput2, aInput3, aInput4 }, - new ItemStack[] { aOutput1, aOutput2, aOutput3, aOutput4 }, null, null, - new FluidStack[] { aFluidInput }, new FluidStack[] { aFluidOutput }, aDuration, aEUt, 0);*/ - - return aSize > aSize2; + int aSize = GT_Recipe_Map.sMixerRecipes.mRecipeList.size(); + GT_Recipe_Map.sMixerRecipes.add(aSpecialRecipe); + return GT_Recipe_Map.sMixerRecipes.mRecipeList.size() > aSize; } // Machine Component Assembler @@ -1445,18 +1429,18 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } @Override - public boolean addUvLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu) { + public boolean addUvLaserRecipe(ItemStack aInput1, ItemStack aOutput, int time, long eu) { // Generate Special Laser Recipe GT_Recipe u = new GTPP_Recipe( false, new ItemStack[] { aInput1, - aInput2, + GregtechItemList.Laser_Lens_WoodsGlass.get(1), }, new ItemStack[] { aOutput }, - GregtechItemList.Laser_Lens_WoodsGlass.get(1), + null, new int[] { 10000 }, @@ -1469,8 +1453,8 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } @Override - public boolean addIrLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu) { - return addUvLaserRecipe(aInput1, aInput2, aOutput, time, eu); + public boolean addIrLaserRecipe(ItemStack aInput1, ItemStack aOutput, int time, long eu) { + return addUvLaserRecipe(aInput1, aOutput, time, eu); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java index 64e77393bd..b93933d088 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java @@ -68,7 +68,12 @@ public class GregtechCustomHatches { // Multiblock Air Intake Hatch GregtechItemList.Hatch_Air_Intake.set(new GT_MetaTileEntity_Hatch_AirIntake(861, "hatch.air.intake.tier.00", "Air Intake Hatch", 5).getStackForm(1L)); + GregtechItemList.Hatch_Air_Intake_Extreme.set(new GT_MetaTileEntity_Hatch_AirIntake_Extreme(31070, "hatch.air.intake.tier.01", "Extreme Air Intake Hatch", 6).getStackForm(1L)); + // Multiblock Reservoir Hatch + GregtechItemList.Hatch_Reservoir.set(new GT_MetaTileEntity_Hatch_Reservoir(31071, "hatch.water.intake.tier.00", "Reservoir Hatch", 6).getStackForm(1L)); + + // Steam Hatch GregtechItemList.Hatch_Input_Steam .set(new GT_MetaTileEntity_Hatch_CustomFluidBase(FluidUtils.getSteam(1).getFluid(), // Fluid diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialChisel.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialChisel.java new file mode 100644 index 0000000000..2027e6b190 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialChisel.java @@ -0,0 +1,25 @@ +package gtPlusPlus.xmod.gregtech.registration.gregtech; + +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaTileEntity_AutoChisel; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialChisel; + +public class GregtechIndustrialChisel { + + public static void run() { + GregtechItemList.GT_Chisel_LV.set(new GregtechMetaTileEntity_AutoChisel(31066, + "chisel.tier.01", "Basic Auto-Chisel", 1).getStackForm(1L)); + GregtechItemList.GT_Chisel_MV.set(new GregtechMetaTileEntity_AutoChisel(31067, + "chisel.tier.02", "Advanced Auto-Chisel", 2).getStackForm(1L)); + GregtechItemList.GT_Chisel_HV.set(new GregtechMetaTileEntity_AutoChisel(31068, + "chisel.tier.03", "Precision Auto-Chisel", 3).getStackForm(1L)); + + GregtechItemList.Controller_IndustrialAutoChisel.set( + new GregtechMetaTileEntity_IndustrialChisel(31069, + "multimachine.adv.chisel", + "Industrial 3D Copying Machine").getStackForm(1L)); + + + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialRockBreaker.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialRockBreaker.java new file mode 100644 index 0000000000..562693ee3e --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialRockBreaker.java @@ -0,0 +1,13 @@ +package gtPlusPlus.xmod.gregtech.registration.gregtech; + +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_IndustrialRockBreaker; + +public class GregtechIndustrialRockBreaker { + + public static void run() { + GregtechItemList.Controller_IndustrialRockBreaker.set(new GregtechMetaTileEntity_IndustrialRockBreaker(31065, + "industrialrockcrusher.controller.tier.single", "Boldarnator").getStackForm(1L)); + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialSifter.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialSifter.java index 15bf42c9d4..8fa4cb6cb1 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialSifter.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialSifter.java @@ -18,7 +18,6 @@ public class GregtechIndustrialSifter { } private static void run1() { - // Industrial Maceration Stack Multiblock GregtechItemList.Industrial_Sifter.set(new GregtechMetaTileEntity_IndustrialSifter(840, "industrialsifter.controller.tier.single", "Large Sifter Control Block").getStackForm(1L)); diff --git a/src/main/resources/assets/miscutils/lang/en_US.lang b/src/main/resources/assets/miscutils/lang/en_US.lang index 476062476f..a3639062f8 100644 --- a/src/main/resources/assets/miscutils/lang/en_US.lang +++ b/src/main/resources/assets/miscutils/lang/en_US.lang @@ -3368,3 +3368,4 @@ item.FrothMonaziteflotation.name=Monazite Flotation Froth Cell //Added 18/12/21 item.BasicGenericChemItem.13.name=Formaldehyde Catalyst +item.hydrogenchloridemix.name=Hydrogen Chlorine Mix
\ No newline at end of file diff --git a/src/main/resources/assets/miscutils/textures/blocks/TileEntities/adv_machine_water.png b/src/main/resources/assets/miscutils/textures/blocks/TileEntities/adv_machine_water.png Binary files differnew file mode 100644 index 0000000000..3351f5d0a6 --- /dev/null +++ b/src/main/resources/assets/miscutils/textures/blocks/TileEntities/adv_machine_water.png |