diff options
author | Tec <daniel112092@gmail.com> | 2020-07-19 18:50:01 +0200 |
---|---|---|
committer | Tec <daniel112092@gmail.com> | 2020-07-19 18:50:01 +0200 |
commit | 5cc23f76bbb12b13f5456793796aa8f5a8db08b2 (patch) | |
tree | 4350b8b887489adedebd138bfe75acd9b0afbe72 | |
parent | 8ee168be62e5d5a10d0efd281293a2623d260633 (diff) | |
download | GT5-Unofficial-5cc23f76bbb12b13f5456793796aa8f5a8db08b2.tar.gz GT5-Unofficial-5cc23f76bbb12b13f5456793796aa8f5a8db08b2.tar.bz2 GT5-Unofficial-5cc23f76bbb12b13f5456793796aa8f5a8db08b2.zip |
Adjust some logic IDK
15 files changed, 139 insertions, 103 deletions
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java index e00bf2d264..e67f773a86 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java @@ -20,7 +20,7 @@ public final class cElementalDecay { public final double probability; public cElementalDecay(iElementalDefinition... outSafe) { - this(2D, outSafe); + this(1D, outSafe); } public cElementalDecay(double probability, iElementalDefinition... outSafe) { @@ -33,7 +33,7 @@ public final class cElementalDecay { } public cElementalDecay(cElementalDefinitionStack... outSafe) { - this(2D, outSafe); + this(1D, outSafe); } public cElementalDecay(double probability, cElementalDefinitionStack... out) { @@ -42,7 +42,7 @@ public final class cElementalDecay { } public cElementalDecay(cElementalDefinitionStackMap tree) { - this(2D, tree); + this(1D, tree); } public cElementalDecay(double probability, cElementalDefinitionStackMap tree) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java index 96fd686ef8..e1fdc6a553 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java @@ -99,6 +99,11 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn return map; } + public Set<Map.Entry<iElementalDefinition, cElementalInstanceStack>> getEntrySet() { + return map.entrySet(); + } + + //Removers public void clear() { map.clear(); @@ -336,6 +341,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn info[i++] = EnumChatFormatting.BLUE + instance.definition.getName()+ " "+ EnumChatFormatting.AQUA + instance.definition.getSymbol()+ EnumChatFormatting.RESET+ " #: " + EnumChatFormatting.GREEN + String.format("%.3E",instance.amount/ AVOGADRO_CONSTANT) +" mol"+ EnumChatFormatting.RESET+ + " E: " + EnumChatFormatting.GREEN + instance.getEnergy() + EnumChatFormatting.RESET+ " T: " + EnumChatFormatting.GREEN + (instance.getLifeTime()<0?"STABLE":String.format("%.3E",instance.getLifeTime())); } return info; @@ -418,6 +424,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn } public double tickContent(double lifeTimeMult, int postEnergize, double seconds){ + cleanUp(); double diff=0; for (cElementalInstanceStack instance : values()) { cElementalDecayResult newInstances = instance.decay(lifeTimeMult, instance.age += seconds, postEnergize); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java index 547c0b7b9d..559d7ab8d9 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java @@ -8,6 +8,8 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInsta import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; import com.github.technus.tectech.util.Util; +import net.minecraft.client.Minecraft; +import net.minecraft.crash.CrashReport; import net.minecraft.nbt.NBTTagCompound; import java.util.ArrayList; @@ -190,18 +192,19 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } else if (newEnergyLevel < 0) { newEnergyLevel += 1; } + cElementalDecayResult output; if(definition.usesMultipleDecayCalls(energy)){ double amountTemp=amount; - long decayCnt=(long) min(MAX_MULTIPLE_DECAY_CALLS,max(amount/DECAY_CALL_PER,MIN_MULTIPLE_DECAY_CALLS)); - double amountPer= div(amount,decayCnt); - amount= sub(amount,amountPer*(--decayCnt)); + int decayCnt=(int) min(MAX_MULTIPLE_DECAY_CALLS,max(amount/DECAY_CALL_PER,MIN_MULTIPLE_DECAY_CALLS)); + amount= div(amount,decayCnt); + decayCnt--; - cElementalDecayResult output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); + output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); if(output==null){ amount=amountTemp; return null; } - amount=amountPer; + for(int i=0;i<decayCnt;i++){ cElementalDecayResult map=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); if(map!=null){ @@ -211,10 +214,13 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } } amount=amountTemp; - return output; }else{ - return decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); + output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); + } + if(output!=null){ + output.getOutput().cleanUp(); } + return output; } private cElementalDecayResult decayMechanics(double lifeTimeMult, double apparentAge, long newEnergyLevel) { @@ -312,7 +318,13 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { for (int i = 0; i < probabilities.length; i++) { probabilities[i]=decays[i].probability; } - double[] qttyOfDecay = distribute(amount, probabilities); + double[] qttyOfDecay; + try{ + qttyOfDecay = distribute(amount, probabilities); + }catch (ArithmeticException e){ + Minecraft.getMinecraft().crashed(new CrashReport("Decay failed for: "+this.toString(),e)); + return null; + } //long amountRemaining = this.amount, amount = this.amount; //float remainingProbability = 1D; // diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java index 65446548e6..6ee8591c58 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java @@ -11,9 +11,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.crash.CrashReport; import net.minecraft.nbt.NBTTagCompound; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; +import java.util.*; import static com.github.technus.tectech.util.Util.areBitsSet; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; @@ -77,7 +75,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { this.rawLifeTime = rawLifeTime; naturalDecayInstant = (byte) naturalInstant; energeticDecayInstant = (byte) energeticInstant; - elementalDecays = elementalDecaysArray; + elementalDecays =elementalDecaysArray; } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java index 964baff155..c9ac204554 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java @@ -17,8 +17,8 @@ import static com.github.technus.tectech.thing.item.DebugElementalInstanceContai * Created by Tec on 26.05.2017. */ public class bTransformationInfo { - public static final double AVOGADRO_CONSTANT =6.02214076e23D;//CUBE LOL XD - public static final double AVOGADRO_CONSTANT_UNCERTAINTY =1/6.02214076e23D;//CUBE LOL XD + public static final double AVOGADRO_CONSTANT =6.02214076e23D; + public static final double AVOGADRO_CONSTANT_UNCERTAINTY =(144*1000)/6.02214076e23D; public static final double AVOGADRO_CONSTANT_144 = AVOGADRO_CONSTANT *144D; public static final HashMap<Integer,aFluidQuantizationInfo> fluidQuantization=new HashMap<>(32); diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java index b990adef15..965c46cef6 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java @@ -2,8 +2,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.util.Util; -import com.github.technus.tectech.util.XSTR; import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; @@ -19,19 +17,21 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition; +import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.XSTR; import cpw.mods.fml.common.Loader; import gregtech.api.enums.Materials; import net.minecraft.nbt.NBTTagCompound; import java.util.*; -import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; -import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition.getNbtTagCompound; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; import static gregtech.api.enums.OrePrefixes.dust; /** @@ -178,7 +178,7 @@ public final class dAtomDefinition extends cElementalDefinition { } else { rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); } - rawLifeTime = Math.min(rawLifeTimeTemp, iElementalDefinition.STABLE_RAW_LIFE_TIME); + rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); }else { rawLifeTime = containsAnti ? iaea.halfTime * 1.5514433E-21d * (1d + xstr.nextDouble() * 9d) : iaea.halfTime; } @@ -193,7 +193,7 @@ public final class dAtomDefinition extends cElementalDefinition { } else { rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); } - rawLifeTime = Math.min(rawLifeTimeTemp, iElementalDefinition.STABLE_RAW_LIFE_TIME); + rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); iaeaDefinitionExistsAndHasEnergyLevels =false; } @@ -208,7 +208,6 @@ public final class dAtomDefinition extends cElementalDefinition { decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4)+ BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET); } //this.stable = this.rawLifeTime >= STABLE_RAW_LIFE_TIME; - hash=super.hashCode(); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java index 6b9e56bbf1..c5efaf1403 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java @@ -154,7 +154,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi name.append(' ').append(sym); }else { for (cElementalDefinitionStack quark : quarkStacks.values()) { - name.append(' ').append(quark.definition.getSymbol()).append(quark.amount); + name.append(' ').append(quark.definition.getSymbol()).append((int)quark.amount); } } return name.toString(); @@ -278,7 +278,9 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi @Override public cElementalDecay[] getDecayArray() { cElementalDefinitionStack[] quarkStacks = this.quarkStacks.values(); - if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { + if (amount == 2 && quarkStacks.length == 2 && + quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && + quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) { return cElementalDecay.noProduct; } else if (amount != 3) { return new cElementalDecay[]{new cElementalDecay(0.95D, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks @@ -293,24 +295,22 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi //remove last eQuarkDefinition lastQuark = newBaryon.remove(2); + cElementalDefinitionStack[] decay; if (Math.abs(lastQuark.getType()) > 1) { - cElementalDefinitionStack[] decay = lastQuark.getDecayArray()[1].outputStacks.values(); - newBaryon.add((eQuarkDefinition) decay[0].definition); - Particles[0] = decay[1].definition; - Particles[1] = decay[2].definition; + decay = lastQuark.getDecayArray()[1].outputStacks.values(); } else { - cElementalDefinitionStack[] decay = lastQuark.getDecayArray()[0].outputStacks.values(); - newBaryon.add((eQuarkDefinition) decay[0].definition); - Particles[0] = decay[1].definition; - Particles[1] = decay[2].definition; + decay = lastQuark.getDecayArray()[2].outputStacks.values(); } + newBaryon.add((eQuarkDefinition) decay[0].definition); + Particles[0] = decay[1].definition; + Particles[1] = decay[2].definition; eQuarkDefinition[] contentOfBaryon = newBaryon.toArray(new eQuarkDefinition[3]); try { return new cElementalDecay[]{ - new cElementalDecay(0.99D, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), new cElementalDecay(0.001D, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1], boson_Y__), + new cElementalDecay(0.99D, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), eBosonDefinition.deadEnd}; } catch (tElementalException e) { if (DEBUG_MODE) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java index 410e53810e..8b09bfd2e0 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java @@ -52,7 +52,7 @@ public final class iaeaNuclide { while((line=reader.readLine())!=null) { String[] split= splitButDifferent(line,","); if(split.length!=47) { - throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuvlidesTable database " + line); + throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuclidesTable database " + line); } get(Integer.parseInt(split[0]),Integer.parseInt(split[1])).getMoreData(split); } @@ -140,6 +140,14 @@ public final class iaeaNuclide { energeticStatesArray = empty; } else { energeticStatesArray = energeticStates.values().toArray(new energeticState[0]); + double life=halfTime; + for (energeticState energeticState : energeticStatesArray) { + if(Double.isNaN(energeticState.Thalf)){ + energeticState.Thalf=life; + }else { + life=energeticState.Thalf; + } + } } } @@ -162,7 +170,7 @@ public final class iaeaNuclide { public static final class energeticState{ public final double energy; - public final double Thalf; + public double Thalf; public final iaeaDecay[] decaymodes; private energeticState(iaeaNuclide nuclide,double Thalf,iaeaDecay[] decaymodes){ diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java index f1f740f665..9a82cdd6c0 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java @@ -4,6 +4,10 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; +import static com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition.*; + /** * Created by danie_000 on 22.10.2016. */ @@ -21,11 +25,11 @@ public final class eBosonDefinition extends cElementalPrimitive { } public static void run() { - boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, cElementalDecay.noDecay); - boson_H__.init(null, 1.56e-22D, 0, 0, + boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); + boson_H__.init(null, 1.56e-22D, 2, 2, + new cElementalDecay(0.01D, quark_b, quark_b_), + new cElementalDecay(0.02D, lepton_t, lepton_t_), new cElementalDecay(0.96D, new cElementalDefinitionStack(boson_Y__, 4)), - new cElementalDecay(0.02D, eLeptonDefinition.lepton_t, eLeptonDefinition.lepton_t_), - new cElementalDecay(0.01D, eQuarkDefinition.quark_b, eQuarkDefinition.quark_b_), deadEnd); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java index dd57d6875e..1e3b7189a8 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java @@ -4,6 +4,10 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition.*; + /** * Created by danie_000 on 22.10.2016. */ @@ -29,28 +33,28 @@ public final class eLeptonDefinition extends cElementalPrimitive { public static void run() { lepton_e.init(lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1, - eBosonDefinition.deadEnd,//makes photons and don't care - new cElementalDecay(lepton_e, eBosonDefinition.boson_Y__)); + deadEnd, + new cElementalDecay(lepton_e,boson_Y__)); lepton_m.init(lepton_m_, 2.197019e-6D, 0, 1, - new cElementalDecay(0.9D, lepton_e, eNeutrinoDefinition.lepton_Ve_, eNeutrinoDefinition.lepton_Vm), - eBosonDefinition.deadEnd);//makes photons and don't care + new cElementalDecay(0.9D, lepton_e, lepton_Ve_, lepton_Vm), + deadEnd);//makes photons and don't care lepton_t.init(lepton_t_, 2.906e-13D, 1, 3, - new cElementalDecay(0.8D, lepton_m, eNeutrinoDefinition.lepton_Vm_, eNeutrinoDefinition.lepton_Vt, eBosonDefinition.boson_Y__), - new cElementalDecay(0.1D, lepton_e, eNeutrinoDefinition.lepton_Ve_, eNeutrinoDefinition.lepton_Vm), - new cElementalDecay(0.05F, lepton_m, eNeutrinoDefinition.lepton_Vm_, eNeutrinoDefinition.lepton_Vt, eBosonDefinition.boson_H__), - eBosonDefinition.deadEnd);//makes photons and don't care + new cElementalDecay(0.05F, lepton_m, lepton_Vm_, lepton_Vt, boson_H__), + new cElementalDecay(0.1D, lepton_e, lepton_Ve_, lepton_Vm), + new cElementalDecay(0.8D, lepton_m, lepton_Vm_, lepton_Vt, boson_Y__), + deadEnd);//makes photons and don't care lepton_e_.init(lepton_e, STABLE_RAW_LIFE_TIME, 0, 1, - eBosonDefinition.deadEnd,//makes photons and don't care - new cElementalDecay(lepton_e_, eBosonDefinition.boson_Y__)); + deadEnd, + new cElementalDecay(lepton_e,boson_Y__)); lepton_m_.init(lepton_m, 2.197019e-6F, 0, 1, - new cElementalDecay(0.9F, lepton_e_, eNeutrinoDefinition.lepton_Ve, eNeutrinoDefinition.lepton_Vm_), - eBosonDefinition.deadEnd);//makes photons and don't care + new cElementalDecay(0.9F, lepton_e_, lepton_Ve, lepton_Vm_), + deadEnd);//makes photons and don't care lepton_t_.init(lepton_t, 2.906e-13F, 1, 3, - new cElementalDecay(0.8F, lepton_m_, eNeutrinoDefinition.lepton_Vm, eNeutrinoDefinition.lepton_Vt_, eBosonDefinition.boson_Y__), - new cElementalDecay(0.1F, lepton_e_, eNeutrinoDefinition.lepton_Ve, eNeutrinoDefinition.lepton_Vm_), - new cElementalDecay(0.05F, lepton_m_, eNeutrinoDefinition.lepton_Vm, eNeutrinoDefinition.lepton_Vt_, eBosonDefinition.boson_H__), - eBosonDefinition.deadEnd);//makes photons and don't care + new cElementalDecay(0.05F, lepton_m_, lepton_Vm, lepton_Vt_, boson_H__), + new cElementalDecay(0.1F, lepton_e_, lepton_Ve, lepton_Vm_), + new cElementalDecay(0.8F, lepton_m_, lepton_Vm, lepton_Vt_, boson_Y__), + deadEnd);//makes photons and don't care } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java index ba084af9a2..c55e7f6364 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java @@ -4,6 +4,8 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.*; + /** * Created by danie_000 on 22.10.2016. */ @@ -30,19 +32,19 @@ public final class eNeutrinoDefinition extends cElementalPrimitive { cElementalDecay.noProduct); lepton_Vm.init(lepton_Vm_, 1D, 1, 0, new cElementalDecay(0.825D, nothing), - eBosonDefinition.deadEndHalf); + deadEndHalf); lepton_Vt.init(lepton_Vt_, 1, 1, 0, new cElementalDecay(0.75F, nothing), - eBosonDefinition.deadEnd); + deadEnd); lepton_Ve_.init(lepton_Ve, 1, -1, -1, cElementalDecay.noProduct); lepton_Vm_.init(lepton_Vm, 1, 1, 0, new cElementalDecay(0.825F, nothing), - eBosonDefinition.deadEndHalf); + deadEndHalf); lepton_Vt_.init(lepton_Vt, 1, 1, 0, new cElementalDecay(0.75F, nothing), - eBosonDefinition.deadEnd); + deadEnd); } @Override diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java index 027b604dc5..9e5b2e66bb 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java @@ -3,6 +3,9 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primiti import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition.*; + /** * Created by danie_000 on 22.10.2016. */ @@ -27,67 +30,67 @@ public final class eQuarkDefinition extends cElementalPrimitive { public static void run() { quark_u.init(quark_u_, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(0.9D, quark_d, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.050778116D, quark_s/*,lepton_m_,lepton_Vm*/), new cElementalDecay(1.23201e-5D, quark_b/*,lepton_t_,lepton_Vt*/), + new cElementalDecay(0.050778116D, quark_s/*,lepton_m_,lepton_Vm*/), + new cElementalDecay(0.9D, quark_d, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care quark_c.init(quark_c_, 0.5e-13D, 1, -1, - new cElementalDecay(0.9D, quark_s, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.05071504D, quark_d, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), new cElementalDecay(0.00169744D, quark_b/*,lepton_t_,lepton_Vt*/), + new cElementalDecay(0.05071504D, quark_d, lepton_m_, lepton_Vm), + new cElementalDecay(0.9D, quark_s, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care - quark_t.init(quark_t_, 2.5e-26D, 2, -1, - new cElementalDecay(0.9D, quark_b, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.00163216D, quark_s, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), - new cElementalDecay(7.51689e-5D, quark_d, eLeptonDefinition.lepton_t_, eNeutrinoDefinition.lepton_Vt), + quark_t.init(quark_t_, 2.5e-26D, 0, -1, + new cElementalDecay(7.51689e-5D, quark_d, lepton_t_, lepton_Vt), + new cElementalDecay(0.00163216D, quark_s, lepton_m_, lepton_Vm), + new cElementalDecay(0.9D, quark_b, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care quark_d.init(quark_d_, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(0.9D, quark_u, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.05071504D, quark_c/*,lepton_m,lepton_Vm_*/), new cElementalDecay(7.51689e-5D, quark_t/*,lepton_t,lepton_Vt_*/), + new cElementalDecay(0.05071504D, quark_c/*,lepton_m,lepton_Vm_*/), + new cElementalDecay(0.9D, quark_u, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care quark_s.init(quark_s_, 0.6e-9D, 1, -1, - new cElementalDecay(0.9D, quark_c, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.050778116D, quark_u, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), new cElementalDecay(0.00163216D, quark_t/*,lepton_t,lepton_Vt_*/), + new cElementalDecay(0.050778116D, quark_u, lepton_m, lepton_Vm_), + new cElementalDecay(0.9D, quark_c, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care - quark_b.init(quark_b_, 0.7e-13D, 2, -1, - new cElementalDecay(0.9D, quark_t, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.00169744D, quark_c, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), - new cElementalDecay(1.23201e-5D, quark_u, eLeptonDefinition.lepton_t, eNeutrinoDefinition.lepton_Vt_), + quark_b.init(quark_b_, 0.7e-13D, 0, -1, + new cElementalDecay(1.23201e-5D, quark_u, lepton_t, lepton_Vt_), + new cElementalDecay(0.00169744D, quark_c, lepton_m, lepton_Vm_), + new cElementalDecay(0.9D, quark_t, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care quark_u_.init(quark_u, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(0.9D, quark_d_, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.050778116D, quark_s_/*,lepton_m,lepton_Vm_*/), new cElementalDecay(1.23201e-5D, quark_b_/*,lepton_t,lepton_Vt_*/), + new cElementalDecay(0.050778116D, quark_s_/*,lepton_m,lepton_Vm_*/), + new cElementalDecay(0.9D, quark_d_, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care quark_c_.init(quark_c, 0.5e-13D, 1, -1, - new cElementalDecay(0.9F, quark_s_, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.05071504F, quark_d_, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), new cElementalDecay(0.00169744F, quark_b_/*,lepton_t,lepton_Vt_*/), + new cElementalDecay(0.05071504F, quark_d_, lepton_m, lepton_Vm_), + new cElementalDecay(0.9F, quark_s_, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care - quark_t_.init(quark_t, 2.5e-26F, 2, -1, - new cElementalDecay(0.9F, quark_b_, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.00163216F, quark_s_, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), - new cElementalDecay(7.51689e-5F, quark_d_, eLeptonDefinition.lepton_t, eNeutrinoDefinition.lepton_Vt_), + quark_t_.init(quark_t, 2.5e-26F, 0, -1, + new cElementalDecay(7.51689e-5F, quark_d_, lepton_t, lepton_Vt_), + new cElementalDecay(0.00163216F, quark_s_, lepton_m, lepton_Vm_), + new cElementalDecay(0.9F, quark_b_, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care quark_d_.init(quark_d, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(0.9F, quark_u_, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.05071504F, quark_c_/*,lepton_m_,lepton_Vm*/), new cElementalDecay(7.51689e-5F, quark_t_/*,lepton_t_,lepton_Vt*/), + new cElementalDecay(0.05071504F, quark_c_/*,lepton_m_,lepton_Vm*/), + new cElementalDecay(0.9F, quark_u_, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care quark_s_.init(quark_s, 0.6e-9F, 1, -1, - new cElementalDecay(0.9F, quark_c_, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.050778116F, quark_u_, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), new cElementalDecay(0.00163216F, quark_t_/*,lepton_t_,lepton_Vt*/), + new cElementalDecay(0.050778116F, quark_u_, lepton_m_, lepton_Vm), + new cElementalDecay(0.9F, quark_c_, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care - quark_b_.init(quark_b, 0.7e-13F, 2, -1, - new cElementalDecay(0.9F, quark_t_, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.00169744F, quark_c_, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), - new cElementalDecay(1.23201e-5F, quark_u_, eLeptonDefinition.lepton_t_, eNeutrinoDefinition.lepton_Vt), + quark_b_.init(quark_b, 0.7e-13F, 0, -1, + new cElementalDecay(1.23201e-5F, quark_u_, lepton_t_, lepton_Vt), + new cElementalDecay(0.00169744F, quark_c_, lepton_m_, lepton_Vm), + new cElementalDecay(0.9F, quark_t_, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index 5b09e05fe5..c8606f68f0 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -111,10 +111,8 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta if (aBaseMetaTileEntity.isServerSide()) { byte Tick = (byte) (aTick % 20); if (DECAY_AT == Tick) { - content.cleanUp(); purgeOverflow(); content.tickContentByOneSecond(1, postEnergize);//Hatches don't life time mult things - content.cleanUp(); purgeOverflow(); } else if (OVERFLOW_AT == Tick) { if (overflowMatter <= 0) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index fe96ca45ba..d534b41fec 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -132,17 +132,15 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase outputEM[0] = input; outputEM[1] = new cElementalInstanceStackMap(); - for (cElementalInstanceStack stack : outputEM[0].values()) { - if (stack.getEnergy() == 0 && stack.definition.decayMakesEnergy(1) - && getBaseMetaTileEntity().decreaseStoredEnergyUnits( - (long) (stack.getEnergySettingCost(1) * URANIUM_MASS_TO_EU_INSTANT), false)) { + if (stack.getEnergy() == 0 && stack.definition.decayMakesEnergy(1) && + getBaseMetaTileEntity().decreaseStoredEnergyUnits( + (long) (stack.getEnergySettingCost(1) * URANIUM_MASS_TO_EU_INSTANT), false)) { stack.setEnergy(1); } else if (!stack.definition.decayMakesEnergy(stack.getEnergy())) { outputEM[0].remove(stack.definition); outputEM[1].putReplace(stack); } - //System.out.println(stack.definition.getSymbol()+" "+stack.amount); } eAmpereFlow = (long) ampereFlow.get(); diff --git a/src/main/java/com/github/technus/tectech/util/DoubleCount.java b/src/main/java/com/github/technus/tectech/util/DoubleCount.java index e7ef18be08..0c5865d56e 100644 --- a/src/main/java/com/github/technus/tectech/util/DoubleCount.java +++ b/src/main/java/com/github/technus/tectech/util/DoubleCount.java @@ -6,7 +6,7 @@ import static java.lang.Math.max; import static java.lang.Math.ulp; public class DoubleCount { - public static double[] distribute(double count,double... probabilities){ + public static double[] distribute(double count,double... probabilities) throws ArithmeticException{ if(probabilities==null){ return null; }else if(count==0){ @@ -20,12 +20,15 @@ public class DoubleCount { double remaining=count,previous=probabilities[size],probability,out,sum=0; for (int i = size - 1; i >= 0; i--) { probability=probabilities[i]; - remaining-=out=count*probability; - sum+=output[i]=out-ulp(out); + remaining-=out=count*(probability-ulp(probability)); + sum+=output[i]=out; if(previous<probability){ throw new ArithmeticException("Malformed probability order: "+ Arrays.toString(probabilities)); } previous=probability; + if(probability>=1){ + break; + } } if(remaining*count<0){ throw new ArithmeticException("Malformed probability sum: "+ Arrays.toString(probabilities)); |