From 74cb12a7ca9c8ba0cfd63e8ca743e1b8820fea21 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 16 Feb 2019 14:36:34 +0100 Subject: Backup theese default methods --- .../dreamcraft/DreamCraftRecipeLoader.java | 2 +- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 2 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 2 +- .../tectech/loader/thing/MachineLoader.java | 148 ++++++------- .../thing/item/ConstructableTriggerItem.java | 2 +- .../tectech/thing/item/ParametrizerMemoryCard.java | 2 +- .../hatch/GT_MetaTileEntity_Hatch_Capacitor.java | 2 +- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 2 +- .../hatch/GT_MetaTileEntity_Hatch_Holder.java | 2 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 2 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 2 +- .../multi/GT_MetaTileEntity_EM_research.java | 6 +- .../multi/GT_MetaTileEntity_TM_microwave.java | 2 +- .../multi/base/GT_Container_MultiMachineEM.java | 4 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 203 ++++++----------- .../metaTileEntity/multi/base/Parameters.java | 240 +++++++++++++++++++++ .../em_machine/GT_MetaTileEntity_EM_machine.java | 4 + 17 files changed, 401 insertions(+), 226 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 1d1c80f0da..a70f85d62d 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -716,7 +716,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(9216)}, ItemList.Field_Generator_UEV.get(1L), 4000, 800000); - //UHV Energy Hatch + //UHV Energy ParameterDefinition TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Energy_UV.get(1L), 24000, 16, 50000, 2, new Object[]{ ItemList.Hull_MAX.get(1L), diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index 84cd28b7c9..9e6f3f3c77 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -52,7 +52,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ private static final String[] description = new String[]{ EnumChatFormatting.AQUA+"Hint Details:", "1 - Classic Hatches or High Power Casing", - "2 - Elemental Input Hatch", + "2 - Elemental Input ParameterDefinition", "3 - Elemental Overflow Hatches or Elemental Casing", "General - Some sort of Essentia Storage", }; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index d45060c758..d97c28a2be 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -52,7 +52,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu private static final String[] description = new String[]{ EnumChatFormatting.AQUA+"Hint Details:", "1 - Classic Hatches or High Power Casing", - "2 - Elemental Output Hatch", + "2 - Elemental Output ParameterDefinition", "3 - Elemental Overflow Hatches or Elemental Casing", "General - Some sort of Essentia Storage", }; diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index c1b78523c5..deca78bf6e 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -26,133 +26,133 @@ public class MachineLoader implements Runnable { // =================================================================================================== eM_in_UV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15000, "hatch.emin.tier.08", "UV Elemental Input Hatch", 8).getStackForm(1L)); + 15000, "hatch.emin.tier.08", "UV Elemental Input ParameterDefinition", 8).getStackForm(1L)); eM_in_UHV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15001, "hatch.emin.tier.09", "UHV Elemental Input Hatch", 9).getStackForm(1L)); + 15001, "hatch.emin.tier.09", "UHV Elemental Input ParameterDefinition", 9).getStackForm(1L)); eM_in_UEV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15002, "hatch.emin.tier.10", "UEV Elemental Input Hatch", 10).getStackForm(1L)); + 15002, "hatch.emin.tier.10", "UEV Elemental Input ParameterDefinition", 10).getStackForm(1L)); eM_in_UIV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15003, "hatch.emin.tier.11", "UIV Elemental Input Hatch", 11).getStackForm(1L)); + 15003, "hatch.emin.tier.11", "UIV Elemental Input ParameterDefinition", 11).getStackForm(1L)); eM_in_UMV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15004, "hatch.emin.tier.12", "UMV Elemental Input Hatch", 12).getStackForm(1L)); + 15004, "hatch.emin.tier.12", "UMV Elemental Input ParameterDefinition", 12).getStackForm(1L)); eM_in_UXV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15005, "hatch.emin.tier.13", "UXV Elemental Input Hatch", 13).getStackForm(1L)); + 15005, "hatch.emin.tier.13", "UXV Elemental Input ParameterDefinition", 13).getStackForm(1L)); // =================================================================================================== // eM OUT // =================================================================================================== eM_out_UV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15010, "hatch.emout.tier.08", "UV Elemental Output Hatch", 8).getStackForm(1L)); + 15010, "hatch.emout.tier.08", "UV Elemental Output ParameterDefinition", 8).getStackForm(1L)); eM_out_UHV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15011, "hatch.emout.tier.09", "UHV Elemental Output Hatch", 9).getStackForm(1L)); + 15011, "hatch.emout.tier.09", "UHV Elemental Output ParameterDefinition", 9).getStackForm(1L)); eM_out_UEV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15012, "hatch.emout.tier.10", "UEV Elemental Output Hatch", 10).getStackForm(1L)); + 15012, "hatch.emout.tier.10", "UEV Elemental Output ParameterDefinition", 10).getStackForm(1L)); eM_out_UIV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15013, "hatch.emout.tier.11", "UIV Elemental Output Hatch", 11).getStackForm(1L)); + 15013, "hatch.emout.tier.11", "UIV Elemental Output ParameterDefinition", 11).getStackForm(1L)); eM_out_UMV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15014, "hatch.emout.tier.12", "UMV Elemental Output Hatch", 12).getStackForm(1L)); + 15014, "hatch.emout.tier.12", "UMV Elemental Output ParameterDefinition", 12).getStackForm(1L)); eM_out_UXV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15015, "hatch.emout.tier.13", "UXV Elemental Output Hatch", 13).getStackForm(1L)); + 15015, "hatch.emout.tier.13", "UXV Elemental Output ParameterDefinition", 13).getStackForm(1L)); // =================================================================================================== // eM Waste OUT // =================================================================================================== eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f).getStackForm(1L)); + 15020, "hatch.emmuffler.tier.08", "UV Overflow Output ParameterDefinition", 8, 1e10f).getStackForm(1L)); eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f).getStackForm(1L)); + 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output ParameterDefinition", 9, 5e10f).getStackForm(1L)); eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f).getStackForm(1L)); + 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output ParameterDefinition", 10, 25e10f).getStackForm(1L)); eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f).getStackForm(1L)); + 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output ParameterDefinition", 11, 125e10f).getStackForm(1L)); eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f).getStackForm(1L)); + 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output ParameterDefinition", 12, 125e11f).getStackForm(1L)); eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f).getStackForm(1L)); + 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output ParameterDefinition", 13, 125e12f).getStackForm(1L)); // =================================================================================================== // Multi AMP Power INPUTS // =================================================================================================== eM_energymulti4_IV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15100, "hatch.energymulti04.tier.05", "IV 4A Energy Hatch", 5, 4).getStackForm(1L)); + 15100, "hatch.energymulti04.tier.05", "IV 4A Energy ParameterDefinition", 5, 4).getStackForm(1L)); eM_energymulti16_IV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15110, "hatch.energymulti16.tier.05", "IV 16A Energy Hatch", 5, 16).getStackForm(1L)); + 15110, "hatch.energymulti16.tier.05", "IV 16A Energy ParameterDefinition", 5, 16).getStackForm(1L)); eM_energymulti64_IV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15120, "hatch.energymulti64.tier.05", "IV 64A Energy Hatch", 5, 64).getStackForm(1L)); + 15120, "hatch.energymulti64.tier.05", "IV 64A Energy ParameterDefinition", 5, 64).getStackForm(1L)); eM_energymulti4_LuV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15101, "hatch.energymulti04.tier.06", "LuV 4A Energy Hatch", 6, 4).getStackForm(1L)); + 15101, "hatch.energymulti04.tier.06", "LuV 4A Energy ParameterDefinition", 6, 4).getStackForm(1L)); eM_energymulti16_LuV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15111, "hatch.energymulti16.tier.06", "LuV 16A Energy Hatch", 6, 16).getStackForm(1L)); + 15111, "hatch.energymulti16.tier.06", "LuV 16A Energy ParameterDefinition", 6, 16).getStackForm(1L)); eM_energymulti64_LuV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15121, "hatch.energymulti64.tier.06", "LuV 64A Energy Hatch", 6, 64).getStackForm(1L)); + 15121, "hatch.energymulti64.tier.06", "LuV 64A Energy ParameterDefinition", 6, 64).getStackForm(1L)); eM_energymulti4_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15102, "hatch.energymulti04.tier.07", "ZPM 4A Energy Hatch", 7, 4).getStackForm(1L)); + 15102, "hatch.energymulti04.tier.07", "ZPM 4A Energy ParameterDefinition", 7, 4).getStackForm(1L)); eM_energymulti16_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15112, "hatch.energymulti16.tier.07", "ZPM 16A Energy Hatch", 7, 16).getStackForm(1L)); + 15112, "hatch.energymulti16.tier.07", "ZPM 16A Energy ParameterDefinition", 7, 16).getStackForm(1L)); eM_energymulti64_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15122, "hatch.energymulti64.tier.07", "ZPM 64A Energy Hatch", 7, 64).getStackForm(1L)); + 15122, "hatch.energymulti64.tier.07", "ZPM 64A Energy ParameterDefinition", 7, 64).getStackForm(1L)); eM_energymulti4_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15103, "hatch.energymulti04.tier.08", "UV 4A Energy Hatch", 8, 4).getStackForm(1L)); + 15103, "hatch.energymulti04.tier.08", "UV 4A Energy ParameterDefinition", 8, 4).getStackForm(1L)); eM_energymulti16_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15113, "hatch.energymulti16.tier.08", "UV 16A Energy Hatch", 8, 16).getStackForm(1L)); + 15113, "hatch.energymulti16.tier.08", "UV 16A Energy ParameterDefinition", 8, 16).getStackForm(1L)); eM_energymulti64_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15123, "hatch.energymulti64.tier.08", "UV 64A Energy Hatch", 8, 64).getStackForm(1L)); + 15123, "hatch.energymulti64.tier.08", "UV 64A Energy ParameterDefinition", 8, 64).getStackForm(1L)); eM_energymulti4_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15104, "hatch.energymulti04.tier.09", "UHV 4A Energy Hatch", 9, 4).getStackForm(1L)); + 15104, "hatch.energymulti04.tier.09", "UHV 4A Energy ParameterDefinition", 9, 4).getStackForm(1L)); eM_energymulti16_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15114, "hatch.energymulti16.tier.09", "UHV 16A Energy Hatch", 9, 16).getStackForm(1L)); + 15114, "hatch.energymulti16.tier.09", "UHV 16A Energy ParameterDefinition", 9, 16).getStackForm(1L)); eM_energymulti64_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15124, "hatch.energymulti64.tier.09", "UHV 64A Energy Hatch", 9, 64).getStackForm(1L)); + 15124, "hatch.energymulti64.tier.09", "UHV 64A Energy ParameterDefinition", 9, 64).getStackForm(1L)); eM_energymulti4_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15105, "hatch.energymulti04.tier.10", "UEV 4A Energy Hatch", 10, 4).getStackForm(1L)); + 15105, "hatch.energymulti04.tier.10", "UEV 4A Energy ParameterDefinition", 10, 4).getStackForm(1L)); eM_energymulti16_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15115, "hatch.energymulti16.tier.10", "UEV 16A Energy Hatch", 10, 16).getStackForm(1L)); + 15115, "hatch.energymulti16.tier.10", "UEV 16A Energy ParameterDefinition", 10, 16).getStackForm(1L)); eM_energymulti64_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15125, "hatch.energymulti64.tier.10", "UEV 64A Energy Hatch", 10, 64).getStackForm(1L)); + 15125, "hatch.energymulti64.tier.10", "UEV 64A Energy ParameterDefinition", 10, 64).getStackForm(1L)); eM_energymulti4_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15106, "hatch.energymulti04.tier.11", "UIV 4A Energy Hatch", 11, 4).getStackForm(1L)); + 15106, "hatch.energymulti04.tier.11", "UIV 4A Energy ParameterDefinition", 11, 4).getStackForm(1L)); eM_energymulti16_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15116, "hatch.energymulti16.tier.11", "UIV 16A Energy Hatch", 11, 16).getStackForm(1L)); + 15116, "hatch.energymulti16.tier.11", "UIV 16A Energy ParameterDefinition", 11, 16).getStackForm(1L)); eM_energymulti64_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15126, "hatch.energymulti64.tier.11", "UIV 64A Energy Hatch", 11, 64).getStackForm(1L)); + 15126, "hatch.energymulti64.tier.11", "UIV 64A Energy ParameterDefinition", 11, 64).getStackForm(1L)); eM_energymulti4_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15107, "hatch.energymulti04.tier.12", "UMV 4A Energy Hatch", 12, 4).getStackForm(1L)); + 15107, "hatch.energymulti04.tier.12", "UMV 4A Energy ParameterDefinition", 12, 4).getStackForm(1L)); eM_energymulti16_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15117, "hatch.energymulti16.tier.12", "UMV 16A Energy Hatch", 12, 16).getStackForm(1L)); + 15117, "hatch.energymulti16.tier.12", "UMV 16A Energy ParameterDefinition", 12, 16).getStackForm(1L)); eM_energymulti64_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15127, "hatch.energymulti64.tier.12", "UMV 64A Energy Hatch", 12, 64).getStackForm(1L)); + 15127, "hatch.energymulti64.tier.12", "UMV 64A Energy ParameterDefinition", 12, 64).getStackForm(1L)); eM_energymulti4_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15108, "hatch.energymulti04.tier.13", "UXV 4A Energy Hatch", 13, 4).getStackForm(1L)); + 15108, "hatch.energymulti04.tier.13", "UXV 4A Energy ParameterDefinition", 13, 4).getStackForm(1L)); eM_energymulti16_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15118, "hatch.energymulti16.tier.13", "UXV 16A Energy Hatch", 13, 16).getStackForm(1L)); + 15118, "hatch.energymulti16.tier.13", "UXV 16A Energy ParameterDefinition", 13, 16).getStackForm(1L)); eM_energymulti64_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15128, "hatch.energymulti64.tier.13", "UXV 64A Energy Hatch", 13, 64).getStackForm(1L)); + 15128, "hatch.energymulti64.tier.13", "UXV 64A Energy ParameterDefinition", 13, 64).getStackForm(1L)); // =================================================================================================== // Multi AMP Power OUTPUTS @@ -160,67 +160,67 @@ public class MachineLoader implements Runnable { eM_dynamomulti4_IV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15200, "hatch.dynamomulti04.tier.05", "IV 4A Dynamo Hatch", 5, 4).getStackForm(1L)); + 15200, "hatch.dynamomulti04.tier.05", "IV 4A Dynamo ParameterDefinition", 5, 4).getStackForm(1L)); eM_dynamomulti16_IV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15210, "hatch.dynamomulti16.tier.05", "IV 16A Dynamo Hatch", 5, 16).getStackForm(1L)); + 15210, "hatch.dynamomulti16.tier.05", "IV 16A Dynamo ParameterDefinition", 5, 16).getStackForm(1L)); eM_dynamomulti64_IV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15220, "hatch.dynamomulti64.tier.05", "IV 64A Dynamo Hatch", 5, 64).getStackForm(1L)); + 15220, "hatch.dynamomulti64.tier.05", "IV 64A Dynamo ParameterDefinition", 5, 64).getStackForm(1L)); eM_dynamomulti4_LuV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15201, "hatch.dynamomulti04.tier.06", "LuV 4A Dynamo Hatch", 6, 4).getStackForm(1L)); + 15201, "hatch.dynamomulti04.tier.06", "LuV 4A Dynamo ParameterDefinition", 6, 4).getStackForm(1L)); eM_dynamomulti16_LuV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15211, "hatch.dynamomulti16.tier.06", "LuV 16A Dynamo Hatch", 6, 16).getStackForm(1L)); + 15211, "hatch.dynamomulti16.tier.06", "LuV 16A Dynamo ParameterDefinition", 6, 16).getStackForm(1L)); eM_dynamomulti64_LuV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15221, "hatch.dynamomulti64.tier.06", "LuV 64A Dynamo Hatch", 6, 64).getStackForm(1L)); + 15221, "hatch.dynamomulti64.tier.06", "LuV 64A Dynamo ParameterDefinition", 6, 64).getStackForm(1L)); eM_dynamomulti4_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15202, "hatch.dynamomulti04.tier.07", "ZPM 4A Dynamo Hatch", 7, 4).getStackForm(1L)); + 15202, "hatch.dynamomulti04.tier.07", "ZPM 4A Dynamo ParameterDefinition", 7, 4).getStackForm(1L)); eM_dynamomulti16_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15212, "hatch.dynamomulti16.tier.07", "ZPM 16A Dynamo Hatch", 7, 16).getStackForm(1L)); + 15212, "hatch.dynamomulti16.tier.07", "ZPM 16A Dynamo ParameterDefinition", 7, 16).getStackForm(1L)); eM_dynamomulti64_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15222, "hatch.dynamomulti64.tier.07", "ZPM 64A Dynamo Hatch", 7, 64).getStackForm(1L)); + 15222, "hatch.dynamomulti64.tier.07", "ZPM 64A Dynamo ParameterDefinition", 7, 64).getStackForm(1L)); eM_dynamomulti4_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15203, "hatch.dynamomulti04.tier.08", "UV 4A Dynamo Hatch", 8, 4).getStackForm(1L)); + 15203, "hatch.dynamomulti04.tier.08", "UV 4A Dynamo ParameterDefinition", 8, 4).getStackForm(1L)); eM_dynamomulti16_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15213, "hatch.dynamomulti16.tier.08", "UV 16A Dynamo Hatch", 8, 16).getStackForm(1L)); + 15213, "hatch.dynamomulti16.tier.08", "UV 16A Dynamo ParameterDefinition", 8, 16).getStackForm(1L)); eM_dynamomulti64_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15223, "hatch.dynamomulti64.tier.08", "UV 64A Dynamo Hatch", 8, 64).getStackForm(1L)); + 15223, "hatch.dynamomulti64.tier.08", "UV 64A Dynamo ParameterDefinition", 8, 64).getStackForm(1L)); eM_dynamomulti4_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15204, "hatch.dynamomulti04.tier.09", "UHV 4A Dynamo Hatch", 9, 4).getStackForm(1L)); + 15204, "hatch.dynamomulti04.tier.09", "UHV 4A Dynamo ParameterDefinition", 9, 4).getStackForm(1L)); eM_dynamomulti16_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15214, "hatch.dynamomulti16.tier.09", "UHV 16A Dynamo Hatch", 9, 16).getStackForm(1L)); + 15214, "hatch.dynamomulti16.tier.09", "UHV 16A Dynamo ParameterDefinition", 9, 16).getStackForm(1L)); eM_dynamomulti64_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15224, "hatch.dynamomulti64.tier.09", "UHV 64A Dynamo Hatch", 9, 64).getStackForm(1L)); + 15224, "hatch.dynamomulti64.tier.09", "UHV 64A Dynamo ParameterDefinition", 9, 64).getStackForm(1L)); eM_dynamomulti4_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15205, "hatch.dynamomulti04.tier.10", "UEV 4A Dynamo Hatch", 10, 4).getStackForm(1L)); + 15205, "hatch.dynamomulti04.tier.10", "UEV 4A Dynamo ParameterDefinition", 10, 4).getStackForm(1L)); eM_dynamomulti16_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15215, "hatch.dynamomulti16.tier.10", "UEV 16A Dynamo Hatch", 10, 16).getStackForm(1L)); + 15215, "hatch.dynamomulti16.tier.10", "UEV 16A Dynamo ParameterDefinition", 10, 16).getStackForm(1L)); eM_dynamomulti64_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15225, "hatch.dynamomulti64.tier.10", "UEV 64A Dynamo Hatch", 10, 64).getStackForm(1L)); + 15225, "hatch.dynamomulti64.tier.10", "UEV 64A Dynamo ParameterDefinition", 10, 64).getStackForm(1L)); eM_dynamomulti4_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15206, "hatch.dynamomulti04.tier.11", "UIV 4A Dynamo Hatch", 11, 4).getStackForm(1L)); + 15206, "hatch.dynamomulti04.tier.11", "UIV 4A Dynamo ParameterDefinition", 11, 4).getStackForm(1L)); eM_dynamomulti16_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15216, "hatch.dynamomulti16.tier.11", "UIV 16A Dynamo Hatch", 11, 16).getStackForm(1L)); + 15216, "hatch.dynamomulti16.tier.11", "UIV 16A Dynamo ParameterDefinition", 11, 16).getStackForm(1L)); eM_dynamomulti64_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15226, "hatch.dynamomulti64.tier.11", "UIV 64A Dynamo Hatch", 11, 64).getStackForm(1L)); + 15226, "hatch.dynamomulti64.tier.11", "UIV 64A Dynamo ParameterDefinition", 11, 64).getStackForm(1L)); eM_dynamomulti4_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15207, "hatch.dynamomulti04.tier.12", "UMV 4A Dynamo Hatch", 12, 4).getStackForm(1L)); + 15207, "hatch.dynamomulti04.tier.12", "UMV 4A Dynamo ParameterDefinition", 12, 4).getStackForm(1L)); eM_dynamomulti16_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15217, "hatch.dynamomulti16.tier.12", "UMV 16A Dynamo Hatch", 12, 16).getStackForm(1L)); + 15217, "hatch.dynamomulti16.tier.12", "UMV 16A Dynamo ParameterDefinition", 12, 16).getStackForm(1L)); eM_dynamomulti64_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15227, "hatch.dynamomulti64.tier.12", "UMV 64A Dynamo Hatch", 12, 64).getStackForm(1L)); + 15227, "hatch.dynamomulti64.tier.12", "UMV 64A Dynamo ParameterDefinition", 12, 64).getStackForm(1L)); eM_dynamomulti4_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15208, "hatch.dynamomulti04.tier.13", "UXV 4A Dynamo Hatch", 13, 4).getStackForm(1L)); + 15208, "hatch.dynamomulti04.tier.13", "UXV 4A Dynamo ParameterDefinition", 13, 4).getStackForm(1L)); eM_dynamomulti16_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15218, "hatch.dynamomulti16.tier.13", "UXV 16A Dynamo Hatch", 13, 16).getStackForm(1L)); + 15218, "hatch.dynamomulti16.tier.13", "UXV 16A Dynamo ParameterDefinition", 13, 16).getStackForm(1L)); eM_dynamomulti64_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15228, "hatch.dynamomulti64.tier.13", "UXV 64A Dynamo Hatch", 13, 64).getStackForm(1L)); + 15228, "hatch.dynamomulti64.tier.13", "UXV 64A Dynamo ParameterDefinition", 13, 64).getStackForm(1L)); // =================================================================================================== // MULTIBLOCKS @@ -279,7 +279,7 @@ public class MachineLoader implements Runnable { rack_Hatch.set(new GT_MetaTileEntity_Hatch_Rack(15450, "hatch.rack.tier.08", "Computer Rack", 8, "4 Slot Rack").getStackForm(1L)); holder_Hatch.set(new GT_MetaTileEntity_Hatch_Holder(15451, "hatch.holder.tier.09", "Object Holder", 8, "For Research Station").getStackForm(1L)); - capacitor_Hatch.set(new GT_MetaTileEntity_Hatch_Capacitor(15452, "hatch.capacitor.tier.05", "Capacitor Hatch", 5, "For Tesla Coil").getStackForm(1L)); + capacitor_Hatch.set(new GT_MetaTileEntity_Hatch_Capacitor(15452, "hatch.capacitor.tier.05", "Capacitor ParameterDefinition", 5, "For Tesla Coil").getStackForm(1L)); // =================================================================================================== // Pipes @@ -309,7 +309,7 @@ public class MachineLoader implements Runnable { // =================================================================================================== // Debug Stuff // =================================================================================================== - hatch_CreativeMaitenance.set(new GT_MetaTileEntity_Hatch_CreativeMaintenance(15497, "debug.tt.maintenance", "Debug Maintenance Hatch", 15).getStackForm(1L)); + hatch_CreativeMaitenance.set(new GT_MetaTileEntity_Hatch_CreativeMaintenance(15497, "debug.tt.maintenance", "Debug Maintenance ParameterDefinition", 15).getStackForm(1L)); Machine_DebugGenny.set(new GT_MetaTileEntity_DebugPowerGenerator(15498, "debug.tt.genny", "Debug Power Generator", 15).getStackForm(1L)); Machine_DebugWriter.set(new GT_MetaTileEntity_DebugStructureWriter(15499, "debug.tt.writer", "Debug Structure Writer", 15).getStackForm(1L)); diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java index efb9e6d644..667f1a45d5 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java @@ -133,7 +133,7 @@ public final class ConstructableTriggerItem extends Item { private final String[] desc=new String[]{ EnumChatFormatting.AQUA+"Hint Details:", "1 - Classic Hatches or Heat Proof Casing", - "2 - Muffler Hatch", + "2 - Muffler ParameterDefinition", "3 - Coil blocks" }; //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java index 035b049a99..bc6d8cf3c6 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java @@ -127,7 +127,7 @@ public final class ParametrizerMemoryCard extends Item { int temp; if(tNBT!=null && tNBT.hasKey("param")) { - aList.add("Hatch ID: "+EnumChatFormatting.AQUA + tNBT.getInteger("param")); + aList.add("ParameterDefinition ID: "+EnumChatFormatting.AQUA + tNBT.getInteger("param")); temp=tNBT.getInteger("value0i"); aList.add("Value 0|I: "+EnumChatFormatting.AQUA + temp); aList.add("Value 0|F: "+EnumChatFormatting.AQUA + Float.intBitsToFloat(temp)); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java index 2aae2b8c2b..ca8fb59f74 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java @@ -94,7 +94,7 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_Capacitor(aPlayerInventory, aBaseMetaTileEntity, "Capacitor Hatch"); + return new GT_GUIContainer_Capacitor(aPlayerInventory, aBaseMetaTileEntity, "Capacitor ParameterDefinition"); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index c84057c121..e97ffaa670 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -259,7 +259,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta mDescription, "Max stacks amount: " + EnumChatFormatting.AQUA + getMaxStacksCount(), "Stack capacity: " + EnumChatFormatting.AQUA + getMaxStackSize(), - "Place Overflow Hatch behind,on top or below", + "Place Overflow ParameterDefinition behind,on top or below", "to provide overflow protection while this block", "is not attached to multi block.", "Transport range can be extended in straight", diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java index 409f8195e2..cd3ad8d573 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java @@ -94,7 +94,7 @@ public class GT_MetaTileEntity_Hatch_Holder extends GT_MetaTileEntity_Hatch { @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_Holder(aPlayerInventory, aBaseMetaTileEntity, "Holder Hatch"); + return new GT_GUIContainer_Holder(aPlayerInventory, aBaseMetaTileEntity, "Holder ParameterDefinition"); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 5f102c94ab..346e851345 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -53,7 +53,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo private static final String[] description = new String[]{ EnumChatFormatting.AQUA + "Hint Details:", "1 - Classic Hatches or High Power Casing", - "2 - Elemental Input Hatch", + "2 - Elemental Input ParameterDefinition", "3 - Elemental Overflow Hatches or Molecular Casing", }; //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java index a5a3f451ea..5733bfb458 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java @@ -59,7 +59,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock private static final String[] description = new String[]{ EnumChatFormatting.AQUA+"Hint Details:", "1 - Classic Hatches or High Power Casing", - "2 - Elemental Output Hatch", + "2 - Elemental Output ParameterDefinition", "3 - Elemental Overflow Hatches or Molecular Casing", }; //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 377291f59a..edc9c11a56 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -73,7 +73,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB private static final String[] description = new String[]{ EnumChatFormatting.AQUA+"Hint Details:", "1 - Classic/Data Hatches or Computer casing", - "2 - Holder Hatch", + "2 - Holder ParameterDefinition", }; //endregion @@ -286,7 +286,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } for (int i = 0; i < tRecipe.mFluidInputs.length; i++) { if (tRecipe.mFluidInputs[i] != null) { - tNBTList.appendTag(new NBTTagString("Input Hatch " + (i + 1) + ": " + tRecipe.mFluidInputs[i].amount + "L " + GT_LanguageManager.getTranslation(tRecipe.mFluidInputs[i].getLocalizedName()))); + tNBTList.appendTag(new NBTTagString("Input ParameterDefinition " + (i + 1) + ": " + tRecipe.mFluidInputs[i].amount + "L " + GT_LanguageManager.getTranslation(tRecipe.mFluidInputs[i].getLocalizedName()))); } } tNBT.setTag("pages", tNBTList); @@ -382,7 +382,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB s = tRecipe.mFluidInputs[i].getLocalizedName(); } } - tNBTList.appendTag(new NBTTagString("Input Hatch "+(i+1)+": "+tRecipe.mFluidInputs[i].amount+"L "+s)); + tNBTList.appendTag(new NBTTagString("Input ParameterDefinition "+(i+1)+": "+tRecipe.mFluidInputs[i].amount+"L "+s)); } } tNBT.setTag("pages", tNBTList); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 1fdf8d6943..541adfd953 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -210,7 +210,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } @Override - protected void parametersInRead_EM() { + protected void parametersInReadWhileActive_EM() { powerSetting = (int) getParameterIn(0, 0); timerSetting = (int) getParameterIn(0, 1); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java index 4845117a99..b8c856f9f8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java @@ -106,8 +106,8 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null || eParamsInStatus == null) { return; } - eParamsInStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eParamsInStatus; - eParamsOutStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eParamsOutStatus; + eParamsInStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).parametrization.eParamsInStatus; + eParamsOutStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).parametrization.eParamsOutStatus; eCertainMode = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eCertainMode; eCertainStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eCertainStatus; ePowerPass = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).ePowerPass; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java index a6ec5b561a..07fde1050a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java @@ -95,20 +95,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected ArrayList eInputData = new ArrayList<>(); protected ArrayList eOutputData = new ArrayList<>(); - //endregion - - //region PARAMETERS! GO AWAY and use proper get/set methods - // 0 and 10 are from first parametrizer - // 1 and 11 are from second etc... - - private final int[] iParamsIn = new int[20];//number I from parametrizers - private final int[] iParamsOut = new int[20];//number O to parametrizers - private final boolean[] bParamsAreFloats = new boolean[10]; - - final LedStatus[] eParamsInStatus = new LedStatus[20];//LED status for I - final LedStatus[] eParamsOutStatus = new LedStatus[20];//LED status for O - // 0,2,4,6 - ok - // 1,3,5 - nok + //region parameters + public final Parameters parametrization; //endregion @@ -164,12 +152,16 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected GT_MetaTileEntity_MultiblockBase_EM(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); - parametersLoadDefault_EM(); + parametrization=new Parameters(); + parametersInstantiation_EM(); + parametrization.setToDefaults(true,true,true); } protected GT_MetaTileEntity_MultiblockBase_EM(String aName) { super(aName); - parametersLoadDefault_EM(); + parametrization=new Parameters(); + parametersInstantiation_EM(); + parametrization.setToDefaults(true,true,true); } //region SUPER STRUCT @@ -631,80 +623,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //endregion - //region PARAMETERS AND STATUSES - actually use it to work with parameters in other overrides - - public final boolean setParameterPairIn_ClearOut(int hatchNo, boolean usesFloats, double value0, double value1) { - if (mMaxProgresstime > 0) { - return false; - } - bParamsAreFloats[hatchNo] = usesFloats; - if (usesFloats) { - iParamsIn[hatchNo] = Float.floatToIntBits((float) value0); - iParamsIn[hatchNo + 10] = Float.floatToIntBits((float) value1); - } else { - iParamsIn[hatchNo] = (int) value0; - iParamsIn[hatchNo + 10] = (int) value1; - } - iParamsOut[hatchNo] = 0; - iParamsOut[hatchNo + 10] = 0; - return true; - } - - public final boolean isParametrizerUsingFloat(int hatchNo){ - return bParamsAreFloats[hatchNo]; - } - - public final double getParameterIn(int hatchNo, int paramID){ - return bParamsAreFloats[hatchNo]?Float.intBitsToFloat(iParamsIn[hatchNo+10*paramID]):iParamsIn[hatchNo+10*paramID]; - } - - public final int getParameterInInt(int hatchNo, int paramID){ - if(bParamsAreFloats[hatchNo]) { - return (int) Float.intBitsToFloat(iParamsIn[hatchNo + 10 * paramID]); - } - return iParamsIn[hatchNo+10*paramID]; - } - - //public final int getParameterInIntRaw(int hatchNo, int paramID){ - // return iParamsIn[hatchNo+10*paramID]; - //} - - //public final float getParameterInFloatRaw(int hatchNo, int paramID){ - // return Float.intBitsToFloat(iParamsIn[hatchNo+10*paramID]); - //} - - public final void setParameterOut(int hatchNo, int paramID, double value){ - if(bParamsAreFloats[hatchNo]) { - iParamsOut[hatchNo+10*paramID]=Float.floatToIntBits((float) value); - }else{ - iParamsOut[hatchNo+10*paramID]=(int)value; - } - } - - //public final boolean setParameterOutInt(int hatchNo, int paramID, int value){ - // if(bParamsAreFloats[hatchNo]) return false; - // iParamsOut[hatchNo+10*paramID]=value; - // return true; - //} - - //public final boolean setParameterOutFloat(int hatchNo, int paramID, float value){ - // if(bParamsAreFloats[hatchNo]) { - // iParamsOut[hatchNo + 10 * paramID] = Float.floatToIntBits(value); - // return true; - // } - // return false; - //} - - public final void setStatusOfParameterIn(int hatchNo, int paramID, LedStatus status){ - eParamsInStatus[hatchNo+10*paramID]=status; - } - - public final void setStatusOfParameterOut(int hatchNo, int paramID, LedStatus status){ - eParamsOutStatus[hatchNo+10*paramID]=status; - } - - //endregion - //region Methods to maybe override (if u implement certain stuff) /** @@ -787,30 +705,43 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } /** - * loads default parameters in CONSTRUCTOR! CALLED ONCE on creation, don't call it in your classes + * instantiate parameters in CONSTRUCTOR! CALLED ONCE on creation, don't call it in your classes */ - protected void parametersLoadDefault_EM(){ - //load default parameters with setParameterPairIn_ClearOut - } + protected void parametersInstantiation_EM(){} /** - * This is called automatically when there was parameters data update, copy it to your variables for safe storage - * although the base code only downloads the values from parametrizers when machines is NOT OPERATING + * This is called automatically when there was IN parameters data update and machine IS RUNNING + * although the base code only downloads the IN values from parametrizers when machine is NOT OPERATING + * + * this can be used to update the IN values on the fly when machine is running to affect the current process * - * good place to get Parameters */ - protected void parametersInRead_EM(){} + protected void parametersInReadWhileActive_EM() { + } /** * It is automatically called OFTEN * update status of parameters in guis (and "machine state" if u wish) - * Called before check recipe, before outputting, and every second the machine is active + * Called before check recipe, before outputting, and every second the machine is complete * - * good place for set Parameters + * good place to update parameter statuses, default implementation handles it well * * @param machineBusy is machine doing SHIT */ - public void parametersOutAndStatusesWrite_EM(boolean machineBusy){} + public void parametersOutAndStatusesWrite_EM(boolean machineBusy) { + if(!machineBusy){ + for (Parameters.ParameterDefinition.In in : parametrization.inArrayList) { + if (in != null) { + in.updateStatus(); + } + } + } + for (Parameters.ParameterDefinition.Out out : parametrization.outArrayList) { + if (out != null) { + out.updateStatus(); + } + } + } /** * For extra types of hatches initiation, LOOK HOW IT IS CALLED! in onPostTick @@ -942,32 +873,32 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } NBTTagCompound paramI = new NBTTagCompound(); - for (int i = 0; i < iParamsIn.length; i++) { - paramI.setInteger(Integer.toString(i), iParamsIn[i]); + for (int i = 0; i < parametrization.iParamsIn.length; i++) { + paramI.setInteger(Integer.toString(i), parametrization.iParamsIn[i]); } aNBT.setTag("eParamsIn", paramI); NBTTagCompound paramO = new NBTTagCompound(); - for (int i = 0; i < iParamsOut.length; i++) { - paramO.setInteger(Integer.toString(i), iParamsOut[i]); + for (int i = 0; i < parametrization.iParamsOut.length; i++) { + paramO.setInteger(Integer.toString(i), parametrization.iParamsOut[i]); } aNBT.setTag("eParamsOut", paramO); NBTTagCompound paramB = new NBTTagCompound(); - for (int i = 0; i < bParamsAreFloats.length; i++) { - paramB.setBoolean(Integer.toString(i), bParamsAreFloats[i]); + for (int i = 0; i < parametrization.bParamsAreFloats.length; i++) { + paramB.setBoolean(Integer.toString(i), parametrization.bParamsAreFloats[i]); } aNBT.setTag("eParamsB", paramB); NBTTagCompound paramIs = new NBTTagCompound(); - for (int i = 0; i < eParamsInStatus.length; i++) { - paramIs.setByte(Integer.toString(i), eParamsInStatus[i].getOrdinalByte()); + for (int i = 0; i < parametrization.eParamsInStatus.length; i++) { + paramIs.setByte(Integer.toString(i), parametrization.eParamsInStatus[i].getOrdinalByte()); } aNBT.setTag("eParamsInS", paramIs); NBTTagCompound paramOs = new NBTTagCompound(); - for (int i = 0; i < eParamsOutStatus.length; i++) { - paramOs.setByte(Integer.toString(i), eParamsOutStatus[i].getOrdinalByte()); + for (int i = 0; i < parametrization.eParamsOutStatus.length; i++) { + paramOs.setByte(Integer.toString(i), parametrization.eParamsOutStatus[i].getOrdinalByte()); } aNBT.setTag("eParamsOutS", paramOs); } @@ -1035,28 +966,28 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } NBTTagCompound paramI = aNBT.getCompoundTag("eParamsIn"); - for (int i = 0; i < iParamsIn.length; i++) { - iParamsIn[i] = paramI.getInteger(Integer.toString(i)); + for (int i = 0; i < parametrization.iParamsIn.length; i++) { + parametrization.iParamsIn[i] = paramI.getInteger(Integer.toString(i)); } NBTTagCompound paramO = aNBT.getCompoundTag("eParamsOut"); - for (int i = 0; i < iParamsOut.length; i++) { - iParamsOut[i] = paramO.getInteger(Integer.toString(i)); + for (int i = 0; i < parametrization.iParamsOut.length; i++) { + parametrization.iParamsOut[i] = paramO.getInteger(Integer.toString(i)); } NBTTagCompound paramB = aNBT.getCompoundTag("eParamsB"); - for (int i = 0; i < bParamsAreFloats.length; i++) { - bParamsAreFloats[i] = paramB.getBoolean(Integer.toString(i)); + for (int i = 0; i < parametrization.bParamsAreFloats.length; i++) { + parametrization.bParamsAreFloats[i] = paramB.getBoolean(Integer.toString(i)); } NBTTagCompound paramIs = aNBT.getCompoundTag("eParamsInS"); - for (int i = 0; i < eParamsInStatus.length; i++) { - eParamsInStatus[i] = LedStatus.getStatus(paramIs.getByte(Integer.toString(i))); + for (int i = 0; i < parametrization.eParamsInStatus.length; i++) { + parametrization.eParamsInStatus[i] = LedStatus.getStatus(paramIs.getByte(Integer.toString(i))); } NBTTagCompound paramOs = aNBT.getCompoundTag("eParamsOutS"); - for (int i = 0; i < eParamsOutStatus.length; i++) { - eParamsOutStatus[i] = LedStatus.getStatus(paramOs.getByte(Integer.toString(i))); + for (int i = 0; i < parametrization.eParamsOutStatus.length; i++) { + parametrization.eParamsOutStatus[i] = LedStatus.getStatus(paramOs.getByte(Integer.toString(i))); } } @@ -1235,7 +1166,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } /** - * callback for updating parameters, change this if u really need dynamic (inside recipe time) parameter updates + * callback for updating parameters and new hatches */ protected void hatchesStatusUpdate_EM() { boolean busy=mMaxProgresstime>0; @@ -1245,29 +1176,29 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt continue; } int paramID = hatch.param; - if(bParamsAreFloats[hatch.param] == hatch.isUsingFloats()){ - hatch.input0i = iParamsOut[paramID]; - hatch.input1i = iParamsOut[paramID + 10]; + if(parametrization.bParamsAreFloats[hatch.param] == hatch.isUsingFloats()){ + hatch.input0i = parametrization.iParamsOut[paramID]; + hatch.input1i = parametrization.iParamsOut[paramID + 10]; }else if(hatch.isUsingFloats()){ - hatch.input0i = Float.floatToIntBits((float)iParamsOut[paramID]); - hatch.input1i = Float.floatToIntBits((float)iParamsOut[paramID + 10]); + hatch.input0i = Float.floatToIntBits((float)parametrization.iParamsOut[paramID]); + hatch.input1i = Float.floatToIntBits((float)parametrization.iParamsOut[paramID + 10]); }else { - hatch.input0i = (int)Float.intBitsToFloat(iParamsOut[paramID]); - hatch.input1i = (int)Float.intBitsToFloat(iParamsOut[paramID + 10]); + hatch.input0i = (int)Float.intBitsToFloat(parametrization.iParamsOut[paramID]); + hatch.input1i = (int)Float.intBitsToFloat(parametrization.iParamsOut[paramID + 10]); } } - parametersInRead_EM(); + parametersInReadWhileActive_EM(); } else {//if has nothing to do update all for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { if (!GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch) || hatch.param < 0) { continue; } int paramID = hatch.param; - bParamsAreFloats[hatch.param] = hatch.isUsingFloats(); - iParamsIn[paramID] = hatch.value0i; - iParamsIn[paramID + 10] = hatch.value1i; - hatch.input0i = iParamsOut[paramID]; - hatch.input1i = iParamsOut[paramID + 10]; + parametrization.bParamsAreFloats[hatch.param] = hatch.isUsingFloats(); + parametrization.iParamsIn[paramID] = hatch.value0i; + parametrization.iParamsIn[paramID + 10] = hatch.value1i; + hatch.input0i = parametrization.iParamsOut[paramID]; + hatch.input1i = parametrization.iParamsOut[paramID + 10]; } } for (GT_MetaTileEntity_Hatch_Uncertainty uncertainty : eUncertainHatches) { @@ -1479,7 +1410,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { hatch.getBaseMetaTileEntity().setActive(true); if(hatch.param>=0) { - bParamsAreFloats[hatch.param] = hatch.isUsingFloats(); + parametrization.bParamsAreFloats[hatch.param] = hatch.isUsingFloats(); } } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java new file mode 100644 index 0000000000..3bd769f14f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java @@ -0,0 +1,240 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.base; + +import java.util.ArrayList; +import java.util.function.Supplier; + +/** + * Instantiate parameters as field in parametersInstantiation_EM(); + */ +public class Parameters { + private static final Supplier LED_STATUS_FUNCTION_DEFAULT = ()->LedStatus.STATUS_UNDEFINED; + private static final int ZERO_FLOAT=Float.floatToIntBits(0); + private final ParameterDefinition[] parameterDefinitions =new ParameterDefinition[10]; + + final int[] iParamsIn = new int[20];//number I from parametrizers + final int[] iParamsOut = new int[20];//number O to parametrizers + final ArrayList inArrayList=new ArrayList<>(); + final ArrayList outArrayList=new ArrayList<>(); + + final boolean[] bParamsAreFloats =new boolean[10]; + + //package private for use in gui + final LedStatus[] eParamsInStatus = new LedStatus[20];//LED status for I + final LedStatus[] eParamsOutStatus = new LedStatus[20];//LED status for O + + Parameters(){} + + void setToDefaults(boolean defaultIn, boolean defaultOut,boolean defaultAreFloats){ + for (int hatch=0;hatch<10;hatch++) { + ParameterDefinition p= parameterDefinitions[hatch]; + if (p!=null){ + p.setToDefaults(defaultIn,defaultOut,defaultAreFloats); + }else{ + if(defaultAreFloats){ + bParamsAreFloats[hatch]=false; + if(defaultIn){ + iParamsIn[hatch] = 0; + iParamsIn[hatch + 10] = 0; + } + if(defaultOut){ + iParamsOut[hatch] = 0; + iParamsOut[hatch + 10] = 0; + } + }else{ + if(bParamsAreFloats[hatch]){ + if(defaultIn){ + iParamsIn[hatch] = ZERO_FLOAT; + iParamsIn[hatch + 10] = ZERO_FLOAT; + } + if(defaultOut){ + iParamsOut[hatch] = ZERO_FLOAT; + iParamsOut[hatch + 10] = ZERO_FLOAT; + } + }else{ + if(defaultIn){ + iParamsIn[hatch] = 0; + iParamsIn[hatch + 10] = 0; + } + if(defaultOut){ + iParamsOut[hatch] = 0; + iParamsOut[hatch + 10] = 0; + } + } + } + } + } + } + + public void ClearDefinitions(){ + setToDefaults(true,true,false); + inArrayList.clear(); + outArrayList.clear(); + for(int i = 0; i< parameterDefinitions.length; i++){ + parameterDefinitions[i]=null; + } + } + + /** + * most likely used locally in parametersInstantiation_EM() + */ + public class ParameterDefinition { + private final boolean bParamsDefaultsAreStoredAsFloats; + private final int hatchNo; + private final In[] in=new In[2]; + private final Out[] out=new Out[2]; + + private ParameterDefinition(int hatchNo, boolean aParamsDefaultsAreFloats){ + if(hatchNo<0 || hatchNo>=10){ + throw new IllegalArgumentException("ParameterDefinition id must be in 0 to 9 range"); + } + this.hatchNo=hatchNo; + bParamsDefaultsAreStoredAsFloats =aParamsDefaultsAreFloats; + parameterDefinitions[hatchNo]=this; + } + + private void setToDefaults(boolean defaultIn, boolean defaultOut,boolean defaultAreFloats) { + if(defaultAreFloats){ + bParamsAreFloats[hatchNo] = bParamsDefaultsAreStoredAsFloats; + } + if(defaultIn){ + for(int in=0;in<2;in++){ + if(this.in[in]!=null){ + this.in[in].setDefault(); + }else { + if (bParamsAreFloats[hatchNo]) { + iParamsIn[hatchNo] = ZERO_FLOAT; + iParamsIn[hatchNo + 10] = ZERO_FLOAT; + } else { + iParamsIn[hatchNo] = 0; + iParamsIn[hatchNo + 10] = 0; + } + } + } + } + if(defaultOut){ + for(int out=0;out<2;out++){ + if(this.out[out]!=null){ + this.out[out].setDefault(); + }else { + if (bParamsAreFloats[hatchNo]) { + iParamsIn[hatchNo] = ZERO_FLOAT; + iParamsIn[hatchNo + 10] = ZERO_FLOAT; + } else { + iParamsIn[hatchNo] = 0; + iParamsIn[hatchNo + 10] = 0; + } + } + } + } + } + + /** + * Make a field out of this... + */ + public class Out { + public final int id; + public final double defaultValue; + private final Supplier status; + + public Out(int paramID, double defaultValue, Supplier< LedStatus> status){ + this.id=hatchNo+10*paramID; + if(paramID<0 || paramID>2){ + throw new IllegalArgumentException("Parameter id must be in 0 to 1 range"); + } + this.defaultValue=defaultValue; + if(out[paramID]!=null){ + throw new InstantiationError("This parameter already exists!"); + } + if(status ==null){ + this.status =LED_STATUS_FUNCTION_DEFAULT; + }else{ + this.status = status; + } + outArrayList.add(this); + out[paramID]=this; + } + + private void setDefault() { + set(defaultValue); + } + + public double get(){ + return bParamsAreFloats[hatchNo]?Float.intBitsToFloat(iParamsOut[id]):iParamsOut[id]; + } + + public void set(double value){ + if(bParamsAreFloats[hatchNo]) { + iParamsOut[id]=Float.floatToIntBits((float) value); + }else{ + iParamsOut[id]=(int)value; + } + } + + public LedStatus getStatus(){ + return eParamsOutStatus[id]; + } + + public void updateStatus(){ + eParamsOutStatus[id]=status.get(); + } + + public LedStatus getStaus(boolean update){ + if(update){ + updateStatus(); + } + return eParamsOutStatus[id]; + } + } + + /** + * Make a field out of this... + */ + public class In { + public final int id; + public final double defaultValue; + private final Supplier status; + + public In(int paramID, double defaultValue,Supplier status){ + this.id=hatchNo+10*paramID; + if(paramID<0 || paramID>2){ + throw new IllegalArgumentException("Parameter id must be in 0 to 1 range"); + } + this.defaultValue=defaultValue; + if(in[paramID]!=null){ + throw new InstantiationError("This parameter already exists!"); + } + if(status ==null){ + this.status =LED_STATUS_FUNCTION_DEFAULT; + }else{ + this.status = status; + } + inArrayList.add(this); + in[paramID]=this; + } + + private void setDefault() { + if(bParamsAreFloats[hatchNo]) { + iParamsIn[id]=Float.floatToIntBits((float) defaultValue); + }else{ + iParamsIn[id]=(int)defaultValue; + } + } + + public double get(){ + return bParamsAreFloats[hatchNo]?Float.intBitsToFloat(iParamsIn[id]):iParamsIn[id]; + } + + public void updateStatus(){ + eParamsInStatus[id]=status.get(); + } + + public LedStatus getStaus(boolean update){ + if(update){ + updateStatus(); + } + return eParamsInStatus[id]; + } + } + } +} + diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java index ad10d70cbf..93c8f69587 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java @@ -376,6 +376,10 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa public static abstract class Behaviour { public Behaviour(){} + public abstract void setOnMachine(){ + + } + /** * handle parameters pre recipe, and cyclically * this shouldn't write to input parameters! only to the provided array and/or output parameters -- cgit From d1b16ceea346e546ae7bec574230bdf03c2a4172 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 16 Feb 2019 15:16:44 +0100 Subject: Collider uses new impl of parameters --- .../dreamcraft/DreamCraftRecipeLoader.java | 2 +- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 2 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 2 +- .../tectech/loader/thing/MachineLoader.java | 148 ++++++++++----------- .../thing/item/ConstructableTriggerItem.java | 2 +- .../tectech/thing/item/ParametrizerMemoryCard.java | 2 +- .../hatch/GT_MetaTileEntity_Hatch_Capacitor.java | 2 +- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 2 +- .../hatch/GT_MetaTileEntity_Hatch_Holder.java | 2 +- .../multi/GT_MetaTileEntity_EM_collider.java | 48 +++++-- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 2 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 2 +- .../multi/GT_MetaTileEntity_EM_research.java | 6 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 14 +- .../metaTileEntity/multi/base/Parameters.java | 49 ++++--- .../em_machine/GT_MetaTileEntity_EM_machine.java | 25 +--- 16 files changed, 173 insertions(+), 137 deletions(-) diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index a70f85d62d..a735213915 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -716,7 +716,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(9216)}, ItemList.Field_Generator_UEV.get(1L), 4000, 800000); - //UHV Energy ParameterDefinition + //UHV Energy ParameterGroup TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Energy_UV.get(1L), 24000, 16, 50000, 2, new Object[]{ ItemList.Hull_MAX.get(1L), diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index 9e6f3f3c77..6a9ef392cd 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -52,7 +52,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ private static final String[] description = new String[]{ EnumChatFormatting.AQUA+"Hint Details:", "1 - Classic Hatches or High Power Casing", - "2 - Elemental Input ParameterDefinition", + "2 - Elemental Input ParameterGroup", "3 - Elemental Overflow Hatches or Elemental Casing", "General - Some sort of Essentia Storage", }; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index d97c28a2be..0fbf3aaa13 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -52,7 +52,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu private static final String[] description = new String[]{ EnumChatFormatting.AQUA+"Hint Details:", "1 - Classic Hatches or High Power Casing", - "2 - Elemental Output ParameterDefinition", + "2 - Elemental Output ParameterGroup", "3 - Elemental Overflow Hatches or Elemental Casing", "General - Some sort of Essentia Storage", }; diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index deca78bf6e..0e65aa0b12 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -26,133 +26,133 @@ public class MachineLoader implements Runnable { // =================================================================================================== eM_in_UV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15000, "hatch.emin.tier.08", "UV Elemental Input ParameterDefinition", 8).getStackForm(1L)); + 15000, "hatch.emin.tier.08", "UV Elemental Input ParameterGroup", 8).getStackForm(1L)); eM_in_UHV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15001, "hatch.emin.tier.09", "UHV Elemental Input ParameterDefinition", 9).getStackForm(1L)); + 15001, "hatch.emin.tier.09", "UHV Elemental Input ParameterGroup", 9).getStackForm(1L)); eM_in_UEV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15002, "hatch.emin.tier.10", "UEV Elemental Input ParameterDefinition", 10).getStackForm(1L)); + 15002, "hatch.emin.tier.10", "UEV Elemental Input ParameterGroup", 10).getStackForm(1L)); eM_in_UIV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15003, "hatch.emin.tier.11", "UIV Elemental Input ParameterDefinition", 11).getStackForm(1L)); + 15003, "hatch.emin.tier.11", "UIV Elemental Input ParameterGroup", 11).getStackForm(1L)); eM_in_UMV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15004, "hatch.emin.tier.12", "UMV Elemental Input ParameterDefinition", 12).getStackForm(1L)); + 15004, "hatch.emin.tier.12", "UMV Elemental Input ParameterGroup", 12).getStackForm(1L)); eM_in_UXV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15005, "hatch.emin.tier.13", "UXV Elemental Input ParameterDefinition", 13).getStackForm(1L)); + 15005, "hatch.emin.tier.13", "UXV Elemental Input ParameterGroup", 13).getStackForm(1L)); // =================================================================================================== // eM OUT // =================================================================================================== eM_out_UV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15010, "hatch.emout.tier.08", "UV Elemental Output ParameterDefinition", 8).getStackForm(1L)); + 15010, "hatch.emout.tier.08", "UV Elemental Output ParameterGroup", 8).getStackForm(1L)); eM_out_UHV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15011, "hatch.emout.tier.09", "UHV Elemental Output ParameterDefinition", 9).getStackForm(1L)); + 15011, "hatch.emout.tier.09", "UHV Elemental Output ParameterGroup", 9).getStackForm(1L)); eM_out_UEV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15012, "hatch.emout.tier.10", "UEV Elemental Output ParameterDefinition", 10).getStackForm(1L)); + 15012, "hatch.emout.tier.10", "UEV Elemental Output ParameterGroup", 10).getStackForm(1L)); eM_out_UIV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15013, "hatch.emout.tier.11", "UIV Elemental Output ParameterDefinition", 11).getStackForm(1L)); + 15013, "hatch.emout.tier.11", "UIV Elemental Output ParameterGroup", 11).getStackForm(1L)); eM_out_UMV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15014, "hatch.emout.tier.12", "UMV Elemental Output ParameterDefinition", 12).getStackForm(1L)); + 15014, "hatch.emout.tier.12", "UMV Elemental Output ParameterGroup", 12).getStackForm(1L)); eM_out_UXV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15015, "hatch.emout.tier.13", "UXV Elemental Output ParameterDefinition", 13).getStackForm(1L)); + 15015, "hatch.emout.tier.13", "UXV Elemental Output ParameterGroup", 13).getStackForm(1L)); // =================================================================================================== // eM Waste OUT // =================================================================================================== eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15020, "hatch.emmuffler.tier.08", "UV Overflow Output ParameterDefinition", 8, 1e10f).getStackForm(1L)); + 15020, "hatch.emmuffler.tier.08", "UV Overflow Output ParameterGroup", 8, 1e10f).getStackForm(1L)); eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output ParameterDefinition", 9, 5e10f).getStackForm(1L)); + 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output ParameterGroup", 9, 5e10f).getStackForm(1L)); eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output ParameterDefinition", 10, 25e10f).getStackForm(1L)); + 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output ParameterGroup", 10, 25e10f).getStackForm(1L)); eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output ParameterDefinition", 11, 125e10f).getStackForm(1L)); + 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output ParameterGroup", 11, 125e10f).getStackForm(1L)); eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output ParameterDefinition", 12, 125e11f).getStackForm(1L)); + 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output ParameterGroup", 12, 125e11f).getStackForm(1L)); eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output ParameterDefinition", 13, 125e12f).getStackForm(1L)); + 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output ParameterGroup", 13, 125e12f).getStackForm(1L)); // =================================================================================================== // Multi AMP Power INPUTS // =================================================================================================== eM_energymulti4_IV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15100, "hatch.energymulti04.tier.05", "IV 4A Energy ParameterDefinition", 5, 4).getStackForm(1L)); + 15100, "hatch.energymulti04.tier.05", "IV 4A Energy ParameterGroup", 5, 4).getStackForm(1L)); eM_energymulti16_IV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15110, "hatch.energymulti16.tier.05", "IV 16A Energy ParameterDefinition", 5, 16).getStackForm(1L)); + 15110, "hatch.energymulti16.tier.05", "IV 16A Energy ParameterGroup", 5, 16).getStackForm(1L)); eM_energymulti64_IV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15120, "hatch.energymulti64.tier.05", "IV 64A Energy ParameterDefinition", 5, 64).getStackForm(1L)); + 15120, "hatch.energymulti64.tier.05", "IV 64A Energy ParameterGroup", 5, 64).getStackForm(1L)); eM_energymulti4_LuV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15101, "hatch.energymulti04.tier.06", "LuV 4A Energy ParameterDefinition", 6, 4).getStackForm(1L)); + 15101, "hatch.energymulti04.tier.06", "LuV 4A Energy ParameterGroup", 6, 4).getStackForm(1L)); eM_energymulti16_LuV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15111, "hatch.energymulti16.tier.06", "LuV 16A Energy ParameterDefinition", 6, 16).getStackForm(1L)); + 15111, "hatch.energymulti16.tier.06", "LuV 16A Energy ParameterGroup", 6, 16).getStackForm(1L)); eM_energymulti64_LuV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15121, "hatch.energymulti64.tier.06", "LuV 64A Energy ParameterDefinition", 6, 64).getStackForm(1L)); + 15121, "hatch.energymulti64.tier.06", "LuV 64A Energy ParameterGroup", 6, 64).getStackForm(1L)); eM_energymulti4_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15102, "hatch.energymulti04.tier.07", "ZPM 4A Energy ParameterDefinition", 7, 4).getStackForm(1L)); + 15102, "hatch.energymulti04.tier.07", "ZPM 4A Energy ParameterGroup", 7, 4).getStackForm(1L)); eM_energymulti16_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15112, "hatch.energymulti16.tier.07", "ZPM 16A Energy ParameterDefinition", 7, 16).getStackForm(1L)); + 15112, "hatch.energymulti16.tier.07", "ZPM 16A Energy ParameterGroup", 7, 16).getStackForm(1L)); eM_energymulti64_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15122, "hatch.energymulti64.tier.07", "ZPM 64A Energy ParameterDefinition", 7, 64).getStackForm(1L)); + 15122, "hatch.energymulti64.tier.07", "ZPM 64A Energy ParameterGroup", 7, 64).getStackForm(1L)); eM_energymulti4_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15103, "hatch.energymulti04.tier.08", "UV 4A Energy ParameterDefinition", 8, 4).getStackForm(1L)); + 15103, "hatch.energymulti04.tier.08", "UV 4A Energy ParameterGroup", 8, 4).getStackForm(1L)); eM_energymulti16_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15113, "hatch.energymulti16.tier.08", "UV 16A Energy ParameterDefinition", 8, 16).getStackForm(1L)); + 15113, "hatch.energymulti16.tier.08", "UV 16A Energy ParameterGroup", 8, 16).getStackForm(1L)); eM_energymulti64_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15123, "hatch.energymulti64.tier.08", "UV 64A Energy ParameterDefinition", 8, 64).getStackForm(1L)); + 15123, "hatch.energymulti64.tier.08", "UV 64A Energy ParameterGroup", 8, 64).getStackForm(1L)); eM_energymulti4_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15104, "hatch.energymulti04.tier.09", "UHV 4A Energy ParameterDefinition", 9, 4).getStackForm(1L)); + 15104, "hatch.energymulti04.tier.09", "UHV 4A Energy ParameterGroup", 9, 4).getStackForm(1L)); eM_energymulti16_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15114, "hatch.energymulti16.tier.09", "UHV 16A Energy ParameterDefinition", 9, 16).getStackForm(1L)); + 15114, "hatch.energymulti16.tier.09", "UHV 16A Energy ParameterGroup", 9, 16).getStackForm(1L)); eM_energymulti64_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15124, "hatch.energymulti64.tier.09", "UHV 64A Energy ParameterDefinition", 9, 64).getStackForm(1L)); + 15124, "hatch.energymulti64.tier.09", "UHV 64A Energy ParameterGroup", 9, 64).getStackForm(1L)); eM_energymulti4_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15105, "hatch.energymulti04.tier.10", "UEV 4A Energy ParameterDefinition", 10, 4).getStackForm(1L)); + 15105, "hatch.energymulti04.tier.10", "UEV 4A Energy ParameterGroup", 10, 4).getStackForm(1L)); eM_energymulti16_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15115, "hatch.energymulti16.tier.10", "UEV 16A Energy ParameterDefinition", 10, 16).getStackForm(1L)); + 15115, "hatch.energymulti16.tier.10", "UEV 16A Energy ParameterGroup", 10, 16).getStackForm(1L)); eM_energymulti64_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15125, "hatch.energymulti64.tier.10", "UEV 64A Energy ParameterDefinition", 10, 64).getStackForm(1L)); + 15125, "hatch.energymulti64.tier.10", "UEV 64A Energy ParameterGroup", 10, 64).getStackForm(1L)); eM_energymulti4_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15106, "hatch.energymulti04.tier.11", "UIV 4A Energy ParameterDefinition", 11, 4).getStackForm(1L)); + 15106, "hatch.energymulti04.tier.11", "UIV 4A Energy ParameterGroup", 11, 4).getStackForm(1L)); eM_energymulti16_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15116, "hatch.energymulti16.tier.11", "UIV 16A Energy ParameterDefinition", 11, 16).getStackForm(1L)); + 15116, "hatch.energymulti16.tier.11", "UIV 16A Energy ParameterGroup", 11, 16).getStackForm(1L)); eM_energymulti64_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15126, "hatch.energymulti64.tier.11", "UIV 64A Energy ParameterDefinition", 11, 64).getStackForm(1L)); + 15126, "hatch.energymulti64.tier.11", "UIV 64A Energy ParameterGroup", 11, 64).getStackForm(1L)); eM_energymulti4_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15107, "hatch.energymulti04.tier.12", "UMV 4A Energy ParameterDefinition", 12, 4).getStackForm(1L)); + 15107, "hatch.energymulti04.tier.12", "UMV 4A Energy ParameterGroup", 12, 4).getStackForm(1L)); eM_energymulti16_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15117, "hatch.energymulti16.tier.12", "UMV 16A Energy ParameterDefinition", 12, 16).getStackForm(1L)); + 15117, "hatch.energymulti16.tier.12", "UMV 16A Energy ParameterGroup", 12, 16).getStackForm(1L)); eM_energymulti64_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15127, "hatch.energymulti64.tier.12", "UMV 64A Energy ParameterDefinition", 12, 64).getStackForm(1L)); + 15127, "hatch.energymulti64.tier.12", "UMV 64A Energy ParameterGroup", 12, 64).getStackForm(1L)); eM_energymulti4_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15108, "hatch.energymulti04.tier.13", "UXV 4A Energy ParameterDefinition", 13, 4).getStackForm(1L)); + 15108, "hatch.energymulti04.tier.13", "UXV 4A Energy ParameterGroup", 13, 4).getStackForm(1L)); eM_energymulti16_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15118, "hatch.energymulti16.tier.13", "UXV 16A Energy ParameterDefinition", 13, 16).getStackForm(1L)); + 15118, "hatch.energymulti16.tier.13", "UXV 16A Energy ParameterGroup", 13, 16).getStackForm(1L)); eM_energymulti64_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15128, "hatch.energymulti64.tier.13", "UXV 64A Energy ParameterDefinition", 13, 64).getStackForm(1L)); + 15128, "hatch.energymulti64.tier.13", "UXV 64A Energy ParameterGroup", 13, 64).getStackForm(1L)); // =================================================================================================== // Multi AMP Power OUTPUTS @@ -160,67 +160,67 @@ public class MachineLoader implements Runnable { eM_dynamomulti4_IV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15200, "hatch.dynamomulti04.tier.05", "IV 4A Dynamo ParameterDefinition", 5, 4).getStackForm(1L)); + 15200, "hatch.dynamomulti04.tier.05", "IV 4A Dynamo ParameterGroup", 5, 4).getStackForm(1L)); eM_dynamomulti16_IV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15210, "hatch.dynamomulti16.tier.05", "IV 16A Dynamo ParameterDefinition", 5, 16).getStackForm(1L)); + 15210, "hatch.dynamomulti16.tier.05", "IV 16A Dynamo ParameterGroup", 5, 16).getStackForm(1L)); eM_dynamomulti64_IV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15220, "hatch.dynamomulti64.tier.05", "IV 64A Dynamo ParameterDefinition", 5, 64).getStackForm(1L)); + 15220, "hatch.dynamomulti64.tier.05", "IV 64A Dynamo ParameterGroup", 5, 64).getStackForm(1L)); eM_dynamomulti4_LuV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15201, "hatch.dynamomulti04.tier.06", "LuV 4A Dynamo ParameterDefinition", 6, 4).getStackForm(1L)); + 15201, "hatch.dynamomulti04.tier.06", "LuV 4A Dynamo ParameterGroup", 6, 4).getStackForm(1L)); eM_dynamomulti16_LuV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15211, "hatch.dynamomulti16.tier.06", "LuV 16A Dynamo ParameterDefinition", 6, 16).getStackForm(1L)); + 15211, "hatch.dynamomulti16.tier.06", "LuV 16A Dynamo ParameterGroup", 6, 16).getStackForm(1L)); eM_dynamomulti64_LuV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15221, "hatch.dynamomulti64.tier.06", "LuV 64A Dynamo ParameterDefinition", 6, 64).getStackForm(1L)); + 15221, "hatch.dynamomulti64.tier.06", "LuV 64A Dynamo ParameterGroup", 6, 64).getStackForm(1L)); eM_dynamomulti4_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15202, "hatch.dynamomulti04.tier.07", "ZPM 4A Dynamo ParameterDefinition", 7, 4).getStackForm(1L)); + 15202, "hatch.dynamomulti04.tier.07", "ZPM 4A Dynamo ParameterGroup", 7, 4).getStackForm(1L)); eM_dynamomulti16_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15212, "hatch.dynamomulti16.tier.07", "ZPM 16A Dynamo ParameterDefinition", 7, 16).getStackForm(1L)); + 15212, "hatch.dynamomulti16.tier.07", "ZPM 16A Dynamo ParameterGroup", 7, 16).getStackForm(1L)); eM_dynamomulti64_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15222, "hatch.dynamomulti64.tier.07", "ZPM 64A Dynamo ParameterDefinition", 7, 64).getStackForm(1L)); + 15222, "hatch.dynamomulti64.tier.07", "ZPM 64A Dynamo ParameterGroup", 7, 64).getStackForm(1L)); eM_dynamomulti4_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15203, "hatch.dynamomulti04.tier.08", "UV 4A Dynamo ParameterDefinition", 8, 4).getStackForm(1L)); + 15203, "hatch.dynamomulti04.tier.08", "UV 4A Dynamo ParameterGroup", 8, 4).getStackForm(1L)); eM_dynamomulti16_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15213, "hatch.dynamomulti16.tier.08", "UV 16A Dynamo ParameterDefinition", 8, 16).getStackForm(1L)); + 15213, "hatch.dynamomulti16.tier.08", "UV 16A Dynamo ParameterGroup", 8, 16).getStackForm(1L)); eM_dynamomulti64_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15223, "hatch.dynamomulti64.tier.08", "UV 64A Dynamo ParameterDefinition", 8, 64).getStackForm(1L)); + 15223, "hatch.dynamomulti64.tier.08", "UV 64A Dynamo ParameterGroup", 8, 64).getStackForm(1L)); eM_dynamomulti4_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15204, "hatch.dynamomulti04.tier.09", "UHV 4A Dynamo ParameterDefinition", 9, 4).getStackForm(1L)); + 15204, "hatch.dynamomulti04.tier.09", "UHV 4A Dynamo ParameterGroup", 9, 4).getStackForm(1L)); eM_dynamomulti16_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15214, "hatch.dynamomulti16.tier.09", "UHV 16A Dynamo ParameterDefinition", 9, 16).getStackForm(1L)); + 15214, "hatch.dynamomulti16.tier.09", "UHV 16A Dynamo ParameterGroup", 9, 16).getStackForm(1L)); eM_dynamomulti64_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15224, "hatch.dynamomulti64.tier.09", "UHV 64A Dynamo ParameterDefinition", 9, 64).getStackForm(1L)); + 15224, "hatch.dynamomulti64.tier.09", "UHV 64A Dynamo ParameterGroup", 9, 64).getStackForm(1L)); eM_dynamomulti4_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15205, "hatch.dynamomulti04.tier.10", "UEV 4A Dynamo ParameterDefinition", 10, 4).getStackForm(1L)); + 15205, "hatch.dynamomulti04.tier.10", "UEV 4A Dynamo ParameterGroup", 10, 4).getStackForm(1L)); eM_dynamomulti16_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15215, "hatch.dynamomulti16.tier.10", "UEV 16A Dynamo ParameterDefinition", 10, 16).getStackForm(1L)); + 15215, "hatch.dynamomulti16.tier.10", "UEV 16A Dynamo ParameterGroup", 10, 16).getStackForm(1L)); eM_dynamomulti64_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15225, "hatch.dynamomulti64.tier.10", "UEV 64A Dynamo ParameterDefinition", 10, 64).getStackForm(1L)); + 15225, "hatch.dynamomulti64.tier.10", "UEV 64A Dynamo ParameterGroup", 10, 64).getStackForm(1L)); eM_dynamomulti4_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15206, "hatch.dynamomulti04.tier.11", "UIV 4A Dynamo ParameterDefinition", 11, 4).getStackForm(1L)); + 15206, "hatch.dynamomulti04.tier.11", "UIV 4A Dynamo ParameterGroup", 11, 4).getStackForm(1L)); eM_dynamomulti16_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15216, "hatch.dynamomulti16.tier.11", "UIV 16A Dynamo ParameterDefinition", 11, 16).getStackForm(1L)); + 15216, "hatch.dynamomulti16.tier.11", "UIV 16A Dynamo ParameterGroup", 11, 16).getStackForm(1L)); eM_dynamomulti64_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15226, "hatch.dynamomulti64.tier.11", "UIV 64A Dynamo ParameterDefinition", 11, 64).getStackForm(1L)); + 15226, "hatch.dynamomulti64.tier.11", "UIV 64A Dynamo ParameterGroup", 11, 64).getStackForm(1L)); eM_dynamomulti4_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15207, "hatch.dynamomulti04.tier.12", "UMV 4A Dynamo ParameterDefinition", 12, 4).getStackForm(1L)); + 15207, "hatch.dynamomulti04.tier.12", "UMV 4A Dynamo ParameterGroup", 12, 4).getStackForm(1L)); eM_dynamomulti16_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15217, "hatch.dynamomulti16.tier.12", "UMV 16A Dynamo ParameterDefinition", 12, 16).getStackForm(1L)); + 15217, "hatch.dynamomulti16.tier.12", "UMV 16A Dynamo ParameterGroup", 12, 16).getStackForm(1L)); eM_dynamomulti64_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15227, "hatch.dynamomulti64.tier.12", "UMV 64A Dynamo ParameterDefinition", 12, 64).getStackForm(1L)); + 15227, "hatch.dynamomulti64.tier.12", "UMV 64A Dynamo ParameterGroup", 12, 64).getStackForm(1L)); eM_dynamomulti4_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15208, "hatch.dynamomulti04.tier.13", "UXV 4A Dynamo ParameterDefinition", 13, 4).getStackForm(1L)); + 15208, "hatch.dynamomulti04.tier.13", "UXV 4A Dynamo ParameterGroup", 13, 4).getStackForm(1L)); eM_dynamomulti16_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15218, "hatch.dynamomulti16.tier.13", "UXV 16A Dynamo ParameterDefinition", 13, 16).getStackForm(1L)); + 15218, "hatch.dynamomulti16.tier.13", "UXV 16A Dynamo ParameterGroup", 13, 16).getStackForm(1L)); eM_dynamomulti64_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15228, "hatch.dynamomulti64.tier.13", "UXV 64A Dynamo ParameterDefinition", 13, 64).getStackForm(1L)); + 15228, "hatch.dynamomulti64.tier.13", "UXV 64A Dynamo ParameterGroup", 13, 64).getStackForm(1L)); // =================================================================================================== // MULTIBLOCKS @@ -279,7 +279,7 @@ public class MachineLoader implements Runnable { rack_Hatch.set(new GT_MetaTileEntity_Hatch_Rack(15450, "hatch.rack.tier.08", "Computer Rack", 8, "4 Slot Rack").getStackForm(1L)); holder_Hatch.set(new GT_MetaTileEntity_Hatch_Holder(15451, "hatch.holder.tier.09", "Object Holder", 8, "For Research Station").getStackForm(1L)); - capacitor_Hatch.set(new GT_MetaTileEntity_Hatch_Capacitor(15452, "hatch.capacitor.tier.05", "Capacitor ParameterDefinition", 5, "For Tesla Coil").getStackForm(1L)); + capacitor_Hatch.set(new GT_MetaTileEntity_Hatch_Capacitor(15452, "hatch.capacitor.tier.05", "Capacitor ParameterGroup", 5, "For Tesla Coil").getStackForm(1L)); // =================================================================================================== // Pipes @@ -309,7 +309,7 @@ public class MachineLoader implements Runnable { // =================================================================================================== // Debug Stuff // =================================================================================================== - hatch_CreativeMaitenance.set(new GT_MetaTileEntity_Hatch_CreativeMaintenance(15497, "debug.tt.maintenance", "Debug Maintenance ParameterDefinition", 15).getStackForm(1L)); + hatch_CreativeMaitenance.set(new GT_MetaTileEntity_Hatch_CreativeMaintenance(15497, "debug.tt.maintenance", "Debug Maintenance ParameterGroup", 15).getStackForm(1L)); Machine_DebugGenny.set(new GT_MetaTileEntity_DebugPowerGenerator(15498, "debug.tt.genny", "Debug Power Generator", 15).getStackForm(1L)); Machine_DebugWriter.set(new GT_MetaTileEntity_DebugStructureWriter(15499, "debug.tt.writer", "Debug Structure Writer", 15).getStackForm(1L)); diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java index 667f1a45d5..cf4b4d2978 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java @@ -133,7 +133,7 @@ public final class ConstructableTriggerItem extends Item { private final String[] desc=new String[]{ EnumChatFormatting.AQUA+"Hint Details:", "1 - Classic Hatches or Heat Proof Casing", - "2 - Muffler ParameterDefinition", + "2 - Muffler ParameterGroup", "3 - Coil blocks" }; //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java index bc6d8cf3c6..25eb3ec939 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java @@ -127,7 +127,7 @@ public final class ParametrizerMemoryCard extends Item { int temp; if(tNBT!=null && tNBT.hasKey("param")) { - aList.add("ParameterDefinition ID: "+EnumChatFormatting.AQUA + tNBT.getInteger("param")); + aList.add("ParameterGroup ID: "+EnumChatFormatting.AQUA + tNBT.getInteger("param")); temp=tNBT.getInteger("value0i"); aList.add("Value 0|I: "+EnumChatFormatting.AQUA + temp); aList.add("Value 0|F: "+EnumChatFormatting.AQUA + Float.intBitsToFloat(temp)); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java index ca8fb59f74..560a57cd54 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java @@ -94,7 +94,7 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_Capacitor(aPlayerInventory, aBaseMetaTileEntity, "Capacitor ParameterDefinition"); + return new GT_GUIContainer_Capacitor(aPlayerInventory, aBaseMetaTileEntity, "Capacitor ParameterGroup"); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index e97ffaa670..63bd262a75 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -259,7 +259,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta mDescription, "Max stacks amount: " + EnumChatFormatting.AQUA + getMaxStacksCount(), "Stack capacity: " + EnumChatFormatting.AQUA + getMaxStackSize(), - "Place Overflow ParameterDefinition behind,on top or below", + "Place Overflow ParameterGroup behind,on top or below", "to provide overflow protection while this block", "is not attached to multi block.", "Transport range can be extended in straight", diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java index cd3ad8d573..0850bf859a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java @@ -94,7 +94,7 @@ public class GT_MetaTileEntity_Hatch_Holder extends GT_MetaTileEntity_Hatch { @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_Holder(aPlayerInventory, aBaseMetaTileEntity, "Holder ParameterDefinition"); + return new GT_GUIContainer_Holder(aPlayerInventory, aBaseMetaTileEntity, "Holder ParameterGroup"); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 69bebb4a78..0ec2196a82 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -16,6 +16,8 @@ import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -51,8 +53,6 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB private static double MASS_TO_EU_PARTIAL,MASS_TO_EU_INSTANT; private static int STARTUP_COST,KEEPUP_COST; - private long plasmaEnergy; - public static void setValues(int heliumPlasmaValue){ MASS_TO_EU_PARTIAL = heliumPlasmaValue / 1.75893000478707E07;//mass diff MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20; @@ -267,6 +267,8 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB protected byte eTier = 0; protected cElementalInstanceStack stack; + private long plasmaEnergy; + public Parameters.ParameterGroup.In mode; protected static final byte FUSE_MODE=0, COLLIDE_MODE =1; protected boolean started=false; @@ -328,6 +330,35 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB super(aName); } + @Override + protected void parametersInstantiation_EM() { + Parameters.ParameterGroup group=parametrization.makeGroup(0,false); + mode=group.makeInParameter(0,FUSE_MODE,()->{ + if(isMaster()){ + if(mode.get()==FUSE_MODE){ + return "Mode: Fuse"; + }else if(mode.get()==COLLIDE_MODE){ + return "Mode: Collide"; + } + return "Mode: Undefined"; + } + return "Currently Slaves..."; + },()->{ + if(isMaster()){ + if (mode.get() == FUSE_MODE || mode.get() == COLLIDE_MODE) { + return STATUS_OK; + } else if (mode.get() > 1) { + return STATUS_TOO_HIGH; + } else if (mode.get() < 0) { + return STATUS_TOO_LOW; + }else{ + return STATUS_WRONG; + } + } + return STATUS_UNUSED; + }); + } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_EM_collider(mName); @@ -441,16 +472,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public void parametersOutAndStatusesWrite_EM(boolean machineBusy) { if(isMaster()) { - double mode = getParameterIn(0, 0); - if (mode == FUSE_MODE || mode == COLLIDE_MODE) { - setStatusOfParameterIn(0, 0, STATUS_OK); - } else if (mode > 1) { - setStatusOfParameterIn(0, 0, STATUS_TOO_HIGH); - } else if (mode < 0) { - setStatusOfParameterIn(0, 0, STATUS_TOO_LOW); - }else{ - setStatusOfParameterIn(0,0,STATUS_WRONG); - } + super.parametersOutAndStatusesWrite_EM(machineBusy); } } @@ -600,7 +622,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB return; } if (isMaster()) { - switch (getParameterInInt(0,0)){ + switch ((int)mode.get()){ case FUSE_MODE: makeEU(fuse(partner)); break; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 346e851345..8c0a0f0708 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -53,7 +53,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo private static final String[] description = new String[]{ EnumChatFormatting.AQUA + "Hint Details:", "1 - Classic Hatches or High Power Casing", - "2 - Elemental Input ParameterDefinition", + "2 - Elemental Input ParameterGroup", "3 - Elemental Overflow Hatches or Molecular Casing", }; //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java index 5733bfb458..1494d97e34 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java @@ -59,7 +59,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock private static final String[] description = new String[]{ EnumChatFormatting.AQUA+"Hint Details:", "1 - Classic Hatches or High Power Casing", - "2 - Elemental Output ParameterDefinition", + "2 - Elemental Output ParameterGroup", "3 - Elemental Overflow Hatches or Molecular Casing", }; //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index edc9c11a56..b4b786dcdb 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -73,7 +73,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB private static final String[] description = new String[]{ EnumChatFormatting.AQUA+"Hint Details:", "1 - Classic/Data Hatches or Computer casing", - "2 - Holder ParameterDefinition", + "2 - Holder ParameterGroup", }; //endregion @@ -286,7 +286,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } for (int i = 0; i < tRecipe.mFluidInputs.length; i++) { if (tRecipe.mFluidInputs[i] != null) { - tNBTList.appendTag(new NBTTagString("Input ParameterDefinition " + (i + 1) + ": " + tRecipe.mFluidInputs[i].amount + "L " + GT_LanguageManager.getTranslation(tRecipe.mFluidInputs[i].getLocalizedName()))); + tNBTList.appendTag(new NBTTagString("Input ParameterGroup " + (i + 1) + ": " + tRecipe.mFluidInputs[i].amount + "L " + GT_LanguageManager.getTranslation(tRecipe.mFluidInputs[i].getLocalizedName()))); } } tNBT.setTag("pages", tNBTList); @@ -382,7 +382,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB s = tRecipe.mFluidInputs[i].getLocalizedName(); } } - tNBTList.appendTag(new NBTTagString("Input ParameterDefinition "+(i+1)+": "+tRecipe.mFluidInputs[i].amount+"L "+s)); + tNBTList.appendTag(new NBTTagString("Input ParameterGroup "+(i+1)+": "+tRecipe.mFluidInputs[i].amount+"L "+s)); } } tNBT.setTag("pages", tNBTList); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java index 07fde1050a..82da3a5ba2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java @@ -453,6 +453,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt EnumChatFormatting.AQUA+paramID + EnumChatFormatting.YELLOW+ ":"+ EnumChatFormatting.AQUA+"I"); + try{ + list.add(parametrization.parameterGroups[hatchNo].in[paramID].name.get()); + }catch (NullPointerException e){ + list.add("Unused"); + } return list; } @@ -470,6 +475,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt EnumChatFormatting.AQUA+paramID + EnumChatFormatting.YELLOW+ ":"+ EnumChatFormatting.AQUA+"O"); + try{ + list.add(parametrization.parameterGroups[hatchNo].out[paramID].name.get()); + }catch (NullPointerException e){ + list.add("Unused"); + } return list; } @@ -730,13 +740,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt */ public void parametersOutAndStatusesWrite_EM(boolean machineBusy) { if(!machineBusy){ - for (Parameters.ParameterDefinition.In in : parametrization.inArrayList) { + for (Parameters.ParameterGroup.In in : parametrization.inArrayList) { if (in != null) { in.updateStatus(); } } } - for (Parameters.ParameterDefinition.Out out : parametrization.outArrayList) { + for (Parameters.ParameterGroup.Out out : parametrization.outArrayList) { if (out != null) { out.updateStatus(); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java index 3bd769f14f..824588ab25 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java @@ -9,12 +9,13 @@ import java.util.function.Supplier; public class Parameters { private static final Supplier LED_STATUS_FUNCTION_DEFAULT = ()->LedStatus.STATUS_UNDEFINED; private static final int ZERO_FLOAT=Float.floatToIntBits(0); - private final ParameterDefinition[] parameterDefinitions =new ParameterDefinition[10]; + + final ParameterGroup[] parameterGroups =new ParameterGroup[10]; final int[] iParamsIn = new int[20];//number I from parametrizers final int[] iParamsOut = new int[20];//number O to parametrizers - final ArrayList inArrayList=new ArrayList<>(); - final ArrayList outArrayList=new ArrayList<>(); + final ArrayList inArrayList=new ArrayList<>(); + final ArrayList outArrayList=new ArrayList<>(); final boolean[] bParamsAreFloats =new boolean[10]; @@ -24,9 +25,9 @@ public class Parameters { Parameters(){} - void setToDefaults(boolean defaultIn, boolean defaultOut,boolean defaultAreFloats){ + public void setToDefaults(boolean defaultIn, boolean defaultOut,boolean defaultAreFloats){ for (int hatch=0;hatch<10;hatch++) { - ParameterDefinition p= parameterDefinitions[hatch]; + ParameterGroup p= parameterGroups[hatch]; if (p!=null){ p.setToDefaults(defaultIn,defaultOut,defaultAreFloats); }else{ @@ -69,30 +70,42 @@ public class Parameters { setToDefaults(true,true,false); inArrayList.clear(); outArrayList.clear(); - for(int i = 0; i< parameterDefinitions.length; i++){ - parameterDefinitions[i]=null; + for(int i = 0; i< parameterGroups.length; i++){ + parameterGroups[i]=null; } } + public ParameterGroup makeGroup(int hatchNo, boolean aParamsDefaultsAreFloats){ + return new ParameterGroup( hatchNo, aParamsDefaultsAreFloats); + } + /** * most likely used locally in parametersInstantiation_EM() */ - public class ParameterDefinition { + public class ParameterGroup { private final boolean bParamsDefaultsAreStoredAsFloats; private final int hatchNo; - private final In[] in=new In[2]; - private final Out[] out=new Out[2]; + final In[] in=new In[2]; + final Out[] out=new Out[2]; - private ParameterDefinition(int hatchNo, boolean aParamsDefaultsAreFloats){ + private ParameterGroup(int hatchNo, boolean aParamsDefaultsAreFloats){ if(hatchNo<0 || hatchNo>=10){ - throw new IllegalArgumentException("ParameterDefinition id must be in 0 to 9 range"); + throw new IllegalArgumentException("ParameterGroup id must be in 0 to 9 range"); } this.hatchNo=hatchNo; bParamsDefaultsAreStoredAsFloats =aParamsDefaultsAreFloats; - parameterDefinitions[hatchNo]=this; + parameterGroups[hatchNo]=this; + } + + public In makeInParameter(int paramID, double defaultValue,Supplier name, Supplier status){ + return new In(paramID, defaultValue,name, status); + } + + public Out makeOutParameter(int paramID, double defaultValue,Supplier name, Supplier status){ + return new Out(paramID, defaultValue, name, status); } - private void setToDefaults(boolean defaultIn, boolean defaultOut,boolean defaultAreFloats) { + public void setToDefaults(boolean defaultIn, boolean defaultOut,boolean defaultAreFloats) { if(defaultAreFloats){ bParamsAreFloats[hatchNo] = bParamsDefaultsAreStoredAsFloats; } @@ -135,8 +148,10 @@ public class Parameters { public final int id; public final double defaultValue; private final Supplier status; + public Supplier name; - public Out(int paramID, double defaultValue, Supplier< LedStatus> status){ + private Out(int paramID, double defaultValue,Supplier name, Supplier status){ + this.name=name; this.id=hatchNo+10*paramID; if(paramID<0 || paramID>2){ throw new IllegalArgumentException("Parameter id must be in 0 to 1 range"); @@ -193,8 +208,10 @@ public class Parameters { public final int id; public final double defaultValue; private final Supplier status; + public Supplier name; - public In(int paramID, double defaultValue,Supplier status){ + private In(int paramID, double defaultValue,Supplier name,Supplier status){ + this.name=name; this.id=hatchNo+10*paramID; if(paramID<0 || paramID>2){ throw new IllegalArgumentException("Parameter id must be in 0 to 1 range"); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java index 93c8f69587..d22b1d4d2c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java @@ -9,6 +9,7 @@ import com.github.technus.tectech.thing.block.QuantumStuffBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; @@ -31,7 +32,6 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStat * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - public static final String machine = "EM Machinery"; private Behaviour currentBehaviour; @@ -376,10 +376,13 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa public static abstract class Behaviour { public Behaviour(){} - public abstract void setOnMachine(){ - + public final void setOnMachine(GT_MetaTileEntity_EM_machine te){ + te.parametrization.ClearDefinitions(); + parametersInstantiation(te.parametrization); } + public abstract void parametersInstantiation(Parameters parameters); + /** * handle parameters pre recipe, and cyclically * this shouldn't write to input parameters! only to the provided array and/or output parameters @@ -397,22 +400,6 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa * @return null if recipe should not start, control object to set machine state and start recipe */ public abstract MultiblockControl process(cElementalInstanceStackMap[] inputs, double[] checkedAndFixedParameters); - - /** - * get input param description, only for 4 first hatches - * @param baseDescr - * @param hatchNo - * @param paramID - */ - protected void getFullLedDescriptionIn(ArrayList baseDescr, int hatchNo, int paramID){} - - /** - * get output param description - * @param baseDescr - * @param hatchNo - * @param paramID - */ - protected void getFullLedDescriptionOut(ArrayList baseDescr, int hatchNo, int paramID){} } @Override -- cgit From 664d264be74c12b2a7471548b16d49870d98cada Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 18 Feb 2019 19:24:14 +0100 Subject: Storing work --- .../multi/GT_MetaTileEntity_EM_collider.java | 64 +++++----- .../multi/GT_MetaTileEntity_EM_computer.java | 11 ++ .../multi/base/GT_Container_MultiMachineEM.java | 4 +- .../multi/base/GT_GUIContainer_MultiMachineEM.java | 2 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 21 ++-- .../thing/metaTileEntity/multi/base/LedStatus.java | 67 ++++++++++- .../metaTileEntity/multi/base/Parameters.java | 129 +++++++++++---------- .../em_machine/GT_MetaTileEntity_EM_machine.java | 2 +- 8 files changed, 190 insertions(+), 110 deletions(-) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 0ec2196a82..e805b02fa9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -34,6 +34,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; +import java.util.function.Function; import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; @@ -50,11 +51,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB private static Textures.BlockIcons.CustomIcon ScreenON_Slave; private static Textures.BlockIcons.CustomIcon ScreenOFF_Slave; - private static double MASS_TO_EU_PARTIAL,MASS_TO_EU_INSTANT; + protected static final byte FUSE_MODE=0, COLLIDE_MODE =1; + private static double MASS_TO_EU_INSTANT; private static int STARTUP_COST,KEEPUP_COST; public static void setValues(int heliumPlasmaValue){ - MASS_TO_EU_PARTIAL = heliumPlasmaValue / 1.75893000478707E07;//mass diff + double MASS_TO_EU_PARTIAL = heliumPlasmaValue / 1.75893000478707E07;//mass diff MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20; STARTUP_COST=-heliumPlasmaValue*10000; KEEPUP_COST=-heliumPlasmaValue; @@ -268,9 +270,36 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB protected byte eTier = 0; protected cElementalInstanceStack stack; private long plasmaEnergy; - public Parameters.ParameterGroup.In mode; - protected static final byte FUSE_MODE=0, COLLIDE_MODE =1; + //region parameters + protected Parameters.Group.ParameterIn mode; + private static final Function MODE_STATUS = base_EM->{ + if(base_EM.isMaster()){ + if (base_EM.mode.get() == FUSE_MODE || base_EM.mode.get() == COLLIDE_MODE) { + return STATUS_OK; + } else if (base_EM.mode.get() > 1) { + return STATUS_TOO_HIGH; + } else if (base_EM.mode.get() < 0) { + return STATUS_TOO_LOW; + }else{ + return STATUS_WRONG; + } + } + return STATUS_UNUSED; + }; + private static final Function MODE_NAME = base_EM->{ + if(base_EM.isMaster()){ + if(base_EM.mode.get()==FUSE_MODE){ + return "Mode: Fuse"; + }else if(base_EM.mode.get()==COLLIDE_MODE){ + return "Mode: Collide"; + } + return "Mode: Undefined"; + } + return "Currently Slaves..."; + }; + //endregion + protected boolean started=false; //region Structure @@ -332,31 +361,8 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override protected void parametersInstantiation_EM() { - Parameters.ParameterGroup group=parametrization.makeGroup(0,false); - mode=group.makeInParameter(0,FUSE_MODE,()->{ - if(isMaster()){ - if(mode.get()==FUSE_MODE){ - return "Mode: Fuse"; - }else if(mode.get()==COLLIDE_MODE){ - return "Mode: Collide"; - } - return "Mode: Undefined"; - } - return "Currently Slaves..."; - },()->{ - if(isMaster()){ - if (mode.get() == FUSE_MODE || mode.get() == COLLIDE_MODE) { - return STATUS_OK; - } else if (mode.get() > 1) { - return STATUS_TOO_HIGH; - } else if (mode.get() < 0) { - return STATUS_TOO_LOW; - }else{ - return STATUS_WRONG; - } - } - return STATUS_UNUSED; - }); + Parameters.Group group=parametrization.makeGroup(0,false); + mode=group.makeInParameter(0,FUSE_MODE, MODE_NAME, MODE_STATUS); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java index 77db52f4b1..305acb23e3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java @@ -10,6 +10,7 @@ import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_H import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -43,6 +44,11 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; + //region parameters + protected Parameters.Group.ParameterIn overclock,overvolt; + + //endregion + private final ArrayList eRacks = new ArrayList<>(); private int maxCurrentTemp = 0; @@ -76,6 +82,11 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB eCertainStatus = -128;//no-brain value } + @Override + protected void parametersInstantiation_EM() { + + } + @Override @SideOnly(Side.CLIENT) protected ResourceLocation getActivitySound(){ diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java index b8c856f9f8..78b020979e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java @@ -11,8 +11,8 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { - public LedStatus[] eParamsInStatus = new LedStatus[20];//unused 0,G ok 1, B too low 2, R too high 3, Y blink dangerous 4,5 - public LedStatus[] eParamsOutStatus = new LedStatus[20]; + public LedStatus[] eParamsInStatus = LedStatus.makeArray(20,LedStatus.STATUS_UNDEFINED); + public LedStatus[] eParamsOutStatus = LedStatus.makeArray(20,LedStatus.STATUS_UNDEFINED); public byte eCertainMode = 5, eCertainStatus = 127; public boolean ePowerPass = false, eSafeVoid = false, allowedToWork = false; public final boolean ePowerPassButton, eSafeVoidButton, allowedToWorkButton; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java index 90ad4e7388..71ab4c0af8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java @@ -231,7 +231,7 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach case STATUS_HIGH:// too high drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (6 + j), su, sv); break; - case STATUS_UNUSED: + default: if (GregTech_API.sColoredGUI && this.mContainer.mTileEntity != null) { int tColor = this.mContainer.mTileEntity.getColorization() & 15; if (tColor < ItemDye.field_150922_c.length) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java index 82da3a5ba2..f99eb510d3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java @@ -97,7 +97,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //region parameters public final Parameters parametrization; - //endregion //region Control variables @@ -152,14 +151,14 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected GT_MetaTileEntity_MultiblockBase_EM(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); - parametrization=new Parameters(); + parametrization=new Parameters(this); parametersInstantiation_EM(); parametrization.setToDefaults(true,true,true); } protected GT_MetaTileEntity_MultiblockBase_EM(String aName) { super(aName); - parametrization=new Parameters(); + parametrization=new Parameters(this); parametersInstantiation_EM(); parametrization.setToDefaults(true,true,true); } @@ -454,7 +453,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt EnumChatFormatting.YELLOW+ ":"+ EnumChatFormatting.AQUA+"I"); try{ - list.add(parametrization.parameterGroups[hatchNo].in[paramID].name.get()); + list.add(parametrization.groups[hatchNo].parameterIn[paramID].getBrief()); }catch (NullPointerException e){ list.add("Unused"); } @@ -476,7 +475,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt EnumChatFormatting.YELLOW+ ":"+ EnumChatFormatting.AQUA+"O"); try{ - list.add(parametrization.parameterGroups[hatchNo].out[paramID].name.get()); + list.add(parametrization.groups[hatchNo].parameterOut[paramID].getBrief()); }catch (NullPointerException e){ list.add("Unused"); } @@ -740,15 +739,15 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt */ public void parametersOutAndStatusesWrite_EM(boolean machineBusy) { if(!machineBusy){ - for (Parameters.ParameterGroup.In in : parametrization.inArrayList) { - if (in != null) { - in.updateStatus(); + for (Parameters.Group.ParameterIn parameterIn : parametrization.parameterInArrayList) { + if (parameterIn != null) { + parameterIn.updateStatus(); } } } - for (Parameters.ParameterGroup.Out out : parametrization.outArrayList) { - if (out != null) { - out.updateStatus(); + for (Parameters.Group.ParameterOut parameterOut : parametrization.parameterOutArrayList) { + if (parameterOut != null) { + parameterOut.updateStatus(); } } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java index fba5910532..f346fe7e64 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java @@ -8,8 +8,7 @@ public enum LedStatus { STATUS_OK, STATUS_TOO_HIGH, STATUS_HIGH, - STATUS_UNDEFINED, - STATUS_NEUTRAL; + STATUS_UNDEFINED; public boolean isOk(){ return (ordinal()&1)==0; @@ -26,8 +25,70 @@ public enum LedStatus { public static LedStatus getStatus(byte value){ try{ return LedStatus.values()[value]; - }catch (IndexOutOfBoundsException e){ + }catch (Exception e){ return STATUS_UNDEFINED; } } + + public static LedStatus[] makeArray(int count,LedStatus defaultValue){ + LedStatus[] statuses=new LedStatus[count]; + for (int i = 0; i < count; i++) { + statuses[i]=defaultValue; + } + return statuses; + } + + public static LedStatus fromLimitsInclusiveOuterBoundary(double value, double min,double low, double high, double max, double... excludedNumbers + ){ + if(Double.isNaN(value)) return STATUS_WRONG; + if(valuemax) return STATUS_TOO_HIGH; + + if(valuehigh) return STATUS_HIGH; + for (double val : excludedNumbers) { + if(val==value) return STATUS_WRONG; + } + return STATUS_UNDEFINED; + } + + public static LedStatus fromLimitsExclusiveOuterBoundary(double value, double min,double low, double high,double max, double... excludedNumbers + ){ + if(Double.isNaN(value)) return STATUS_WRONG; + if(value<=min) return STATUS_TOO_LOW; + if(value>=max) return STATUS_TOO_HIGH; + + if(valuehigh) return STATUS_HIGH; + for (double val : excludedNumbers) { + if(val==value) return STATUS_WRONG; + } + return STATUS_OK; + } + + public static LedStatus fromLimitsInclusiveOuterBoundary(double value, double min, double max, double... excludedNumbers + ){ + if(Double.isNaN(value)) return STATUS_WRONG; + if(value<=min) return STATUS_TOO_LOW; + else if(value==min) + if(value>=max) return STATUS_TOO_HIGH; + + for (double val : excludedNumbers) { + if(val==value) return STATUS_WRONG; + } + return STATUS_OK; + } + + public static LedStatus fromLimitsExclusiveOuterBoundary(double value, double min, double max, double... excludedNumbers + ){ + if(Double.isNaN(value)) return STATUS_WRONG; + if(value<=min) return STATUS_TOO_LOW; + else if(value==min) + if(value>=max) return STATUS_TOO_HIGH; + + for (double val : excludedNumbers) { + if(val==value) return STATUS_WRONG; + } + return STATUS_OK; + } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java index 824588ab25..e67072309f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java @@ -1,33 +1,38 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; import java.util.ArrayList; -import java.util.function.Supplier; +import java.util.function.Function; /** * Instantiate parameters as field in parametersInstantiation_EM(); */ public class Parameters { - private static final Supplier LED_STATUS_FUNCTION_DEFAULT = ()->LedStatus.STATUS_UNDEFINED; - private static final int ZERO_FLOAT=Float.floatToIntBits(0); + public static final Function LED_STATUS_FUNCTION_DEFAULT = o->LedStatus.STATUS_UNDEFINED; + public static final Function NAME_FUNCTION_DEFAULT=o->"Undefined"; + public static final int ZERO_FLOAT=Float.floatToIntBits(0); - final ParameterGroup[] parameterGroups =new ParameterGroup[10]; + final Group[] groups = new Group[10]; final int[] iParamsIn = new int[20];//number I from parametrizers final int[] iParamsOut = new int[20];//number O to parametrizers - final ArrayList inArrayList=new ArrayList<>(); - final ArrayList outArrayList=new ArrayList<>(); + final ArrayList parameterInArrayList =new ArrayList<>(); + final ArrayList parameterOutArrayList =new ArrayList<>(); final boolean[] bParamsAreFloats =new boolean[10]; //package private for use in gui - final LedStatus[] eParamsInStatus = new LedStatus[20];//LED status for I - final LedStatus[] eParamsOutStatus = new LedStatus[20];//LED status for O + final LedStatus[] eParamsInStatus = LedStatus.makeArray(20,LedStatus.STATUS_UNUSED);//LED status for I + final LedStatus[] eParamsOutStatus = LedStatus.makeArray(20,LedStatus.STATUS_UNUSED);//LED status for O - Parameters(){} + private final GT_MetaTileEntity_MultiblockBase_EM parent; + + Parameters(GT_MetaTileEntity_MultiblockBase_EM parent){ + this.parent=parent; + } public void setToDefaults(boolean defaultIn, boolean defaultOut,boolean defaultAreFloats){ for (int hatch=0;hatch<10;hatch++) { - ParameterGroup p= parameterGroups[hatch]; + Group p= groups[hatch]; if (p!=null){ p.setToDefaults(defaultIn,defaultOut,defaultAreFloats); }else{ @@ -68,41 +73,41 @@ public class Parameters { public void ClearDefinitions(){ setToDefaults(true,true,false); - inArrayList.clear(); - outArrayList.clear(); - for(int i = 0; i< parameterGroups.length; i++){ - parameterGroups[i]=null; + parameterInArrayList.clear(); + parameterOutArrayList.clear(); + for(int i = 0; i< groups.length; i++){ + groups[i]=null; } } - public ParameterGroup makeGroup(int hatchNo, boolean aParamsDefaultsAreFloats){ - return new ParameterGroup( hatchNo, aParamsDefaultsAreFloats); + public Group makeGroup(int hatchNo, boolean aParamsDefaultsAreFloats){ + return new Group( hatchNo, aParamsDefaultsAreFloats); } /** * most likely used locally in parametersInstantiation_EM() */ - public class ParameterGroup { + public class Group { private final boolean bParamsDefaultsAreStoredAsFloats; private final int hatchNo; - final In[] in=new In[2]; - final Out[] out=new Out[2]; + final ParameterIn[] parameterIn =new ParameterIn[2]; + final ParameterOut[] parameterOut =new ParameterOut[2]; - private ParameterGroup(int hatchNo, boolean aParamsDefaultsAreFloats){ + private Group(int hatchNo, boolean aParamsDefaultsAreFloats){ if(hatchNo<0 || hatchNo>=10){ throw new IllegalArgumentException("ParameterGroup id must be in 0 to 9 range"); } this.hatchNo=hatchNo; bParamsDefaultsAreStoredAsFloats =aParamsDefaultsAreFloats; - parameterGroups[hatchNo]=this; + groups[hatchNo]=this; } - public In makeInParameter(int paramID, double defaultValue,Supplier name, Supplier status){ - return new In(paramID, defaultValue,name, status); + public ParameterIn makeInParameter(int paramID, double defaultValue, Function name, Function status){ + return new ParameterIn(paramID, defaultValue,name, status); } - public Out makeOutParameter(int paramID, double defaultValue,Supplier name, Supplier status){ - return new Out(paramID, defaultValue, name, status); + public ParameterOut makeOutParameter(int paramID, double defaultValue, Function name, Function status){ + return new ParameterOut(paramID, defaultValue, name, status); } public void setToDefaults(boolean defaultIn, boolean defaultOut,boolean defaultAreFloats) { @@ -111,8 +116,8 @@ public class Parameters { } if(defaultIn){ for(int in=0;in<2;in++){ - if(this.in[in]!=null){ - this.in[in].setDefault(); + if(this.parameterIn[in]!=null){ + this.parameterIn[in].setDefault(); }else { if (bParamsAreFloats[hatchNo]) { iParamsIn[hatchNo] = ZERO_FLOAT; @@ -126,8 +131,8 @@ public class Parameters { } if(defaultOut){ for(int out=0;out<2;out++){ - if(this.out[out]!=null){ - this.out[out].setDefault(); + if(this.parameterOut[out]!=null){ + this.parameterOut[out].setDefault(); }else { if (bParamsAreFloats[hatchNo]) { iParamsIn[hatchNo] = ZERO_FLOAT; @@ -144,29 +149,26 @@ public class Parameters { /** * Make a field out of this... */ - public class Out { + public class ParameterOut { public final int id; public final double defaultValue; - private final Supplier status; - public Supplier name; + Function status; + Function name; - private Out(int paramID, double defaultValue,Supplier name, Supplier status){ - this.name=name; + @SuppressWarnings("unchecked") + private ParameterOut(int paramID, double defaultValue, Function name, Function status){ + this.name= name; this.id=hatchNo+10*paramID; if(paramID<0 || paramID>2){ throw new IllegalArgumentException("Parameter id must be in 0 to 1 range"); } this.defaultValue=defaultValue; - if(out[paramID]!=null){ + if(parameterOut[paramID]!=null){ throw new InstantiationError("This parameter already exists!"); } - if(status ==null){ - this.status =LED_STATUS_FUNCTION_DEFAULT; - }else{ - this.status = status; - } - outArrayList.add(this); - out[paramID]=this; + this.status = status; + parameterOutArrayList.add(this); + parameterOut[paramID]=this; } private void setDefault() { @@ -185,48 +187,45 @@ public class Parameters { } } - public LedStatus getStatus(){ - return eParamsOutStatus[id]; - } - public void updateStatus(){ - eParamsOutStatus[id]=status.get(); + eParamsOutStatus[id]=status.apply(parent); } - public LedStatus getStaus(boolean update){ + public LedStatus getStatus(boolean update){ if(update){ updateStatus(); } return eParamsOutStatus[id]; } + + public String getBrief(){ + return name.apply(parent); + } } /** * Make a field out of this... */ - public class In { + public class ParameterIn { public final int id; public final double defaultValue; - private final Supplier status; - public Supplier name; + Function status; + Function name; - private In(int paramID, double defaultValue,Supplier name,Supplier status){ - this.name=name; + @SuppressWarnings("unchecked") + private ParameterIn(int paramID, double defaultValue, Function name, Function status){ + this.name= name; this.id=hatchNo+10*paramID; if(paramID<0 || paramID>2){ throw new IllegalArgumentException("Parameter id must be in 0 to 1 range"); } this.defaultValue=defaultValue; - if(in[paramID]!=null){ + if(parameterIn[paramID]!=null){ throw new InstantiationError("This parameter already exists!"); } - if(status ==null){ - this.status =LED_STATUS_FUNCTION_DEFAULT; - }else{ - this.status = status; - } - inArrayList.add(this); - in[paramID]=this; + this.status = status; + parameterInArrayList.add(this); + parameterIn[paramID]=this; } private void setDefault() { @@ -242,15 +241,19 @@ public class Parameters { } public void updateStatus(){ - eParamsInStatus[id]=status.get(); + eParamsInStatus[id]=status.apply(parent); } - public LedStatus getStaus(boolean update){ + public LedStatus getStatus(boolean update){ if(update){ updateStatus(); } return eParamsInStatus[id]; } + + public String getBrief(){ + return name.apply(parent); + } } } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java index d22b1d4d2c..9c45b5df67 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java @@ -377,7 +377,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa public Behaviour(){} public final void setOnMachine(GT_MetaTileEntity_EM_machine te){ - te.parametrization.ClearDefinitions(); + te.parametrization.clearGroups(); parametersInstantiation(te.parametrization); } -- cgit From 16ace78716ae898fe0d57abde51448fde68c2d58 Mon Sep 17 00:00:00 2001 From: Tec Date: Tue, 19 Feb 2019 20:28:13 +0100 Subject: Most likely the param api will look like this. --- .../multi/GT_MetaTileEntity_EM_collider.java | 4 +- .../multi/GT_MetaTileEntity_EM_computer.java | 109 +++++++-------------- .../multi/GT_MetaTileEntity_EM_dataBank.java | 10 -- .../multi/GT_MetaTileEntity_EM_decay.java | 33 +++++-- .../multi/base/GT_Container_MultiMachineEM.java | 36 +++++++ .../multi/base/GT_GUIContainer_MultiMachineEM.java | 78 ++++++++++----- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 41 +++++--- .../thing/metaTileEntity/multi/base/LedStatus.java | 46 +++++---- .../metaTileEntity/multi/base/Parameters.java | 49 ++++++--- 9 files changed, 247 insertions(+), 159 deletions(-) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index e805b02fa9..03404cf652 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -361,8 +361,8 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override protected void parametersInstantiation_EM() { - Parameters.Group group=parametrization.makeGroup(0,false); - mode=group.makeInParameter(0,FUSE_MODE, MODE_NAME, MODE_STATUS); + Parameters.Group hatch_0=parametrization.makeGroup(0,false); + mode=hatch_0.makeInParameter(0,FUSE_MODE, MODE_NAME, MODE_STATUS); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java index 305acb23e3..d12ec0ca64 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java @@ -10,6 +10,7 @@ import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_H import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; @@ -28,6 +29,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import java.util.ArrayList; +import java.util.function.Function; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.Util.StructureBuilderExtreme; @@ -46,11 +48,29 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB //region parameters protected Parameters.Group.ParameterIn overclock,overvolt; - + protected Parameters.Group.ParameterOut maxCurrentTemp,availableData; + private static final Function OC_NAME = base-> "Overclock ratio"; + private static final Function OV_NAME = base-> "Overvoltage ratio"; + private static final Function MAX_TEMP_NAME = base-> "Current max. heat"; + private static final Function COMPUTE_NAME = base-> "Produced computation"; + private static final Function OC_STATUS= + base->LedStatus.fromLimitsInclusiveOuterBoundary(base.overclock.get(),0,1,1,3); + private static final Function OV_STATUS= + base->LedStatus.fromLimitsInclusiveOuterBoundary(base.overvolt.get(),.7,.8,1.2,2); + private static final Function MAX_TEMP_STATUS= + base->LedStatus.fromLimitsInclusiveOuterBoundary(base.maxCurrentTemp.get(),-10000,0,0,5000); + private static final Function COMPUTE_STATUS=base->{ + if(base.eAvailableData<0){ + return STATUS_TOO_LOW; + } + if(base.eAvailableData==0){ + return STATUS_NEUTRAL; + } + return STATUS_OK; + }; //endregion private final ArrayList eRacks = new ArrayList<>(); - private int maxCurrentTemp = 0; //region Structure private static final String[][] front = new String[][]{{"A ", "A ", "A. ", "A ",},}; @@ -84,7 +104,11 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override protected void parametersInstantiation_EM() { - + Parameters.Group hatch_0=parametrization.makeGroup(0,true); + overclock=hatch_0.makeInParameter(0,1,OC_NAME,OC_STATUS); + overvolt=hatch_0.makeInParameter(1,1,OV_NAME,OV_STATUS); + maxCurrentTemp=hatch_0.makeOutParameter(0,0,MAX_TEMP_NAME,MAX_TEMP_STATUS); + availableData=hatch_0.makeOutParameter(1,0,COMPUTE_NAME,COMPUTE_STATUS); } @Override @@ -116,14 +140,15 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public boolean checkRecipe_EM(ItemStack itemStack) { + parametrization.setToDefaults(false,true,false); eAvailableData = 0; - maxCurrentTemp = 0; - double overClockRatio= getParameterIn(0,0); - double overVoltageRatio= getParameterIn(0,1); + double maxTemp=0; + double overClockRatio= overclock.get(); + double overVoltageRatio= overvolt.get(); if(Double.isNaN(overClockRatio) || Double.isNaN(overVoltageRatio)) { return false; } - if(overClockRatio>0 && overVoltageRatio>=0.7f && overClockRatio<=3 && overVoltageRatio<=2){ + if(overclock.getStatus(true).isOk() && overvolt.getStatus(true).isOk()){ float eut=V[8] * (float)overVoltageRatio * (float)overClockRatio; if(eut maxCurrentTemp) { - maxCurrentTemp = rack.heat; + if (rack.heat > maxTemp) { + maxTemp=rack.heat; } rackComputation = rack.tickComponents((float) overClockRatio, (float) overVoltageRatio); if (rackComputation > 0) { @@ -161,6 +186,8 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB eAmpereFlow = 1 + (thingsActive >> 2); mMaxProgresstime = 20; mEfficiencyIncrease = 10000; + maxCurrentTemp.set(maxTemp); + availableData.set(eAvailableData); return true; } else { eAvailableData=0; @@ -168,6 +195,8 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB eAmpereFlow = 1; mMaxProgresstime = 20; mEfficiencyIncrease = 10000; + maxCurrentTemp.set(maxTemp); + availableData.set(eAvailableData); return true; } } @@ -211,68 +240,6 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } } - @Override - protected void parametersLoadDefault_EM() { - setParameterPairIn_ClearOut(0, false, 1, 1); - } - - @Override - public void parametersOutAndStatusesWrite_EM(boolean machineBusy) { - double ocRatio = getParameterIn(0, 0); - if (ocRatio < 0) { - setStatusOfParameterIn(0, 0, STATUS_TOO_LOW); - } else if (ocRatio < 1) { - setStatusOfParameterIn(0, 0, STATUS_LOW); - } else if (ocRatio == 1) { - setStatusOfParameterIn(0, 0, STATUS_OK); - } else if (ocRatio <= 3) { - setStatusOfParameterIn(0, 0, STATUS_HIGH); - } else if (Double.isNaN(ocRatio)) { - setStatusOfParameterIn(0, 0, STATUS_WRONG); - } else { - setStatusOfParameterIn(0, 0, STATUS_TOO_HIGH); - } - - double ovRatio = getParameterIn(0, 1); - if (ovRatio < 0.7f) { - setStatusOfParameterIn(0, 1, STATUS_TOO_LOW); - } else if (ovRatio < 0.8f) { - setStatusOfParameterIn(0, 1, STATUS_LOW); - } else if (ovRatio <= 1.2f) { - setStatusOfParameterIn(0, 1, STATUS_OK); - } else if (ovRatio <= 2) { - setStatusOfParameterIn(0, 1, STATUS_HIGH); - } else if (Double.isNaN(ovRatio)) { - setStatusOfParameterIn(0, 1, STATUS_WRONG); - } else { - setStatusOfParameterIn(0, 1, STATUS_TOO_HIGH); - } - - setParameterOut(0, 0, maxCurrentTemp); - setParameterOut(0, 1, eAvailableData); - - if (maxCurrentTemp < -10000) { - setStatusOfParameterOut(0, 0, STATUS_TOO_LOW); - } else if (maxCurrentTemp < 0) { - setStatusOfParameterOut(0, 0, STATUS_LOW); - } else if (maxCurrentTemp == 0) { - setStatusOfParameterOut(0, 0, STATUS_OK); - } else if (maxCurrentTemp <= 5000) { - setStatusOfParameterOut(0, 0, STATUS_HIGH); - } else { - setStatusOfParameterOut(0, 0, STATUS_TOO_HIGH); - } - - if (!machineBusy) { - setStatusOfParameterOut(0, 1, STATUS_NEUTRAL); - } else if (eAvailableData <= 0) { - setStatusOfParameterOut(0, 1, STATUS_TOO_LOW); - } else { - setStatusOfParameterOut(0, 1, STATUS_OK); - } - } - - @Override public void onRemoval() { super.onRemoval(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index e79675f016..3a4e82cb52 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -113,16 +113,6 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB return description; } - @Override - protected void parametersLoadDefault_EM() { - for(int i=0;i<10;i++){ - setStatusOfParameterIn(i,0,STATUS_UNUSED); - setStatusOfParameterIn(i,1,STATUS_UNUSED); - setStatusOfParameterOut(i,0,STATUS_UNUSED); - setStatusOfParameterOut(i,1,STATUS_UNUSED); - } - } - @Override public boolean checkRecipe_EM(ItemStack itemStack) { if (eDataAccessHatches.size() > 0 && eStacksDataOutputs.size() > 0) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 71a6b70dfb..36b7505a65 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -7,6 +7,8 @@ import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -23,11 +25,14 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import java.util.function.Function; + import static com.github.technus.tectech.CommonValues.VN; import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; /** * Created by danie_000 on 17.12.2016. @@ -40,6 +45,17 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase private static final double MASS_TO_EU_PARTIAL = ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF; private static final double MASS_TO_EU_INSTANT= MASS_TO_EU_PARTIAL *20; + //region parameters + protected Parameters.Group.ParameterIn ampereFlow; + private final Function FLOW_NAME=base->"Ampere divider"; + private final Function FLOW_STATUS=base->{ + if(eAmpereFlow<=0){ + return STATUS_TOO_LOW; + } + return STATUS_OK; + }; + //endregion + //region structure private static final String[][] shape = new String[][]{ {"0C0","A ","A . ","A ","0C0",}, @@ -73,6 +89,12 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase super(aName); } + @Override + protected void parametersInstantiation_EM() { + Parameters.Group hatch_0=parametrization.makeGroup(0,false); + ampereFlow=hatch_0.makeInParameter(0,1,FLOW_NAME,FLOW_STATUS); + } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_EM_decay(mName); @@ -157,8 +179,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase float preMass=outputEM[0].getMass(); outputEM[0].tickContent(1,0,1); double energyDose=((preMass-outputEM[0].getMass())* MASS_TO_EU_PARTIAL); - mEUt=(int)(energyDose/getParameterInInt(0,0)); - eAmpereFlow=getParameterInInt(0,0); + mEUt=(int)(energyDose/(eAmpereFlow=(long) ampereFlow.get())); return outputEM[0].hasStacks(); } @@ -191,17 +212,17 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase return new String[]{ "Progress:", EnumChatFormatting.GREEN + Integer.toString(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + - EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", + EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s", "Energy Hatches:", EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET + " EU", + EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", (mEUt <= 0 ? "Probably uses: " : "Probably makes: ") + - EnumChatFormatting.RED + Integer.toString(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t at " + + EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t at " + EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", "Tier Rating: " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + " Amp Rating: " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", "Problems: " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + - " Efficiency: " + EnumChatFormatting.YELLOW + Float.toString(mEfficiency / 100.0F) + EnumChatFormatting.RESET + " %", + " Efficiency: " + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", "PowerPass: " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + " SafeVoid: " + EnumChatFormatting.BLUE + eSafeVoid, "Computation: " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET, diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java index 78b020979e..bd2c20b2bc 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java @@ -10,10 +10,15 @@ import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import java.util.BitSet; + public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { public LedStatus[] eParamsInStatus = LedStatus.makeArray(20,LedStatus.STATUS_UNDEFINED); public LedStatus[] eParamsOutStatus = LedStatus.makeArray(20,LedStatus.STATUS_UNDEFINED); + public int[] eParamsIn = new int[20];//number I from parametrizers + public int[] eParamsOut = new int[20];//number O to parametrizers public byte eCertainMode = 5, eCertainStatus = 127; + public short eParamsAreFloats; public boolean ePowerPass = false, eSafeVoid = false, allowedToWork = false; public final boolean ePowerPassButton, eSafeVoidButton, allowedToWorkButton; @@ -108,6 +113,9 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { } eParamsInStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).parametrization.eParamsInStatus; eParamsOutStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).parametrization.eParamsOutStatus; + int[] iParamsIn= ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).parametrization.iParamsIn; + int[] iParamsOut= ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).parametrization.iParamsOut; + eParamsAreFloats=((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).parametrization.bParamsAreFloats; eCertainMode = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eCertainMode; eCertainStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eCertainStatus; ePowerPass = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).ePowerPass; @@ -122,6 +130,26 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { } var1.sendProgressBarUpdate(this, 120, eCertainMode | (eCertainStatus << 8)); var1.sendProgressBarUpdate(this, 121, (ePowerPass ? 1 : 0) + (eSafeVoid ? 2 : 0) + (allowedToWork ? 4 : 0)); + var1.sendProgressBarUpdate(this,122,eParamsAreFloats); + i=130; + for(int j=0;j>>16); + } + for(int j=0;j>>16); + } } } @@ -141,6 +169,14 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { ePowerPass = (par2 & 1) == 1; eSafeVoid = (par2 & 2) == 2; allowedToWork = (par2 & 4) == 4; + } else if (par1 == 122) { + eParamsAreFloats=(short) par2; + }else if(par1>=130 && par1<170){ + int pointer=(par1-130)>>1; + eParamsOut[pointer]=(par1&1)==0?eParamsOut[pointer]&0xFFFF0000|par2:eParamsOut[pointer]&0xFFFF|(par2<<16); + }else if(par1>=170 && par1<210){ + int pointer=(par1-170)>>1; + eParamsIn[pointer]=(par1&1)==0?eParamsIn[pointer]&0xFFFF0000|par2:eParamsIn[pointer]&0xFFFF|(par2<<16); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java index 71ab4c0af8..47a3d60a0a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java @@ -24,9 +24,11 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach private String mName; private static byte counter = 0; private final boolean ePowerPassButton, eSafeVoidButton, allowedToWorkButton; + private final GT_Container_MultiMachineEM mContainer; public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile, boolean enablePowerPass, boolean enableSafeVoid, boolean enablePowerButton) { super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); + mContainer=(GT_Container_MultiMachineEM)super.mContainer; mName = aName; ePowerPassButton=enablePowerPass; eSafeVoidButton=enableSafeVoid; @@ -37,6 +39,7 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); + mContainer=(GT_Container_MultiMachineEM)super.mContainer; mName = aName; ePowerPassButton=eSafeVoidButton=allowedToWorkButton=true; ySize= 192; @@ -58,36 +61,36 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach fontRendererObj.drawString(mName, 7, 8, 16448255); if (mContainer != null) { - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 1) != 0) { + if ((mContainer.mDisplayErrorCode & 1) != 0) { fontRendererObj.drawString("Pipe is loose.", 7, 16, 16448255); } - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 2) != 0) { + if ((mContainer.mDisplayErrorCode & 2) != 0) { fontRendererObj.drawString("Screws are loose.", 7, 24, 16448255); } - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 4) != 0) { + if ((mContainer.mDisplayErrorCode & 4) != 0) { fontRendererObj.drawString("Something is stuck.", 7, 32, 16448255); } - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 8) != 0) { + if ((mContainer.mDisplayErrorCode & 8) != 0) { fontRendererObj.drawString("Plating is dented.", 7, 40, 16448255); } - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 16) != 0) { + if ((mContainer.mDisplayErrorCode & 16) != 0) { fontRendererObj.drawString("Circuitry burned out.", 7, 48, 16448255); } - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 32) != 0) { + if ((mContainer.mDisplayErrorCode & 32) != 0) { fontRendererObj.drawString("That doesn't belong there.", 7, 56, 16448255); } - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 64) != 0) { + if ((mContainer.mDisplayErrorCode & 64) != 0) { fontRendererObj.drawString("Incomplete Structure.", 7, 64, 16448255); } - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 128) != 0) { + if ((mContainer.mDisplayErrorCode & 128) != 0) { fontRendererObj.drawString("Too Uncertain.", 7, 72, 16448255); } - if ((((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode & 256) != 0) { + if ((mContainer.mDisplayErrorCode & 256) != 0) { fontRendererObj.drawString("Invalid Parameters.", 7, 80, 16448255); } - if (((GT_Container_MultiMachineEM) mContainer).mDisplayErrorCode == 0) { - if (((GT_Container_MultiMachineEM) mContainer).mActive == 0) { + if (mContainer.mDisplayErrorCode == 0) { + if (mContainer.mActive == 0) { fontRendererObj.drawString("Soft Hammer or press Button", 7, 16, 16448255); fontRendererObj.drawString("to (re-)start the Machine", 7, 24, 16448255); fontRendererObj.drawString("if it doesn't start.", 7, 32, 16448255); @@ -104,41 +107,41 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach int x = (width - xSize) / 2; int y = (height - ySize) / 2; drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - if (mContainer != null && ((GT_Container_MultiMachineEM) mContainer).eParamsInStatus != null) { + if (mContainer != null && mContainer.eParamsInStatus != null) { counter = (byte) ((1 + counter) % 6); GL11.glColor4f(1f, 1f, 1f, 1f); x+= 173; if(!ePowerPassButton) { drawTexturedModalRect(x, y + 115, 231, 23, 18, 18); - } else if (((GT_Container_MultiMachineEM) mContainer).ePowerPass) { + } else if (mContainer.ePowerPass) { drawTexturedModalRect(x, y + 115, 207, 23, 18, 18); } if(!eSafeVoidButton) { drawTexturedModalRect(x, y + 132, 231, 41, 18, 18); - } else if (((GT_Container_MultiMachineEM) mContainer).eSafeVoid) { + } else if (mContainer.eSafeVoid) { drawTexturedModalRect(x, y + 132, 207, 41, 18, 18); } if(!allowedToWorkButton) { drawTexturedModalRect(x, y + 147, 231, 57, 18, 18); - } else if (((GT_Container_MultiMachineEM) mContainer).allowedToWork) { + } else if (mContainer.allowedToWork) { drawTexturedModalRect(x, y + 147, 207, 57, 18, 18); } x -= 162; y += 96; for (int i = 0; i < 20; ) { byte hatch = (byte) (i >>> 1); - LEDdrawP(x, y, i, 0, ((GT_Container_MultiMachineEM) mContainer).eParamsInStatus[hatch]); - LEDdrawP(x, y, i++, 1, ((GT_Container_MultiMachineEM) mContainer).eParamsOutStatus[hatch]); - LEDdrawP(x, y, i, 0, ((GT_Container_MultiMachineEM) mContainer).eParamsInStatus[hatch + 10]); - LEDdrawP(x, y, i++, 1, ((GT_Container_MultiMachineEM) mContainer).eParamsOutStatus[hatch + 10]); + LEDdrawP(x, y, i, 0, mContainer.eParamsInStatus[hatch]); + LEDdrawP(x, y, i++, 1, mContainer.eParamsOutStatus[hatch]); + LEDdrawP(x, y, i, 0, mContainer.eParamsInStatus[hatch + 10]); + LEDdrawP(x, y, i++, 1, mContainer.eParamsOutStatus[hatch + 10]); } short rU = 207, Vs = 77; x += 162; - byte state = ((GT_Container_MultiMachineEM) mContainer).eCertainStatus; - switch (((GT_Container_MultiMachineEM) mContainer).eCertainMode) { + byte state = mContainer.eCertainStatus; + switch (mContainer.eCertainMode) { case 1://ooo oxo ooo drawTexturedModalRect(x + 6, y + 6, rU + (state == 0 ? 30 : 6), @@ -231,6 +234,29 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach case STATUS_HIGH:// too high drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (6 + j), su, sv); break; + case STATUS_NEUTRAL: + if(counter<3){ + GL11.glColor4f(.85f, .9f, .95f, 1.0F); + drawTexturedModalRect(x + su * i, y + sv * j, 212, 96, su+2, sv+2); + GL11.glColor4f(1f, 1f, 1f, 1f); + }else { + GL11.glColor4f(.8f, .9f, 1f, 1.0F); + drawTexturedModalRect(x + su * i, y + sv * j, 212, 96, su+2, sv+2); + GL11.glColor4f(1f, 1f, 1f, 1f); + } + break; + case STATUS_UNDEFINED: + if(counter<3) { + GL11.glColor4f(.5f, .1f, .15f, 1.0F); + drawTexturedModalRect(x + su * i, y + sv * j, 212, 96, su + 2, sv + 2); + GL11.glColor4f(1f, 1f, 1f, 1f); + }else { + GL11.glColor4f(0f, .1f, .2f, 1.0F); + drawTexturedModalRect(x + su * i, y + sv * j, 212, 96, su + 2, sv + 2); + GL11.glColor4f(1f, 1f, 1f, 1f); + } + break; + case STATUS_UNUSED: default: if (GregTech_API.sColoredGUI && this.mContainer.mTileEntity != null) { int tColor = this.mContainer.mTileEntity.getColorization() & 15; @@ -254,6 +280,12 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach if(mContainer.mTileEntity!=null){ IMetaTileEntity mte=mContainer.mTileEntity.getMetaTileEntity(); if(mte instanceof GT_MetaTileEntity_MultiblockBase_EM){ + Parameters parametrization=((GT_MetaTileEntity_MultiblockBase_EM)mte).parametrization; + parametrization.bParamsAreFloats=mContainer.eParamsAreFloats; + parametrization.eParamsInStatus=mContainer.eParamsInStatus; + parametrization.eParamsOutStatus=mContainer.eParamsOutStatus; + parametrization.iParamsIn=mContainer.eParamsIn; + parametrization.iParamsOut=mContainer.eParamsOut; int su = 8, sv = 6, u=11,v=96; if(x=v && y=0) { - parametrization.bParamsAreFloats[hatch.param] = hatch.isUsingFloats(); + if(hatch.isUsingFloats()){ + parametrization.bParamsAreFloats |= B[hatch.param]; + }else { + parametrization.bParamsAreFloats &=~B[hatch.param]; + } } } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java index f346fe7e64..52d4f30c12 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java @@ -1,21 +1,30 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; public enum LedStatus { - STATUS_UNUSED, - STATUS_TOO_LOW, - STATUS_LOW, - STATUS_WRONG, - STATUS_OK, - STATUS_TOO_HIGH, - STATUS_HIGH, - STATUS_UNDEFINED; + STATUS_UNUSED("Unused",true), + STATUS_TOO_LOW("Too Low",false), + STATUS_LOW("Low",true), + STATUS_WRONG("Wrong",false), + STATUS_OK("Valid",true), + STATUS_TOO_HIGH("Too High",false), + STATUS_HIGH("High",true), + STATUS_UNDEFINED("Unknown",false), + STATUS_NEUTRAL("Neutral",true); + + public final String name; + public final boolean isOk; + + LedStatus(String name,boolean ok){ + this.name=name; + this.isOk=ok; + } public boolean isOk(){ - return (ordinal()&1)==0; + return isOk; } public boolean isBad(){ - return (ordinal()&1)==1; + return !isOk; } public byte getOrdinalByte(){ @@ -38,9 +47,7 @@ public enum LedStatus { return statuses; } - public static LedStatus fromLimitsInclusiveOuterBoundary(double value, double min,double low, double high, double max, double... excludedNumbers - ){ - if(Double.isNaN(value)) return STATUS_WRONG; + public static LedStatus fromLimitsInclusiveOuterBoundary(double value, double min,double low, double high, double max, double... excludedNumbers){ if(valuemax) return STATUS_TOO_HIGH; @@ -49,11 +56,11 @@ public enum LedStatus { for (double val : excludedNumbers) { if(val==value) return STATUS_WRONG; } + if(Double.isNaN(value)) return STATUS_WRONG; return STATUS_UNDEFINED; } - public static LedStatus fromLimitsExclusiveOuterBoundary(double value, double min,double low, double high,double max, double... excludedNumbers - ){ + public static LedStatus fromLimitsExclusiveOuterBoundary(double value, double min,double low, double high,double max, double... excludedNumbers){ if(Double.isNaN(value)) return STATUS_WRONG; if(value<=min) return STATUS_TOO_LOW; if(value>=max) return STATUS_TOO_HIGH; @@ -63,11 +70,11 @@ public enum LedStatus { for (double val : excludedNumbers) { if(val==value) return STATUS_WRONG; } + if(Double.isNaN(value)) return STATUS_WRONG; return STATUS_OK; } - public static LedStatus fromLimitsInclusiveOuterBoundary(double value, double min, double max, double... excludedNumbers - ){ + public static LedStatus fromLimitsInclusiveBoundary(double value, double min, double max, double... excludedNumbers){ if(Double.isNaN(value)) return STATUS_WRONG; if(value<=min) return STATUS_TOO_LOW; else if(value==min) @@ -76,11 +83,11 @@ public enum LedStatus { for (double val : excludedNumbers) { if(val==value) return STATUS_WRONG; } + if(Double.isNaN(value)) return STATUS_WRONG; return STATUS_OK; } - public static LedStatus fromLimitsExclusiveOuterBoundary(double value, double min, double max, double... excludedNumbers - ){ + public static LedStatus fromLimitsExclusiveBoundary(double value, double min, double max, double... excludedNumbers){ if(Double.isNaN(value)) return STATUS_WRONG; if(value<=min) return STATUS_TOO_LOW; else if(value==min) @@ -89,6 +96,7 @@ public enum LedStatus { for (double val : excludedNumbers) { if(val==value) return STATUS_WRONG; } + if(Double.isNaN(value)) return STATUS_WRONG; return STATUS_OK; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java index e67072309f..3ab2947085 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java @@ -1,8 +1,13 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; +import gregtech.api.enums.GT_Values; + import java.util.ArrayList; +import java.util.BitSet; import java.util.function.Function; +import static gregtech.api.enums.GT_Values.B; + /** * Instantiate parameters as field in parametersInstantiation_EM(); */ @@ -13,16 +18,24 @@ public class Parameters { final Group[] groups = new Group[10]; - final int[] iParamsIn = new int[20];//number I from parametrizers - final int[] iParamsOut = new int[20];//number O to parametrizers + int[] iParamsIn = new int[20];//number I from parametrizers + int[] iParamsOut = new int[20];//number O to parametrizers final ArrayList parameterInArrayList =new ArrayList<>(); final ArrayList parameterOutArrayList =new ArrayList<>(); - final boolean[] bParamsAreFloats =new boolean[10]; + short bParamsAreFloats=0; //package private for use in gui - final LedStatus[] eParamsInStatus = LedStatus.makeArray(20,LedStatus.STATUS_UNUSED);//LED status for I - final LedStatus[] eParamsOutStatus = LedStatus.makeArray(20,LedStatus.STATUS_UNUSED);//LED status for O + LedStatus[] eParamsInStatus = LedStatus.makeArray(20,LedStatus.STATUS_UNUSED);//LED status for I + LedStatus[] eParamsOutStatus = LedStatus.makeArray(20,LedStatus.STATUS_UNUSED);//LED status for O + + public double getIn(int hatchNo,int parameterId){ + return (bParamsAreFloats& B[hatchNo])!=0?Float.intBitsToFloat(iParamsIn[hatchNo+10*parameterId]):iParamsIn[hatchNo+10*parameterId]; + } + + public double getOut(int hatchNo,int parameterId){ + return (bParamsAreFloats& B[hatchNo])!=0?Float.intBitsToFloat(iParamsOut[hatchNo+10*parameterId]):iParamsOut[hatchNo+10*parameterId]; + } private final GT_MetaTileEntity_MultiblockBase_EM parent; @@ -37,7 +50,7 @@ public class Parameters { p.setToDefaults(defaultIn,defaultOut,defaultAreFloats); }else{ if(defaultAreFloats){ - bParamsAreFloats[hatch]=false; + bParamsAreFloats&=~B[hatch]; if(defaultIn){ iParamsIn[hatch] = 0; iParamsIn[hatch + 10] = 0; @@ -47,7 +60,7 @@ public class Parameters { iParamsOut[hatch + 10] = 0; } }else{ - if(bParamsAreFloats[hatch]){ + if((bParamsAreFloats& B[hatch])!=0){ if(defaultIn){ iParamsIn[hatch] = ZERO_FLOAT; iParamsIn[hatch + 10] = ZERO_FLOAT; @@ -110,16 +123,20 @@ public class Parameters { return new ParameterOut(paramID, defaultValue, name, status); } - public void setToDefaults(boolean defaultIn, boolean defaultOut,boolean defaultAreFloats) { - if(defaultAreFloats){ - bParamsAreFloats[hatchNo] = bParamsDefaultsAreStoredAsFloats; + public void setToDefaults(boolean defaultIn, boolean defaultOut,boolean defaultConfigureAreFloats) { + if(defaultConfigureAreFloats){ + if(bParamsDefaultsAreStoredAsFloats){ + bParamsAreFloats|= B[hatchNo]; + }else { + bParamsAreFloats&=~B[hatchNo]; + } } if(defaultIn){ for(int in=0;in<2;in++){ if(this.parameterIn[in]!=null){ this.parameterIn[in].setDefault(); }else { - if (bParamsAreFloats[hatchNo]) { + if ((bParamsAreFloats& B[hatchNo])!=0) { iParamsIn[hatchNo] = ZERO_FLOAT; iParamsIn[hatchNo + 10] = ZERO_FLOAT; } else { @@ -134,7 +151,7 @@ public class Parameters { if(this.parameterOut[out]!=null){ this.parameterOut[out].setDefault(); }else { - if (bParamsAreFloats[hatchNo]) { + if ((bParamsAreFloats& B[hatchNo])!=0) { iParamsIn[hatchNo] = ZERO_FLOAT; iParamsIn[hatchNo + 10] = ZERO_FLOAT; } else { @@ -176,11 +193,11 @@ public class Parameters { } public double get(){ - return bParamsAreFloats[hatchNo]?Float.intBitsToFloat(iParamsOut[id]):iParamsOut[id]; + return (bParamsAreFloats& B[hatchNo])!=0?Float.intBitsToFloat(iParamsOut[id]):iParamsOut[id]; } public void set(double value){ - if(bParamsAreFloats[hatchNo]) { + if((bParamsAreFloats& B[hatchNo])!=0) { iParamsOut[id]=Float.floatToIntBits((float) value); }else{ iParamsOut[id]=(int)value; @@ -229,7 +246,7 @@ public class Parameters { } private void setDefault() { - if(bParamsAreFloats[hatchNo]) { + if((bParamsAreFloats& B[hatchNo])!=0) { iParamsIn[id]=Float.floatToIntBits((float) defaultValue); }else{ iParamsIn[id]=(int)defaultValue; @@ -237,7 +254,7 @@ public class Parameters { } public double get(){ - return bParamsAreFloats[hatchNo]?Float.intBitsToFloat(iParamsIn[id]):iParamsIn[id]; + return (bParamsAreFloats& B[hatchNo])!=0?Float.intBitsToFloat(iParamsIn[id]):iParamsIn[id]; } public void updateStatus(){ -- cgit From 187984ddedb32973ec4fc09e86749a3806b2072a Mon Sep 17 00:00:00 2001 From: Dream-Master Date: Sat, 23 Feb 2019 11:54:26 +0100 Subject: fix gradle --- build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.properties b/build.properties index 460c548681..ebb04958db 100644 --- a/build.properties +++ b/build.properties @@ -1,5 +1,5 @@ minecraft.version=1.7.10 -forge.version=1.7.10-10.13.4.1614-1.7.10 +forge.version=1.7.10-10.13.4.1614 tectech.version=3.6.8 ic2.version=2.2.790-experimental -- cgit From 3a7797d2734688caba1a71a24279cceba8a67421 Mon Sep 17 00:00:00 2001 From: Dream-Master Date: Sat, 23 Feb 2019 11:55:58 +0100 Subject: update gt version --- build.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.properties b/build.properties index ebb04958db..410117c4a8 100644 --- a/build.properties +++ b/build.properties @@ -6,8 +6,8 @@ ic2.version=2.2.790-experimental codechickenlib.version=1.1.3.140 codechickencore.version=1.0.7.47 nei.version=1.0.5.120 -gregtech.jenkinsbuild=227 -gregtech.version=5.09.33.07 +gregtech.jenkinsbuild=241 +gregtech.version=5.09.33.10 cofhcore.version=[1.7.10]3.1.4-329-dev cofhlib.version=[1.7.10]1.0.3-175-dev -- cgit From 49bbc0df0fed717b95c3e5232e7cee1b6406d90a Mon Sep 17 00:00:00 2001 From: Dream-Master Date: Sat, 23 Feb 2019 12:06:34 +0100 Subject: fix gradle again --- build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.properties b/build.properties index 410117c4a8..6a9a79e5d7 100644 --- a/build.properties +++ b/build.properties @@ -1,5 +1,5 @@ minecraft.version=1.7.10 -forge.version=1.7.10-10.13.4.1614 +forge.version=1.7.10-10.13.4.1614-1.7.10 tectech.version=3.6.8 ic2.version=2.2.790-experimental -- cgit From 615fc4e2495ca8bae3fcd45c54e5fe8cfc2e3681 Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 10 Mar 2019 14:25:39 +0100 Subject: storing work --- src/main/java/com/github/technus/tectech/Util.java | 139 +++++++-- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 6 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 6 +- .../tectech/loader/recipe/BloodyRecipeLoader.java | 52 ++-- .../hatch/GT_MetaTileEntity_Hatch_Param.java | 62 ++-- .../hatch/gui/GT_Container_Param.java | 74 ++--- .../hatch/gui/GT_Container_ParamAdv.java | 108 +++---- .../hatch/gui/GT_GUIContainer_Param.java | 15 +- .../hatch/gui/GT_GUIContainer_ParamAdv.java | 26 +- .../multi/GT_MetaTileEntity_EM_annihilation.java | 3 +- .../multi/GT_MetaTileEntity_EM_bhg.java | 3 +- .../multi/GT_MetaTileEntity_EM_collider.java | 36 ++- .../multi/GT_MetaTileEntity_EM_computer.java | 45 ++- .../multi/GT_MetaTileEntity_EM_crafting.java | 3 +- .../multi/GT_MetaTileEntity_EM_dataBank.java | 15 +- .../multi/GT_MetaTileEntity_EM_decay.java | 27 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 6 +- .../multi/GT_MetaTileEntity_EM_infuser.java | 3 +- .../multi/GT_MetaTileEntity_EM_junction.java | 108 ++++--- .../multi/GT_MetaTileEntity_EM_quantizer.java | 6 +- .../multi/GT_MetaTileEntity_EM_research.java | 14 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 57 +++- .../multi/GT_MetaTileEntity_EM_stabilizer.java | 3 +- .../multi/GT_MetaTileEntity_EM_switch.java | 83 ++--- .../multi/GT_MetaTileEntity_EM_transformer.java | 3 +- .../multi/GT_MetaTileEntity_EM_wormhole.java | 3 +- .../multi/GT_MetaTileEntity_TM_microwave.java | 125 +++----- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 15 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 183 ++++------- .../metaTileEntity/multi/base/HatchAdder.java | 8 + .../thing/metaTileEntity/multi/base/LedStatus.java | 19 +- .../metaTileEntity/multi/base/NameFunction.java | 8 + .../metaTileEntity/multi/base/Parameters.java | 303 ++++++++++-------- .../metaTileEntity/multi/base/StatusFunction.java | 8 + .../multi/em_machine/Behaviour_Centrifuge.java | 112 ++++--- .../multi/em_machine/Behaviour_Electrolyzer.java | 12 +- .../Behaviour_ElectromagneticSeparator.java | 12 +- .../multi/em_machine/Behaviour_PrecisionLaser.java | 12 +- .../multi/em_machine/Behaviour_Recycler.java | 12 +- .../multi/em_machine/Behaviour_Scanner.java | 12 +- .../em_machine/GT_MetaTileEntity_EM_machine.java | 342 ++++++++------------- .../single/GT_MetaTileEntity_DataReader.java | 10 +- .../single/gui/GT_GUIContainer_DataReader.java | 6 +- 43 files changed, 1052 insertions(+), 1053 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/HatchAdder.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/NameFunction.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/StatusFunction.java diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java index 1fd479939c..05e7fd6336 100644 --- a/src/main/java/com/github/technus/tectech/Util.java +++ b/src/main/java/com/github/technus/tectech/Util.java @@ -2,6 +2,7 @@ package com.github.technus.tectech; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.IFrontRotation; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -13,6 +14,8 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.init.Items; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -22,8 +25,6 @@ import net.minecraftforge.fluids.FluidStack; import org.apache.commons.lang3.StringUtils; import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; @@ -71,6 +72,22 @@ public final class Util { return result.toString(); } + public static String longBitsToShortString(long number) { + StringBuilder result = new StringBuilder(16); + + for (int i = 63; i >= 0; i--) { + int mask = 1 << i; + result.append((number & mask) != 0 ? ":" : "."); + + if (i % 8 == 0) { + result.append('|'); + } + } + result.replace(result.length() - 1, result.length(), ""); + + return result.toString(); + } + //region junk /* //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller @@ -360,14 +377,14 @@ public final class Util { */ //endregion + //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller //This only checks for REGULAR BLOCKS! public static boolean StructureCheckerExtreme( String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks Block[] blockType,//use numbers 0-9 for casing types byte[] blockMeta,//use numbers 0-9 for casing types - Method adder, - String[] addingMethods, + HatchAdder[] addingMethods, short[] casingTextures, Block[] blockTypeFallback,//use numbers 0-9 for casing types byte[] blockMetaFallback,//use numbers 0-9 for casing types @@ -578,28 +595,22 @@ public final class Util { } return false; } - } else if ((pointer = block - ' ') >= 0) { + } else //noinspection ConstantConditions + if ((pointer = block - ' ') >= 0) { igt = aBaseMetaTileEntity.getIGregTechTileEntity(x, y, z); - try { - if (igt == null || !(boolean) adder.invoke(imt, addingMethods[pointer], igt, casingTextures[pointer])) { - if (world.getBlock(x, y, z) != blockTypeFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-struct-block-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlock(x, y, z).getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); - } - return false; - } - if (world.getBlockMetadata(x, y, z) != blockMetaFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlockMetadata(x, y, z) + ' ' + blockMetaFallback[pointer]); - } - return false; + if (igt == null || !addingMethods[pointer].apply(igt, casingTextures[pointer])) { + if (world.getBlock(x, y, z) != blockTypeFallback[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Fallback-struct-block-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlock(x, y, z).getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); } + return false; } - } catch (InvocationTargetException | IllegalAccessException e) { - if (DEBUG_MODE) { - e.printStackTrace(); + if (world.getBlockMetadata(x, y, z) != blockMetaFallback[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlockMetadata(x, y, z) + ' ' + blockMetaFallback[pointer]); + } + return false; } - return false; } } } @@ -1291,18 +1302,18 @@ public final class Util { return (testedValue & setBits) == setBits; } - public static class TT_ItemStack implements Comparable { + public static class ItemStack_NoNBT implements Comparable { public final Item mItem; public final int mStackSize; public final int mMetaData; - public TT_ItemStack(Item aItem, long aStackSize, long aMetaData) { + public ItemStack_NoNBT(Item aItem, long aStackSize, long aMetaData) { this.mItem = aItem; this.mStackSize = (byte) ((int) aStackSize); this.mMetaData = (short) ((int) aMetaData); } - public TT_ItemStack(ItemStack aStack) { + public ItemStack_NoNBT(ItemStack aStack) { if (aStack == null) { mItem = null; mStackSize = mMetaData = 0; @@ -1314,7 +1325,7 @@ public final class Util { } @Override - public int compareTo(TT_ItemStack o) { + public int compareTo(ItemStack_NoNBT o) { if (mMetaData > o.mMetaData) return 1; if (mMetaData < o.mMetaData) return -1; if (mStackSize > o.mStackSize) return 1; @@ -1329,10 +1340,10 @@ public final class Util { @Override public boolean equals(Object aStack) { return aStack == this || - (aStack instanceof TT_ItemStack && - ((mItem == ((TT_ItemStack) aStack).mItem) || ((TT_ItemStack) aStack).mItem.getUnlocalizedName().equals(this.mItem.getUnlocalizedName())) && - ((TT_ItemStack) aStack).mStackSize == this.mStackSize && - ((TT_ItemStack) aStack).mMetaData == this.mMetaData); + (aStack instanceof ItemStack_NoNBT && + ((mItem == ((ItemStack_NoNBT) aStack).mItem) || ((ItemStack_NoNBT) aStack).mItem.getUnlocalizedName().equals(this.mItem.getUnlocalizedName())) && + ((ItemStack_NoNBT) aStack).mStackSize == this.mStackSize && + ((ItemStack_NoNBT) aStack).mMetaData == this.mMetaData); } @Override @@ -1346,7 +1357,7 @@ public final class Util { } } - public static void setTier(int tier,Object me){ + public static void setTier(int tier,GT_MetaTileEntity_TieredMachineBlock me){ try{ Field field=GT_MetaTileEntity_TieredMachineBlock.class.getField("mTier"); field.setAccessible(true); @@ -1355,4 +1366,70 @@ public final class Util { e.printStackTrace(); } } + + public static double receiveDouble(double previousValue, int startIndex, int index, int value){ + return Double.longBitsToDouble(receiveLong(Double.doubleToLongBits(previousValue),startIndex,index,value)); + } + + public static long receiveLong(long previousValue, int startIndex, int index, int value){ + value &=0xFFFF; + switch (index-startIndex){ + case 0: + previousValue&= 0xFFFF_FFFF_FFFF_0000L; + previousValue|=value; + break; + case 1: + previousValue&=0xFFFF_FFFF_0000_FFFFL; + previousValue|=value<<16; + break; + case 2: + previousValue&=0xFFFF_0000_FFFF_FFFFL; + previousValue|=(long)value<<32; + break; + case 3: + previousValue&=0x0000_FFFF_FFFF_FFFFL; + previousValue|=(long)value<<48; + break; + } + return previousValue; + } + + public static void sendDouble(double value,Container container, ICrafting crafter,int startIndex){ + sendLong(Double.doubleToLongBits(value),container,crafter,startIndex); + } + + public static void sendLong(long value,Container container, ICrafting crafter,int startIndex){ + crafter.sendProgressBarUpdate(container, startIndex++, (int)(value & 0xFFFFL)); + crafter.sendProgressBarUpdate(container, startIndex++, (int)((value & 0xFFFF0000L)>>>16)); + crafter.sendProgressBarUpdate(container, startIndex++, (int)((value & 0xFFFF00000000L)>>>32)); + crafter.sendProgressBarUpdate(container, startIndex, (int)((value & 0xFFFF000000000000L)>>>48)); + } + + public static float receiveFloat(float previousValue, int startIndex, int index, int value){ + return Float.intBitsToFloat(receiveInteger(Float.floatToIntBits(previousValue),startIndex,index,value)); + } + + public static int receiveInteger(int previousValue, int startIndex, int index, int value){ + value &=0xFFFF; + switch (index-startIndex){ + case 0: + previousValue&= 0xFFFF_0000; + previousValue|=value; + break; + case 1: + previousValue&=0x0000_FFFF; + previousValue|=value<<16; + break; + } + return previousValue; + } + + public static void sendFloat(float value,Container container, ICrafting crafter,int startIndex){ + sendInteger(Float.floatToIntBits(value),container,crafter,startIndex); + } + + public static void sendInteger(int value,Container container, ICrafting crafter,int startIndex){ + crafter.sendProgressBarUpdate(container, startIndex++, (int)(value & 0xFFFFL)); + crafter.sendProgressBarUpdate(container, startIndex, (value & 0xFFFF0000)>>>16); + } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index 6a9ef392cd..96230201ba 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -10,6 +10,7 @@ import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -45,7 +46,10 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ }; private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{0,0,4,8}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalInputToMachineList", "addElementalMufflerToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{ + this::addClassicToMachineList, + this::addElementalInputToMachineList, + this::addElementalMufflerToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 0fbf3aaa13..ba97367cd7 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -10,6 +10,7 @@ import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -45,7 +46,10 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu }; private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{0,4,0,8}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalOutputToMachineList", "addElementalMufflerToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{ + this::addClassicToMachineList, + this::addElementalOutputToMachineList, + this::addElementalMufflerToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset+4, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java index 6e3a95aaad..fc2cc455de 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java @@ -570,38 +570,38 @@ public class BloodyRecipeLoader implements Runnable { } private void register_machine_EM_behaviours(){ - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(6),ItemList.Machine_IV_Centrifuge.get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(6),ItemList.Machine_IV_Centrifuge.get(1)); try { - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(7),ItemList.valueOf("Machine_LuV_Centrifuge").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(8),ItemList.valueOf("Machine_ZPM_Centrifuge").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(9),ItemList.valueOf("Machine_UV_Centrifuge").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(10),ItemList.valueOf("Machine_UV_Centrifuge").get(4)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(11),ItemList.valueOf("Machine_UV_Centrifuge").get(16)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(12),ItemList.valueOf("Machine_UV_Centrifuge").get(64)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(7),ItemList.valueOf("Machine_LuV_Centrifuge").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(8),ItemList.valueOf("Machine_ZPM_Centrifuge").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(9),ItemList.valueOf("Machine_UV_Centrifuge").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(10),ItemList.valueOf("Machine_UV_Centrifuge").get(4)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(11),ItemList.valueOf("Machine_UV_Centrifuge").get(16)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(12),ItemList.valueOf("Machine_UV_Centrifuge").get(64)); }catch (IllegalArgumentException|NullPointerException e){ - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(7),ItemList.Machine_IV_Centrifuge.get(2)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(8),ItemList.Machine_IV_Centrifuge.get(4)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(9),ItemList.Machine_IV_Centrifuge.get(8)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(10),ItemList.Machine_IV_Centrifuge.get(16)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(11),ItemList.Machine_IV_Centrifuge.get(32)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(12),ItemList.Machine_IV_Centrifuge.get(64)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(7),ItemList.Machine_IV_Centrifuge.get(2)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(8),ItemList.Machine_IV_Centrifuge.get(4)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(9),ItemList.Machine_IV_Centrifuge.get(8)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(10),ItemList.Machine_IV_Centrifuge.get(16)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(11),ItemList.Machine_IV_Centrifuge.get(32)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(12),ItemList.Machine_IV_Centrifuge.get(64)); } - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(6),ItemList.Machine_IV_ElectromagneticSeparator.get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(6),ItemList.Machine_IV_ElectromagneticSeparator.get(1)); try { - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(7),ItemList.valueOf("Machine_LuV_ElectromagneticSeparator").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(8),ItemList.valueOf("Machine_ZPM_ElectromagneticSeparator").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(9),ItemList.valueOf("Machine_UV_ElectromagneticSeparator").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(10),ItemList.valueOf("Machine_UV_ElectromagneticSeparator").get(4)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(11),ItemList.valueOf("Machine_UV_ElectromagneticSeparator").get(16)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(12),ItemList.valueOf("Machine_UV_ElectromagneticSeparator").get(64)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(7),ItemList.valueOf("Machine_LuV_ElectromagneticSeparator").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(8),ItemList.valueOf("Machine_ZPM_ElectromagneticSeparator").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(9),ItemList.valueOf("Machine_UV_ElectromagneticSeparator").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(10),ItemList.valueOf("Machine_UV_ElectromagneticSeparator").get(4)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(11),ItemList.valueOf("Machine_UV_ElectromagneticSeparator").get(16)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(12),ItemList.valueOf("Machine_UV_ElectromagneticSeparator").get(64)); }catch (IllegalArgumentException|NullPointerException e){ - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(7),ItemList.Machine_IV_ElectromagneticSeparator.get(2)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(8),ItemList.Machine_IV_ElectromagneticSeparator.get(4)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(9),ItemList.Machine_IV_ElectromagneticSeparator.get(8)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(10),ItemList.Machine_IV_ElectromagneticSeparator.get(16)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(11),ItemList.Machine_IV_ElectromagneticSeparator.get(32)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(12),ItemList.Machine_IV_ElectromagneticSeparator.get(64)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(7),ItemList.Machine_IV_ElectromagneticSeparator.get(2)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(8),ItemList.Machine_IV_ElectromagneticSeparator.get(4)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(9),ItemList.Machine_IV_ElectromagneticSeparator.get(8)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(10),ItemList.Machine_IV_ElectromagneticSeparator.get(16)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(11),ItemList.Machine_IV_ElectromagneticSeparator.get(32)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(12),ItemList.Machine_IV_ElectromagneticSeparator.get(64)); } } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java index 2a2812368b..aa92eb777e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java @@ -26,13 +26,12 @@ import net.minecraftforge.fluids.FluidStack; * Created by danie_000 on 15.12.2016. */ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { - private boolean usesFloat = false; public int pointer = 0; public int param = -1; - public int value0i = 0; - public int value1i = 0; - public int input0i = 0; - public int input1i = 0; + public double value0i = 0; + public double value1i = 0; + public double input0i = 0; + public double input1i = 0; private static Textures.BlockIcons.CustomIcon ScreenON; private static Textures.BlockIcons.CustomIcon ScreenOFF; @@ -105,9 +104,6 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { @Override public String[] getInfoData() { - if(mTier>7) { - return new String[]{"Parametrizer ID: " + EnumChatFormatting.GREEN + param, "Value 0I: " + EnumChatFormatting.AQUA + value0i, "Value 0FB: " + EnumChatFormatting.AQUA + Float.intBitsToFloat(value0i) + ' ' + Util.intBitsToShortString(value0i), "Value 1I: " + EnumChatFormatting.BLUE + value1i, "Value 1FB: " + EnumChatFormatting.BLUE + Float.intBitsToFloat(value1i) + ' ' + Util.intBitsToShortString(value1i), "Input 0I: " + EnumChatFormatting.GOLD + input0i, "Input 0FB: " + EnumChatFormatting.GOLD + Float.intBitsToFloat(input0i) + ' ' + Util.intBitsToShortString(input0i), "Input 1I: " + EnumChatFormatting.YELLOW + input1i, "Input 1FB: " + EnumChatFormatting.YELLOW + Float.intBitsToFloat(input1i) + ' ' + Util.intBitsToShortString(input1i),}; - } return new String[]{ "Parametrizer ID: " + EnumChatFormatting.GREEN + param, "Value 0I: " + EnumChatFormatting.AQUA + value0i, @@ -135,24 +131,41 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - aNBT.setBoolean("eFloats", usesFloat); aNBT.setInteger("ePointer", pointer); - aNBT.setInteger("eValue0i", value0i); - aNBT.setInteger("eValue1i", value1i); - aNBT.setInteger("eInput0i", value0i); - aNBT.setInteger("eInput1i", value1i); + aNBT.setDouble("eDValue0i", value0i); + aNBT.setDouble("eDValue1i", value1i); + aNBT.setDouble("eDInput0i", input0i); + aNBT.setDouble("eDInput1i", input1i); aNBT.setInteger("eParam", param); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - usesFloat = aNBT.getBoolean("eFloats"); pointer = aNBT.getInteger("ePointer"); - value0i=aNBT.getInteger("eValue0i"); - value1i=aNBT.getInteger("eValue1i"); - value0i=aNBT.getInteger("eInput0i"); - value1i=aNBT.getInteger("eInput1i"); + if(aNBT.hasKey("eFloats") || + aNBT.hasKey("eValue0i") || + aNBT.hasKey("eValue1i") || + aNBT.hasKey("eInput0i") || + aNBT.hasKey("eInput1i")){ + boolean usesFloat = aNBT.getBoolean("eFloats"); + if(usesFloat){ + value0i=Float.intBitsToFloat(aNBT.getInteger("eValue0i")); + value1i=Float.intBitsToFloat(aNBT.getInteger("eValue1i")); + input0i=Float.intBitsToFloat(aNBT.getInteger("eInput0i")); + input1i=Float.intBitsToFloat(aNBT.getInteger("eInput1i")); + }else { + value0i=aNBT.getInteger("eValue0i"); + value1i=aNBT.getInteger("eValue1i"); + input0i=aNBT.getInteger("eInput0i"); + input1i=aNBT.getInteger("eInput1i"); + } + }else{ + value0i=aNBT.getDouble("eDValue0i"); + value1i=aNBT.getDouble("eDValue1i"); + input0i=aNBT.getDouble("eDInput0i"); + input1i=aNBT.getDouble("eDInput1i"); + } param = aNBT.getInteger("eParam"); } @@ -198,17 +211,4 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "E=mine*craft\u00b2" }; } - - public boolean isUsingFloats() { - return mTier > 7 && usesFloat; - } - - //returns - succeded - public boolean setUsingFloats(boolean value){ - if(mTier>7){ - usesFloat=value; - return true; - } - return !value; - } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java index fec3be6e20..db0c2d501f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.Util; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -15,10 +16,10 @@ import net.minecraft.item.ItemStack; public class GT_Container_Param extends GT_ContainerMetaTile_Machine { public int param = 0; - public int value0f = 0; - public int value1f = 0; - public int input0f = 0; - public int input1f = 0; + public double value0f = 0; + public double value1f = 0; + public double input0f = 0; + public double input1f = 0; public GT_Container_Param(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { super(aInventoryPlayer, aTileEntity); @@ -67,8 +68,8 @@ public class GT_Container_Param extends GT_ContainerMetaTile_Machine { paramH.value1i -= aShifthold == 1 ? 4096 : 256; break; case 3: - paramH.value0i >>= aShifthold == 1 ? 16 : 4; - paramH.value1i >>= aShifthold == 1 ? 16 : 4; + paramH.value0i /= aShifthold == 1 ? 4096 : 256; + paramH.value1i /= aShifthold == 1 ? 4096 : 256; break; case 4: paramH.param -= aShifthold == 1 ? 2 : 1; @@ -80,8 +81,8 @@ public class GT_Container_Param extends GT_ContainerMetaTile_Machine { paramH.value1i -= aShifthold == 1 ? 16 : 1; break; case 7: - paramH.value0i >>= aShifthold == 1 ? 2 : 1; - paramH.value1i >>= aShifthold == 1 ? 2 : 1; + paramH.value0i /= aShifthold == 1 ? 16 : 2; + paramH.value1i /= aShifthold == 1 ? 16 : 2; break; case 8: paramH.param += aShifthold == 1 ? 16 : 4; @@ -93,8 +94,8 @@ public class GT_Container_Param extends GT_ContainerMetaTile_Machine { paramH.value1i += aShifthold == 1 ? 4096 : 256; break; case 11: - paramH.value0i <<= aShifthold == 1 ? 16 : 4; - paramH.value1i <<= aShifthold == 1 ? 16 : 4; + paramH.value0i *= aShifthold == 1 ? 4096 : 256; + paramH.value1i *= aShifthold == 1 ? 4096 : 256; break; case 12: paramH.param += aShifthold == 1 ? 2 : 1; @@ -106,8 +107,8 @@ public class GT_Container_Param extends GT_ContainerMetaTile_Machine { paramH.value1i += aShifthold == 1 ? 16 : 1; break; case 15: - paramH.value0i <<= aShifthold == 1 ? 2 : 1; - paramH.value1i <<= aShifthold == 1 ? 2 : 1; + paramH.value0i *= aShifthold == 1 ? 16 : 2; + paramH.value1i *= aShifthold == 1 ? 16 : 2; break; default: doStuff = false; @@ -139,16 +140,11 @@ public class GT_Container_Param extends GT_ContainerMetaTile_Machine { for (Object crafter : crafters) { ICrafting var1 = (ICrafting) crafter; - var1.sendProgressBarUpdate(this, 100, param & 0xFFFF); - var1.sendProgressBarUpdate(this, 101, param >>> 16); - var1.sendProgressBarUpdate(this, 102, value0f & 0xFFFF); - var1.sendProgressBarUpdate(this, 103, value0f >>> 16); - var1.sendProgressBarUpdate(this, 104, value1f & 0xFFFF); - var1.sendProgressBarUpdate(this, 105, value1f >>> 16); - var1.sendProgressBarUpdate(this, 106, input0f & 0xFFFF); - var1.sendProgressBarUpdate(this, 107, input0f >>> 16); - var1.sendProgressBarUpdate(this, 108, input1f & 0xFFFF); - var1.sendProgressBarUpdate(this, 109, input1f >>> 16); + Util.sendInteger(param,this,var1,100); + Util.sendDouble(value0f,this,var1,102); + Util.sendDouble(value1f,this,var1, 106); + Util.sendDouble(input0f,this,var1, 110); + Util.sendDouble(input1f,this,var1, 114); } } @@ -158,34 +154,32 @@ public class GT_Container_Param extends GT_ContainerMetaTile_Machine { super.updateProgressBar(par1, par2); switch (par1) { case 100: - param = param & 0xFFFF0000 | par2; - return; case 101: - param = param & 0xFFFF | par2 << 16; + param=Util.receiveInteger(param,100,par1,par2); return; case 102: - value0f = value0f & 0xFFFF0000 | par2; - break; case 103: - value0f = value0f & 0xFFFF | par2 << 16; - break; case 104: - value1f = value1f & 0xFFFF0000 | par2; - break; case 105: - value1f = value1f & 0xFFFF | par2 << 16; - break; + value0f=Util.receiveDouble(value0f,102,par1,par2); + return; case 106: - input0f = input0f & 0xFFFF0000 | par2; - break; case 107: - input0f = input0f & 0xFFFF | par2 << 16; - break; case 108: - input1f = input1f & 0xFFFF0000 | par2; - return; case 109: - input1f = input1f & 0xFFFF | par2 << 16; + value1f=Util.receiveDouble(value1f,106,par1,par2); + return; + case 110: + case 111: + case 112: + case 113: + input0f=Util.receiveDouble(input0f,110,par1,par2); + return; + case 114: + case 115: + case 116: + case 117: + input1f=Util.receiveDouble(input1f,114,par1,par2); return; default: } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java index 90d8a26d1c..6b1e4f68cd 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.Util; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -14,13 +15,12 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { - public boolean usesFloats = false; public int pointer=0; public int param = 0; - public int value1f = 0; - public int value0f = 0; - public int input0f = 0; - public int input1f = 0; + public double value1f = 0; + public double value0f = 0; + public double input0f = 0; + public double input1f = 0; public GT_Container_ParamAdv(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { super(aInventoryPlayer, aTileEntity); @@ -60,7 +60,6 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { GT_MetaTileEntity_Hatch_Param paramH = (GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity(); int columnPointer=paramH.pointer &0xff; boolean secondRow=(paramH.pointer &0x0100)!=0; - boolean showInts=!paramH.isUsingFloats(); switch (aSlotIndex) { case 0: paramH.param -= aShifthold == 1 ? 16 : 4; @@ -82,15 +81,19 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { case 3: if (aShifthold == 1) { if (secondRow) { - paramH.value1i = 0xFFFFFFFF; + paramH.value1i = Double.longBitsToDouble(0xFFFF_FFFF_FFFF_FFFFL); } else { - paramH.value0i = 0xFFFFFFFF; + paramH.value0i = Double.longBitsToDouble(0xFFFF_FFFF_FFFF_FFFFL); } } else { if (secondRow) { - paramH.value1i |= 1 << columnPointer; + long temp=Double.doubleToLongBits(paramH.value1i); + temp |= 1 << columnPointer; + paramH.value1i=Double.longBitsToDouble(temp); } else { - paramH.value0i |= 1 << columnPointer; + long temp=Double.doubleToLongBits(paramH.value0i); + temp |= 1 << columnPointer; + paramH.value0i=Double.longBitsToDouble(temp); } } break; @@ -114,15 +117,19 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { case 7: if (aShifthold == 1) { if (secondRow) { - paramH.value1i = 0; + paramH.value1i = Double.longBitsToDouble(0); } else { - paramH.value0i = 0; + paramH.value0i = Double.longBitsToDouble(0); } } else { if (secondRow) { - paramH.value1i &= ~(1 << columnPointer); + long temp=Double.doubleToLongBits(paramH.value1i); + temp &= ~(1 << columnPointer); + paramH.value1i=Double.longBitsToDouble(temp); } else { - paramH.value0i &= ~(1 << columnPointer); + long temp=Double.doubleToLongBits(paramH.value0i); + temp &= ~(1 << columnPointer); + paramH.value0i=Double.longBitsToDouble(temp); } } break; @@ -144,7 +151,8 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { } break; case 11: - showInts ^= true; + paramH.value0i=paramH.input0i; + paramH.value1i=paramH.input1i; break; case 12: paramH.param += aShifthold == 1 ? 2 : 1; @@ -166,15 +174,19 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { case 15: if (aShifthold == 1) { if (secondRow) { - paramH.value1i ^= 0xFFFFFFFF; + paramH.value1i = Double.longBitsToDouble(~Double.doubleToLongBits(paramH.value1i)); } else { - paramH.value0i ^= 0xFFFFFFFF; + paramH.value0i = Double.longBitsToDouble(~Double.doubleToLongBits(paramH.value1i)); } } else { if (secondRow) { - paramH.value1i ^= 1 << columnPointer; + long temp=Double.doubleToLongBits(paramH.value1i); + temp ^= 1 << columnPointer; + paramH.value1i=Double.longBitsToDouble(temp); } else { - paramH.value0i ^= 1 << columnPointer; + long temp=Double.doubleToLongBits(paramH.value0i); + temp ^= 1 << columnPointer; + paramH.value0i=Double.longBitsToDouble(temp); } } break; @@ -190,7 +202,6 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { columnPointer = 0; } paramH.pointer=secondRow?columnPointer+0x100:columnPointer; - paramH.setUsingFloats(!showInts); if (paramH.param > 9) { paramH.param = 9; } else if (paramH.param < -1) { @@ -213,22 +224,15 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { input0f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).input0i; input1f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).input1i; pointer = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).pointer; - usesFloats =((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).isUsingFloats(); for (Object crafter : crafters) { ICrafting var1 = (ICrafting) crafter; - var1.sendProgressBarUpdate(this, 100, param & 0xFFFF); - var1.sendProgressBarUpdate(this, 101, param >>> 16); - var1.sendProgressBarUpdate(this, 102, value0f & 0xFFFF); - var1.sendProgressBarUpdate(this, 103, value0f >>> 16); - var1.sendProgressBarUpdate(this, 104, value1f & 0xFFFF); - var1.sendProgressBarUpdate(this, 105, value1f >>> 16); - var1.sendProgressBarUpdate(this, 106, input0f & 0xFFFF); - var1.sendProgressBarUpdate(this, 107, input0f >>> 16); - var1.sendProgressBarUpdate(this, 108, input1f & 0xFFFF); - var1.sendProgressBarUpdate(this, 109, input1f >>> 16); - var1.sendProgressBarUpdate(this, 110, pointer); - var1.sendProgressBarUpdate(this, 111, usesFloats ? 1 : 0); + Util.sendInteger(param,this,var1,100); + Util.sendDouble(value0f,this,var1,102); + Util.sendDouble(value1f,this,var1, 106); + Util.sendDouble(input0f,this,var1, 110); + Util.sendDouble(input1f,this,var1, 114); + Util.sendInteger(pointer,this,var1,118); } } @@ -238,39 +242,37 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { super.updateProgressBar(par1, par2); switch (par1) { case 100: - param = param & 0xFFFF0000 | par2; - return; case 101: - param = param & 0xFFFF | par2 << 16; + param=Util.receiveInteger(param,100,par1,par2); return; case 102: - value0f = value0f & 0xFFFF0000 | par2; - break; case 103: - value0f = value0f & 0xFFFF | par2 << 16; - break; case 104: - value1f = value1f & 0xFFFF0000 | par2; - break; case 105: - value1f = value1f & 0xFFFF | par2 << 16; - break; + value0f=Util.receiveDouble(value0f,102,par1,par2); + return; case 106: - input0f = input0f & 0xFFFF0000 | par2; - break; case 107: - input0f = input0f & 0xFFFF | par2 << 16; - break; case 108: - input1f = input1f & 0xFFFF0000 | par2; - return; case 109: - input1f = input1f & 0xFFFF | par2 << 16; + value1f=Util.receiveDouble(value1f,106,par1,par2); return; case 110: - pointer = par2 & 0xFFFF; case 111: - usesFloats = par2 != 0; + case 112: + case 113: + input0f=Util.receiveDouble(input0f,110,par1,par2); + return; + case 114: + case 115: + case 116: + case 117: + input1f=Util.receiveDouble(input1f,114,par1,par2); + return; + case 118: + case 119: + pointer=Util.receiveInteger(pointer,118,par1,par2); + return; default: } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java index d9502333d8..9b8f818da8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java @@ -4,6 +4,7 @@ import com.github.technus.tectech.Util; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; +import org.lwjgl.opengl.GL11; import java.util.Locale; @@ -20,12 +21,14 @@ public class GT_GUIContainer_Param extends GT_GUIContainerMetaTile_Machine { if (mContainer != null) { proxy.renderUnicodeString("Parameters: " + ((GT_Container_Param) mContainer).param, 46, 7, 167, 0xffffff); Locale locale= Locale.getDefault(); - proxy.renderUnicodeString("\u24EA\u2b07" + String.format(locale, "%+d", ((GT_Container_Param) mContainer).input0f), 46, 16, 167, 0x22ddff); - proxy.renderUnicodeString("\u2460\u2b07" + String.format(locale, "%+d", ((GT_Container_Param) mContainer).input1f), 46, 24, 167, 0x00ffff); - proxy.renderUnicodeString("\u24EA\u2b06" + String.format(locale, "%+d", ((GT_Container_Param) mContainer).value0f), 46, 33, 167, 0x00bbff); - proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+d", ((GT_Container_Param) mContainer).value1f), 46, 41, 167, 0x0077ff); - proxy.renderUnicodeString("\u24EA\u2b06" + Util.intBitsToShortString(((GT_Container_Param) mContainer).value0f), 46, 50, 167, 0x00bbff); - proxy.renderUnicodeString("\u2460\u2b06" + Util.intBitsToShortString(((GT_Container_Param) mContainer).value1f), 46, 58, 167, 0x0077ff); + proxy.renderUnicodeString("\u24EA\u2b07" + String.format(locale, "%+.5E", ((GT_Container_Param) mContainer).input0f), 46, 16, 167, 0x22ddff); + proxy.renderUnicodeString("\u2460\u2b07" + String.format(locale, "%+.5E", ((GT_Container_Param) mContainer).input1f), 46, 24, 167, 0x00ffff); + proxy.renderUnicodeString("\u24EA\u2b06" + String.format(locale, "%+.5E", ((GT_Container_Param) mContainer).value0f), 46, 33, 167, 0x00bbff); + proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+.5E", ((GT_Container_Param) mContainer).value1f), 46, 41, 167, 0x0077ff); + GL11.glScalef(.5f,.5f,.5f); + proxy.renderUnicodeString("\u24EA\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_Param) mContainer).value0f)), 46*2, 50*2, 167*2, 0x00bbff); + proxy.renderUnicodeString("\u2460\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_Param) mContainer).value1f)), 46*2, 58*2, 167*2, 0x0077ff); + GL11.glScalef(1,1,1); } else { proxy.renderUnicodeString("Parameters", 46, 7, 167, 0xffffff); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java index 245ec91b20..541c8323b1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java @@ -4,6 +4,7 @@ import com.github.technus.tectech.Util; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; +import org.lwjgl.opengl.GL11; import java.util.Locale; @@ -12,27 +13,22 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_ParamAdv extends GT_GUIContainerMetaTile_Machine { public GT_GUIContainer_ParamAdv(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(new GT_Container_ParamAdv(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "ParametrizerAdv.png"); + super(new GT_Container_Param(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "ParametrizerAdv.png"); } @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { if (mContainer != null) { proxy.renderUnicodeString("Parameters X: " + ((GT_Container_ParamAdv) mContainer).param, 46, 7, 167, 0xffffff); - Locale locale= Locale.getDefault(); - if (((GT_Container_ParamAdv) mContainer).usesFloats) { - proxy.renderUnicodeString("\u24EA\u2b07" + String.format(locale, "%+.5E", Float.intBitsToFloat(((GT_Container_ParamAdv) mContainer).input0f)), 46, 16, 167, 0x22ddff); - proxy.renderUnicodeString("\u2460\u2b07" + String.format(locale, "%+.5E", Float.intBitsToFloat(((GT_Container_ParamAdv) mContainer).input1f)), 46, 24, 167, 0x00ffff); - proxy.renderUnicodeString("\u24EA\u2b06" + String.format(locale, "%+.5E", Float.intBitsToFloat(((GT_Container_ParamAdv) mContainer).value0f)), 46, 33, 167, 0x00bbff); - proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+.5E", Float.intBitsToFloat(((GT_Container_ParamAdv) mContainer).value1f)), 46, 41, 167, 0x0077ff); - } else { - proxy.renderUnicodeString("\u24EA\u2b07" + String.format(locale, "%+d", ((GT_Container_ParamAdv) mContainer).input0f), 46, 16, 167, 0x22ddff); - proxy.renderUnicodeString("\u2460\u2b07" + String.format(locale, "%+d", ((GT_Container_ParamAdv) mContainer).input1f), 46, 24, 167, 0x00ffff); - proxy.renderUnicodeString("\u24EA\u2b06" + String.format(locale, "%+d", ((GT_Container_ParamAdv) mContainer).value0f), 46, 33, 167, 0x00bbff); - proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+d", ((GT_Container_ParamAdv) mContainer).value1f), 46, 41, 167, 0x0077ff); - } - proxy.renderUnicodeString("\u24EA\u2b06" + Util.intBitsToShortString(((GT_Container_ParamAdv) mContainer).value0f), 46, 50, 167, 0x00bbff); - proxy.renderUnicodeString("\u2460\u2b06" + Util.intBitsToShortString(((GT_Container_ParamAdv) mContainer).value1f), 46, 58, 167, 0x0077ff); + Locale locale = Locale.getDefault(); + proxy.renderUnicodeString("\u24EA\u2b07" + String.format(locale, "%+.5E", (((GT_Container_ParamAdv) mContainer).input0f)), 46, 16, 167, 0x22ddff); + proxy.renderUnicodeString("\u2460\u2b07" + String.format(locale, "%+.5E", (((GT_Container_ParamAdv) mContainer).input1f)), 46, 24, 167, 0x00ffff); + proxy.renderUnicodeString("\u24EA\u2b06" + String.format(locale, "%+.5E", (((GT_Container_ParamAdv) mContainer).value0f)), 46, 33, 167, 0x00bbff); + proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+.5E", (((GT_Container_ParamAdv) mContainer).value1f)), 46, 41, 167, 0x0077ff); + GL11.glScalef(.5f,.5f,.5f); + proxy.renderUnicodeString("\u24EA\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_ParamAdv) mContainer).value0f)), 46*2, 50*2, 167*2, 0x00bbff); + proxy.renderUnicodeString("\u2460\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_ParamAdv) mContainer).value1f)), 46*2, 58*2, 167*2, 0x0077ff); + GL11.glScalef(1,1,1); proxy.renderUnicodeString("Pointer " + Integer.toHexString(((GT_Container_ParamAdv) mContainer).pointer | 0x10000).substring(1), 46, 66, 167, 0x0033ff); } else { proxy.renderUnicodeString("Parameters X", 46, 7, 167, 0xffffff); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index be9ff21e58..2ee110be4c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -4,6 +4,7 @@ import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -44,7 +45,7 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT ,sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{4, 5, 12, 6, 0, 10}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index 15e9628b7a..7b662814a6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -4,6 +4,7 @@ import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -73,7 +74,7 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E }; private static final Block[] blockType = new Block[]{sBlockCasingsTT,sBlockCasingsTT,sBlockCasingsTT,sBlockCasingsTT,sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{12, 13, 14, 10, 11}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 03404cf652..06f1866826 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -16,8 +16,10 @@ import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -34,7 +36,6 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; -import java.util.function.Function; import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; @@ -273,25 +274,26 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB //region parameters protected Parameters.Group.ParameterIn mode; - private static final Function MODE_STATUS = base_EM->{ + private static final StatusFunction MODE_STATUS = (base_EM, p)->{ if(base_EM.isMaster()){ - if (base_EM.mode.get() == FUSE_MODE || base_EM.mode.get() == COLLIDE_MODE) { + double mode=p.get(); + if (mode == FUSE_MODE || mode == COLLIDE_MODE) { return STATUS_OK; - } else if (base_EM.mode.get() > 1) { + } else if (mode > 1) { return STATUS_TOO_HIGH; - } else if (base_EM.mode.get() < 0) { + } else if (mode < 0) { return STATUS_TOO_LOW; - }else{ - return STATUS_WRONG; } + return STATUS_WRONG; } return STATUS_UNUSED; }; - private static final Function MODE_NAME = base_EM->{ + private static final NameFunction MODE_NAME = (base_EM, p)->{ if(base_EM.isMaster()){ - if(base_EM.mode.get()==FUSE_MODE){ + double mode=p.get(); + if(mode==FUSE_MODE){ return "Mode: Fuse"; - }else if(base_EM.mode.get()==COLLIDE_MODE){ + }else if(mode==COLLIDE_MODE){ return "Mode: Collide"; } return "Mode: Undefined"; @@ -337,7 +339,11 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB }; private static final byte[] blockMeta1 = new byte[]{4, 7, 4, 0, 4, 8}; private static final byte[] blockMeta2 = new byte[]{4, 7, 5, 0, 6, 9}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalInputToMachineList", "addElementalOutputToMachineList", "addElementalMufflerToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{ + this::addClassicToMachineList, + this::addElementalInputToMachineList, + this::addElementalOutputToMachineList, + this::addElementalMufflerToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4, 4, 4}; @@ -361,7 +367,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override protected void parametersInstantiation_EM() { - Parameters.Group hatch_0=parametrization.makeGroup(0,false); + Parameters.Group hatch_0=parametrization.getGroup(0); mode=hatch_0.makeInParameter(0,FUSE_MODE, MODE_NAME, MODE_STATUS); } @@ -476,9 +482,9 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } @Override - public void parametersOutAndStatusesWrite_EM(boolean machineBusy) { + public void parametersStatusesWrite_EM(boolean machineBusy) { if(isMaster()) { - super.parametersOutAndStatusesWrite_EM(machineBusy); + super.parametersStatusesWrite_EM(machineBusy); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java index d12ec0ca64..c2b6589901 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java @@ -10,8 +10,11 @@ import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_H import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -29,11 +32,9 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import java.util.ArrayList; -import java.util.function.Function; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.Util.StructureBuilderExtreme; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -49,17 +50,17 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB //region parameters protected Parameters.Group.ParameterIn overclock,overvolt; protected Parameters.Group.ParameterOut maxCurrentTemp,availableData; - private static final Function OC_NAME = base-> "Overclock ratio"; - private static final Function OV_NAME = base-> "Overvoltage ratio"; - private static final Function MAX_TEMP_NAME = base-> "Current max. heat"; - private static final Function COMPUTE_NAME = base-> "Produced computation"; - private static final Function OC_STATUS= - base->LedStatus.fromLimitsInclusiveOuterBoundary(base.overclock.get(),0,1,1,3); - private static final Function OV_STATUS= - base->LedStatus.fromLimitsInclusiveOuterBoundary(base.overvolt.get(),.7,.8,1.2,2); - private static final Function MAX_TEMP_STATUS= - base->LedStatus.fromLimitsInclusiveOuterBoundary(base.maxCurrentTemp.get(),-10000,0,0,5000); - private static final Function COMPUTE_STATUS=base->{ + private static final NameFunction OC_NAME = (base, p)-> "Overclock ratio"; + private static final NameFunction OV_NAME = (base,p)-> "Overvoltage ratio"; + private static final NameFunction MAX_TEMP_NAME = (base,p)-> "Current max. heat"; + private static final NameFunction COMPUTE_NAME = (base,p)-> "Produced computation"; + private static final StatusFunction OC_STATUS= + (base,p)->LedStatus.fromLimitsInclusiveOuterBoundary(p.get(),0,1,1,3); + private static final StatusFunction OV_STATUS= + (base,p)->LedStatus.fromLimitsInclusiveOuterBoundary(p.get(),.7,.8,1.2,2); + private static final StatusFunction MAX_TEMP_STATUS= + (base,p)->LedStatus.fromLimitsInclusiveOuterBoundary(p.get(),-10000,0,0,5000); + private static final StatusFunction COMPUTE_STATUS=(base,p)->{ if(base.eAvailableData<0){ return STATUS_TOO_LOW; } @@ -79,7 +80,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB private static final String[][] slice = new String[][]{{"-01", "A!2", "A!2", "-01",},}; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{2, 1, 3}; - private static final String[] addingMethods = new String[]{"addToMachineList", "addRackToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{this::addToMachineList, this::addRackToMachineList}; private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{1, 3}; @@ -104,7 +105,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override protected void parametersInstantiation_EM() { - Parameters.Group hatch_0=parametrization.makeGroup(0,true); + Parameters.Group hatch_0=parametrization.getGroup(0); overclock=hatch_0.makeInParameter(0,1,OC_NAME,OC_STATUS); overvolt=hatch_0.makeInParameter(1,1,OV_NAME,OV_STATUS); maxCurrentTemp=hatch_0.makeOutParameter(0,0,MAX_TEMP_NAME,MAX_TEMP_STATUS); @@ -140,7 +141,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public boolean checkRecipe_EM(ItemStack itemStack) { - parametrization.setToDefaults(false,true,false); + parametrization.setToDefaults(false,true); eAvailableData = 0; double maxTemp=0; double overClockRatio= overclock.get(); @@ -148,7 +149,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB if(Double.isNaN(overClockRatio) || Double.isNaN(overVoltageRatio)) { return false; } - if(overclock.getStatus(true).isOk() && overvolt.getStatus(true).isOk()){ + if(overclock.getStatus(true).isOk && overvolt.getStatus(true).isOk){ float eut=V[8] * (float)overVoltageRatio * (float)overClockRatio; if(eut eStacksDataOutputs = new ArrayList<>(); @@ -46,7 +45,7 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB }; private static final Block[] blockType = new Block[]{sBlockCasingsTT,sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{2,1}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList","addDataBankHatchToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList,this::addDataBankHatchToMachineList}; private static final short[] casingTextures = new short[]{textureOffset,textureOffset+1}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT,sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0,1}; @@ -176,14 +175,4 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB } return false; } - - public static void run(){ - try { - adderMethodMap.put("addDataBankHatchToMachineList", GT_MetaTileEntity_EM_dataBank.class.getMethod("addDataBankHatchToMachineList", IGregTechTileEntity.class, int.class)); - } catch (NoSuchMethodException e) { - if (TecTechConfig.DEBUG_MODE) { - e.printStackTrace(); - } - } - } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 36b7505a65..b52637d220 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -7,8 +7,10 @@ import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -25,14 +27,13 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import java.util.function.Function; - import static com.github.technus.tectech.CommonValues.VN; import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_OK; +import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_LOW; /** * Created by danie_000 on 17.12.2016. @@ -47,9 +48,9 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase //region parameters protected Parameters.Group.ParameterIn ampereFlow; - private final Function FLOW_NAME=base->"Ampere divider"; - private final Function FLOW_STATUS=base->{ - if(eAmpereFlow<=0){ + private static final NameFunction FLOW_NAME= (base, p)->"Ampere divider"; + private static final StatusFunction FLOW_STATUS= (base, p)->{ + if(base.eAmpereFlow<=0){ return STATUS_TOO_LOW; } return STATUS_OK; @@ -70,7 +71,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT ,sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{4, 5, 8, 6}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; @@ -91,7 +92,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override protected void parametersInstantiation_EM() { - Parameters.Group hatch_0=parametrization.makeGroup(0,false); + Parameters.Group hatch_0=parametrization.getGroup(0, true); ampereFlow=hatch_0.makeInParameter(0,1,FLOW_NAME,FLOW_STATUS); } @@ -179,8 +180,12 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase float preMass=outputEM[0].getMass(); outputEM[0].tickContent(1,0,1); double energyDose=((preMass-outputEM[0].getMass())* MASS_TO_EU_PARTIAL); - mEUt=(int)(energyDose/(eAmpereFlow=(long) ampereFlow.get())); - + eAmpereFlow=(long) ampereFlow.get(); + if (eAmpereFlow <= 0) { + mEUt=0; + return false; + } + mEUt=(int)(energyDose/eAmpereFlow); return outputEM[0].hasStacks(); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 8c0a0f0708..5f5febb383 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -10,6 +10,7 @@ import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -46,7 +47,10 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; private static final byte[] blockMeta = new byte[]{0, 4, 0}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalInputToMachineList", "addElementalMufflerToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{ + this::addClassicToMachineList, + this::addElementalInputToMachineList, + this::addElementalMufflerToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index c6eb10c94a..54d14ded92 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -8,6 +8,7 @@ import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -39,7 +40,7 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{7, 4}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList}; private static final short[] casingTextures = new short[]{textureOffset}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index a295a5c7f1..d78ed3cbc4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -5,8 +5,13 @@ import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -16,6 +21,7 @@ import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static gregtech.api.enums.GT_Values.E; /** * Created by danie_000 on 17.12.2016. @@ -29,9 +35,16 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB {"!!!", "!0!", "!!!",}, {"!!!", "!!!", "!!!",}, }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalToMachineList"}; + private static final String[][] shapeBig = new String[][]{ + {E, "A ", "A . ", "A ",}, + {"A!!!", "!000!", "!010!", "!000!", "A!!!",}, + {"!!!!!", "!000!", "!000!", "!000!", "!!!!!",}, + {"A!!!", "!000!", "!000!", "!000!", "A!!!",}, + {"A!!!", "!!!!!", "!!!!!", "!!!!!", "A!!!",}, + }; + private static final Block[] blockType = new Block[]{sBlockCasingsTT,sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{4,5}; + private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; @@ -42,6 +55,36 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB }; //endregion + //region parameters + private static final NameFunction ROUTE_NAME= + (base,p)->(p.parameterId()==0?"Source ":"Destination ")+p.hatchId(); + private static final StatusFunction SRC_STATUS = + (base,p)-> { + double v = p.get(); + if (Double.isNaN(v)) return STATUS_WRONG; + v=(int)v; + if (v < 0) return STATUS_TOO_LOW; + if (v == 0) return STATUS_NEUTRAL; + if (v >= base.eInputHatches.size()) return STATUS_TOO_HIGH; + return STATUS_OK; + }; + private static final StatusFunction DST_STATUS = + (base,p)->{ + if(base.src[p.hatchId()].getStatus(false)== STATUS_OK){ + double v = p.get(); + if (Double.isNaN(v)) return STATUS_WRONG; + v=(int)v; + if (v < 0) return STATUS_TOO_LOW; + if (v == 0) return STATUS_LOW; + if (v >= base.eInputHatches.size()) return STATUS_TOO_HIGH; + return STATUS_OK; + } + return STATUS_NEUTRAL; + }; + protected Parameters.Group.ParameterIn[] src=new Parameters.Group.ParameterIn[10]; + protected Parameters.Group.ParameterIn[] dst=new Parameters.Group.ParameterIn[10]; + //endregion + public GT_MetaTileEntity_EM_junction(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -50,6 +93,15 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB super(aName); } + @Override + protected void parametersInstantiation_EM() { + for (int i = 0; i < 10; i++) { + Parameters.Group hatch = parametrization.getGroup(i); + src[i] = hatch.makeInParameter(0, i, ROUTE_NAME, SRC_STATUS); + dst[i] = hatch.makeInParameter(1, i, ROUTE_NAME, DST_STATUS); + } + } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_EM_junction(mName); @@ -57,7 +109,13 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + int meta=iGregTechTileEntity.getMetaIDAtSide(GT_Utility.getOppositeSide(iGregTechTileEntity.getFrontFacing())); + if(meta==4){ + return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + }else if(meta==5){ + return structureCheck_EM(shapeBig, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + } + return false; } @Override @@ -79,38 +137,6 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB }; } - @Override - public void parametersOutAndStatusesWrite_EM(boolean machineBusy) { - double src, dest; - for (int i = 0; i < 10; i++) { - src = getParameterIn(i, 0); - if (src <= 0) { - setStatusOfParameterIn(i, 0, STATUS_TOO_LOW); - setStatusOfParameterIn(i, 1, STATUS_NEUTRAL); - } else if (src > eInputHatches.size()) { - setStatusOfParameterIn(i, 0, STATUS_TOO_HIGH); - setStatusOfParameterIn(i, 1, STATUS_NEUTRAL); - } else if (Double.isNaN(src)) { - setStatusOfParameterIn(i, 0, STATUS_WRONG); - setStatusOfParameterIn(i, 1, STATUS_NEUTRAL); - } else { - setStatusOfParameterIn(i, 0, STATUS_OK); - dest = getParameterIn(i, 1); - if (dest < 0) { - setStatusOfParameterIn(i, 1, STATUS_TOO_LOW); - } else if (dest == 0) { - setStatusOfParameterIn(i, 1, STATUS_LOW); - } else if (dest > eOutputHatches.size()) { - setStatusOfParameterIn(i, 1, STATUS_TOO_HIGH); - } else if (Double.isNaN(dest)) { - setStatusOfParameterIn(i, 1, STATUS_WRONG); - } else { - setStatusOfParameterIn(i, 1, STATUS_OK); - } - } - } - } - @Override public boolean checkRecipe_EM(ItemStack itemStack) { for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { @@ -127,18 +153,18 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override public void outputAfterRecipe_EM() { - double src,dest; + double src,dst; for (int i = 0; i < 10; i++) { - src= getParameterIn(i,0); - dest= getParameterIn(i,1); - if(Double.isNaN(src) || Double.isNaN(dest)) { + src= this.src[i].get(); + dst= this.dst[i].get(); + if(Double.isNaN(src) || Double.isNaN(dst)) { continue; } int inIndex = (int)src - 1; if (inIndex < 0 || inIndex >= eInputHatches.size()) { continue; } - int outIndex = (int)dest - 1; + int outIndex = (int)dst - 1; GT_MetaTileEntity_Hatch_InputElemental in = eInputHatches.get(inIndex); if (outIndex == -1) {//param==0 -> null the content cleanHatchContentEM_EM(in); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java index 1494d97e34..e7a42fa941 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java @@ -13,6 +13,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; @@ -52,7 +53,10 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; private static final byte[] blockMeta = new byte[]{4, 0, 0}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalOutputToMachineList", "addElementalMufflerToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{ + this::addClassicToMachineList, + this::addElementalOutputToMachineList, + this::addElementalMufflerToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index b4b786dcdb..6b3cab021e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -1,12 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.loader.TecTechConfig; import com.github.technus.tectech.recipe.TT_recipe; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Holder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; @@ -66,7 +66,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{1, 3, 2}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addHolderToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList, this::addHolderToMachineList}; private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, Blocks.air}; private static final byte[] blockMetaFallback = new byte[]{1, 0}; @@ -490,16 +490,6 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB return false; } - public static void run() { - try { - adderMethodMap.put("addHolderToMachineList", GT_MetaTileEntity_EM_research.class.getMethod("addHolderToMachineList", IGregTechTileEntity.class, int.class)); - } catch (NoSuchMethodException e) { - if (TecTechConfig.DEBUG_MODE) { - e.printStackTrace(); - } - } - } - @Override public int getInventoryStackLimit() { return 1; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java index b2711530ed..d7cf3303f3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java @@ -14,6 +14,11 @@ import com.github.technus.tectech.thing.item.ElementalDefinitionScanStorage_EM; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction; import gregtech.api.enums.ItemList; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -57,6 +62,24 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa private long totalComputationRemaining, totalComputationRequired; private int[] scanComplexity; + //region parameters + private static final NameFunction CONFIG_NAME= + (base,p)->"Config at Depth: "+(p.hatchId()*2+p.parameterId()); + private static final StatusFunction CONFIG_STATUS= + (base,p)->{ + double v=p.get(); + if(Double.isNaN(v)){ + return LedStatus.STATUS_WRONG; + } + v=(int)v; + if(v==0) return LedStatus.STATUS_NEUTRAL; + if(v>=SCAN_GET_CLASS_TYPE) return LedStatus.STATUS_TOO_HIGH; + if(v<0) return LedStatus.STATUS_TOO_LOW; + return LedStatus.STATUS_OK; + }; + protected Parameters.Group.ParameterIn[] scanConfiguration=new Parameters.Group.ParameterIn[20]; + //endregion + //region structure private static final String[][] shape = new String[][]{ {" ", " 222 ", " 2.2 ", " 222 ", " ",}, @@ -70,11 +93,11 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{4, 0, 0}; - private static final String[] addingMethods = new String[]{ - "addClassicToMachineList", - "addElementalInputToMachineList", - "addElementalOutputToMachineList", - "addElementalMufflerToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{ + this::addClassicToMachineList, + this::addElementalInputToMachineList, + this::addElementalOutputToMachineList, + this::addElementalMufflerToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4, 4, 4}; @@ -97,6 +120,15 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa eDismantleBoom=true; } + @Override + protected void parametersInstantiation_EM() { + for (int i = 0; i < 10; i++) { + Parameters.Group hatch = parametrization.getGroup(i); + scanConfiguration[i*2] = hatch.makeInParameter(0, 0, CONFIG_NAME, CONFIG_STATUS); + scanConfiguration[i*2+1] = hatch.makeInParameter(0, 0, CONFIG_NAME, CONFIG_STATUS); + } + } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_EM_scanner(mName); @@ -248,7 +280,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa cleanStackEM_EM(stackEM); researchEM.remove(stackEM.definition); } - if(eRecipe!=null && scannerRecipe!=null){//make sure it werks + if(eRecipe!=null && scannerRecipe!=null){//todo make sure it werks totalComputationRequired = totalComputationRemaining = scannerRecipe.mDuration * 20L; mMaxProgresstime = 20;//const mEfficiencyIncrease = 10000; @@ -272,9 +304,8 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa //get depth scan complexity array { int[] scanComplexityTemp = new int[20]; - for (int i = 0; i < 10; i++) { - scanComplexityTemp[i] = getParameterInInt(i, 0); - scanComplexityTemp[i + 10] = getParameterInInt(i, 1); + for (int i = 0; i < 20; i++) { + scanComplexityTemp[i]=(int)scanConfiguration[i].get(); } int maxDepth = 0; for (int i = 0; i < 20; i++) { @@ -418,20 +449,20 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa return new String[]{ "Energy Hatches:", EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET + " EU", + EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", (mEUt <= 0 ? "Probably uses: " : "Probably makes: ") + - EnumChatFormatting.RED + Integer.toString(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t at " + + EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t at " + EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", "Tier Rating: " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + " Amp Rating: " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", "Problems: " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + - " Efficiency: " + EnumChatFormatting.YELLOW + Float.toString(mEfficiency / 100.0F) + EnumChatFormatting.RESET + " %", + " Efficiency: " + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", "PowerPass: " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + " SafeVoid: " + EnumChatFormatting.BLUE + eSafeVoid, "Computation Available: " + EnumChatFormatting.GREEN + eAvailableData +EnumChatFormatting.RESET+" / "+EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET, "Computation Remaining:", EnumChatFormatting.GREEN + Long.toString(totalComputationRemaining / 20L) + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.YELLOW + Long.toString(totalComputationRequired / 20L) + EnumChatFormatting.YELLOW + totalComputationRequired / 20L }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index ce16d939cd..2386619e7e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java @@ -4,6 +4,7 @@ import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; @@ -28,7 +29,7 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT ,sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{4, 0, 5, 6, 9}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index 767bd676d6..e5bcb3f75d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -8,6 +8,10 @@ import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -39,7 +43,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas }; private static final Block[] blockType = new Block[]{sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{3}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList}; private static final short[] casingTextures = new short[]{textureOffset+1}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{1}; @@ -49,6 +53,34 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas }; //endregion + //region parameters + private static final NameFunction ROUTE_NAME= + (base,p)->(p.parameterId()==0?"Destination ":"Weight ")+p.hatchId(); + private static final StatusFunction WEI_STATUS = + (base,p)-> { + double v=p.get(); + if (Double.isNaN(v)) return STATUS_WRONG; + if(v<0) return STATUS_TOO_LOW; + if(v==0) return STATUS_LOW; + if(Double.isInfinite(v)) return STATUS_HIGH; + return STATUS_OK; + }; + private static final StatusFunction DST_STATUS = + (base,p)->{ + if(base.weight[p.hatchId()].getStatus(false).isOk) { + double v = p.get(); + if (Double.isNaN(v)) return STATUS_WRONG; + v = (int) v; + if (v <= 0) return STATUS_TOO_LOW; + if (v >= base.eOutputHatches.size()) return STATUS_TOO_HIGH; + return STATUS_OK; + } + return STATUS_NEUTRAL; + }; + protected Parameters.Group.ParameterIn[] dst=new Parameters.Group.ParameterIn[10]; + protected Parameters.Group.ParameterIn[] weight =new Parameters.Group.ParameterIn[10]; + //endregion + public GT_MetaTileEntity_EM_switch(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -57,6 +89,15 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas super(aName); } + @Override + protected void parametersInstantiation_EM() { + for (int i = 0; i < 10; i++) { + Parameters.Group hatch = parametrization.getGroup(i); + dst[i] = hatch.makeInParameter(0, i, ROUTE_NAME, DST_STATUS); + weight[i] = hatch.makeInParameter(1,0, ROUTE_NAME, WEI_STATUS); + } + } + public final static ResourceLocation activitySound=new ResourceLocation(Reference.MODID+":fx_hi_freq"); @Override @@ -117,12 +158,10 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas public void outputAfterRecipe_EM() { if (!eOutputData.isEmpty()) { double total = 0; - double dest; double weight; for (int i = 0; i < 10; i++) {//each param pair - dest= getParameterIn(i,1); - weight= getParameterIn(i,0); - if (weight > 0 && dest >= 0) { + weight= this.weight[i].get(); + if (weight > 0 && dst[i].get() >= 0) { total += weight;//Total weighted div } } @@ -144,9 +183,10 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas long remaining = pack.getContent(); + double dest; for (int i = 0; i < 10; i++) { - dest= getParameterIn(i,1); - weight= getParameterIn(i,0); + dest= dst[i].get(); + weight= this.weight[i].get(); if (weight > 0 && dest >= 0) { int outIndex = (int)dest - 1; if (outIndex < 0 || outIndex >= eOutputData.size()) { @@ -177,35 +217,6 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } } - @Override - public void parametersOutAndStatusesWrite_EM(boolean machineBusy) { - double weight, dest; - for (int i = 0; i < 10; i++) { - weight = getParameterIn(i, 0); - if (weight < 0) { - setStatusOfParameterIn(i, 0, STATUS_TOO_LOW); - setStatusOfParameterIn(i, 1, STATUS_NEUTRAL); - } else if (Double.isNaN(weight)) { - setStatusOfParameterIn(i, 0, STATUS_WRONG); - setStatusOfParameterIn(i, 1, STATUS_NEUTRAL); - } else { - setStatusOfParameterIn(i, 0, weight==0?STATUS_LOW:STATUS_OK); - dest = getParameterIn(i, 1); - if (dest < 0) { - setStatusOfParameterIn(i, 1, STATUS_TOO_LOW); - } else if (dest == 0) { - setStatusOfParameterIn(i, 1, STATUS_LOW); - } else if (dest > eOutputData.size()) { - setStatusOfParameterIn(i, 1, STATUS_TOO_HIGH); - } else if (Double.isNaN(dest)) { - setStatusOfParameterIn(i, 1, STATUS_WRONG); - } else { - setStatusOfParameterIn(i, 1, STATUS_OK); - } - } - } - } - @Override public String[] getDescription() { return new String[]{ diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 4584e86122..65f2301e41 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -6,6 +6,7 @@ import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -37,7 +38,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo }; private static final Block[] blockType = new Block[]{sBlockCasings1}; private static final byte[] blockMeta = new byte[]{15}; - private static final String[] addingMethods = new String[]{"addEnergyIOToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{this::addEnergyIOToMachineList}; private static final short[] casingTextures = new short[]{textureOffset}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index 5e60f59807..50070972ca 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -4,6 +4,7 @@ import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -45,7 +46,7 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB }; private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE ,sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{12, 10, 0, 5, 11}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 541adfd953..4456f97130 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -3,9 +3,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -19,7 +19,6 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumChatFormatting; @@ -35,8 +34,6 @@ import static gregtech.api.GregTech_API.sBlockCasings4; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - public static final int POWER_SETTING_DEFAULT=1000, TIMER_SETTING_DEFAULT=360; - private int powerSetting,timerSetting,timerValue; private boolean hasBeenPausedThisCycle=false; //region Structure @@ -51,7 +48,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock private static final Block[] blockType = new Block[]{sBlockCasings4}; private static final byte[] blockMeta = new byte[]{1}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList}; private static final short[] casingTextures = new short[]{49}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasings4}; private static final byte[] blockMetaFallback = new byte[]{1}; @@ -62,6 +59,25 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock }; //endregion + //region parameters + protected Parameters.Group.ParameterIn powerSetting,timerSetting; + protected Parameters.Group.ParameterOut timerValue,remainingTime; + private static final NameFunction POWER_NAME = (base, p)-> "Power setting"; + private static final NameFunction TIMER_SETTING_NAME = (base, p)-> "Timer setting"; + private static final NameFunction TIMER_REMAINING_NAME = (base, p)-> "Timer remaining"; + private static final NameFunction TIMER_VALUE_NAME = (base,p)-> "Timer value"; + private static final StatusFunction POWER_STATUS= + (base,p)-> LedStatus.fromLimitsInclusiveOuterBoundary(p.get(),300,1000,1000,Double.POSITIVE_INFINITY); + private static final StatusFunction TIMER_STATUS=(base,p)->{ + double value=p.get(); + if(Double.isNaN(value)) return STATUS_WRONG; + value=(int)value; + if(value<=0) return STATUS_TOO_LOW; + if(value>3000) return STATUS_TOO_HIGH; + return STATUS_OK; + }; + //endregion + public GT_MetaTileEntity_TM_microwave(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -70,6 +86,15 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock super(aName); } + @Override + protected void parametersInstantiation_EM() { + Parameters.Group hatch_0=parametrization.getGroup(0, true); + powerSetting=hatch_0.makeInParameter(0,1000, POWER_NAME,POWER_STATUS); + timerSetting=hatch_0.makeInParameter(1,360, TIMER_SETTING_NAME,TIMER_STATUS); + timerValue=hatch_0.makeOutParameter(0,0,TIMER_VALUE_NAME,TIMER_STATUS); + remainingTime=hatch_0.makeOutParameter(0,360,TIMER_REMAINING_NAME,TIMER_STATUS); + } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_TM_microwave(mName); @@ -123,13 +148,14 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public boolean checkRecipe_EM(ItemStack itemStack) { hasBeenPausedThisCycle =false; - if(powerSetting<300 || timerSetting<=0 || timerSetting>3000) { + if((int)powerSetting.get()<300 || timerSetting.get()<=0 || timerSetting.get()>3000) { return false; } - if (timerValue <= 0) { - timerValue=timerSetting; + if (remainingTime.get() <= 0) { + remainingTime.set(timerSetting.get()); + timerValue.set(0); } - mEUt = -(powerSetting >> 1); + mEUt = -((int)powerSetting.get() >> 1); eAmpereFlow = 1; mMaxProgresstime = 20; mEfficiencyIncrease = 10000; @@ -141,7 +167,8 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock if(hasBeenPausedThisCycle) { return;//skip timer and actions if paused } - timerValue--; + timerValue.set(timerValue.get()+1); + remainingTime.set(timerSetting.get()-timerValue.get()); IGregTechTileEntity mte=getBaseMetaTileEntity(); double[] xyzOffsets= getTranslatedOffsets(0,-1,2); double xPos=mte.getXCoord()+0.5f+xyzOffsets[0]; @@ -153,12 +180,12 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock for(int i=0;i<3;i++){//gets ABS from translated to get expansion values if(xyzExpansion[i]<0)xyzExpansion[i]=-xyzExpansion[i]; } - + int power=(int)powerSetting.get(); int damagingFactor = - Math.min(powerSetting >> 6,8)+ - Math.min(powerSetting >> 8,24)+ - Math.min(powerSetting >> 12,48)+ - (powerSetting >> 18); + Math.min(power >> 6,8)+ + Math.min(power >> 8,24)+ + Math.min(power >> 12,48)+ + (power >> 18); ArrayList itemsToOutput=new ArrayList<>(); HashSet tickedStuff=new HashSet<>(); @@ -194,59 +221,14 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock damagingFactor>>=1; } while(damagingFactor>0); - mOutputItems= itemsToOutput.toArray(new ItemStack[itemsToOutput.size()]); + mOutputItems= itemsToOutput.toArray(new ItemStack[0]); - if(timerValue<=0) { + if(remainingTime.get() <=0) { mte.getWorld().playSoundEffect(xPos,yPos,zPos, Reference.MODID+":microwave_ding", 1, 1); stopMachine(); } } - @Override - protected void parametersLoadDefault_EM() { - powerSetting = POWER_SETTING_DEFAULT; - timerSetting = TIMER_SETTING_DEFAULT; - setParameterPairIn_ClearOut(0,false, POWER_SETTING_DEFAULT, TIMER_SETTING_DEFAULT); - } - - @Override - protected void parametersInReadWhileActive_EM() { - powerSetting = (int) getParameterIn(0, 0); - timerSetting = (int) getParameterIn(0, 1); - } - - @Override - public void parametersOutAndStatusesWrite_EM(boolean machineBusy) { - double powerParameter = getParameterIn(0, 0); - if (powerParameter < 300) { - setStatusOfParameterIn(0, 0, STATUS_TOO_LOW); - } else if (powerParameter < 1000) { - setStatusOfParameterIn(0, 0, STATUS_LOW); - } else if (powerParameter == 1000) { - setStatusOfParameterIn(0, 0, STATUS_OK); - } else if (powerParameter == Double.POSITIVE_INFINITY) { - setStatusOfParameterIn(0, 0, STATUS_TOO_HIGH); - } else if (Double.isNaN(powerParameter)) { - setStatusOfParameterIn(0, 0, STATUS_WRONG); - } else { - setStatusOfParameterOut(0, 0, STATUS_HIGH); - } - - double timerParameter = getParameterIn(0, 1); - if (timerParameter <= 1) { - setStatusOfParameterIn(0, 1, STATUS_TOO_LOW); - } else if (timerParameter <= 3000) { - setStatusOfParameterIn(0, 1, STATUS_OK); - } else if (Double.isNaN(timerParameter)) { - setStatusOfParameterIn(0, 1, STATUS_WRONG); - } else { - setStatusOfParameterIn(0, 1, STATUS_TOO_HIGH); - } - - setParameterOut(0, 0, timerValue); - setParameterOut(0, 1, timerSetting - timerValue); - } - @Override public boolean onRunningTick(ItemStack aStack) { if(eSafeVoid) { @@ -258,19 +240,8 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public void stopMachine() { super.stopMachine(); - timerValue=0; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setInteger("eTimerVal", timerValue); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - timerValue = aNBT.getInteger("eTimerVal"); + remainingTime.set(timerSetting.get()); + timerValue.set(0); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 82722e76f9..2c58006360 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -6,6 +6,7 @@ import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_H import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -23,7 +24,6 @@ import java.util.ArrayList; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.Util.StructureBuilder; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static gregtech.api.GregTech_API.*; import static gregtech.api.enums.GT_Values.E; @@ -88,7 +88,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private static final byte[] blockMetaT1 = new byte[]{15, 1, 13, 0}; private static final byte[] blockMetaT2 = new byte[]{15, 2, 13, 0}; private static final byte[][] blockMetas = new byte[][]{blockMetaT0,blockMetaT1,blockMetaT2}; - private static final String[] addingMethods = new String[]{"addCapacitorToMachineList", "addFrameToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{this::addCapacitorToMachineList, this::addFrameToMachineList}; private static final short[] casingTextures = new short[]{29, 0}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasings2, null}; private static final byte[] blockMetaFallback = new byte[]{13, 0}; @@ -348,15 +348,4 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } return false; } - - public static void run() { - try { - adderMethodMap.put("addFrameToMachineList", GT_MetaTileEntity_TM_teslaCoil.class.getMethod("addFrameToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addCapacitorToMachineList", GT_MetaTileEntity_TM_teslaCoil.class.getMethod("addCapacitorToMachineList", IGregTechTileEntity.class, int.class)); - } catch (NoSuchMethodException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java index f3147d890c..3c9102d072 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java @@ -14,7 +14,6 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.network.Rotati import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -36,18 +35,13 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.FluidStack; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; import static com.github.technus.tectech.CommonValues.*; import static com.github.technus.tectech.Util.StructureCheckerExtreme; import static com.github.technus.tectech.Util.getTier; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; -import static gregtech.api.enums.GT_Values.B; /** * Created by danie_000 on 27.10.2016. @@ -59,12 +53,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public static final FluidStack[] nothingF = new FluidStack[0]; //endregion - //region Reflection based hatch adding... - //Example how to add custom method is in computer and research station - protected static final Map adderMethodMap = new HashMap<>(); - private static Method adderMethod; - //endregion - //region Client side variables (static - one per class) //Front icon holders - static so it is default one for my blocks @@ -155,14 +143,14 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt super(aID, aName, aNameRegional); parametrization=new Parameters(this); parametersInstantiation_EM(); - parametrization.setToDefaults(true,true,true); + parametrization.setToDefaults(true,true); } protected GT_MetaTileEntity_MultiblockBase_EM(String aName) { super(aName); parametrization=new Parameters(this); parametersInstantiation_EM(); - parametrization.setToDefaults(true,true,true); + parametrization.setToDefaults(true,true); } //region SUPER STRUCT @@ -375,12 +363,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt String[][] structure,//0-9 casing, +- air no air, a-z ignore Block[] blockType,//use numbers 0-9 for casing types byte[] blockMeta,//use numbers 0-9 for casing types - String[] addingMethods, + HatchAdder[] addingMethods, short[] casingTextures, Block[] blockTypeFallback,//use numbers 0-9 for casing types byte[] blockMetaFallback,//use numbers 0-9 for casing types int horizontalOffset, int verticalOffset, int depthOffset) { - return StructureCheckerExtreme(structure, blockType, blockMeta, adderMethod, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, + return StructureCheckerExtreme(structure, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, horizontalOffset, verticalOffset, depthOffset, getBaseMetaTileEntity(), this, !mMachine); } @@ -435,7 +423,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } } - //endregion //region tooltip and scanner result @@ -455,11 +442,10 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt EnumChatFormatting.YELLOW+ ":"+ EnumChatFormatting.AQUA+"I"); list.add(EnumChatFormatting.WHITE+"Value: "+ - EnumChatFormatting.AQUA+parametrization.getIn(hatchNo,paramID)+ - EnumChatFormatting.GOLD+(((parametrization.bParamsAreFloats& B[hatchNo])!=0)?" float":" int")); + EnumChatFormatting.AQUA+parametrization.getIn(hatchNo,paramID)); try{ list.add(parametrization.groups[hatchNo].parameterIn[paramID].getBrief()); - }catch (NullPointerException e){ + }catch (NullPointerException|IndexOutOfBoundsException e){ list.add("Unused"); } return list; @@ -480,11 +466,10 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt EnumChatFormatting.YELLOW+ ":"+ EnumChatFormatting.AQUA+"O"); list.add(EnumChatFormatting.WHITE+"Value: "+ - EnumChatFormatting.AQUA+parametrization.getOut(hatchNo,paramID)+ - EnumChatFormatting.GOLD+(((parametrization.bParamsAreFloats& B[hatchNo])!=0)?" float":" int")); + EnumChatFormatting.AQUA+parametrization.getOut(hatchNo,paramID)); try{ list.add(parametrization.groups[hatchNo].parameterOut[paramID].getBrief()); - }catch (NullPointerException e){ + }catch (NullPointerException|IndexOutOfBoundsException e){ list.add("Unused"); } return list; @@ -726,16 +711,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt */ protected void parametersInstantiation_EM(){} - /** - * This is called automatically when there was IN parameters data update and machine IS RUNNING - * although the base code only downloads the IN values from parametrizers when machine is NOT OPERATING - * - * this can be used to update the IN values on the fly when machine is running to affect the current process - * - */ - protected void parametersInReadWhileActive_EM() { - } - /** * It is automatically called OFTEN * update status of parameters in guis (and "machine state" if u wish) @@ -745,13 +720,23 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt * * @param machineBusy is machine doing SHIT */ - protected void parametersOutAndStatusesWrite_EM(boolean machineBusy) {//todo unimplement + protected void parametersStatusesWrite_EM(boolean machineBusy) {//todo unimplement? if(!machineBusy){ for (Parameters.Group.ParameterIn parameterIn : parametrization.parameterInArrayList) { if (parameterIn != null) { parameterIn.updateStatus(); } } + }else{ + for (Parameters.Group hatch:parametrization.groups){ + if(hatch!=null && hatch.updateWhileRunning){ + for (Parameters.Group.ParameterIn in:hatch.parameterIn) { + if(in!=null){ + in.updateStatus(); + } + } + } + } } for (Parameters.Group.ParameterOut parameterOut : parametrization.parameterOutArrayList) { if (parameterOut != null) { @@ -891,17 +876,15 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt NBTTagCompound paramI = new NBTTagCompound(); for (int i = 0; i < parametrization.iParamsIn.length; i++) { - paramI.setInteger(Integer.toString(i), parametrization.iParamsIn[i]); + paramI.setDouble(Integer.toString(i), parametrization.iParamsIn[i]); } - aNBT.setTag("eParamsIn", paramI); + aNBT.setTag("eParamsInD", paramI); NBTTagCompound paramO = new NBTTagCompound(); for (int i = 0; i < parametrization.iParamsOut.length; i++) { - paramO.setInteger(Integer.toString(i), parametrization.iParamsOut[i]); + paramO.setDouble(Integer.toString(i), parametrization.iParamsOut[i]); } - aNBT.setTag("eParamsOut", paramO); - - aNBT.setShort("eParamsS",parametrization.bParamsAreFloats); + aNBT.setTag("eParamsOutD", paramO); NBTTagCompound paramIs = new NBTTagCompound(); for (int i = 0; i < parametrization.eParamsInStatus.length; i++) { @@ -978,24 +961,28 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt outputEM = null; } - NBTTagCompound paramI = aNBT.getCompoundTag("eParamsIn"); - for (int i = 0; i < parametrization.iParamsIn.length; i++) { - parametrization.iParamsIn[i] = paramI.getInteger(Integer.toString(i)); - } - - NBTTagCompound paramO = aNBT.getCompoundTag("eParamsOut"); - for (int i = 0; i < parametrization.iParamsOut.length; i++) { - parametrization.iParamsOut[i] = paramO.getInteger(Integer.toString(i)); - } - - if(aNBT.hasKey("eParamsB")) { + if(aNBT.hasKey("eParamsIn") && aNBT.hasKey("eParamsOut") && aNBT.hasKey("eParamsB")){ + NBTTagCompound paramI = aNBT.getCompoundTag("eParamsIn"); + NBTTagCompound paramO = aNBT.getCompoundTag("eParamsOut"); NBTTagCompound paramB = aNBT.getCompoundTag("eParamsB"); - parametrization.bParamsAreFloats=0; for (int i = 0; i < 10; i++) { - parametrization.bParamsAreFloats|=paramB.getBoolean(Integer.toString(i))? B[i]:0; + if(paramB.getBoolean(Integer.toString(i))){ + parametrization.iParamsIn[i] = Float.intBitsToFloat(paramI.getInteger(Integer.toString(i))); + parametrization.iParamsOut[i] =Float.intBitsToFloat(paramO.getInteger(Integer.toString(i))); + }else { + parametrization.iParamsIn[i] = paramI.getInteger(Integer.toString(i)); + parametrization.iParamsOut[i] = paramO.getInteger(Integer.toString(i)); + } } }else{ - parametrization.bParamsAreFloats=aNBT.getShort("eParamsS"); + NBTTagCompound paramI = aNBT.getCompoundTag("eParamsInD"); + for (int i = 0; i < parametrization.iParamsIn.length; i++) { + parametrization.iParamsIn[i] = paramI.getDouble(Integer.toString(i)); + } + NBTTagCompound paramO = aNBT.getCompoundTag("eParamsOutD"); + for (int i = 0; i < parametrization.iParamsOut.length; i++) { + parametrization.iParamsOut[i] = paramO.getDouble(Integer.toString(i)); + } } NBTTagCompound paramIs = aNBT.getCompoundTag("eParamsInS"); @@ -1187,47 +1174,40 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt * callback for updating parameters and new hatches */ protected void hatchesStatusUpdate_EM() { + if(getBaseMetaTileEntity().isClientSide()){ + return; + } boolean busy=mMaxProgresstime>0; if (busy) {//write from buffer to hatches only for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { if (!GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch) || hatch.param < 0) { continue; } - int paramID = hatch.param; - if((parametrization.bParamsAreFloats&B[hatch.param])!=0){ - hatch.input0i = parametrization.iParamsOut[paramID]; - hatch.input1i = parametrization.iParamsOut[paramID + 10]; - }else if(hatch.isUsingFloats()){ - hatch.input0i = Float.floatToIntBits((float)parametrization.iParamsOut[paramID]); - hatch.input1i = Float.floatToIntBits((float)parametrization.iParamsOut[paramID + 10]); - }else { - hatch.input0i = (int)Float.intBitsToFloat(parametrization.iParamsOut[paramID]); - hatch.input1i = (int)Float.intBitsToFloat(parametrization.iParamsOut[paramID + 10]); + int hatchId = hatch.param; + if(parametrization.groups[hatchId]!=null && parametrization.groups[hatchId].updateWhileRunning){ + parametrization.iParamsIn[hatchId] = hatch.value0i; + parametrization.iParamsIn[hatchId + 10] = hatch.value1i; } + hatch.input0i = parametrization.iParamsOut[hatchId]; + hatch.input1i = parametrization.iParamsOut[hatchId + 10]; } - parametersInReadWhileActive_EM(); } else {//if has nothing to do update all for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { if (!GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch) || hatch.param < 0) { continue; } - int paramID = hatch.param; - if(hatch.isUsingFloats()){ - parametrization.bParamsAreFloats |= B[hatch.param]; - }else { - parametrization.bParamsAreFloats &=~B[hatch.param]; - } - parametrization.iParamsIn[paramID] = hatch.value0i; - parametrization.iParamsIn[paramID + 10] = hatch.value1i; - hatch.input0i = parametrization.iParamsOut[paramID]; - hatch.input1i = parametrization.iParamsOut[paramID + 10]; + int hatchId = hatch.param; + parametrization.iParamsIn[hatchId] = hatch.value0i; + parametrization.iParamsIn[hatchId + 10] = hatch.value1i; + hatch.input0i = parametrization.iParamsOut[hatchId]; + hatch.input1i = parametrization.iParamsOut[hatchId + 10]; } } for (GT_MetaTileEntity_Hatch_Uncertainty uncertainty : eUncertainHatches) { eCertainStatus = uncertainty.update(eCertainMode); } eAvailableData = getAvailableData_EM(); - parametersOutAndStatusesWrite_EM(busy); + parametersStatusesWrite_EM(busy); } @Deprecated @@ -1431,13 +1411,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches){ if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { hatch.getBaseMetaTileEntity().setActive(true); - if(hatch.param>=0) { - if(hatch.isUsingFloats()){ - parametrization.bParamsAreFloats |= B[hatch.param]; - }else { - parametrization.bParamsAreFloats &=~B[hatch.param]; - } - } } } } else { @@ -2621,48 +2594,4 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } return false; } - - public static void run() { - try { - adderMethodMap.put("addToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addClassicToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addClassicToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addElementalToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addElementalToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addMufflerToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addMufflerToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addClassicMufflerToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addClassicMufflerToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addElementalMufflerToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addElementalMufflerToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addInputToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addInputToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addOutputToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addOutputToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addEnergyInputToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addEnergyInputToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addDynamoToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addDynamoToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addEnergyIOToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addEnergyIOToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addElementalInputToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addElementalInputToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addElementalOutputToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addElementalOutputToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addClassicInputToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addClassicInputToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addClassicOutputToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addClassicOutputToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addParametrizerToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addParametrizerToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addUncertainToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addUncertainToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addMaintenanceToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addMaintenanceToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addClassicMaintenanceToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addClassicMaintenanceToMachineList", IGregTechTileEntity.class, int.class)); - adderMethodMap.put("addDataConnectorToMachineList", GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addDataConnectorToMachineList", IGregTechTileEntity.class, int.class)); - adderMethod = GT_MetaTileEntity_MultiblockBase_EM.class.getMethod("addThing", String.class, IGregTechTileEntity.class, int.class); - } catch (NoSuchMethodException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - - //CALLBACK from hatches adders - public boolean addThing(String methodName, IGregTechTileEntity igt, int casing) { - try { - return (boolean) adderMethodMap.get(methodName).invoke(this, igt, casing); - } catch (InvocationTargetException | IllegalAccessException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - return false; - } - - //endregion } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/HatchAdder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/HatchAdder.java new file mode 100644 index 0000000000..a8633c4837 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/HatchAdder.java @@ -0,0 +1,8 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.base; + + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + +import java.util.function.BiFunction; + +public interface HatchAdder extends BiFunction {} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java index 52d4f30c12..e32df43ae4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java @@ -19,14 +19,6 @@ public enum LedStatus { this.isOk=ok; } - public boolean isOk(){ - return isOk; - } - - public boolean isBad(){ - return !isOk; - } - public byte getOrdinalByte(){ return (byte)ordinal(); } @@ -61,7 +53,6 @@ public enum LedStatus { } public static LedStatus fromLimitsExclusiveOuterBoundary(double value, double min,double low, double high,double max, double... excludedNumbers){ - if(Double.isNaN(value)) return STATUS_WRONG; if(value<=min) return STATUS_TOO_LOW; if(value>=max) return STATUS_TOO_HIGH; @@ -75,10 +66,8 @@ public enum LedStatus { } public static LedStatus fromLimitsInclusiveBoundary(double value, double min, double max, double... excludedNumbers){ - if(Double.isNaN(value)) return STATUS_WRONG; - if(value<=min) return STATUS_TOO_LOW; - else if(value==min) - if(value>=max) return STATUS_TOO_HIGH; + if(valuemax) return STATUS_TOO_HIGH; for (double val : excludedNumbers) { if(val==value) return STATUS_WRONG; @@ -88,10 +77,8 @@ public enum LedStatus { } public static LedStatus fromLimitsExclusiveBoundary(double value, double min, double max, double... excludedNumbers){ - if(Double.isNaN(value)) return STATUS_WRONG; if(value<=min) return STATUS_TOO_LOW; - else if(value==min) - if(value>=max) return STATUS_TOO_HIGH; + if(value>=max) return STATUS_TOO_HIGH; for (double val : excludedNumbers) { if(val==value) return STATUS_WRONG; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/NameFunction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/NameFunction.java new file mode 100644 index 0000000000..8ced431576 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/NameFunction.java @@ -0,0 +1,8 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.base; + +import java.util.function.BiFunction; + +public interface NameFunction extends BiFunction { + @Override + String apply(T t, Parameters.IParameter iParameter); +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java index 3ab2947085..2e8959c00f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java @@ -1,40 +1,31 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; -import gregtech.api.enums.GT_Values; - import java.util.ArrayList; -import java.util.BitSet; -import java.util.function.Function; - -import static gregtech.api.enums.GT_Values.B; /** * Instantiate parameters as field in parametersInstantiation_EM(); */ public class Parameters { - public static final Function LED_STATUS_FUNCTION_DEFAULT = o->LedStatus.STATUS_UNDEFINED; - public static final Function NAME_FUNCTION_DEFAULT=o->"Undefined"; - public static final int ZERO_FLOAT=Float.floatToIntBits(0); + private static final StatusFunction LED_STATUS_FUNCTION_DEFAULT = (b,p)->LedStatus.STATUS_UNDEFINED; + private static final NameFunction NAME_FUNCTION_DEFAULT= (b,p)->"Undefined"; final Group[] groups = new Group[10]; - int[] iParamsIn = new int[20];//number I from parametrizers - int[] iParamsOut = new int[20];//number O to parametrizers + double[] iParamsIn = new double[20];//number I from parametrizers + double[] iParamsOut = new double[20];//number O to parametrizers final ArrayList parameterInArrayList =new ArrayList<>(); final ArrayList parameterOutArrayList =new ArrayList<>(); - short bParamsAreFloats=0; - //package private for use in gui LedStatus[] eParamsInStatus = LedStatus.makeArray(20,LedStatus.STATUS_UNUSED);//LED status for I LedStatus[] eParamsOutStatus = LedStatus.makeArray(20,LedStatus.STATUS_UNUSED);//LED status for O - public double getIn(int hatchNo,int parameterId){ - return (bParamsAreFloats& B[hatchNo])!=0?Float.intBitsToFloat(iParamsIn[hatchNo+10*parameterId]):iParamsIn[hatchNo+10*parameterId]; + double getIn(int hatchNo,int parameterId){ + return iParamsIn[hatchNo+10*parameterId]; } - public double getOut(int hatchNo,int parameterId){ - return (bParamsAreFloats& B[hatchNo])!=0?Float.intBitsToFloat(iParamsOut[hatchNo+10*parameterId]):iParamsOut[hatchNo+10*parameterId]; + double getOut(int hatchNo,int parameterId){ + return iParamsOut[hatchNo+10*parameterId]; } private final GT_MetaTileEntity_MultiblockBase_EM parent; @@ -43,49 +34,29 @@ public class Parameters { this.parent=parent; } - public void setToDefaults(boolean defaultIn, boolean defaultOut,boolean defaultAreFloats){ - for (int hatch=0;hatch<10;hatch++) { - Group p= groups[hatch]; - if (p!=null){ - p.setToDefaults(defaultIn,defaultOut,defaultAreFloats); - }else{ - if(defaultAreFloats){ - bParamsAreFloats&=~B[hatch]; - if(defaultIn){ - iParamsIn[hatch] = 0; - iParamsIn[hatch + 10] = 0; - } - if(defaultOut){ - iParamsOut[hatch] = 0; - iParamsOut[hatch + 10] = 0; - } - }else{ - if((bParamsAreFloats& B[hatch])!=0){ - if(defaultIn){ - iParamsIn[hatch] = ZERO_FLOAT; - iParamsIn[hatch + 10] = ZERO_FLOAT; - } - if(defaultOut){ - iParamsOut[hatch] = ZERO_FLOAT; - iParamsOut[hatch + 10] = ZERO_FLOAT; - } - }else{ - if(defaultIn){ - iParamsIn[hatch] = 0; - iParamsIn[hatch + 10] = 0; - } - if(defaultOut){ - iParamsOut[hatch] = 0; - iParamsOut[hatch + 10] = 0; - } - } - } + public void setToDefaults(int hatch,boolean defaultIn, boolean defaultOut) { + Group p= groups[hatch]; + if (p == null) { + if (defaultIn) { + iParamsIn[hatch] = 0; + iParamsIn[hatch + 10] = 0; + } + if (defaultOut) { + iParamsOut[hatch] = 0; + iParamsOut[hatch + 10] = 0; } + } else { + p.setToDefaults(defaultIn,defaultOut); + } + } + + public void setToDefaults(boolean defaultIn, boolean defaultOut){ + for (int hatch=0;hatch<10;hatch++) { + setToDefaults(hatch,defaultIn,defaultOut); } } public void ClearDefinitions(){ - setToDefaults(true,true,false); parameterInArrayList.clear(); parameterOutArrayList.clear(); for(int i = 0; i< groups.length; i++){ @@ -93,72 +64,95 @@ public class Parameters { } } - public Group makeGroup(int hatchNo, boolean aParamsDefaultsAreFloats){ - return new Group( hatchNo, aParamsDefaultsAreFloats); + public void removeGroup(Group group){ + if(group==groups[group.hatchNo]){ + removeGroup(group.hatchNo); + }else{ + throw new IllegalArgumentException("Group does not exists in this parametrization!"); + } + } + + public void removeGroup(int hatchNo){ + Group hatch=groups[hatchNo]; + if(hatch!=null){ + for (Group.ParameterOut p:hatch.parameterOut) { + parameterOutArrayList.remove(p); + } + for (Group.ParameterIn p:hatch.parameterIn) { + parameterInArrayList.remove(p); + } + groups[hatchNo]=null; + } + } + + public Group getGroup(int hatchNo, boolean updateWhileRunning){ + return groups[hatchNo]!=null?groups[hatchNo]:new Group( hatchNo, updateWhileRunning); + } + + public Group getGroup(int hatchNo){ + return groups[hatchNo]!=null?groups[hatchNo]:new Group( hatchNo, false); + } + + public interface IParameter{ + double get(); + double getDefault(); + void updateStatus(); + LedStatus getStatus(boolean update); + int id(); + int hatchId(); + int parameterId(); + String getBrief(); } /** * most likely used locally in parametersInstantiation_EM() */ public class Group { - private final boolean bParamsDefaultsAreStoredAsFloats; private final int hatchNo; final ParameterIn[] parameterIn =new ParameterIn[2]; final ParameterOut[] parameterOut =new ParameterOut[2]; + public boolean updateWhileRunning; - private Group(int hatchNo, boolean aParamsDefaultsAreFloats){ + private Group(int hatchNo, boolean updateWhileRunning){ if(hatchNo<0 || hatchNo>=10){ throw new IllegalArgumentException("ParameterGroup id must be in 0 to 9 range"); } this.hatchNo=hatchNo; - bParamsDefaultsAreStoredAsFloats =aParamsDefaultsAreFloats; + this.updateWhileRunning=updateWhileRunning; groups[hatchNo]=this; } - public ParameterIn makeInParameter(int paramID, double defaultValue, Function name, Function status){ + public ParameterIn makeInParameter(int paramID, double defaultValue, NameFunction name, StatusFunction status){ return new ParameterIn(paramID, defaultValue,name, status); } - public ParameterOut makeOutParameter(int paramID, double defaultValue, Function name, Function status){ + public ParameterOut makeOutParameter(int paramID, double defaultValue, NameFunction name, StatusFunction status){ return new ParameterOut(paramID, defaultValue, name, status); } - public void setToDefaults(boolean defaultIn, boolean defaultOut,boolean defaultConfigureAreFloats) { - if(defaultConfigureAreFloats){ - if(bParamsDefaultsAreStoredAsFloats){ - bParamsAreFloats|= B[hatchNo]; - }else { - bParamsAreFloats&=~B[hatchNo]; - } - } + public void setToDefaults(boolean defaultIn, boolean defaultOut) { if(defaultIn){ - for(int in=0;in<2;in++){ - if(this.parameterIn[in]!=null){ - this.parameterIn[in].setDefault(); - }else { - if ((bParamsAreFloats& B[hatchNo])!=0) { - iParamsIn[hatchNo] = ZERO_FLOAT; - iParamsIn[hatchNo + 10] = ZERO_FLOAT; - } else { - iParamsIn[hatchNo] = 0; - iParamsIn[hatchNo + 10] = 0; - } - } + if (this.parameterIn[0] != null) { + this.parameterIn[0].setDefault(); + } else { + iParamsIn[hatchNo] = 0; + } + if (this.parameterIn[1] != null) { + this.parameterIn[1].setDefault(); + } else { + iParamsIn[hatchNo + 10] = 0; } } if(defaultOut){ - for(int out=0;out<2;out++){ - if(this.parameterOut[out]!=null){ - this.parameterOut[out].setDefault(); - }else { - if ((bParamsAreFloats& B[hatchNo])!=0) { - iParamsIn[hatchNo] = ZERO_FLOAT; - iParamsIn[hatchNo + 10] = ZERO_FLOAT; - } else { - iParamsIn[hatchNo] = 0; - iParamsIn[hatchNo + 10] = 0; - } - } + if (this.parameterOut[0] != null) { + this.parameterOut[0].setDefault(); + } else { + iParamsIn[hatchNo] = 0; + } + if (this.parameterOut[1] != null) { + this.parameterOut[1].setDefault(); + } else { + iParamsIn[hatchNo + 10] = 0; } } } @@ -166,48 +160,52 @@ public class Parameters { /** * Make a field out of this... */ - public class ParameterOut { + public class ParameterOut implements IParameter { public final int id; public final double defaultValue; - Function status; - Function name; + StatusFunction status; + NameFunction name; - @SuppressWarnings("unchecked") - private ParameterOut(int paramID, double defaultValue, Function name, Function status){ - this.name= name; - this.id=hatchNo+10*paramID; + private ParameterOut(int paramID, double defaultValue, NameFunction name, StatusFunction status){ + this.name= name==null?NAME_FUNCTION_DEFAULT:name; if(paramID<0 || paramID>2){ throw new IllegalArgumentException("Parameter id must be in 0 to 1 range"); } - this.defaultValue=defaultValue; if(parameterOut[paramID]!=null){ - throw new InstantiationError("This parameter already exists!"); + throw new IllegalArgumentException("Parameter id already occupied"); } - this.status = status; + this.id=hatchNo+10*paramID; + this.defaultValue=defaultValue; + this.status = status==null?LED_STATUS_FUNCTION_DEFAULT:status; parameterOutArrayList.add(this); parameterOut[paramID]=this; } - private void setDefault() { + void setDefault() { set(defaultValue); } + @Override public double get(){ - return (bParamsAreFloats& B[hatchNo])!=0?Float.intBitsToFloat(iParamsOut[id]):iParamsOut[id]; + return iParamsOut[id]; + } + + @Override + public double getDefault() { + return defaultValue; } public void set(double value){ - if((bParamsAreFloats& B[hatchNo])!=0) { - iParamsOut[id]=Float.floatToIntBits((float) value); - }else{ - iParamsOut[id]=(int)value; - } + iParamsOut[id]=value; } + @SuppressWarnings("unchecked") + @Override public void updateStatus(){ - eParamsOutStatus[id]=status.apply(parent); + eParamsOutStatus[id]=status.apply(parent,this); } + @Override public LedStatus getStatus(boolean update){ if(update){ updateStatus(); @@ -215,52 +213,76 @@ public class Parameters { return eParamsOutStatus[id]; } + @Override public String getBrief(){ - return name.apply(parent); + return name.apply(parent,this); + } + + @Override + public int id() { + return id; + } + + @Override + public int hatchId() { + return id%10; + } + + @Override + public int parameterId() { + return id/10; } } /** * Make a field out of this... */ - public class ParameterIn { + public class ParameterIn implements IParameter { public final int id; public final double defaultValue; - Function status; - Function name; + StatusFunction status; + NameFunction name; - @SuppressWarnings("unchecked") - private ParameterIn(int paramID, double defaultValue, Function name, Function status){ - this.name= name; + private ParameterIn(int paramID, double defaultValue, NameFunction name, StatusFunction status){ + this.name= name==null?NAME_FUNCTION_DEFAULT:name; this.id=hatchNo+10*paramID; if(paramID<0 || paramID>2){ throw new IllegalArgumentException("Parameter id must be in 0 to 1 range"); } - this.defaultValue=defaultValue; - if(parameterIn[paramID]!=null){ - throw new InstantiationError("This parameter already exists!"); + if(parameterOut[paramID]!=null){ + throw new IllegalArgumentException("Parameter id already occupied"); } - this.status = status; + this.defaultValue=defaultValue; + this.status = status==null?LED_STATUS_FUNCTION_DEFAULT:status; parameterInArrayList.add(this); parameterIn[paramID]=this; } - private void setDefault() { - if((bParamsAreFloats& B[hatchNo])!=0) { - iParamsIn[id]=Float.floatToIntBits((float) defaultValue); - }else{ - iParamsIn[id]=(int)defaultValue; - } + void setDefault() { + set(defaultValue); } + @Override public double get(){ - return (bParamsAreFloats& B[hatchNo])!=0?Float.intBitsToFloat(iParamsIn[id]):iParamsIn[id]; + return iParamsIn[id]; + } + + void set(double value){ + iParamsIn[id]=value; } + @Override + public double getDefault() { + return defaultValue; + } + + @SuppressWarnings("unchecked") + @Override public void updateStatus(){ - eParamsInStatus[id]=status.apply(parent); + eParamsInStatus[id]=status.apply(parent,this); } + @Override public LedStatus getStatus(boolean update){ if(update){ updateStatus(); @@ -268,8 +290,25 @@ public class Parameters { return eParamsInStatus[id]; } + @Override public String getBrief(){ - return name.apply(parent); + return name.apply(parent,this); + } + + + @Override + public int id() { + return id; + } + + @Override + public int hatchId() { + return id%10; + } + + @Override + public int parameterId() { + return id/10; } } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/StatusFunction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/StatusFunction.java new file mode 100644 index 0000000000..224f0fc47c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/StatusFunction.java @@ -0,0 +1,8 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.base; + +import java.util.function.BiFunction; + +public interface StatusFunction extends BiFunction { + @Override + LedStatus apply(T t, Parameters.IParameter iParameter); +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index efbca82c8f..4551ef3b17 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -4,12 +4,11 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.atom.dAtomDefinition; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import java.util.ArrayList; import java.util.Arrays; -import java.util.Comparator; +import java.util.function.BiFunction; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; @@ -18,10 +17,22 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStat /** * Created by danie_000 on 24.12.2017. */ -public class Behaviour_Centrifuge extends GT_MetaTileEntity_EM_machine.Behaviour { - private final float radius, maxRPM, maxRCF, maxForce, maxCapacity; +public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.Behaviour { private final byte tier; - private final static String[] DESCRIPTION_I =new String[]{"RPM Input","Fraction Count Input"}; + private float radius, maxRPM, maxRCF, maxForce, maxCapacity; + private Parameters.Group.ParameterIn settingRPM, settingFraction; + private final static NameFunction rpmName= (gt_metaTileEntity_em_machine, iParameter) -> "RPM Setting"; + private static final StatusFunction rpmStatus= (gt_metaTileEntity_em_machine, iParameter) -> { + double v=iParameter.get(); + if(Double.isNaN(v)){ + return STATUS_WRONG; + } + + }; + private final static NameFunction fractionName= (gt_metaTileEntity_em_machine, iParameter) -> "Fraction Count"; + private static final StatusFunction fractionStatus= (gt_metaTileEntity_em_machine, iParameter) -> { + + }; private final static String[] DESCRIPTION_O =new String[]{"RPM Setting","RCF Setting","Radius [mm]","Max RPM","Max Force [eV/c^2 * m/s]","Max Capacity [eV/c^2]","Max Power Usage[EU/t]","Max Recipe Rime [tick]"}; private static final double[/*tier+5*/][/*outputHatches+2*/] MIXING_FACTORS =new double[][]{ @@ -46,13 +57,6 @@ public class Behaviour_Centrifuge extends GT_MetaTileEntity_EM_machine.Behaviour maxCapacity = maxSafeMass * 4f * radius;// eV/c^2 } - @Override - protected void getFullLedDescriptionIn(ArrayList baseDescr, int hatchNo, int paramID) { - if(hatchNo==0) { - baseDescr.add(DESCRIPTION_I[(hatchNo << 1) + paramID]); - } - } - @Override protected void getFullLedDescriptionOut(ArrayList baseDescr, int hatchNo, int paramID) { if(hatchNo<=2) { @@ -60,25 +64,38 @@ public class Behaviour_Centrifuge extends GT_MetaTileEntity_EM_machine.Behaviour } } - @Override - public boolean setAndCheckParametersOutAndStatuses(GT_MetaTileEntity_EM_machine te, double[] parametersToCheckAndFix) { - boolean check=true; - - te.setParameterOut(1, 0, radius * 1000);//in mm - te.setParameterOut(1, 1, maxRPM); - te.setParameterOut(2, 0, maxForce * 9.80665);// (eV/c^2 * m/s) - te.setParameterOut(2, 1, maxCapacity);// eV/c^2 + private double getRCF(double RPM) { + return RPM * RPM * radius * 0.001118; + } - for(int i=4;i<=9;i++) { - te.setStatusOfParameterOut(i, 0, STATUS_UNUSED); - te.setStatusOfParameterOut(i, 1, STATUS_UNUSED); + private void addRandomly(cElementalInstanceStack me, cElementalInstanceStackMap[] toThis, int fractionCount) { + long amountPerFraction = me.amount / fractionCount; + cElementalInstanceStack[] stacks = new cElementalInstanceStack[fractionCount]; + for (int i = 0; i < fractionCount; i++) { + stacks[i] = me.clone(); + stacks[i].amount = amountPerFraction; + toThis[i].putReplace(stacks[i]); } - for(int i=1;i<=3;i++) { - te.setStatusOfParameterIn(i, 0, STATUS_UNUSED); - te.setStatusOfParameterIn(i, 1, STATUS_UNUSED); + int remainingAmount = (int) (me.amount % fractionCount); + while (remainingAmount > 0) { + int amountToAdd = TecTech.RANDOM.nextInt(remainingAmount) + 1; + stacks[TecTech.RANDOM.nextInt(fractionCount)].amount += amountToAdd; + remainingAmount -= amountToAdd; } + } - double RPM = parametersToCheckAndFix[0]; + @Override + public void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters) { + Parameters.Group hatch1=parameters.getGroup(7); + settingRPM=hatch1.makeInParameter(0,0,,); + settingFraction=hatch1.makeInParameter(1,2,,); + } + + @Override + public boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters) { + boolean check=true; + + double RPM = settingRPM.get(); if (RPM > maxRPM) { te.setStatusOfParameterIn(0, 0, STATUS_TOO_HIGH); te.setParameterOut(0, 0, maxRPM);//rpm @@ -107,7 +124,7 @@ public class Behaviour_Centrifuge extends GT_MetaTileEntity_EM_machine.Behaviour te.setParameterOut(0, 1, getRCF(RPM)); } - double fractionCount = parametersToCheckAndFix[1]; + double fractionCount = settingFraction.get(); if (fractionCount > 6) { parametersToCheckAndFix[1] = 6; te.setStatusOfParameterIn(0, 1, STATUS_TOO_HIGH); @@ -130,7 +147,7 @@ public class Behaviour_Centrifuge extends GT_MetaTileEntity_EM_machine.Behaviour } @Override - public MultiblockControl process(cElementalInstanceStackMap[] inputs, double[] checkedAndFixedParameters) { + public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { cElementalInstanceStackMap input = inputs[0]; if (input == null || input.isEmpty()) return null;//nothing in only valid input @@ -181,15 +198,12 @@ public class Behaviour_Centrifuge extends GT_MetaTileEntity_EM_machine.Behaviour //take all from hatch handler and put into new map - this takes from hatch to inner data storage stacks = input.takeAllToNewMap().values();//cleanup stacks if (stacks.length > 1) { - Arrays.sort(stacks, new Comparator() { - @Override - public int compare(cElementalInstanceStack o1, cElementalInstanceStack o2) { - float m1 = o1.definition.getMass(); - float m2 = o2.definition.getMass(); - if (m1 < m2) return -1; - if (m1 > m2) return 1; - return o1.compareTo(o2); - } + Arrays.sort(stacks, (o1, o2) -> { + float m1 = o1.definition.getMass(); + float m2 = o2.definition.getMass(); + if (m1 < m2) return -1; + if (m1 > m2) return 1; + return o1.compareTo(o2); }); double absMassPerOutput = 0;//"volume" @@ -258,24 +272,4 @@ public class Behaviour_Centrifuge extends GT_MetaTileEntity_EM_machine.Behaviour } return new MultiblockControl<>(outputs, mEut, 1, 0, 10000, mTicks, 0, excessMass); } - - private double getRCF(double RPM) { - return RPM * RPM * radius * 0.001118; - } - - private void addRandomly(cElementalInstanceStack me, cElementalInstanceStackMap[] toThis, int fractionCount) { - long amountPerFraction = me.amount / fractionCount; - cElementalInstanceStack[] stacks = new cElementalInstanceStack[fractionCount]; - for (int i = 0; i < fractionCount; i++) { - stacks[i] = me.clone(); - stacks[i].amount = amountPerFraction; - toThis[i].putReplace(stacks[i]); - } - int remainingAmount = (int) (me.amount % fractionCount); - while (remainingAmount > 0) { - int amountToAdd = TecTech.RANDOM.nextInt(remainingAmount) + 1; - stacks[TecTech.RANDOM.nextInt(fractionCount)].amount += amountToAdd; - remainingAmount -= amountToAdd; - } - } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java index 9fe54588bc..42b41a5ae3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java @@ -2,23 +2,29 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; /** * Created by danie_000 on 24.12.2017. */ -public class Behaviour_Electrolyzer extends GT_MetaTileEntity_EM_machine.Behaviour { +public class Behaviour_Electrolyzer implements GT_MetaTileEntity_EM_machine.Behaviour { final int tier; public Behaviour_Electrolyzer(int tier){ this.tier=tier; } @Override - public boolean setAndCheckParametersOutAndStatuses(GT_MetaTileEntity_EM_machine te, double[] parametersToCheckAndFix) { + public void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters) { + + } + + @Override + public boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters) { return false; } @Override - public MultiblockControl process(cElementalInstanceStackMap[] inputs, double[] checkedAndFixedParameters) { + public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { return null; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java index 94f00ece1b..e8b0ac7401 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java @@ -15,7 +15,7 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStat /** * Created by danie_000 on 24.12.2017. */ -public class Behaviour_ElectromagneticSeparator extends GT_MetaTileEntity_EM_machine.Behaviour { +public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_machine.Behaviour { private final byte tier; private final int ticks; private final byte precisionFull; @@ -102,16 +102,6 @@ public class Behaviour_ElectromagneticSeparator extends GT_MetaTileEntity_EM_mac te.setParameterOut(3,0,V[tier]); te.setParameterOut(3,1,ticks); - for(int i=4;i<=9;i++) { - te.setStatusOfParameterOut(i, 0, STATUS_UNUSED); - te.setStatusOfParameterOut(i, 1, STATUS_UNUSED); - } - te.setStatusOfParameterIn(1, 1, STATUS_UNUSED); - for(int i=2;i<=3;i++) { - te.setStatusOfParameterIn(i, 0, STATUS_UNUSED); - te.setStatusOfParameterIn(i, 1, STATUS_UNUSED); - } - double full=parametersToCheckAndFix[0]; if(Double.isInfinite(full) && full>0) { te.setStatusOfParameterIn(0,0,STATUS_TOO_HIGH); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java index bae032cd9e..02ddecbdc6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java @@ -2,23 +2,29 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; /** * Created by danie_000 on 24.12.2017. */ -public class Behaviour_PrecisionLaser extends GT_MetaTileEntity_EM_machine.Behaviour { +public class Behaviour_PrecisionLaser implements GT_MetaTileEntity_EM_machine.Behaviour { final int tier; public Behaviour_PrecisionLaser(int tier){ this.tier=tier; } @Override - public boolean setAndCheckParametersOutAndStatuses(GT_MetaTileEntity_EM_machine te, double[] parametersToCheckAndFix) { + public void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters) { + + } + + @Override + public boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters) { return false; } @Override - public MultiblockControl process(cElementalInstanceStackMap[] inputs, double[] checkedAndFixedParameters) { + public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { return null; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java index 4f6d555fdc..e30fdf111b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java @@ -2,23 +2,29 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; /** * Created by danie_000 on 24.12.2017. */ -public class Behaviour_Recycler extends GT_MetaTileEntity_EM_machine.Behaviour { +public class Behaviour_Recycler implements GT_MetaTileEntity_EM_machine.Behaviour { final int tier; public Behaviour_Recycler(int tier){ this.tier=tier; } @Override - public boolean setAndCheckParametersOutAndStatuses(GT_MetaTileEntity_EM_machine te, double[] parametersToCheckAndFix) { + public void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters) { + + } + + @Override + public boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters) { return false; } @Override - public MultiblockControl process(cElementalInstanceStackMap[] inputs, double[] checkedAndFixedParameters) { + public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { return null; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java index 32d8b81fdd..627f713a22 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java @@ -2,23 +2,29 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; /** * Created by danie_000 on 24.12.2017. */ -public class Behaviour_Scanner extends GT_MetaTileEntity_EM_machine.Behaviour { +public class Behaviour_Scanner implements GT_MetaTileEntity_EM_machine.Behaviour { final int tier; public Behaviour_Scanner(int tier){ this.tier=tier; } @Override - public boolean setAndCheckParametersOutAndStatuses(GT_MetaTileEntity_EM_machine te, double[] parametersToCheckAndFix) { + public void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters) { + + } + + @Override + public boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters) { return false; } @Override - public MultiblockControl process(cElementalInstanceStackMap[] inputs, double[] checkedAndFixedParameters) { + public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { return null; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java index 9c45b5df67..1ef3705b50 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java @@ -7,21 +7,25 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInsta import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_junction; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; -import java.util.BitSet; import java.util.HashMap; +import java.util.function.Supplier; import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; @@ -34,6 +38,7 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStat public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { public static final String machine = "EM Machinery"; + private ItemStack loadedMachine; private Behaviour currentBehaviour; //region structure @@ -47,7 +52,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa {"B0", "A!!!", "0!!!0", "A!!!", "B0",},}; private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{4, 0, 5, 6}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalToMachineList"}; + private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList,this::addElementalToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; @@ -57,6 +62,36 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa "2 - Elemental Hatches or Molecular Casing",}; //endregion + //region parameters + protected Parameters.Group.ParameterIn[] inputMux=new Parameters.Group.ParameterIn[6]; + protected Parameters.Group.ParameterIn[] outputMux=new Parameters.Group.ParameterIn[6]; + private static final StatusFunction SRC_STATUS = + (base,p)-> { + double v = p.get(); + if (Double.isNaN(v)) return STATUS_WRONG; + v=(int)v; + if (v < 0) return STATUS_TOO_LOW; + if (v == 0) return STATUS_NEUTRAL; + if (v >= base.eInputHatches.size()) return STATUS_TOO_HIGH; + return STATUS_OK; + }; + private static final StatusFunction DST_STATUS = + (base,p)->{ + if(base.inputMux[p.hatchId()].getStatus(false)== STATUS_OK){ + double v = p.get(); + if (Double.isNaN(v)) return STATUS_WRONG; + v=(int)v; + if (v < 0) return STATUS_TOO_LOW; + if (v == 0) return STATUS_LOW; + if (v >= base.eInputHatches.size()) return STATUS_TOO_HIGH; + return STATUS_OK; + } + return STATUS_NEUTRAL; + }; + private static final NameFunction ROUTE_NAME= + (base,p)->(p.parameterId()==0?"Source ":"Destination ")+p.hatchId(); + //endregion + public GT_MetaTileEntity_EM_machine(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -65,6 +100,31 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa super(aName); } + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + if(aNBT.hasKey("eLoadedMachine")){ + loadedMachine = ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag("eLoadedMachine")); + } + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + if(loadedMachine !=null) { + aNBT.setTag("eLoadedMachine", loadedMachine.writeToNBT(new NBTTagCompound())); + } + } + + @Override + protected void parametersInstantiation_EM() { + for (int i=0;i<6;i++){ + Parameters.Group hatch=parametrization.getGroup(i); + inputMux[i]=hatch.makeInParameter(0,i,ROUTE_NAME,SRC_STATUS); + outputMux[i]=hatch.makeInParameter(1,i,ROUTE_NAME,DST_STATUS); + } + } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_EM_machine(mName); @@ -92,6 +152,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public void onFirstTick_EM(IGregTechTileEntity aBaseMetaTileEntity) { + setCurrentBehaviour(); if(aBaseMetaTileEntity.isServerSide()) { quantumStuff(aBaseMetaTileEntity.isActive()); } @@ -100,7 +161,9 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if(aBaseMetaTileEntity.isClientSide() && (aTick & 0x2)==0){ - currentBehaviour=GT_MetaTileEntity_EM_machine.map.get(new Util.TT_ItemStack(mInventory[1])); + if((aTick&0x10)==0) { + setCurrentBehaviour(); + } if(aBaseMetaTileEntity.isActive()){ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX*2+aBaseMetaTileEntity.getXCoord(); int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY*2+aBaseMetaTileEntity.getYCoord(); @@ -110,28 +173,6 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } } - private boolean setCurrentBehaviour(Behaviour newBehaviour){ - boolean changed=currentBehaviour!=newBehaviour; - if(changed){ - setDefaultParametersAndStatuses(); - } - currentBehaviour=newBehaviour; - return changed; - } - - private void setDefaultParametersAndStatuses() { - for (int i = 0; i <= 3; i++) { - setStatusOfParameterIn(i, 0, STATUS_NEUTRAL); - setStatusOfParameterIn(i, 1, STATUS_NEUTRAL); - } - for (int i = 0; i <= 9; i++) { - setStatusOfParameterOut(i, 0, STATUS_NEUTRAL); - setStatusOfParameterOut(i, 1, STATUS_NEUTRAL); - setParameterOut(i, 0, 0); - setParameterOut(i, 1, 0); - } - } - @Override public void onRemoval() { quantumStuff(false); @@ -140,48 +181,21 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkRecipe_EM(ItemStack itemStack) { - setCurrentBehaviour(GT_MetaTileEntity_EM_machine.map.get(new Util.TT_ItemStack(itemStack))); + setCurrentBehaviour(); if(currentBehaviour==null){ return false; } - //mux input - double[] parameters = new double[]{ - getParameterIn(0, 0), - getParameterIn(0, 1), - getParameterIn(1, 0), - getParameterIn(1, 1), - getParameterIn(2, 0), - getParameterIn(2, 1), - getParameterIn(3, 0), - getParameterIn(3, 1)}; - if (!currentBehaviour.setAndCheckParametersOutAndStatuses(this, parameters)) { + + if (!currentBehaviour.checkParametersInAndSetStatuses(this, parametrization)) { return false; } cElementalInstanceStackMap[] handles = new cElementalInstanceStackMap[6]; - int pointer = getParameterInInt(4, 0) - 1; - if (pointer >= 0 && pointer < eInputHatches.size()) { - handles[0] = eInputHatches.get(pointer).getContainerHandler(); - } - pointer = getParameterInInt(4, 1) - 1; - if (pointer >= 0 && pointer < eInputHatches.size()) { - handles[1] = eInputHatches.get(pointer).getContainerHandler(); - } - pointer = getParameterInInt(5, 0) - 1; - if (pointer >= 0 && pointer < eInputHatches.size()) { - handles[2] = eInputHatches.get(pointer).getContainerHandler(); - } - pointer = getParameterInInt(5, 1) - 1; - if (pointer >= 0 && pointer < eInputHatches.size()) { - handles[3] = eInputHatches.get(pointer).getContainerHandler(); - } - pointer = getParameterInInt(6, 0) - 1; - if (pointer >= 0 && pointer < eInputHatches.size()) { - handles[4] = eInputHatches.get(pointer).getContainerHandler(); - } - pointer = getParameterInInt(6, 1) - 1; - if (pointer >= 0 && pointer < eInputHatches.size()) { - handles[5] = eInputHatches.get(pointer).getContainerHandler(); + for (int i = 0; i < 6; i++) { + int pointer = (int)inputMux[i].get(); + if (pointer >= 0 && pointer < eInputHatches.size()) { + handles[i] = eInputHatches.get(pointer).getContainerHandler(); + } } for (int i = 1; i < 6; i++) { @@ -194,7 +208,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } } - MultiblockControl control = currentBehaviour.process(handles, parameters); + MultiblockControl control = currentBehaviour.process(handles,this, parametrization); if (control == null) { return false; } @@ -223,33 +237,16 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public void outputAfterRecipe_EM() { - if (setCurrentBehaviour(GT_MetaTileEntity_EM_machine.map.get(new Util.TT_ItemStack(mInventory[1])))) { + if (setCurrentBehaviour()) { return; } + cElementalInstanceStackMap[] handles = new cElementalInstanceStackMap[6]; - int pointer = getParameterInInt(7, 0) - 1; - if (pointer >= 0 && pointer < eOutputHatches.size()) { - handles[0] = eOutputHatches.get(pointer).getContainerHandler(); - } - pointer = getParameterInInt(7, 1) - 1; - if (pointer >= 0 && pointer < eOutputHatches.size()) { - handles[1] = eOutputHatches.get(pointer).getContainerHandler(); - } - pointer = getParameterInInt(8, 0) - 1; - if (pointer >= 0 && pointer < eOutputHatches.size()) { - handles[2] = eOutputHatches.get(pointer).getContainerHandler(); - } - pointer = getParameterInInt(8, 1) - 1; - if (pointer >= 0 && pointer < eOutputHatches.size()) { - handles[3] = eOutputHatches.get(pointer).getContainerHandler(); - } - pointer = getParameterInInt(9, 0) - 1; - if (pointer >= 0 && pointer < eOutputHatches.size()) { - handles[4] = eOutputHatches.get(pointer).getContainerHandler(); - } - pointer = getParameterInInt(9, 1) - 1; - if (pointer >= 0 && pointer < eOutputHatches.size()) { - handles[5] = eOutputHatches.get(pointer).getContainerHandler(); + for (int i = 0; i < 6; i++) { + int pointer = (int)outputMux[i].get(); + if (pointer >= 0 && pointer < eOutputHatches.size()) { + handles[i] = eOutputHatches.get(pointer).getContainerHandler(); + } } //output for (int i = 0; i < 6 && i < outputEM.length; i++) { @@ -269,159 +266,70 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } @Override - protected void parametersLoadDefault_EM() {//default routing table - setParameterPairIn_ClearOut(4, false, 1, 2);//I - setParameterPairIn_ClearOut(5, false, 3, 4);//I - setParameterPairIn_ClearOut(6, false, 5, 6);//I - - setParameterPairIn_ClearOut(7, false, 1, 2);//O - setParameterPairIn_ClearOut(8, false, 3, 4);//O - setParameterPairIn_ClearOut(9, false, 5, 6);//O + public void parametersStatusesWrite_EM(boolean machineBusy) { + if (!machineBusy) { + setCurrentBehaviour(); + } + super.parametersStatusesWrite_EM(machineBusy); } - @Override - public void parametersOutAndStatusesWrite_EM(boolean machineBusy) { - int pointer; - { - BitSet checkArray = new BitSet(); - for (int i = 4; i <= 6; i++) { - pointer = getParameterInInt(i, 0); - if (Double.isNaN(pointer)) { - setStatusOfParameterIn(i, 0, STATUS_WRONG); - } else if (pointer <= 0) { - setStatusOfParameterIn(i, 0, STATUS_TOO_LOW); - }//else if(pointer==0) - // setStatusOfParameterIn(i,0,STATUS_LOW); - else if (pointer <= eInputHatches.size()) { - if (checkArray.get(pointer)) { - setStatusOfParameterIn(i, 0, STATUS_WRONG); - } else { - setStatusOfParameterIn(i, 0, STATUS_OK); - checkArray.set(pointer); - } - } else { - setStatusOfParameterIn(i, 0, STATUS_TOO_HIGH); - } - pointer = getParameterInInt(i, 1); - if (Double.isNaN(pointer)) { - setStatusOfParameterIn(i, 1, STATUS_WRONG); - } else if (pointer < 0) { - setStatusOfParameterIn(i, 1, STATUS_TOO_LOW); - } else if (pointer == 0) { - setStatusOfParameterIn(i, 1, STATUS_LOW); - } else if (pointer <= eInputHatches.size()) { - if (checkArray.get(pointer)) { - setStatusOfParameterIn(i, 1, STATUS_WRONG); - } else { - setStatusOfParameterIn(i, 1, STATUS_OK); - checkArray.set(pointer); - } - } else { - setStatusOfParameterIn(i, 1, STATUS_TOO_HIGH); - } - } + private boolean setCurrentBehaviour(){ + ItemStack newMachine=mInventory[1]; + if(ItemStack.areItemStacksEqual(newMachine, loadedMachine)){ + return false; } - { - for (int i = 7; i <= 9; i++) { - pointer = getParameterInInt(i, 0); - if (Double.isNaN(pointer)) { - setStatusOfParameterIn(i, 0, STATUS_WRONG); - } else if (pointer < 0) { - setStatusOfParameterIn(i, 0, STATUS_TOO_LOW); - } else if (pointer == 0) { - setStatusOfParameterIn(i, 0, STATUS_LOW); - } else if (pointer <= eOutputHatches.size()) { - setStatusOfParameterIn(i, 0, STATUS_OK); - } else { - setStatusOfParameterIn(i, 0, STATUS_TOO_HIGH); - } - pointer = getParameterInInt(i, 1); - if (Double.isNaN(pointer)) { - setStatusOfParameterIn(i, 1, STATUS_WRONG); - } else if (pointer < 0) { - setStatusOfParameterIn(i, 1, STATUS_TOO_LOW); - } else if (pointer == 0) { - setStatusOfParameterIn(i, 1, STATUS_LOW); - } else if (pointer <= eOutputHatches.size()) { - setStatusOfParameterIn(i, 1, STATUS_OK); - } else { - setStatusOfParameterIn(i, 1, STATUS_TOO_HIGH); - } + loadedMachine=newMachine; + Supplier behaviourSupplier=GT_MetaTileEntity_EM_machine.BEHAVIOUR_MAP.get(new Util.ItemStack_NoNBT(newMachine)); + if(currentBehaviour==null && behaviourSupplier==null) { + return false; + } + if(currentBehaviour!=null){ + for(int i=6;i<10;i++){ + parametrization.removeGroup(i); } } - setCurrentBehaviour(GT_MetaTileEntity_EM_machine.map.get(new Util.TT_ItemStack(mInventory[1]))); - if (currentBehaviour == null) { - setDefaultParametersAndStatuses(); + if(behaviourSupplier!=null){ + currentBehaviour=behaviourSupplier.get(); + currentBehaviour.parametersInstantiation(this, parametrization); + for(int i=6;i<10;i++){ + parametrization.setToDefaults(i,true,true); + } } else { - double[] parameters = new double[]{ - getParameterIn(0, 0), - getParameterIn(0, 1), - getParameterIn(1, 0), - getParameterIn(1, 1), - getParameterIn(2, 0), - getParameterIn(2, 1), - getParameterIn(3, 0), - getParameterIn(3, 1)}; - currentBehaviour.setAndCheckParametersOutAndStatuses(this,parameters); + currentBehaviour=null; } + return true; } - private static final HashMap map = new HashMap<>(); + private static final HashMap> BEHAVIOUR_MAP = new HashMap<>(); - public static void registerBehaviour(Behaviour behaviour, ItemStack is) { - map.put(new Util.TT_ItemStack(is), behaviour); - TecTech.LOGGER.info("Registered EM machine behaviour "+behaviour.getClass().getSimpleName()+' '+new Util.TT_ItemStack(is).toString()); + public static void registerBehaviour(Supplier behaviour, ItemStack is) { + BEHAVIOUR_MAP.put(new Util.ItemStack_NoNBT(is), behaviour); + TecTech.LOGGER.info("Registered EM machine behaviour "+behaviour.get().getClass().getSimpleName()+' '+new Util.ItemStack_NoNBT(is).toString()); } - public static abstract class Behaviour { - public Behaviour(){} - - public final void setOnMachine(GT_MetaTileEntity_EM_machine te){ - te.parametrization.clearGroups(); - parametersInstantiation(te.parametrization); - } - - public abstract void parametersInstantiation(Parameters parameters); + public interface Behaviour { + /** + * instantiate parameters, u can also check machine tier here + * @param te + * @param parameters + */ + void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters); /** - * handle parameters pre recipe, and cyclically - * this shouldn't write to input parameters! only to the provided array and/or output parameters - * @param te this - * @param parametersToCheckAndFix array of 6 parameters to pass to the process method (can be modified) - * this allows to pass different numbers if u want to employ automatic parameter correction here + * handle parameters per recipe + * @param te this te instance + * @param parameters of this te * @return return true if machine can start with current parameters, false if not */ - public abstract boolean setAndCheckParametersOutAndStatuses(GT_MetaTileEntity_EM_machine te, double[] parametersToCheckAndFix); + boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters); /** * do recipe handling * @param inputs from muxed inputs - * @param checkedAndFixedParameters array passed from previous method! + * @param parameters array passed from previous method! * @return null if recipe should not start, control object to set machine state and start recipe */ - public abstract MultiblockControl process(cElementalInstanceStackMap[] inputs, double[] checkedAndFixedParameters); - } - - @Override - public ArrayList getFullLedDescriptionIn(int hatchNo, int paramID) { - ArrayList base=super.getFullLedDescriptionIn(hatchNo, paramID); - if(hatchNo>=7){ - base.add("Output mux "+((hatchNo-7)*2+paramID+1)); - }else if(hatchNo>=4){ - base.add("Input mux "+((hatchNo-4)*2+paramID+1)); - }else if(currentBehaviour!=null){ - currentBehaviour.getFullLedDescriptionIn(base,hatchNo,paramID); - } - return base; - } - - @Override - public ArrayList getFullLedDescriptionOut(int hatchNo, int paramID) { - ArrayList base=super.getFullLedDescriptionOut(hatchNo, paramID); - if(currentBehaviour!=null){ - currentBehaviour.getFullLedDescriptionOut(base,hatchNo,paramID); - } - return base; + MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters); } private void quantumStuff(boolean shouldExist){ diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java index 6612167e5f..758afa69b9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java @@ -37,7 +37,7 @@ import static com.github.technus.tectech.Reference.MODID; * Created by Tec on 23.03.2017. */ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine { - private static final HashMap> RENDER_REGISTRY =new HashMap<>(); + private static final HashMap> RENDER_REGISTRY =new HashMap<>(); private static GT_RenderedTexture READER_ONLINE, READER_OFFLINE; public GT_MetaTileEntity_DataReader(int aID, String aName, String aNameRegional, int aTier) { @@ -89,7 +89,7 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine return DID_NOT_FIND_RECIPE; } ItemStack input=getInputAt(0); - ArrayList renders=getRenders(new Util.TT_ItemStack(input)); + ArrayList renders=getRenders(new Util.ItemStack_NoNBT(input)); for(DataRender render:renders){ if(render.canRender(input,mTier)){ mOutputItems[0]=input.copy(); @@ -173,7 +173,7 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine return maxEUInput()*4L; } - public static void addDataRender(Util.TT_ItemStack stack,DataRender render){ + public static void addDataRender(Util.ItemStack_NoNBT stack, DataRender render){ ArrayList renders=RENDER_REGISTRY.get(stack); if(renders==null){ RENDER_REGISTRY.put(stack,renders=new ArrayList<>()); @@ -184,7 +184,7 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine renders.add(render); } - public static ArrayList getRenders(Util.TT_ItemStack stack){ + public static ArrayList getRenders(Util.ItemStack_NoNBT stack){ return RENDER_REGISTRY.get(stack); } @@ -205,7 +205,7 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine } public static void run(){ - addDataRender(new Util.TT_ItemStack(ItemList.Tool_DataStick.get(1)),new DataRender() { + addDataRender(new Util.ItemStack_NoNBT(ItemList.Tool_DataStick.get(1)),new DataRender() { @SideOnly(Side.CLIENT) private ResourceLocation bg; @SideOnly(Side.CLIENT) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java index 97e7601b67..022247b541 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java @@ -115,7 +115,7 @@ public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine private void renderDataBG(ItemStack thing, int mouseX, int mouseY, int x, int y, byte mTier) { if (thing != null) { - ArrayList renders = GT_MetaTileEntity_DataReader.getRenders(new Util.TT_ItemStack(thing)); + ArrayList renders = GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(thing)); for (GT_MetaTileEntity_DataReader.DataRender render : renders) { if (render.canRender(thing, mTier)) { if (!GT_Utility.areStacksEqual(stack, thing, false)) { @@ -133,7 +133,7 @@ public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine if(stack==null){ return false; } - ArrayList renders = GT_MetaTileEntity_DataReader.getRenders(new Util.TT_ItemStack(stack)); + ArrayList renders = GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(stack)); for (GT_MetaTileEntity_DataReader.DataRender render : renders) { if (render.canRender(stack, mTier)) { render.renderForeground(stack, mouseX, mouseY, this, fontRendererObj); @@ -147,7 +147,7 @@ public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine if(stack==null){ return false; } - ArrayList renders = GT_MetaTileEntity_DataReader.getRenders(new Util.TT_ItemStack(stack)); + ArrayList renders = GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(stack)); for (GT_MetaTileEntity_DataReader.DataRender render : renders) { if (render.canRender(stack, mTier)) { render.renderTooltips(stack, mouseX, mouseY, this); -- cgit From 77299aca53c2a96760fe76c078e1ddad4df1aa0a Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 10 Mar 2019 17:55:54 +0100 Subject: done --- .../multi/em_machine/Behaviour_Centrifuge.java | 99 ++++------- .../Behaviour_ElectromagneticSeparator.java | 184 +++++++++------------ 2 files changed, 108 insertions(+), 175 deletions(-) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index 4551ef3b17..5f072b3196 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -4,11 +4,12 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.atom.dAtomDefinition; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction; -import java.util.ArrayList; import java.util.Arrays; -import java.util.function.BiFunction; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; @@ -22,18 +23,33 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.Behavi private float radius, maxRPM, maxRCF, maxForce, maxCapacity; private Parameters.Group.ParameterIn settingRPM, settingFraction; private final static NameFunction rpmName= (gt_metaTileEntity_em_machine, iParameter) -> "RPM Setting"; - private static final StatusFunction rpmStatus= (gt_metaTileEntity_em_machine, iParameter) -> { + private final StatusFunction rpmStatus= (gt_metaTileEntity_em_machine, iParameter) -> { double v=iParameter.get(); if(Double.isNaN(v)){ return STATUS_WRONG; } - + if (v <=0) { + return STATUS_TOO_LOW; + }else if (v>maxRPM){ + return STATUS_TOO_HIGH; + } + return STATUS_OK; }; private final static NameFunction fractionName= (gt_metaTileEntity_em_machine, iParameter) -> "Fraction Count"; private static final StatusFunction fractionStatus= (gt_metaTileEntity_em_machine, iParameter) -> { - + double v=iParameter.get(); + if(Double.isNaN(v)){ + return STATUS_WRONG; + } + v=(int)v; + if (v <= 1) { + return STATUS_TOO_LOW; + }else if (v>6){ + return STATUS_TOO_HIGH; + } + return STATUS_OK; }; - private final static String[] DESCRIPTION_O =new String[]{"RPM Setting","RCF Setting","Radius [mm]","Max RPM","Max Force [eV/c^2 * m/s]","Max Capacity [eV/c^2]","Max Power Usage[EU/t]","Max Recipe Rime [tick]"}; + //private final static String[] DESCRIPTION_O =new String[]{"RPM Setting","RCF Setting","Radius [mm]","Max RPM","Max Force [eV/c^2 * m/s]","Max Capacity [eV/c^2]","Max Power Usage[EU/t]","Max Recipe Rime [tick]"}; private static final double[/*tier+5*/][/*outputHatches+2*/] MIXING_FACTORS =new double[][]{ {.45,.85,.95,1,1,}, @@ -57,13 +73,6 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.Behavi maxCapacity = maxSafeMass * 4f * radius;// eV/c^2 } - @Override - protected void getFullLedDescriptionOut(ArrayList baseDescr, int hatchNo, int paramID) { - if(hatchNo<=2) { - baseDescr.add(DESCRIPTION_O[(hatchNo<<1)+paramID]); - } - } - private double getRCF(double RPM) { return RPM * RPM * radius * 0.001118; } @@ -87,63 +96,13 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.Behavi @Override public void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters) { Parameters.Group hatch1=parameters.getGroup(7); - settingRPM=hatch1.makeInParameter(0,0,,); - settingFraction=hatch1.makeInParameter(1,2,,); + settingRPM=hatch1.makeInParameter(0,0,rpmName,rpmStatus); + settingFraction=hatch1.makeInParameter(1,2,fractionName,fractionStatus); } @Override public boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters) { - boolean check=true; - - double RPM = settingRPM.get(); - if (RPM > maxRPM) { - te.setStatusOfParameterIn(0, 0, STATUS_TOO_HIGH); - te.setParameterOut(0, 0, maxRPM);//rpm - te.setParameterOut(0, 1, maxRCF);//rcf - check=false; - } else if (RPM > maxRPM / 3f * 2f) { - te.setStatusOfParameterIn(0, 0, STATUS_HIGH); - } else if (RPM > maxRPM / 3f) { - te.setStatusOfParameterIn(0, 0, STATUS_OK); - } else if (RPM > 0) { - te.setStatusOfParameterIn(0, 0, STATUS_LOW); - } else if (RPM <= 0) { - te.setStatusOfParameterIn(0, 0, STATUS_TOO_LOW); - te.setParameterOut(0, 0, 0);//rpm - te.setParameterOut(0, 1, 0);//rcf - check=false; - } else { - te.setStatusOfParameterIn(0, 0, STATUS_WRONG); - te.setParameterOut(0, 0, 0);//rpm - te.setParameterOut(0, 1, 0);//rcf - check=false; - } - - if(check) { - te.setParameterOut(0, 0, RPM); - te.setParameterOut(0, 1, getRCF(RPM)); - } - - double fractionCount = settingFraction.get(); - if (fractionCount > 6) { - parametersToCheckAndFix[1] = 6; - te.setStatusOfParameterIn(0, 1, STATUS_TOO_HIGH); - check=false; - } else if (fractionCount >= 2) { - te.setStatusOfParameterIn(0, 1, STATUS_OK); - } else if (fractionCount < 2) { - parametersToCheckAndFix[1] = 2; - te.setStatusOfParameterIn(0, 1, STATUS_TOO_LOW); - check=false; - } else { - te.setStatusOfParameterIn(0, 1, STATUS_WRONG); - check=false; - } - - te.setParameterOut(3,0,(int) (Math.pow(parametersToCheckAndFix[0] / maxRPM, 3f) * V[tier]));//max eut - te.setParameterOut(3,1,(int) (20 * (fractionCount - 1)));//max time - - return check; + return settingRPM.getStatus(true).isOk && settingFraction.getStatus(true).isOk; } @Override @@ -172,11 +131,11 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.Behavi inputMass = Math.abs(input.getMass()); - double RCF = getRCF(checkedAndFixedParameters[0]); + double RCF = getRCF(settingRPM.get()); if (inputMass * RCF > maxForce) return new MultiblockControl<>(excessMass);//AND THEN IT EXPLODES // how many output hatches to use - int fractionCount = (int) checkedAndFixedParameters[1]; + int fractionCount = (int) settingFraction.get(); cElementalInstanceStackMap[] outputs = new cElementalInstanceStackMap[fractionCount]; for (int i = 0; i < fractionCount; i++) { outputs[i] = new cElementalInstanceStackMap(); @@ -188,7 +147,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.Behavi TecTech.LOGGER.info("mixingFactor "+mixingFactor); } - int mEut = (int) (Math.pow(checkedAndFixedParameters[0] / maxRPM, 3f) * V[tier]); + int mEut = (int) (Math.pow(settingRPM.get() / maxRPM, 3f) * V[tier]); mEut = Math.max(mEut, 512); mEut = -mEut; int mTicks = (int) (20 * (inputMass / maxCapacity) * (fractionCount - 1)); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java index e8b0ac7401..d2b08f0960 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java @@ -4,10 +4,10 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.atom.dAtomDefinition; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; - -import java.util.ArrayList; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; @@ -17,14 +17,70 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStat */ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_machine.Behaviour { private final byte tier; - private final int ticks; - private final byte precisionFull; - private final byte precisionMinimal; - private final float maxCapacity; - private final long maxCharge; - private final int offsetMax; - private final static String[] DESCRIPTION_I =new String[]{"Full Precision Input [e/3]","Minimal Precision Input [e/3]","Offset Input [e/3]",null}; - private final static String[] DESCRIPTION_O =new String[]{"Full Precision Limit [e/3]","Minimal Precision Limit [e/3]","Offset Limit [e/3]",null,"Max Charge [e/3]","Max Capacity [eV/c^2]","Max Power Usage[EU/t]","Max Recipe Rime [tick]"}; + private int ticks; + private byte precisionFull,precisionMinimal; + private float maxCapacity; + private long maxCharge; + private int offsetMax; + private Parameters.Group.ParameterIn fullSetting,minimalSetting,offsetSetting; + private final static NameFunction fullName= (gt_metaTileEntity_em_machine, iParameter) -> "Full Precision Input [e/3]"; + private final StatusFunction fullStatus= (gt_metaTileEntity_em_machine, iParameter) -> { + double v=iParameter.get(); + if(Double.isNaN(v)){ + return STATUS_WRONG; + } + v=(int)v; + if(Double.isInfinite(v) && v>0) { + return STATUS_TOO_HIGH; + }else if(v>precisionFull){ + return STATUS_HIGH; + }else if(v minimalName= (gt_metaTileEntity_em_machine, iParameter) -> "Minimal Precision Input [e/3]"; + private final StatusFunction minimalStatus= (gt_metaTileEntity_em_machine, iParameter) -> { + double minimal=iParameter.get(); + double full=fullSetting.get(); + if(Double.isInfinite(minimal) && minimal>0) { + return STATUS_TOO_HIGH; + }else if(minimal>precisionMinimal){ + if(minimal>full){ + return STATUS_TOO_HIGH; + }else { + return STATUS_HIGH; + } + }else if(minimal==precisionMinimal){ + if(minimal>full){ + return STATUS_TOO_HIGH; + }else { + return STATUS_OK; + } + }else if(minimal offsetName= (gt_metaTileEntity_em_machine, iParameter) -> "Offset Input [e/3]"; + private final StatusFunction offsetStatus= (gt_metaTileEntity_em_machine, iParameter) -> { + double offset=iParameter.get(); + if(offset>offsetMax){ + return STATUS_TOO_HIGH; + }else if(offset>0){ + return STATUS_HIGH; + }else if(offset==0){ + return STATUS_OK; + }else if(offset>=-offsetMax){ + return STATUS_LOW; + }else if(offset<-offsetMax){ + return STATUS_TOO_LOW; + }else { + return STATUS_WRONG; + } + }; + //private final static String[] DESCRIPTION_O =new String[]{"Full Precision Limit [e/3]","Minimal Precision Limit [e/3]","Offset Limit [e/3]",null,"Max Charge [e/3]","Max Capacity [eV/c^2]","Max Power Usage[EU/t]","Max Recipe Rime [tick]"}; public Behaviour_ElectromagneticSeparator(int desiredTier){ tier=(byte) desiredTier; @@ -70,103 +126,21 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ } @Override - protected void getFullLedDescriptionIn(ArrayList baseDescr, int hatchNo, int paramID) { - if(hatchNo<=1) { - String desc=DESCRIPTION_I[(hatchNo << 1) + paramID]; - if(desc!=null){ - baseDescr.add(desc); - } - } + public void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters) { + Parameters.Group hatch1=parameters.getGroup(7); + fullSetting=hatch1.makeInParameter(0,0,fullName,fullStatus); + minimalSetting=hatch1.makeInParameter(1,2,minimalName,minimalStatus); + Parameters.Group hatch2=parameters.getGroup(8); + offsetSetting=hatch2.makeInParameter(0,0,offsetName,offsetStatus); } @Override - protected void getFullLedDescriptionOut(ArrayList baseDescr, int hatchNo, int paramID) { - if(hatchNo<=3){ - String desc=DESCRIPTION_O[(hatchNo<<1)+paramID]; - if(desc!=null){ - baseDescr.add(desc); - } - } - } - - @Override - public boolean setAndCheckParametersOutAndStatuses(GT_MetaTileEntity_EM_machine te, double[] parametersToCheckAndFix) { - boolean check=true; - - te.setParameterOut(0,0,precisionFull); - te.setParameterOut(0,1,precisionMinimal); - te.setParameterOut(1,0,offsetMax); - te.setStatusOfParameterOut(1,1,STATUS_UNUSED); - te.setParameterOut(2,0,maxCharge); - te.setParameterOut(2,1,maxCapacity); - te.setParameterOut(3,0,V[tier]); - te.setParameterOut(3,1,ticks); - - double full=parametersToCheckAndFix[0]; - if(Double.isInfinite(full) && full>0) { - te.setStatusOfParameterIn(0,0,STATUS_TOO_HIGH); - check=false; - }else if(full>precisionFull){ - te.setStatusOfParameterIn(0,0, STATUS_HIGH); - }else if(full==precisionFull){ - te.setStatusOfParameterIn(0,0,STATUS_OK); - }else if(full0) { - te.setStatusOfParameterIn(0,1,STATUS_TOO_HIGH); - check=false; - }else if(minimal>precisionMinimal){ - if(minimal>full){ - te.setStatusOfParameterIn(0,1,STATUS_TOO_HIGH); - check=false; - }else { - te.setStatusOfParameterIn(0,1, STATUS_HIGH); - } - }else if(minimal==precisionMinimal){ - if(minimal>full){ - te.setStatusOfParameterIn(0,1,STATUS_TOO_HIGH); - check=false; - }else { - te.setStatusOfParameterIn(0,1, STATUS_OK); - } - }else if(minimaloffsetMax){ - te.setStatusOfParameterIn(1,0,STATUS_TOO_HIGH); - check=false; - }else if(offset>0){ - te.setStatusOfParameterIn(1,0,STATUS_HIGH); - }else if(offset==0){ - te.setStatusOfParameterIn(1,0,STATUS_OK); - }else if(offset>=-offsetMax){ - te.setStatusOfParameterIn(1,0,STATUS_LOW); - }else if(offset<-offsetMax){ - te.setStatusOfParameterIn(1,0,STATUS_TOO_LOW); - check=false; - }else { - te.setStatusOfParameterIn(1,0,STATUS_WRONG); - check=false; - } - - return check; + public boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters) { + return fullSetting.getStatus(true).isOk && minimalSetting.getStatus(true).isOk && offsetSetting.getStatus(true).isOk; } @Override - public MultiblockControl process(cElementalInstanceStackMap[] inputs, double[] checkedAndFixedParameters) { + public MultiblockControl process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { cElementalInstanceStackMap input = inputs[0]; if (input == null || input.isEmpty()) return null;//nothing in only valid input @@ -202,9 +176,9 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ outputs[i] = new cElementalInstanceStackMap(); } - double offsetIn=checkedAndFixedParameters[2]; - double precisionFullIn=checkedAndFixedParameters[0]; - double precisionMinimalIn=checkedAndFixedParameters[1]; + double offsetIn=offsetSetting.get(); + double precisionFullIn=fullSetting.get(); + double precisionMinimalIn=minimalSetting.get(); double levelsCountPlus1=precisionFullIn-precisionMinimalIn+1; //take all from hatch handler and put into new map - this takes from hatch to inner data storage -- cgit From 92ce99cef18bc7f32c6a0219ab12f93ff4bf55bf Mon Sep 17 00:00:00 2001 From: Tec Date: Sun, 10 Mar 2019 21:01:58 +0100 Subject: hmm sake --- src/main/java/com/github/technus/tectech/Util.java | 4 +-- .../dreamcraft/DreamCraftRecipeLoader.java | 34 +++++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java index 05e7fd6336..09aeae6a6b 100644 --- a/src/main/java/com/github/technus/tectech/Util.java +++ b/src/main/java/com/github/technus/tectech/Util.java @@ -1357,13 +1357,13 @@ public final class Util { } } - public static void setTier(int tier,GT_MetaTileEntity_TieredMachineBlock me){ + public static void setTier(int tier,Object me){ try{ Field field=GT_MetaTileEntity_TieredMachineBlock.class.getField("mTier"); field.setAccessible(true); field.set(me,(byte)tier); }catch (Exception e){ - e.printStackTrace(); + //e.printStackTrace(); } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index a735213915..78f96a6901 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -980,22 +980,22 @@ public class DreamCraftRecipeLoader implements Runnable { } private void register_machine_EM_behaviours(){ - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(5),ItemList.Machine_IV_Centrifuge.get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(6),getItemContainer("CentrifugeLuV").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(7),getItemContainer("CentrifugeZPM").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(8),getItemContainer("CentrifugeUV").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(9),getItemContainer("CentrifugeUHV").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(10),getItemContainer("CentrifugeUEV").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(11),getItemContainer("CentrifugeUIV").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_Centrifuge(12),getItemContainer("CentrifugeUMV").get(1)); - - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(5),ItemList.Machine_IV_ElectromagneticSeparator.get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(6),getItemContainer("ElectromagneticSeparatorLuV").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(7),getItemContainer("ElectromagneticSeparatorZPM").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(8),getItemContainer("ElectromagneticSeparatorUV").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(9),getItemContainer("ElectromagneticSeparatorUHV").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(10),getItemContainer("ElectromagneticSeparatorUEV").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(11),getItemContainer("ElectromagneticSeparatorUIV").get(1)); - GT_MetaTileEntity_EM_machine.registerBehaviour(new Behaviour_ElectromagneticSeparator(12),getItemContainer("ElectromagneticSeparatorUMV").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(5),ItemList.Machine_IV_Centrifuge.get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(6),getItemContainer("CentrifugeLuV").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(7),getItemContainer("CentrifugeZPM").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(8),getItemContainer("CentrifugeUV").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(9),getItemContainer("CentrifugeUHV").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(10),getItemContainer("CentrifugeUEV").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(11),getItemContainer("CentrifugeUIV").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(12),getItemContainer("CentrifugeUMV").get(1)); + + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(5),ItemList.Machine_IV_ElectromagneticSeparator.get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(6),getItemContainer("ElectromagneticSeparatorLuV").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(7),getItemContainer("ElectromagneticSeparatorZPM").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(8),getItemContainer("ElectromagneticSeparatorUV").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(9),getItemContainer("ElectromagneticSeparatorUHV").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(10),getItemContainer("ElectromagneticSeparatorUEV").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(11),getItemContainer("ElectromagneticSeparatorUIV").get(1)); + GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(12),getItemContainer("ElectromagneticSeparatorUMV").get(1)); } } -- cgit From a3630d5d45ef3198f2548150bbb8d500865e438c Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 11 Mar 2019 06:53:41 +0100 Subject: tweak gui --- build.gradle | 8 ++-- .../tectech/loader/thing/MachineLoader.java | 7 --- .../tectech/thing/item/ParametrizerMemoryCard.java | 44 +++++++----------- .../hatch/GT_MetaTileEntity_Hatch_Param.java | 48 ++++++++++---------- .../hatch/gui/GT_Container_Param.java | 40 ++++++++--------- .../hatch/gui/GT_Container_ParamAdv.java | 48 ++++++++++---------- .../hatch/gui/GT_GUIContainer_Param.java | 3 +- .../hatch/gui/GT_GUIContainer_ParamAdv.java | 3 +- .../multi/GT_MetaTileEntity_EM_junction.java | 6 ++- .../multi/GT_MetaTileEntity_EM_scanner.java | 3 +- .../multi/GT_MetaTileEntity_EM_switch.java | 6 ++- .../multi/GT_MetaTileEntity_TM_microwave.java | 2 +- .../multi/base/GT_Container_MultiMachineEM.java | 52 +++++++--------------- .../multi/base/GT_GUIContainer_MultiMachineEM.java | 15 +++---- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 26 +++++------ .../metaTileEntity/multi/base/HatchAdder.java | 6 +-- .../metaTileEntity/multi/base/NameFunction.java | 5 +-- .../metaTileEntity/multi/base/Parameters.java | 10 +++++ .../metaTileEntity/multi/base/StatusFunction.java | 5 +-- .../em_machine/GT_MetaTileEntity_EM_machine.java | 6 ++- 20 files changed, 155 insertions(+), 188 deletions(-) diff --git a/build.gradle b/build.gradle index 6fccbe64e8..3933a94c35 100644 --- a/build.gradle +++ b/build.gradle @@ -91,10 +91,10 @@ task getGregTech(type: Download) { mustRunAfter "repackMinecraft" } -tasks.setupCIWorkspace.dependsOn getGregTech -tasks.setupDevWorkspace.dependsOn getGregTech -tasks.setupDecompWorkspace.dependsOn getGregTech -tasks.compileJava.dependsOn getGregTech +//tasks.setupCIWorkspace.dependsOn getGregTech +//tasks.setupDevWorkspace.dependsOn getGregTech +//tasks.setupDecompWorkspace.dependsOn getGregTech +//tasks.compileJava.dependsOn getGregTech processResources { diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 0e65aa0b12..9ecb1b6526 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -6,7 +6,6 @@ import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity. import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_essentiaQuantizer; import com.github.technus.tectech.thing.metaTileEntity.hatch.*; import com.github.technus.tectech.thing.metaTileEntity.multi.*; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM; @@ -317,13 +316,7 @@ public class MachineLoader implements Runnable { // MetaTE init // =================================================================================================== - GT_MetaTileEntity_MultiblockBase_EM.run(); GT_MetaTileEntity_Hatch_Rack.run(); - GT_MetaTileEntity_EM_computer.run(); - GT_MetaTileEntity_EM_research.run(); - GT_MetaTileEntity_EM_dataBank.run(); - GT_MetaTileEntity_TM_teslaCoil.run(); - GT_MetaTileEntity_DataReader.run(); if (!Loader.isModLoaded(Reference.DREAMCRAFT)) { diff --git a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java index 25eb3ec939..4d7b451dd2 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java @@ -57,19 +57,13 @@ public final class ParametrizerMemoryCard extends Item { if (aStack.getItemDamage() == 1) { //write to parametrizer parametrizer.param = tNBT.getInteger("param"); - if (parametrizer.setUsingFloats(tNBT.getBoolean("usesFloats"))) { - parametrizer.value0i = (int) Float.intBitsToFloat(tNBT.getInteger("value0i")); - parametrizer.value1i = (int) Float.intBitsToFloat(tNBT.getInteger("value1i")); - } else { - parametrizer.value0i = tNBT.getInteger("value0i"); - parametrizer.value1i = tNBT.getInteger("value1i"); - } + parametrizer.value0D = tNBT.getDouble("value0D"); + parametrizer.value1D = tNBT.getDouble("value1D"); } else { //read from parametrizer tNBT.setInteger("param", parametrizer.param); - tNBT.setBoolean("usesFloats", parametrizer.isUsingFloats()); - tNBT.setInteger("value0i", parametrizer.value0i); - tNBT.setInteger("value1i", parametrizer.value1i); + tNBT.setDouble("value0D", parametrizer.value0D); + tNBT.setDouble("value1D", parametrizer.value1D); } return true; }else if(metaTE instanceof GT_MetaTileEntity_MultiblockBase_EM){ @@ -79,16 +73,10 @@ public final class ParametrizerMemoryCard extends Item { } NBTTagCompound tNBT = aStack.getTagCompound(); if(aStack.getItemDamage()== 1){ - //write to base - if(tNBT.getBoolean("usesFloats")){ - base.setParameterPairIn_ClearOut(tNBT.getInteger("param"),true - ,Float.intBitsToFloat(tNBT.getInteger("value0i")) - ,Float.intBitsToFloat(tNBT.getInteger("value1i"))); - }else{ - base.setParameterPairIn_ClearOut(tNBT.getInteger("param"),false - ,tNBT.getInteger("value0i") - ,tNBT.getInteger("value1i")); - } + base.parametrization.trySetParameters( + tNBT.getInteger("param"), + tNBT.getDouble("value0D"), + tNBT.getDouble("value1D")); return true; } } @@ -125,17 +113,15 @@ public final class ParametrizerMemoryCard extends Item { } aList.add(EnumChatFormatting.BLUE + "Sneak right click to lock/unlock"); - int temp; + long temp; if(tNBT!=null && tNBT.hasKey("param")) { aList.add("ParameterGroup ID: "+EnumChatFormatting.AQUA + tNBT.getInteger("param")); - temp=tNBT.getInteger("value0i"); - aList.add("Value 0|I: "+EnumChatFormatting.AQUA + temp); - aList.add("Value 0|F: "+EnumChatFormatting.AQUA + Float.intBitsToFloat(temp)); - aList.add("Value 0|B: "+EnumChatFormatting.AQUA + Util.intBitsToShortString(temp)); - temp=tNBT.getInteger("value1i"); - aList.add("Value 1|I: "+EnumChatFormatting.AQUA + temp); - aList.add("Value 1|F: "+EnumChatFormatting.AQUA + Float.intBitsToFloat(temp)); - aList.add("Value 1|B: "+EnumChatFormatting.AQUA + Util.intBitsToShortString(temp)); + temp=tNBT.getInteger("value0D"); + aList.add("Value 0D: "+EnumChatFormatting.AQUA + temp); + aList.add("Value 0B: "+EnumChatFormatting.AQUA + Util.longBitsToShortString(Double.doubleToLongBits(temp))); + temp=tNBT.getInteger("value1D"); + aList.add("Value 1D: "+EnumChatFormatting.AQUA + temp); + aList.add("Value 1B: "+EnumChatFormatting.AQUA + Util.longBitsToShortString(Double.doubleToLongBits(temp))); aList.add("Uses Floats: "+(tNBT.getBoolean("usesFloats")?EnumChatFormatting.GREEN+"TRUE":EnumChatFormatting.RED+"FALSE")); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java index aa92eb777e..a4a713626c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java @@ -28,10 +28,10 @@ import net.minecraftforge.fluids.FluidStack; public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { public int pointer = 0; public int param = -1; - public double value0i = 0; - public double value1i = 0; - public double input0i = 0; - public double input1i = 0; + public double value0D = 0; + public double value1D = 0; + public double input0D = 0; + public double input1D = 0; private static Textures.BlockIcons.CustomIcon ScreenON; private static Textures.BlockIcons.CustomIcon ScreenOFF; @@ -106,10 +106,10 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { public String[] getInfoData() { return new String[]{ "Parametrizer ID: " + EnumChatFormatting.GREEN + param, - "Value 0I: " + EnumChatFormatting.AQUA + value0i, - "Value 1I: " + EnumChatFormatting.BLUE + value1i, - "Input 0I: " + EnumChatFormatting.GOLD + input0i, - "Input 1I: " + EnumChatFormatting.YELLOW + input1i, + "Value 0D: " + EnumChatFormatting.AQUA + value0D, + "Value 1D: " + EnumChatFormatting.BLUE + value1D, + "Input 0D: " + EnumChatFormatting.GOLD + input0D, + "Input 1D: " + EnumChatFormatting.YELLOW + input1D, }; } @@ -132,10 +132,10 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setInteger("ePointer", pointer); - aNBT.setDouble("eDValue0i", value0i); - aNBT.setDouble("eDValue1i", value1i); - aNBT.setDouble("eDInput0i", input0i); - aNBT.setDouble("eDInput1i", input1i); + aNBT.setDouble("eValue0D", value0D); + aNBT.setDouble("eValue1D", value1D); + aNBT.setDouble("eInput0D", input0D); + aNBT.setDouble("eInput1D", input1D); aNBT.setInteger("eParam", param); } @@ -150,21 +150,21 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { aNBT.hasKey("eInput1i")){ boolean usesFloat = aNBT.getBoolean("eFloats"); if(usesFloat){ - value0i=Float.intBitsToFloat(aNBT.getInteger("eValue0i")); - value1i=Float.intBitsToFloat(aNBT.getInteger("eValue1i")); - input0i=Float.intBitsToFloat(aNBT.getInteger("eInput0i")); - input1i=Float.intBitsToFloat(aNBT.getInteger("eInput1i")); + value0D=Float.intBitsToFloat(aNBT.getInteger("eValue0i")); + value1D=Float.intBitsToFloat(aNBT.getInteger("eValue1i")); + input0D=Float.intBitsToFloat(aNBT.getInteger("eInput0i")); + input1D=Float.intBitsToFloat(aNBT.getInteger("eInput1i")); }else { - value0i=aNBT.getInteger("eValue0i"); - value1i=aNBT.getInteger("eValue1i"); - input0i=aNBT.getInteger("eInput0i"); - input1i=aNBT.getInteger("eInput1i"); + value0D=aNBT.getInteger("eValue0i"); + value1D=aNBT.getInteger("eValue1i"); + input0D=aNBT.getInteger("eInput0i"); + input1D=aNBT.getInteger("eInput1i"); } }else{ - value0i=aNBT.getDouble("eDValue0i"); - value1i=aNBT.getDouble("eDValue1i"); - input0i=aNBT.getDouble("eDInput0i"); - input1i=aNBT.getDouble("eDInput1i"); + value0D=aNBT.getDouble("eValue0D"); + value1D=aNBT.getDouble("eValue1D"); + input0D=aNBT.getDouble("eInput0D"); + input1D=aNBT.getDouble("eInput1D"); } param = aNBT.getInteger("eParam"); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java index db0c2d501f..f9c53090ff 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java @@ -62,53 +62,53 @@ public class GT_Container_Param extends GT_ContainerMetaTile_Machine { paramH.param -= aShifthold == 1 ? 16 : 4; break; case 1: - paramH.value0i -= aShifthold == 1 ? 4096 : 256; + paramH.value0D -= aShifthold == 1 ? 4096 : 256; break; case 2: - paramH.value1i -= aShifthold == 1 ? 4096 : 256; + paramH.value1D -= aShifthold == 1 ? 4096 : 256; break; case 3: - paramH.value0i /= aShifthold == 1 ? 4096 : 256; - paramH.value1i /= aShifthold == 1 ? 4096 : 256; + paramH.value0D /= aShifthold == 1 ? 4096 : 256; + paramH.value1D /= aShifthold == 1 ? 4096 : 256; break; case 4: paramH.param -= aShifthold == 1 ? 2 : 1; break; case 5: - paramH.value0i -= aShifthold == 1 ? 16 : 1; + paramH.value0D -= aShifthold == 1 ? 16 : 1; break; case 6: - paramH.value1i -= aShifthold == 1 ? 16 : 1; + paramH.value1D -= aShifthold == 1 ? 16 : 1; break; case 7: - paramH.value0i /= aShifthold == 1 ? 16 : 2; - paramH.value1i /= aShifthold == 1 ? 16 : 2; + paramH.value0D /= aShifthold == 1 ? 16 : 2; + paramH.value1D /= aShifthold == 1 ? 16 : 2; break; case 8: paramH.param += aShifthold == 1 ? 16 : 4; break; case 9: - paramH.value0i += aShifthold == 1 ? 4096 : 256; + paramH.value0D += aShifthold == 1 ? 4096 : 256; break; case 10: - paramH.value1i += aShifthold == 1 ? 4096 : 256; + paramH.value1D += aShifthold == 1 ? 4096 : 256; break; case 11: - paramH.value0i *= aShifthold == 1 ? 4096 : 256; - paramH.value1i *= aShifthold == 1 ? 4096 : 256; + paramH.value0D *= aShifthold == 1 ? 4096 : 256; + paramH.value1D *= aShifthold == 1 ? 4096 : 256; break; case 12: paramH.param += aShifthold == 1 ? 2 : 1; break; case 13: - paramH.value0i += aShifthold == 1 ? 16 : 1; + paramH.value0D += aShifthold == 1 ? 16 : 1; break; case 14: - paramH.value1i += aShifthold == 1 ? 16 : 1; + paramH.value1D += aShifthold == 1 ? 16 : 1; break; case 15: - paramH.value0i *= aShifthold == 1 ? 16 : 2; - paramH.value1i *= aShifthold == 1 ? 16 : 2; + paramH.value0D *= aShifthold == 1 ? 16 : 2; + paramH.value1D *= aShifthold == 1 ? 16 : 2; break; default: doStuff = false; @@ -133,10 +133,10 @@ public class GT_Container_Param extends GT_ContainerMetaTile_Machine { return; } param = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).param; - value0f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).value0i; - value1f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).value1i; - input0f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).input0i; - input1f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).input1i; + value0f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).value0D; + value1f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).value1D; + input0f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).input0D; + input1f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).input1D; for (Object crafter : crafters) { ICrafting var1 = (ICrafting) crafter; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java index 6b1e4f68cd..3ce8b59fd0 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java @@ -81,19 +81,19 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { case 3: if (aShifthold == 1) { if (secondRow) { - paramH.value1i = Double.longBitsToDouble(0xFFFF_FFFF_FFFF_FFFFL); + paramH.value1D = Double.longBitsToDouble(0xFFFF_FFFF_FFFF_FFFFL); } else { - paramH.value0i = Double.longBitsToDouble(0xFFFF_FFFF_FFFF_FFFFL); + paramH.value0D = Double.longBitsToDouble(0xFFFF_FFFF_FFFF_FFFFL); } } else { if (secondRow) { - long temp=Double.doubleToLongBits(paramH.value1i); + long temp=Double.doubleToLongBits(paramH.value1D); temp |= 1 << columnPointer; - paramH.value1i=Double.longBitsToDouble(temp); + paramH.value1D=Double.longBitsToDouble(temp); } else { - long temp=Double.doubleToLongBits(paramH.value0i); + long temp=Double.doubleToLongBits(paramH.value0D); temp |= 1 << columnPointer; - paramH.value0i=Double.longBitsToDouble(temp); + paramH.value0D=Double.longBitsToDouble(temp); } } break; @@ -117,19 +117,19 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { case 7: if (aShifthold == 1) { if (secondRow) { - paramH.value1i = Double.longBitsToDouble(0); + paramH.value1D = Double.longBitsToDouble(0); } else { - paramH.value0i = Double.longBitsToDouble(0); + paramH.value0D = Double.longBitsToDouble(0); } } else { if (secondRow) { - long temp=Double.doubleToLongBits(paramH.value1i); + long temp=Double.doubleToLongBits(paramH.value1D); temp &= ~(1 << columnPointer); - paramH.value1i=Double.longBitsToDouble(temp); + paramH.value1D=Double.longBitsToDouble(temp); } else { - long temp=Double.doubleToLongBits(paramH.value0i); + long temp=Double.doubleToLongBits(paramH.value0D); temp &= ~(1 << columnPointer); - paramH.value0i=Double.longBitsToDouble(temp); + paramH.value0D=Double.longBitsToDouble(temp); } } break; @@ -151,8 +151,8 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { } break; case 11: - paramH.value0i=paramH.input0i; - paramH.value1i=paramH.input1i; + paramH.value0D=paramH.input0D; + paramH.value1D=paramH.input1D; break; case 12: paramH.param += aShifthold == 1 ? 2 : 1; @@ -174,19 +174,19 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { case 15: if (aShifthold == 1) { if (secondRow) { - paramH.value1i = Double.longBitsToDouble(~Double.doubleToLongBits(paramH.value1i)); + paramH.value1D = Double.longBitsToDouble(~Double.doubleToLongBits(paramH.value1D)); } else { - paramH.value0i = Double.longBitsToDouble(~Double.doubleToLongBits(paramH.value1i)); + paramH.value0D = Double.longBitsToDouble(~Double.doubleToLongBits(paramH.value1D)); } } else { if (secondRow) { - long temp=Double.doubleToLongBits(paramH.value1i); + long temp=Double.doubleToLongBits(paramH.value1D); temp ^= 1 << columnPointer; - paramH.value1i=Double.longBitsToDouble(temp); + paramH.value1D=Double.longBitsToDouble(temp); } else { - long temp=Double.doubleToLongBits(paramH.value0i); + long temp=Double.doubleToLongBits(paramH.value0D); temp ^= 1 << columnPointer; - paramH.value0i=Double.longBitsToDouble(temp); + paramH.value0D=Double.longBitsToDouble(temp); } } break; @@ -219,10 +219,10 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { return; } param = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).param; - value0f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).value0i; - value1f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).value1i; - input0f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).input0i; - input1f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).input1i; + value0f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).value0D; + value1f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).value1D; + input0f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).input0D; + input1f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).input1D; pointer = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).pointer; for (Object crafter : crafters) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java index 9b8f818da8..6547097257 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java @@ -25,10 +25,11 @@ public class GT_GUIContainer_Param extends GT_GUIContainerMetaTile_Machine { proxy.renderUnicodeString("\u2460\u2b07" + String.format(locale, "%+.5E", ((GT_Container_Param) mContainer).input1f), 46, 24, 167, 0x00ffff); proxy.renderUnicodeString("\u24EA\u2b06" + String.format(locale, "%+.5E", ((GT_Container_Param) mContainer).value0f), 46, 33, 167, 0x00bbff); proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+.5E", ((GT_Container_Param) mContainer).value1f), 46, 41, 167, 0x0077ff); + GL11.glPushMatrix(); GL11.glScalef(.5f,.5f,.5f); proxy.renderUnicodeString("\u24EA\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_Param) mContainer).value0f)), 46*2, 50*2, 167*2, 0x00bbff); proxy.renderUnicodeString("\u2460\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_Param) mContainer).value1f)), 46*2, 58*2, 167*2, 0x0077ff); - GL11.glScalef(1,1,1); + GL11.glPopMatrix(); } else { proxy.renderUnicodeString("Parameters", 46, 7, 167, 0xffffff); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java index 541c8323b1..7482d0a38c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java @@ -25,10 +25,11 @@ public class GT_GUIContainer_ParamAdv extends GT_GUIContainerMetaTile_Machine { proxy.renderUnicodeString("\u2460\u2b07" + String.format(locale, "%+.5E", (((GT_Container_ParamAdv) mContainer).input1f)), 46, 24, 167, 0x00ffff); proxy.renderUnicodeString("\u24EA\u2b06" + String.format(locale, "%+.5E", (((GT_Container_ParamAdv) mContainer).value0f)), 46, 33, 167, 0x00bbff); proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+.5E", (((GT_Container_ParamAdv) mContainer).value1f)), 46, 41, 167, 0x0077ff); + GL11.glPushMatrix(); GL11.glScalef(.5f,.5f,.5f); proxy.renderUnicodeString("\u24EA\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_ParamAdv) mContainer).value0f)), 46*2, 50*2, 167*2, 0x00bbff); proxy.renderUnicodeString("\u2460\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_ParamAdv) mContainer).value1f)), 46*2, 58*2, 167*2, 0x0077ff); - GL11.glScalef(1,1,1); + GL11.glPopMatrix(); proxy.renderUnicodeString("Pointer " + Integer.toHexString(((GT_Container_ParamAdv) mContainer).pointer | 0x10000).substring(1), 46, 66, 167, 0x0033ff); } else { proxy.renderUnicodeString("Parameters X", 46, 7, 167, 0xffffff); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index d78ed3cbc4..c1248820b3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -81,8 +81,8 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB } return STATUS_NEUTRAL; }; - protected Parameters.Group.ParameterIn[] src=new Parameters.Group.ParameterIn[10]; - protected Parameters.Group.ParameterIn[] dst=new Parameters.Group.ParameterIn[10]; + protected Parameters.Group.ParameterIn[] src; + protected Parameters.Group.ParameterIn[] dst; //endregion public GT_MetaTileEntity_EM_junction(int aID, String aName, String aNameRegional) { @@ -95,6 +95,8 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override protected void parametersInstantiation_EM() { + src=new Parameters.Group.ParameterIn[10]; + dst=new Parameters.Group.ParameterIn[10]; for (int i = 0; i < 10; i++) { Parameters.Group hatch = parametrization.getGroup(i); src[i] = hatch.makeInParameter(0, i, ROUTE_NAME, SRC_STATUS); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java index d7cf3303f3..2461fc5534 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java @@ -77,7 +77,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa if(v<0) return LedStatus.STATUS_TOO_LOW; return LedStatus.STATUS_OK; }; - protected Parameters.Group.ParameterIn[] scanConfiguration=new Parameters.Group.ParameterIn[20]; + protected Parameters.Group.ParameterIn[] scanConfiguration; //endregion //region structure @@ -122,6 +122,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override protected void parametersInstantiation_EM() { + scanConfiguration=new Parameters.Group.ParameterIn[20]; for (int i = 0; i < 10; i++) { Parameters.Group hatch = parametrization.getGroup(i); scanConfiguration[i*2] = hatch.makeInParameter(0, 0, CONFIG_NAME, CONFIG_STATUS); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index e5bcb3f75d..276d0f2f74 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -77,8 +77,8 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } return STATUS_NEUTRAL; }; - protected Parameters.Group.ParameterIn[] dst=new Parameters.Group.ParameterIn[10]; - protected Parameters.Group.ParameterIn[] weight =new Parameters.Group.ParameterIn[10]; + protected Parameters.Group.ParameterIn[] dst; + protected Parameters.Group.ParameterIn[] weight; //endregion public GT_MetaTileEntity_EM_switch(int aID, String aName, String aNameRegional) { @@ -91,6 +91,8 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas @Override protected void parametersInstantiation_EM() { + dst=new Parameters.Group.ParameterIn[10]; + weight =new Parameters.Group.ParameterIn[10]; for (int i = 0; i < 10; i++) { Parameters.Group hatch = parametrization.getGroup(i); dst[i] = hatch.makeInParameter(0, i, ROUTE_NAME, DST_STATUS); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 4456f97130..7894a7fa37 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -92,7 +92,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock powerSetting=hatch_0.makeInParameter(0,1000, POWER_NAME,POWER_STATUS); timerSetting=hatch_0.makeInParameter(1,360, TIMER_SETTING_NAME,TIMER_STATUS); timerValue=hatch_0.makeOutParameter(0,0,TIMER_VALUE_NAME,TIMER_STATUS); - remainingTime=hatch_0.makeOutParameter(0,360,TIMER_REMAINING_NAME,TIMER_STATUS); + remainingTime=hatch_0.makeOutParameter(1,360,TIMER_REMAINING_NAME,TIMER_STATUS); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java index bd2c20b2bc..ea22e3c23c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.Util; import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.gui.GT_Slot_Holo; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -10,15 +11,12 @@ import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import java.util.BitSet; - public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { public LedStatus[] eParamsInStatus = LedStatus.makeArray(20,LedStatus.STATUS_UNDEFINED); public LedStatus[] eParamsOutStatus = LedStatus.makeArray(20,LedStatus.STATUS_UNDEFINED); - public int[] eParamsIn = new int[20];//number I from parametrizers - public int[] eParamsOut = new int[20];//number O to parametrizers + public double[] eParamsIn = new double[20];//number I from parametrizers + public double[] eParamsOut = new double[20];//number O to parametrizers public byte eCertainMode = 5, eCertainStatus = 127; - public short eParamsAreFloats; public boolean ePowerPass = false, eSafeVoid = false, allowedToWork = false; public final boolean ePowerPassButton, eSafeVoidButton, allowedToWorkButton; @@ -113,9 +111,8 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { } eParamsInStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).parametrization.eParamsInStatus; eParamsOutStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).parametrization.eParamsOutStatus; - int[] iParamsIn= ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).parametrization.iParamsIn; - int[] iParamsOut= ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).parametrization.iParamsOut; - eParamsAreFloats=((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).parametrization.bParamsAreFloats; + eParamsIn= ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).parametrization.iParamsIn; + eParamsOut= ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).parametrization.iParamsOut; eCertainMode = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eCertainMode; eCertainStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eCertainStatus; ePowerPass = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).ePowerPass; @@ -124,31 +121,14 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { for (Object crafter : crafters) { ICrafting var1 = (ICrafting) crafter; - int i = 100; - for (int j = 0; j < eParamsInStatus.length; j++) { + for (int i=100, j = 0; j < eParamsInStatus.length; j++) { var1.sendProgressBarUpdate(this, i++, (eParamsInStatus[j].getOrdinalByte() | (eParamsOutStatus[j].getOrdinalByte() << 8))); } var1.sendProgressBarUpdate(this, 120, eCertainMode | (eCertainStatus << 8)); var1.sendProgressBarUpdate(this, 121, (ePowerPass ? 1 : 0) + (eSafeVoid ? 2 : 0) + (allowedToWork ? 4 : 0)); - var1.sendProgressBarUpdate(this,122,eParamsAreFloats); - i=130; - for(int j=0;j>>16); - } - for(int j=0;j>>16); + for(int i=124,k=204,j=0;j<20;j++,i+=4,k+=4) { + Util.sendDouble(eParamsOut[j], this, var1, i); + Util.sendDouble(eParamsIn[j], this, var1, k); } } } @@ -169,14 +149,12 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { ePowerPass = (par2 & 1) == 1; eSafeVoid = (par2 & 2) == 2; allowedToWork = (par2 & 4) == 4; - } else if (par1 == 122) { - eParamsAreFloats=(short) par2; - }else if(par1>=130 && par1<170){ - int pointer=(par1-130)>>1; - eParamsOut[pointer]=(par1&1)==0?eParamsOut[pointer]&0xFFFF0000|par2:eParamsOut[pointer]&0xFFFF|(par2<<16); - }else if(par1>=170 && par1<210){ - int pointer=(par1-170)>>1; - eParamsIn[pointer]=(par1&1)==0?eParamsIn[pointer]&0xFFFF0000|par2:eParamsIn[pointer]&0xFFFF|(par2<<16); + } else if(par1>=130 && par1<210){ + int pos=(par1-130)>>2; + eParamsIn[pos]=Util.receiveDouble(eParamsIn[pos],par1&0xFFFFFFFC,par1,par2); + }else if(par1>=210 && par1<290){ + int pos=(par1-210)>>2; + eParamsIn[pos]=Util.receiveDouble(eParamsIn[pos],par1&0xFFFFFFFC,par1,par2); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java index 47a3d60a0a..94e2d0af8d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java @@ -12,8 +12,6 @@ import org.lwjgl.opengl.GL12; import java.util.List; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM.*; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_UNUSED; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; /** @@ -281,7 +279,6 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach IMetaTileEntity mte=mContainer.mTileEntity.getMetaTileEntity(); if(mte instanceof GT_MetaTileEntity_MultiblockBase_EM){ Parameters parametrization=((GT_MetaTileEntity_MultiblockBase_EM)mte).parametrization; - parametrization.bParamsAreFloats=mContainer.eParamsAreFloats; parametrization.eParamsInStatus=mContainer.eParamsInStatus; parametrization.eParamsOutStatus=mContainer.eParamsOutStatus; parametrization.iParamsIn=mContainer.eParamsIn; @@ -293,15 +290,15 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach for(int param=0;param<2;param++){ if(x<(u+=su)){ if(y=v && y {} +public interface HatchAdder{ + Boolean apply(IGregTechTileEntity iGregTechTileEntity, Short aShort); +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/NameFunction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/NameFunction.java index 8ced431576..a296600abf 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/NameFunction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/NameFunction.java @@ -1,8 +1,5 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; -import java.util.function.BiFunction; - -public interface NameFunction extends BiFunction { - @Override +public interface NameFunction{ String apply(T t, Parameters.IParameter iParameter); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java index 2e8959c00f..8a0fca3d09 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java @@ -34,6 +34,16 @@ public class Parameters { this.parent=parent; } + public boolean trySetParameters(int hatch,double parameter0,double parameter1){ + Group p=groups[hatch]; + if(parent.mMaxProgresstime<=0 || (p!=null && p.updateWhileRunning)){ + iParamsIn[hatch]=parameter0; + iParamsIn[hatch+10]=parameter1; + return true; + } + return false; + } + public void setToDefaults(int hatch,boolean defaultIn, boolean defaultOut) { Group p= groups[hatch]; if (p == null) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/StatusFunction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/StatusFunction.java index 224f0fc47c..e285c75344 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/StatusFunction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/StatusFunction.java @@ -1,8 +1,5 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; -import java.util.function.BiFunction; - -public interface StatusFunction extends BiFunction { - @Override +public interface StatusFunction{ LedStatus apply(T t, Parameters.IParameter iParameter); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java index 1ef3705b50..c29da7208a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java @@ -63,8 +63,8 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa //endregion //region parameters - protected Parameters.Group.ParameterIn[] inputMux=new Parameters.Group.ParameterIn[6]; - protected Parameters.Group.ParameterIn[] outputMux=new Parameters.Group.ParameterIn[6]; + protected Parameters.Group.ParameterIn[] inputMux; + protected Parameters.Group.ParameterIn[] outputMux; private static final StatusFunction SRC_STATUS = (base,p)-> { double v = p.get(); @@ -118,6 +118,8 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override protected void parametersInstantiation_EM() { + inputMux=new Parameters.Group.ParameterIn[6]; + outputMux=new Parameters.Group.ParameterIn[6]; for (int i=0;i<6;i++){ Parameters.Group hatch=parametrization.getGroup(i); inputMux[i]=hatch.makeInParameter(0,i,ROUTE_NAME,SRC_STATUS); -- cgit From 586ff231000d80b44382b40abfef53eaece76d24 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 11 Mar 2019 06:53:52 +0100 Subject: tweak gui --- .../tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java | 4 ++-- .../thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java index 6547097257..015c3742cd 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java @@ -27,8 +27,8 @@ public class GT_GUIContainer_Param extends GT_GUIContainerMetaTile_Machine { proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+.5E", ((GT_Container_Param) mContainer).value1f), 46, 41, 167, 0x0077ff); GL11.glPushMatrix(); GL11.glScalef(.5f,.5f,.5f); - proxy.renderUnicodeString("\u24EA\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_Param) mContainer).value0f)), 46*2, 50*2, 167*2, 0x00bbff); - proxy.renderUnicodeString("\u2460\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_Param) mContainer).value1f)), 46*2, 58*2, 167*2, 0x0077ff); + proxy.renderUnicodeString("\u24EA\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_Param) mContainer).value0f)), 92, 100, 334, 0x00bbff); + proxy.renderUnicodeString("\u2460\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_Param) mContainer).value1f)), 92, 116, 334, 0x0077ff); GL11.glPopMatrix(); } else { proxy.renderUnicodeString("Parameters", 46, 7, 167, 0xffffff); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java index 7482d0a38c..0e89e00303 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java @@ -27,8 +27,8 @@ public class GT_GUIContainer_ParamAdv extends GT_GUIContainerMetaTile_Machine { proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+.5E", (((GT_Container_ParamAdv) mContainer).value1f)), 46, 41, 167, 0x0077ff); GL11.glPushMatrix(); GL11.glScalef(.5f,.5f,.5f); - proxy.renderUnicodeString("\u24EA\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_ParamAdv) mContainer).value0f)), 46*2, 50*2, 167*2, 0x00bbff); - proxy.renderUnicodeString("\u2460\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_ParamAdv) mContainer).value1f)), 46*2, 58*2, 167*2, 0x0077ff); + proxy.renderUnicodeString("\u24EA\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_ParamAdv) mContainer).value0f)), 92, 100, 334, 0x00bbff); + proxy.renderUnicodeString("\u2460\u2b06" + Util.longBitsToShortString(Double.doubleToLongBits(((GT_Container_ParamAdv) mContainer).value1f)), 92, 116, 334, 0x0077ff); GL11.glPopMatrix(); proxy.renderUnicodeString("Pointer " + Integer.toHexString(((GT_Container_ParamAdv) mContainer).pointer | 0x10000).substring(1), 46, 66, 167, 0x0033ff); } else { -- cgit From d43febcd60496a05d24e60d4004b4d87308dd6f4 Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 11 Mar 2019 18:22:22 +0100 Subject: remove cast --- .../metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java index 7d063c5931..b91d932ebd 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java @@ -515,7 +515,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt "Energy Hatches:", EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", - (mEUt*(double)eAmpereFlow <= 0 ? "Probably uses: " : "Probably makes: ") + + (mEUt*eAmpereFlow <= 0 ? "Probably uses: " : "Probably makes: ") + EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t at " + EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", "Tier Rating: " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + -- cgit From 212ae6295324b48980702d9098ea5e727802955d Mon Sep 17 00:00:00 2001 From: Tec Date: Mon, 11 Mar 2019 18:43:36 +0100 Subject: fix dis --- .../dreamcraft/DreamCraftRecipeLoader.java | 2 +- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 2 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 2 +- .../tectech/loader/thing/MachineLoader.java | 148 ++++++++++----------- .../thing/item/ConstructableTriggerItem.java | 2 +- .../tectech/thing/item/ParametrizerMemoryCard.java | 2 +- .../hatch/GT_MetaTileEntity_Hatch_Capacitor.java | 2 +- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 2 +- .../hatch/GT_MetaTileEntity_Hatch_Holder.java | 2 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 2 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 2 +- .../multi/GT_MetaTileEntity_EM_research.java | 6 +- .../metaTileEntity/multi/base/Parameters.java | 2 +- 13 files changed, 88 insertions(+), 88 deletions(-) diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index 78f96a6901..73aef326b7 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -716,7 +716,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(9216)}, ItemList.Field_Generator_UEV.get(1L), 4000, 800000); - //UHV Energy ParameterGroup + //UHV Energy Hatch TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Energy_UV.get(1L), 24000, 16, 50000, 2, new Object[]{ ItemList.Hull_MAX.get(1L), diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index 96230201ba..6cec48c41f 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -56,7 +56,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ private static final String[] description = new String[]{ EnumChatFormatting.AQUA+"Hint Details:", "1 - Classic Hatches or High Power Casing", - "2 - Elemental Input ParameterGroup", + "2 - Elemental Input Hatch", "3 - Elemental Overflow Hatches or Elemental Casing", "General - Some sort of Essentia Storage", }; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index ba97367cd7..fd56305d5f 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -56,7 +56,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu private static final String[] description = new String[]{ EnumChatFormatting.AQUA+"Hint Details:", "1 - Classic Hatches or High Power Casing", - "2 - Elemental Output ParameterGroup", + "2 - Elemental Output Hatch", "3 - Elemental Overflow Hatches or Elemental Casing", "General - Some sort of Essentia Storage", }; diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 9ecb1b6526..86b3beac8d 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -25,133 +25,133 @@ public class MachineLoader implements Runnable { // =================================================================================================== eM_in_UV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15000, "hatch.emin.tier.08", "UV Elemental Input ParameterGroup", 8).getStackForm(1L)); + 15000, "hatch.emin.tier.08", "UV Elemental Input Hatch", 8).getStackForm(1L)); eM_in_UHV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15001, "hatch.emin.tier.09", "UHV Elemental Input ParameterGroup", 9).getStackForm(1L)); + 15001, "hatch.emin.tier.09", "UHV Elemental Input Hatch", 9).getStackForm(1L)); eM_in_UEV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15002, "hatch.emin.tier.10", "UEV Elemental Input ParameterGroup", 10).getStackForm(1L)); + 15002, "hatch.emin.tier.10", "UEV Elemental Input Hatch", 10).getStackForm(1L)); eM_in_UIV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15003, "hatch.emin.tier.11", "UIV Elemental Input ParameterGroup", 11).getStackForm(1L)); + 15003, "hatch.emin.tier.11", "UIV Elemental Input Hatch", 11).getStackForm(1L)); eM_in_UMV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15004, "hatch.emin.tier.12", "UMV Elemental Input ParameterGroup", 12).getStackForm(1L)); + 15004, "hatch.emin.tier.12", "UMV Elemental Input Hatch", 12).getStackForm(1L)); eM_in_UXV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 15005, "hatch.emin.tier.13", "UXV Elemental Input ParameterGroup", 13).getStackForm(1L)); + 15005, "hatch.emin.tier.13", "UXV Elemental Input Hatch", 13).getStackForm(1L)); // =================================================================================================== // eM OUT // =================================================================================================== eM_out_UV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15010, "hatch.emout.tier.08", "UV Elemental Output ParameterGroup", 8).getStackForm(1L)); + 15010, "hatch.emout.tier.08", "UV Elemental Output Hatch", 8).getStackForm(1L)); eM_out_UHV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15011, "hatch.emout.tier.09", "UHV Elemental Output ParameterGroup", 9).getStackForm(1L)); + 15011, "hatch.emout.tier.09", "UHV Elemental Output Hatch", 9).getStackForm(1L)); eM_out_UEV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15012, "hatch.emout.tier.10", "UEV Elemental Output ParameterGroup", 10).getStackForm(1L)); + 15012, "hatch.emout.tier.10", "UEV Elemental Output Hatch", 10).getStackForm(1L)); eM_out_UIV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15013, "hatch.emout.tier.11", "UIV Elemental Output ParameterGroup", 11).getStackForm(1L)); + 15013, "hatch.emout.tier.11", "UIV Elemental Output Hatch", 11).getStackForm(1L)); eM_out_UMV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15014, "hatch.emout.tier.12", "UMV Elemental Output ParameterGroup", 12).getStackForm(1L)); + 15014, "hatch.emout.tier.12", "UMV Elemental Output Hatch", 12).getStackForm(1L)); eM_out_UXV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 15015, "hatch.emout.tier.13", "UXV Elemental Output ParameterGroup", 13).getStackForm(1L)); + 15015, "hatch.emout.tier.13", "UXV Elemental Output Hatch", 13).getStackForm(1L)); // =================================================================================================== // eM Waste OUT // =================================================================================================== eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15020, "hatch.emmuffler.tier.08", "UV Overflow Output ParameterGroup", 8, 1e10f).getStackForm(1L)); + 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f).getStackForm(1L)); eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output ParameterGroup", 9, 5e10f).getStackForm(1L)); + 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f).getStackForm(1L)); eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output ParameterGroup", 10, 25e10f).getStackForm(1L)); + 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f).getStackForm(1L)); eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output ParameterGroup", 11, 125e10f).getStackForm(1L)); + 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f).getStackForm(1L)); eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output ParameterGroup", 12, 125e11f).getStackForm(1L)); + 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f).getStackForm(1L)); eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output ParameterGroup", 13, 125e12f).getStackForm(1L)); + 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f).getStackForm(1L)); // =================================================================================================== // Multi AMP Power INPUTS // =================================================================================================== eM_energymulti4_IV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15100, "hatch.energymulti04.tier.05", "IV 4A Energy ParameterGroup", 5, 4).getStackForm(1L)); + 15100, "hatch.energymulti04.tier.05", "IV 4A Energy Hatch", 5, 4).getStackForm(1L)); eM_energymulti16_IV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15110, "hatch.energymulti16.tier.05", "IV 16A Energy ParameterGroup", 5, 16).getStackForm(1L)); + 15110, "hatch.energymulti16.tier.05", "IV 16A Energy Hatch", 5, 16).getStackForm(1L)); eM_energymulti64_IV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15120, "hatch.energymulti64.tier.05", "IV 64A Energy ParameterGroup", 5, 64).getStackForm(1L)); + 15120, "hatch.energymulti64.tier.05", "IV 64A Energy Hatch", 5, 64).getStackForm(1L)); eM_energymulti4_LuV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15101, "hatch.energymulti04.tier.06", "LuV 4A Energy ParameterGroup", 6, 4).getStackForm(1L)); + 15101, "hatch.energymulti04.tier.06", "LuV 4A Energy Hatch", 6, 4).getStackForm(1L)); eM_energymulti16_LuV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15111, "hatch.energymulti16.tier.06", "LuV 16A Energy ParameterGroup", 6, 16).getStackForm(1L)); + 15111, "hatch.energymulti16.tier.06", "LuV 16A Energy Hatch", 6, 16).getStackForm(1L)); eM_energymulti64_LuV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15121, "hatch.energymulti64.tier.06", "LuV 64A Energy ParameterGroup", 6, 64).getStackForm(1L)); + 15121, "hatch.energymulti64.tier.06", "LuV 64A Energy Hatch", 6, 64).getStackForm(1L)); eM_energymulti4_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15102, "hatch.energymulti04.tier.07", "ZPM 4A Energy ParameterGroup", 7, 4).getStackForm(1L)); + 15102, "hatch.energymulti04.tier.07", "ZPM 4A Energy Hatch", 7, 4).getStackForm(1L)); eM_energymulti16_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15112, "hatch.energymulti16.tier.07", "ZPM 16A Energy ParameterGroup", 7, 16).getStackForm(1L)); + 15112, "hatch.energymulti16.tier.07", "ZPM 16A Energy Hatch", 7, 16).getStackForm(1L)); eM_energymulti64_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15122, "hatch.energymulti64.tier.07", "ZPM 64A Energy ParameterGroup", 7, 64).getStackForm(1L)); + 15122, "hatch.energymulti64.tier.07", "ZPM 64A Energy Hatch", 7, 64).getStackForm(1L)); eM_energymulti4_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15103, "hatch.energymulti04.tier.08", "UV 4A Energy ParameterGroup", 8, 4).getStackForm(1L)); + 15103, "hatch.energymulti04.tier.08", "UV 4A Energy Hatch", 8, 4).getStackForm(1L)); eM_energymulti16_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15113, "hatch.energymulti16.tier.08", "UV 16A Energy ParameterGroup", 8, 16).getStackForm(1L)); + 15113, "hatch.energymulti16.tier.08", "UV 16A Energy Hatch", 8, 16).getStackForm(1L)); eM_energymulti64_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15123, "hatch.energymulti64.tier.08", "UV 64A Energy ParameterGroup", 8, 64).getStackForm(1L)); + 15123, "hatch.energymulti64.tier.08", "UV 64A Energy Hatch", 8, 64).getStackForm(1L)); eM_energymulti4_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15104, "hatch.energymulti04.tier.09", "UHV 4A Energy ParameterGroup", 9, 4).getStackForm(1L)); + 15104, "hatch.energymulti04.tier.09", "UHV 4A Energy Hatch", 9, 4).getStackForm(1L)); eM_energymulti16_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15114, "hatch.energymulti16.tier.09", "UHV 16A Energy ParameterGroup", 9, 16).getStackForm(1L)); + 15114, "hatch.energymulti16.tier.09", "UHV 16A Energy Hatch", 9, 16).getStackForm(1L)); eM_energymulti64_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15124, "hatch.energymulti64.tier.09", "UHV 64A Energy ParameterGroup", 9, 64).getStackForm(1L)); + 15124, "hatch.energymulti64.tier.09", "UHV 64A Energy Hatch", 9, 64).getStackForm(1L)); eM_energymulti4_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15105, "hatch.energymulti04.tier.10", "UEV 4A Energy ParameterGroup", 10, 4).getStackForm(1L)); + 15105, "hatch.energymulti04.tier.10", "UEV 4A Energy Hatch", 10, 4).getStackForm(1L)); eM_energymulti16_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15115, "hatch.energymulti16.tier.10", "UEV 16A Energy ParameterGroup", 10, 16).getStackForm(1L)); + 15115, "hatch.energymulti16.tier.10", "UEV 16A Energy Hatch", 10, 16).getStackForm(1L)); eM_energymulti64_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15125, "hatch.energymulti64.tier.10", "UEV 64A Energy ParameterGroup", 10, 64).getStackForm(1L)); + 15125, "hatch.energymulti64.tier.10", "UEV 64A Energy Hatch", 10, 64).getStackForm(1L)); eM_energymulti4_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15106, "hatch.energymulti04.tier.11", "UIV 4A Energy ParameterGroup", 11, 4).getStackForm(1L)); + 15106, "hatch.energymulti04.tier.11", "UIV 4A Energy Hatch", 11, 4).getStackForm(1L)); eM_energymulti16_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15116, "hatch.energymulti16.tier.11", "UIV 16A Energy ParameterGroup", 11, 16).getStackForm(1L)); + 15116, "hatch.energymulti16.tier.11", "UIV 16A Energy Hatch", 11, 16).getStackForm(1L)); eM_energymulti64_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15126, "hatch.energymulti64.tier.11", "UIV 64A Energy ParameterGroup", 11, 64).getStackForm(1L)); + 15126, "hatch.energymulti64.tier.11", "UIV 64A Energy Hatch", 11, 64).getStackForm(1L)); eM_energymulti4_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15107, "hatch.energymulti04.tier.12", "UMV 4A Energy ParameterGroup", 12, 4).getStackForm(1L)); + 15107, "hatch.energymulti04.tier.12", "UMV 4A Energy Hatch", 12, 4).getStackForm(1L)); eM_energymulti16_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15117, "hatch.energymulti16.tier.12", "UMV 16A Energy ParameterGroup", 12, 16).getStackForm(1L)); + 15117, "hatch.energymulti16.tier.12", "UMV 16A Energy Hatch", 12, 16).getStackForm(1L)); eM_energymulti64_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15127, "hatch.energymulti64.tier.12", "UMV 64A Energy ParameterGroup", 12, 64).getStackForm(1L)); + 15127, "hatch.energymulti64.tier.12", "UMV 64A Energy Hatch", 12, 64).getStackForm(1L)); eM_energymulti4_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15108, "hatch.energymulti04.tier.13", "UXV 4A Energy ParameterGroup", 13, 4).getStackForm(1L)); + 15108, "hatch.energymulti04.tier.13", "UXV 4A Energy Hatch", 13, 4).getStackForm(1L)); eM_energymulti16_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15118, "hatch.energymulti16.tier.13", "UXV 16A Energy ParameterGroup", 13, 16).getStackForm(1L)); + 15118, "hatch.energymulti16.tier.13", "UXV 16A Energy Hatch", 13, 16).getStackForm(1L)); eM_energymulti64_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15128, "hatch.energymulti64.tier.13", "UXV 64A Energy ParameterGroup", 13, 64).getStackForm(1L)); + 15128, "hatch.energymulti64.tier.13", "UXV 64A Energy Hatch", 13, 64).getStackForm(1L)); // =================================================================================================== // Multi AMP Power OUTPUTS @@ -159,67 +159,67 @@ public class MachineLoader implements Runnable { eM_dynamomulti4_IV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15200, "hatch.dynamomulti04.tier.05", "IV 4A Dynamo ParameterGroup", 5, 4).getStackForm(1L)); + 15200, "hatch.dynamomulti04.tier.05", "IV 4A Dynamo Hatch", 5, 4).getStackForm(1L)); eM_dynamomulti16_IV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15210, "hatch.dynamomulti16.tier.05", "IV 16A Dynamo ParameterGroup", 5, 16).getStackForm(1L)); + 15210, "hatch.dynamomulti16.tier.05", "IV 16A Dynamo Hatch", 5, 16).getStackForm(1L)); eM_dynamomulti64_IV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15220, "hatch.dynamomulti64.tier.05", "IV 64A Dynamo ParameterGroup", 5, 64).getStackForm(1L)); + 15220, "hatch.dynamomulti64.tier.05", "IV 64A Dynamo Hatch", 5, 64).getStackForm(1L)); eM_dynamomulti4_LuV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15201, "hatch.dynamomulti04.tier.06", "LuV 4A Dynamo ParameterGroup", 6, 4).getStackForm(1L)); + 15201, "hatch.dynamomulti04.tier.06", "LuV 4A Dynamo Hatch", 6, 4).getStackForm(1L)); eM_dynamomulti16_LuV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15211, "hatch.dynamomulti16.tier.06", "LuV 16A Dynamo ParameterGroup", 6, 16).getStackForm(1L)); + 15211, "hatch.dynamomulti16.tier.06", "LuV 16A Dynamo Hatch", 6, 16).getStackForm(1L)); eM_dynamomulti64_LuV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15221, "hatch.dynamomulti64.tier.06", "LuV 64A Dynamo ParameterGroup", 6, 64).getStackForm(1L)); + 15221, "hatch.dynamomulti64.tier.06", "LuV 64A Dynamo Hatch", 6, 64).getStackForm(1L)); eM_dynamomulti4_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15202, "hatch.dynamomulti04.tier.07", "ZPM 4A Dynamo ParameterGroup", 7, 4).getStackForm(1L)); + 15202, "hatch.dynamomulti04.tier.07", "ZPM 4A Dynamo Hatch", 7, 4).getStackForm(1L)); eM_dynamomulti16_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15212, "hatch.dynamomulti16.tier.07", "ZPM 16A Dynamo ParameterGroup", 7, 16).getStackForm(1L)); + 15212, "hatch.dynamomulti16.tier.07", "ZPM 16A Dynamo Hatch", 7, 16).getStackForm(1L)); eM_dynamomulti64_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15222, "hatch.dynamomulti64.tier.07", "ZPM 64A Dynamo ParameterGroup", 7, 64).getStackForm(1L)); + 15222, "hatch.dynamomulti64.tier.07", "ZPM 64A Dynamo Hatch", 7, 64).getStackForm(1L)); eM_dynamomulti4_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15203, "hatch.dynamomulti04.tier.08", "UV 4A Dynamo ParameterGroup", 8, 4).getStackForm(1L)); + 15203, "hatch.dynamomulti04.tier.08", "UV 4A Dynamo Hatch", 8, 4).getStackForm(1L)); eM_dynamomulti16_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15213, "hatch.dynamomulti16.tier.08", "UV 16A Dynamo ParameterGroup", 8, 16).getStackForm(1L)); + 15213, "hatch.dynamomulti16.tier.08", "UV 16A Dynamo Hatch", 8, 16).getStackForm(1L)); eM_dynamomulti64_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15223, "hatch.dynamomulti64.tier.08", "UV 64A Dynamo ParameterGroup", 8, 64).getStackForm(1L)); + 15223, "hatch.dynamomulti64.tier.08", "UV 64A Dynamo Hatch", 8, 64).getStackForm(1L)); eM_dynamomulti4_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15204, "hatch.dynamomulti04.tier.09", "UHV 4A Dynamo ParameterGroup", 9, 4).getStackForm(1L)); + 15204, "hatch.dynamomulti04.tier.09", "UHV 4A Dynamo Hatch", 9, 4).getStackForm(1L)); eM_dynamomulti16_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15214, "hatch.dynamomulti16.tier.09", "UHV 16A Dynamo ParameterGroup", 9, 16).getStackForm(1L)); + 15214, "hatch.dynamomulti16.tier.09", "UHV 16A Dynamo Hatch", 9, 16).getStackForm(1L)); eM_dynamomulti64_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15224, "hatch.dynamomulti64.tier.09", "UHV 64A Dynamo ParameterGroup", 9, 64).getStackForm(1L)); + 15224, "hatch.dynamomulti64.tier.09", "UHV 64A Dynamo Hatch", 9, 64).getStackForm(1L)); eM_dynamomulti4_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15205, "hatch.dynamomulti04.tier.10", "UEV 4A Dynamo ParameterGroup", 10, 4).getStackForm(1L)); + 15205, "hatch.dynamomulti04.tier.10", "UEV 4A Dynamo Hatch", 10, 4).getStackForm(1L)); eM_dynamomulti16_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15215, "hatch.dynamomulti16.tier.10", "UEV 16A Dynamo ParameterGroup", 10, 16).getStackForm(1L)); + 15215, "hatch.dynamomulti16.tier.10", "UEV 16A Dynamo Hatch", 10, 16).getStackForm(1L)); eM_dynamomulti64_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15225, "hatch.dynamomulti64.tier.10", "UEV 64A Dynamo ParameterGroup", 10, 64).getStackForm(1L)); + 15225, "hatch.dynamomulti64.tier.10", "UEV 64A Dynamo Hatch", 10, 64).getStackForm(1L)); eM_dynamomulti4_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15206, "hatch.dynamomulti04.tier.11", "UIV 4A Dynamo ParameterGroup", 11, 4).getStackForm(1L)); + 15206, "hatch.dynamomulti04.tier.11", "UIV 4A Dynamo Hatch", 11, 4).getStackForm(1L)); eM_dynamomulti16_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15216, "hatch.dynamomulti16.tier.11", "UIV 16A Dynamo ParameterGroup", 11, 16).getStackForm(1L)); + 15216, "hatch.dynamomulti16.tier.11", "UIV 16A Dynamo Hatch", 11, 16).getStackForm(1L)); eM_dynamomulti64_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15226, "hatch.dynamomulti64.tier.11", "UIV 64A Dynamo ParameterGroup", 11, 64).getStackForm(1L)); + 15226, "hatch.dynamomulti64.tier.11", "UIV 64A Dynamo Hatch", 11, 64).getStackForm(1L)); eM_dynamomulti4_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15207, "hatch.dynamomulti04.tier.12", "UMV 4A Dynamo ParameterGroup", 12, 4).getStackForm(1L)); + 15207, "hatch.dynamomulti04.tier.12", "UMV 4A Dynamo Hatch", 12, 4).getStackForm(1L)); eM_dynamomulti16_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15217, "hatch.dynamomulti16.tier.12", "UMV 16A Dynamo ParameterGroup", 12, 16).getStackForm(1L)); + 15217, "hatch.dynamomulti16.tier.12", "UMV 16A Dynamo Hatch", 12, 16).getStackForm(1L)); eM_dynamomulti64_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15227, "hatch.dynamomulti64.tier.12", "UMV 64A Dynamo ParameterGroup", 12, 64).getStackForm(1L)); + 15227, "hatch.dynamomulti64.tier.12", "UMV 64A Dynamo Hatch", 12, 64).getStackForm(1L)); eM_dynamomulti4_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15208, "hatch.dynamomulti04.tier.13", "UXV 4A Dynamo ParameterGroup", 13, 4).getStackForm(1L)); + 15208, "hatch.dynamomulti04.tier.13", "UXV 4A Dynamo Hatch", 13, 4).getStackForm(1L)); eM_dynamomulti16_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15218, "hatch.dynamomulti16.tier.13", "UXV 16A Dynamo ParameterGroup", 13, 16).getStackForm(1L)); + 15218, "hatch.dynamomulti16.tier.13", "UXV 16A Dynamo Hatch", 13, 16).getStackForm(1L)); eM_dynamomulti64_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15228, "hatch.dynamomulti64.tier.13", "UXV 64A Dynamo ParameterGroup", 13, 64).getStackForm(1L)); + 15228, "hatch.dynamomulti64.tier.13", "UXV 64A Dynamo Hatch", 13, 64).getStackForm(1L)); // =================================================================================================== // MULTIBLOCKS @@ -278,7 +278,7 @@ public class MachineLoader implements Runnable { rack_Hatch.set(new GT_MetaTileEntity_Hatch_Rack(15450, "hatch.rack.tier.08", "Computer Rack", 8, "4 Slot Rack").getStackForm(1L)); holder_Hatch.set(new GT_MetaTileEntity_Hatch_Holder(15451, "hatch.holder.tier.09", "Object Holder", 8, "For Research Station").getStackForm(1L)); - capacitor_Hatch.set(new GT_MetaTileEntity_Hatch_Capacitor(15452, "hatch.capacitor.tier.05", "Capacitor ParameterGroup", 5, "For Tesla Coil").getStackForm(1L)); + capacitor_Hatch.set(new GT_MetaTileEntity_Hatch_Capacitor(15452, "hatch.capacitor.tier.05", "Capacitor Hatch", 5, "For Tesla Coil").getStackForm(1L)); // =================================================================================================== // Pipes @@ -308,7 +308,7 @@ public class MachineLoader implements Runnable { // =================================================================================================== // Debug Stuff // =================================================================================================== - hatch_CreativeMaitenance.set(new GT_MetaTileEntity_Hatch_CreativeMaintenance(15497, "debug.tt.maintenance", "Debug Maintenance ParameterGroup", 15).getStackForm(1L)); + hatch_CreativeMaitenance.set(new GT_MetaTileEntity_Hatch_CreativeMaintenance(15497, "debug.tt.maintenance", "Debug Maintenance Hatch", 15).getStackForm(1L)); Machine_DebugGenny.set(new GT_MetaTileEntity_DebugPowerGenerator(15498, "debug.tt.genny", "Debug Power Generator", 15).getStackForm(1L)); Machine_DebugWriter.set(new GT_MetaTileEntity_DebugStructureWriter(15499, "debug.tt.writer", "Debug Structure Writer", 15).getStackForm(1L)); diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java index cf4b4d2978..efb9e6d644 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java @@ -133,7 +133,7 @@ public final class ConstructableTriggerItem extends Item { private final String[] desc=new String[]{ EnumChatFormatting.AQUA+"Hint Details:", "1 - Classic Hatches or Heat Proof Casing", - "2 - Muffler ParameterGroup", + "2 - Muffler Hatch", "3 - Coil blocks" }; //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java index 4d7b451dd2..dafc425163 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java @@ -115,7 +115,7 @@ public final class ParametrizerMemoryCard extends Item { long temp; if(tNBT!=null && tNBT.hasKey("param")) { - aList.add("ParameterGroup ID: "+EnumChatFormatting.AQUA + tNBT.getInteger("param")); + aList.add("Hatch ID: "+EnumChatFormatting.AQUA + tNBT.getInteger("param")); temp=tNBT.getInteger("value0D"); aList.add("Value 0D: "+EnumChatFormatting.AQUA + temp); aList.add("Value 0B: "+EnumChatFormatting.AQUA + Util.longBitsToShortString(Double.doubleToLongBits(temp))); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java index 560a57cd54..2aae2b8c2b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java @@ -94,7 +94,7 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_Capacitor(aPlayerInventory, aBaseMetaTileEntity, "Capacitor ParameterGroup"); + return new GT_GUIContainer_Capacitor(aPlayerInventory, aBaseMetaTileEntity, "Capacitor Hatch"); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index 63bd262a75..c84057c121 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -259,7 +259,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta mDescription, "Max stacks amount: " + EnumChatFormatting.AQUA + getMaxStacksCount(), "Stack capacity: " + EnumChatFormatting.AQUA + getMaxStackSize(), - "Place Overflow ParameterGroup behind,on top or below", + "Place Overflow Hatch behind,on top or below", "to provide overflow protection while this block", "is not attached to multi block.", "Transport range can be extended in straight", diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java index 0850bf859a..409f8195e2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java @@ -94,7 +94,7 @@ public class GT_MetaTileEntity_Hatch_Holder extends GT_MetaTileEntity_Hatch { @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_Holder(aPlayerInventory, aBaseMetaTileEntity, "Holder ParameterGroup"); + return new GT_GUIContainer_Holder(aPlayerInventory, aBaseMetaTileEntity, "Holder Hatch"); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 5f5febb383..a837c6a0a2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -57,7 +57,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo private static final String[] description = new String[]{ EnumChatFormatting.AQUA + "Hint Details:", "1 - Classic Hatches or High Power Casing", - "2 - Elemental Input ParameterGroup", + "2 - Elemental Input Hatch", "3 - Elemental Overflow Hatches or Molecular Casing", }; //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java index e7a42fa941..381df4b893 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java @@ -63,7 +63,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock private static final String[] description = new String[]{ EnumChatFormatting.AQUA+"Hint Details:", "1 - Classic Hatches or High Power Casing", - "2 - Elemental Output ParameterGroup", + "2 - Elemental Output Hatch", "3 - Elemental Overflow Hatches or Molecular Casing", }; //endregion diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 6b3cab021e..88b24d11ae 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -73,7 +73,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB private static final String[] description = new String[]{ EnumChatFormatting.AQUA+"Hint Details:", "1 - Classic/Data Hatches or Computer casing", - "2 - Holder ParameterGroup", + "2 - Holder Hatch", }; //endregion @@ -286,7 +286,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } for (int i = 0; i < tRecipe.mFluidInputs.length; i++) { if (tRecipe.mFluidInputs[i] != null) { - tNBTList.appendTag(new NBTTagString("Input ParameterGroup " + (i + 1) + ": " + tRecipe.mFluidInputs[i].amount + "L " + GT_LanguageManager.getTranslation(tRecipe.mFluidInputs[i].getLocalizedName()))); + tNBTList.appendTag(new NBTTagString("Input Hatch " + (i + 1) + ": " + tRecipe.mFluidInputs[i].amount + "L " + GT_LanguageManager.getTranslation(tRecipe.mFluidInputs[i].getLocalizedName()))); } } tNBT.setTag("pages", tNBTList); @@ -382,7 +382,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB s = tRecipe.mFluidInputs[i].getLocalizedName(); } } - tNBTList.appendTag(new NBTTagString("Input ParameterGroup "+(i+1)+": "+tRecipe.mFluidInputs[i].amount+"L "+s)); + tNBTList.appendTag(new NBTTagString("Input Hatch "+(i+1)+": "+tRecipe.mFluidInputs[i].amount+"L "+s)); } } tNBT.setTag("pages", tNBTList); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java index 8a0fca3d09..4aba953df6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java @@ -125,7 +125,7 @@ public class Parameters { private Group(int hatchNo, boolean updateWhileRunning){ if(hatchNo<0 || hatchNo>=10){ - throw new IllegalArgumentException("ParameterGroup id must be in 0 to 9 range"); + throw new IllegalArgumentException("Hatch id must be in 0 to 9 range"); } this.hatchNo=hatchNo; this.updateWhileRunning=updateWhileRunning; -- cgit