aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTechnus <daniel112092@gmail.com>2017-05-06 11:12:26 +0200
committerTechnus <daniel112092@gmail.com>2017-05-06 11:12:26 +0200
commit528346d781e55ec55451f4fd06dce2ecd78b3203 (patch)
tree20861562c9fc6f62f98342878fe4dcd84f14aa94 /src
parent6867a4945e17a16273545dd5fe9781b8e52acfc1 (diff)
downloadGT5-Unofficial-528346d781e55ec55451f4fd06dce2ecd78b3203.tar.gz
GT5-Unofficial-528346d781e55ec55451f4fd06dce2ecd78b3203.tar.bz2
GT5-Unofficial-528346d781e55ec55451f4fd06dce2ecd78b3203.zip
Minor api changes and stuff
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/github/technus/tectech/TecTech.java6
-rw-r--r--src/main/java/com/github/technus/tectech/Util.java15
-rw-r--r--src/main/java/com/github/technus/tectech/auxiliary/TecTechConfig.java9
-rw-r--r--src/main/java/com/github/technus/tectech/dataFramework/quantumDataPacket.java3
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDecay.java14
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinition.java20
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStackMap.java (renamed from src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStackTree.java)38
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStack.java32
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStackMap.java (renamed from src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStackTree.java)40
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalPrimitive.java20
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/classes/rElementalRecipe.java13
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/classes/rElementalRecipeTree.java23
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/definitions/dAtomDefinition.java67
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/definitions/dHadronDefinition.java31
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iElementalDefinition.java4
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iElementalInstanceContainer.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/DebugContainer_EM.java14
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java13
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java9
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java3
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java5
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java17
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java38
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java7
28 files changed, 254 insertions, 213 deletions
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java
index 9014a71c52..78cc01eca9 100644
--- a/src/main/java/com/github/technus/tectech/TecTech.java
+++ b/src/main/java/com/github/technus/tectech/TecTech.java
@@ -123,13 +123,13 @@ public class TecTech {
for(Materials m:Materials.values()){
FluidStack p=m.getPlasma(1);
if( p!=null) {
- if(ModConfig.DEBUG_MODE) TecTech.Logger.info("Found Plasma of "+m.name());
+ if(TecTechConfig.DEBUG_MODE) TecTech.Logger.info("Found Plasma of "+m.name());
if (m.mElement != null &&
(m.mElement.mProtons >= Materials.Iron.mElement.mProtons ||
-m.mElement.mProtons >= Materials.Iron.mElement.mProtons ||
m.mElement.mNeutrons >= Materials.Iron.mElement.mNeutrons ||
-m.mElement.mNeutrons >= Materials.Iron.mElement.mNeutrons)) {
- if (ModConfig.DEBUG_MODE) TecTech.Logger.info("Attempting to bind " + m.name());
+ if (TecTechConfig.DEBUG_MODE) TecTech.Logger.info("Attempting to bind " + m.name());
if (m.getMolten(1) != null) binds.put(p.getFluid(), m.getMolten(1).getFluid());
else if (m.getGas(1) != null) binds.put(p.getFluid(), m.getGas(1).getFluid());
else if (m.getFluid(1) != null) binds.put(p.getFluid(), m.getFluid(1).getFluid());
@@ -140,7 +140,7 @@ public class TecTech {
for(GT_Recipe r:GT_Recipe.GT_Recipe_Map.sFusionRecipes.mRecipeList){
Fluid f=binds.get(r.mFluidOutputs[0].getFluid());
if(f!=null){
- if(ModConfig.DEBUG_MODE) TecTech.Logger.info("Nerfing Recipe "+r.mFluidOutputs[0].getUnlocalizedName());
+ if(TecTechConfig.DEBUG_MODE) TecTech.Logger.info("Nerfing Recipe "+r.mFluidOutputs[0].getUnlocalizedName());
r.mFluidOutputs[0]=new FluidStack(f,r.mFluidInputs[0].amount);
}
}
diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java
index 2d14abea5a..154ed10eba 100644
--- a/src/main/java/com/github/technus/tectech/Util.java
+++ b/src/main/java/com/github/technus/tectech/Util.java
@@ -1,5 +1,6 @@
package com.github.technus.tectech;
+import com.github.technus.tectech.auxiliary.TecTechConfig;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.GregTech_API;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -97,12 +98,12 @@ public class Util {
pointer = block - '0';
//countable air -> net.minecraft.block.BlockAir
if (world.getBlock(x, y, z) != blockType[pointer]) {
- if (TecTech.ModConfig.DEBUG_MODE)
+ if (TecTechConfig.DEBUG_MODE)
TecTech.Logger.info("Struct-block-error " + x + " " + y + " " + z + " / " + a + " " + b + " " + c + " / " + world.getBlock(x, y, z).getUnlocalizedName() + " " + blockType[pointer].getUnlocalizedName());
return false;
}
if (world.getBlockMetadata(x, y, z) != blockMeta[pointer]) {
- if (TecTech.ModConfig.DEBUG_MODE)
+ if (TecTechConfig.DEBUG_MODE)
TecTech.Logger.info("Struct-meta-id-error " + x + " " + y + " " + z + " / " + a + " " + b + " " + c + " / " + world.getBlockMetadata(x, y, z) + " " + blockMeta[pointer]);
return false;
}
@@ -187,12 +188,12 @@ public class Util {
if((pointer = block - '0') >= 0) {
//countable air -> net.minecraft.block.BlockAir
if (world.getBlock(x, y, z) != blockType[pointer]) {
- if (TecTech.ModConfig.DEBUG_MODE)
+ if (TecTechConfig.DEBUG_MODE)
TecTech.Logger.info("Struct-block-error " + x + " " + y + " " + z + " / " + a + " " + b + " " + c + " / " + world.getBlock(x, y, z).getUnlocalizedName() + " " + blockType[pointer].getUnlocalizedName());
return false;
}
if (world.getBlockMetadata(x, y, z) != blockMeta[pointer]) {
- if (TecTech.ModConfig.DEBUG_MODE)
+ if (TecTechConfig.DEBUG_MODE)
TecTech.Logger.info("Struct-meta-id-error " + x + " " + y + " " + z + " / " + a + " " + b + " " + c + " / " + world.getBlockMetadata(x, y, z) + " " + blockMeta[pointer]);
return false;
}
@@ -201,18 +202,18 @@ public class Util {
try {
if(igt==null || !(boolean) adder.invoke(imt,addingMethods[pointer],igt,casingTextures[pointer])){
if (world.getBlock(x, y, z) != blockTypeFallback[pointer]) {
- if (TecTech.ModConfig.DEBUG_MODE)
+ if (TecTechConfig.DEBUG_MODE)
TecTech.Logger.info("Fallback-struct-block-error " + x + " " + y + " " + z + " / " + a + " " + b + " " + c + " / " + world.getBlock(x, y, z).getUnlocalizedName() + " " + blockTypeFallback[pointer].getUnlocalizedName());
return false;
}
if (world.getBlockMetadata(x, y, z) != blockMetaFallback[pointer]) {
- if (TecTech.ModConfig.DEBUG_MODE)
+ if (TecTechConfig.DEBUG_MODE)
TecTech.Logger.info("Fallback-Struct-meta-id-error " + x + " " + y + " " + z + " / " + a + " " + b + " " + c + " / " + world.getBlockMetadata(x, y, z) + " " + blockMetaFallback[pointer]);
return false;
}
}
}catch (InvocationTargetException | IllegalAccessException e){
- if(TecTech.ModConfig.DEBUG_MODE) e.printStackTrace();
+ if(TecTechConfig.DEBUG_MODE) e.printStackTrace();
return false;
}
}
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 65aec9ac19..036d7d6784 100644
--- a/src/main/java/com/github/technus/tectech/auxiliary/TecTechConfig.java
+++ b/src/main/java/com/github/technus/tectech/auxiliary/TecTechConfig.java
@@ -11,14 +11,15 @@ public class TecTechConfig extends ConfigManager {
public boolean ModAdminErrorLogs_Enabled;
- public boolean DEBUG_MODE;
+ //final static to allow compiler to remove the debug code when this is false
+ public static final boolean DEBUG_MODE = true;
public boolean BOOM_ENABLE;
public boolean NERF_FUSION;
@Override
protected void PreInit() {
ModAdminErrorLogs_Enabled = false;
- DEBUG_MODE = false;
+ //DEBUG_MODE = false;
BOOM_ENABLE = true;
NERF_FUSION = true;
}
@@ -27,8 +28,8 @@ public class TecTechConfig extends ConfigManager {
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");
+ //DEBUG_MODE = _mainConfig.getBoolean("DebugPrint", "Debug", DEBUG_MODE,
+ // "Enables logging");
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)");
NERF_FUSION = _mainConfig.getBoolean("NerfFusion", "Features", NERF_FUSION,
diff --git a/src/main/java/com/github/technus/tectech/dataFramework/quantumDataPacket.java b/src/main/java/com/github/technus/tectech/dataFramework/quantumDataPacket.java
index 78229bd6a1..9e304b1694 100644
--- a/src/main/java/com/github/technus/tectech/dataFramework/quantumDataPacket.java
+++ b/src/main/java/com/github/technus/tectech/dataFramework/quantumDataPacket.java
@@ -3,6 +3,7 @@ package com.github.technus.tectech.dataFramework;
import com.github.technus.tectech.vec3pos;
import net.minecraft.nbt.NBTTagCompound;
+import java.util.Set;
import java.util.TreeSet;
/**
@@ -12,7 +13,7 @@ public class quantumDataPacket {
public static byte maxHistory =64;
public long computation=0;
- public TreeSet<vec3pos> trace=new TreeSet<>();
+ public Set<vec3pos> trace=new TreeSet<>();
public quantumDataPacket(vec3pos pos,long computation){
this.computation=computation;
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDecay.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDecay.java
index 7b9dcd91dc..19d3b1566b 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDecay.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDecay.java
@@ -12,7 +12,7 @@ public final class cElementalDecay {
//Or cast null into ARRAY type but this static is more convenient!!!
public static final cElementalDecay[] noProduct = new cElementalDecay[0];
//this in turn can be used to tell that the thing should just vanish
- public final cElementalDefinitionStackTree outputStacks;
+ public final cElementalDefinitionStackMap outputStacks;
public final float probability;
public cElementalDecay(iElementalDefinition... outSafe) {
@@ -24,7 +24,7 @@ public final class cElementalDecay {
for (int i = 0; i < outArr.length; i++) {
outArr[i] = new cElementalDefinitionStack(outSafe[i], 1);
}
- this.outputStacks = new cElementalDefinitionStackTree(outArr);
+ this.outputStacks = new cElementalDefinitionStackMap(outArr);
this.probability = probability;
}
@@ -33,21 +33,21 @@ public final class cElementalDecay {
}
public cElementalDecay(float probability, cElementalDefinitionStack... out) {
- this.outputStacks = new cElementalDefinitionStackTree(out);
+ this.outputStacks = new cElementalDefinitionStackMap(out);
this.probability = probability;
}
- public cElementalDecay(cElementalDefinitionStackTree tree) {
+ public cElementalDecay(cElementalDefinitionStackMap tree) {
this(2F, tree);
}
- public cElementalDecay(float probability, cElementalDefinitionStackTree tree) {
+ public cElementalDecay(float probability, cElementalDefinitionStackMap tree) {
this.outputStacks = tree;
this.probability = probability;
}
- public cElementalInstanceStackTree getResults(float lifeMult, long age, int energy, int amountDecaying) {
- cElementalInstanceStackTree decayResult = new cElementalInstanceStackTree();
+ public cElementalInstanceStackMap getResults(float lifeMult, long age, int energy, int amountDecaying) {
+ cElementalInstanceStackMap decayResult = new cElementalInstanceStackMap();
if (outputStacks == null) return decayResult;//This is to prevent null pointer exceptions.
//Deny decay code is in instance!
int qtty = 0;
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 01a55805d8..28da3203b3 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,11 +1,12 @@
package com.github.technus.tectech.elementalMatter.classes;
-import com.github.technus.tectech.TecTech;
+import com.github.technus.tectech.auxiliary.TecTechConfig;
import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition;
import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition;
import net.minecraft.nbt.NBTTagCompound;
import java.lang.reflect.Method;
+import java.util.Map;
import java.util.TreeMap;
import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveDefinition.debug__;
@@ -15,7 +16,7 @@ import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveD
*/
public abstract class cElementalDefinition implements iElementalDefinition {
//add text based creators for recipe formula input?
- private static final TreeMap<Byte, Method> nbtCreationBind = new TreeMap<>();//creator methods in subclasses
+ private static final Map<Byte, Method> nbtCreationBind = new TreeMap<>();//creator methods in subclasses
protected static Method addCreatorFromNBT(byte b, Method m) {
return nbtCreationBind.put(b, m);
@@ -28,7 +29,7 @@ public abstract class cElementalDefinition implements iElementalDefinition {
try {
return (iElementalDefinition) nbtCreationBind.get(nbt.getByte("t")).invoke(null, nbt);
} catch (Exception e) {
- if (TecTech.ModConfig.DEBUG_MODE) e.printStackTrace();
+ if (TecTechConfig.DEBUG_MODE) e.printStackTrace();
return debug__;
}
}
@@ -59,9 +60,10 @@ public abstract class cElementalDefinition implements iElementalDefinition {
//use only for nested operations!
private static int compareDefinitionStacksWithAmount(cElementalDefinitionStack[] tc, cElementalDefinitionStack[] sc) {
- if (tc == null)
+ if (tc == null) {
if (sc == null) return 0;
else return -1;
+ }
if (sc == null) return 1;
if (tc.length > sc.length) return 1;
@@ -76,4 +78,14 @@ public abstract class cElementalDefinition implements iElementalDefinition {
}
return 0;
}
+
+ @Override
+ public int hashCode() {
+ int hash=getSubParticles().size();
+ int i=9;
+ for(cElementalDefinitionStack s:getSubParticles().values()){
+ hash+=s.hashCode()*(i++);
+ }
+ return hash;
+ }
}
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStackTree.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStackMap.java
index 969fa1cbf7..1abffb7a26 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStackTree.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStackMap.java
@@ -13,42 +13,42 @@ import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveD
/**
* Created by danie_000 on 22.01.2017.
*/
-public final class cElementalDefinitionStackTree implements Comparable<cElementalDefinitionStackTree> {
- private TreeMap<iElementalDefinition, cElementalDefinitionStack> tree = new TreeMap<>();
+public final class cElementalDefinitionStackMap implements Comparable<cElementalDefinitionStackMap> {
+ private Map<iElementalDefinition, cElementalDefinitionStack> tree = new TreeMap<>();
//Constructors
- public cElementalDefinitionStackTree() {
+ public cElementalDefinitionStackMap() {
}
@Deprecated
- public cElementalDefinitionStackTree(iElementalDefinition... in) {
+ public cElementalDefinitionStackMap(iElementalDefinition... in) {
if (in == null) return;
for (iElementalDefinition definition : in)
tree.put(definition, new cElementalDefinitionStack(definition, 1));
}
- public cElementalDefinitionStackTree(cElementalDefinitionStack... in) {
+ public cElementalDefinitionStackMap(cElementalDefinitionStack... in) {
if (in == null) return;
for (cElementalDefinitionStack stack : in)
tree.put(stack.definition, stack);
}
- private cElementalDefinitionStackTree(TreeMap<iElementalDefinition, cElementalDefinitionStack> in) {
+ private cElementalDefinitionStackMap(Map<iElementalDefinition, cElementalDefinitionStack> in) {
if (in == null) return;
tree = in;
}
- public cElementalDefinitionStackTree(cElementalDefinitionStackTree in) {
+ public cElementalDefinitionStackMap(cElementalDefinitionStackMap in) {
this(in.tree);
}
@Override
protected Object clone() throws CloneNotSupportedException {
- return new cElementalDefinitionStackTree(tree);
+ return new cElementalDefinitionStackMap(tree);
}
@Override
- public int compareTo(cElementalDefinitionStackTree o) {
+ public int compareTo(cElementalDefinitionStackMap o) {
if (tree.size() != o.tree.size()) return tree.size() - o.tree.size();
cElementalDefinitionStack[] ofThis = values(), ofThat = o.values();
for (int i = 0; i < ofThat.length; i++) {
@@ -155,11 +155,11 @@ public final class cElementalDefinitionStackTree implements Comparable<cElementa
return removeAllAmounts(testOnly, stacks);
}
- public boolean removeAllAmounts(boolean testOnly, cElementalDefinitionStackTree container) {
+ public boolean removeAllAmounts(boolean testOnly, cElementalDefinitionStackMap container) {
return removeAllAmounts(testOnly, container.values());
}
- public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStackTree container) {
+ public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStackMap container) {
return removeAllAmounts(testOnly, container.values());
}
@@ -177,7 +177,7 @@ public final class cElementalDefinitionStackTree implements Comparable<cElementa
this.tree.putAll(inTreeUnsafe);
}
- public void putReplaceAll(cElementalDefinitionStackTree inContainerUnsafe) {
+ public void putReplaceAll(cElementalDefinitionStackMap inContainerUnsafe) {
putReplaceAll(inContainerUnsafe.tree);
}
@@ -207,7 +207,7 @@ public final class cElementalDefinitionStackTree implements Comparable<cElementa
putUnify(in);
}
- public void putUnifyAll(cElementalDefinitionStackTree containerUnsafe) {
+ public void putUnifyAll(cElementalDefinitionStackMap containerUnsafe) {
putUnifyAll(containerUnsafe.tree);
}
@@ -279,28 +279,28 @@ public final class cElementalDefinitionStackTree implements Comparable<cElementa
return nbt;
}
- public static cElementalDefinitionStackTree fromNBT(NBTTagCompound nbt) throws tElementalException {
+ public static cElementalDefinitionStackMap fromNBT(NBTTagCompound nbt) throws tElementalException {
final cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")];
for (int i = 0; i < defStacks.length; i++) {
defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i)));
if (defStacks[i].definition.equals(debug__))
throw new tElementalException("Something went Wrong");
}
- return new cElementalDefinitionStackTree(defStacks);
+ return new cElementalDefinitionStackMap(defStacks);
}
//stackUp
@Deprecated
- public static cElementalDefinitionStackTree stackUpTree(iElementalDefinition... in) {
- final cElementalDefinitionStackTree inTree = new cElementalDefinitionStackTree();
+ public static cElementalDefinitionStackMap stackUpTree(iElementalDefinition... in) {
+ final cElementalDefinitionStackMap inTree = new cElementalDefinitionStackMap();
for (iElementalDefinition def : in) {
inTree.putUnify(new cElementalDefinitionStack(def, 1));
}
return inTree;
}
- public static cElementalDefinitionStackTree stackUpTree(cElementalDefinitionStack... in) {
- final cElementalDefinitionStackTree inTree = new cElementalDefinitionStackTree();
+ public static cElementalDefinitionStackMap stackUpTree(cElementalDefinitionStack... in) {
+ final cElementalDefinitionStackMap inTree = new cElementalDefinitionStackMap();
inTree.putUnifyAll(in);
return inTree;
}
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 1c4d165018..492de1b71e 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
@@ -14,7 +14,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
public final iElementalDefinition definition;
//energy - if positive then particle should try to decay
public int energy;
- //byte color; 0=R 1=G 2=B 0=C 1=M 2=Y, else ignored
+ //byte color; 0=Red 1=Green 2=Blue 3=Order 4=Earth 5=Water 0=Cyan 1=Magenta 2=Yellow 3=Entropy 4=Air 5=Fire, else ignored (-1 - uncolorable)
private byte color;
public long age;
public int amount;
@@ -36,7 +36,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
public cElementalInstanceStack(iElementalDefinition defSafe, int amount, float lifeTimeMult, long age, int energy) {
this.definition = defSafe == null ? null__ : defSafe;
byte color = definition.getColor();
- if (color < (byte) 0) {//transforms colorable??? into proper color
+ if (color < 0 || color >= 3) {//transforms colorable??? into proper color
this.color = color;
} else {
this.color = (byte) (TecTech.Rnd.nextInt(3));
@@ -70,20 +70,18 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
return definition;
}
- public byte getColor() {
+ public final byte getColor() {
return color;
}
- public byte setColor(byte color) {
- if (this.color < (byte) 0) return this.color;
- this.color = color;
- return this.color;
+ public final byte setColor(byte color) {//does not allow changing magic element
+ if (this.color < 0 || this.color >= 3 || color<0 || color>=3) return this.color;
+ return this.color = color;
}
- public byte nextColor() {
- if (this.color < (byte) 0) return this.color;
- this.color = (byte) (TecTech.Rnd.nextInt(3));
- return this.color;
+ public final byte nextColor() {//does not allow changing magic element
+ if (this.color < 0 || this.color >= 3 ) return this.color;
+ return this.color = (byte) (TecTech.Rnd.nextInt(3));
}
public float getLifeTime() {
@@ -100,11 +98,11 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
return lifeTimeMult;
}
- public cElementalInstanceStackTree decay() {
+ public cElementalInstanceStackMap decay() {
return decay(1F, age, 0);
}
- public cElementalInstanceStackTree decay(Float lifeTimeMult, long age, int postEnergize) {
+ public cElementalInstanceStackMap decay(Float lifeTimeMult, long age, int postEnergize) {
if (this.energy > 0) {
this.energy--;
return decayCompute(definition.getEnergeticDecayInstant(), lifeTimeMult, age, postEnergize + this.energy);
@@ -118,7 +116,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
return null;//return null since decay cannot be achieved
}
- public cElementalInstanceStackTree decay(long age, int postEnergize) {
+ public cElementalInstanceStackMap decay(long age, int postEnergize) {
if (this.energy > 0) {
this.energy--;
return decayCompute(definition.getEnergeticDecayInstant(), lifeTimeMult, age, postEnergize + this.energy);
@@ -132,14 +130,14 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
return null;//return null since decay cannot be achieved
}
- private cElementalInstanceStackTree decayCompute(cElementalDecay[] decays, float lifeTimeMult, long age, int energy) {
+ private cElementalInstanceStackMap decayCompute(cElementalDecay[] decays, float lifeTimeMult, long age, int energy) {
if (decays == null) return null;//Can not decay so it wont
else if (decays.length == 0)
- return new cElementalInstanceStackTree();//provide non null 0 length array for annihilation
+ return new cElementalInstanceStackMap();//provide non null 0 length array for annihilation
else if (decays.length == 1) {//only one type of decay :D, doesn't need dead end
return decays[0].getResults(lifeTimeMult, age, energy, this.amount);
} else {
- cElementalInstanceStackTree output = new cElementalInstanceStackTree();
+ cElementalInstanceStackMap output = new cElementalInstanceStackMap();
final int differentDecays = decays.length;
int[] qttyOfDecay = new int[differentDecays];
int amountRemaining = this.amount, amount = this.amount;
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStackTree.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStackMap.java
index 24474229ee..c317554a32 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStackTree.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStackMap.java
@@ -13,18 +13,18 @@ import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveD
/**
* Created by danie_000 on 22.01.2017.
*/
-public final class cElementalInstanceStackTree implements Comparable<cElementalInstanceStackTree> {
- private TreeMap<iElementalDefinition, cElementalInstanceStack> tree = new TreeMap<>();
+public final class cElementalInstanceStackMap implements Comparable<cElementalInstanceStackMap> {
+ private Map<iElementalDefinition, cElementalInstanceStack> tree = new TreeMap<>();
//Constructors
- public cElementalInstanceStackTree() {
+ public cElementalInstanceStackMap() {
}
- public cElementalInstanceStackTree(cElementalInstanceStack... inSafe) {
+ public cElementalInstanceStackMap(cElementalInstanceStack... inSafe) {
this(true, inSafe);
}
- public cElementalInstanceStackTree(boolean copy, cElementalInstanceStack... in) {
+ public cElementalInstanceStackMap(boolean copy, cElementalInstanceStack... in) {
if (in == null) return;
if (copy) {
for (cElementalInstanceStack instance : in) {
@@ -37,11 +37,11 @@ public final class cElementalInstanceStackTree implements Comparable<cElementalI
}
}
- private cElementalInstanceStackTree(TreeMap<iElementalDefinition, cElementalInstanceStack> inSafe) {
+ private cElementalInstanceStackMap(Map<iElementalDefinition, cElementalInstanceStack> inSafe) {
this(true, inSafe);
}
- private cElementalInstanceStackTree(boolean copy, TreeMap<iElementalDefinition, cElementalInstanceStack> in) {
+ private cElementalInstanceStackMap(boolean copy, Map<iElementalDefinition, cElementalInstanceStack> in) {
if (in == null) return;
if (copy) {
for (cElementalInstanceStack instance : in.values()) {
@@ -52,21 +52,21 @@ public final class cElementalInstanceStackTree i