From 75584c6b6ddbca089d912061a2ab93d36a455b5a Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 11 Aug 2018 21:38:32 +0200 Subject: Push some collider work and change plasma nerf behaviour. --- .../java/com/github/technus/tectech/TecTech.java | 2 +- .../definitions/dComplexAspectDefinition.java | 8 + .../github/technus/tectech/loader/MainLoader.java | 20 +- .../core/cElementalInstanceStackMap.java | 7 +- .../core/cElementalMutableDefinitionStackMap.java | 2 +- .../core/stacks/cElementalInstanceStack.java | 16 + .../core/templates/cElementalPrimitive.java | 4 + .../core/transformations/bTransformationInfo.java | 18 +- .../definitions/complex/atom/dAtomDefinition.java | 148 ++++--- .../complex/hadron/dHadronDefinition.java | 16 +- .../item/DebugElementalInstanceContainer_EM.java | 32 ++ .../multi/GT_MetaTileEntity_EM_collider.java | 443 +++++++++++++++++++-- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 56 +-- .../pipe/GT_MetaTileEntity_Pipe_Laser.java | 5 + 14 files changed, 613 insertions(+), 164 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Laser.java (limited to 'src/main/java/com') diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 989968c170..6f1c4fc7a0 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -76,7 +76,7 @@ public class TecTech { hasCOFH = Loader.isModLoaded(Reference.COFHCORE); MainLoader.load(); - MainLoader.addAfterPostLoad(); + MainLoader.addAfterGregTechPostLoadRunner(); } @Mod.EventHandler diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java index 433a3a2697..95671f2515 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java @@ -110,6 +110,10 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme @Override public NBTTagCompound toNBT() { + return getNbtTagCompound(nbtType, aspectStacks); + } + + public static NBTTagCompound getNbtTagCompound(byte nbtType, cElementalDefinitionStackMap aspectStacks) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setByte("t", nbtType); cElementalDefinitionStack[] quarkStacksValues = aspectStacks.values(); @@ -248,6 +252,10 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme return -96; } + public static byte getClassTypeStatic(){ + return -96; + } + @Override public int hashCode() { return hash; 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 48c297c5f9..04b354f737 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -244,14 +244,14 @@ public final class MainLoader { //todo add GC GS stuff } - public static void addAfterPostLoad() { + public static void addAfterGregTechPostLoadRunner() { GregTech_API.sAfterGTPostload.add(new Runnable() { @Override public void run() { if(TecTech.configTecTech.NERF_FUSION) { FixBrokenFusionRecipes(); } - GT_MetaTileEntity_EM_collider.heliumPlasmaValue = getFuelValue(Materials.Helium.getPlasma(125)); + GT_MetaTileEntity_EM_collider.setValues(getFuelValue(Materials.Helium.getPlasma(125))); } }); } @@ -290,7 +290,21 @@ public final class MainLoader { if (DEBUG_MODE) { LOGGER.info("Nerfing Recipe " + r.mFluidOutputs[0].getUnlocalizedName()); } - r.mFluidOutputs[0] = new FluidStack(fluid, r.mFluidInputs[0].amount); + r.mFluidOutputs[0] = new FluidStack(fluid, r.mFluidOutputs[0].amount); + } + fluid = binds.get(r.mFluidInputs[0].getFluid()); + if (fluid != null) { + if (DEBUG_MODE) { + LOGGER.info("Fixing plasma use in Recipe " + r.mFluidInputs[0].getUnlocalizedName()); + } + r.mFluidInputs[0] = new FluidStack(fluid, r.mFluidInputs[0].amount); + } + fluid = binds.get(r.mFluidInputs[1].getFluid()); + if (fluid != null) { + if (DEBUG_MODE) { + LOGGER.info("Fixing plasma use in Recipe " + r.mFluidInputs[1].getUnlocalizedName()); + } + r.mFluidInputs[1] = new FluidStack(fluid, r.mFluidInputs[1].amount); } } } 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 799b1f183f..bfbe93bb4f 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 @@ -313,7 +313,7 @@ public final class cElementalInstanceStackMap implements Comparable var = map.values(); - return var.toArray(new cElementalInstanceStack[var.size()])[i]; + return var.toArray(new cElementalInstanceStack[0])[i]; } public String[] getElementalInfo() { @@ -339,12 +339,12 @@ public final class cElementalInstanceStackMap implements Comparable var = map.values(); - return var.toArray(new cElementalInstanceStack[var.size()]); + return var.toArray(new cElementalInstanceStack[0]); } public iElementalDefinition[] keys() { Set var = map.keySet(); - return var.toArray(new iElementalDefinition[var.size()]); + return var.toArray(new iElementalDefinition[0]); } public float getMass() { @@ -406,7 +406,6 @@ public final class cElementalInstanceStackMap implements Comparable lines, int capabilities, long energyLevel) { if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { 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 01e5571f23..367b412201 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 @@ -10,6 +10,7 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; import java.util.HashMap; +import java.util.HashSet; /** * Created by Tec on 26.05.2017. @@ -24,11 +25,7 @@ public class bTransformationInfo { public static final HashMap oredictQuantization=new HashMap<>(32); public HashMap oredictDequantization; - public bTransformationInfo(){ - fluidDequantization=new HashMap<>(); - itemDequantization=new HashMap<>(); - oredictDequantization=new HashMap<>(); - } + public static final HashSet stacksRegistered=new HashSet<>(); public bTransformationInfo(int fluidCap,int itemCap, int oreCap){ if(fluidCap>0) { @@ -45,49 +42,58 @@ public class bTransformationInfo { public void addFluid(iHasElementalDefinition em, FluidStack fluidStack){ fluidQuantization.put(fluidStack.getFluidID(),new aFluidQuantizationInfo(fluidStack,em)); fluidDequantization.put(em.getDefinition(),new aFluidDequantizationInfo(em,fluidStack)); + stacksRegistered.add(em.getDefinition()); } public void addFluid(iHasElementalDefinition em ,int fluidID,int fluidAmount) { fluidQuantization.put(fluidID,new aFluidQuantizationInfo(fluidID,fluidAmount,em)); fluidDequantization.put(em.getDefinition(),new aFluidDequantizationInfo(em,fluidID,fluidAmount)); + stacksRegistered.add(em.getDefinition()); } public void addFluid(iHasElementalDefinition em, Fluid fluid, int fluidAmount){ fluidQuantization.put(fluid.getID(),new aFluidQuantizationInfo(fluid,fluidAmount,em)); fluidDequantization.put(em.getDefinition(),new aFluidDequantizationInfo(em,fluid,fluidAmount)); + stacksRegistered.add(em.getDefinition()); } - public void addItemQuantization(aItemQuantizationInfo aIQI){ + private void addItemQuantization(aItemQuantizationInfo aIQI){ itemQuantization.put(aIQI,aIQI); } public void addItem(iHasElementalDefinition em, ItemStack itemStack, boolean skipNBT){ addItemQuantization(new aItemQuantizationInfo(itemStack,skipNBT,em)); itemDequantization.put(em.getDefinition(),new aItemDequantizationInfo(em,itemStack)); + stacksRegistered.add(em.getDefinition()); } public void addItem(iHasElementalDefinition em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT){ addItemQuantization(new aItemQuantizationInfo(prefix,material,amount,skipNBT,em)); itemDequantization.put(em.getDefinition(),new aItemDequantizationInfo(em,prefix,material,amount)); + stacksRegistered.add(em.getDefinition()); } public void addOredict(iHasElementalDefinition em, int id, int qty){ oredictQuantization.put(id,new aOredictQuantizationInfo(id,qty,em)); oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,id,qty)); + stacksRegistered.add(em.getDefinition()); } public void addOredict(iHasElementalDefinition em, String name, int qty){ oredictQuantization.put(OreDictionary.getOreID(name),new aOredictQuantizationInfo(name,qty,em)); oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,name,qty)); + stacksRegistered.add(em.getDefinition()); } public void addOredict(iHasElementalDefinition em, OrePrefixes prefix, Materials material, int qty){ oredictQuantization.put(OreDictionary.getOreID(prefix.name() + material.mName),new aOredictQuantizationInfo(prefix,material,qty,em)); oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,prefix,material,qty)); + stacksRegistered.add(em.getDefinition()); } public void addOredict(iHasElementalDefinition em, OrePrefixes prefix, String materialName, int qty){ oredictQuantization.put(OreDictionary.getOreID(prefix.name() + materialName),new aOredictQuantizationInfo(prefix,materialName,qty,em)); oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,prefix,materialName,qty)); + stacksRegistered.add(em.getDefinition()); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/atom/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/atom/dAtomDefinition.java index 16a668dfe3..5f191a4274 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/atom/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/atom/dAtomDefinition.java @@ -27,6 +27,7 @@ import net.minecraft.nbt.NBTTagCompound; import java.util.*; import static com.github.technus.tectech.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.definitions.primitive.eBosonDefinition.boson_Y__; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; @@ -462,28 +463,28 @@ public final class dAtomDefinition extends cElementalDefinition { case "D": { if (withThis.removeAllAmounts(false, deuterium.definition.getSubParticles())){ withThis.putReplace(deuterium); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_unsafeMightLeaveExposedElementalTree())); + decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; } } break; case "3H": { if (withThis.removeAllAmounts(false, tritium.definition.getSubParticles())){ withThis.putReplace(tritium); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_unsafeMightLeaveExposedElementalTree())); + decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; } } break; case "3HE": { if (withThis.removeAllAmounts(false, helium_3.definition.getSubParticles())){ withThis.putReplace(helium_3); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_unsafeMightLeaveExposedElementalTree())); + decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; } } break; case "8BE": { if (withThis.removeAllAmounts(false, beryllium_8.definition.getSubParticles())){ withThis.putReplace(beryllium_8); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_unsafeMightLeaveExposedElementalTree())); + decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; } } break; @@ -491,8 +492,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, carbon_14.definition.getSubParticles())){ newStuff.putReplace(carbon_14); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -505,8 +506,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, neon_24.definition.getSubParticles())){ newStuff.putReplace(neon_24); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -519,8 +520,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, silicon_34.definition.getSubParticles())){ newStuff.putReplace(silicon_34); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -533,8 +534,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2,dHadronDefinition.hadron_p2)){ newStuff.putReplace(alpha); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -549,8 +550,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eLeptonDefinition.lepton_e_1); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -565,8 +566,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eLeptonDefinition.lepton_e_2); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -581,8 +582,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eLeptonDefinition.lepton_e1); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -597,8 +598,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eLeptonDefinition.lepton_e2); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -612,8 +613,8 @@ public final class dAtomDefinition extends cElementalDefinition { withThis.putUnify(dHadronDefinition.hadron_n1); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -627,8 +628,8 @@ public final class dAtomDefinition extends cElementalDefinition { withThis.putUnify(dHadronDefinition.hadron_n2); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -643,8 +644,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eLeptonDefinition.lepton_e_1); newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -659,8 +660,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(alpha); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -676,8 +677,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(dHadronDefinition.hadron_p1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -693,8 +694,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(dHadronDefinition.hadron_p2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -709,8 +710,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(alpha); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -726,8 +727,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(dHadronDefinition.hadron_n1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -743,8 +744,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(dHadronDefinition.hadron_n2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -759,8 +760,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); newStuff.putReplace(dHadronDefinition.hadron_p1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -774,8 +775,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(alpha); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -790,8 +791,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(dHadronDefinition.hadron_p1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -806,8 +807,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); newStuff.putReplace(dHadronDefinition.hadron_p2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -822,8 +823,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); newStuff.putReplace(dHadronDefinition.hadron_p3); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -836,8 +837,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ newStuff.putReplace(dHadronDefinition.hadron_n1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -850,8 +851,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){ newStuff.putReplace(dHadronDefinition.hadron_n2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -864,8 +865,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1)){ newStuff.putReplace(dHadronDefinition.hadron_p1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -878,8 +879,8 @@ public final class dAtomDefinition extends cElementalDefinition { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){ newStuff.putReplace(dHadronDefinition.hadron_p2); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -975,8 +976,8 @@ public final class dAtomDefinition extends cElementalDefinition { newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); newStuff.putReplace(eBosonDefinition.boson_Y__1); try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; }catch (Exception e){ if(DEBUG_MODE) { @@ -1000,7 +1001,7 @@ public final class dAtomDefinition extends cElementalDefinition { cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAmount(false, emit)) { try { - decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_unsafeMightLeaveExposedElementalTree()), 1), emit)); + decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), emit)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1015,7 +1016,7 @@ public final class dAtomDefinition extends cElementalDefinition { cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAllAmounts(false, alpha.definition.getSubParticles())) { try { - decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_unsafeMightLeaveExposedElementalTree()), 1), alpha)); + decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), alpha)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1031,7 +1032,7 @@ public final class dAtomDefinition extends cElementalDefinition { if (tree.removeAmount(false, dHadronDefinition.hadron_n1)) { try { tree.putUnify(dHadronDefinition.hadron_p1); - decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_unsafeMightLeaveExposedElementalTree()), 1), eLeptonDefinition.lepton_e1, eNeutrinoDefinition.lepton_Ve_1)); + decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e1, eNeutrinoDefinition.lepton_Ve_1)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1047,7 +1048,7 @@ public final class dAtomDefinition extends cElementalDefinition { if (tree.removeAmount(false, dHadronDefinition.hadron_p1)) { try { tree.putUnify(dHadronDefinition.hadron_n1); - decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_unsafeMightLeaveExposedElementalTree()), 1), eLeptonDefinition.lepton_e_1, eNeutrinoDefinition.lepton_Ve1)); + decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e_1, eNeutrinoDefinition.lepton_Ve1)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1063,7 +1064,7 @@ public final class dAtomDefinition extends cElementalDefinition { if (tree.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)) { try { tree.putUnify(dHadronDefinition.hadron_n1); - decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_unsafeMightLeaveExposedElementalTree()), 1), eNeutrinoDefinition.lepton_Ve1)); + decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), eNeutrinoDefinition.lepton_Ve1)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1112,9 +1113,9 @@ public final class dAtomDefinition extends cElementalDefinition { } try { - particles.putReplace(new cElementalDefinitionStack(new dAtomDefinition(fissile.toImmutable_unsafeMightLeaveExposedElementalTree()),1)); - particles.putReplace(new cElementalDefinitionStack(new dAtomDefinition(heavy.toImmutable_unsafeMightLeaveExposedElementalTree()),1)); - decaysList.add(new cElementalDecay(probability, particles.toImmutable_unsafeMightLeaveExposedElementalTree())); + particles.putReplace(new cElementalDefinitionStack(new dAtomDefinition(fissile.toImmutable_optimized_unsafeLeavesExposedElementalTree()),1)); + particles.putReplace(new cElementalDefinitionStack(new dAtomDefinition(heavy.toImmutable_optimized_unsafeLeavesExposedElementalTree()),1)); + decaysList.add(new cElementalDecay(probability, particles.toImmutable_optimized_unsafeLeavesExposedElementalTree())); return true; } catch (Exception e) { if(DEBUG_MODE) { @@ -1276,7 +1277,7 @@ public final class dAtomDefinition extends cElementalDefinition { anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount)); } try { - return new dAtomDefinition(anti.toImmutable_unsafeMightLeaveExposedElementalTree()); + return new dAtomDefinition(anti.toImmutable_optimized_unsafeLeavesExposedElementalTree()); } catch (tElementalException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -1308,14 +1309,7 @@ public final class dAtomDefinition extends cElementalDefinition { @Override public NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setByte("t", nbtType); - cElementalDefinitionStack[] elementalStacksValues = elementalStacks.values(); - nbt.setInteger("i", elementalStacksValues.length); - for (int i = 0; i < elementalStacksValues.length; i++) { - nbt.setTag(Integer.toString(i), elementalStacksValues[i].toNBT()); - } - return nbt; + return getNbtTagCompound(nbtType, elementalStacks); } public static dAtomDefinition fromNBT(NBTTagCompound nbt) { @@ -1624,6 +1618,10 @@ public final class dAtomDefinition extends cElementalDefinition { return 64; } + public static byte getClassTypeStatic(){ + return 64; + } + @Override public int hashCode() { return hash; diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/hadron/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/hadron/dHadronDefinition.java index ed2cee8b2f..f24b9f2d82 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/hadron/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/hadron/dHadronDefinition.java @@ -19,6 +19,7 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; +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.definitions.complex.atom.dAtomDefinition.transformation; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; @@ -324,7 +325,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount)); } try { - return new dHadronDefinition(anti.toImmutable_unsafeMightLeaveExposedElementalTree()); + return new dHadronDefinition(anti.toImmutable_optimized_unsafeLeavesExposedElementalTree()); } catch (tElementalException e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -350,14 +351,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi @Override public NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setByte("t", nbtType); - cElementalDefinitionStack[] quarkStacksValues = quarkStacks.values(); - nbt.setInteger("i", quarkStacksValues.length); - for (int i = 0; i < quarkStacksValues.length; i++) { - nbt.setTag(Integer.toString(i), quarkStacksValues[i].toNBT()); - } - return nbt; + return getNbtTagCompound(nbtType, quarkStacks); } public static dHadronDefinition fromNBT(NBTTagCompound nbt) { @@ -429,6 +423,10 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi return -64; } + public static byte getClassTypeStatic(){ + return -64; + } + @Override public int hashCode() { return hash; diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java index 2cd6d79d22..1f68163238 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java @@ -4,7 +4,10 @@ import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.Util; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalInstanceContainer; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -71,6 +74,30 @@ public final class DebugElementalInstanceContainer_EM extends Item { return aPlayer instanceof EntityPlayerMP; } + public ItemStack setContent(ItemStack aStack,cElementalInstanceStackMap content){ + NBTTagCompound tNBT = aStack.getTagCompound(); + if(tNBT==null){ + aStack.setTagCompound(new NBTTagCompound()); + } + if (tNBT.hasKey("content")) { + try { + content.putUnifyAll(cElementalInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); + } catch (tElementalException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return aStack; + } + tNBT.removeTag("content"); + tNBT.removeTag("info"); + } else if (content.hasStacks()) { + tNBT.setTag("info", content.getInfoNBT()); + tNBT.setTag("content", content.toNBT()); + content.clear(); + } + return aStack; + } + @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { aList.add(CommonValues.TEC_MARK_EM); @@ -98,5 +125,10 @@ public final class DebugElementalInstanceContainer_EM extends Item { ItemStack that = new ItemStack(this, 1); that.setTagCompound(new NBTTagCompound()); list.add(that); + for(iElementalDefinition defintion:bTransformationInfo.stacksRegistered){ + list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+1),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,1)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+144),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,144)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+1000),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,1000)))); + } } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index eb029d8726..dcee60d40b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -2,9 +2,19 @@ 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.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalMutableDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.atom.dAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.hadron.dHadronDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; @@ -21,6 +31,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; +import java.util.HashMap; + import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -32,12 +44,231 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - public static long heliumPlasmaValue; + private static Textures.BlockIcons.CustomIcon ScreenON_Slave; + private static Textures.BlockIcons.CustomIcon ScreenOFF_Slave; + + private static double MASS_TO_EU_PARTIAL,MASS_TO_EU_INSTANT; + private static int STARTUP_COST,KEEPUP_COST; + + private long plasmaEnergy; + + public static void setValues(int heliumPlasmaValue){ + MASS_TO_EU_PARTIAL = heliumPlasmaValue / 1.75893000478707E07;//mass diff + MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20; + STARTUP_COST=-heliumPlasmaValue*10000; + KEEPUP_COST=-heliumPlasmaValue; + } + + //region collision handlers + public static final HashMap FUSE_HANDLERS =new HashMap<>(); + public static final HashMap PRIMITIVE_FUSE_HANDLERS =new HashMap<>(); + public interface PrimitiveColliderHandler { + void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out); + } + public interface ColliderHandler extends PrimitiveColliderHandler { + byte getRequiredTier(); + } + static { + FUSE_HANDLERS.put((dAtomDefinition.getClassTypeStatic() << 16) | dAtomDefinition.getClassTypeStatic(), new ColliderHandler() { + @Override + public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { + try { + cElementalMutableDefinitionStackMap defs=new cElementalMutableDefinitionStackMap(); + defs.putUnifyAll(in1.definition.getSubParticles()); + defs.putUnifyAll(in2.definition.getSubParticles()); + dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + out.putUnify(new cElementalInstanceStack(atom,Math.min(in1.amount,in2.amount))); + }catch (Exception e){ + out.putUnifyAll(in1,in2); + return; + } + if(in1.amount>in2.amount){ + out.putUnify(new cElementalInstanceStack(in1.definition,in1.amount-in2.amount)); + }else if (in2.amount>in1.amount){ + out.putUnify(new cElementalInstanceStack(in2.definition,in2.amount-in1.amount)); + } + } + + @Override + public byte getRequiredTier() { + return 1; + } + }); + registerSimpleAtomFuse(dHadronDefinition.getClassTypeStatic()); + registerSimpleAtomFuse(dComplexAspectDefinition.getClassTypeStatic()); + registerSimpleAtomFuse(cElementalPrimitive.getClassTypeStatic()); + + FUSE_HANDLERS.put((dHadronDefinition.getClassTypeStatic() << 16) | dHadronDefinition.getClassTypeStatic(), new ColliderHandler() { + @Override + public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { + try { + cElementalMutableDefinitionStackMap defs=new cElementalMutableDefinitionStackMap(); + defs.putUnifyAll(in1.definition.getSubParticles()); + defs.putUnifyAll(in2.definition.getSubParticles()); + dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + out.putUnify(new cElementalInstanceStack(hadron,Math.min(in1.amount,in2.amount))); + }catch (Exception e){ + out.putUnifyAll(in1,in2); + return; + } + if(in1.amount>in2.amount){ + out.putUnify(new cElementalInstanceStack(in1.definition,in1.amount-in2.amount)); + }else if (in2.amount>in1.amount){ + out.putUnify(new cElementalInstanceStack(in2.definition,in2.amount-in1.amount)); + } + } + + @Override + public byte getRequiredTier() { + return 2; + } + }); + FUSE_HANDLERS.put((dHadronDefinition.getClassTypeStatic() << 16) | cElementalPrimitive.getClassTypeStatic(), new ColliderHandler() { + @Override + public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { + try { + cElementalMutableDefinitionStackMap defs=new cElementalMutableDefinitionStackMap(); + defs.putUnifyAll(in1.definition.getSubParticles()); + defs.putUnify(in2.definition.getStackForm(1)); + dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); + out.putUnify(new cElementalInstanceStack(hadron,Math.min(in1.amount,in2.amount))); + }catch (Exception e){ + out.putUnifyAll(in1,in2); + return; + } + if(in1.amount>in2.amount){ + out.putUnify(new cElementalInstanceStack(in1.definition,in1.amount-in2.amount)); + }else if (in2.amount>in1.amount){ + out.putUnify(new cElementalInstanceStack(in2.definition,in2.amount-in1.amount)); + } + } + + @Override + public byte getRequiredTier() { + return 2; + } + }); + + registerSimpleAspectFuse(dComplexAspectDefinition.getClassTypeStatic()); + registerSi