From 0fd5222f872d63f837eab046bbff34af9d9ea4db Mon Sep 17 00:00:00 2001 From: Technus Date: Sat, 11 Mar 2017 16:48:51 +0100 Subject: bump version, fixed some recipe bugs, fixed some eu computation bugs, optmized some stuff, added debug here and there, made 3 multiblocks work properly: transformer, quantizer, junction --- .../com/github/technus/tectech/CustomItemList.java | 10 +- .../github/technus/tectech/GT_CustomLoader.java | 21 +- .../technus/tectech/GT_Loader_Elemental.java | 222 --------- .../github/technus/tectech/GT_Loader_Machines.java | 199 ++++++++ .../github/technus/tectech/GT_Loader_Recipes.java | 35 ++ .../java/com/github/technus/tectech/TecTech.java | 49 +- src/main/java/com/github/technus/tectech/XSTR.java | 255 ++++++++++ .../technus/tectech/auxiliary/TecTechConfig.java | 10 +- .../Behaviour_elementalMatterContainer.java | 5 +- .../classes/cElementalDefinition.java | 4 +- .../classes/cElementalInstanceStack.java | 10 +- .../classes/cElementalPrimitive.java | 5 +- .../tectech/elementalMatter/commonValues.java | 2 - .../definitions/dAtomDefinition.java | 92 ++-- .../definitions/dHadronDefinition.java | 12 +- .../gui/GT_GUIContainer_MultiMachineEM.java | 1 - .../gui/GT_GUIContainer_Uncertainty.java | 6 +- .../gui/GT_GUIContainer_UncertaintyAdv.java | 2 - .../machine/GT_MetaTileEntity_Computer.java | 50 ++ .../machine/GT_MetaTileEntity_EMbhg.java | 2 +- .../machine/GT_MetaTileEntity_EMdequantifier.java | 6 +- .../machine/GT_MetaTileEntity_EMjunction.java | 13 +- .../machine/GT_MetaTileEntity_EMquantifier.java | 328 ++++++++++++- .../machine/GT_MetaTileEntity_EMtransformer.java | 102 ++++ .../GT_MetaTileEntity_Hatch_DynamoMulti.java | 2 +- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 45 +- .../GT_MetaTileEntity_Hatch_EnergyMulti.java | 2 +- .../GT_MetaTileEntity_Hatch_MufflerElemental.java | 12 +- .../GT_MetaTileEntity_Hatch_Uncertainty.java | 9 +- ...GT_MetaTileEntity_MultiblockBase_Elemental.java | 541 +++++++++++++++++---- 30 files changed, 1573 insertions(+), 479 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/GT_Loader_Elemental.java create mode 100644 src/main/java/com/github/technus/tectech/GT_Loader_Machines.java create mode 100644 src/main/java/com/github/technus/tectech/GT_Loader_Recipes.java create mode 100644 src/main/java/com/github/technus/tectech/XSTR.java create mode 100644 src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Computer.java create mode 100644 src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMtransformer.java (limited to 'src/main/java') diff --git a/src/main/java/com/github/technus/tectech/CustomItemList.java b/src/main/java/com/github/technus/tectech/CustomItemList.java index 22e481be5b..65bdba09b7 100644 --- a/src/main/java/com/github/technus/tectech/CustomItemList.java +++ b/src/main/java/com/github/technus/tectech/CustomItemList.java @@ -28,8 +28,12 @@ public enum CustomItemList implements IItemContainer eM_in_UV,eM_in_UHV,eM_in_UEV,eM_in_UIV,eM_in_UMV,eM_in_UXV, eM_out_UV,eM_out_UHV,eM_out_UEV,eM_out_UIV,eM_out_UMV,eM_out_UXV, eM_muffler_UV,eM_muffler_UHV,eM_muffler_UEV,eM_muffler_UIV,eM_muffler_UMV,eM_muffler_UXV, - Parametrizer_Hatch,Uncertainty_Hatch,UncertaintyX_Hatch,eM_Casing,eM_Field,eM_Field_Casing,eM_Coil,eM_Tele,eM_TimeSpaceWarp,debugBlock, - Machine_Multi_BHG,Machine_Multi_EM,Machine_Multi_MatterToEM,Machine_Multi_EMToMatter,Machine_Multi_Collider,Machine_Multi_Wormhole,Machine_Multi_EMCrafter,Machine_Multi_EMjunction; + Parametrizer_Hatch,Uncertainty_Hatch,UncertaintyX_Hatch, + eM_Casing,eM_Field,eM_Field_Casing,eM_Coil,eM_Tele,eM_TimeSpaceWarp, + debugBlock, + Machine_Multi_MatterToEM,Machine_Multi_EMToMatter,Machine_Multi_EMjunction, + Machine_Multi_Transformer,Machine_Multi_Computer, + Machine_Multi_BHG,Machine_Multi_EMmachine,Machine_Multi_Collider,Machine_Multi_Wormhole,Machine_Multi_EMCrafter,Machine_Multi_Scanner; private ItemStack mStack = null; @@ -146,6 +150,4 @@ public enum CustomItemList implements IItemContainer for (Object tOreName : aOreNames) GT_OreDictUnificator.registerOre(tOreName, getWildcard(1)); return this; } - - } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/GT_CustomLoader.java b/src/main/java/com/github/technus/tectech/GT_CustomLoader.java index 82d97663c0..918725f759 100644 --- a/src/main/java/com/github/technus/tectech/GT_CustomLoader.java +++ b/src/main/java/com/github/technus/tectech/GT_CustomLoader.java @@ -1,22 +1,23 @@ package com.github.technus.tectech; -import com.github.technus.tectech.blocks.QuantumGlass; import com.github.technus.tectech.casing.GT_Loader_CasingsTT; -import cpw.mods.fml.common.registry.GameRegistry; public class GT_CustomLoader { + private GT_Loader_Machines ElementalLoader; + private GT_Loader_CasingsTT ElementalCasing; + private GT_Loader_Recipes ElementalRecipes; - - public GT_CustomLoader() { - ElementalCasing = new GT_Loader_CasingsTT(); - ElementalLoader = new GT_Loader_Elemental(); - } - - private GT_Loader_Elemental ElementalLoader = null; - private GT_Loader_CasingsTT ElementalCasing = null; + public GT_CustomLoader() {} public void run() { + ElementalCasing = new GT_Loader_CasingsTT(); + ElementalLoader = new GT_Loader_Machines(); ElementalCasing.run(); ElementalLoader.run(); } + + public void run2() { + ElementalRecipes = new GT_Loader_Recipes(); + ElementalRecipes.run(); + } } diff --git a/src/main/java/com/github/technus/tectech/GT_Loader_Elemental.java b/src/main/java/com/github/technus/tectech/GT_Loader_Elemental.java deleted file mode 100644 index 73fd076604..0000000000 --- a/src/main/java/com/github/technus/tectech/GT_Loader_Elemental.java +++ /dev/null @@ -1,222 +0,0 @@ -package com.github.technus.tectech; - -import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; -import com.github.technus.tectech.elementalMatter.definitions.*; -import com.github.technus.tectech.elementalMatter.machine.*; - -/** - * Created by danie_000 on 16.11.2016. - */ -public class GT_Loader_Elemental implements Runnable { - public void run() { - - // =================================================================================================== - // def init - // =================================================================================================== - - cElementalPrimitive.run(); - - cPrimitiveDefinition.run(); - - eQuarkDefinition.run(); - eLeptonDefinition.run(); - eNeutrinoDefinition.run(); - eBosonDefinition.run(); - - dHadronDefinition.run(); - - dAtomDefinition.run(); - - // =================================================================================================== - // Recipe init - // =================================================================================================== - - GT_MetaTileEntity_EMquantifier.recipeInit(); - - // =================================================================================================== - // eM IN - // =================================================================================================== - - CustomItemList.eM_in_UV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 12070, "hatch.emin.tier.08", "UV Elemental Input Hatch",8).getStackForm(1L)); - - CustomItemList.eM_in_UHV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 12071, "hatch.emin.tier.09", "UHV Elemental Input Hatch",9).getStackForm(1L)); - - CustomItemList.eM_in_UEV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 12072, "hatch.emin.tier.10", "UEV Elemental Input Hatch",10).getStackForm(1L)); - - CustomItemList.eM_in_UIV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 12073, "hatch.emin.tier.11", "UIV Elemental Input Hatch",11).getStackForm(1L)); - - CustomItemList.eM_in_UMV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 12074, "hatch.emin.tier.12", "UMV Elemental Input Hatch",12).getStackForm(1L)); - - CustomItemList.eM_in_UXV.set(new GT_MetaTileEntity_Hatch_InputElemental( - 12075, "hatch.emin.tier.13", "UXV Elemental Input Hatch",13).getStackForm(1L)); - - // =================================================================================================== - // eM OUT - // =================================================================================================== - - CustomItemList.eM_out_UV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 12080, "hatch.emout.tier.08", "UV Elemental Output Hatch",8).getStackForm(1L)); - - CustomItemList.eM_out_UHV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 12081, "hatch.emout.tier.09", "UHV Elemental Output Hatch",9).getStackForm(1L)); - - CustomItemList.eM_out_UEV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 12082, "hatch.emout.tier.10", "UEV Elemental Output Hatch",10).getStackForm(1L)); - - CustomItemList.eM_out_UIV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 12083, "hatch.emout.tier.11", "UIV Elemental Output Hatch",11).getStackForm(1L)); - - CustomItemList.eM_out_UMV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 12084, "hatch.emout.tier.12", "UMV Elemental Output Hatch",12).getStackForm(1L)); - - CustomItemList.eM_out_UXV.set(new GT_MetaTileEntity_Hatch_OutputElemental( - 12085, "hatch.emout.tier.13", "UXV Elemental Output Hatch",13).getStackForm(1L)); - - // =================================================================================================== - // eM Waste OUT - // =================================================================================================== - - CustomItemList.eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( - 12090, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch",8,1e10f).getStackForm(1L)); - - CustomItemList.eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( - 12091, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch",9,5e10f).getStackForm(1L)); - - CustomItemList.eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( - 12092, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch",10,25e10f).getStackForm(1L)); - - CustomItemList.eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( - 12093, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch",11,125e10f).getStackForm(1L)); - - CustomItemList.eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( - 12094, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch",12,125e11f).getStackForm(1L)); - - CustomItemList.eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( - 12095, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch",13,125e12f).getStackForm(1L)); - - // =================================================================================================== - // Multi AMP Power INPUTS - // =================================================================================================== - - CustomItemList.eM_energymulti4_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12100, "hatch.energymulti04.tier.08", "UV 4A Energy Hatch",8,4).getStackForm(1L)); - CustomItemList.eM_energymulti16_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12110, "hatch.energymulti16.tier.08", "UV 16A Energy Hatch",8,16).getStackForm(1L)); - CustomItemList.eM_energymulti64_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12120, "hatch.energymulti64.tier.08", "UV 64A Energy Hatch",8,64).getStackForm(1L)); - - CustomItemList.eM_energymulti4_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12101, "hatch.energymulti04.tier.09", "UHV 4A Energy Hatch",9,4).getStackForm(1L)); - CustomItemList.eM_energymulti16_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12111, "hatch.energymulti16.tier.09", "UHV 16A Energy Hatch",9,16).getStackForm(1L)); - CustomItemList.eM_energymulti64_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12121, "hatch.energymulti64.tier.09", "UHV 64A Energy Hatch",9,64).getStackForm(1L)); - - CustomItemList.eM_energymulti4_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12102, "hatch.energymulti04.tier.10", "UEV 4A Energy Hatch",10,4).getStackForm(1L)); - CustomItemList.eM_energymulti16_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12112, "hatch.energymulti16.tier.10", "UEV 16A Energy Hatch",10,16).getStackForm(1L)); - CustomItemList.eM_energymulti64_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12122, "hatch.energymulti64.tier.10", "UEV 64A Energy Hatch",10,64).getStackForm(1L)); - - CustomItemList.eM_energymulti4_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12103, "hatch.energymulti04.tier.11", "UIV 4A Energy Hatch",11,4).getStackForm(1L)); - CustomItemList.eM_energymulti16_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12113, "hatch.energymulti16.tier.11", "UIV 16A Energy Hatch",11,16).getStackForm(1L)); - CustomItemList.eM_energymulti64_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12123, "hatch.energymulti64.tier.11", "UIV 64A Energy Hatch",11,64).getStackForm(1L)); - - CustomItemList.eM_energymulti4_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12104, "hatch.energymulti04.tier.12", "UMV 4A Energy Hatch",12,4).getStackForm(1L)); - CustomItemList.eM_energymulti16_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12114, "hatch.energymulti16.tier.12", "UMV 16A Energy Hatch",12,16).getStackForm(1L)); - CustomItemList.eM_energymulti64_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12124, "hatch.energymulti64.tier.12", "UMV 64A Energy Hatch",12,64).getStackForm(1L)); - - CustomItemList.eM_energymulti4_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12105, "hatch.energymulti04.tier.13", "UXV 4A Energy Hatch",13,4).getStackForm(1L)); - CustomItemList.eM_energymulti16_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12115, "hatch.energymulti16.tier.13", "UXV 16A Energy Hatch",13,16).getStackForm(1L)); - CustomItemList.eM_energymulti64_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 12125, "hatch.energymulti64.tier.13", "UXV 64A Energy Hatch",13,64).getStackForm(1L)); - - - // =================================================================================================== - // Multi AMP Power OUTPUTS - // =================================================================================================== - - CustomItemList.eM_dynamomulti4_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12130, "hatch.dynamomulti04.tier.08", "UV 4A Dynamo Hatch",8,4).getStackForm(1L)); - CustomItemList.eM_dynamomulti16_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12140, "hatch.dynamomulti16.tier.08", "UV 16A Dynamo Hatch",8,16).getStackForm(1L)); - CustomItemList.eM_dynamomulti64_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12150, "hatch.dynamomulti64.tier.08", "UV 64A Dynamo Hatch",8,64).getStackForm(1L)); - - CustomItemList.eM_dynamomulti4_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12131, "hatch.dynamomulti04.tier.09", "UHV 4A Dynamo Hatch",9,4).getStackForm(1L)); - CustomItemList.eM_dynamomulti16_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12141, "hatch.dynamomulti16.tier.09", "UHV 16A Dynamo Hatch",9,16).getStackForm(1L)); - CustomItemList.eM_dynamomulti64_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12151, "hatch.dynamomulti64.tier.09", "UHV 64A Dynamo Hatch",9,64).getStackForm(1L)); - - CustomItemList.eM_dynamomulti4_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12132, "hatch.dynamomulti04.tier.10", "UEV 4A Dynamo Hatch",10,4).getStackForm(1L)); - CustomItemList.eM_dynamomulti16_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12142, "hatch.dynamomulti16.tier.10", "UEV 16A Dynamo Hatch",10,16).getStackForm(1L)); - CustomItemList.eM_dynamomulti64_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12152, "hatch.dynamomulti64.tier.10", "UEV 64A Dynamo Hatch",10,64).getStackForm(1L)); - - CustomItemList.eM_dynamomulti4_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12133, "hatch.dynamomulti04.tier.11", "UIV 4A Dynamo Hatch",11,4).getStackForm(1L)); - CustomItemList.eM_dynamomulti16_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12143, "hatch.dynamomulti16.tier.11", "UIV 16A Dynamo Hatch",11,16).getStackForm(1L)); - CustomItemList.eM_dynamomulti64_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12153, "hatch.dynamomulti64.tier.11", "UIV 64A Dynamo Hatch",11,64).getStackForm(1L)); - - CustomItemList.eM_dynamomulti4_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12134, "hatch.dynamomulti04.tier.12", "UMV 4A Dynamo Hatch",12,4).getStackForm(1L)); - CustomItemList.eM_dynamomulti16_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12144, "hatch.dynamomulti16.tier.12", "UMV 16A Dynamo Hatch",12,16).getStackForm(1L)); - CustomItemList.eM_dynamomulti64_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12154, "hatch.dynamomulti64.tier.12", "UMV 64A Dynamo Hatch",12,64).getStackForm(1L)); - - CustomItemList.eM_dynamomulti4_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12135, "hatch.dynamomulti04.tier.13", "UXV 4A Dynamo Hatch",13,4).getStackForm(1L)); - CustomItemList.eM_dynamomulti16_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12145, "hatch.dynamomulti16.tier.13", "UXV 16A Dynamo Hatch",13,16).getStackForm(1L)); - CustomItemList.eM_dynamomulti64_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 12155, "hatch.dynamomulti64.tier.13", "UXV 64A Dynamo Hatch",13,64).getStackForm(1L)); - - // =================================================================================================== - // MULTIBLOCKS EM - // =================================================================================================== - - CustomItemList.Machine_Multi_MatterToEM.set(new GT_MetaTileEntity_EMquantifier(12160,"multimachine.mattertoem","Matter Quantifier").getStackForm(1L)); - CustomItemList.Machine_Multi_EMToMatter.set(new GT_MetaTileEntity_EMdequantifier(12161,"multimachine.emtomatter","Matter De-quantifier").getStackForm(1L)); - CustomItemList.Machine_Multi_EMjunction.set(new GT_MetaTileEntity_EMjunction(12162,"multimachine.emjunction","Matter junction").getStackForm(1L)); - CustomItemList.Machine_Multi_EM.set(new GT_MetaTileEntity_EMmachine(12163,"multimachine.emprocessing","Quantum Processing Machine").getStackForm(1L)); - CustomItemList.Machine_Multi_EMCrafter.set(new GT_MetaTileEntity_EMcrafter(12164,"multimachine.emcrafter","Matter Assembler").getStackForm(1L)); - CustomItemList.Machine_Multi_Collider.set(new GT_MetaTileEntity_EMcollider(12165,"multimachine.emcollider","Matter Collider").getStackForm(1L)); - CustomItemList.Machine_Multi_BHG.set(new GT_MetaTileEntity_EMbhg(12166,"multimachine.blackholegenerator","Black Hole Generator").getStackForm(1L)); - CustomItemList.Machine_Multi_Wormhole.set(new GT_MetaTileEntity_EMwormhole(12167,"multimachine.emwormhole","Wormhole").getStackForm(1L)); - - // =================================================================================================== - // Hatches EM - // =================================================================================================== - CustomItemList.Parametrizer_Hatch.set(new GT_MetaTileEntity_Hatch_Param(12170,"hatch.param.tier.06","Parametrizer for machines",6).getStackForm(1L)); - CustomItemList.Uncertainty_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(12171,"hatch.emcertain.tier.06","Uncertainty resolver",6).getStackForm(1L)); - CustomItemList.UncertaintyX_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(12172,"hatch.emcertain.tier.10","Uncertainty resolver X",10).getStackForm(1L)); - - // =================================================================================================== - // EM pipe - // =================================================================================================== - CustomItemList.EMpipe.set(new GT_MetaTileEntity_EMpipe(12179,"pipe.elementalmatter","Quantum tunnel").getStackForm(1L)); - - //System.out.println("ELEMENTAL INIT DONE"); - } -} diff --git a/src/main/java/com/github/technus/tectech/GT_Loader_Machines.java b/src/main/java/com/github/technus/tectech/GT_Loader_Machines.java new file mode 100644 index 0000000000..f11bd7f3ff --- /dev/null +++ b/src/main/java/com/github/technus/tectech/GT_Loader_Machines.java @@ -0,0 +1,199 @@ +package com.github.technus.tectech; + +import com.github.technus.tectech.elementalMatter.machine.*; + +/** + * Created by danie_000 on 16.11.2016. + */ +public class GT_Loader_Machines implements Runnable { + public void run() { + // =================================================================================================== + // eM IN + // =================================================================================================== + + CustomItemList.eM_in_UV.set(new GT_MetaTileEntity_Hatch_InputElemental( + 12070, "hatch.emin.tier.08", "UV Elemental Input Hatch",8).getStackForm(1L)); + + CustomItemList.eM_in_UHV.set(new GT_MetaTileEntity_Hatch_InputElemental( + 12071, "hatch.emin.tier.09", "UHV Elemental Input Hatch",9).getStackForm(1L)); + + CustomItemList.eM_in_UEV.set(new GT_MetaTileEntity_Hatch_InputElemental( + 12072, "hatch.emin.tier.10", "UEV Elemental Input Hatch",10).getStackForm(1L)); + + CustomItemList.eM_in_UIV.set(new GT_MetaTileEntity_Hatch_InputElemental( + 12073, "hatch.emin.tier.11", "UIV Elemental Input Hatch",11).getStackForm(1L)); + + CustomItemList.eM_in_UMV.set(new GT_MetaTileEntity_Hatch_InputElemental( + 12074, "hatch.emin.tier.12", "UMV Elemental Input Hatch",12).getStackForm(1L)); + + CustomItemList.eM_in_UXV.set(new GT_MetaTileEntity_Hatch_InputElemental( + 12075, "hatch.emin.tier.13", "UXV Elemental Input Hatch",13).getStackForm(1L)); + + // =================================================================================================== + // eM OUT + // =================================================================================================== + + CustomItemList.eM_out_UV.set(new GT_MetaTileEntity_Hatch_OutputElemental( + 12080, "hatch.emout.tier.08", "UV Elemental Output Hatch",8).getStackForm(1L)); + + CustomItemList.eM_out_UHV.set(new GT_MetaTileEntity_Hatch_OutputElemental( + 12081, "hatch.emout.tier.09", "UHV Elemental Output Hatch",9).getStackForm(1L)); + + CustomItemList.eM_out_UEV.set(new GT_MetaTileEntity_Hatch_OutputElemental( + 12082, "hatch.emout.tier.10", "UEV Elemental Output Hatch",10).getStackForm(1L)); + + CustomItemList.eM_out_UIV.set(new GT_MetaTileEntity_Hatch_OutputElemental( + 12083, "hatch.emout.tier.11", "UIV Elemental Output Hatch",11).getStackForm(1L)); + + CustomItemList.eM_out_UMV.set(new GT_MetaTileEntity_Hatch_OutputElemental( + 12084, "hatch.emout.tier.12", "UMV Elemental Output Hatch",12).getStackForm(1L)); + + CustomItemList.eM_out_UXV.set(new GT_MetaTileEntity_Hatch_OutputElemental( + 12085, "hatch.emout.tier.13", "UXV Elemental Output Hatch",13).getStackForm(1L)); + + // =================================================================================================== + // eM Waste OUT + // =================================================================================================== + + CustomItemList.eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + 12090, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch",8,1e10f).getStackForm(1L)); + + CustomItemList.eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + 12091, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch",9,5e10f).getStackForm(1L)); + + CustomItemList.eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + 12092, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch",10,25e10f).getStackForm(1L)); + + CustomItemList.eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + 12093, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch",11,125e10f).getStackForm(1L)); + + CustomItemList.eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + 12094, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch",12,125e11f).getStackForm(1L)); + + CustomItemList.eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_MufflerElemental( + 12095, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch",13,125e12f).getStackForm(1L)); + + // =================================================================================================== + // Multi AMP Power INPUTS + // =================================================================================================== + + CustomItemList.eM_energymulti4_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12100, "hatch.energymulti04.tier.08", "UV 4A Energy Hatch",8,4).getStackForm(1L)); + CustomItemList.eM_energymulti16_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12110, "hatch.energymulti16.tier.08", "UV 16A Energy Hatch",8,16).getStackForm(1L)); + CustomItemList.eM_energymulti64_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12120, "hatch.energymulti64.tier.08", "UV 64A Energy Hatch",8,64).getStackForm(1L)); + + CustomItemList.eM_energymulti4_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12101, "hatch.energymulti04.tier.09", "UHV 4A Energy Hatch",9,4).getStackForm(1L)); + CustomItemList.eM_energymulti16_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12111, "hatch.energymulti16.tier.09", "UHV 16A Energy Hatch",9,16).getStackForm(1L)); + CustomItemList.eM_energymulti64_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12121, "hatch.energymulti64.tier.09", "UHV 64A Energy Hatch",9,64).getStackForm(1L)); + + CustomItemList.eM_energymulti4_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12102, "hatch.energymulti04.tier.10", "UEV 4A Energy Hatch",10,4).getStackForm(1L)); + CustomItemList.eM_energymulti16_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12112, "hatch.energymulti16.tier.10", "UEV 16A Energy Hatch",10,16).getStackForm(1L)); + CustomItemList.eM_energymulti64_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12122, "hatch.energymulti64.tier.10", "UEV 64A Energy Hatch",10,64).getStackForm(1L)); + + CustomItemList.eM_energymulti4_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12103, "hatch.energymulti04.tier.11", "UIV 4A Energy Hatch",11,4).getStackForm(1L)); + CustomItemList.eM_energymulti16_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12113, "hatch.energymulti16.tier.11", "UIV 16A Energy Hatch",11,16).getStackForm(1L)); + CustomItemList.eM_energymulti64_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12123, "hatch.energymulti64.tier.11", "UIV 64A Energy Hatch",11,64).getStackForm(1L)); + + CustomItemList.eM_energymulti4_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12104, "hatch.energymulti04.tier.12", "UMV 4A Energy Hatch",12,4).getStackForm(1L)); + CustomItemList.eM_energymulti16_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12114, "hatch.energymulti16.tier.12", "UMV 16A Energy Hatch",12,16).getStackForm(1L)); + CustomItemList.eM_energymulti64_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12124, "hatch.energymulti64.tier.12", "UMV 64A Energy Hatch",12,64).getStackForm(1L)); + + CustomItemList.eM_energymulti4_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12105, "hatch.energymulti04.tier.13", "UXV 4A Energy Hatch",13,4).getStackForm(1L)); + CustomItemList.eM_energymulti16_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12115, "hatch.energymulti16.tier.13", "UXV 16A Energy Hatch",13,16).getStackForm(1L)); + CustomItemList.eM_energymulti64_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 12125, "hatch.energymulti64.tier.13", "UXV 64A Energy Hatch",13,64).getStackForm(1L)); + + + // =================================================================================================== + // Multi AMP Power OUTPUTS + // =================================================================================================== + + CustomItemList.eM_dynamomulti4_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12130, "hatch.dynamomulti04.tier.08", "UV 4A Dynamo Hatch",8,4).getStackForm(1L)); + CustomItemList.eM_dynamomulti16_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12140, "hatch.dynamomulti16.tier.08", "UV 16A Dynamo Hatch",8,16).getStackForm(1L)); + CustomItemList.eM_dynamomulti64_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12150, "hatch.dynamomulti64.tier.08", "UV 64A Dynamo Hatch",8,64).getStackForm(1L)); + + CustomItemList.eM_dynamomulti4_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12131, "hatch.dynamomulti04.tier.09", "UHV 4A Dynamo Hatch",9,4).getStackForm(1L)); + CustomItemList.eM_dynamomulti16_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12141, "hatch.dynamomulti16.tier.09", "UHV 16A Dynamo Hatch",9,16).getStackForm(1L)); + CustomItemList.eM_dynamomulti64_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12151, "hatch.dynamomulti64.tier.09", "UHV 64A Dynamo Hatch",9,64).getStackForm(1L)); + + CustomItemList.eM_dynamomulti4_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12132, "hatch.dynamomulti04.tier.10", "UEV 4A Dynamo Hatch",10,4).getStackForm(1L)); + CustomItemList.eM_dynamomulti16_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12142, "hatch.dynamomulti16.tier.10", "UEV 16A Dynamo Hatch",10,16).getStackForm(1L)); + CustomItemList.eM_dynamomulti64_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12152, "hatch.dynamomulti64.tier.10", "UEV 64A Dynamo Hatch",10,64).getStackForm(1L)); + + CustomItemList.eM_dynamomulti4_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12133, "hatch.dynamomulti04.tier.11", "UIV 4A Dynamo Hatch",11,4).getStackForm(1L)); + CustomItemList.eM_dynamomulti16_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12143, "hatch.dynamomulti16.tier.11", "UIV 16A Dynamo Hatch",11,16).getStackForm(1L)); + CustomItemList.eM_dynamomulti64_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12153, "hatch.dynamomulti64.tier.11", "UIV 64A Dynamo Hatch",11,64).getStackForm(1L)); + + CustomItemList.eM_dynamomulti4_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12134, "hatch.dynamomulti04.tier.12", "UMV 4A Dynamo Hatch",12,4).getStackForm(1L)); + CustomItemList.eM_dynamomulti16_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12144, "hatch.dynamomulti16.tier.12", "UMV 16A Dynamo Hatch",12,16).getStackForm(1L)); + CustomItemList.eM_dynamomulti64_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12154, "hatch.dynamomulti64.tier.12", "UMV 64A Dynamo Hatch",12,64).getStackForm(1L)); + + CustomItemList.eM_dynamomulti4_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12135, "hatch.dynamomulti04.tier.13", "UXV 4A Dynamo Hatch",13,4).getStackForm(1L)); + CustomItemList.eM_dynamomulti16_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12145, "hatch.dynamomulti16.tier.13", "UXV 16A Dynamo Hatch",13,16).getStackForm(1L)); + CustomItemList.eM_dynamomulti64_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 12155, "hatch.dynamomulti64.tier.13", "UXV 64A Dynamo Hatch",13,64).getStackForm(1L)); + + // =================================================================================================== + // MULTIBLOCKS EM + // =================================================================================================== + + CustomItemList.Machine_Multi_Transformer.set(new GT_MetaTileEntity_EMtransformer(12160,"multimachine.em.transformer", "Active Transformer").getStackForm(1L)); + CustomItemList.Machine_Multi_MatterToEM.set(new GT_MetaTileEntity_EMquantifier(12161,"multimachine.em.mattertoem","Matter Quantifier").getStackForm(1L)); + CustomItemList.Machine_Multi_EMToMatter.set(new GT_MetaTileEntity_EMdequantifier(12162,"multimachine.em.emtomatter","Matter De-quantifier").getStackForm(1L)); + CustomItemList.Machine_Multi_EMjunction.set(new GT_MetaTileEntity_EMjunction(12163,"multimachine.em.junction","Matter junction").getStackForm(1L)); + CustomItemList.Machine_Multi_EMmachine.set(new GT_MetaTileEntity_EMmachine(12164,"multimachine.em.processing","Quantum Processing Machine").getStackForm(1L)); + CustomItemList.Machine_Multi_EMCrafter.set(new GT_MetaTileEntity_EMcrafter(12165,"multimachine.em.crafter","Matter Assembler").getStackForm(1L)); + CustomItemList.Machine_Multi_Collider.set(new GT_MetaTileEntity_EMcollider(12166,"multimachine.em.collider","Matter Collider").getStackForm(1L)); + CustomItemList.Machine_Multi_BHG.set(new GT_MetaTileEntity_EMbhg(12167,"multimachine.em.blackholegenerator","Black Hole Generator").getStackForm(1L)); + CustomItemList.Machine_Multi_Wormhole.set(new GT_MetaTileEntity_EMwormhole(12168,"multimachine.em.wormhole","Wormhole").getStackForm(1L)); + CustomItemList.Machine_Multi_Scanner.set(new GT_MetaTileEntity_EMscanner(12169,"multimachine.em.scanner","Elemental Scanner").getStackForm(1L)); + CustomItemList.Machine_Multi_Computer.set(new GT_MetaTileEntity_Computer(12170,"multimachine.em.computer","Quantum computer").getStackForm(1L)); + + // =================================================================================================== + // Hatches EM + // =================================================================================================== + CustomItemList.Parametrizer_Hatch.set(new GT_MetaTileEntity_Hatch_Param(12180,"hatch.param.tier.06","Parametrizer for machines",6).getStackForm(1L)); + CustomItemList.Uncertainty_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(12181,"hatch.emcertain.tier.06","Uncertainty resolver",6).getStackForm(1L)); + CustomItemList.UncertaintyX_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(12182,"hatch.emcertain.tier.10","Uncertainty resolver X",10).getStackForm(1L)); + + // =================================================================================================== + // EM pipe + // =================================================================================================== + CustomItemList.EMpipe.set(new GT_MetaTileEntity_EMpipe(12179,"pipe.elementalmatter","Quantum tunnel").getStackForm(1L)); + + //System.out.println("ELEMENTAL INIT DONE"); + } +} diff --git a/src/main/java/com/github/technus/tectech/GT_Loader_Recipes.java b/src/main/java/com/github/technus/tectech/GT_Loader_Recipes.java new file mode 100644 index 0000000000..2d26587d31 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/GT_Loader_Recipes.java @@ -0,0 +1,35 @@ +package com.github.technus.tectech; + +import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; +import com.github.technus.tectech.elementalMatter.definitions.*; +import com.github.technus.tectech.elementalMatter.machine.GT_MetaTileEntity_EMquantifier; + +/** + * Created by danie_000 on 16.11.2016. + */ +public class GT_Loader_Recipes implements Runnable { + public void run() { + // =================================================================================================== + // def init + // =================================================================================================== + + cElementalPrimitive.run(); + + cPrimitiveDefinition.run(); + + eQuarkDefinition.run(); + eLeptonDefinition.run(); + eNeutrinoDefinition.run(); + eBosonDefinition.run(); + + dHadronDefinition.run(); + + dAtomDefinition.run(); + + // =================================================================================================== + // Recipe init + // =================================================================================================== + + GT_MetaTileEntity_EMquantifier.run(); + } +} diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 090b55604d..4c07e616c5 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -1,9 +1,9 @@ package com.github.technus.tectech; - import com.github.technus.tectech.auxiliary.Reference; import com.github.technus.tectech.auxiliary.TecTechConfig; import com.github.technus.tectech.blocks.QuantumGlass; import com.github.technus.tectech.proxy.CommonProxy; +import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; @@ -13,13 +13,17 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import eu.usrv.yamcore.auxiliary.IngameErrorLog; import eu.usrv.yamcore.auxiliary.LogHelper; - -import java.util.Random; +import eu.usrv.yamcore.items.ModItemManager; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; @Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, dependencies = "required-after:Forge@[10.13.4.1614,);" - + "required-after:YAMCore@[0.5.73,);") + + "required-after:YAMCore@[0.5.73,);" + "required-after:gregtech;") public class TecTech { @SidedProxy(clientSide = Reference.CLIENTSIDE, serverSide = Reference.SERVERSIDE) @@ -28,12 +32,15 @@ public class TecTech { @Instance(Reference.MODID) public static TecTech instance; - //public static CreativeTabsManager TabManager = null; + //public static ModFluidManager FluidManager = null; + //public static ModBlockManager BlockManager = null; + public static ModItemManager ItemManager = null; public static IngameErrorLog Module_AdminErrorLogs = null; public static GT_CustomLoader GTCustomLoader = null; public static TecTechConfig ModConfig; - public static Random Rnd = null; + public static XSTR Rnd = null; public static LogHelper Logger = new LogHelper(Reference.MODID); + public static CreativeTabs mainTab=null; public static void AddLoginError(String pMessage) { if (Module_AdminErrorLogs != null) @@ -44,13 +51,16 @@ public class TecTech { public void PreLoad(FMLPreInitializationEvent PreEvent) { Logger.setDebugOutput(true); - Rnd = new Random(System.currentTimeMillis()); + Rnd = new XSTR(); + + //ItemManager = new ModItemManager(Refstrings.MODID); + //BlockManager = new ModBlockManager(Refstrings.MODID); + //FluidManager = new ModFluidManager(Refstrings.MODID); ModConfig = new TecTechConfig(PreEvent.getModConfigurationDirectory(), Reference.COLLECTIONNAME, Reference.MODID); if (!ModConfig.LoadConfig()) - Logger.error( - String.format("%s could not load its config file. Things are going to be weird!", Reference.MODID)); + Logger.error(Reference.MODID+" could not load its config file. Things are going to be weird!"); if (ModConfig.ModAdminErrorLogs_Enabled) { Logger.debug("Module_AdminErrorLogs is enabled"); @@ -68,6 +78,27 @@ public class TecTech { public void PostLoad(FMLPostInitializationEvent PostEvent) { GTCustomLoader = new GT_CustomLoader(); GTCustomLoader.run(); + GTCustomLoader.run2(); + + mainTab=new CreativeTabs("TecTech") { + @SideOnly(Side.CLIENT) + @Override + public Item getTabIconItem() { + return CustomItemList.eM_TimeSpaceWarp.getItem(); + } + + @SideOnly(Side.CLIENT) + @Override + public ItemStack getIconItemStack() { + return CustomItemList.eM_TimeSpaceWarp.getWithDamage(1,8); + } + }; + RegisterThingsInTabs(); + if(Loader.isModLoaded("dreamcraft"));//TODO init recipes for GTNH coremod + } + + public void RegisterThingsInTabs(){ + QuantumGlass.INSTANCE.setCreativeTab(mainTab);//TODO? COPY PASTE GT CLASSES TO ADD MY THINGS TO CREATIVE TAB } /** diff --git a/src/main/java/com/github/technus/tectech/XSTR.java b/src/main/java/com/github/technus/tectech/XSTR.java new file mode 100644 index 0000000000..e733e8cfb8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/XSTR.java @@ -0,0 +1,255 @@ +package com.github.technus.tectech; +/** + * A subclass of java.util.random that implements the Xorshift random number + * generator + * + * - it is 30% faster than the generator from Java's library - it produces + * random sequences of higher quality than java.util.Random - this class also + * provides a clone() function + * + * Usage: XSRandom rand = new XSRandom(); //Instantiation x = rand.nextInt(); + * //pull a random number + * + * To use the class in legacy code, you may also instantiate an XSRandom object + * and assign it to a java.util.Random object: java.util.Random rand = new + * XSRandom(); + * + * for an explanation of the algorithm, see + * http://demesos.blogspot.com/2011/09/pseudo-random-number-generators.html + * + * @author Wilfried Elmenreich University of Klagenfurt/Lakeside Labs + * http://www.elmenreich.tk + * + * This code is released under the GNU Lesser General Public License Version 3 + * http://www.gnu.org/licenses/lgpl-3.0.txt + */ + +import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; + +/** + * XSTR - Xorshift ThermiteRandom + * Modified by Bogdan-G + * 03.06.2016 + * version 0.0.4 + */ +public class XSTR extends Random { + + private static final long serialVersionUID = 6208727693524452904L; + private long seed; + private long last; + private static final long GAMMA = 0x9e3779b97f4a7c15L; + private static final int PROBE_INCREMENT = 0x9e3779b9; + private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL; + private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) + private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) + + /* + MODIFIED BY: Robotia + Modification: Implemented Random class seed generator + */ + /** + * Creates a new pseudo random number generator. The seed is initialized to + * the current time, as if by + * setSeed(System.currentTimeMillis());. + */ + public XSTR() { + this(seedUniquifier() ^ System.nanoTime()); + } + private static final AtomicLong seedUniquifier + = new AtomicLong(8682522807148012L); + + private static long seedUniquifier() { + // L'Ecuyer, "Tables of Linear Congruential Generators of + // Different Sizes and Good Lattice Structure", 1999 + for (;;) { + long current = seedUniquifier.get(); + long next = current * 181783497276652981L; + if (seedUniquifier.compareAndSet(current, next)) { + return next; + } + } + } + + /** + * Creates a new pseudo random number generator, starting with the specified + * seed, using setSeed(seed);. + * + * @param seed the initial seed + */ + public XSTR(long seed) { + this.seed = seed; + } + public boolean nextBoolean() { + return next(1) != 0; + } + + public double nextDouble() { + return (((long)(next(26)) << 27) + next(27)) * DOUBLE_UNIT; + } + /** + * Returns the current state of the seed, can be used to clone the object + * + * @return the current seed + */ + public synchronized long getSeed() { + return seed; + } + + /** + * Sets the seed for this pseudo random number generator. As described + * above, two instances of the same random class, starting with the same + * seed, produce the same results, if the same methods are called. + * + * @param seed the new seed + */ + public synchronized void setSeed(long seed) { + this.seed = seed; + } + + /** + * @return Returns an XSRandom object with the same state as the original + */ + @Override + public gregtech.api.objects.XSTR clone() { + return new gregtech.api.objects.XSTR(getSeed()); + } + + /** + * Implementation of George Marsaglia's elegant Xorshift random generator + * 30% faster and better quality than the built-in java.util.random see also + * see http://www.javamex.com/tutorials/random_numbers/xorshift.shtml + * + * @param nbits + * @return + */ + public int next(int nbits) { + long x = seed; + x ^= (x << 21); + x ^= (x >>> 35); + x ^= (x << 4); + seed = x; + x &= ((1L << nbits) - 1); + return (int) x; + } + boolean haveNextNextGaussian = false; + double nextNextGaussian = 0; + synchronized public double nextGaussian() { + // See Knuth, ACP, Section 3.4.1 Algorithm C. + if (haveNextNextGaussian) { + haveNextNextGaussian = false; + return nextNextGaussian; + } else { + double v1, v2, s; + do { + v1 = 2 * nextDouble() - 1; // between -1 and 1 + v2 = 2 * nextDouble() - 1; // between -1 and 1 + s = v1 * v1 + v2 * v2; + } while (s >= 1 || s == 0); + double multiplier = StrictMath.sqrt(-2 * StrictMath.log(s)/s); + nextNextGaussian = v2 * multiplier; + haveNextNextGaussian = true; + return v1 * multiplier; + } + } + /** + * Returns a pseudorandom, uniformly distributed {@code int} value between 0 + * (inclusive) and the specified value (exclusive), drawn from this random + * number generator's sequence. The general contract of {@code nextInt} is + * that one {@code int} value in the specified range is pseudorandomly + * generated and returned. All {@code bound} possible {@code int} values are + * produced with (approximately) equal probability. The method + * {@code nextInt(int bound)} is implemented by class {@code Random} as if + * by: + *
 {@code
+     * public int nextInt(int bound) {
+     *   if (bound <= 0)
+     *     throw new IllegalArgumentException("bound must be positive");
+     *
+     *   if ((bound & -bound) == bound)  // i.e., bound is a power of 2
+     *     return (int)((bound * (long)next(31)) >> 31);
+     *
+     *   int bits, val;
+     *   do {
+     *       bits = next(31);
+     *       val = bits % bound;
+     *   } while (bits - val + (bound-1) < 0);
+     *   return val;
+     * }}
+ * + *

The hedge "approx + * imately" is used in the foregoing description only because the next + * method is only approximately an unbiased source of independently chosen + * bits. If it were a perfect source of randomly chosen bits, then the + * algorithm shown would choose {@code int} values from the stated range + * with perfect uniformity. + *

+ * The algorithm is slightly tricky. It rejects values that would result in + * an uneven distribution (due to the fact that 2^31 is not divisible by n). + * The probability of a value being rejected depends on n. The worst case is + * n=2^30+1, for which the probability of a reject is 1/2, and the expected + * number of iterations before the loop terminates is 2. + *

+ * The algorithm treats the case where n is a power of two specially: it + * returns the correct number of high-order bits from the underlying + * pseudo-random number generator. In the absence of special treatment, the + * correct number of low-order bits would be returned. Linear + * congruential pseudo-random number generators such as the one implemented + * by this class are known to have short periods in the sequence of values + * of their low-order bits. Thus, this special case greatly increases the + * length of the sequence of values returned by successive calls to this + * method if n is a small power of two. + * + * @param bound the upper bound (exclusive). Must be positive. + * @return the next pseudorandom, uniformly distributed {@code int} value + * between zero (inclusive) and {@code bound} (exclusive) from this random + * number generator's sequence + * @throws IllegalArgumentException if bound is not positive + * @since 1.2 + */ + public int nextInt(int bound) { + //if (bound <= 0) { + //throw new RuntimeException("BadBound"); + //} + + /*int r = next(31); + int m = bound - 1; + if ((bound & m) == 0) // i.e., bound is a power of 2 + { + r = (int) ((bound * (long) r) >> 31); + } else { + for (int u = r; + u - (r = u % bound) + m < 0; + u = next(31)) + ; + } + return r;*/ + //speedup, new nextInt ~+40% + last = seed ^ (seed << 21); + last ^= (last >>> 35); + last ^= (last << 4); + seed = last; + int out = (int) last % bound; + return (out < 0) ? -out : out; + } + public int nextInt() { + return next(32); + } + + public float nextFloat() { + return next(24) * FLOAT_UNIT; + } + + public long nextLong() { + // it's okay that the bottom word remains signed. + return ((long)(next(32)) << 32) + next(32); + } + + public void nextBytes(byte[] bytes_arr) { + for (int iba = 0, lenba = bytes_arr.length; iba < lenba; ) + for (int rndba = nextInt(), + nba = Math.min(lenba - iba, Integer.SIZE/Byte.SIZE); + nba-- > 0; rndba >>= Byte.SIZE) + bytes_arr[iba++] = (byte)rndba; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/auxiliary/TecTechConfig.java b/src/main/java/com/github/technus/tectech/auxiliary/TecTechConfig.java index 0eb8a90d8f..4613bc193f 100644 --- a/src/main/java/com/github/technus/tectech/auxiliary/TecTechConfig.java +++ b/src/main/java/com/github/technus/tectech/auxiliary/TecTechConfig.java @@ -7,20 +7,28 @@ import java.io.File; public class TecTechConfig extends ConfigManager { public TecTechConfig(File pConfigBaseDirectory, String pModCollectionDirectory, String pModID) { super(pConfigBaseDirectory, pModCollectionDirectory, pModID); - } public boolean ModAdminErrorLogs_Enabled; + public boolean DEBUG_MODE; + public boolean BOOM_ENABLE; + @Override protected void PreInit() { ModAdminErrorLogs_Enabled = false; + DEBUG_MODE=false; + BOOM_ENABLE=true; } @Override protected void Init() { ModAdminErrorLogs_Enabled = _mainConfig.getBoolean("AdminErrorLog", "Modules", ModAdminErrorLogs_Enabled, "If set to true, every op/admin will receive all errors occoured during the startup phase as ingame message on join"); + DEBUG_MODE=_mainConfig.getBoolean("DebugPrint", "Debug", DEBUG_MODE, + "Enables logging into System.out"); + BOOM_ENABLE=_mainConfig.getBoolean("BoomEnable","Features", BOOM_ENABLE, + "Set to false to disable explosions on everything bad that you can do (this will not be available after release)"); } @Override diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/Behaviour_elementalMatterContainer.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/Behaviour_elementalMatterContainer.java index dcef8a8d7a..6b28e3ba0a 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/Behaviour_elementalMatterContainer.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/Behaviour_elementalMatterContainer.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.elementalMatter.classes; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.elementalMatter.commonValues; import com.github.technus.tectech.elementalMatter.interfaces.iElementalInstanceContainer; import gregtech.api.interfaces.IItemBehaviour; @@ -19,8 +20,6 @@ import net.minecraft.world.World; import java.util.Collections; import java.util.List; -import static com.github.technus.tectech.elementalMatter.commonValues.DEBUGMODE; - /** * Created by danie_000 on 11.12.2016. * used in custom GT build! debug purposes @@ -42,7 +41,7 @@ public final class Behaviour_elementalMatterContainer extends Behaviour_None { try { content.putUnifyAll(cElementalInstanceStackTree.fromNBT(tNBT.getCompoundTag("content"))); }catch (tElementalException e){ - if(DEBUGMODE)e.printStackTrace(); + if(TecTech.ModConfig.DEBUG_MODE)e.printStackTrace(); return true; } ((iElementalInstanceContainer) metaTE).purgeOverflow(); diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinition.java index 807d6991ae..827df7e684 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinition.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.elementalMatter.classes; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; import net.minecraft.nbt.NBTTagCompound; @@ -7,7 +8,6 @@ import net.minecraft.nbt.NBTTagCompound; import java.lang.reflect.Method; import java.util.TreeMap; -import static com.github.technus.tectech.elementalMatter.commonValues.DEBUGMODE; import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveDefinition.debug__; /** @@ -28,7 +28,7 @@ public abstract class cElementalDefinition implements iElementalDefinition { try { return (iElementalDefinition) nbtCreationBind.get(nbt.getByte("t")).invoke(null, nbt); }catch(Exception e){ - if(DEBUGMODE)e.printStackTrace(); + if(TecTech.ModConfig.DEBUG_MODE)e.printStackTrace(); return debug__; } } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStack.java index 8c752ea5c5..8698463bca 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStack.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStack.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.elementalMatter.classes; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; -import gregtech.api.objects.XSTR; import net.minecraft.nbt.NBTTagCompound; import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveDefinition.null__; @@ -11,8 +11,6 @@ import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveD * Created by danie_000 on 22.10.2016. */ public final class cElementalInstanceStack implements iHasElementalDefinition { - private static final XSTR xstr = new XSTR(); - public final iElementalDefinition definition; //energy - if positive then particle should try to decay public int energy; @@ -41,7 +39,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { if (color < (byte) 0) {//transforms colorable??? into proper color this.color = color; } else { - this.color = (byte) (xstr.nextInt(3)); + this.color = (byte) (TecTech.Rnd.nextInt(3)); } this.lifeTimeMult = lifeTimeMult; this.lifeTime = definition.getRawLifeTime() * this.lifeTimeMult; @@ -84,7 +82,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { public byte nextColor() { if (this.color < (byte) 0) return this.color; - this.color = (byte) (xstr.nextInt(3)); + this.color = (byte) (TecTech.Rnd.nextInt(3)); return this.color; } @@ -177,7 +175,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } for (int i = 0; i < amountRemaining; i++) { - double rand = (double) (xstr.nextFloat()); + double rand = (double) (TecTech.Rnd.nextFloat()); for (int j = 0; j < differentDecays; j++) {//looking for the thing it decayed into rand -= (double) (decays[j].probability); if (rand <= 0D) { diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalPrimitive.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalPrimitive.java index 89efa0cc71..eb7375555b 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalPrimitive.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalPrimitive.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.elementalMatter.classes; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; import net.minecraft.client.Minecraft; import net.minecraft.crash.CrashReport; @@ -9,8 +10,6 @@ import net.minecraftforge.fluids.FluidStack; import java.util.TreeMap; -import static com.github.technus.tectech.elementalMatter.commonValues.DEBUGMODE; - /** * Created by danie_000 on 22.10.2016. * EXTEND THIS TO ADD NEW PRIMITIVES, WATCH OUT FOR ID'S!!! (-1 to 32 can be assumed as used) @@ -167,7 +166,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { try { cElementalDefinition.addCreatorFromNBT(nbtType, cElementalPrimitive.class.getMethod("fromNBT", NBTTagCompound.class)); } catch (Exception e) { - if(DEBUGMODE)e.printStackTrace(); + if(TecTech.ModConfig.DEBUG_MODE)e.printStackTrace(); } } } \ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/commonValues.java b/src/main/java/com/github/technus/tectech/elementalMatter/commonValues.java index 1a1ff56aca..8f71e93c23 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/commonValues.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/commonValues.java @@ -19,6 +19,4 @@ public final class commonValues { // - in case some hatches are not in multiblock structure public final static byte multiCheckAt = 12;// multiblock checks it's state public final static byte disperseAt = 14;// overflow hatches perform disperse - - public final static boolean DEBUGMODE = true; } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dAtomDefinition.java index a07509adf5..55048c9547 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dAtomDefinition.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.elementalMatter.definitions; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.elementalMatter.classes.*; import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; import gregtech.api.objects.XSTR; @@ -7,12 +8,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.TreeSet; +import java.util.*; import static com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStackTree.stackUpTree; -import static com.github.technus.tectech.elementalMatter.commonValues.DEBUGMODE; import static com.github.technus.tectech.elementalMatter.definitions.eBosonDefinition.boson_Y__; import static com.github.technus.tectech.elementalMatter.definitions.eBosonDefinition.deadEnd; @@ -21,8 +19,11 @@ import static com.github.technus.tectech.elementalMatter.definitions.eBosonDefin */ public final class dAtomDefinition extends cElementalDefinition { private static final byte nbtType=(byte)'a'; - private static final XSTR xstr = new XSTR(); - private static final HashMap> stableIsotopes=new HashMap<>(); + private static final Random xstr = new XSTR();//NEEDS SEPARATE! + private static HashMap> stableIsotopes=new HashMap<>(); + private static final TreeMap stableAtoms=new TreeMap<>(); + private static HashMap> mostStableUnstableIsotopes=new HashMap<>(); + private static final TreeMap unstableAtoms=new TreeMap<>(); private static cElementalDefinitionStack alfa; //float-mass in eV/c^2 @@ -240,7 +241,7 @@ public final class dAtomDefinition extends cElementalDefinition { if(type!=1) return (negative?"~? ":"? ") +nomenclature.Name[element]; return negative?"~"+ nomenclature.Name[element]:nomenclature.Name[element]; }catch(Exception e){ - if(DEBUGMODE)e.printStackTrace(); + if(TecTech.ModConfig.DEBUG_MODE)e.printStackTrace(); return (negative?"Element: ~":"Element: ") + element; } } @@ -252,12 +253,12 @@ public final class dAtomDefinition extends cElementalDefinition { try{ return (negative?"~":"") + nomenclature.Symbol[element]+" N:"+isotope+" I:"+getIonization(); }catch(Exception e){ - if(DEBUGMODE)e.printStackTrace(); + if(TecTech.ModConfig.DEBUG_MODE)e.printStackTrace(); try { int s100 = element / 100, s1 = (element/10) % 10, s10 = (element) % 10; return (negative?"~":"") + nomenclature.SymbolIUPAC[10+s100]+nomenclature.SymbolIUPAC[s10]+nomenclature.SymbolIUPAC[s1]+ " N:" + isotope + " I:" + getIonization(); }catch (Exception E){ - if(DEBUGMODE)e.printStackTrace(); + if(TecTech.ModConfig.DEBUG_MODE)e.printStackTrace(); return (negative?"~":"") + "? N:"