diff options
| author | Technus <daniel112092@gmail.com> | 2017-12-14 21:21:18 +0100 |
|---|---|---|
| committer | Technus <daniel112092@gmail.com> | 2017-12-14 21:21:18 +0100 |
| commit | f80d0e3467231d67d3da303ca2c1385996febb2a (patch) | |
| tree | 92163407e14b0e9579257b7cdd2b53036496d8fd /src | |
| parent | 2342a88d886cdcb7bf159fefe5c5e30f019619e1 (diff) | |
| download | GT5-Unofficial-f80d0e3467231d67d3da303ca2c1385996febb2a.tar.gz GT5-Unofficial-f80d0e3467231d67d3da303ca2c1385996febb2a.tar.bz2 GT5-Unofficial-f80d0e3467231d67d3da303ca2c1385996febb2a.zip | |
first draft of scanning of em data extraction
Diffstat (limited to 'src')
23 files changed, 356 insertions, 64 deletions
diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java index 2f2cc9c298..c0aec1baf8 100644 --- a/src/main/java/com/github/technus/tectech/Util.java +++ b/src/main/java/com/github/technus/tectech/Util.java @@ -11,6 +11,7 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; @@ -815,4 +816,15 @@ public class Util { strings[strings.length-1]=string.substring(lastEnd); return strings; } + + public static String[] infoFromNBT(NBTTagCompound nbt) { + final String[] strings = new String[nbt.getInteger("i")]; + for (int i = 0; i < strings.length; i++) + strings[i] = nbt.getString(Integer.toString(i)); + return strings; + } + + public static boolean areBitsSet(int setBits,int testedValue){ + return (testedValue&setBits)==setBits; + } } 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 034aa55642..29a3a714b8 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 @@ -1,6 +1,7 @@ package com.github.technus.tectech.compatibility.thaumcraft.definitions; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.Util; import com.github.technus.tectech.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; import com.github.technus.tectech.elementalMatter.core.containers.cElementalDefinitionStack; @@ -13,9 +14,12 @@ import com.github.technus.tectech.elementalMatter.core.transformations.aOredictD import com.github.technus.tectech.elementalMatter.definitions.primitive.eBosonDefinition; import net.minecraft.nbt.NBTTagCompound; +import java.util.ArrayList; + import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.compatibility.thaumcraft.definitions.AspectDefinitionCompat.aspectDefinitionCompat; import static com.github.technus.tectech.elementalMatter.core.cElementalDecay.noDecay; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; /** * Created by Tec on 06.05.2017. @@ -228,4 +232,28 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme public int hashCode() { return hash; } + + + + @Override + public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { + if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) + lines.add("CLASS = "+nbtType+" "+getClassType()); + if(Util.areBitsSet(SCAN_GET_NOMENCLATURE+SCAN_GET_COLOR+SCAN_GET_CHARGE+SCAN_GET_MASS, capabilities)) { + lines.add("NAME = "+getName()); + //lines.add("SYMBOL = "+getSymbol()); + } + if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) + lines.add("CHARGE = "+getCharge()/3f+" eV"); + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) + lines.add(getColor()<0?"NOT COLORED":"CARRIES COLOR"); + if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) + lines.add("MASS = "+getMass()+" eV/c\u00b2"); + //TODO decay info - no energy states info here + if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add(isTimeSpanHalfLife()?"TIME SPAN IS HALF LIFE":"TIME SPAN IS LIFE TIME"); + lines.add("TIME SPAN = "+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } } 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 5891d4e252..347836764b 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 @@ -7,6 +7,7 @@ import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalD import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import java.util.ArrayList; import java.util.Iterator; import java.util.Map; import java.util.TreeMap; @@ -307,6 +308,14 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn return info; } + public ArrayList<String> getScanInfo(int[] capabilities) { + ArrayList<String> list=new ArrayList<>(16); + for(Map.Entry<iElementalDefinition,cElementalInstanceStack> e:map.entrySet()){ + e.getValue().addScanResults(list,capabilities); + } + return list; + } + public cElementalInstanceStack[] values() { return map.values().toArray(new cElementalInstanceStack[0]); } @@ -370,11 +379,13 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn return nbt; } - public static String[] infoFromNBT(NBTTagCompound nbt) { - final String[] strings = new String[nbt.getInteger("i")]; - for (int i = 0; i < strings.length; i++) - strings[i] = nbt.getString(Integer.toString(i)); - return strings; + public NBTTagCompound getScanInfoNBT(int[] capabilities) { + final NBTTagCompound nbt = new NBTTagCompound(); + final ArrayList<String> info = getScanInfo(capabilities); + nbt.setInteger("i", info.size()); + for (int i = 0; i < info.size(); i++) + nbt.setString(Integer.toString(i), info.get(i)); + return nbt; } public NBTTagCompound toNBT() { 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 55446e9c93..c95427d906 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 @@ -80,13 +80,6 @@ abstract class cElementalStackMap implements Comparable<cElementalStackMap> { return nbt; } - public static String[] infoFromNBT(NBTTagCompound nbt) { - final String[] strings = new String[nbt.getInteger("i")]; - for (int i = 0; i < strings.length; i++) - strings[i] = nbt.getString(Integer.toString(i)); - return strings; - } - public final NBTTagCompound toNBT() { final NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("i", map.size()); 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 a28fed340e..5a79eeee42 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 @@ -1,14 +1,19 @@ package com.github.technus.tectech.elementalMatter.core.containers; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.Util; import com.github.technus.tectech.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.elementalMatter.core.interfaces.iElementalDefinition; import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; import com.github.technus.tectech.elementalMatter.core.templates.cElementalDefinition; import net.minecraft.nbt.NBTTagCompound; +import java.util.ArrayList; + import static com.github.technus.tectech.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; /** * Created by danie_000 on 22.10.2016. @@ -147,7 +152,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { return decay(1F,apparentAge,postEnergize); } - public cElementalInstanceStackMap decay(Float lifeTimeMult, long apparentAge, long postEnergize) { + public cElementalInstanceStackMap decay(float lifeTimeMult, long apparentAge, long postEnergize) { long newEnergyLevel=postEnergize+this.energy; if(newEnergyLevel>0) newEnergyLevel-=1; else if(newEnergyLevel<0) newEnergyLevel+=1; @@ -300,6 +305,43 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { return this; } + public void addScanResults(ArrayList<String> lines, int[] detailsOnDepthLevels){ + final int capabilities=detailsOnDepthLevels[0]; + if(Util.areBitsSet(SCAN_GET_DEPTH_LEVEL,capabilities)) + lines.add("DEPTH = "+0); + definition.addScanResults(lines,capabilities,energy); + if(Util.areBitsSet(SCAN_GET_TIMESPAN_MULT,capabilities)) { + lines.add("TIME SPAN MULTIPLIER = " + lifeTimeMult); + if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO,capabilities)) + lines.add("TIME SPAN MULTIPLIED = "+lifeTime+" s"); + } + if(Util.areBitsSet(SCAN_GET_AGE,capabilities)) + lines.add("AGE = " + age+" s"); + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) + lines.add("COLOR = "+color+" RGB or CMY"); + if(Util.areBitsSet(SCAN_GET_ENERGY_LEVEL,capabilities)) + lines.add("ENERGY LEVEL = "+energy); + if(Util.areBitsSet(SCAN_GET_AMOUNT,capabilities)) + lines.add("AMOUNT = "+amount); + lines.add(null);//def separator + scanContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); + } + + private void scanContents(ArrayList<String> lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){ + if(definitions!=null && depth<detailsOnDepthLevels.length){ + final int deeper=depth+1; + for(cElementalDefinitionStack definitionStack:definitions.values()) { + if(Util.areBitsSet(SCAN_GET_DEPTH_LEVEL,detailsOnDepthLevels[depth])) + lines.add("DEPTH = " + depth); + definition.addScanResults(lines,detailsOnDepthLevels[depth],energy); + if(Util.areBitsSet(SCAN_GET_AMOUNT,detailsOnDepthLevels[depth])) + lines.add("AMOUNT = "+definitionStack.amount); + lines.add(null);//def separator + scanContents(lines,definitionStack.definition.getSubParticles(),deeper,detailsOnDepthLevels); + } + } + } + public NBTTagCompound toNBT() { NBTTagCompound nbt = new NBTTagCompound(); nbt.setTag("d", definition.toNBT()); 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 33432bad5d..fd44addbb6 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 @@ -8,6 +8,8 @@ import com.github.technus.tectech.elementalMatter.core.transformations.aItemDequ import com.github.technus.tectech.elementalMatter.core.transformations.aOredictDequantizationInfo; import net.minecraft.nbt.NBTTagCompound; +import java.util.ArrayList; + /** * Created by danie_000 on 11.11.2016. */ @@ -22,6 +24,8 @@ public interface iElementalDefinition extends Comparable<iElementalDefinition>,C String getSymbol(); + void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel); + byte getType(); byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalDefinition.java index 021a762f6f..c455506435 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalDefinition.java @@ -1,17 +1,22 @@ package com.github.technus.tectech.elementalMatter.core.templates; +import com.github.technus.tectech.Util; import com.github.technus.tectech.elementalMatter.core.containers.cElementalDefinitionStack; import com.github.technus.tectech.elementalMatter.core.interfaces.iElementalDefinition; import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; import net.minecraft.nbt.NBTTagCompound; import java.lang.reflect.Method; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_MASS; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_TIMESPAN_INFO; /** * Created by danie_000 on 23.01.2017. 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 2a2a3459c2..08cf157afb 100644 --- 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 @@ -1,6 +1,7 @@ package com.github.technus.tectech.elementalMatter.core.templates; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.Util; import com.github.technus.tectech.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; import com.github.technus.tectech.elementalMatter.core.interfaces.iElementalDefinition; @@ -12,11 +13,13 @@ 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 static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; /** * Created by danie_000 on 22.10.2016. @@ -176,6 +179,28 @@ public abstract class cElementalPrimitive extends cElementalDefinition { return -128; } + @Override + public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { + if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) + lines.add("CLASS = "+nbtType+" "+getClassType()); + if(Util.areBitsSet(SCAN_GET_NOMENCLATURE+SCAN_GET_COLOR+SCAN_GET_CHARGE+SCAN_GET_MASS, capabilities)) { + lines.add("NAME = "+getName()); + lines.add("SYMBOL = "+getSymbol()); + } + if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) + lines.add("CHARGE = "+getCharge()/3f+" eV"); + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) + lines.add(getColor()<0?"NOT COLORED":"CARRIES COLOR"); + if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) + lines.add("MASS = "+getMass()+" eV/c\u00b2"); + //TODO decay info - no energy states info here + if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add(isTimeSpanHalfLife()?"TIME SPAN IS HALF LIFE":"TIME SPAN IS LIFE TIME"); + lines.add("TIME SPAN = "+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } + public static void run() { try { cElementalDefinition.addCreatorFromNBT(nbtType, cElementalPrimitive.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-128); diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dAtomDefinition.java index 92ba693889..d8a04d16b3 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dAtomDefinition.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.elementalMatter.definitions.complex; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.Util; import com.github.technus.tectech.XSTR; import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; import com.github.technus.tectech.elementalMatter.core.cElementalDecay; @@ -29,6 +30,7 @@ import static com.github.technus.tectech.XSTR.XSTR_INSTANCE; import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; import static com.github.technus.tectech.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; import static gregtech.api.enums.OrePrefixes.dust; /** @@ -397,7 +399,7 @@ public final class dAtomDefinition extends cElementalDefinition { else if(energy<=0) state = iaea.energeticStatesArray[0]; else state=iaea.energeticStatesArray[(int)energy]; for (int i=0;i<state.decaymodes.length;i++){ - if(!getDecay(decaysList,state.decaymodes[i])) { + if(!getDecay(decaysList,state.decaymodes[i],energy)) { decaysList.clear(); return false; } @@ -405,7 +407,7 @@ public final class dAtomDefinition extends cElementalDefinition { return true; } - private boolean getDecay(ArrayList<cElementalDecay> decaysList,iaeaNuclide.iaeaDecay decay){ + private boolean getDecay(ArrayList<cElementalDecay> decaysList,iaeaNuclide.iaeaDecay decay, long energy){ cElementalMutableDefinitionStackMap withThis=elementalStacks.toMutable(),newStuff=new cElementalMutableDefinitionStackMap(); switch (decay.decayName){ case "D": { @@ -834,9 +836,16 @@ public final class dAtomDefinition extends cElementalDefinition { } } } break; - case "IT": case "IT?": case "G": - decaysList.add(new cElementalDecay(decay.chance, this, eBosonDefinition.boson_Y__)); - return true; + case "IT": case "IT?": case "G": { + if(energy>0){ + decaysList.add(new cElementalDecay(decay.chance, this, eBosonDefinition.boson_Y__)); + return true; + }else{ + if(DEBUG_MODE) TecTech.Logger.info("Tried to emit Gamma from ground state"); + decaysList.add(new cElementalDecay(decay.chance, this)); + return true; + } + } //break; case "IT+EC+B+": { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){ withThis.putUnify(dHadronDefinition.hadron_n2); @@ -1053,7 +1062,7 @@ public final class dAtomDefinition extends cElementalDefinition { @Override public cElementalDecay[] getNaturalDecayInstant() { //disembody - ArrayList<cElementalDefinitionStack> decaysInto = new ArrayList<cElementalDefinitionStack>(); + ArrayList<cElementalDefinitionStack> decaysInto = new ArrayList<>(); for (cElementalDefinitionStack elementalStack : elementalStacks.values()) { if (elementalStack.definition.getType() == 1 || elementalStack.definition.getType() == -1) { //covers both quarks and antiquarks @@ -1405,4 +1414,28 @@ public final class dAtomDefinition extends cElementalDefinition { public int hashCode() { return hash; } + + + + @Override + public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { + if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) + lines.add("CLASS = "+nbtType+" "+getClassType()); + if(Util.areBitsSet(SCAN_GET_NOMENCLATURE+SCAN_GET_AMOUNT+SCAN_GET_COLOR+SCAN_GET_CHARGE+SCAN_GET_MASS, capabilities)) { + lines.add("NAME = "+getName()); + lines.add("SYMBOL = "+getSymbol()); + } + if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) + lines.add("CHARGE = "+getCharge()/3f+" eV"); + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) + lines.add(getColor()<0?"NOT COLORED":"CARRIES COLOR"); + if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) + lines.add("MASS = "+getMass()+" eV/c\u00b2"); + //TODO decay info - no energy states info here + if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add(isTimeSpanHalfLife()?"TIME SPAN IS HALF LIFE":"TIME SPAN IS LIFE TIME"); + lines.add("TIME SPAN = "+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dHadronDefinition.java index f7bb9c7f5d..bc985aa5b5 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dHadronDefinition.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.elementalMatter.definitions.complex; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.Util; import com.github.technus.tectech.auxiliary.TecTechConfig; import com.github.technus.tectech.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; @@ -22,6 +23,9 @@ import java.util.ArrayList; import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.elementalMatter.definitions.complex.dAtomDefinition.transformation; import static com.github.technus.tectech.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_MASS; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.SCAN_GET_TIMESPAN_INFO; import static gregtech.api.enums.OrePrefixes.dust; /** @@ -121,30 +125,29 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi @Override public String getName() { + StringBuilder name= new StringBuilder(getSimpleName()); + for (cElementalDefinitionStack quark : quarkStacks.values()) { + name.append(" ").append(quark.definition.getSymbol()).append(quark.amount); + } + return name.toString(); + } + + private String getSimpleName() { String name; switch (amount) { case 2: - name = "Meson:"; - break; + return "Meson"; case 3: - name = "Baryon:"; - break; + return "Baryon"; case 4: - name = "Tetraquark:"; - break; + return "Tetraquark"; case 5: - name = "Pentaquark:"; - break; + return "Pentaquark"; case 6: - name = "Hexaquark:"; - break; + return "Hexaquark"; default: - name = "Hadron:"; - } - for (cElementalDefinitionStack quark : quarkStacks.values()) { - name += " " + quark.definition.getSymbol() + quark.amount; + return "Hadron"; } - return name; } @Override @@ -392,4 +395,26 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi public int hashCode() { return hash; } + + @Override + public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { + if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) + lines.add("CLASS = "+nbtType+" "+getClassType()); + if(Util.areBitsSet(SCAN_GET_NOMENCLATURE+SCAN_GET_AMOUNT, capabilities)) { + lines.add("NAME = "+getSimpleName()); + //lines.add("SYMBOL = "+getSymbol()); + } + if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) + lines.add("CHARGE = "+getCharge()/3f+" eV"); + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) + lines.add(getColor()<0?"NOT COLORED":"CARRIES COLOR"); + if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) + lines.add("MASS = "+getMass()+" eV/c\u00b2"); + //TODO decay info - no energy states info here + if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add(isTimeSpanHalfLife()?"TIME SPAN IS HALF LIFE":"TIME SPAN IS LIFE TIME"); + lines.add("TIME SPAN = "+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } } diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index 4259078c69..bcff2ddfaa 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -9,7 +9,7 @@ import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.item.ConstructableTriggerItem; -import com.github.technus.tectech.thing.item.DebugContainer_EM; +import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import com.github.technus.tectech.thing.item.ParametrizerMemoryCard; import cpw.mods.fml.common.ProgressManager; import cpw.mods.fml.relauncher.Side; @@ -89,7 +89,7 @@ public final class MainLoader { @SideOnly(Side.CLIENT) @Override public Item getTabIconItem() { - return DebugContainer_EM.INSTANCE; + return DebugElementalInstanceContainer_EM.INSTANCE; } @Override @@ -117,7 +117,7 @@ public final class MainLoader { QuantumGlassBlock.INSTANCE.setCreativeTab(mainTab); TT_Container_Casings.sBlockCasingsTT.setCreativeTab(mainTab); TT_Container_Casings.sHintCasingsTT.setCreativeTab(mainTab); - DebugContainer_EM.INSTANCE.setCreativeTab(mainTab); + DebugElementalInstanceContainer_EM.INSTANCE.setCreativeTab(mainTab); ConstructableTriggerItem.INSTANCE.setCreativeTab(mainTab); ParametrizerMemoryCard.INSTANCE.setCreativeTab(mainTab); } diff --git a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java index d957152db5..e42e8e8edc 100644 --- a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java @@ -7,10 +7,7 @@ import com.github.technus.tectech.thing.block.ReactorSimBlock; import com.github.technus.tectech.thing.casing.GT_Block_CasingsTT; import com.github.technus.tectech.thing.casing.GT_Block_HintTT; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.item.ConstructableTriggerItem; -import com.github.technus.tectech.thing.item.DebugContainer_EM; -import com.github.technus.tectech.thing.item.DefinitionContainer_EM; -import com.github.technus.tectech.thing.item.ParametrizerMemoryCard; +import com.github.technus.tectech.thing.item.*; import cpw.mods.fml.common.Loader; import openmodularturrets.blocks.turretbases.TurretBaseEM; import openmodularturrets.blocks.turretheads.TurretHeadEM; @@ -43,10 +40,11 @@ public class ThingsLoader implements Runnable { ConstructableTriggerItem.run(); ParametrizerMemoryCard.run(); - TecTech.Logger.info("Useful item registered"); + ElementalDefinitionScanStorage_EM.run(); + TecTech.Logger.info("Useful Items registered"); - DefinitionContainer_EM.run(); - DebugContainer_EM.run(); + ElementalDefinitionContainer_EM.run(); + DebugElementalI |
