aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/api/objects
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/api/objects')
-rw-r--r--src/Java/gtPlusPlus/api/objects/Logger.java156
-rw-r--r--src/Java/gtPlusPlus/api/objects/data/AutoMap.java21
-rw-r--r--src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java18
-rw-r--r--src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java53
-rw-r--r--src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java39
-rw-r--r--src/Java/gtPlusPlus/api/objects/data/WeightedCollection.java102
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java2
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/CubicObject.java62
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java2
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/SafeTexture.java64
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/ShapedRecipe.java12
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java2
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java2
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java27
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/multi/SpecialMultiBehaviour.java44
-rw-r--r--src/Java/gtPlusPlus/api/objects/random/XSTR.java9
16 files changed, 537 insertions, 78 deletions
diff --git a/src/Java/gtPlusPlus/api/objects/Logger.java b/src/Java/gtPlusPlus/api/objects/Logger.java
index f994c40b52..9c1e3d4338 100644
--- a/src/Java/gtPlusPlus/api/objects/Logger.java
+++ b/src/Java/gtPlusPlus/api/objects/Logger.java
@@ -6,11 +6,12 @@ import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.proxy.ClientProxy;
+import gtPlusPlus.preloader.asm.AsmConfig;
public class Logger {
-
+
public Logger(String string) {
-
+
}
// Logging Functions
@@ -22,133 +23,170 @@ public class Logger {
return gtPlusPlusLogger;
}
+ private static final boolean enabled = !AsmConfig.disableAllLogging;
+
public static final org.apache.logging.log4j.Logger getLogger(){
return modLogger;
}
// Non-Dev Comments
public static void INFO(final String s) {
- modLogger.info(s);
+ if (enabled) {
+ modLogger.info(s);
+ }
}
// Non-Dev Comments
public static void MACHINE_INFO(final String s) {
-
- boolean localPlayer = false;
- try {
- if (ClientProxy.playerName != null){
- if (ClientProxy.playerName.toLowerCase().contains("draknyte1")){
- localPlayer = true;
+ if (enabled) {
+
+ boolean localPlayer = false;
+ try {
+ if (ClientProxy.playerName != null){
+ if (ClientProxy.playerName.toLowerCase().contains("draknyte1")){
+ localPlayer = true;
+ }
}
}
- }
- catch (final Throwable t){
-
- }
-
- if (CORE.ConfigSwitches.MACHINE_INFO || localPlayer) {
- final String name1 = gtPlusPlus.core.util.reflect.ReflectionUtils.getMethodName(2);
- modLogger.info("Machine Info: " + s + " | " + name1);
+ catch (final Throwable t){
+
+ }
+
+ if (CORE.ConfigSwitches.MACHINE_INFO || localPlayer) {
+ final String name1 = gtPlusPlus.core.util.reflect.ReflectionUtils.getMethodName(2);
+ modLogger.info("Machine Info: " + s + " | " + name1);
+ }
}
}
// Developer Comments
public static void WARNING(final String s) {
- if (CORE.DEBUG) {
- modLogger.warn(s);
+ if (enabled) {
+ if (CORE.DEBUG) {
+ modLogger.warn(s);
+ }
}
}
// Errors
public static void ERROR(final String s) {
- if (CORE.DEBUG) {
- modLogger.fatal(s);
+ if (enabled) {
+ if (CORE.DEBUG) {
+ modLogger.fatal(s);
+ }
}
}
// Developer Logger
public static void SPECIFIC_WARNING(final String whatToLog, final String msg, final int line) {
- // if (!CORE.DEBUG){
- FMLLog.warning("GT++ |" + line + "| " + whatToLog + " | " + msg);
- // }
+ if (enabled) {
+ // if (!CORE.DEBUG){
+ FMLLog.warning("GT++ |" + line + "| " + whatToLog + " | " + msg);
+ // }
+ }
}
// ASM Comments
public static void LOG_ASM(final String s) {
- FMLRelaunchLog.info("[Special ASM Logging] ", s);
- }
-
-
-
-
-
-
-
-
-
-
+ if (enabled) {
+ FMLRelaunchLog.info("[Special ASM Logging] ", s);
+ }
+ }
+
+
+
+
+
+
+
+
+
+
/**
* Special Loggers
*/
-
+
/**
* Special Logger for Bee related content
*/
public static void BEES(final String s) {
- if (CORE.DEVENV || CORE.DEBUG)
- modLogger.info("[Bees] "+s);
+ if (enabled) {
+ if (CORE.DEVENV || CORE.DEBUG) {
+ modLogger.info("[Bees] "+s);
+ }
+ }
}
/**
* Special Logger for Debugging Bee related content
*/
public static void DEBUG_BEES(final String s) {
- if (CORE.DEVENV || CORE.DEBUG)
- modLogger.info("[Debug][Bees] "+s);
+ if (enabled) {
+ if (CORE.DEVENV || CORE.DEBUG) {
+ modLogger.info("[Debug][Bees] "+s);
+ }
+ }
}
-
-
-
+
+
+
/**
* Special Logger for Materials related content
*/
public static void MATERIALS(final String s) {
- if (CORE.DEVENV || CORE.DEBUG)
- modLogger.info("[Materials] "+s);
+ if (enabled) {
+ if (/* CORE.DEVENV || */CORE.DEBUG) {
+ modLogger.info("[Materials] "+s);
+ }
+ }
}
/**
* Special Logger for Debugging Materials related content
*/
public static void DEBUG_MATERIALS(final String s) {
- if (CORE.DEVENV || CORE.DEBUG)
- modLogger.info("[Debug][Materials] "+s);
+ if (enabled) {
+ if (CORE.DEVENV || CORE.DEBUG) {
+ modLogger.info("[Debug][Materials] "+s);
+ }
+ }
}
-
+
/**
* Special Logger for Reflection related content
*/
public static void REFLECTION(final String s) {
- if (CORE.DEVENV || CORE.DEBUG)
- modLogger.info("[Reflection] "+s);
+ if (enabled) {
+ if (CORE.DEVENV || CORE.DEBUG) {
+ modLogger.info("[Reflection] "+s);
+ }
+ }
}
-
+
/**
* Special Logger for Darkworld related content
*/
public static void WORLD(final String s) {
- if (CORE.DEVENV || CORE.DEBUG)
- modLogger.info("[WorldGen] "+s);
+ if (enabled) {
+ if (CORE.DEVENV || CORE.DEBUG) {
+ modLogger.info("[WorldGen] "+s);
+ }
+ }
}
public static void RECIPE(String string) {
- if (/*CORE.DEVENV || */CORE.DEBUG)
- modLogger.info("[Recipe] "+string);
+ if (enabled) {
+ if (/*CORE.DEVENV || */CORE.DEBUG) {
+ modLogger.info("[Recipe] "+string);
+ }
+ }
}
public static void SPACE(final String s) {
- modLogger.info("[Space] "+s);
+ if (enabled) {
+ modLogger.info("[Space] "+s);
+ }
}
-
-
+
+
}
diff --git a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java
index 3583a04a74..02517097cf 100644
--- a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java
+++ b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java
@@ -70,6 +70,20 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable, Collect
}
}
}
+
+ /**
+ * Generates an AutoMap from a Array.
+ * @param aArray - Data to be inserted into the AutoMap.
+ */
+ public AutoMap(V[] aArray) {
+ mInternalMap = new LinkedHashMap<Integer, V>();
+ mInternalNameMap = new LinkedHashMap<String, Integer>();
+ if (aArray != null && aArray.length > 0) {
+ for (V obj : aArray) {
+ add(obj);
+ }
+ }
+ }
@Override
public Iterator<V> iterator() {
@@ -212,11 +226,12 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable, Collect
@Override
public boolean retainAll(Collection<?> c) {
- AutoMap<?> aTempAllocation = new AutoMap();
+ AutoMap<?> aTempAllocation = new AutoMap<Object>();
boolean aTrue = false;
aTempAllocation = this;
- aTempAllocation.removeAll(c);
- aTrue = this.removeAll(aTempAllocation);
+ aTempAllocation.removeAll(c);
+ aTempAllocation.clear();
+ aTrue = aTempAllocation.isEmpty();
aTempAllocation.clear();
return aTrue;
}
diff --git a/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java b/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java
new file mode 100644
index 0000000000..991908e402
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java
@@ -0,0 +1,18 @@
+package gtPlusPlus.api.objects.data;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+public class ConcurrentHashSet<V> extends ConcurrentSet<V> {
+
+ private static final long serialVersionUID = -1293478938482781728L;
+
+ public ConcurrentHashSet() {
+ this(new ConcurrentHashMap<Integer, V>());
+ }
+
+ public ConcurrentHashSet(ConcurrentMap<Integer, V> defaultMapType) {
+ super(defaultMapType);
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java b/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java
new file mode 100644
index 0000000000..1d3ffc1c01
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java
@@ -0,0 +1,53 @@
+package gtPlusPlus.api.objects.data;
+
+import java.io.Serializable;
+import java.util.AbstractSet;
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentMap;
+
+public abstract class ConcurrentSet<E> extends AbstractSet<E> implements Serializable {
+
+ private static final long serialVersionUID = -6761513279741915432L;
+
+ private final ConcurrentMap<Integer, E> mInternalMap;
+
+ private int mInternalID = 0;
+
+ /**
+ * Creates a new instance which wraps the specified {@code map}.
+ */
+ public ConcurrentSet(ConcurrentMap<Integer, E> aMap) {
+ mInternalMap = aMap;
+ }
+
+ @Override
+ public int size() {
+ return mInternalMap.size();
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return mInternalMap.containsKey(o);
+ }
+
+ @Override
+ public boolean add(E o) {
+ return mInternalMap.putIfAbsent(mInternalID++, o) == null;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return mInternalMap.remove(o) != null;
+ }
+
+ @Override
+ public void clear() {
+ this.mInternalID = 0;
+ mInternalMap.clear();
+ }
+
+ @Override
+ public Iterator<E> iterator() {
+ return mInternalMap.values().iterator();
+ }
+}
diff --git a/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java b/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java
new file mode 100644
index 0000000000..64f57b4e5a
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java
@@ -0,0 +1,39 @@
+package gtPlusPlus.api.objects.data;
+
+import java.io.Serializable;
+
+import com.google.common.base.Objects;
+
+public class FlexiblePair<K,V> implements Serializable {
+
+ /**
+ * SVUID
+ */
+ private static final long serialVersionUID = 1250550491092812443L;
+ private final K key;
+ private V value;
+
+ public FlexiblePair(final K key, final V value){
+ this.key = key;
+ this.value = value;
+ }
+
+ final public K getKey(){
+ return this.key;
+ }
+
+ final public V getValue(){
+ return this.value;
+ }
+
+ final public void setValue(V aObj) {
+ value = aObj;
+ }
+
+ @Override
+ public int hashCode() {
+ Integer aCode = Objects.hashCode(getKey(), getValue());
+ return aCode != null ? aCode : super.hashCode();
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/api/objects/data/WeightedCollection.java b/src/Java/gtPlusPlus/api/objects/data/WeightedCollection.java
new file mode 100644
index 0000000000..f9966474b0
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/data/WeightedCollection.java
@@ -0,0 +1,102 @@
+package gtPlusPlus.api.objects.data;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.NavigableMap;
+import java.util.Random;
+import java.util.Set;
+import java.util.TreeMap;
+
+import gtPlusPlus.api.objects.random.XSTR;
+
+public class WeightedCollection<E> implements Map<Integer, E> {
+
+ private NavigableMap<Integer, E> map = new TreeMap<Integer, E>();
+ private Random random;
+ private int total = 0;
+
+ public WeightedCollection() {
+ this(new XSTR());
+ }
+
+ public WeightedCollection(Random random) {
+ this.random = random;
+ }
+
+ public E add(int weight, E object) {
+ if (weight <= 0) return null;
+ total += weight;
+ return map.put(total, object);
+ }
+
+ private E next() {
+ int value = random.nextInt(total) + 1; // Can also use floating-point weights
+ return map.ceilingEntry(value).getValue();
+ }
+
+ @Override
+ public int size() {
+ return map.size();
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return map.isEmpty();
+ }
+
+ @Override
+ public boolean containsKey(Object key) {
+ return map.containsKey(key);
+ }
+
+ @Override
+ public boolean containsValue(Object value) {
+ return map.containsValue(value);
+ }
+
+ public E get() {
+ return next();
+ }
+
+ @Override
+ public E get(Object key) {
+ return next();
+ }
+
+ @Override
+ public void putAll(Map m) {
+ map.putAll(m);
+ }
+
+ @Override
+ public void clear() {
+ map.clear();
+ this.total = 0;
+ }
+
+ @Override
+ public Set keySet() {
+ return map.keySet();
+ }
+
+ @Override
+ public Collection values() {
+ return map.values();
+ }
+
+ @Override
+ public Set entrySet() {
+ return map.entrySet();
+ }
+
+ @Override
+ public E put(Integer key, E value) {
+ return add(key, value);
+ }
+
+ @Override
+ public E remove(Object key) {
+ return map.remove(key);
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java b/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java
index 7c11e7232b..ab359c3853 100644
--- a/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java
@@ -19,7 +19,7 @@ public class BlockPos implements Serializable{
public final int yPos;
public final int zPos;
public final int dim;
- public final World world;
+ public final transient World world;
public static BlockPos generateBlockPos(String sUUID) {
String[] s2 = sUUID.split("@");
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/CubicObject.java b/src/Java/gtPlusPlus/api/objects/minecraft/CubicObject.java
new file mode 100644
index 0000000000..8c76513d09
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/CubicObject.java
@@ -0,0 +1,62 @@
+package gtPlusPlus.api.objects.minecraft;
+
+import gtPlusPlus.api.objects.data.AutoMap;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class CubicObject<T> {
+
+ public final T NORTH;
+ public final T SOUTH;
+
+ public final T WEST;
+ public final T EAST;
+
+ public final T UP;
+ public final T DOWN;
+
+ public CubicObject(AutoMap<T> aDataSet) {
+ this(aDataSet.get(0), aDataSet.get(1), aDataSet.get(2), aDataSet.get(3), aDataSet.get(4), aDataSet.get(5));
+ }
+
+ public CubicObject(T[] aDataSet) {
+ this(aDataSet[0], aDataSet[1], aDataSet[2], aDataSet[3], aDataSet[4], aDataSet[5]);
+ }
+
+ public CubicObject(T aDOWN, T aUP, T aNORTH, T aSOUTH, T aWEST, T aEAST) {
+ DOWN = aDOWN;
+ UP = aUP;
+ NORTH = aNORTH;
+ SOUTH = aSOUTH;
+ WEST = aWEST;
+ EAST = aEAST;
+ }
+
+ public T get(int aSide) {
+ return get(ForgeDirection.getOrientation(aSide));
+ }
+
+ public T get(ForgeDirection aSide) {
+ if (aSide == ForgeDirection.DOWN) {
+ return DOWN;
+ }
+ else if (aSide == ForgeDirection.UP) {
+ return UP;
+ }
+ else if (aSide == ForgeDirection.NORTH) {
+ return NORTH;
+ }
+ else if (aSide == ForgeDirection.SOUTH) {
+ return SOUTH;
+ }
+ else if (aSide == ForgeDirection.WEST) {
+ return WEST;
+ }
+ else if (aSide == ForgeDirection.EAST) {
+ return EAST;
+ }
+ else {
+ return null;
+ }
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java b/src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java
index d0c1f3f040..d5db8081dc 100644
--- a/src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java
@@ -12,7 +12,7 @@ import net.minecraftforge.common.DimensionManager;
public class FakeBlockPos extends BlockPos {
private static final long serialVersionUID = -6442245826092414593L;
- private Block aBlockAtPos;
+ private transient Block aBlockAtPos;
private int aBlockMetaAtPos = 0;
public static FakeBlockPos generateBlockPos(String sUUID) {
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/SafeTexture.java b/src/Java/gtPlusPlus/api/objects/minecraft/SafeTexture.java
new file mode 100644
index 0000000000..7c418b5a77
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/SafeTexture.java
@@ -0,0 +1,64 @@
+package gtPlusPlus.api.objects.minecraft;
+
+import java.util.HashMap;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.GregTech_API;
+import gtPlusPlus.core.util.Utils;
+import net.minecraft.util.IIcon;
+
+/**
+ * A Server Side safe object that can hold {@link IIcon}s.
+ * @author Alkalus
+ *
+ */
+public class SafeTexture implements Runnable {
+
+ @SideOnly(Side.CLIENT)
+ private static final HashMap<Integer, IIcon> mHashToIconCache = new HashMap<Integer, IIcon>();
+
+ @SideOnly(Side.CLIENT)
+ private static final HashMap<String, Integer> mPathToHashCash = new HashMap<String, Integer>();
+
+ private static final HashMap<String, SafeTexture> mTextureObjectCache = new HashMap<String, SafeTexture>();
+
+ private final int mHash;
+
+ private final String mTextureName;
+
+ private final static String getKey(String aTexPath) {
+ String aNameKey = Utils.sanitizeString(aTexPath);
+ aNameKey = aNameKey.replace('/', ' ');
+ aNameKey = aNameKey.toLowerCase();
+ return aNameKey;
+ }
+
+ public static SafeTexture register(String aTexturePath) {
+ String aNameKey = getKey(aTexturePath);
+ SafeTexture g = mTextureObjectCache.get(aNameKey);
+ if (g == null) {
+ g = new SafeTexture(aTexturePath);
+ mTextureObjectCache.put(aNameKey, g);
+ mPathToHashCash.put(aTexturePath, aTexturePath.hashCode());
+ }
+ return g;
+ }
+
+ private SafeTexture(String aTexturePath) {
+ mTextureName = aTexturePath;
+ mHash = getKey(aTexturePath).hashCode();
+ GregTech_API.sGTBlockIconload.add(this);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon() {
+ return mHashToIconCache.get(mHash);
+ }
+
+ @Override
+ public void run() {
+ mHashToIconCache.put(getKey(mTextureName).hashCode(), GregTech_API.sBlockIcons.registerIcon(mTextureName));
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/ShapedRecipe.java b/src/Java/gtPlusPlus/api/objects/minecraft/ShapedRecipe.java
index 1073e63914..c0e9b20c54 100644
--- a/src/Java/gtPlusPlus/api/objects/minecraft/ShapedRecipe.java
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/ShapedRecipe.java
@@ -3,11 +3,7 @@ package gtPlusPlus.api.objects.minecraft;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.api.objects.data.Pair;
-import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.everglades.dimension.Dimension_Everglades;
-import gtPlusPlus.xmod.forestry.bees.items.FR_ItemRegistry;
-import gtPlusPlus.xmod.ic2.item.IC2_Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
@@ -36,13 +32,7 @@ public class ShapedRecipe {
String[] aLoggingInfo = new String[9];
if (mBlackList == null) {
- mBlackList = new ItemStack[] {
- ItemUtils.getSimpleStack(ModBlocks.blockNet),
- ItemUtils.getSimpleStack(ModBlocks.blockXpConverter),
- ItemUtils.getSimpleStack(ModBlocks.blockWitherGuard),
- ItemUtils.getSimpleStack(ModBlocks.blockMiningExplosive),
- ItemUtils.getSimpleStack(Dimension_Everglades.blockPortalFrame),
- };
+ mBlackList = new ItemStack[] {};
}
//Just to be safe
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java b/src/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java
index 393d3260b5..b7462250b1 100644
--- a/src/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java
@@ -21,7 +21,7 @@ public class ThreadFakeWorldGenerator extends Thread {
public ThreadFakeWorldGenerator() {
setName("gtpp.handler.fakeworldtrees");
- run();
+ start();
}
public static ThreadFakeWorldGenerator getInstance() {
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java b/src/Java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java
index a5f466b19f..0ff6e112ac 100644
--- a/src/Java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java
@@ -33,7 +33,7 @@ public class ThreadPooCollector extends Thread {
public ThreadPooCollector() {
setName("gtpp.handler.poop");
- run();
+ start();
}
public static ThreadPooCollector getInstance() {
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java
new file mode 100644
index 0000000000..4dc032d01f
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java
@@ -0,0 +1,27 @@
+package gtPlusPlus.api.objects.minecraft.multi;
+
+import gtPlusPlus.core.recipe.common.CI;
+import net.minecraft.item.ItemStack;
+
+public class NoOutputBonusMultiBehaviour extends SpecialMultiBehaviour {
+
+ public NoOutputBonusMultiBehaviour() {
+ // Used by other mods which may wish to not obtain bonus outputs on their Sifting or Maceration recipes.
+ }
+
+ @Override
+ public ItemStack getTriggerItem() {
+ return CI.getNumberedBioCircuit(22);
+ }
+
+ @Override
+ public String getTriggerItemTooltip() {
+ return "Prevents bonus output % on GT++ multiblocks when used";
+ }
+
+ @Override
+ public int getOutputChanceRoll() {
+ return 10000;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/multi/SpecialMultiBehaviour.java b/src/Java/gtPlusPlus/api/objects/minecraft/multi/SpecialMultiBehaviour.java
new file mode 100644
index 0000000000..e562ccc40b
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/multi/SpecialMultiBehaviour.java
@@ -0,0 +1,44 @@
+package gtPlusPlus.api.objects.minecraft.multi;
+
+import gregtech.api.util.GT_Utility;
+import net.minecraft.item.ItemStack;
+
+/**
+ * Extend this class to implement custom behaviour for multiblocks.
+ * The Trigger item when in a special slot or input bus, will cause the multiblock to behave as specified.
+ * Not overriding a method here will cause the default values to be used.
+ * @author Alkalus
+ *
+ */
+public abstract class SpecialMultiBehaviour {
+
+ private final int mMaxParallelRecipes = Short.MIN_VALUE;
+ private final int mEUPercent = Short.MIN_VALUE;
+ private final int mSpeedBonusPercent = Short.MIN_VALUE;
+ private final int mOutputChanceRoll = Short.MIN_VALUE;
+
+ public abstract ItemStack getTriggerItem();
+
+ public abstract String getTriggerItemTooltip();
+
+ public int getMaxParallelRecipes() {
+ return this.mMaxParallelRecipes;
+ }
+
+ public int getEUPercent() {
+ return this.mEUPercent;
+ }
+
+ public int getSpeedBonusPercent() {
+ return this.mSpeedBonusPercent;
+ }
+
+ public int getOutputChanceRoll() {
+ return this.mOutputChanceRoll;
+ }
+
+ public final boolean isTriggerItem(ItemStack aToMatch) {
+ return GT_Utility.areStacksEqual(getTriggerItem(), aToMatch, false);
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/api/objects/random/XSTR.java b/src/Java/gtPlusPlus/api/objects/random/XSTR.java
index 4b5b1298b6..6ce1cbeb6c 100644
--- a/src/Java/gtPlusPlus/api/objects/random/XSTR.java
+++ b/src/Java/gtPlusPlus/api/objects/random/XSTR.java
@@ -33,7 +33,7 @@ import java.util.concurrent.atomic.AtomicLong;
* 03.06.2016
* version 0.0.4
*/
-public class XSTR extends Random {
+public class XSTR extends Random implements Cloneable {
private static final long serialVersionUID = 6208727693524452904L;
private long seed;
@@ -115,6 +115,13 @@ public class XSTR extends Random {
*/
@Override
public XSTR clone() {
+ try {
+ super.clone();
+ }
+ catch (CloneNotSupportedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
return new XSTR(this.getSeed());
}