aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompatEnabled.java2
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java22
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/ePrimalAspectDefinition.java5
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDecay.java4
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java31
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalMutableDefinitionStackMap.java4
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java2
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/core/containers/cElementalDefinitionStack.java16
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/core/containers/cElementalInstanceStack.java104
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iElementalDefinition.java9
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iHasElementalDefinition.java6
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java9
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dAtomDefinition.java56
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dHadronDefinition.java36
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/iaea/iaeaNuclide.java45
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/cPrimitiveDefinition.java5
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eBosonDefinition.java10
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eLeptonDefinition.java13
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eNeutrinoDefinition.java33
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eQuarkDefinition.java5
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo6
27 files changed, 274 insertions, 165 deletions
diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompatEnabled.java
index da0bb07ff0..07603114ed 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompatEnabled.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompatEnabled.java
@@ -30,7 +30,7 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat
ArrayList<Aspect> list=Aspect.getCompoundAspects();
Aspect[] array=list.toArray(new Aspect[0]);
- while (!list.isEmpty()) {
+ while (list.size()>0) {
for (Aspect aspect : array) {
if (list.contains(aspect)) {
Aspect[] content = aspect.getComponents();
diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java
index 3b4a08c703..0643153fbf 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java
@@ -63,11 +63,11 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme
//public but u can just try{}catch(){} the constructor it still calls this method
private static boolean canTheyBeTogether(cElementalDefinitionStackMap stacks) {
- int amount = 0;
+ long amount = 0;
for (cElementalDefinitionStack aspects : stacks.values()) {
- if (aspects.definition instanceof dComplexAspectDefinition || aspects.definition instanceof ePrimalAspectDefinition)
- amount += aspects.amount;
- else return false;
+ if (!(aspects.definition instanceof dComplexAspectDefinition) && !(aspects.definition instanceof ePrimalAspectDefinition))
+ return false;
+ amount += aspects.amount;
}
return amount==2;
}
@@ -126,11 +126,16 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme
}
@Override
- public float getRawLifeTime() {
+ public float getRawTimeSpan() {
return -1;
}
@Override
+ public boolean isTimeSpanHalfLife() {
+ return false;
+ }
+
+ @Override
public int getCharge() {
return 0;
}
@@ -151,11 +156,16 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme
}
@Override
- public cElementalDecay[] getEnergeticDecayInstant() {
+ public cElementalDecay[] getEnergyInducedDecay(long energy) {
return new cElementalDecay[]{new cElementalDecay(0.75F, aspectStacks), eBosonDefinition.deadEnd};
}
@Override
+ public boolean usesSpecialEnergeticDecayHandling() {
+ return false;
+ }
+
+ @Override
public cElementalDecay[] getNaturalDecayInstant() {
return noDecay;
}
diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/ePrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/ePrimalAspectDefinition.java
index 1131c2a4ce..6205055967 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/ePrimalAspectDefinition.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/ePrimalAspectDefinition.java
@@ -38,5 +38,10 @@ public final class ePrimalAspectDefinition extends cElementalPrimitive implement
public Object materializeIntoAspect() {
return aspectDefinitionCompat.getAspect(this);
}
+
+ @Override
+ public boolean isTimeSpanHalfLife() {
+ return false;
+ }
}
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDecay.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDecay.java
index ae38be4d3e..b6a8b4c2d0 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDecay.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDecay.java
@@ -48,11 +48,11 @@ public final class cElementalDecay {
this.probability = probability;
}
- public cElementalInstanceStackMap getResults(float lifeMult, long age, int energy, int amountDecaying) {
+ public cElementalInstanceStackMap getResults(float lifeMult, long age, long energy, long 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;
+ long qtty = 0;
for (cElementalDefinitionStack stack : outputStacks.values()) qtty += stack.amount;
if (qtty <= 0) return decayResult;
//energy /= qtty;
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java
index b0edc510b6..cd5735405e 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java
@@ -125,7 +125,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn
if (testOnly)
return target.amount >= instance.amount;
else {
- final int diff = target.amount - instance.amount;
+ final long diff = target.amount - instance.amount;
if (diff > 0) {
target.amount = diff;
return true;
@@ -144,7 +144,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn
if (testOnly)
return target.amount >= stack.getAmount();
else {
- final int diff = target.amount - stack.getAmount();
+ final long diff = target.amount - stack.getAmount();
if (diff > 0) {
target.amount = diff;
return true;
@@ -198,7 +198,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn
}
//Remove overflow
- public float removeOverflow(int stacksCount, int stackCapacity) {
+ public float removeOverflow(int stacksCount, long stackCapacity) {
float massRemoved = 0;
if (map.size() > stacksCount) {
@@ -320,32 +320,23 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn
}
//Tick Content
- public void tickContent(float lifeTimeMult, int postEnergize) {
- for (cElementalInstanceStack instance : this.values()) {
- cElementalInstanceStackMap newThings = instance.decay(lifeTimeMult, instance.age += 20, postEnergize);
- if (newThings == null) {
- instance.nextColor();
- } else {
- map.remove(instance.definition);
- for (cElementalInstanceStack newInstance : newThings.values())
- putUnify(newInstance);
- }
- }
-
+ public void tickContentByOneSecond(float lifeTimeMult, int postEnergize) {
+ tickContent(lifeTimeMult,postEnergize,1);
}
- public void tickContent(int postEnergize) {
+ public void tickContent(float lifeTimeMult, int postEnergize, int seconds){
for (cElementalInstanceStack instance : this.values()) {
- cElementalInstanceStackMap newThings = instance.decay(instance.age += 20, postEnergize);
- if (newThings == null) {
+ cElementalInstanceStackMap newInstances = instance.decay(lifeTimeMult, instance.age += seconds, postEnergize);
+ if (newInstances == null) {
instance.nextColor();
} else {
map.remove(instance.definition);
- for (cElementalInstanceStack newInstance : newThings.values())
+ for (cElementalInstanceStack newInstance : newInstances.values()) {
putUnify(newInstance);
+ newInstance.nextColor();
+ }
}
}
-
}
//NBT
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalMutableDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalMutableDefinitionStackMap.java
index 2873dfefd2..a20b1c2ddb 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalMutableDefinitionStackMap.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalMutableDefinitionStackMap.java
@@ -94,7 +94,7 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa
if (testOnly)
return target.amount >= instance.amount;
else {
- final int diff = target.amount - instance.amount;
+ final long diff = target.amount - instance.amount;
if (diff > 0) {
map.put(target.definition, new cElementalDefinitionStack(target.definition, diff));
return true;
@@ -113,7 +113,7 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa
if (testOnly)
return target.amount >= stack.getAmount();
else {
- final int diff = target.amount - stack.getAmount();
+ final long diff = target.amount - stack.getAmount();
if (diff > 0) {
map.put(target.definition, new cElementalDefinitionStack(target.definition, diff));
return true;
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java
index 408e62621d..55446e9c93 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java
@@ -118,7 +118,7 @@ abstract class cElementalStackMap implements Comparable<cElementalStackMap> {
}
@Override
- public int hashCode() {//Hash only definitions to compare contents not amounts or data
+ public final int hashCode() {//Hash only definitions to compare contents not amounts or data
int hash = -(map.size() << 4);
for (cElementalDefinitionStack s : map.values()) {
hash += s.definition.hashCode();
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/containers/cElementalDefinitionStack.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/containers/cElementalDefinitionStack.java
index 8a9d855e7e..1e3f79573e 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/core/containers/cElementalDefinitionStack.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/containers/cElementalDefinitionStack.java
@@ -12,9 +12,9 @@ import static com.github.technus.tectech.elementalMatter.definitions.primitive.c
*/
public final class cElementalDefinitionStack implements iHasElementalDefinition {
public final iElementalDefinition definition;
- public final int amount;
+ public final long amount;
- public cElementalDefinitionStack(iElementalDefinition def, int amount) {
+ public cElementalDefinitionStack(iElementalDefinition def, long amount) {
this.definition = def == null ? null__ : def;
this.amount = amount;
}
@@ -30,11 +30,11 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition
}
@Override
- public int getAmount() {
+ public long getAmount() {
return amount;
}
- public int getCharge() {
+ public long getCharge() {
return definition.getCharge() * amount;
}
@@ -45,24 +45,24 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition
public NBTTagCompound toNBT() {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setTag("d", definition.toNBT());
- nbt.setInteger("q", amount);
+ nbt.setLong("q", amount);
return nbt;
}
public static cElementalDefinitionStack fromNBT(NBTTagCompound nbt) {
return new cElementalDefinitionStack(
cElementalDefinition.fromNBT(nbt.getCompoundTag("d")),
- nbt.getInteger("q"));
+ nbt.getLong("q"));
}
- public cElementalDefinitionStack addAmountIntoNewInstance(int amount) {
+ public cElementalDefinitionStack addAmountIntoNewInstance(long amount) {
if(amount==0) return this;
return new cElementalDefinitionStack(definition, amount + this.amount);
}
public cElementalDefinitionStack addAmountIntoNewInstance(cElementalDefinitionStack... other) {
if (other == null || other.length == 0) return this;
- int i = 0;
+ long i = 0;
for (cElementalDefinitionStack stack : other)
i += stack.amount;
return addAmountIntoNewInstance(i);
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/containers/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/containers/cElementalInstanceStack.java
index 9864376c25..afc0bb2678 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/core/containers/cElementalInstanceStack.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/containers/cElementalInstanceStack.java
@@ -16,11 +16,11 @@ import static com.github.technus.tectech.elementalMatter.definitions.primitive.c
public final class cElementalInstanceStack implements iHasElementalDefinition {
public final iElementalDefinition definition;
//energy - if positive then particle should try to decay
- public int energy;
+ public long energy;
//byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable)
private byte color;
public long age;
- public int amount;
+ public long amount;
private float lifeTime;
private float lifeTimeMult;
@@ -28,15 +28,15 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
this(stackSafe.definition, stackSafe.amount, 1F, 0, 0);
}
- public cElementalInstanceStack(cElementalDefinitionStack stackSafe, float lifeTimeMult, long age, int energy) {
+ public cElementalInstanceStack(cElementalDefinitionStack stackSafe, float lifeTimeMult, long age, long energy) {
this(stackSafe.definition, stackSafe.amount, lifeTimeMult, age, energy);
}
- public cElementalInstanceStack(iElementalDefinition defSafe, int amount) {
+ public cElementalInstanceStack(iElementalDefinition defSafe, long amount) {
this(defSafe, amount, 1F, 0, 0);
}
- public cElementalInstanceStack(iElementalDefinition defSafe, int amount, float lifeTimeMult, long age, int energy) {
+ public cElementalInstanceStack(iElementalDefinition defSafe, long amount, float lifeTimeMult, long age, long energy) {
this.definition = defSafe == null ? null__ : defSafe;
byte color = definition.getColor();
if (color < 0 || color > 2) {//transforms colorable??? into proper color
@@ -45,7 +45,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
this.color = (byte) (TecTech.Rnd.nextInt(3));
}
this.lifeTimeMult = lifeTimeMult;
- this.lifeTime = definition.getRawLifeTime() * this.lifeTimeMult;
+ this.lifeTime = definition.getRawTimeSpan() * this.lifeTimeMult;
this.age = age;
this.energy = energy;
this.amount = amount;
@@ -68,11 +68,11 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
}
@Override
- public int getAmount() {
+ public long getAmount() {
return amount;
}
- public int getCharge() {
+ public long getCharge() {
return definition.getCharge() * amount;
}
@@ -107,9 +107,12 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
return lifeTime;
}
- public float multLifeTime(float mult) {
+ public float setLifeTimeMult(float mult) {
+ if(mult<=0) //since infinity*0=nan
+ throw new IllegalArgumentException("mult must be >0");
this.lifeTimeMult = mult;
- this.lifeTime = definition.getRawLifeTime() * mult;
+ if (definition.getRawTimeSpan() <= 0) return this.lifeTime;
+ this.lifeTime = definition.getRawTimeSpan() * this.lifeTimeMult;
return this.lifeTime;
}
@@ -121,41 +124,68 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
return decay(1F, age, 0);//try to decay without changes
}
- public cElementalInstanceStackMap decay(long apparentAge, int postEnergize) {
+ public cElementalInstanceStackMap decay(long apparentAge, long postEnergize) {
return decay(1F,apparentAge,postEnergize);
}
- public cElementalInstanceStackMap decay(Float lifeTimeMult, long apparentAge, int postEnergize) {
- if (this.energy > 0) {
+ public cElementalInstanceStackMap decay(Float lifeTimeMult, long apparentAge, long postEnergize) {
+ if (this.energy > 0 && !definition.usesSpecialEnergeticDecayHandling()) {
this.energy--;
- return decayCompute(definition.getEnergeticDecayInstant(), lifeTimeMult, 0, postEnergize + this.energy);
- } else if (definition.getRawLifeTime() < 0) {
+ return decayCompute(definition.getEnergyInducedDecay(this.energy), lifeTimeMult, -1, postEnergize + this.energy);
+ }else if (definition.getRawTimeSpan() < 0) {
return null;//return null, decay cannot be achieved
- } else if (1F > this.lifeTime) {
- return decayCompute(definition.getNaturalDecayInstant(), lifeTimeMult, 0, postEnergize + this.energy);
- } else if (((float) apparentAge) > this.lifeTime) {
- return decayCompute(definition.getDecayArray(), lifeTimeMult, 0, postEnergize + this.energy);
+ } else if(definition.isTimeSpanHalfLife()){
+ return exponentialDecayCompute(energy>0?definition.getEnergyInducedDecay(this.energy):definition.getDecayArray(), lifeTimeMult, -1, postEnergize + this.energy);
+ } else{
+ if (1F > this.lifeTime) {
+ return decayCompute(energy>0?definition.getEnergyInducedDecay(this.energy):definition.getNaturalDecayInstant(), lifeTimeMult, 0, postEnergize + this.energy);
+ } else if (((float) apparentAge) > this.lifeTime) {
+ return decayCompute(energy>0?definition.getEnergyInducedDecay(this.energy):definition.getDecayArray(), lifeTimeMult, 0, postEnergize + this.energy);
+ }
}
return null;//return null since decay cannot be achieved
}
//Use to get direct decay output providing correct decay array
- public cElementalInstanceStackMap decayCompute(cElementalDecay[] decays, float lifeTimeMult, long newProductsAge, int energy) {
+ public cElementalInstanceStackMap exponentialDecayCompute(cElementalDecay[] decays, float lifeTimeMult, long newProductsAge, long energy) {
+ double decayInverseRatio=Math.pow(2d,1d/* 1 second *//(double)lifeTime);
+ double newAmount=(double)amount/decayInverseRatio;
+ long amountRemaining=((long)Math.floor(newAmount))+(TecTech.Rnd.nextDouble()<=newAmount-Math.floor(newAmount)?1:0);
+ if(amountRemaining==amount) return null;//nothing decayed
+ else if(amountRemaining<=0) return decayCompute(decays,lifeTimeMult,newProductsAge,energy);
+ //split to non decaying and decaying part
+ amount-=amountRemaining;
+ cElementalInstanceStackMap products=decayCompute(decays,lifeTimeMult,newProductsAge,energy);
+ amount=amountRemaining;
+ products.putUnify(this);
+ return products;
+ }
+
+ //Use to get direct decay output providing correct decay array
+ public cElementalInstanceStackMap decayCompute(cElementalDecay[] decays, float lifeTimeMult, long newProductsAge, long energy) {
if (decays == null) return null;//Can not decay so it wont
else if (decays.length == 0)
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, newProductsAge, energy, this.amount);
+ cElementalInstanceStackMap products=decays[0].getResults(lifeTimeMult, newProductsAge, energy, this.amount);
+ if(newProductsAge<0){
+ for(cElementalInstanceStack s:products.values()){
+ if(s.definition.equals(definition)){
+ s.age=age;
+ }
+ }
+ }
+ return products;
} else {
cElementalInstanceStackMap output = new cElementalInstanceStackMap();
final int differentDecays = decays.length;
- int[] qttyOfDecay = new int[differentDecays];
- int amountRemaining = this.amount, amount = this.amount;
+ long[] qttyOfDecay = new long[differentDecays];
+ long amountRemaining = this.amount, amount = this.amount;
float remainingProbability = 1F;
for (int i = 0; i < differentDecays; i++) {
if (decays[i].probability > 1F) {
- int thisDecayAmount = (int) (Math.floor(remainingProbability * (float) amount));
+ long thisDecayAmount = (long) (Math.floor(remainingProbability * (double) amount));
if (thisDecayAmount == 0) {
//remainingProbability=something;
break;
@@ -170,7 +200,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
//remainingProbability=0;
break;
}
- int thisDecayAmount = (int) (Math.floor(decays[i].probability * (float) amount));
+ long thisDecayAmount = (long) (Math.floor(decays[i].probability * (double) amount));
if (thisDecayAmount <= amountRemaining && thisDecayAmount > 0) {//some was made
remainingProbability -= (decays[i].probability);
amountRemaining -= thisDecayAmount;
@@ -184,9 +214,9 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
}
for (int i = 0; i < amountRemaining; i++) {
- double rand = (double) (TecTech.Rnd.nextFloat());
+ double rand = TecTech.Rnd.nextDouble();
for (int j = 0; j < differentDecays; j++) {//looking for the thing it decayed into
- rand -= (double) (decays[j].probability);
+ rand -= decays[j].probability;
if (rand <= 0D) {
qttyOfDecay[j]++;
break;
@@ -198,6 +228,14 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
if (qttyOfDecay[i] > 0)
output.putUnifyAll(decays[i].getResults(lifeTimeMult, newProductsAge, energy, qttyOfDecay[i]));
}
+
+ if(newProductsAge<0){
+ for(cElementalInstanceStack s:output.values()){
+ if(s.definition.equals(definition)){
+ s.age=age;
+ }
+ }
+ }
return output;
}
}
@@ -205,7 +243,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
public cElementalInstanceStack unifyIntoThis(cElementalInstanceStack... instances) {
if (instances == null) return this;
//returns with the definition from the first object passed
- int energy = this.energy * this.amount;
+ long energy = this.energy * this.amount;
float lifeTimeMul = this.lifeTimeMult;
for (cElementalInstanceStack instance : instances) {
@@ -220,15 +258,15 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
if (amount != 0) energy /= Math.abs(amount);
this.energy = energy;
- this.multLifeTime(lifeTimeMul);
+ this.setLifeTimeMult(lifeTimeMul);
return this;
}
public NBTTagCompound toNBT() {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setTag("d", definition.toNBT());
- nbt.setInteger("q", amount);
- nbt.setInteger("e", energy);
+ nbt.setLong("q", amount);
+ nbt.setLong("e", energy);
nbt.setByte("c", color);
nbt.setLong("a", age);
nbt.setFloat("m", lifeTimeMult);
@@ -239,10 +277,10 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
NBTTagCompound definition = nbt.getCompoundTag("d");
cElementalInstanceStack instance = new cElementalInstanceStack(
cElementalDefinition.fromNBT(definition),
- nbt.getInteger("q"),
+ nbt.getLong("q"),
nbt.getFloat("m"),
nbt.getLong("a"),
- nbt.getInteger("e"));
+ nbt.getLong("e"));
instance.setColor(nbt.getByte("c"));
return instance;
}
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iElementalDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iElementalDefinition.java
index e40e2c0a46..98523ffce1 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iElementalDefinition.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iElementalDefinition.java
@@ -13,6 +13,7 @@ import net.minecraft.nbt.NBTTagCompound;
*/
public interface iElementalDefinition extends Comparable<iElementalDefinition>,Cloneable {//IMMUTABLE
float STABLE_RAW_LIFE_TIME =1.5e36f;
+ float NO_DECAY_RAW_LIFE_TIME=-1;
//Nomenclature
String getName();
@@ -30,7 +31,9 @@ public interface iElementalDefinition extends Comparable<iElementalDefinition>,C
cElementalDecay[] getNaturalDecayInstant();//natural decay if lifespan <1tick
- cElementalDecay[] getEnergeticDecayInstant();//energetic decay if lifespan <1tick
+ cElementalDecay[] getEnergyInducedDecay(long energy);//energetic decay
+
+ boolean usesSpecialEnergeticDecayHandling();
float getMass();//mass... MeV/c^2
@@ -39,7 +42,9 @@ public interface iElementalDefinition extends Comparable<iElementalDefinition>,C
//dynamically changing stuff
byte getColor();//-1 nope cannot 0 it can but undefined
- float getRawLifeTime();//defined in static fields or generated
+ float getRawTimeSpan();//defined in static fields or generated
+
+ boolean isTimeSpanHalfLife();
cElementalDefinitionStackMap getSubParticles();//contents... null if none
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iHasElementalDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iHasElementalDefinition.java
index 815af67974..92aac40bf8 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iHasElementalDefinition.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iHasElementalDefinition.java
@@ -6,11 +6,11 @@ package com.github.technus.tectech.elementalMatter.core.interfaces;
public interface iHasElementalDefinition extends Comparable<iHasElementalDefinition>,Cloneable {
iElementalDefinition getDefinition();
- int getAmount();
+ long getAmount();
- float getMass();
+ long getCharge();
- int getCharge();
+ float getMass();
iHasElementalDefinition clone();
}
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java
index 5f250888b2..d98cd93e04 100644
--- a/