aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTechnus <daniel112092@gmail.com>2017-03-11 16:48:51 +0100
committerTechnus <daniel112092@gmail.com>2017-03-11 16:48:51 +0100
commit0fd5222f872d63f837eab046bbff34af9d9ea4db (patch)
treec0e9d151ec7e27769614ef3204c50fde4fbae318 /src
parent8d988d22cee98c1d235c3a2c16ac251e689a4e42 (diff)
downloadGT5-Unofficial-0fd5222f872d63f837eab046bbff34af9d9ea4db.tar.gz
GT5-Unofficial-0fd5222f872d63f837eab046bbff34af9d9ea4db.tar.bz2
GT5-Unofficial-0fd5222f872d63f837eab046bbff34af9d9ea4db.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/github/technus/tectech/CustomItemList.java10
-rw-r--r--src/main/java/com/github/technus/tectech/GT_CustomLoader.java21
-rw-r--r--src/main/java/com/github/technus/tectech/GT_Loader_Machines.java (renamed from src/main/java/com/github/technus/tectech/GT_Loader_Elemental.java)53
-rw-r--r--src/main/java/com/github/technus/tectech/GT_Loader_Recipes.java35
-rw-r--r--src/main/java/com/github/technus/tectech/TecTech.java49
-rw-r--r--src/main/java/com/github/technus/tectech/XSTR.java255
-rw-r--r--src/main/java/com/github/technus/tectech/auxiliary/TecTechConfig.java10
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/classes/Behaviour_elementalMatterContainer.java5
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinition.java4
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStack.java10
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalPrimitive.java5
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/commonValues.java2
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/definitions/dAtomDefinition.java92
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/definitions/dHadronDefinition.java12
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_GUIContainer_MultiMachineEM.java1
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_GUIContainer_Uncertainty.java6
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/gui/GT_GUIContainer_UncertaintyAdv.java2
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Computer.java50
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMbhg.java2
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMdequantifier.java6
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMjunction.java13
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMquantifier.java328
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_EMtransformer.java102
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_DynamoMulti.java2
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_ElementalContainer.java45
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_EnergyMulti.java2
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_MufflerElemental.java12
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_Hatch_Uncertainty.java9
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/machine/GT_MetaTileEntity_MultiblockBase_Elemental.java541
-rw-r--r--src/main/resources/assets/gregtech/textures/blocks/iconsets/PARAM_ACTIVE.pngbin5289 -> 783 bytes
-rw-r--r--src/main/resources/assets/tectech/lang/en_US.lang3
31 files changed, 1391 insertions, 296 deletions
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_Machines.java
index 73fd076604..f11bd7f3ff 100644
--- a/src/main/java/com/github/technus/tectech/GT_Loader_Elemental.java
+++ b/src/main/java/com/github/technus/tectech/GT_Loader_Machines.java
@@ -1,38 +1,12 @@
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 class GT_Loader_Machines 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
// ===================================================================================================
@@ -196,21 +170,24 @@ public class GT_Loader_Elemental implements Runnable {
// 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));
+ 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(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));
+ 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
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
+ * <code>setSeed(System.currentTimeMillis());</code>.
+ */
+ 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 <code>setSeed(seed);</code>.
+ *
+ * @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:
+ * <pre> {@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;
+ * }}</pre>
+ *
+ * <p>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.
+ * <p>
+ * 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.
+ * <p>
+ * 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 <i>low-order</i> 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;