diff options
author | Technus <daniel112092@gmail.com> | 2017-07-17 17:54:56 +0200 |
---|---|---|
committer | Technus <daniel112092@gmail.com> | 2017-07-17 17:54:56 +0200 |
commit | b4dffb9fed2342ca2df09c9d2bd9ecbe35bd3613 (patch) | |
tree | b9efb0e3d446fb045abe547e218b4c02472a0119 /src/main/java | |
parent | 9d1a37c34919e733fa3c45a75aa41167df0192c3 (diff) | |
download | GT5-Unofficial-b4dffb9fed2342ca2df09c9d2bd9ecbe35bd3613.tar.gz GT5-Unofficial-b4dffb9fed2342ca2df09c9d2bd9ecbe35bd3613.tar.bz2 GT5-Unofficial-b4dffb9fed2342ca2df09c9d2bd9ecbe35bd3613.zip |
Debug stuff and some work on decay gen
Diffstat (limited to 'src/main/java')
8 files changed, 69 insertions, 51 deletions
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 52e17a4ff8..3502b6285e 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -79,7 +79,6 @@ public class TecTech { @EventHandler public void PostLoad(FMLPostInitializationEvent PostEvent) { - GTCustomLoader.postLoad(); } 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 19d3b1566b..1f6b38e22d 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 @@ -58,7 +58,7 @@ public final class cElementalDecay { for (cElementalDefinitionStack stack : outputStacks.values()) { decayResult.putUnify(new cElementalInstanceStack(stack.definition, amountDecaying * stack.amount, - lifeMult, age, energy / Math.max(1, stack.amount)));//get instances from stack + lifeMult, age/*new products*/, energy / Math.max(1, stack.amount)));//get instances from stack } return decayResult; } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStackMap.java index a2dbb7df9d..47b1a29994 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStackMap.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStackMap.java @@ -33,7 +33,7 @@ public final class cElementalDefinitionStackMap/*IMMUTABLE*/ extends cElementalS //IMMUTABLE DON'T NEED IT @Override - public cElementalDefinitionStackMap clone() { + public final cElementalDefinitionStackMap clone() { return this; } 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 b511813757..7b5b45cc25 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 @@ -115,43 +115,34 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } public cElementalInstanceStackMap decay() { - return decay(1F, age, 0); + return decay(1F, age, 0);//try to decay without changes } - public cElementalInstanceStackMap decay(Float lifeTimeMult, long age, int postEnergize) { - if (this.energy > 0) { - this.energy--; - return decayCompute(definition.getEnergeticDecayInstant(), lifeTimeMult, age, postEnergize + this.energy); - } else if (definition.getRawLifeTime() < 0) { - return null;//return null, decay cannot be achieved - } else if (1F > this.lifeTime) { - return decayCompute(definition.getNaturalDecayInstant(), lifeTimeMult, age, postEnergize + this.energy); - } else if (((float) this.age) > this.lifeTime) { - return decayCompute(definition.getDecayArray(), lifeTimeMult, age, postEnergize + this.energy); - } - return null;//return null since decay cannot be achieved + public cElementalInstanceStackMap decay(long apparentAge, int postEnergize) { + return decay(1F,apparentAge,postEnergize); } - public cElementalInstanceStackMap decay(long age, int postEnergize) { + public cElementalInstanceStackMap decay(Float lifeTimeMult, long apparentAge, int postEnergize) { if (this.energy > 0) { this.energy--; - return decayCompute(definition.getEnergeticDecayInstant(), lifeTimeMult, age, postEnergize + this.energy); + return decayCompute(definition.getEnergeticDecayInstant(), lifeTimeMult, 0, postEnergize + this.energy); } else if (definition.getRawLifeTime() < 0) { return null;//return null, decay cannot be achieved } else if (1F > this.lifeTime) { - return decayCompute(definition.getNaturalDecayInstant(), lifeTimeMult, age, postEnergize + this.energy); - } else if (((float) this.age) > this.lifeTime) { - return decayCompute(definition.getDecayArray(), lifeTimeMult, age, postEnergize + this.energy); + return decayCompute(definition.getNaturalDecayInstant(), lifeTimeMult, 0, postEnergize + this.energy); + } else if (((float) apparentAge) > this.lifeTime) { + return decayCompute(definition.getDecayArray(), lifeTimeMult, 0, postEnergize + this.energy); } return null;//return null since decay cannot be achieved } - private cElementalInstanceStackMap decayCompute(cElementalDecay[] decays, float lifeTimeMult, long age, int energy) { + //Use to get direct decay output providing correct decay array + public cElementalInstanceStackMap decayCompute(cElementalDecay[] decays, float lifeTimeMult, long newProductsAge, int 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, age, energy, this.amount); + return decays[0].getResults(lifeTimeMult, newProductsAge, energy, this.amount); } else { cElementalInstanceStackMap output = new cElementalInstanceStackMap(); final int differentDecays = decays.length; @@ -202,7 +193,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { for (int i = 0; i < differentDecays; i++) { if (qttyOfDecay[i] > 0) - output.putUnifyAll(decays[i].getResults(lifeTimeMult, age, energy, qttyOfDecay[i])); + output.putUnifyAll(decays[i].getResults(lifeTimeMult, newProductsAge, energy, qttyOfDecay[i])); } return output; } @@ -272,4 +263,9 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { public int hashCode() { return definition.hashCode(); } + + @Override + public String toString() { + return definition.getName()+ '\n' + definition.getSymbol() + '\n' + amount + '\n' + getMass(); + } } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStackMap.java index 1d999b94b0..3443463718 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStackMap.java @@ -414,4 +414,13 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn } return hash; } + + @Override + public String toString() { + StringBuilder build=new StringBuilder("Instance Stack Map\n"); + for(cElementalInstanceStack stack:map.values()){ + build.append(stack.toString()).append('\n'); + } + return build.toString(); + } } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dAtomDefinition.java index 8c4b693d86..81be90e62f 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dAtomDefinition.java @@ -52,7 +52,7 @@ public final class dAtomDefinition extends cElementalDefinition { public final byte decayMode;//t neutron to proton+,0,f proton to neutron public final boolean stable; - public final int isotope; + public final int neutralCount; public final int element; private final cElementalDefinitionStackMap elementalStacks; @@ -88,51 +88,49 @@ public final class dAtomDefinition extends cElementalDefinition { float mass = 0; int cLeptons = 0; int cNucleus = 0; - int isotope = 0, element = 0; + int neutralCount = 0, element = 0; int type = 0; boolean containsAnti = false; for (cElementalDefinitionStack stack : elementalStacks.values()) { iElementalDefinition def = stack.definition; int amount = stack.amount; - mass += amount * def.getMass(); + mass += stack.getMass(); if (def.getType() < 0) containsAnti = true; type = Math.max(type, Math.abs(def.getType())); if (def instanceof eLeptonDefinition) { - cLeptons += amount * def.getCharge(); + cLeptons += stack.getCharge(); } else { - cNucleus += amount * def.getCharge(); + cNucleus += stack.getCharge(); if (def.getCharge() == 3) element += amount; else if (def.getCharge() == -3) element -= amount; - else if (def.getCharge() == 0) { - isotope += amount; - } + else if (def.getCharge() == 0) neutralCount += amount; } } this.type = containsAnti ? (byte) -type : (byte) type; this.mass = mass; this.chargeLeptons = cLeptons; this.charge = cNucleus + cLeptons; - this.isotope = isotope; + this.neutralCount = neutralCount; this.element = element; element = Math.abs(element); - xstr.setSeed((long) (element + 1) * (isotope + 100)); + xstr.setSeed((long) (element + 1) * (neutralCount + 100)); //stability curve int StableIsotope = stableIzoCurve(element); - int izoDiff = isotope - StableIsotope; + int izoDiff = neutralCount - StableIsotope; int izoDiffAbs = Math.abs(izoDiff); hash=super.hashCode(); - Float overridenLifeTime=lifetimeOverrides.get(this); + Float overriddenLifeTime=lifetimeOverrides.get(this); float rawLifeTimeTemp; - if(overridenLifeTime!=null) - rawLifeTimeTemp = overridenLifeTime; + if(overriddenLifeTime!=null) + rawLifeTimeTemp = overriddenLifeTime; else - rawLifeTimeTemp= calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, containsAnti); + rawLifeTimeTemp= calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); this.rawLifeTime=rawLifeTimeTemp>stableRawLifeTime?stableRawLifeTime:rawLifeTimeTemp; @@ -224,7 +222,7 @@ public final class dAtomDefinition extends cElementalDefinition { return charge - chargeLeptons; } - public int getIonization() { + public int getIonizationElementWise() { return (element * 3) + chargeLeptons; } @@ -266,15 +264,15 @@ public final class dAtomDefinition extends cElementalDefinition { final int element = Math.abs(this.element); final boolean negative = element < 0; try { - return (negative ? "~" : "") + nomenclature.Symbol[element] + " N:" + isotope + " I:" + getIonization(); + return (negative ? "~" : "") + nomenclature.Symbol[element] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C: " + getCharge(); } catch (Exception e) { if (TecTechConfig.DEBUG_MODE) e.printStackTrace(); try { int s100 = element / 100, s1 = (element / 10) % 10, s10 = (element) % 10; - return (negative ? "~" : "") + nomenclature.SymbolIUPAC[10 + s100] + nomenclature.SymbolIUPAC[s10] + nomenclature.SymbolIUPAC[s1] + " N:" + isotope + " I:" + getIonization(); + return (negative ? "~" : "") + nomenclature.SymbolIUPAC[10 + s100] + nomenclature.SymbolIUPAC[s10] + nomenclature.SymbolIUPAC[s1] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C: " + getCharge(); } catch (Exception E) { if (TecTechConfig.DEBUG_MODE) e.printStackTrace(); - return (negative ? "~" : "") + "? N:" + isotope + " I:" + getIonization(); + return (negative ? "~" : "") + "? N:" + neutralCount + " I:" + (neutralCount+element) + " C: " + getCharge(); } } } @@ -663,9 +661,9 @@ public final class dAtomDefinition extends cElementalDefinition { //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),144),OrePrefixes.dust, Materials.Actinium,1); transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90),144), dust, Materials.Thorium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),144),OrePrefixes.dust, Materials.Protactinium,1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),144), dust, Materials.Uranium,1); + ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),144), dust, Materials.Uranium,1); //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),144),OrePrefixes.dust, Materials.Neptunium,1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),144), dust, Materials.Plutonium,1); + ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),144), dust, Materials.Plutonium,1); transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95),144), dust, Materials.Americium,1); /* ... */ @@ -702,6 +700,13 @@ public final class dAtomDefinition extends cElementalDefinition { temp=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), + new cElementalDefinitionStack(dHadronDefinition.hadron_n, 146) + ); + transformation.addOredict(new cElementalDefinitionStack(temp, 144),OrePrefixes.dust, Materials.Uranium/*238*/,1); + + temp=new dAtomDefinition( + new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), + new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 143) ); transformation.addOredict(new cElementalDefinitionStack(temp, 144),OrePrefixes.dust, Materials.Uranium235,1); @@ -709,7 +714,14 @@ public final class dAtomDefinition extends cElementalDefinition { temp=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 149) + new cElementalDefinitionStack(dHadronDefinition.hadron_n, 145) + ); + transformation.addOredict(new cElementalDefinitionStack(temp, 144),OrePrefixes.dust, Materials.Plutonium/*239*/,1); + + temp=new dAtomDefinition( + new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), + new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), + new cElementalDefinitionStack(dHadronDefinition.hadron_n, 147) ); transformation.addOredict(new cElementalDefinitionStack(temp, 144),OrePrefixes.dust, Materials.Plutonium241,1); } catch (tElementalException e) { @@ -734,6 +746,4 @@ public final class dAtomDefinition extends cElementalDefinition { public int hashCode() { return hash; } - - } 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 1ed111e6e2..76ae312df2 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 @@ -1,6 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; @@ -93,10 +94,13 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase m3=(float)Math.ceil(input.getLifeTime() / Math.pow(input.amount,3)); if(m3<1) explodeMultiblock(); if(m3>=Integer.MAX_VALUE) return false; - mMaxProgresstime = (int)m3; + mMaxProgresstime = 1;//(int)m3; mEfficiencyIncrease = 10000; m1 = input.getMass()/input.amount; - m2 = input.decay().getMass()/input.amount; + cElementalInstanceStackMap decayed=input.decayCompute(input.getDefinition().getDecayArray(),1,0,0); + m2 = decayed.getMass()/input.amount; + TecTech.Logger.info("I " + input.toString()); + TecTech.Logger.info("O " + decayed.toString()); return true; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPowerGenerator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPowerGenerator.java index 88ff02b8ba..98901f150b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPowerGenerator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPowerGenerator.java @@ -20,7 +20,7 @@ public class GT_GUIContainer_DebugPowerGenerator extends GT_GUIContainerMetaTile this.fontRendererObj.drawString("EUT: " + dpg.EUT, 46, 24, 16448255); this.fontRendererObj.drawString("TIER: " + VN[GT_Utility.getTier(dpg.EUT<0?-dpg.EUT:dpg.EUT)], 46, 32, 16448255); this.fontRendererObj.drawString("AMP: " + dpg.AMP, 46, 40, 16448255); - this.fontRendererObj.drawString("SUM: " + (long)dpg.AMP*dpg.EUT, 46, 32, 16448255); + this.fontRendererObj.drawString("SUM: " + (long)dpg.AMP*dpg.EUT, 46, 48, 16448255); } } |