aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorTec <daniel112092@gmail.com>2022-01-17 22:21:58 +0100
committerMartin Robertz <dream-master@gmx.net>2022-01-29 21:23:12 +0100
commit7edde3bf8c069244dabc7138fb5c5f53ce40336d (patch)
tree6a950d7a866bfb88059f9d4936fb8f7fc1117254 /src/main
parentc82522576d27ba1b0fdaf7fe1283489cb9f40744 (diff)
downloadGT5-Unofficial-7edde3bf8c069244dabc7138fb5c5f53ce40336d.tar.gz
GT5-Unofficial-7edde3bf8c069244dabc7138fb5c5f53ce40336d.tar.bz2
GT5-Unofficial-7edde3bf8c069244dabc7138fb5c5f53ce40336d.zip
Cleanup EM api, encapsulate
(cherry picked from commit 27946d59f2f7c272f2f91ec393a35f5d26f5293e)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/github/technus/tectech/TecTech.java8
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java60
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java16
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java16
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java6
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java (renamed from src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java)124
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java42
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java42
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java20
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java68
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java6
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java10
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java22
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java18
-rw-r--r--src/main/java/com/github/technus/tectech/loader/ElementalLoader.java34
-rw-r--r--src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java8
-rw-r--r--src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java2
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java8
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/tElementalException.java)4
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java)6
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java)50
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/ListEM.java)20
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java90
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java)16
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java77
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java58
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java56
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java242
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java50
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java)134
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java112
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java166
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java58
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java56
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java214
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java50
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java130
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java87
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java65
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java57
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java73
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java73
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java605
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java37
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java88
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java566
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iElementalStack.java23
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java)46
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java)104
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java84
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java85
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java)16
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java)16
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java)16
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java)24
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java)30
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java60
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java172
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java)2
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java52
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java124
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java1694
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java)290
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMNuclideIAEA.java (renamed from src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java)89
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java1678
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java45
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java69
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java59
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java39
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java106
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java39
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java45
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java69
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java59
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java106
-rw-r--r--src/main/java/com/github/technus/tectech/recipe/TT_recipe.java104
-rw-r--r--src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java22
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java40
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java26
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java22
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java251
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java22
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java38
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java48
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java48
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java52
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java69
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java47
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java6
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java10
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo4
-rw-r--r--src/main/java/com/github/technus/tectech/util/DoubleCount.java122
96 files changed, 5205 insertions, 4733 deletions
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java
index 809a7e877d..ef5e146bfa 100644
--- a/src/main/java/com/github/technus/tectech/TecTech.java
+++ b/src/main/java/com/github/technus/tectech/TecTech.java
@@ -9,8 +9,8 @@ import com.github.technus.tectech.mechanics.commands.ConvertFloat;
import com.github.technus.tectech.mechanics.commands.ConvertInteger;
import com.github.technus.tectech.mechanics.data.ChunkDataHandler;
import com.github.technus.tectech.mechanics.data.PlayerPersistence;
-import com.github.technus.tectech.mechanics.elementalMatter.core.commands.GiveEM;
-import com.github.technus.tectech.mechanics.elementalMatter.core.commands.ListEM;
+import com.github.technus.tectech.mechanics.elementalMatter.core.commands.EMGive;
+import com.github.technus.tectech.mechanics.elementalMatter.core.commands.EMList;
import com.github.technus.tectech.proxy.CommonProxy;
import com.github.technus.tectech.util.XSTR;
import cpw.mods.fml.common.FMLCommonHandler;
@@ -203,9 +203,9 @@ public class TecTech {
public void serverLoad(FMLServerStartingEvent pEvent) {
pEvent.registerServerCommand(new ConvertInteger());
pEvent.registerServerCommand(new ConvertFloat());
- pEvent.registerServerCommand(new ListEM());
+ pEvent.registerServerCommand(new EMList());
if(DEBUG_MODE) {
- pEvent.registerServerCommand(new GiveEM());
+ pEvent.registerServerCommand(new EMGive());
pEvent.registerServerCommand(new CancerCommand());
pEvent.registerServerCommand(new ChargeCommand());
}
diff --git a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java
index 72cee6d7aa..73d2955548 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java
@@ -1,14 +1,14 @@
package com.github.technus.tectech.compatibility.gtpp;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo;
import gregtech.api.enums.OrePrefixes;
import net.minecraftforge.fluids.FluidStack;
import java.lang.reflect.Method;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.*;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.*;
public class GtppAtomLoader implements Runnable{
//region reflect a bit
@@ -67,34 +67,34 @@ public class GtppAtomLoader implements Runnable{
}
//endregion
- bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), getFluid("NEON",144));
+ EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), getFluid("NEON",144));
generate("GERMANIUM",true,true);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144), getFluid("BROMINE",144));
- bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144), getFluid("KRYPTON",144));
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),getFluid("XENON",144));
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144), getFluid("BROMINE",144));
+ EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144), getFluid("KRYPTON",144));
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),getFluid("XENON",144));
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(85), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(84), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(85), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(87), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(88), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(89), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(91), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(93), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(96), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(97), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(98), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(99), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(100), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(96), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(97), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(98), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(99), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(100), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1);
}
}
diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java
index a0b6106151..d594a826bc 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java
@@ -1,8 +1,8 @@
package com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles;
import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition;
import gregtech.api.GregTech_API;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
@@ -44,25 +44,25 @@ public class projectileEM extends LaserProjectile {
}
}
- public projectileEM(World par1World, TurretBase turretBase, cElementalInstanceStack projectileContent) {
+ public projectileEM(World par1World, TurretBase turretBase, EMInstanceStack projectileContent) {
super(par1World, turretBase);
this.turretBase = turretBase;
if(projectileContent != null){
mass=projectileContent.getMass();
charge=projectileContent.getCharge();
- massFactor =(float) (projectileContent.definition.getMass()/ dHadronDefinition.hadron_n_.getMass());
+ massFactor =(float) (projectileContent.getDefinition().getMass()/ EMHadronDefinition.hadron_n_.getMass());
- if(projectileContent.definition.getType()>1 || projectileContent.definition.getType()<-1) {
+ if(projectileContent.getDefinition().getType()>1 || projectileContent.getDefinition().getType()<-1) {
strange = true;
}
- if(projectileContent.definition.getType()<0) {
+ if(projectileContent.getDefinition().getType()<0) {
antiMatter = true;
}
- if (projectileContent.definition.getCharge() == 0) {
+ if (projectileContent.getDefinition().getCharge() == 0) {
gravity = massFactor / 100f;
} else {
- gravity = Math.min(0.0025F / Math.abs(projectileContent.definition.getCharge()), massFactor / 100f);
+ gravity = Math.min(0.0025F / Math.abs(projectileContent.getDefinition().getCharge()), massFactor / 100f);
}
}
}
diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java
index e027c83107..6dc5c4f60a 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java
@@ -2,8 +2,8 @@ package com.github.technus.tectech.compatibility.openmodularturrets.tileentity.t
import com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles.projectileEM;
import com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase.TileTurretBaseEM;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
@@ -14,13 +14,13 @@ import openmodularturrets.handler.ConfigHandler;
import openmodularturrets.tileentity.turrets.TurretHead;
import openmodularturrets.util.TurretHeadUtil;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT;
/**
* Created by Bass on 27/07/2017.
*/
public class TileTurretHeadEM extends TurretHead{
- private cElementalInstanceStackMap hatchContentPointer;
+ private EMInstanceStackMap hatchContentPointer;
@Override
public int getTurretRange() {
@@ -70,11 +70,11 @@ public class TileTurretHeadEM extends TurretHead{
if (hatchContentPointer == null || hatchContentPointer.isEmpty()) {
return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), null);
}
- cElementalInstanceStack stack = hatchContentPointer.getRandom();
- double amount = Math.min(AVOGADRO_CONSTANT,stack.amount);
- hatchContentPointer.removeAmount(false, stack.definition.getStackForm(AVOGADRO_CONSTANT));
+ EMInstanceStack stack = hatchContentPointer.getRandom();
+ double amount = Math.min(AVOGADRO_CONSTANT, stack.getAmount());
+ hatchContentPointer.removeAmount(stack.getDefinition(),AVOGADRO_CONSTANT);
stack=stack.clone();
- stack.amount = amount;
+ stack.setAmount(amount);
return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), stack);
}
diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java
index a5d64fb886..0dbc33e007 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java
@@ -1,6 +1,6 @@
package com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental;
import cpw.mods.fml.common.Optional;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -25,7 +25,7 @@ public class TileTurretBaseEM extends TurretBaseTierFiveTileEntity {
return "turretBaseEM";
}
- public final cElementalInstanceStackMap getContainerHandler() {
+ public final EMInstanceStackMap getContainerHandler() {
World worldIn = getWorldObj();
TileEntity te;
if ((te = worldIn.getTileEntity(xCoord + 1, yCoord, zCoord)) instanceof IGregTechTileEntity &&
@@ -61,7 +61,7 @@ public class TileTurretBaseEM extends TurretBaseTierFiveTileEntity {
return null;
}
- private cElementalInstanceStackMap getFromHatch(GT_MetaTileEntity_Hatch_InputElemental hatch) {
+ private EMInstanceStackMap getFromHatch(GT_MetaTileEntity_Hatch_InputElemental hatch) {
hatch.updateTexture((byte) 8,(byte) 4);
return hatch.getContentHandler();
}
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/EMComplexAspectDefinition.java
index 98ad5bbf63..432d151b80 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/EMComplexAspectDefinition.java
@@ -3,55 +3,55 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.defi
import com.github.technus.tectech.TecTech;
import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat;
import com.github.technus.tectech.util.Util;
-import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition;
import net.minecraft.nbt.NBTTagCompound;
import java.util.ArrayList;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay.noDecay;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY;
import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*;
import static net.minecraft.util.StatCollector.translateToLocal;
/**
* Created by Tec on 06.05.2017.
*/
-public final class dComplexAspectDefinition extends cElementalDefinition {
- private final int hash;
- public final double mass;
+public final class EMComplexAspectDefinition extends EMComplex {
+ private final int hash;
+ private final double mass;
private static final byte nbtType = (byte) 'c';
- private final cElementalConstantStackMap aspectStacks;
+ private final EMConstantStackMap aspectStacks;
- public dComplexAspectDefinition(cElementalDefinitionStack... aspects) throws tElementalException {
- this(true, new cElementalConstantStackMap(aspects));
+ public EMComplexAspectDefinition(EMDefinitionStack... aspects) throws EMException {
+ this(true, new EMConstantStackMap(aspects));
}
- private dComplexAspectDefinition(boolean check, cElementalDefinitionStack... aspects) throws tElementalException {
- this(check, new cElementalConstantStackMap(aspects));
+ private EMComplexAspectDefinition(boolean check, EMDefinitionStack... aspects) throws EMException {
+ this(check, new EMConstantStackMap(aspects));
}
- public dComplexAspectDefinition(cElementalConstantStackMap aspects) throws tElementalException {
+ public EMComplexAspectDefinition(EMConstantStackMap aspects) throws EMException {
this(true, aspects);
}
- private dComplexAspectDefinition(boolean check, cElementalConstantStackMap aspects) throws tElementalException {
+ private EMComplexAspectDefinition(boolean check, EMConstantStackMap aspects) throws EMException {
if (check && !canTheyBeTogether(aspects)) {
- throw new tElementalException("Hadron Definition error");
+ throw new EMException("Hadron Definition error");
}
aspectStacks = aspects;
float mass = 0;
- for (cElementalDefinitionStack stack : aspects.valuesToArray()) {
+ for (EMDefinitionStack stack : aspects.valuesToArray()) {
mass += stack.getMass();
}
this.mass = mass;
@@ -59,22 +59,22 @@ public final class dComplexAspectDefinition extends cElementalDefinition {
}
//public but u can just try{}catch(){} the constructor it still calls this method
- private static boolean canTheyBeTogether(cElementalConstantStackMap stacks) {
+ private static boolean canTheyBeTogether(EMConstantStackMap stacks) {
long amount = 0;
- for (cElementalDefinitionStack aspects : stacks.valuesToArray()) {
- if (!(aspects.definition instanceof dComplexAspectDefinition) && !(aspects.definition instanceof ePrimalAspectDefinition)) {
+ for (EMDefinitionStack aspects : stacks.valuesToArray()) {
+ if (!(aspects.getDefinition() instanceof EMComplexAspectDefinition) && !(aspects.getDefinition() instanceof EMPrimalAspectDefinition)) {
return false;
}
- if((int)aspects.amount!=aspects.amount){
+ if((int) aspects.getAmount() != aspects.getAmount()){
throw new ArithmeticException("Amount cannot be safely converted to int!");
}
- amount += aspects.amount;
+ amount += aspects.getAmount();
}
return amount == 2;
}
@Override
- public String getName() {
+ public String getLocalizedName() {
String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectTag(this);
if (name != null) {
name = name.substring(0, 1).toUpperCase() + name.substring(1);
@@ -87,15 +87,15 @@ public final class dComplexAspectDefinition extends cElementalDefinition {
@Override
public String getSymbol() {
StringBuilder symbol = new StringBuilder(8);
- for (cElementalDefinitionStack aspect : aspectStacks.valuesToArray()) {
- if (aspect.definition instanceof ePrimalAspectDefinition) {
- for (int i = 0; i < aspect.amount; i++) {
- symbol.append(aspect.definition.getSymbol());
+ for (EMDefinitionStack aspect : aspectStacks.valuesToArray()) {
+ if (aspect.getDefinition() instanceof EMPrimalAspectDefinition) {
+ for (int i = 0; i < aspect.getAmount(); i++) {
+ symbol.append(aspect.getDefinition().getSymbol());
}
} else {
symbol.append('(');
- for (int i = 0; i < aspect.amount; i++) {
- symbol.append(aspect.definition.getSymbol());
+ for (int i = 0; i < aspect.getAmount(); i++) {
+ symbol.append(aspect.getDefinition().getSymbol());
}
symbol.append(')');
}
@@ -106,15 +106,15 @@ public final class dComplexAspectDefinition extends cElementalDefinition {
@Override
public String getShortSymbol() {
StringBuilder symbol = new StringBuilder(8);
- for (cElementalDefinitionStack aspect : aspectStacks.valuesToArray()) {
- if (aspect.definition instanceof ePrimalAspectDefinition) {
- for (int i = 0; i < aspect.amount; i++) {
- symbol.append(aspect.definition.getShortSymbol());
+ for (EMDefinitionStack aspect : aspectStacks.valuesToArray()) {
+ if (aspect.getDefinition() instanceof EMPrimalAspectDefinition) {
+ for (int i = 0; i < aspect.getAmount(); i++) {
+ symbol.append(aspect.getDefinition().getShortSymbol());
}
} else {
symbol.append('(');
- for (int i = 0; i < aspect.amount; i++) {
- symbol.append(aspect.definition.getShortSymbol());
+ for (int i = 0; i < aspect.getAmount(); i++) {
+ symbol.append(aspect.getDefinition().getShortSymbol());
}
symbol.append(')');
}
@@ -127,10 +127,10 @@ public final class dComplexAspectDefinition extends cElementalDefinition {
return getNbtTagCompound(nbtType, aspectStacks);
}
- public static NBTTagCompound getNbtTagCompound(byte nbtType, cElementalConstantStackMap aspectStacks) {
+ public static NBTTagCompound getNbtTagCompound(byte nbtType, EMConstantStackMap aspectStacks) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setByte("t", nbtType);
- cElementalDefinitionStack[] quarkStacksValues = aspectStacks.valuesToArray();
+ EMDefinitionStack[] quarkStacksValues = aspectStacks.valuesToArray();
nbt.setInteger("i", quarkStacksValues.length);
for (int i = 0; i < quarkStacksValues.length; i++) {
nbt.setTag(Integer.toString(i), quarkStacksValues[i].toNBT());
@@ -138,14 +138,14 @@ public final class dComplexAspectDefinition extends cElementalDefinition {
return nbt;
}
- public static dComplexAspectDefinition fromNBT(NBTTagCompound nbt) {
- cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[nbt.getInteger("i")];
+ public static EMComplexAspectDefinition fromNBT(NBTTagCompound nbt) {
+ EMDefinitionStack[] stacks = new EMDefinitionStack[nbt.getInteger("i")];
for (int i = 0; i < stacks.length; i++) {
- stacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i)));
+ stacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i)));
}
try {
- return new dComplexAspectDefinition(stacks);
- } catch (tElementalException e) {
+ return new EMComplexAspectDefinition(stacks);
+ } catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
}
@@ -179,18 +179,18 @@ public final class dComplexAspectDefinition extends cElementalDefinition {
}
@Override
- public cElementalConstantStackMap getSubParticles() {
+ public EMConstantStackMap getSubParticles() {
return aspectStacks;
}
@Override
- public cElementalDecay[] getEnergyInducedDecay(long energyLevel) {
- return new cElementalDecay[]{new cElementalDecay(0.75F, aspectStacks), eBosonDefinition.deadEnd};
+ public EMDecay[] getEnergyInducedDecay(long energyLevel) {
+ return new EMDecay[]{new EMDecay(0.75F, aspectStacks), EMBosonDefinition.deadEnd};
}
@Override
public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) {
- return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel);
+ return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel);
}
@Override
@@ -214,13 +214,13 @@ public final class dComplexAspectDefinition extends cElementalDefinition {
}
@Override
- public cElementalDecay[] getNaturalDecayInstant() {
- return noDecay;
+ public EMDecay[] getNaturalDecayInstant() {
+ return NO_DECAY;
}
@Override
- public cElementalDecay[] getDecayArray() {
- return noDecay;
+ public EMDecay[] getDecayArray() {
+ return NO_DECAY;
}
@Override
@@ -229,28 +229,28 @@ public final class dComplexAspectDefinition extends cElementalDefinition {
}
@Override
- public aFluidDequantizationInfo someAmountIntoFluidStack() {
+ public EMFluidDequantizationInfo someAmountIntoFluidStack() {
return null;
}
@Override
- public aItemDequantizationInfo someAmountIntoItemsStack() {
+ public EMItemDequantizationInfo someAmountIntoItemsStack() {
return null;
}
@Override
- public aOredictDequantizationInfo someAmountIntoOredictStack() {
+ public EMOredictDequantizationInfo someAmountIntoOredictStack() {
return null;
}
@Override
- public iElementalDefinition getAnti() {
+ public IEMDefinition getAnti() {
return null;
}
public static void run() {
try {
- cElementalDefinition.addCreatorFromNBT(nbtType, dComplexAspectDefinition.class.getMethod("fromNBT", NBTTagCompound.class), (byte) -96);
+ EMComplex.addCreatorFromNBT(nbtType, EMComplexAspectDefinition.class.getMethod("fromNBT", NBTTagCompound.class), (byte) -96);
} catch (Exception e) {
if (DEBUG_MODE) {
e.printStackTrace();
@@ -288,7 +288,7 @@ public final class dComplexAspectDefinition extends cElementalDefinition {
lines.add(translateToLocal("tt.keyword.CLASS") + " = " + nbtType + ' ' + getClassType());
}
if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS, capabilities)) {
- lines.add(translateToLocal("tt.keyword.NAME") + " = " + getName());
+ lines.add(translateToLocal("tt.keyword.NAME") + " = " + getLocalizedName());
//lines.add("SYMBOL = "+getSymbol());
}
if (Util.areBitsSet(SCAN_GET_CHARGE, capabilities)) {
diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java
new file mode 100644
index 0000000000..bf9703d6d7
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java
@@ -0,0 +1,42 @@
+package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive;
+
+import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY;
+import static net.minecraft.util.StatCollector.translateToLocal;
+
+/**
+ * Created by Tec on 06.05.2017.
+ */
+public final class EMPrimalAspectDefinition extends EMPrimitive {
+ public static final EMPrimalAspectDefinition
+ magic_air = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 35),
+ magic_earth = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 34),
+ magic_fire = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3D, 33),
+ magic_water = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7D, 32),
+ magic_order = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5D, 30),
+ magic_entropy = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Entropy"), "e`", 1e5D, 31);
+
+ private EMPrimalAspectDefinition(String name, String symbol, double mass, int ID) {
+ super(name, symbol, 0, mass, 0, -1, ID);
+ }
+
+ public static void run() {
+ magic_air.init(null, -1F, -1, -1, NO_DECAY);
+ magic_earth.init(null, -1F, -1, -1, NO_DECAY);
+ magic_fire.init(null, -1F, -1, -1, NO_DECAY);
+ magic_water.init(null, -1F, -1, -1, NO_DECAY);
+ magic_order.init(null, -1F, -1, -1, NO_DECAY);
+ magic_entropy.init(null, -1F, -1, -1, NO_DECAY);
+ }
+
+ @Override
+ public String getLocalizedName() {
+ return translateToLocal("tt.keyword.Primal") + ": " + getName();
+ }
+
+ @Override
+ public boolean isTimeSpanHalfLife() {
+ return false;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java
deleted file mode 100644
index 5db067a552..0000000000
--- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive;
-
-import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay.noDecay;
-import static net.minecraft.util.StatCollector.translateToLocal;
-
-/**
- * Created by Tec on 06.05.2017.
- */
-public final class ePrimalAspectDefinition extends cElementalPrimitive {
- public static final ePrimalAspectDefinition
- magic_air = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 35),
- magic_earth = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 34),
- magic_fire = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3D, 33),
- magic_water = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7D, 32),
- magic_order = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5D, 30),
- magic_entropy = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Entropy"), "e`", 1e5D, 31);
-
- private ePrimalAspectDefinition(String name, String symbol, double mass, int ID) {
- super(name, symbol, 0, mass, 0, -1, ID);
- }
-
- public static void run() {
- magic_air.init(null, -1F, -1, -1, noDecay);
- magic_earth.init(null, -1F, -1, -1, noDecay);
- magic_fire.init(null, -1F, -1, -1, noDecay);
- magic_water.init(null, -1F, -1, -1, noDecay);
- magic_order.init(null, -1F, -1, -1, noDecay);
- magic_entropy.init(null, -1F, -1, -1, noDecay);
- }
-
- @Override
- public String getName() {
- return translateToLocal("tt.keyword.Primal") + ": " + name;
- }
-
- @Override
- public boolean isTimeSpanHalfLife() {
- return false;
- }
-} \ No newline at end of file
diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java
index 343071e26e..c7f38eb21d 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java
@@ -1,7 +1,7 @@
package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
import java.util.HashMap;
@@ -9,21 +9,25 @@ import java.util.HashMap;
* Created by Tec on 21.05.2017.
*/
public class AspectDefinitionCompat {
- public static AspectDefinitionCompat aspectDefinitionCompat;
- public final HashMap<iElementalDefinition,String> defToAspect = new HashMap<>();
- public final HashMap<String,iElementalDefinition> aspectToDef = new HashMap<>();
+ public static AspectDefinitionCompat aspectDefinitionCompat;
+ private final HashMap<IEMDefinition,String> defToAspect = new HashMap<>();
+ private final HashMap<String, IEMDefinition> aspectToDef = new HashMap<>();
public void run(){}
- public Object getAspect(iElementalDefinition definition){
+ public String getAspectTag(IEMDefinition definition){
return null;
}
- public String getAspectTag(iElementalDefinition definition){
+ public IEMDefinition getDefinition(String aspect){
return null;
}
- public iElementalDefinition getDefinition(String aspect){
- return null;
+ public HashMap<IEMDefinition, String> getDefToAspect() {
+ return defToAspect;
+ }
+
+ public HashMap<String, IEMDefinition> getAspectToDef() {
+ return aspectToDef;
}
}
diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java
index 446e9b66d5..c9ca5d7b9f 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java
@@ -1,13 +1,13 @@
package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations;
-import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
+import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
import thaumcraft.api.aspects.Aspect;
import java.util.ArrayList;
-import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition.*;
+import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition.*;
import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED;
/**
@@ -16,19 +16,19 @@ import static com.github.technus.tectech.thing.item.DebugElementalInstanceContai
public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat {
@Override
public void run(){
- defToAspect.put(magic_air,"aer");
- defToAspect.put(magic_earth,"terra");
- defToAspect.put(magic_fire,"ignis");
- defToAspect.put(magic_water,"aqua");
- defToAspect.put(magic_order,"ordo");
- defToAspect.put(magic_entropy,"perditio");
+ getDefToAspect().put(magic_air,"aer");
+ getDefToAspect().put(magic_earth,"terra");
+ getDefToAspect().put(magic_fire,"ignis");
+ getDefToAspect().put(magic_water,"aqua");
+ getDefToAspect().put(magic_order,"ordo");
+ getDefToAspect().put(magic_entropy,"perditio");
- aspectToDef.put("aer",magic_air);
- aspectToDef.put("terra",magic_earth);
- aspectToDef.put("ignis",magic_fire);
- aspectToDef.put("aqua",magic_water);
- aspectToDef.put("ordo",magic_order);
- aspectToDef.put("perditio",magic_entropy);
+ getAspectToDef().put("aer",magic_air);
+ getAspectToDef().put("terra",magic_earth);
+ getAspectToDef().put("ignis",magic_fire);
+ getAspectToDef().put("aqua",magic_water);
+ getAspectToDef().put("ordo",magic_order);
+ getAspectToDef().put("perditio",magic_entropy);
ArrayList<Aspect> list=Aspect.getCompoundAspects();
Aspect[] array= list.toArray(new Aspect[0]);
@@ -38,20 +38,20 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat
Aspect[] content = aspect.getComponents();
if (content.length != 2) {
list.remove(aspect);
- }else if(aspectToDef.containsKey(content[0].getTag()) && aspectToDef.containsKey(content[1].getTag())){
+ }else if(getAspectToDef().containsKey(content[0].getTag()) && getAspectToDef().containsKey(content[1].getTag())){
try {
- dComplexAspectDefinition newAspect;
+ EMComplexAspectDefinition newAspect;
if(content[0].getTag().equals(content[1].getTag())){
- newAspect = new dComplexAspectDefinition(
- aspectToDef.get(content[0].getTag()).getStackForm(2));
+ newAspect = new EMComplexAspectDefinition(
+ getAspectToDef().get(content[0].getTag()).getStackForm(2));
}else{
- newAspect = new dComplexAspectDefinition(
- aspectToDef.get(content[0].getTag()).getStackForm(1),
- aspectToDef.get(content[1].getTag()).getStackForm(1));
+ newAspect = new EMComplexAspectDefinition(
+ getAspectToDef().get(content[0].getTag()).getStackForm(1),
+ getAspectToDef().get(content[1].getTag()).getStackForm(1));
}
- aspectToDef.put(aspect.getTag(),newAspect);
- defToAspect.put(newAspect,aspect.getTag());
- }catch (tElementalException e) {
+ getAspectToDef().put(aspect.getTag(),newAspect);
+ getDefToAspect().put(newAspect,aspect.getTag());
+ }catch (EMException e) {
/**/
}finally {
list.remove(aspect);
@@ -60,22 +60,16 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat
}
}
}
-
- STACKS_REGISTERED.addAll(defToAspect.keySet());
- }
-
- @Override
- public Aspect getAspect(iElementalDefinition definition) {
- return Aspect.getAspect(defToAspect.get(definition));
+ STACKS_REGISTERED.addAll(getDefToAspect().keySet());
}
@Override
- public String getAspectTag(iElementalDefinition definition) {
- return defToAspect.get(definition);
+ public String getAspectTag(IEMDefinition definition) {
+ return getDefToAspect().get(definition);
}
@Override
- public iElementalDefinition getDefinition(String aspect) {
- return aspectToDef.get(aspect);
+ public IEMDefinition getDefinition(String aspect) {
+ return getAspectToDef().get(aspect);
}
}
diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java
index 63f55912a6..d51bc8dc2d 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java
@@ -1,6 +1,6 @@
package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
import net.minecraft.tileentity.TileEntity;
@@ -18,7 +18,7 @@ public class EssentiaCompat {
return null;
}
- public String getEssentiaName(iElementalDefinition stack){
+ public String getEssentiaName(IEMDefinition stack){
return null;
}
@@ -26,7 +26,7 @@ public class EssentiaCompat {
return false;
}
- public iElementalDefinition getFromContainer(TileEntity container){
+ public IEMDefinition getFromContainer(TileEntity container){
return null;
}
}
diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java
index 03ff92b4e0..ab682ba1a5 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java
@@ -1,6 +1,6 @@
package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
import net.minecraft.tileentity.TileEntity;
import thaumcraft.api.aspects.Aspect;
@@ -28,8 +28,8 @@ public class EssentiaCompatEnabled extends EssentiaCompat {
}
@Override
- public String getEssentiaName(iElementalDefinition stack) {
- return aspectDefinitionCompat.defToAspect.get(stack);
+ public String getEssentiaName(IEMDefinition stack) {
+ return aspectDefinitionCompat.getDefToAspect().get(stack);
}
@Override
@@ -49,7 +49,7 @@ public class EssentiaCompatEnabled extends EssentiaCompat {
}
@Override
- public iElementalDefinition getFromContainer(TileEntity container){
+ public IEMDefinition getFromContainer(TileEntity container){
if(container==null || container.isInvalid()) {
return null;
}
@@ -59,7 +59,7 @@ public class EssentiaCompatEnabled extends EssentiaCompat {
Aspect[] aspectsArr= aspects.getAspects();
if(aspectsArr!=null && aspectsArr[0]!=null){
if (((IAspectContainer) container).takeFromContainer(aspectsArr[0],1)){
- return aspectDefinitionCompat.aspectToDef.get(aspectsArr[0].getTag());
+ return aspectDefinitionCompat.getAspectToDef().get(aspectsArr[0].getTag());
}
}
}
diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java
index c939f10d6b..dbcbe7d86b 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java
@@ -2,8 +2,8 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity
import com.github.technus.tectech.TecTech;
import com.github.technus.tectech.mechanics.constructable.IConstructable;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
import com.github.technus.tectech.mechanics.structure.Structure;
import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder;
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
@@ -26,8 +26,8 @@ import net.minecraftforge.common.util.ForgeDirection;
import thaumcraft.api.aspects.Aspect;
import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED;
import static com.github.technus.tectech.mechanics.structure.Structure.adders;
import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset;
import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT;
@@ -94,24 +94,24 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_
return false;
}
- cElementalInstanceStackMap inputHatchContainer = eInputHatches.get(0).getContentHandler();
+ EMInstanceStackMap inputHatchContainer = eInputHatches.get(0).getContentHandler();
if (inputHatchContainer == null || !inputHatchContainer.hasStacks()) {
return false;
}
- cElementalInstanceStack stack = inputHatchContainer.getRandom();
- if (stack.amount < AVOGADRO_CONSTANT_DIMINISHED) {
- cleanStackEM_EM(inputHatchContainer.remove(stack.definition));
+ EMInstanceStack stack = inputHatchContainer.getRandom();
+ if (stack.getAmount() < AVOGADRO_CONSTANT_DIMINISHED) {
+ cleanStackEM_EM(inputHatchContainer.removeKey(stack.getDefinition()));
mEUt = (int) -V[6];
} else {
- outputEssentiaName = essentiaContainerCompat.getEssentiaName(stack.definition);
+ outputEssentiaName = essentiaContainerCompat.getEssentiaName(stack.getDefinition());
Aspect aspect = Aspect.getAspect(outputEssentiaName);
if (aspect == null) {
outputEssentiaName = null;
- cleanStackEM_EM(inputHatchContainer.remove(stack.definition));
+ cleanStackEM_EM(inputHatchContainer.removeKey(stack.getDefinition()));
mEUt = (int) -V[7];
} else {
- inputHatchContainer.removeAmount(false, stack.definition.getStackForm(AVOGADRO_CONSTANT));
+ inputHatchContainer.removeAmount(stack.getDefinition().getStackForm(AVOGADRO_CONSTANT));
if (aspect.isPrimal()) {
mEUt = (int) -V[8];
} else {
diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java
index 62ac339155..5606442c37 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java
@@ -1,11 +1,11 @@
package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi;
import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition;
+import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition;
import com.github.technus.tectech.mechanics.constructable.IConstructable;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
import com.github.technus.tectech.mechanics.structure.Structure;
import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder;
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
@@ -25,7 +25,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection;
import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT;
import static com.github.technus.tectech.mechanics.structure.Structure.adders;
import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset;
import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT;
@@ -84,15 +84,15 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu
@Override
public boolean checkRecipe_EM(ItemStack itemStack) {
- iElementalDefinition definition = essentiaContainerCompat.getFromContainer(essentiaContainerCompat.getContainer(this));
+ IEMDefinition definition = essentiaContainerCompat.getFromContainer(essentiaContainerCompat.getContainer(this));
if (definition != null) {
mMaxProgresstime = 20;
mEfficiencyIncrease = 10000;
eAmpereFlow = 1;
- outputEM = new cElementalInstanceStackMap[]{
- new cElementalInstanceStackMap(new cElementalInstanceStack(definition,AVOGADRO_CONSTANT))
+ outputEM = new EMInstanceStackMap[]{
+ new EMInstanceStackMap(new EMInstanceStack(definition,AVOGADRO_CONSTANT))
};
- if (definition instanceof ePrimalAspectDefinition) {
+ if (definition instanceof EMPrimalAspectDefinition) {
mEUt = (int) -V[8];
} else {
mEUt = (int) -V[10];
diff --git a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java
index b481b82646..7ce371e57e 100644
--- a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java
@@ -1,11 +1,11 @@
package com.github.technus.tectech.loader;
-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.templates.cElementalPrimitive;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.iaeaNuclide;
+import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition;
+import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMNuclideIAEA;
import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.*;
/**
@@ -18,23 +18,23 @@ public class ElementalLoader implements Runnable {
// Definition init
// ===================================================================================================
- cElementalPrimitive.run();
+ EMPrimitive.run();
- cPrimitiveDefinition.run();
+ EMPrimitiveDefinition.run();
- eQuarkDefinition.run();
- eLeptonDefinition.run();
- eNeutrinoDefinition.run();
- eBosonDefinition.run();
+ EMQuarkDefinition.run();
+ EMLeptonDefinition.run();
+ EMNeutrinoDefinition.run();
+ EMBosonDefinition.run();
- dHadronDefinition.run();
+ EMHadronDefinition.run();
- iaeaNuclide.run();
+ EMNuclideIAEA.run();
- dAtomDefinition.run();
+ EMAtomDefinition.run();
- ePrimalAspectDefinition.run();
+ EMPrimalAspectDefinition.run();
- dComplexAspectDefinition.run();
+ EMComplexAspectDefinition.run();
}
}
diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java
index a2e2f65384..7cd5a25f4a 100644
--- a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java
@@ -3,8 +3,8 @@ package com.github.technus.tectech.loader.recipe;
import com.github.technus.tectech.Reference;
import com.github.technus.tectech.compatibility.dreamcraft.DreamCraftRecipeLoader;
import com.github.technus.tectech.compatibility.spartakcore.SpartakCoreRecipeLoader;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition;
import com.github.technus.tectech.thing.CustomItemList;
import com.github.technus.tectech.thing.casing.TT_Container_Casings;
import com.github.technus.tectech.thing.item.ConstructableTriggerItem;
@@ -35,8 +35,8 @@ public class RecipeLoader implements Runnable {
@Override
public void run() {
- dAtomDefinition.setTransformation();
- dHadronDefinition.setTransformations();
+ EMAtomDefinition.setTransformation();
+ EMHadronDefinition.setTransformations();
// ===================================================================================================
// Recipes init - common goes here rest goes into methods below
diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java
index 91dbffa71f..b3df7483f5 100644
--- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java
@@ -15,7 +15,7 @@ import cpw.mods.fml.common.Loader;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT;
import static com.github.technus.tectech.util.CommonValues.V;
import static com.github.technus.tectech.thing.CustomItemList.*;
diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java
index 0e1771e88d..c6ac34b66d 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java
@@ -7,7 +7,7 @@ import com.github.technus.tectech.mechanics.data.ChunkDataHandler;
import com.github.technus.tectech.mechanics.data.ChunkDataMessage;
import com.github.technus.tectech.mechanics.data.IChunkMetaDataHandler;
import com.github.technus.tectech.mechanics.data.PlayerDataMessage;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition;
import com.github.technus.tectech.util.Util;
import cpw.mods.fml.common.gameevent.TickEvent;
import gregtech.api.GregTech_API;
@@ -31,11 +31,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144;
public class AnomalyHandler implements IChunkMetaDataHandler {
- private static final double SWAP_THRESHOLD = dAtomDefinition.getSomethingHeavy().getMass() * 1000D * AVOGADRO_CONSTANT_144;//can be const as it is computed later...
+ private static final double SWAP_THRESHOLD = EMAtomDefinition.getSomethingHeavy().getMass() * 1000D * AVOGADRO_CONSTANT_144;//can be const as it is computed later...
private static final int COUNT_DIV=32;
private static final double PER_PARTICLE=SWAP_THRESHOLD/COUNT_DIV;
private static final String INTENSITY = "intensity",SPACE_CANCER="space_cancer", SPACE_CHARGE ="space_charge";
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/tElementalException.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java
index 2adadfd062..23ca5d77d9 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/tElementalException.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java
@@ -3,8 +3,8 @@ package com.github.technus.tectech.mechanics.elementalMatter.core;
/**
* Created by danie_000 on 19.11.2016.
*/
-public final class tElementalException extends Exception {
- public tElementalException(String message) {
+public final class EMException extends Exception {
+ public EMException(String message) {
super(message);
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java
index 457a37f7b9..d731078988 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalContainer.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java
@@ -1,12 +1,12 @@
package com.github.technus.tectech.mechanics.elementalMatter.core;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
/**
* Created by danie_000 on 25.01.2017.
*/
-public interface iElementalContainer {
- cElementalInstanceStackMap getContentHandler();
+public interface IEMContainer {
+ EMInstanceStackMap getContentHandler();
void purgeOverflow();
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java
index 8b1f6d0c14..64e9bcea1e 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java
@@ -1,13 +1,13 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.commands;
import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalDefinitionStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
@@ -23,15 +23,15 @@ import java.util.List;
import java.util.Map;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__;
/**
* Created by danie_000 on 30.12.2017.
*/
-public class GiveEM implements ICommand {
+public class EMGive implements ICommand {
ArrayList<String> aliases=new ArrayList<>();
- public GiveEM(){
+ public EMGive(){
aliases.add("em_give");
aliases.add("give_em");
aliases.add("gib_em");
@@ -48,13 +48,13 @@ public class GiveEM implements ICommand {
ArrayList<String> list = new ArrayList<>(Arrays.asList(args));
String energy=list.remove(0);
- cElementalDefinitionStack def= getDefinitionStack(list);
+ EMDefinitionStack def = getDefinitionStack(list);
if(def!=null) {
- cElementalInstanceStack instanceStack = new cElementalInstanceStack(def, 1D, 0D, Long.parseLong(energy));
+ EMInstanceStack instanceStack = new EMInstanceStack(def, 1D, 0D, Long.parseLong(energy));
- sender.addChatMessage(new ChatComponentText(instanceStack.definition.getSymbol() + " - " + instanceStack.definition.getName()));
+ sender.addChatMessage(new ChatComponentText(instanceStack.getDefinition().getSymbol() + " - " + instanceStack.getDefinition().getLocalizedName()));
- cElementalInstanceStackMap instanceMap = new cElementalInstanceStackMap(instanceStack);
+ EMInstanceStackMap instanceMap = new EMInstanceStackMap(instanceStack);
ItemStack itemStack = new ItemStack(DebugElementalInstanceContainer_EM.INSTANCE);
NBTTagCompound contents = new NBTTagCompound();
@@ -68,7 +68,7 @@ public class GiveEM implements ICommand {
}
}
- private cElementalDefinitionStack getDefinitionStack(ArrayList<String> args){
+ private EMDefinitionStack getDefinitionStack(ArrayList<String> args){
if(args.get(0).equals("<")){
args.remove(0);
return null;
@@ -77,24 +77,24 @@ public class GiveEM implements ICommand {
try{
int id=Integer.parseInt(args.get(0));
args.remove(0);
- iElementalDefinition primitive=cElementalPrimitive.getBindsPrimitive().get(id);
- return new cElementalDefinitionStack(primitive,amount);
+ IEMDefinition primitive = EMPrimitive.getBindsPrimitive().get(id);
+ return new EMDefinitionStack(primitive,amount);
}catch (NumberFormatException e){
byte clazz = (byte) args.remove(0).charAt(0);
- Method constructor = cElementalDefinition.getBindsComplex().get(clazz);
+ Method constructor = EMComplex.getBindsComplex().get(clazz);
- cElementalDefinitionStackMap stacks =new cElementalDefinitionStackMap();
+ EMDefinitionStackMap stacks =new EMDefinitionStackMap();
while(args.size()>0){
- cElementalDefinitionStack tempStack=getDefinitionStack(args);
+ EMDefinitionStack tempStack =getDefinitionStack(args);
if(tempStack==null) {
break;
}else {
- stacks.putUnify(tempStack);
+ stacks.putUnifyExact(tempStack);
}
}
try {
- return ((iElementalDefinition) constructor.invoke(null, stacks.toNBT())).getStackForm(amount);
+ return ((IEMDefinition) constructor.invoke(null, stacks.toNBT())).getStackForm(amount);
} catch (Exception e1) {
if (DEBUG_MODE) {
e.printStackTrace();
@@ -129,12 +129,12 @@ public class GiveEM implements ICommand {
private List<String> completionsForClassOrID(){
ArrayList<String> strings=new ArrayList<>(8);
- Map<Byte,Method> binds= cElementalDefinition.getBindsComplex();
+ Map<Byte,Method> binds= EMComplex.getBindsComplex();
for (Map.Entry<Byte,Method> e:binds.entrySet()) {
strings.add(String.valueOf((char)e.getKey().byteValue()));
}
- Map<Integer, cElementalPrimitive> bindsBO = cElementalPrimitive.getBindsPrimitive();
- for (Map.Entry<Integer,cElementalPrimitive> e:bindsBO.entrySet()) {
+ Map<Integer, EMPrimitive> bindsBO = EMPrimitive.getBindsPrimitive();
+ for (Map.Entry<Integer, EMPrimitive> e:bindsBO.entrySet()) {
strings.add(String.valueOf(e.getKey().byteValue()));
}
return strings;
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/ListEM.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java
index 20110c0b0d..395592036f 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/ListEM.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java
@@ -1,7 +1,7 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.commands;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;
@@ -14,10 +14,10 @@ import java.util.Map;
/**
* Created by danie_000 on 30.12.2017.
*/
-public class ListEM implements ICommand {
+public class EMList implements ICommand {
ArrayList<String> aliases=new ArrayList<>();
- public ListEM(){
+ public EMList(){
aliases.add("em_list");
aliases.add("list_em");
}
@@ -27,16 +27,16 @@ public class ListEM implements ICommand {
if (!sender.getEntityWorld().isRemote) {
if(args.length == 0) {
sender.addChatMessage(new ChatComponentText(" Available Classes: tag - name"));
- Map<Byte,Method> binds= cElementalDefinition.getBindsComplex();
+ Map<Byte,Method> binds= EMComplex.getBindsComplex();
for (Map.Entry<Byte,Method> e:binds.entrySet()) {
sender.addChatMessage(new ChatComponentText((char) e.getKey().byteValue() +" - "+e.getValue().getReturnType().getSimpleName()));
}
}else if(args.length==1){
sender.addChatMessage(new ChatComponentText(" Available Primitives: symbol - name"));
- if(args[0].equals(String.valueOf((char)cElementalPrimitive.nbtType))){
- Map<Integer, cElementalPrimitive> bindsBO = cElementalPrimitive.getBindsPrimitive();
- for (Map.Entry<Integer,cElementalPrimitive> e:bindsBO.entrySet()) {
- sender.addChatMessage(new ChatComponentText(e.getKey() + " - "+e.getValue().getName()));
+ if(args[0].equals(String.valueOf((char) EMPrimitive.nbtType))){
+ Map<Integer, EMPrimitive> bindsBO = EMPrimitive.getBindsPrimitive();
+ for (Map.Entry<Integer, EMPrimitive> e:bindsBO.entrySet()) {
+ sender.addChatMessage(new ChatComponentText(e.getKey() + " - "+e.getValue().getLocalizedName()));
}
}else{
sender.addChatMessage(new ChatComponentText("Complex definition - needs contents"));
@@ -65,7 +65,7 @@ public class ListEM implements ICommand {
@Override
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args) {
if(args.length==0){
- Map<Byte,Method> binds= cElementalDefinition.getBindsComplex();
+ Map<Byte,Method> binds= EMComplex.getBindsComplex();
ArrayList<String> strings=new ArrayList<>(binds.size());
for (Map.Entry<Byte,Method> e:binds.entrySet()) {
strings.add(String.valueOf((char)e.getKey().byteValue())+' '+e.getValue().getReturnType().getSimpleName());
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java
new file mode 100644
index 0000000000..bed49a5040
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java
@@ -0,0 +1,90 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.decay;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
+
+import static com.github.technus.tectech.util.DoubleCount.mul;
+
+/**
+ * Created by danie_000 on 22.10.2016.
+ */
+public final class EMDecay {
+ public static final EMDecay[] NO_DECAY = null;
+ //DECAY IMPOSSIBLE!!!
+ //Do not use regular NULL java will not make it work with varargs!!!
+ //Or cast null into ARRAY type but this static is more convenient!!!
+ public static final EMDecay[] NO_PRODUCT = new EMDecay[0];
+ //this in turn can be used to tell that the thing should just vanish
+ private final EMConstantStackMap outputStacks;
+ private final double probability;
+
+ public EMDecay(IEMDefinition... outSafe) {
+ this(1D, outSafe);
+ }
+
+ public EMDecay(double probability, IEMDefinition... outSafe) {
+ EMDefinitionStack[] outArr = new EMDefinitionStack[outSafe.length];
+ for (int i = 0; i < outArr.length; i++) {
+ outArr[i] = new EMDefinitionStack(outSafe[i], 1D);
+ }
+ outputStacks = new EMConstantStackMap(outArr);
+ this.probability = probability;
+ }
+
+ public EMDecay(EMDefinitionStack... outSafe) {
+ this(1D, outSafe);
+ }
+
+ public EMDecay(double probability, EMDefinitionStack... out) {
+ outputStacks = new EMConstantStackMap(out);
+ this.probability = probability;
+ }
+
+ public EMDecay(EMConstantStackMap tree) {
+ this(1D, tree);
+ }
+
+ public EMDecay(double probability, EMConstantStackMap tree) {
+ outputStacks = tree;
+ this.probability = probability;
+ }
+
+ public EMInstanceStackMap getResults(double lifeMult, double age, long newEnergyLevel, double amountDecaying) {
+ EMInstanceStackMap decayResult = new EMInstanceStackMap();
+ if (getOutputStacks() == null) {
+ return decayResult;//This is to prevent null pointer exceptions.
+ }
+ //Deny decay code is in instance!
+ boolean empty=true;
+ for (EMDefinitionStack stack : getOutputStacks().valuesToArray()) {
+ if(stack.getAmount() >0){
+ empty=false;
+ break;
+ }
+ }
+ if (empty) {
+ return decayResult;
+ }
+ //newEnergyLevel /= qtty;
+ //lifeMult /= (float) qtty;
+ for (EMDefinitionStack stack : getOutputStacks().valuesToArray()) {
+ decayResult.putUnify(new EMInstanceStack(stack.getDefinition(),
+ mul(amountDecaying, stack.getAmount()),
+ lifeMult,
+ age/*new products*/,
+ (long)(newEnergyLevel / Math.max(1D, Math.abs(stack.getAmount())))));//get instances from stack
+ }
+ return decayResult;
+ }
+
+ public EMConstantStackMap getOutputStacks() {
+ return outputStacks;
+ }
+
+ public double getProbability() {
+ return probability;
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java
index 43f4341720..0a00a519f9 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecayResult.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java
@@ -1,24 +1,25 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.decay;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
-public class cElementalDecayResult {
- private final cElementalInstanceStackMap output;
- private double massAffected;
- private double massDiff;
+public class EMDecayResult {
+ private final EMInstanceStackMap output;
+ private double massAffected;
+ private double massDiff;
- public cElementalDecayResult(cElementalInstanceStackMap output, double massAffected, double massDiff) {
+ public EMDecayResult(EMInstanceStackMap output, double massAffected, double massDiff) {
this.output = output;
this.massAffected = massAffected;
this.massDiff = massDiff;
}
- public cElementalInstanceStackMap getOutput() {
+ public EMInstanceStackMap getOutput() {
return output;
}
/**
* How much was lost in the process (decayed or removed)
+ *
* @return
*/
public double getMassAffected() {
@@ -27,6 +28,7 @@ public class cElementalDecayResult {
/**
* Difference of mass of actually decayed elements
+ *
* @return
*/
public double getMassDiff() {
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java
deleted file mode 100644
index 79103f7fa0..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/cElementalDecay.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.decay;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
-
-import static com.github.technus.tectech.util.DoubleCount.add;
-
-/**
- * Created by danie_000 on 22.10.2016.
- */
-public final class cElementalDecay {
- public static final cElementalDecay[] noDecay = null;
- //DECAY IMPOSSIBLE!!!
- //Do not use regular NULL java will not make it work with varargs!!!
- //Or cast null into ARRAY type but this static is more convenient!!!
- public static final cElementalDecay[] noProduct = new cElementalDecay[0];
- //this in turn can be used to tell that the thing should just vanish
- public final cElementalConstantStackMap outputStacks;
- public final double probability;
-
- public cElementalDecay(iElementalDefinition... outSafe) {
- this(1D, outSafe);
- }
-
- public cElementalDecay(double probability, iElementalDefinition... outSafe) {
- cElementalDefinitionStack[] outArr = new cElementalDefinitionStack[outSafe.length];
- for (int i = 0; i < outArr.length; i++) {
- outArr[i] = new cElementalDefinitionStack(outSafe[i], 1D);
- }
- outputStacks = new cElementalConstantStackMap(outArr);
- this.probability = probability;
- }
-
- public cElementalDecay(cElementalDefinitionStack... outSafe) {
- this(1D, outSafe);
- }
-
- public cElementalDecay(double probability, cElementalDefinitionStack... out) {
- outputStacks = new cElementalConstantStackMap(out);
- this.probability = probability;
- }
-
- public cElementalDecay(cElementalConstantStackMap tree) {
- this(1D, tree);
- }
-
- public cElementalDecay(double probability, cElementalConstantStackMap tree) {
- outputStacks = tree;
- this.probability = probability;
- }
-
- public cElementalInstanceStackMap getResults(double lifeMult, double age, long energyTotalForProducts, double amountDecaying) {
- cElementalInstanceStackMap decayResult = new cElementalInstanceStackMap();
- if (outputStacks == null) {
- return decayResult;//This is to prevent null pointer exceptions.
- }
- //Deny decay code is in instance!
- double qtty = 0D;
- for (cElementalDefinitionStack stack : outputStacks.valuesToArray()) {
- qtty= add(qtty,stack.amount);
- }
- if (qtty <= 0D) {
- return decayResult;
- }
- //energyTotalForProducts /= qtty;
- //lifeMult /= (float) qtty;
- for (cElementalDefinitionStack stack : outputStacks.valuesToArray()) {
- decayResult.putUnify(new cElementalInstanceStack(stack.definition,
- amountDecaying * stack.amount,
- lifeMult, age/*new products*/, (long)(energyTotalForProducts / Math.max(1D, Math.abs(stack.amount)))));//get instances from stack
- }
- return decayResult;
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java
new file mode 100644
index 0000000000..d9297436a0
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java
@@ -0,0 +1,58 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
+import net.minecraft.nbt.NBTTagCompound;
+
+import java.util.Collections;
+import java.util.NavigableMap;
+import java.util.TreeMap;
+
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__;
+
+/**
+ * Created by Tec on 12.05.2017.
+ */
+public final class EMConstantStackMap/*IMMUTABLE*/ extends EMStackMap<EMDefinitionStack> {//Target class for construction of definitions/recipes
+ //Constructors + Clone, all make a whole new OBJ.
+ public static final EMConstantStackMap EMPTY = new EMConstantStackMap();
+
+ private EMConstantStackMap() {
+ super(Collections.emptyNavigableMap());
+ }
+
+ public EMConstantStackMap(EMDefinitionStack... in) {
+ this(new EMDefinitionStackMap(in).getBackingMap());
+ }
+
+ public EMConstantStackMap(NavigableMap<IEMDefinition, EMDefinitionStack> in) {
+ super(Collections.unmodifiableNavigableMap(in));
+ }
+
+ @Override
+ public Class<EMDefinitionStack> getType() {
+ return EMDefinitionStack.class;
+ }
+
+ //IMMUTABLE DON'T NEED IT
+ @Override
+ public EMConstantStackMap clone() {
+ return this;
+ }
+
+ public EMDefinitionStackMap toMutable() {
+ return new EMDefinitionStackMap(new TreeMap<>(getBackingMap()));
+ }
+
+ public static EMConstantStackMap fromNBT(NBTTagCompound nbt) throws EMException {
+ EMDefinitionStack[] defStacks = new EMDefinitionStack[nbt.getInteger("i")];
+ for (int i = 0; i < defStacks.length; i++) {
+ defStacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i)));
+ if (defStacks[i].getDefinition().equals(nbtE__)) {
+ throw new EMException("Something went Wrong");
+ }
+ }
+ return new EMConstantStackMap(defStacks);
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java
new file mode 100644
index 0000000000..45ce50d5c7
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java
@@ -0,0 +1,56 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
+import net.minecraft.nbt.NBTTagCompound;
+
+import java.util.NavigableMap;
+import java.util.TreeMap;
+
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__;
+
+/**
+ * Created by danie_000 on 22.01.2017.
+ */
+public final class EMDefinitionStackMap extends EMStackMap<EMDefinitionStack> implements IEMMapWriteExact<EMDefinitionStack> {//Transient class for construction of definitions/recipes
+ //Constructors + Clone, all make a whole new OBJ.
+ public EMDefinitionStackMap() {}
+
+ public EMDefinitionStackMap(EMDefinitionStack... in) {
+ putUnifyAllExact(in);
+ }
+
+ public EMDefinitionStackMap(NavigableMap<IEMDefinition, EMDefinitionStack> in) {
+ super(in);
+ }
+
+ @Override
+ public Class<EMDefinitionStack> getType() {
+ return EMDefinitionStack.class;
+ }
+
+ @Override
+ public EMDefinitionStackMap clone() {
+ return new EMDefinitionStackMap(new TreeMap<>(getBackingMap()));
+ }
+
+ public EMConstantStackMap toImmutable() {
+ return new EMConstantStackMap(new TreeMap<>(getBackingMap()));
+ }
+
+ public EMConstantStackMap toImmutable_optimized_unsafe_LeavesExposedElementalTree() {
+ return new EMConstantStackMap(getBackingMap());
+ }
+
+ public static EMDefinitionStackMap fromNBT(NBTTagCompound nbt) throws EMException {
+ EMDefinitionStack[] defStacks = new EMDefinitionStack[nbt.getInteger("i")];
+ for (int i = 0; i < defStacks.length; i++) {
+ defStacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i)));
+ if (defStacks[i].getDefinition().equals(nbtE__)) {
+ throw new EMException("Something went Wrong");
+ }
+ }
+ return new EMDefinitionStackMap(defStacks);
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java
new file mode 100644
index 0000000000..c15142787f
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java
@@ -0,0 +1,242 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.NavigableMap;
+import java.util.TreeMap;
+
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__;
+import static com.github.technus.tectech.util.DoubleCount.add;
+
+/**
+ * Created by danie_000 on 22.01.2017.
+ */
+public final class EMInstanceStackMap extends EMStackMap<EMInstanceStack> implements IEMMapWrite<EMInstanceStack> {
+ //Constructors
+ public EMInstanceStackMap() {}
+
+ public EMInstanceStackMap(EMInstanceStack... inSafe) {
+ this(true, inSafe);
+ }
+
+ public EMInstanceStackMap(boolean clone, EMInstanceStack... in) {
+ if (clone) {
+ EMInstanceStack[] stacks =new EMInstanceStack[in.length];
+ for(int i=0;i<stacks.length;i++) {
+ stacks[i] = in[i].clone();
+ }
+ putUnifyAll(stacks);
+ } else {
+ putUnifyAll(in);
+ }
+ }
+
+ private EMInstanceStackMap(NavigableMap<IEMDefinition, EMInstanceStack> inSafe) {
+ this(true, inSafe);
+ }
+
+ private EMInstanceStackMap(boolean clone, NavigableMap<IEMDefinition, EMInstanceStack> in) {
+ super(clone?new TreeMap<>():in);
+ if (clone) {
+ for(EMInstanceStack stack:in.values()) {
+ putUnify(stack.clone());
+ }
+ }
+ }
+
+ @Override
+ public Class<EMInstanceStack> getType() {
+ return EMInstanceStack.class;
+ }
+
+ @Override
+ public EMInstanceStackMap clone() {
+ return new EMInstanceStackMap(getBackingMap());
+ }
+
+ //Remove overflow
+ public double removeOverflow(int stacksCount, double stackCapacity) {
+ double massRemoved = 0;
+
+ if (getBackingMap().size() > stacksCount) {
+ IEMDefinition[] keys = keySetToArray();
+ for (int i = stacksCount; i < keys.length; i++) {
+ massRemoved += getBackingMap().get(keys[i]).getDefinitionStack().getMass();
+ getBackingMap().remove(keys[i]);
+ }
+ }
+
+ for (EMInstanceStack instance : valuesToArray()) {
+ if (instance.getAmount() > stackCapacity) {
+ massRemoved += instance.getDefinition().getMass() * (instance.getAmount() - stackCapacity);
+ instance.setAmount(stackCapacity);
+ }
+ }
+ return massRemoved;
+ }
+
+ //Getters
+ public String[] getElementalInfo() {
+ String[] info = new String[getBackingMap().size()];
+ int i = 0;
+ for (EMInstanceStack instance : getBackingMap().values()) {
+ info[i++] = EnumChatFormatting.BLUE + instance.getDefinition().getLocalizedName()+
+ " "+ EnumChatFormatting.AQUA + instance.getDefinition().getSymbol()+ EnumChatFormatting.RESET+
+ " #: " + EnumChatFormatting.GREEN + String.format("%.3E", instance.getAmount() / AVOGADRO_CONSTANT) +" mol"+ EnumChatFormatting.RESET+
+ " E: " + EnumChatFormatting.GREEN + instance.getEnergy() + EnumChatFormatting.RESET+
+ " T: " + EnumChatFormatting.GREEN + (instance.getLifeTime()<0?"STABLE":String.format("%.3E",instance.getLifeTime()));
+ }
+ return info;
+ }
+
+ public ArrayList<String> getScanShortSymbols(int[] capabilities) {
+ ArrayList<String> list=new ArrayList<>(16);
+ for(Map.Entry<IEMDefinition, EMInstanceStack> e: getBackingMap().entrySet()){
+ e.getValue().addScanShortSymbols(list,capabilities);
+ }
+ return list;
+ }
+
+ public ArrayList<String> getScanInfo(int[] capabilities) {
+ ArrayList<String> list=new ArrayList<>(16);
+ for(Map.Entry<IEMDefinition, EMInstanceStack> e: getBackingMap().entrySet()){
+ e.getValue().addScanResults(list,capabilities);
+ }
+ return list;
+ }
+
+ //Tick Content
+ public double tickContentByOneSecond(double lifeTimeMult, int postEnergize) {
+ return tickContent(lifeTimeMult,postEnergize,1D);
+ }
+
+ public double tickContent(double lifeTimeMult, int postEnergize, double seconds){
+ cleanUp();
+ double diff=0;
+ for (EMInstanceStack instance : valuesToArray()) {
+ instance.setAge(instance.getAge() + seconds);
+ EMDecayResult newInstances = instance.decay(lifeTimeMult, instance.getAge(), postEnergize);
+ if (newInstances == null) {
+ instance.nextColor();
+ } else {
+ diff=add(diff,newInstances.getMassDiff());
+ removeAmount(instance);//todo check maybe this should be removeKey
+ putUnifyAll(newInstances.getOutput());
+ }
+ }
+ return diff;
+ }
+
+ //NBT
+ public NBTTagCompound getScanShortSymbolsNBT(int[] capabilities) {
+ NBTTagCompound nbt = new NBTTagCompound();
+ ArrayList<String> info = getScanShortSymbols(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 getScanInfoNBT(int[] capabilities) {
+ NBTTagCompound nbt = new NBTTagCompound();
+ 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 static EMInstanceStackMap fromNBT(NBTTagCompound nbt) throws EMException {
+ EMInstanceStack[] instances = new EMInstanceStack[nbt.getInteger("i")];
+ for (int i = 0; i < instances.length; i++) {
+ instances[i] = EMInstanceStack.fromNBT(nbt.getCompoundTag(Integer.toString(i)));
+ if (instances[i].getDefinition().equals(nbtE__)) {
+ throw new EMException("Something went Wrong");
+ }
+ }
+ return new EMInstanceStackMap(false, instances);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof EMInstanceStackMap) {
+ return compareTo((EMInstanceStackMap) obj) == 0;
+ }
+ if (obj instanceof EMStackMap) {
+ return toDefinitionMapForComparison().compareTo((EMStackMap<?>) obj) == 0;
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder build=new StringBuilder("Instance Stack Map\n");
+ for(EMInstanceStack stack: getBackingMap().values()){
+ build.append(stack.toString()).append('\n');
+ }
+ return build.toString();
+ }
+
+ public EMInstanceStackMap takeAll(){
+ EMInstanceStackMap newStack =new EMInstanceStackMap(false,new TreeMap<>(this.getBackingMap()));//just in case to uncouple The map
+ this.getBackingMap().clear();
+ return newStack;
+ }
+
+ public EMDefinitionStackMap toDefinitionMapForComparison() {
+ EMDefinitionStack[] list = new EMDefinitionStack[size()];
+ int i = 0;
+ for (Map.Entry<IEMDefinition, EMInstanceStack> entry : entrySet()) {
+ EMInstanceStack value = entry.getValue();
+ list[i++] = new EMDefinitionStack(value.getDefinition(), value.getAmount());
+ }
+ return new EMDefinitionStackMap(list);
+ }
+
+ @Override
+ public EMInstanceStack putUnify(EMInstanceStack stack) {
+ EMInstanceStack target =get(stack.getDefinition());
+ if(target==null) {
+ putReplace(stack);
+ return stack;
+ }
+ double newAmount = add(target.getAmount(), stack.getAmount());
+ if (IEMMapRead.isValidAmount(newAmount)) {
+ stack=target.unifyIntoThis(stack);
+ putReplace(stack);
+ return stack;
+ }else {
+ removeKey(stack);
+ return null;
+ }
+ }
+
+ @Override
+ public EMInstanceStack putUnifyExact(EMInstanceStack stack) {
+ EMInstanceStack target =get(stack.getDefinition());
+ if(target==null) {
+ putReplace(stack);
+ return stack;
+ }
+ double newAmount = target.getAmount()+stack.getAmount();
+ if (IEMMapRead.isValidAmount(newAmount)) {
+ stack=target.unifyIntoThis(stack);
+ putReplace(stack);
+ return stack;
+ }else {
+ removeKey(stack);
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java
new file mode 100644
index 0000000000..4c798499b5
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java
@@ -0,0 +1,50 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
+
+import java.util.NavigableMap;
+import java.util.TreeMap;
+
+/**
+ * Created by Tec on 12.05.2017.
+ */
+abstract class EMStackMap<T extends IEMStack> implements IEMMapRead<T> {
+ private final NavigableMap<IEMDefinition, T> backingMap;
+
+ protected EMStackMap() {
+ this(new TreeMap<>());
+ }
+
+ protected EMStackMap(NavigableMap<IEMDefinition, T> map) {
+ this.backingMap =map;
+ }
+
+ @Override
+ public NavigableMap<IEMDefinition, T> getBackingMap() {
+ return backingMap;
+ }
+
+ @Override
+ public abstract EMStackMap<T> clone();
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof EMInstanceStackMap) {
+ return compareTo(((EMInstanceStackMap) obj).toDefinitionMapForComparison()) == 0;
+ }
+ if (obj instanceof EMStackMap) {
+ return compareTo((EMStackMap) obj) == 0;
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {//Hash only definitions to compare contents not amounts or data
+ int hash = -(getBackingMap().size() << 4);
+ for (T stack : getBackingMap().values()) {
+ hash += stack.getDefinition().hashCode();
+ }
+ return hash;
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java
index 0491c43ebc..392d06f5cf 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapR.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java
@@ -1,35 +1,44 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import java.lang.reflect.Array;
import java.util.*;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.*;
+import static com.github.technus.tectech.util.DoubleCount.ulpSigned;
-public interface iElementalMapR<T extends iElementalStack> extends Comparable<iElementalMapR<? extends iElementalStack>>, Cloneable {
- NavigableMap<iElementalDefinition,T> getBackingMap();
+public interface IEMMapRead<T extends IEMStack> extends Comparable<IEMMapRead<?>>, Cloneable {
+ static boolean isValidAmount(double amount){
+ return amount>=AVOGADRO_CONSTANT_UNCERTAINTY;
+ }
+
+ static boolean isInvalidAmount(double amount){
+ return amount<AVOGADRO_CONSTANT_UNCERTAINTY;
+ }
- iElementalMapR<T> clone();
+ NavigableMap<IEMDefinition,T> getBackingMap();
- default Set<Map.Entry<iElementalDefinition, T>> entrySet(){
+ IEMMapRead<T> clone();
+
+ default Set<Map.Entry<IEMDefinition, T>> entrySet(){
return getBackingMap().entrySet();
}
- default Set<iElementalDefinition> keySet(){
+ default Set<IEMDefinition> keySet(){
return getBackingMap().keySet();
}
- default iElementalDefinition[] keySetToArray() {
- return keySetToArray(new iElementalDefinition[size()]);
+ default IEMDefinition[] keySetToArray() {
+ return keySetToArray(new IEMDefinition[size()]);
}
- default iElementalDefinition[] keySetToArray(iElementalDefinition[] array) {
- return getBackingMap().keySet().toArray(array);
+ default IEMDefinition[] keySetToArray(IEMDefinition[] array) {
+ return keySet().toArray(array);
}
default Collection<T> values(){
@@ -42,7 +51,7 @@ public interface iElementalMapR<T extends iElementalStack> extends Comparable<iE
}
default T[] valuesToArray(T[] array){
- return getBackingMap().values().toArray(array);
+ return values().toArray(array);
}
Class<T> getType();
@@ -56,7 +65,11 @@ public interface iElementalMapR<T extends iElementalStack> extends Comparable<iE
return getBackingMap().lastEntry().getValue();
}
- default T get(iElementalDefinition def) {
+ default T get(IEMStack stack) {
+ return get(stack.getDefinition());
+ }
+
+ default T get(IEMDefinition def) {
return getBackingMap().get(def);
}
@@ -64,7 +77,7 @@ public interface iElementalMapR<T extends iElementalStack> extends Comparable<iE
if(pos<0 || pos>=size()){
throw new IndexOutOfBoundsException("Index was: "+pos+" size was: "+size());
}
- for (Map.Entry<iElementalDefinition, T> entry : entrySet()) {
+ for (Map.Entry<IEMDefinition, T> entry : entrySet()) {
if(pos==0){
return entry.getValue();
}
@@ -90,7 +103,7 @@ public interface iElementalMapR<T extends iElementalStack> extends Comparable<iE
String[] info = new String[size() * 3];
int i = 0;
for (T defStack : values()) {
- info[i] = EnumChatFormatting.BLUE + defStack.getDefinition().getName();
+ info[i] = EnumChatFormatting.BLUE + defStack.getDefinition().getLocalizedName();
info[i + 1] = EnumChatFormatting.AQUA + defStack.getDefinition().getSymbol();
info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.getAmount()/AVOGADRO_CONSTANT;
i += 3;
@@ -130,14 +143,14 @@ public interface iElementalMapR<T extends iElementalStack> extends Comparable<iE
}
@Override
- default int compareTo(iElementalMapR<? extends iElementalStack> o) {//this actually compares rest
+ default int compareTo(IEMMapRead<? extends IEMStack> o) {//this actually compares rest
int sizeDiff = size() - o.size();
if (sizeDiff != 0) {
return sizeDiff;
}
- Iterator<T> iterator = values().iterator();
- Iterator<? extends iElementalStack> iteratorO = o.values().iterator();
+ Iterator<T> iterator = values().iterator();
+ Iterator<? extends IEMStack> iteratorO = o.values().iterator();
while (iterator.hasNext()) {
int result = iterator.next().compareTo(iteratorO.next());
@@ -150,7 +163,7 @@ public interface iElementalMapR<T extends iElementalStack> extends Comparable<iE
default double getMass(){
double mass=0;
- for (Map.Entry<iElementalDefinition, T> entry : getBackingMap().entrySet()) {
+ for (Map.Entry<IEMDefinition, T> entry : entrySet()) {
mass+=entry.getValue().getMass();
}
return mass;
@@ -158,21 +171,96 @@ public interface iElementalMapR<T extends iElementalStack> extends Comparable<iE
default long getCharge(){
long charge=0;
- for (Map.Entry<iElementalDefinition, T> entry : getBackingMap().entrySet()) {
+ for (Map.Entry<IEMDefinition, T> entry : entrySet()) {
charge+=entry.getValue().getCharge();
}
return charge;
}
//Tests
- default boolean containsKey(iElementalDefinition def) {
+ default boolean containsKey(IEMDefinition def) {
return getBackingMap().containsKey(def);
}
- default boolean containsKey(iElementalStack def) {
+ default boolean containsKey(IEMStack def) {
return containsKey(def.getDefinition());
}
+ default boolean containsAllKeys(IEMDefinition... definitions) {
+ for (IEMDefinition def : definitions) {
+ if (!containsKey(def)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ default boolean containsAllKeys(IEMStack... hasElementalDefinition) {
+ for (IEMStack has : hasElementalDefinition) {
+ if (!containsKey(has)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ default boolean containsAmountExact(IEMDefinition def, double amount) {
+ T target = getBackingMap().get(def);
+ return target != null && target.getAmount() >= amount;
+ }
+
+ default boolean containsAmountExact(IEMStack stack) {
+ return containsAmountExact(stack.getDefinition(),stack.getAmount());
+ }
+
+ default boolean containsAllAmountsExact(IEMStack... stacks) {
+ for (IEMStack stack : stacks) {
+ if(!containsAmountExact(stack)){
+ return false;
+ }
+ }
+ return true;
+ }
+
+ default boolean containsAllAmountsExact(IEMMapRead<? extends IEMStack> container) {
+ for (Map.Entry<IEMDefinition, ? extends IEMStack> entry : container.entrySet()) {
+ if(!containsAmountExact(entry.getValue())){
+ return false;
+ }
+ }
+ return true;
+ }
+
+ default boolean containsAmount(IEMDefinition def, double amountToConsume) {
+ double amountRequired=amountToConsume-AVOGADRO_CONSTANT_EPSILON;
+ if(amountRequired==amountToConsume){
+ amountRequired-=ulpSigned(amountRequired);
+ }
+ return containsAmountExact(def,amountRequired);
+ }
+
+ default boolean containsAmount(IEMStack stack) {
+ return containsAmount(stack.getDefinition(),stack.getAmount());
+ }
+
+ default boolean containsAllAmounts(IEMStack... stacks) {
+ for (IEMStack stack : stacks) {
+ if(!containsAmount(stack)){
+ return false;
+ }
+ }
+ return true;
+ }
+
+ default boolean containsAllAmounts(IEMMapRead<? extends IEMStack> container) {
+ for (Map.Entry<IEMDefinition, ? extends IEMStack> entry : container.entrySet()) {
+ if(!containsAmount(entry.getValue())){
+ return false;
+ }
+ }
+ return true;
+ }
+
default int size() {
return getBackingMap().size();
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java
new file mode 100644
index 0000000000..cc22267474
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java
@@ -0,0 +1,112 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo;
+
+import java.util.Map;
+
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_EPSILON;
+import static com.github.technus.tectech.util.DoubleCount.*;
+
+public interface IEMMapWrite<T extends IEMStack> extends IEMMapWriteExact<T> {
+ IEMMapWrite<T> clone();
+
+ /**
+ * Consumes amount from map
+ * @param def def to consume
+ * @param amountToConsume should be comparable to {@link EMTransformationInfo#AVOGADRO_CONSTANT}
+ * @return consumed successfully
+ */
+ default boolean removeAmount(IEMDefinition def, double amountToConsume){
+ double amountRequired=amountToConsume-AVOGADRO_CONSTANT_EPSILON;
+ if(amountRequired==amountToConsume){
+ amountRequired-=ulpSigned(amountRequired);
+ }
+ return removeAmount(def,amountToConsume,amountRequired);
+ }
+
+ default boolean removeAmount(IEMDefinition def, double amountToConsume, double amountRequired){
+ T current=getBackingMap().get(def);
+ if(current!=null){
+ if(current.getAmount()>=amountRequired){
+ double newAmount=sub(current.getAmount(),amountToConsume);
+ if(IEMMapRead.isValidAmount(current.getAmount())){
+ current=(T)current.mutateAmount(newAmount);
+ getBackingMap().put(current.getDefinition(),current);
+ }else {
+ getBackingMap().remove(current.getDefinition());
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ default boolean removeAmount(IEMStack stack) {
+ return removeAmount(stack.getDefinition(),stack.getAmount());
+ }
+
+ default boolean removeAllAmounts(IEMStack... stacks) {
+ boolean test = true;
+ for (IEMStack stack : stacks) {
+ test &= containsAmount(stack);
+ }
+ if (!test) {
+ return test;
+ }
+ for (IEMStack stack : stacks) {
+ removeAmount(stack);
+ }
+ return true;
+ }
+
+ default boolean removeAllAmounts(IEMMapRead<? extends IEMStack> map) {
+ boolean test=true;
+ for (Map.Entry<IEMDefinition, ? extends IEMStack> entry : map.entrySet()) {
+ test &= containsAmount(entry.getValue());
+ }
+ if (!test) {
+ return test;
+ }
+ for (Map.Entry<IEMDefinition, ? extends IEMStack> entry : map.entrySet()) {
+ removeAmount(entry.getValue());
+ }
+ return true;
+ }
+
+ //Put unify
+ /**
+ *
+ * @param stack thing to put
+ * @return new mapping or null if merging actually removed stuff
+ */
+ default T putUnify(T stack) {
+ T target=getBackingMap().get(stack.getDefinition());
+ if(target==null) {
+ putReplace(stack);
+ return stack;
+ }
+ double newAmount = add(target.getAmount(), stack.getAmount());
+ if (IEMMapRead.isValidAmount(newAmount)) {
+ stack=(T) target.mutateAmount(newAmount);
+ putReplace(stack);
+ return stack;
+ }else {
+ removeKey(stack);
+ return null;
+ }
+ }
+
+ default void putUnifyAll(T... defs) {
+ for (T def : defs) {
+ putUnify(def);
+ }
+ }
+
+ default void putUnifyAll(IEMMapRead<T> inTreeUnsafe) {
+ for (T in : inTreeUnsafe.values()) {
+ putUnify(in);
+ }
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java
new file mode 100644
index 0000000000..7b8853a2f4
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java
@@ -0,0 +1,166 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
+
+import java.util.Map;
+
+public interface IEMMapWriteExact<T extends IEMStack> extends IEMMapRead<T> {
+ default void cleanUp(){
+ entrySet().removeIf(entry -> IEMMapRead.isInvalidAmount(entry.getValue().getAmount()));
+ }
+
+ default void clear() {
+ getBackingMap().clear();
+ }
+
+ IEMMapWriteExact<T> clone();
+
+ //Remove
+ default T removeKey(IEMDefinition def) {
+ return getBackingMap().remove(def);
+ }
+
+ default T removeKey(IEMStack has) {
+ return removeKey(has.getDefinition());
+ }
+
+ default boolean removeKeys(IEMDefinition... definitions) {
+ boolean hadAll=true;
+ for (IEMDefinition def : definitions) {
+ hadAll&=removeKey(def)!=null;
+ }
+ return hadAll;
+ }
+
+ default boolean removeKeys(IEMStack... hasElementalDefinition) {
+ boolean hadAll=true;
+ for (IEMStack has : hasElementalDefinition) {
+ hadAll&=removeKey(has)!=null;
+ }
+ return hadAll;
+ }
+
+ default boolean removeAllKeys(IEMDefinition... definitions) {
+ boolean hadAll=containsAllKeys(definitions);
+ if(hadAll){
+ for (IEMDefinition def : definitions) {
+ removeKey(def);
+ }
+ }
+ return hadAll;
+ }
+
+ default boolean removeAllKeys(IEMStack... hasElementalDefinition) {
+ boolean hadAll=containsAllKeys(hasElementalDefinition);
+ if(hadAll){
+ for (IEMStack stack : hasElementalDefinition) {
+ removeKey(stack);
+ }
+ }
+ return hadAll;
+ }
+
+ default void putReplace(T defStackUnsafe) {
+ getBackingMap().put(defStackUnsafe.getDefinition(), defStackUnsafe);
+ }
+
+ default void putReplaceAll(T... defStacksUnsafe) {
+ for (T defStack : defStacksUnsafe) {
+ putReplace(defStack);
+ }
+ }
+
+ default void putReplaceAll(IEMMapRead<T> inContainerUnsafe) {
+ getBackingMap().putAll(inContainerUnsafe.getBackingMap());
+ }
+
+ /**
+ * Should only be used when modifying definitions to alter the integer count correctly
+ * @param def
+ * @return
+ */
+ default boolean removeAmountExact(IEMStack def){
+ return removeAmountExact(def.getDefinition(),def.getAmount());
+ }
+
+ /**
+ * Should only be used when modifying definitions to alter the integer count correctly
+ * @param def
+ * @param amountToConsume
+ * @return
+ */
+ default boolean removeAmountExact(IEMDefinition def, double amountToConsume){
+ T current=getBackingMap().get(def);
+ if(current!=null){
+ double newAmount=current.getAmount()-amountToConsume;
+ if(newAmount>=0){
+ if(IEMMapRead.isValidAmount(current.getAmount())){
+ current=(T)current.mutateAmount(newAmount);
+ getBackingMap().put(current.getDefinition(),current);
+ } else {
+ getBackingMap().remove(current.getDefinition());
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ default boolean removeAllAmountsExact(IEMStack... stacks) {
+ boolean test = true;
+ for (IEMStack stack : stacks) {
+ test &= containsAmountExact(stack);
+ }
+ if (!test) {
+ return test;
+ }
+ for (IEMStack stack : stacks) {
+ removeAmountExact(stack);
+ }
+ return true;
+ }
+
+ default boolean removeAllAmountsExact(IEMMapRead<? extends IEMStack> map) {
+ boolean test=true;
+ for (Map.Entry<IEMDefinition, ? extends IEMStack> entry : map.entrySet()) {
+ test &= containsAmountExact(entry.getValue());
+ }
+ if (!test) {
+ return test;
+ }
+ for (Map.Entry<IEMDefinition, ? extends IEMStack> entry : map.entrySet()) {
+ removeAmountExact(entry.getValue());
+ }
+ return true;
+ }
+
+ default T putUnifyExact(T stack) {
+ T target=getBackingMap().get(stack.getDefinition());
+ if(target==null) {
+ putReplace(stack);
+ return stack;
+ }
+ double newAmount = target.getAmount()+stack.getAmount();
+ if (IEMMapRead.isValidAmount(newAmount)) {
+ stack=(T) target.mutateAmount(newAmount);
+ putReplace(stack);
+ return stack;
+ }else {
+ removeKey(stack);
+ return null;
+ }
+ }
+
+ default void putUnifyAllExact(T... defs) {
+ for (T def : defs) {
+ putUnifyExact(def);
+ }
+ }
+
+ default void putUnifyAllExact(IEMMapRead<T> inTreeUnsafe) {
+ for (T in : inTreeUnsafe.values()) {
+ putUnifyExact(in);
+ }
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java
deleted file mode 100644
index cde1d55561..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalConstantStackMap.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
-import net.minecraft.nbt.NBTTagCompound;
-
-import java.util.Collections;
-import java.util.NavigableMap;
-import java.util.TreeMap;
-
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__;
-
-/**
- * Created by Tec on 12.05.2017.
- */
-public final class cElementalConstantStackMap/*IMMUTABLE*/ extends cElementalStackMap<cElementalDefinitionStack> {//Target class for construction of definitions/recipes
- //Constructors + Clone, all make a whole new OBJ.
- public static final cElementalConstantStackMap EMPTY = new cElementalConstantStackMap();
-
- private cElementalConstantStackMap() {
- super(Collections.emptyNavigableMap());
- }
-
- public cElementalConstantStackMap(cElementalDefinitionStack... in) {
- this(new cElementalDefinitionStackMap(in).map);
- }
-
- public cElementalConstantStackMap(NavigableMap<iElementalDefinition, cElementalDefinitionStack> in) {
- super(Collections.unmodifiableNavigableMap(in));
- }
-
- @Override
- public Class<cElementalDefinitionStack> getType() {
- return cElementalDefinitionStack.class;
- }
-
- //IMMUTABLE DON'T NEED IT
- @Override
- public cElementalConstantStackMap clone() {
- return this;
- }
-
- public cElementalDefinitionStackMap toMutable() {
- return new cElementalDefinitionStackMap(new TreeMap<>(map));
- }
-
- public static cElementalConstantStackMap fromNBT(NBTTagCompound nbt) throws tElementalException {
- cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")];
- for (int i = 0; i < defStacks.length; i++) {
- defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i)));
- if (defStacks[i].definition.equals(nbtE__)) {
- throw new tElementalException("Something went Wrong");
- }
- }
- return new cElementalConstantStackMap(defStacks);
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java
deleted file mode 100644
index 1273119bb3..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalDefinitionStackMap.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
-import net.minecraft.nbt.NBTTagCompound;
-
-import java.util.NavigableMap;
-import java.util.TreeMap;
-
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__;
-
-/**
- * Created by danie_000 on 22.01.2017.
- */
-public final class cElementalDefinitionStackMap extends cElementalStackMap<cElementalDefinitionStack> implements iElementalMapRW<cElementalDefinitionStack> {//Transient class for construction of definitions/recipes
- //Constructors + Clone, all make a whole new OBJ.
- public cElementalDefinitionStackMap() {}
-
- public cElementalDefinitionStackMap(cElementalDefinitionStack... in) {
- putUnifyAll(in);
- }
-
- public cElementalDefinitionStackMap(NavigableMap<iElementalDefinition, cElementalDefinitionStack> in) {
- super(in);
- }
-
- @Override
- public Class<cElementalDefinitionStack> getType() {
- return cElementalDefinitionStack.class;
- }
-
- @Override
- public cElementalDefinitionStackMap clone() {
- return new cElementalDefinitionStackMap(new TreeMap<>(map));
- }
-
- public cElementalConstantStackMap toImmutable() {
- return new cElementalConstantStackMap(new TreeMap<>(map));
- }
-
- public cElementalConstantStackMap toImmutable_optimized_unsafe_LeavesExposedElementalTree() {
- return new cElementalConstantStackMap(map);
- }
-
- public static cElementalDefinitionStackMap fromNBT(NBTTagCompound nbt) throws tElementalException {
- cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")];
- for (int i = 0; i < defStacks.length; i++) {
- defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i)));
- if (defStacks[i].definition.equals(nbtE__)) {
- throw new tElementalException("Something went Wrong");
- }
- }
- return new cElementalDefinitionStackMap(defStacks);
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java
deleted file mode 100644
index aab1f93990..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalInstanceStackMap.java
+++ /dev/null
@@ -1,214 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecayResult;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-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 net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.EnumChatFormatting;
-
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.NavigableMap;
-import java.util.TreeMap;
-
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__;
-import static com.github.technus.tectech.util.DoubleCount.add;
-
-/**
- * Created by danie_000 on 22.01.2017.
- */
-public final class cElementalInstanceStackMap extends cElementalStackMap<cElementalInstanceStack> implements iElementalMapRW<cElementalInstanceStack> {
- //Constructors
- public cElementalInstanceStackMap() {}
-
- public cElementalInstanceStackMap(cElementalInstanceStack... inSafe) {
- this(true, inSafe);
- }
-
- public cElementalInstanceStackMap(boolean clone, cElementalInstanceStack... in) {
- if (clone) {
- cElementalInstanceStack[] stacks=new cElementalInstanceStack[in.length];
- for(int i=0;i<stacks.length;i++) {
- stacks[i] = in[i].clone();
- }
- putUnifyAll(stacks);
- } else {
- putUnifyAll(in);
- }
- }
-
- private cElementalInstanceStackMap(NavigableMap<iElementalDefinition, cElementalInstanceStack> inSafe) {
- this(true, inSafe);
- }
-
- private cElementalInstanceStackMap(boolean clone, NavigableMap<iElementalDefinition, cElementalInstanceStack> in) {
- if (clone) {
- map = new TreeMap<>();
- for(cElementalInstanceStack stack:in.values()) {
- putUnify(stack.clone());
- }
- } else {
- map = in;
- }
- }
-
- @Override
- public Class<cElementalInstanceStack> getType() {
- return cElementalInstanceStack.class;
- }
-
- @Override
- public cElementalInstanceStackMap clone() {
- return new cElementalInstanceStackMap(map);
- }
-
- //Remove overflow
- public double removeOverflow(int stacksCount, double stackCapacity) {
- double massRemoved = 0;
-
- if (map.size() > stacksCount) {
- iElementalDefinition[] keys = keySetToArray();
- for (int i = stacksCount; i < keys.length; i++) {
- massRemoved += map.get(keys[i]).getDefinitionStack().getMass();
- map.remove(keys[i]);
- }
- }
-
- for (cElementalInstanceStack instance : valuesToArray()) {
- if (instance.amount > stackCapacity) {
- massRemoved += instance.definition.getMass() * (instance.amount - stackCapacity);
- instance.amount = stackCapacity;
- }
- }
- return massRemoved;
- }
-
- //Getters
- public String[] getElementalInfo() {
- String[] info = new String[map.size()];
- int i = 0;
- for (cElementalInstanceStack instance : map.values()) {
- info[i++] = EnumChatFormatting.BLUE + instance.definition.getName()+
- " "+ EnumChatFormatting.AQUA + instance.definition.getSymbol()+ EnumChatFormatting.RESET+
- " #: " + EnumChatFormatting.GREEN + String.format("%.3E",instance.amount/ AVOGADRO_CONSTANT) +" mol"+ EnumChatFormatting.RESET+
- " E: " + EnumChatFormatting.GREEN + instance.getEnergy() + EnumChatFormatting.RESET+
- " T: " + EnumChatFormatting.GREEN + (instance.getLifeTime()<0?"STABLE":String.format("%.3E",instance.getLifeTime()));
- }
- return info;
- }
-
- public ArrayList<String> getScanShortSymbols(int[] capabilities) {
- ArrayList<String> list=new ArrayList<>(16);
- for(Map.Entry<iElementalDefinition,cElementalInstanceStack> e:map.entrySet()){
- e.getValue().addScanShortSymbols(list,capabilities);
- }
- return list;
- }
-
- 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;
- }
-
- //Tick Content
- public double tickContentByOneSecond(double lifeTimeMult, int postEnergize) {
- return tickContent(lifeTimeMult,postEnergize,1D);
- }
-
- public double tickContent(double lifeTimeMult, int postEnergize, double seconds){
- cleanUp();
- double diff=0;
- for (cElementalInstanceStack instance : valuesToArray()) {
- cElementalDecayResult newInstances = instance.decay(lifeTimeMult, instance.age += seconds, postEnergize);
- if (newInstances == null) {
- instance.nextColor();
- } else {
- diff=add(diff,newInstances.getMassDiff());
- removeAmount(false,instance);
- putUnifyAll(newInstances.getOutput());
- }
- }
- return diff;
- }
-
- //NBT
- public NBTTagCompound getScanShortSymbolsNBT(int[] capabilities) {
- NBTTagCompound nbt = new NBTTagCompound();
- ArrayList<String> info = getScanShortSymbols(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 getScanInfoNBT(int[] capabilities) {
- NBTTagCompound nbt = new NBTTagCompound();
- 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 static cElementalInstanceStackMap fromNBT(NBTTagCompound nbt) throws tElementalException {
- cElementalInstanceStack[] instances = new cElementalInstanceStack[nbt.getInteger("i")];
- for (int i = 0; i < instances.length; i++) {
- instances[i] = cElementalInstanceStack.fromNBT(nbt.getCompoundTag(Integer.toString(i)));
- if (instances[i].definition.equals(nbtE__)) {
- throw new tElementalException("Something went Wrong");
- }
- }
- return new cElementalInstanceStackMap(false, instances);
- }
-
- //stackUp
- public static cElementalInstanceStack[] stackUp(cElementalInstanceStack... in) {
- cElementalInstanceStackMap inTree = new cElementalInstanceStackMap();
- inTree.putUnifyAll(in);
- return inTree.valuesToArray();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof cElementalInstanceStackMap) {
- return compareTo((cElementalInstanceStackMap) obj) == 0;
- }
- if (obj instanceof cElementalStackMap) {
- return toDefinitionMapForComparison().compareTo((cElementalStackMap) obj) == 0;
- }
- return false;
- }
-
- @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();
- }
-
- public cElementalInstanceStackMap takeAll(){
- cElementalInstanceStackMap newStack=new cElementalInstanceStackMap(false,new TreeMap<>(this.map));//just in case to uncouple The map
- this.map.clear();
- return newStack;
- }
-
- public cElementalDefinitionStackMap toDefinitionMapForComparison() {
- cElementalDefinitionStack[] list = new cElementalDefinitionStack[size()];
- int i = 0;
- for (Map.Entry<iElementalDefinition, cElementalInstanceStack> entry : entrySet()) {
- cElementalInstanceStack value = entry.getValue();
- list[i++] = new cElementalDefinitionStack(value.getDefinition(), value.getAmount());
- }
- return new cElementalDefinitionStackMap(list);
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java
deleted file mode 100644
index 2b144df128..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/cElementalStackMap.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
-
-import java.util.NavigableMap;
-import java.util.TreeMap;
-
-/**
- * Created by Tec on 12.05.2017.
- */
-abstract class cElementalStackMap<T extends iElementalStack> implements iElementalMapR<T> {
- protected NavigableMap<iElementalDefinition, T> map;
-
- protected cElementalStackMap() {
- this(new TreeMap<>());
- }
-
- protected cElementalStackMap(NavigableMap<iElementalDefinition, T> map) {
- this.map = map;
- }
-
- @Override
- public NavigableMap<iElementalDefinition, T> getBackingMap() {
- return map;
- }
-
- @Override
- public abstract cElementalStackMap<T> clone();
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof cElementalInstanceStackMap) {
- return compareTo(((cElementalInstanceStackMap) obj).toDefinitionMapForComparison()) == 0;
- }
- if (obj instanceof cElementalStackMap) {
- return compareTo((cElementalStackMap) obj) == 0;
- }
- return false;
- }
-
- @Override
- public int hashCode() {//Hash only definitions to compare contents not amounts or data
- int hash = -(map.size() << 4);
- for (T stack : map.values()) {
- hash += stack.getDefinition().hashCode();
- }
- return hash;
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java
deleted file mode 100644
index 7f8d314858..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/iElementalMapRW.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
-
-import java.util.Map;
-
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY;
-import static com.github.technus.tectech.util.DoubleCount.sub;
-
-public interface iElementalMapRW<T extends iElementalStack> extends iElementalMapR<T> {
- iElementalMapRW<T> clone();
-
- default void cleanUp(){
- getBackingMap().entrySet().removeIf(entry -> entry.getValue().getAmount() < AVOGADRO_CONSTANT_UNCERTAINTY);
- }
-
- default void clear() {
- getBackingMap().clear();
- }
-
- //Remove
- default T remove(iElementalDefinition def) {
- return getBackingMap().remove(def);
- }
-
- default T remove(iElementalStack has) {
- return remove(has.getDefinition());
- }
-
- default void removeAll(iElementalDefinition... definitions) {
- for (iElementalDefinition def : definitions) {
- getBackingMap().remove(def);
- }
- }
-
- default void removeAll(iElementalStack... hasElementalDefinition) {
- for (iElementalStack has : hasElementalDefinition) {
- getBackingMap().remove(has.getDefinition());
- }
- }
-
- default boolean removeAmount(boolean testOnly, iElementalStack stack) {
- return removeAmount(testOnly,stack.getDefinition(),stack.getAmount());
- }
-
- default boolean removeAmount(boolean testOnly, iElementalDefinition def,double amount) {
- T target = getBackingMap().get(def);
- if (target == null) {
- return false;
- }
- if (testOnly) {
- return target.getAmount() >= amount;
- } else {
- double newAmount = sub(target.getAmount(),amount);
- if (newAmount > 0) {
- getBackingMap().put(target.getDefinition(), (T)target.mutateAmount(newAmount));
- return true;
- } else if (newAmount == 0) {
- getBackingMap().remove(def);
- return true;
- }
- }
- return false;
- }
-
- default boolean removeAllAmounts(boolean testOnly, iElementalStack... stacks) {
- boolean test = true;
- for (iElementalStack stack : stacks) {
- test &= removeAmount(true, stack);
- }
- if (testOnly || !test) {
- return test;
- }
- for (iElementalStack stack : stacks) {
- removeAmount(false, stack);
- }
- return true;
- }
-
- default boolean removeAllAmounts(boolean testOnly, iElementalMapR<? extends iElementalStack> container) {
- boolean test=true;
- for (Map.Entry<iElementalDefinition, ? extends iElementalStack> entry : container.entrySet()) {
- test &= removeAmount(true, entry.getValue());
- }
- if (testOnly || !test) {
- return test;
- }
- for (Map.Entry<iElementalDefinition, ? extends iElementalStack> entry : container.entrySet()) {
- removeAmount(false, entry.getValue());
- }
- return true;
- }
-
- //Put replace
- default T putReplace(T defStackUnsafe) {
- return getBackingMap().put(defStackUnsafe.getDefinition(), defStackUnsafe);
- }
-
- default void putReplaceAll(T... defStacks) {
- for (T defStack : defStacks) {
- getBackingMap().put(defStack.getDefinition(), defStack);
- }
- }
-
- default void putReplaceAll(iElementalMapR<T> inContainerUnsafe) {
- getBackingMap().putAll(inContainerUnsafe.getBackingMap());
- }
-
- //Put unify
- default T putUnify(T def) {
- T stack=getBackingMap().get(def.getDefinition());
- if(stack==null) {
- return getBackingMap().put(def.getDefinition(), def);
- }
- return getBackingMap().put(def.getDefinition(), (T)stack.mutateAmount(def.getAmount()+stack.getAmount()));
- }
-
- default void putUnifyAll(T... defs) {
- for (T def : defs) {
- putUnify(def);
- }
- }
-
- default void putUnifyAll(iElementalMapR<T> inTreeUnsafe) {
- for (T in : inTreeUnsafe.values()) {
- putUnify(in);
- }
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java
new file mode 100644
index 0000000000..4b0792eac9
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java
@@ -0,0 +1,87 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.recipes;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.IEMMapRead;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+/**
+ * Created by Tec on 02.03.2017.
+ */
+public class EMRecipe<T> implements Comparable<EMRecipe<T>> {
+ private final int ID;
+ private final EMConstantStackMap inEM;
+ private final IEMMapRead<? extends IEMStack> outEM;
+ private final ItemStack[] outItems;
+ private final FluidStack[] outFluids;
+ private T extension;
+
+ public EMRecipe(
+ EMConstantStackMap inEM,//not null plz
+ int id,
+ IEMMapRead<? extends IEMStack> outEM,
+ ItemStack[] outItems,
+ FluidStack[] outFluids) {
+ this.inEM = inEM;
+ this.outEM = outEM;
+ this.outItems = outItems;
+ this.outFluids = outFluids;
+ ID = id;//allows multiple recipes with the same input EM,so u can actually extend...
+ }
+
+ public EMRecipe<T> extend(T data) {
+ setExtension(data);
+ return this;
+ }
+
+ @Override
+ public int compareTo(EMRecipe<T> o) {
+ int compare = getInEM().compareTo(o.getInEM());
+ if(compare!=0) {
+ return compare;
+ }
+ return Integer.compare(getID(), o.getID());
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof EMRecipe) {
+ return compareTo((EMRecipe) obj) == 0;
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return getInEM().hashCode();
+ }
+
+ public int getID() {
+ return ID;
+ }
+
+ public EMConstantStackMap getInEM() {
+ return inEM;
+ }
+
+ public IEMMapRead<? extends IEMStack> getOutEM() {
+ return outEM;
+ }
+
+ public ItemStack[] getOutItems() {
+ return outItems;
+ }
+
+ public FluidStack[] getOutFluids() {
+ return outFluids;
+ }
+
+ public T getExtension() {
+ return extension;
+ }
+
+ public void setExtension(T extension) {
+ this.extension = extension;
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java
new file mode 100644
index 0000000000..811a9bc370
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java
@@ -0,0 +1,65 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.recipes;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.*;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by Tec on 02.03.2017.
+ */
+public class EMRecipeMap<T> {//TODO FIX
+ //Multimap for multiple recipes from the same thing - you know parameters might differ the output
+ private final Map<EMConstantStackMap, Map<Integer, EMRecipe<T>>> recipes;
+
+ public EMRecipeMap() {
+ recipes = new HashMap<>();
+ }
+
+ public EMRecipe<T> put(EMRecipe<T> in) {
+ Map<Integer, EMRecipe<T>> r = getRecipes().computeIfAbsent(in.getInEM(), k -> new HashMap<>());
+ return r.put(in.getID(), in);//IF THIS RETURN SHIT, it means that inputs are using the exact same types of matter as input - (non amount wise collision)
+ //It is either bad, or unimportant if you use different id's
+ }
+
+ public void putAll(EMRecipe<T>... contents) {
+ for (EMRecipe<T> recipe : contents) {
+ put(recipe);
+ }
+ }
+
+ public EMRecipe<T> remove(IEMMapRead<EMDefinitionStack> map, int id) {
+ Map<Integer, EMRecipe<T>> recipesMap = getRecipes().get(map);
+ return recipesMap != null ? recipesMap.remove(id) : null;//todo check, suspicious but ok, equals and hashcode methods are adjusted for that
+ }
+
+ public Map<Integer, EMRecipe<T>> remove(IEMMapRead<EMDefinitionStack> map) {
+ return getRecipes().remove(map);//todo check, suspicious but ok, equals and hashcode methods are adjusted for that
+ }
+
+ //Recipe founding should not check amounts - this checks if the types of matter in map are equal to any recipe!
+ //Return a recipeShortMap when the content of input is equal (ignoring amounts and instance data)
+ @Deprecated
+ public Map<Integer, EMRecipe<T>> findExact(IEMMapRead<? extends IEMStack> in) {
+ return getRecipes().get(in);//suspicious but ok, equals and hashcode methods are adjusted for that
+ }
+
+ //this does check if the map contains all the requirements for any recipe, and the required amounts
+ //Return a recipeShortMap when the content of input matches the recipe input - does not ignore amounts but ignores instance data!
+ public Map<Integer, EMRecipe<T>> findMatch(IEMMapRead<? extends IEMStack> in) {
+ for (Map.Entry<EMConstantStackMap, Map<Integer, EMRecipe<T>>> cElementalDefinitionStackMapHashMapEntry : getRecipes().entrySet()) {
+ if (in.containsAllAmounts(cElementalDefinitionStackMapHashMapEntry.getKey())) {
+ return cElementalDefinitionStackMapHashMapEntry.getValue();
+ }
+ }
+ return null;
+ }
+
+ public Map<EMConstantStackMap, Map<Integer, EMRecipe<T>>> getRecipes() {
+ return recipes;
+ }
+
+ //To check for instance data and other things use recipe extensions!
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java
deleted file mode 100644
index 8c0fb40a4b..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipe.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.recipes;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.FluidStack;
-
-/**
- * Created by Tec on 02.03.2017.
- */
-public class rElementalRecipe implements Comparable<rElementalRecipe> {
- public final short ID;
- public final cElementalConstantStackMap inEM;
- public final cElementalConstantStackMap outEM;
- public final ItemStack[] outItems;
- public final FluidStack[] outFluids;
- public Object[] extension;
-
- public rElementalRecipe(
- cElementalConstantStackMap inEM,//not null plz
- short id,
- cElementalConstantStackMap outEM,
- ItemStack[] outItems,
- FluidStack[] outFluids) {
- this.inEM = inEM;
- this.outEM = outEM;
- this.outItems = outItems;
- this.outFluids = outFluids;
- ID = id;//allows multiple recipes with the same input EM,so u can actually extend...
- }
-
- public rElementalRecipe extend(Object... data) {
- extension = data;
- return this;
- }
-
- @Override
- public int compareTo(rElementalRecipe o) {
- int compare = inEM.compareTo(o.inEM);
- if(compare!=0) {
- return compare;
- }
- return Short.compare(ID, o.ID);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof rElementalRecipe) {
- return compareTo((rElementalRecipe) obj) == 0;
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return inEM.hashCode();
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java
deleted file mode 100644
index 56a9030354..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/rElementalRecipeMap.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.recipes;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.*;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Created by Tec on 02.03.2017.
- */
-public class rElementalRecipeMap {//TODO FIX
- //Multimap for multiple recipes from the same thing - you know parameters might differ the output
- private final HashMap<cElementalConstantStackMap, HashMap<Short, rElementalRecipe>> recipes;
-
- public rElementalRecipeMap() {
- recipes = new HashMap<>();
- }
-
- public rElementalRecipe put(rElementalRecipe in) {
- HashMap<Short, rElementalRecipe> r = recipes.computeIfAbsent(in.inEM, k -> new HashMap<>());
- return r.put(in.ID, in);//IF THIS RETURN SHIT, it means that inputs are using the exact same types of matter as input - (non amount wise collision)
- //It is either bad, or unimportant if you use different id's
- }
-
- public void putAll(rElementalRecipe... contents) {
- for (rElementalRecipe recipe : contents) {
- put(recipe);
- }
- }
-
- public rElementalRecipe remove(iElementalMapR<cElementalDefinitionStack> map, short id) {
- return recipes.get(map).remove(id);//suspicious but ok, equals and hashcode methods are adjusted for that
- }
-
- public HashMap<Short, rElementalRecipe> remove(iElementalMapR<cElementalDefinitionStack> map) {
- return recipes.remove(map);//suspicious but ok, equals and hashcode methods are adjusted for that
- }
-
- public HashMap<Short, rElementalRecipe> findExact(cElementalInstanceStackMap in) {
- return recipes.get(in.toDefinitionMapForComparison());//suspicious but ok, equals and hashcode methods are adjusted for that
- }
-
- //Recipe founding should not check amounts - this checks if the types of matter in map are equal to any recipe!
- //Return a recipeShortMap when the content of input is equal (ignoring amounts and instance data)
- @Deprecated
- public HashMap<Short, rElementalRecipe> findExact(iElementalMapR<cElementalDefinitionStack> in) {
- return recipes.get(in);//suspicious but ok, equals and hashcode methods are adjusted for that
- }
-
- //this does check if the map contains all the requirements for any recipe, and the required amounts
- //Return a recipeShortMap when the content of input matches the recipe input - does not ignore amounts but ignores instance data!
- @Deprecated
- public HashMap<Short, rElementalRecipe> findMatch(cElementalDefinitionStackMap in, boolean testOnlyTruePreferred) {
- for (Map.Entry<cElementalConstantStackMap, HashMap<Short, rElementalRecipe>> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) {
- if (in.removeAllAmounts(testOnlyTruePreferred, cElementalDefinitionStackMapHashMapEntry.getKey())) {
- return cElementalDefinitionStackMapHashMapEntry.getValue();
- }
- }
- return null;
- }
-
- public HashMap<Short, rElementalRecipe> findMatch(cElementalInstanceStackMap in, boolean testOnly) {
- for (Map.Entry<cElementalConstantStackMap, HashMap<Short, rElementalRecipe>> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) {
- if (in.removeAllAmounts(testOnly, cElementalDefinitionStackMapHashMapEntry.getKey())) {
- return cElementalDefinitionStackMapHashMapEntry.getValue();
- }
- }
- return null;
- }
-
- //To check for instance data and other things use recipe extensions!
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java
new file mode 100644
index 0000000000..fe0c73e795
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java
@@ -0,0 +1,73 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.stacks;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
+import net.minecraft.nbt.NBTTagCompound;
+
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__;
+
+/**
+ * Created by danie_000 on 20.11.2016.
+ */
+public final class EMDefinitionStack implements IEMStack {
+ private final IEMDefinition definition;
+ private final double amount;
+
+ public EMDefinitionStack(IEMDefinition def, double amount) {
+ definition = def == null ? null__ : def;
+ this.amount = amount;
+ }
+
+ @Override
+ public EMDefinitionStack clone() {
+ return this;//IMMUTABLE
+ }
+
+ @Override
+ public EMDefinitionStack mutateAmount(double newAmount) {
+ if(getAmount() == newAmount){
+ return this;
+ }
+ return new EMDefinitionStack(getDefinition(), newAmount);//IMMUTABLE
+ }
+
+ @Override
+ public IEMDefinition getDefinition() {
+ return definition;//IMMUTABLE
+ }
+
+ @Override
+ public double getAmount() {
+ return amount;
+ }
+
+ public NBTTagCompound toNBT() {
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setTag("d", getDefinition().toNBT());
+ nbt.setDouble("Q", getAmount());
+ return nbt;
+ }
+
+ public static EMDefinitionStack fromNBT(NBTTagCompound nbt) {
+ return new EMDefinitionStack(
+ EMComplex.fromNBT(nbt.getCompoundTag("d")),
+ nbt.getLong("q")+nbt.getDouble("Q"));
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof IEMDefinition) {
+ return getDefinition().compareTo((IEMDefinition) obj) == 0;
+ }
+ if (obj instanceof IEMStack) {
+ return getDefinition().compareTo(((IEMStack) obj).getDefinition()) == 0;
+ }
+ return false;
+ }
+
+ //Amount shouldn't be hashed if this is just indicating amount and not structure
+ @Override
+ public int hashCode() {
+ return getDefinition().hashCode();
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java
new file mode 100644
index 0000000000..b73bd21f02
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java
@@ -0,0 +1,605 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.stacks;
+
+import com.github.technus.tectech.TecTech;
+import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
+import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
+import com.github.technus.tectech.util.Util;
+import net.minecraft.client.Minecraft;
+import net.minecraft.crash.CrashReport;
+import net.minecraft.nbt.NBTTagCompound;
+
+import java.util.ArrayList;
+
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.deadEnd;
+import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*;
+import static com.github.technus.tectech.util.DoubleCount.*;
+import static java.lang.Math.*;
+
+/**
+ * Created by danie_000 on 22.10.2016.
+ */
+public final class EMInstanceStack implements IEMStack {
+ public static int MIN_MULTIPLE_DECAY_CALLS = 4, MAX_MULTIPLE_DECAY_CALLS = 16;
+ public static double DECAY_CALL_PER = AVOGADRO_CONSTANT;//todo
+
+ private final IEMDefinition definition;
+ private double amount;
+
+ private double age;
+ //energy - if positive then particle should try to decay
+ private long energy;
+ //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable)
+ private byte color;
+ private double lifeTime;
+ private double lifeTimeMult;
+
+ public EMInstanceStack(IEMStack stackSafe) {
+ this(stackSafe.getDefinition(), stackSafe.getAmount(), 1D, 0D, 0);
+ }
+
+ public EMInstanceStack(IEMStack stackSafe, double lifeTimeMult, double age, long energy) {
+ this(stackSafe.getDefinition(), stackSafe.getAmount(), lifeTimeMult, age, energy);
+ }
+
+ public EMInstanceStack(IEMDefinition defSafe, double amount) {
+ this(defSafe, amount, 1D, 0D, 0);
+ }
+
+ public EMInstanceStack(IEMDefinition defSafe, double amount, double lifeTimeMult, double age, long energy) {
+ definition = defSafe == null ? null__ : defSafe;
+ byte bColor = getDefinition().getColor();
+ if (bColor < 0 || bColor > 2) {//transforms colorable??? into proper color
+ this.color = bColor;
+ } else {
+ this.color = (byte) TecTech.RANDOM.nextInt(3);
+ }
+ this.lifeTimeMult = lifeTimeMult;
+ lifeTime = getDefinition().getRawTimeSpan(energy) * this.lifeTimeMult;
+ setEnergy(energy);
+ this.setAge(age);
+ this.setAmount(amount);
+ }
+
+ //Clone proxy
+ private EMInstanceStack(EMInstanceStack stack) {
+ definition = stack.getDefinition();
+ color = stack.color;
+ setAge(stack.getAge());
+ setAmount(stack.getAmount());
+ lifeTime = stack.lifeTime;
+ lifeTimeMult = stack.lifeTimeMult;
+ energy = stack.energy;
+ }
+
+ @Override
+ public EMInstanceStack clone() {
+ return new EMInstanceStack(this);
+ }
+
+ @Override
+ public EMInstanceStack mutateAmount(double newAmount) {
+ this.setAmount(newAmount);
+ return this;
+ }
+
+ @Override
+ public double getAmount() {
+ return amount;
+ }
+
+ public long getEnergy() {
+ return energy;
+ }
+
+ public void setEnergy(long newEnergyLevel) {
+ energy = newEnergyLevel;
+ setLifeTimeMultiplier(getLifeTimeMultiplier());
+ }
+
+ public double getEnergySettingCost(long currentEnergyLevel, long newEnergyLevel) {
+ return getDefinition().getEnergyDiffBetweenStates(currentEnergyLevel, newEnergyLevel) * getAmount();
+ }
+
+ public double getEnergySettingCost(long newEnergyLevel) {
+ return getEnergySettingCost(energy, newEnergyLevel) * getAmount();
+ }
+
+ public EMDefinitionStack getDefinitionStack() {
+ return new EMDefinitionStack(getDefinition(), getAmount());
+ }
+
+ @Override
+ public IEMDefinition getDefinition() {
+ return definition;
+ }
+
+ public byte getColor() {
+ return color;
+ }
+
+ public void setColor(byte color) {//does not allow changing magic element
+ if (this.color < 0 || this.color > 2 || color < 0 || color >= 3) {
+ return;
+ }
+ this.color = color;
+ }
+
+ public void nextColor() {//does not allow changing magic element
+ if (color < 0 || color > 2) {
+ return;
+ }
+ color = (byte) TecTech.RANDOM.nextInt(3);
+ }
+
+ public double getLifeTime() {
+ return lifeTime;
+ }
+
+ public void setLifeTimeMultiplier(double mult) {
+ if (mult <= 0) //since infinity*0=nan
+ {
+ throw new IllegalArgumentException("multiplier must be >0");
+ }
+ lifeTimeMult = mult;
+ if (getDefinition().getRawTimeSpan(energy) <= 0) {
+ return;
+ }
+ lifeTime = getDefinition().getRawTimeSpan(energy) * lifeTimeMult;
+ }
+
+ public double getLifeTimeMultiplier() {
+ return lifeTimeMult;
+ }
+
+ public EMDecayResult tickStackByOneSecond(double lifeTimeMult, int postEnergize) {
+ return tickStack(lifeTimeMult, postEnergize, 1D);
+ }
+
+ public EMDecayResult tickStack(double lifeTimeMult, int postEnergize, double seconds) {
+ setAge(getAge() + seconds);
+ EMDecayResult newInstances = decay(lifeTimeMult, getAge(), postEnergize);
+ if (newInstances == null) {
+ nextColor();
+ } else {
+ for (EMInstanceStack newInstance : newInstances.getOutput().valuesToArray()) {
+ newInstance.nextColor();
+ }
+ }
+ return newInstances;
+ }
+
+ public EMDecayResult decay() {
+ return decay(1D, getAge(), 0);//try to decay without changes
+ }
+
+ public EMDecayResult decay(double apparentAge, long postEnergize) {
+ return decay(1D, apparentAge, postEnergize);
+ }
+
+ public EMDecayResult decay(double lifeTimeMult, double apparentAge, long postEnergize) {
+ long newEnergyLevel = postEnergize + energy;
+ if (newEnergyLevel > 0) {
+ newEnergyLevel -= 1;
+ } else if (newEnergyLevel < 0) {
+ newEnergyLevel += 1;
+ }
+ EMDecayResult output;
+ if (getDefinition().usesMultipleDecayCalls(energy)) {
+ double amountTemp = getAmount();
+ int decayCnt = (int) min(MAX_MULTIPLE_DECAY_CALLS, max(getAmount() / DECAY_CALL_PER, MIN_MULTIPLE_DECAY_CALLS));
+ setAmount(div(getAmount(), decayCnt));
+ decayCnt--;
+
+ output = decayMechanics(lifeTimeMult, apparentAge, newEnergyLevel);
+ if (output == null) {
+ setAmount(amountTemp);
+ return null;
+ }
+
+ for (int i = 0; i < decayCnt; i++) {
+ EMDecayResult map = decayMechanics(lifeTimeMult, apparentAge, newEnergyLevel);
+ if (map != null) {
+ output.getOutput().putUnifyAll(map.getOutput());
+ output.setMassDiff(add(output.getMassDiff(), map.getMassDiff()));
+ output.setMassAffected(output.getMassDiff() + map.getMassDiff());
+ }
+ }
+ setAmount(amountTemp);
+ } else {
+ output = decayMechanics(lifeTimeMult, apparentAge, newEnergyLevel);
+ }
+ if (output != null) {
+ output.getOutput().cleanUp();
+ }
+ return output;
+ }
+
+ private EMDecayResult decayMechanics(double lifeTimeMult, double apparentAge, long newEnergyLevel) {
+ if (energy > 0 && !getDefinition().usesSpecialEnergeticDecayHandling()) {
+ setLifeTimeMultiplier(getLifeTimeMultiplier());
+ return decayCompute(getDefinition().getEnergyInducedDecay(energy), lifeTimeMult, -1D, newEnergyLevel);
+ } else if (getDefinition().getRawTimeSpan(energy) < 0) {
+ return null;//return null, decay cannot be achieved
+ } else if (getDefinition().isTimeSpanHalfLife()) {
+ return exponentialDecayCompute(energy > 0 ? getDefinition().getEnergyInducedDecay(energy) : getDefinition().getDecayArray(), lifeTimeMult, -1D, newEnergyLevel);
+ } else {
+ if (1 > lifeTime) {
+ return decayCompute(energy > 0 ? getDefinition().getEnergyInducedDecay(energy) : getDefinition().getNaturalDecayInstant(), lifeTimeMult, 0D, newEnergyLevel);
+ } else if (apparentAge > lifeTime) {
+ return decayCompute(energy > 0 ? getDefinition().getEnergyInducedDecay(energy) : getDefinition().getDecayArray(), lifeTimeMult, 0D, newEnergyLevel);
+ }
+ }
+ return null;//return null since decay cannot be achieved
+ }
+
+ //Use to get direct decay output providing correct decay array
+ private EMDecayResult exponentialDecayCompute(EMDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) {
+ double newAmount = div(getAmount(), Math.pow(2D, 1D/* 1 second */ / lifeTime));
+
+ //if(definition.getSymbol().startsWith("U ")) {
+ // System.out.println("newAmount = " + newAmount);
+ // System.out.println("amountRemaining = " + amountRemaining);
+ // for(cElementalDecay decay:decays){
+ // System.out.println("prob = "+decay.probability);
+ // for(cElementalDefinitionStack stack:decay.outputStacks.values()){
+ // System.out.println("stack = " + stack.getDefinition().getSymbol() + " " + stack.amount);
+ // }
+ // }
+ //}
+ if (newAmount == getAmount()) {
+ newAmount -= ulpSigned(newAmount);
+ } else if (newAmount < 1) {
+ return decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel);
+ }
+
+ //split to non decaying and decaying part
+ double amount = this.getAmount();
+ this.setAmount(this.getAmount() - newAmount);
+ EMDecayResult products = decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel);
+ this.setAmount(newAmount);
+ if (products != null) {
+ products.getOutput().putUnify(clone());
+ }
+ this.setAmount(amount);
+ return products;
+ }
+
+ //Use to get direct decay output providing correct decay array
+ private EMDecayResult decayCompute(EMDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) {
+ if (decays == null) {
+ return null;//Can not decay so it won't
+ }
+ boolean makesEnergy = getDefinition().decayMakesEnergy(energy);
+ double mass = getMass();
+ if (decays.length == 0) {
+ return makesEnergy ? null : new EMDecayResult(new EMInstanceStackMap(), mass, 0);
+ //provide non null 0 length array for annihilation
+ } else if (decays.length == 1) {//only one type of decay :D, doesn't need dead end
+ if (decays[0] == deadEnd) {
+ return makesEnergy ? null : new EMDecayResult(decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, getAmount()), mass, 0);
+ }
+ EMInstanceStackMap output = decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, getAmount());
+ if (newProductsAge < 0) {
+ if (output.size() == 1) {
+ if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) {
+ output.getFirst().setEnergy(energy);
+ output.getFirst().setAge(getAge());
+ }
+ } else {
+ for (EMInstanceStack stack : output.valuesToArray()) {
+ if (stack.getDefinition().equals(getDefinition())) {
+ stack.setAge(getAge());
+ }
+ }
+ }
+ } else {
+ if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) {
+ output.getFirst().setEnergy(energy);
+ }
+ }
+ if (energy <= 0 && output.getMass() > mass) {
+ return null;//no energy usage to decay
+ }
+ return new EMDecayResult(new EMInstanceStackMap(), mass, makesEnergy ? output.getMass() - mass : 0);
+ } else {
+ EMDecayResult totalOutput = new EMDecayResult(new EMInstanceStackMap(), getMass(), 0);
+ EMInstanceStackMap output = totalOutput.getOutput(), results;
+ int differentDecays = decays.length;
+ double[] probabilities = new double[differentDecays];
+ for (int i = 0; i < probabilities.length; i++) {
+ probabilities[i] = decays[i].getProbability();
+ }
+ double[] qttyOfDecay;
+ try {
+ qttyOfDecay = distribute(getAmount(), probabilities);
+ } catch (ArithmeticException e) {
+ Minecraft.getMinecraft().crashed(new CrashReport("Decay failed for: " + this, e));
+ return null;
+ }
+ //long amountRemaining = this.amount, amount = this.amount;
+ //float remainingProbability = 1D;
+//
+ //for (int i = 0; i < differentDecays; i++) {
+ // if (decays[i].probability >= 1D) {
+ // long thisDecayAmount = (long) Math.floor(remainingProbability * (double) amount);
+ // if (thisDecayAmount > 0) {
+ // if (thisDecayAmount <= amountRemaining) {
+ // amountRemaining -= thisDecayAmount;
+ // qttyOfDecay[i] += thisDecayAmount;
+ // }else {//in case too much was made
+ // qttyOfDecay[i] += amountRemaining;
+ // amountRemaining = 0;
+ // //remainingProbability=0;
+ // }
+ // }
+ // break;
+ // }
+ // long thisDecayAmount = (long) Math.floor(decays[i].probability * (double) amount);
+ // if (thisDecayAmount <= amountRemaining && thisDecayAmount > 0) {//some was made
+ // amountRemaining -= thisDecayAmount;
+ // qttyOfDecay[i] += thisDecayAmount;
+ // } else if (thisDecayAmount > amountRemaining) {//too much was made
+ // qttyOfDecay[i] += amountRemaining;
+ // amountRemaining = 0;
+ // //remainingProbability=0;
+ // break;
+ // }
+ // remainingProbability -= decays[i].probability;
+ // if(remainingProbability<=0) {
+ // break;
+ // }
+ //}
+
+ //for (int i = 0; i < amountRemaining; i++) {
+ // double rand = TecTech.RANDOM.nextDouble();
+ // for (int j = 0; j < differentDecays; j++) {//looking for the thing it decayed into
+ // rand -= decays[j].probability;
+ // if (rand <= 0D) {
+ // qttyOfDecay[j]++;
+ // break;
+ // }
+ // }
+ //}
+
+ if (getDefinition().decayMakesEnergy(energy)) {
+ for (int i = differentDecays - 1; i >= 0; i--) {
+ if (decays[i] == deadEnd) {
+ EMInstanceStack clone = clone();
+ clone.setAmount(qttyOfDecay[i]);
+ output.putUnify(clone);
+ } else {
+ results = decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]);
+ output.putUnifyAll(results);
+ totalOutput.setMassDiff(add(totalOutput.getMassDiff(), results.getMass() - mass));
+ }
+ }
+ } else {
+ for (int i = differentDecays - 1; i >= 0; i--) {
+ results = decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]);
+ output.putUnifyAll(results);
+ }
+ }
+
+ if (newProductsAge < 0) {
+ if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) {
+ output.getFirst().setEnergy(energy);
+ output.getFirst().setAge(getAge());
+ } else {
+ for (EMInstanceStack stack : output.valuesToArray()) {
+ if (stack.getDefinition().equals(getDefinition())) {
+ stack.setAge(getAge());
+ }
+ }
+ }
+ } else {
+ if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) {
+ output.getFirst().setEnergy(energy);
+ output.getFirst().setAge(getAge());
+ }
+ }
+ if (energy <= 0 && output.getMass() > getMass()) {
+ return null;//no energy usage to decay
+ }
+ return totalOutput;
+ }
+ }
+
+ public EMInstanceStack unifyIntoThis(EMInstanceStack... instances) {
+ if (instances == null) {
+ return this;
+ }
+ //returns with the definition from the first object passed
+ double energyTotal = getEnergySettingCost(0, energy);
+ long maxEnergy = energy;
+ long minEnergy = energy;
+
+ for (EMInstanceStack instance : instances) {
+ //if (instance != null && compareTo(instance) == 0) {
+ setAmount(add(getAmount(), instance.getAmount()));
+ energyTotal += instance.getEnergySettingCost(0, instance.energy);
+ maxEnergy = max(instance.energy, maxEnergy);
+ minEnergy = min(instance.energy, maxEnergy);
+ lifeTimeMult = min(lifeTimeMult, instance.lifeTimeMult);
+ setAge(max(getAge(), instance.getAge()));
+ //}
+ }
+
+ if (energyTotal >= 0) {
+ for (; maxEnergy > 0; maxEnergy--) {
+ if (getEnergySettingCost(0, maxEnergy) < energyTotal) {
+ break;
+ }
+ }
+ setEnergy(maxEnergy);
+ } else {
+ for (; minEnergy < 0; minEnergy++) {
+ if (getEnergySettingCost(minEnergy, 0) < energyTotal) {
+ break;
+ }
+ }
+ setEnergy(minEnergy);
+ }
+ return this;
+ }
+
+ public EMInstanceStack unifyIntoThisExact(EMInstanceStack... instances) {
+ if (instances == null) {
+ return this;
+ }
+ //returns with the definition from the first object passed
+ double energyTotal = getEnergySettingCost(0, energy);
+ long maxEnergy = energy;
+ long minEnergy = energy;
+
+ for (EMInstanceStack instance : instances) {
+ //if (instance != null && compareTo(instance) == 0) {
+ setAmount(getAmount() + instance.getAmount());
+ energyTotal += instance.getEnergySettingCost(0, instance.energy);
+ maxEnergy = max(instance.energy, maxEnergy);
+ minEnergy = min(instance.energy, maxEnergy);
+ lifeTimeMult = min(lifeTimeMult, instance.lifeTimeMult);
+ setAge(max(getAge(), instance.getAge()));
+ //}
+ }
+
+ if (energyTotal >= 0) {
+ for (; maxEnergy > 0; maxEnergy--) {
+ if (getEnergySettingCost(0, maxEnergy) < energyTotal) {
+ break;
+ }
+ }
+ setEnergy(maxEnergy);
+ } else {
+ for (; minEnergy < 0; minEnergy++) {
+ if (getEnergySettingCost(minEnergy, 0) < energyTotal) {
+ break;
+ }
+ }
+ setEnergy(minEnergy);
+ }
+ return this;
+ }
+
+ public void addScanShortSymbols(ArrayList<String> lines, int[] detailsOnDepthLevels) {
+ int capabilities = detailsOnDepthLevels[0];
+ getDefinition().addScanShortSymbols(lines, capabilities, energy);
+ //scanShortSymbolsContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels);
+ }
+
+ //private void scanShortSymbolsContents(ArrayList<String> lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){
+ // if(definitions!=null && depth<detailsOnDepthLevels.length){
+ // int deeper=depth+1;
+ // for(cElementalDefinitionStack definitionStack:definitions.values()) {
+ // definition.addScanShortSymbols(lines,detailsOnDepthLevels[depth],energy);
+ // scanSymbolsContents(lines,definitionStack.definition.getSubParticles(),deeper,detailsOnDepthLevels);
+ // }
+ // }
+ //}
+
+ public void addScanResults(ArrayList<String> lines, int[] detailsOnDepthLevels) {
+ int capabilities = detailsOnDepthLevels[0];
+ if (Util.areBitsSet(SCAN_GET_DEPTH_LEVEL, capabilities)) {
+ lines.add("DEPTH = " + 0);
+ }
+ getDefinition().addScanResults(lines, capabilities, energy);
+ if (Util.areBitsSet(SCAN_GET_TIMESPAN_MULT, capabilities)) {
+ lines.add("TIME MULT = " + lifeTimeMult);
+ if (Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) {
+ lines.add("TIME SPAN = " + lifeTime + " s");
+ }
+ }
+ if (Util.areBitsSet(SCAN_GET_AGE, capabilities)) {
+ lines.add("AGE = " + getAge() + " 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 = " + energy);
+ }
+ if (Util.areBitsSet(SCAN_GET_AMOUNT, capabilities)) {
+ lines.add("AMOUNT = " + getAmount() / AVOGADRO_CONSTANT + " mol");
+ }
+ scanContents(lines, getDefinition().getSubParticles(), 1, detailsOnDepthLevels);
+ }
+
+ private void scanContents(ArrayList<String> lines, EMConstantStackMap definitions, int depth, int[] detailsOnDepthLevels) {
+ if (definitions != null && depth < detailsOnDepthLevels.length) {
+ int deeper = depth + 1;
+ for (EMDefinitionStack definitionStack : definitions.valuesToArray()) {
+ lines.add("");//def separator
+ if (Util.areBitsSet(SCAN_GET_DEPTH_LEVEL, detailsOnDepthLevels[depth])) {
+ lines.add("DEPTH = " + depth);
+ }
+ getDefinition().addScanResults(lines, detailsOnDepthLevels[depth], energy);
+ if (Util.areBitsSet(SCAN_GET_AMOUNT, detailsOnDepthLevels[depth])) {
+ lines.add("AMOUNT = " + definitionStack.getAmount());
+ }
+ scanContents(lines, definitionStack.getDefinition().getSubParticles(), deeper, detailsOnDepthLevels);
+ }
+ }
+ }
+
+ public NBTTagCompound toNBT() {
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setTag("d", getDefinition().toNBT());
+ nbt.setDouble("Q", getAmount());
+ nbt.setLong("e", energy);
+ nbt.setByte("c", color);
+ nbt.setDouble("A", getAge());
+ nbt.setDouble("M", lifeTimeMult);
+ return nbt;
+ }
+
+ public static EMInstanceStack fromNBT(NBTTagCompound nbt) {
+ NBTTagCompound definition = nbt.getCompoundTag("d");
+ EMInstanceStack instance = new EMInstanceStack(
+ EMComplex.fromNBT(definition),
+ nbt.getLong("q") + nbt.getDouble("Q"),
+ nbt.getFloat("m") + nbt.getDouble("M"),
+ nbt.getLong("a") + nbt.getDouble("A"),
+ nbt.getLong("e"));
+ instance.setColor(nbt.getByte("c"));
+ return instance;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof IEMDefinition) {
+ return getDefinition().compareTo((IEMDefinition) obj) == 0;
+ }
+ if (obj instanceof IEMStack) {
+ return getDefinition().compareTo(((IEMStack) obj).getDefinition()) == 0;
+ }
+ return false;
+ }
+
+ //Amount shouldn't be hashed if this is just indicating amount and not structure, DOES NOT CARE ABOUT creativeTabTecTech INFO
+ @Override
+ public int hashCode() {
+ return getDefinition().hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return getDefinition().toString() + '\n' + getAmount() / AVOGADRO_CONSTANT + " mol\n" + getMass();
+ }
+
+ public void setAmount(double amount) {
+ this.amount = amount;
+ }
+
+ public double getAge() {
+ return age;
+ }
+
+ public void setAge(double age) {
+ this.age = age;
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java
new file mode 100644
index 0000000000..94c76634d9
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java
@@ -0,0 +1,37 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.stacks;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
+import net.minecraft.nbt.NBTTagCompound;
+
+/**
+ * Created by danie_000 on 30.01.2017.
+ */
+public interface IEMStack extends Comparable<IEMStack>,Cloneable {
+ IEMDefinition getDefinition();
+
+ double getAmount();
+
+ default double getCharge(){
+ return getDefinition().getCharge()*getAmount();
+ }
+
+ default double getMass(){
+ return getDefinition().getMass()*getAmount();
+ }
+
+ IEMStack clone();
+
+ /**
+ * Will return stack with mutated amount, it might be a new object!
+ * @param newAmount new amount
+ * @return new stack (or previous one if was mutable)
+ */
+ IEMStack mutateAmount(double newAmount);
+
+ NBTTagCompound toNBT();
+
+ @Override
+ default int compareTo(IEMStack o){
+ return getDefinition().compareTo(o.getDefinition());
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java
deleted file mode 100644
index 1e03c8130f..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.stacks;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
-import net.minecraft.nbt.NBTTagCompound;
-
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__;
-
-/**
- * Created by danie_000 on 20.11.2016.
- */
-public final class cElementalDefinitionStack implements iElementalStack {
- public final iElementalDefinition definition;
- public final double amount;
-
- public cElementalDefinitionStack(iElementalDefinition def, double amount) {
- definition = def == null ? null__ : def;
- this.amount = amount;
- }
-
- @Override
- public cElementalDefinitionStack clone() {
- return this;//IMMUTABLE
- }
-
- @Override
- public cElementalDefinitionStack mutateAmount(double amount) {
- if(this.amount==amount){
- return this;
- }
- return new cElementalDefinitionStack(definition,amount);//IMMUTABLE
- }
-
- @Override
- public iElementalDefinition getDefinition() {
- return definition;//IMMUTABLE
- }
-
- @Override
- public double getAmount() {
- return amount;
- }
-
- @Override
- public double getCharge() {
- return definition.getCharge() * amount;
- }
-
- @Override
- public double getMass() {
- return definition.getMass() * amount;
- }
-
- public NBTTagCompound toNBT() {
- NBTTagCompound nbt = new NBTTagCompound();
- nbt.setTag("d", definition.toNBT());
- nbt.setDouble("Q", amount);
- return nbt;
- }
-
- public static cElementalDefinitionStack fromNBT(NBTTagCompound nbt) {
- return new cElementalDefinitionStack(
- cElementalDefinition.fromNBT(nbt.getCompoundTag("d")),
- nbt.getLong("q")+nbt.getDouble("Q"));
- }
-
- @Override
- public int compareTo(iElementalStack o) {
- return definition.compareTo(o.getDefinition());
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof iElementalDefinition) {
- return definition.compareTo((iElementalDefinition) obj) == 0;
- }
- if (obj instanceof iElementalStack) {
- return definition.compareTo(((iElementalStack) obj).getDefinition()) == 0;
- }
- return false;
- }
-
- //Amount shouldn't be hashed if this is just indicating amount and not structure
- @Override
- public int hashCode() {
- return definition.hashCode();
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java
deleted file mode 100644
index 1c06e560db..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java
+++ /dev/null
@@ -1,566 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.stacks;
-
-import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay;
-import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecayResult;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
-import com.github.technus.tectech.util.Util;
-import net.minecraft.client.Minecraft;
-import net.minecraft.crash.CrashReport;
-import net.minecraft.nbt.NBTTagCompound;
-
-import java.util.ArrayList;
-
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd;
-import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*;
-import static com.github.technus.tectech.util.DoubleCount.*;
-import static java.lang.Math.*;
-
-/**
- * Created by danie_000 on 22.10.2016.
- */
-public final class cElementalInstanceStack implements iElementalStack {
- public static int MIN_MULTIPLE_DECAY_CALLS=4,MAX_MULTIPLE_DECAY_CALLS=16;
- public static double DECAY_CALL_PER=AVOGADRO_CONSTANT;//todo
-
- public final iElementalDefinition definition;
- //energy - if positive then particle should try to decay
- private long energy;
- //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable)
- private byte color;
- public double age;
- public double amount;
- private double lifeTime;
- private double lifeTimeMult;
-
- public cElementalInstanceStack(cElementalDefinitionStack stackSafe) {
- this(stackSafe.definition, stackSafe.amount, 1D, 0D, 0);
- }
-
- public cElementalInstanceStack(cElementalDefinitionStack stackSafe, double lifeTimeMult, double age, long energy) {
- this(stackSafe.definition, stackSafe.amount, lifeTimeMult, age, energy);
- }
-
- public cElementalInstanceStack(iElementalDefinition defSafe, double amount) {
- this(defSafe, amount, 1D, 0D, 0);
- }
-
- public cElementalInstanceStack(iElementalDefinition defSafe, double amount, double lifeTimeMult, double age, long energy) {
- definition = defSafe == null ? null__ : defSafe;
- byte bColor = definition.getColor();
- if (bColor < 0 || bColor > 2) {//transforms colorable??? into proper color
- this.color = bColor;
- } else {
- this.color = (byte) TecTech.RANDOM.nextInt(3);
- }
- this.lifeTimeMult = lifeTimeMult;
- lifeTime = definition.getRawTimeSpan(energy) * this.lifeTimeMult;
- setEnergy(energy);
- this.age = age;
- this.amount = amount;
- }
-
- //Clone proxy
- private cElementalInstanceStack(cElementalInstanceStack stack) {
- definition = stack.definition;
- color = stack.color;
- age = stack.age;
- amount = stack.amount;
- lifeTime = stack.lifeTime;
- lifeTimeMult = stack.lifeTimeMult;
- energy = stack.energy;
- }
-
- @Override
- public cElementalInstanceStack clone() {
- return new cElementalInstanceStack(this);
- }
-
- @Override
- public cElementalInstanceStack mutateAmount(double amount) {
- this.amount = amount;
- return this;
- }
-
- @Override
- public double getAmount() {
- return amount;
- }
-
- @Override
- public double getCharge() {
- return definition.getCharge() * amount;
- }
-
- @Override
- public double getMass() {
- return definition.getMass() * amount;
- }
-
- public long getEnergy() {
- return energy;
- }
-
- public void setEnergy(long newEnergyLevel){
- energy=newEnergyLevel;
- setLifeTimeMultiplier(getLifeTimeMultiplier());
- }
-
- public double getEnergySettingCost(long currentEnergyLevel, long newEnergyLevel){
- return definition.getEnergyDiffBetweenStates(currentEnergyLevel,newEnergyLevel)*amount;
- }
-
- public double getEnergySettingCost(long newEnergyLevel){
- return definition.getEnergyDiffBetweenStates(energy,newEnergyLevel)*amount;
- }
-
- public cElementalDefinitionStack getDefinitionStack() {
- return new cElementalDefinitionStack(definition, amount);
- }
-
- @Override
- public iElementalDefinition getDefinition() {
- return definition;
- }
-
- public byte getColor() {
- return color;
- }
-
- public byte setColor(byte color) {//does not allow changing magic element
- if (this.color < 0 || this.color > 2 || color < 0 || color >= 3) {
- return this.color;
- }
- return this.color = color;
- }
-
- public byte nextColor() {//does not allow changing magic element
- if (color < 0 || color > 2) {
- return color;
- }
- return color = (byte) TecTech.RANDOM.nextInt(3);
- }
-
- public double getLifeTime() {
- return lifeTime;
- }
-
- public double setLifeTimeMultiplier(double mult) {
- if(mult<=0) //since infinity*0=nan
- {
- throw new IllegalArgumentException("multiplier must be >0");
- }
- lifeTimeMult = mult;
- if (definition.getRawTimeSpan(energy) <= 0) {
- return lifeTime;
- }
- lifeTime = definition.getRawTimeSpan(energy) * lifeTimeMult;
- return lifeTime;
- }
-
- public double getLifeTimeMultiplier() {
- return lifeTimeMult;
- }
-
- public cElementalDecayResult tickStackByOneSecond(double lifeTimeMult, int postEnergize){
- return tickStack(lifeTimeMult,postEnergize,1D);
- }
-
- public cElementalDecayResult tickStack(double lifeTimeMult, int postEnergize, double seconds){
- cElementalDecayResult newInstances = decay(lifeTimeMult, age += seconds, postEnergize);
- if (newInstances == null) {
- nextColor();
- } else {
- for (cElementalInstanceStack newInstance : newInstances.getOutput().valuesToArray()) {
- newInstance.nextColor();
- }
- }
- return newInstances;
- }
-
- public cElementalDecayResult decay() {
- return decay(1D, age, 0);//try to decay without changes
- }
-
- public cElementalDecayResult decay(double apparentAge, long postEnergize) {
- return decay(1D,apparentAge,postEnergize);
- }
-
- public cElementalDecayResult decay(double lifeTimeMult, double apparentAge, long postEnergize) {
- long newEnergyLevel = postEnergize + energy;
- if (newEnergyLevel > 0) {
- newEnergyLevel -= 1;
- } else if (newEnergyLevel < 0) {
- newEnergyLevel += 1;
- }
- cElementalDecayResult output;
- if(definition.usesMultipleDecayCalls(energy)){
- double amountTemp=amount;
- int decayCnt=(int) min(MAX_MULTIPLE_DECAY_CALLS,max(amount/DECAY_CALL_PER,MIN_MULTIPLE_DECAY_CALLS));
- amount= div(amount,decayCnt);
- decayCnt--;
-
- output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel);
- if(output==null){
- amount=amountTemp;
- return null;
- }
-
- for(int i=0;i<decayCnt;i++){
- cElementalDecayResult map=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel);
- if(map!=null){
- output.getOutput().putUnifyAll(map.getOutput());
- output.setMassDiff(add(output.getMassDiff(),map.getMassDiff()));
- output.setMassAffected(output.getMassDiff()+map.getMassDiff());
- }
- }
- amount=amountTemp;
- }else{
- output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel);
- }
- if(output!=null){
- output.getOutput().cleanUp();
- }
- return output;
- }
-
- private cElementalDecayResult decayMechanics(double lifeTimeMult, double apparentAge, long newEnergyLevel) {
- if (energy > 0 && !definition.usesSpecialEnergeticDecayHandling()) {
- setLifeTimeMultiplier(getLifeTimeMultiplier());
- return decayCompute(definition.getEnergyInducedDecay(energy), lifeTimeMult, -1D, newEnergyLevel);
- } else if (definition.getRawTimeSpan(energy) < 0) {
- return null;//return null, decay cannot be achieved
- } else if (definition.isTimeSpanHalfLife()) {
- return exponentialDecayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getDecayArray(), lifeTimeMult, -1D, newEnergyLevel);
- } else {
- if (1 > lifeTime) {
- return decayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getNaturalDecayInstant(), lifeTimeMult, 0D, newEnergyLevel);
- } else if (apparentAge > lifeTime) {
- return decayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getDecayArray(), lifeTimeMult, 0D, newEnergyLevel);
- }
- }
- return null;//return null since decay cannot be achieved
- }
-
- //Use to get direct decay output providing correct decay array
- private cElementalDecayResult exponentialDecayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) {
- double newAmount= div(amount,Math.pow(2D,1D/* 1 second *//lifeTime));
-
- //if(definition.getSymbol().startsWith("U ")) {
- // System.out.println("newAmount = " + newAmount);
- // System.out.println("amountRemaining = " + amountRemaining);
- // for(cElementalDecay decay:decays){
- // System.out.println("prob = "+decay.probability);
- // for(cElementalDefinitionStack stack:decay.outputStacks.values()){
- // System.out.println("stack = " + stack.getDefinition().getSymbol() + " " + stack.amount);
- // }
- // }
- //}
- if(newAmount==amount) {
- newAmount-=ulp(newAmount);
- } else if(newAmount<1) {
- return decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel);
- }
-
- //split to non decaying and decaying part
- double amount=this.amount;
- this.amount-=newAmount;
- cElementalDecayResult products=decayCompute(decays,lifeTimeMult,newProductsAge,newEnergyLevel);
- this.amount=newAmount;
- if(products!=null){
- products.getOutput().putUnify(clone());
- }
- this.amount=amount;
- return products;
- }
-
- //Use to get direct decay output providing correct decay array
- private cElementalDecayResult decayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) {
- if (decays == null) {
- return null;//Can not decay so it wont
- }
- boolean makesEnergy=definition.decayMakesEnergy(energy);
- double mass=getMass();
- if (decays.length == 0) {
- return makesEnergy ? null : new cElementalDecayResult(new cElementalInstanceStackMap(), mass, 0);
- //provide non null 0 length array for annihilation
- } else if (decays.length == 1) {//only one type of decay :D, doesn't need dead end
- if(decays[0]==deadEnd) {
- return makesEnergy ? null : new cElementalDecayResult(decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, amount), mass, 0);
- }
- cElementalInstanceStackMap output = decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, amount);
- if(newProductsAge<0){
- if(output.size()==1) {
- if(output.size()==1 && output.getFirst().definition.equals(definition)) {
- output.getFirst().setEnergy(energy);
- output.getFirst().age=age;
- }
- }else {
- for (cElementalInstanceStack stack : output.valuesToArray()) {
- if (stack.definition.equals(definition)) {
- stack.age = age;
- }
- }
- }
- }else{
- if(output.size()==1 && output.getFirst().definition.equals(definition)) {
- output.getFirst().setEnergy(energy);
- }
- }
- if(energy <= 0 && output.getMass() > mass){
- return null;//no energy usage to decay
- }
- return new cElementalDecayResult(new cElementalInstanceStackMap(), mass, makesEnergy ? output.getMass()-mass:0);
- } else {
- cElementalDecayResult totalOutput = new cElementalDecayResult(new cElementalInstanceStackMap(),getMass(),0);
- cElementalInstanceStackMap output=totalOutput.getOutput(),results;
- int differentDecays = decays.length;
- double[] probabilities=new double[differentDecays];
- for (int i = 0; i < probabilities.length; i++) {
- probabilities[i]=decays[i].probability;
- }
- double[] qttyOfDecay;
- try{
- qttyOfDecay = distribute(amount, probabilities);
- }catch (ArithmeticException e){
- Minecraft.getMinecraft().crashed(new CrashReport("Decay failed for: "+this.toString(),e));
- return null;
- }
- //long amountRemaining = this.amount, amount = this.amount;
- //float remainingProbability = 1D;
-//
- //for (int i = 0; i < differentDecays; i++) {
- // if (decays[i].probability >= 1D) {
- // long thisDecayAmount = (long) Math.floor(remainingProbability * (double) amount);
- // if (thisDecayAmount > 0) {
- // if (thisDecayAmount <= amountRemaining) {
- // amountRemaining -= thisDecayAmount;
- // qttyOfDecay[i] += thisDecayAmount;
- // }else {//in case too much was made
- // qttyOfDecay[i] += amountRemaining;
- // amountRemaining = 0;
- // //remainingProbability=0;
- // }
- // }
- // break;
- // }
- // long thisDecayAmount = (long) Math.floor(decays[i].probability * (double) amount);
- // if (thisDecayAmount <= amountRemaining && thisDecayAmount > 0) {//some was made
- // amountRemaining -= thisDecayAmount;
- // qttyOfDecay[i] += thisDecayAmount;
- // } else if (thisDecayAmount > amountRemaining) {//too much was made
- // qttyOfDecay[i] += amountRemaining;
- // amountRemaining = 0;
- // //remainingProbability=0;
- // break;
- // }
- // remainingProbability -= decays[i].probability;
- // if(remainingProbability<=0) {
- // break;
- // }
- //}
-
- //for (int i = 0; i < amountRemaining; i++) {
- // double rand = TecTech.RANDOM.nextDouble();
- // for (int j = 0; j < differentDecays; j++) {//looking for the thing it decayed into
- // rand -= decays[j].probability;
- // if (rand <= 0D) {
- // qttyOfDecay[j]++;
- // break;
- // }
- // }
- //}
-
- if(definition.decayMakesEnergy(energy)){
- for (int i = differentDecays - 1; i >= 0; i--) {
- if(decays[i]==deadEnd){
- cElementalInstanceStack clone=clone();
- clone.amount=qttyOfDecay[i];
- output.putUnify(clone);
- }else {
- results=decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]);
- output.putUnifyAll(results);
- totalOutput.setMassDiff(add(totalOutput.getMassDiff(),results.getMass()-mass));
- }
- }
- }else{
- for (int i = differentDecays - 1; i >= 0; i--) {
- results=decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]);
- output.putUnifyAll(results);
- }
- }
-
- if(newProductsAge<0) {
- if (output.size() == 1 && output.getFirst().definition.equals(definition)) {
- output.getFirst().setEnergy(energy);
- output.getFirst().age = age;
- } else {
- for (cElementalInstanceStack stack : output.valuesToArray()) {
- if (stack.definition.equals(definition)) {
- stack.age = age;
- }
- }
- }
- }else{
- if(output.size()==1 && output.getFirst().definition.equals(definition)) {
- output.getFirst().setEnergy(energy);
- output.getFirst().age=age;
- }
- }
- if(energy <= 0 && output.getMass() > getMass()){
- return null;//no energy usage to decay
- }
- return totalOutput;
- }
- }
-
- public cElementalInstanceStack unifyIntoThis(cElementalInstanceStack... instances) {
- if (instances == null) {
- return this;
- }
- //returns with the definition from the first object passed
- double energyTotal = this.energy * amount;
- long maxEnergy=this.energy;
- double lifeTimeMul = lifeTimeMult;
-
- for (cElementalInstanceStack instance : instances) {
- if (instance != null && compareTo(instance) == 0) {
- amount= add(amount,instance.amount);
- energyTotal += instance.energy * instance.amount;
- if(instance.energy>maxEnergy){
- maxEnergy=instance.energy;
- }
- lifeTimeMul = min(lifeTimeMul, instance.lifeTimeMult);
- age = max(age, instance.age);
- }
- }
-
- if (amount != 0) {
- energyTotal /= Math.abs(amount);
- }
-
- double wholeParts=Math.floor(energyTotal);
- energyTotal= min(energyTotal-wholeParts,1D)+(wholeParts>=0?-0.11709966304863834D:0.11709966304863834D);
- long energy=(long) wholeParts + ((energyTotal > TecTech.RANDOM.nextDouble()) ? 1 : 0);
- if(energy*energyTotal<0){
- energy=0;
- }
- setEnergy(min(maxEnergy,energy));
- return this;
- }
-
- public void addScanShortSymbols(ArrayList<String> lines, int[] detailsOnDepthLevels){
- int capabilities=detailsOnDepthLevels[0];
- definition.addScanShortSymbols(lines,capabilities,energy);
- //scanShortSymbolsContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels);
- }
-
- //private void scanShortSymbolsContents(ArrayList<String> lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){
- // if(definitions!=null && depth<detailsOnDepthLevels.length){
- // int deeper=depth+1;
- // for(cElementalDefinitionStack definitionStack:definitions.values()) {
- // definition.addScanShortSymbols(lines,detailsOnDepthLevels[depth],energy);
- // scanSymbolsContents(lines,definitionStack.definition.getSubParticles(),deeper,detailsOnDepthLevels);
- // }
- // }
- //}
-
- public void addScanResults(ArrayList<String> lines, int[] detailsOnDepthLevels){
- 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 MULT = " + lifeTimeMult);
- if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO,capabilities)) {
- lines.add("TIME SPAN = " + 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 = " + energy);
- }
- if(Util.areBitsSet(SCAN_GET_AMOUNT,capabilities)) {
- lines.add("AMOUNT = " + amount/ AVOGADRO_CONSTANT +" mol");
- }
- scanContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels);
- }
-
- private void scanContents(ArrayList<String> lines, cElementalConstantStackMap definitions, int depth, int[] detailsOnDepthLevels){
- if(definitions!=null && depth<detailsOnDepthLevels.length){
- int deeper=depth+1;
- for(cElementalDefinitionStack definitionStack:definitions.valuesToArray()) {
- lines.add("");//def separator
- 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);
- }
- scanContents(lines,definitionStack.definition.getSubParticles(),deeper,detailsOnDepthLevels);
- }
- }
- }
-
- public NBTTagCompound toNBT() {
- NBTTagCompound nbt = new NBTTagCompound();
- nbt.setTag("d", definition.toNBT());
- nbt.setDouble("Q", amount);
- nbt.setLong("e", energy);
- nbt.setByte("c", color);
- nbt.setDouble("A", age);
- nbt.setDouble("M", lifeTimeMult);
- return nbt;
- }
-
- public static cElementalInstanceStack fromNBT(NBTTagCompound nbt) {
- NBTTagCompound definition = nbt.getCompoundTag("d");
- cElementalInstanceStack instance = new cElementalInstanceStack(
- cElementalDefinition.fromNBT(definition),
- nbt.getLong("q")+nbt.getDouble("Q"),
- nbt.getFloat("m")+nbt.getDouble("M"),
- nbt.getLong("a")+nbt.getDouble("A"),
- nbt.getLong("e"));
- instance.setColor(nbt.getByte("c"));
- return instance;
- }
-
- @Override
- public int compareTo(iElementalStack o) {//use for unification
- return definition.compareTo(o.getDefinition());
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof iElementalDefinition) {
- return definition.compareTo((iElementalDefinition) obj) == 0;
- }
- if (obj instanceof iElementalStack) {
- return definition.compareTo(((iElementalStack) obj).getDefinition()) == 0;
- }
- return false;
- }
-
- //Amount shouldn't be hashed if this is just indicating amount and not structure, DOES NOT CARE ABOUT creativeTabTecTech INFO
- @Override
- public int hashCode() {
- return definition.hashCode();
- }
-
- @Override
- public String toString() {
- return definition.toString() + '\n' + amount/ AVOGADRO_CONSTANT + " mol\n" + getMass();
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iElementalStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iElementalStack.java
deleted file mode 100644
index 65f2ed3b78..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iElementalStack.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.stacks;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
-import net.minecraft.nbt.NBTTagCompound;
-
-/**
- * Created by danie_000 on 30.01.2017.
- */
-public interface iElementalStack extends Comparable<iElementalStack>,Cloneable {
- iElementalDefinition getDefinition();
-
- double getAmount();
-
- double getCharge();
-
- double getMass();
-
- iElementalStack clone();
-
- iElementalStack mutateAmount(double amount);
-
- NBTTagCompound toNBT();
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java
index 43e42df988..7fc074bded 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMComplex.java
@@ -1,7 +1,7 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.templates;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
import net.minecraft.nbt.NBTTagCompound;
import java.lang.reflect.Method;
@@ -10,14 +10,14 @@ import java.util.HashSet;
import java.util.Map;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__;
/**
* Created by danie_000 on 23.01.2017.
*/
-public abstract class cElementalDefinition extends iElementalDefinition {
+public abstract class EMComplex implements IEMDefinition {
//Nothing array
- public static final iElementalDefinition[] nothing = new cElementalPrimitive[0];
+ public static final IEMDefinition[] nothing = new EMPrimitive[0];
//add text based creators for recipe formula input?
private static final Map<Byte, Method> nbtCreationBind = new HashMap<>();//creator methods in subclasses
@@ -37,13 +37,13 @@ public abstract class cElementalDefinition extends iElementalDefinition {
}
@Override
- public final cElementalDefinition clone() {
+ public final EMComplex clone() {
return this;//IMMUTABLE
}
- public static iElementalDefinition fromNBT(NBTTagCompound nbt) {
+ public static IEMDefinition fromNBT(NBTTagCompound nbt) {
try {
- return (iElementalDefinition) nbtCreationBind.get(nbt.getByte("t")).invoke(null, nbt);
+ return (IEMDefinition) nbtCreationBind.get(nbt.getByte("t")).invoke(null, nbt);
} catch (Exception e) {
if (DEBUG_MODE) {
e.printStackTrace();
@@ -53,7 +53,7 @@ public abstract class cElementalDefinition extends iElementalDefinition {
}
@Override
- public int compareTo(iElementalDefinition o) {
+ public int compareTo(IEMDefinition o) {
int classCompare = compareClassID(o);
if (classCompare != 0) {
return classCompare;
@@ -66,7 +66,7 @@ public abstract class cElementalDefinition extends iElementalDefinition {
}
//use only for nested operations!
- private static int compareInnerContentsWithAmounts(cElementalDefinitionStack[] tc, cElementalDefinitionStack[] sc) {
+ private static int compareInnerContentsWithAmounts(EMDefinitionStack[] tc, EMDefinitionStack[] sc) {
if (tc == null) {
if (sc == null) {
return 0;
@@ -84,15 +84,15 @@ public abstract class cElementalDefinition extends iElementalDefinition {
}
for (int i = 0; i < tc.length; i++) {
- int cn = tc[i].definition.compareTo(sc[i].definition);
+ int cn = tc[i].getDefinition().compareTo(sc[i].getDefinition());
if (cn != 0) {
return cn;
}
- if (tc[i].amount > sc[i].amount) {
+ if (tc[i].getAmount() > sc[i].getAmount()) {
return 1;
}
- if (tc[i].amount < sc[i].amount) {
+ if (tc[i].getAmount() < sc[i].getAmount()) {
return -1;
}
}
@@ -100,8 +100,8 @@ public abstract class cElementalDefinition extends iElementalDefinition {
}
@Override
- public final cElementalDefinitionStack getStackForm(double amount) {
- return new cElementalDefinitionStack(this, amount);
+ public final EMDefinitionStack getStackForm(double amount) {
+ return new EMDefinitionStack(this, amount);
}
@Override
@@ -109,11 +109,11 @@ public abstract class cElementalDefinition extends iElementalDefinition {
if(this==obj) {
return true;
}
- if (obj instanceof iElementalDefinition) {
- return compareTo((iElementalDefinition) obj) == 0;
+ if (obj instanceof IEMDefinition) {
+ return compareTo((IEMDefinition) obj) == 0;
}
- if (obj instanceof iElementalStack) {
- return compareTo(((iElementalStack) obj).getDefinition()) == 0;
+ if (obj instanceof IEMStack) {
+ return compareTo(((IEMStack) obj).getDefinition()) == 0;
}
return false;
}
@@ -121,15 +121,15 @@ public abstract class cElementalDefinition extends iElementalDefinition {
@Override
public int hashCode() {//Internal amounts should be also hashed
int hash = -(getSubParticles().size() << 4);
- for (cElementalDefinitionStack stack : getSubParticles().valuesToArray()) {
- int amount=(int)stack.amount;
- hash += ((amount & 0x1) == 0 ? -amount : amount) + stack.definition.hashCode();
+ for (EMDefinitionStack stack : getSubParticles().valuesToArray()) {
+ int amount=(int) stack.getAmount();
+ hash += ((amount & 0x1) == 0 ? -amount : amount) + stack.getDefinition().hashCode();
}
return hash;
}
@Override
public String toString() {
- return getName()+ '\n' + getSymbol();
+ return getLocalizedName()+ '\n' + getSymbol();
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java
index 70af6445c9..587affd0f1 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/EMPrimitive.java
@@ -1,12 +1,12 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.templates;
import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo;
import net.minecraft.client.Minecraft;
import net.minecraft.crash.CrashReport;
import net.minecraft.nbt.NBTTagCompound;
@@ -15,7 +15,7 @@ import java.util.*;
import static com.github.technus.tectech.util.Util.areBitsSet;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__;
import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED;
import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*;
@@ -23,54 +23,54 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileE
* Created by danie_000 on 22.10.2016.
* EXTEND THIS TO ADD NEW PRIMITIVES, WATCH OUT FOR ID'S!!! (-1 to 32 can be assumed as used)
*/
-public abstract class cElementalPrimitive extends cElementalDefinition {
+public abstract class EMPrimitive extends EMComplex {
public static final byte nbtType = (byte) 'p';
- private static final Map<Integer, cElementalPrimitive> bindsBO = new HashMap<>();
+ private static final Map<Integer, EMPrimitive> bindsBO = new HashMap<>();
- public static Map<Integer, cElementalPrimitive> getBindsPrimitive() {
+ public static Map<Integer, EMPrimitive> getBindsPrimitive() {
return bindsBO;
}
- public final String name;
- public final String symbol;
+ private final String name;
+ private final String symbol;
//float-mass in eV/c^2
- public final double mass;
+ private final double mass;
//int -electric charge in 1/3rds of electron charge for optimization
- public final byte charge;
+ private final int charge;
//byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable)
- public final byte color;
+ private final byte color;
//-1/-2/-3 anti matter generations, +1/+2/+3 matter generations, 0 self anti
- public final byte type;
+ private final byte type;
- private cElementalPrimitive anti;//IMMUTABLE
- private cElementalDecay[] elementalDecays;
- private byte naturalDecayInstant;
+ private EMPrimitive anti;//IMMUTABLE
+ private EMDecay[] elementalDecays;
+ private byte naturalDecayInstant;
private byte energeticDecayInstant;
private double rawLifeTime;
- public final int ID;
+ private final int ID;
//no _ at end - normal particle
// _ at end - anti particle
// __ at end - self is antiparticle
- protected cElementalPrimitive(String name, String symbol, int type, double mass, int charge, int color, int ID) {
+ protected EMPrimitive(String name, String symbol, int type, double mass, int charge, int color, int ID) {
this.name = name;
this.symbol = symbol;
this.type = (byte) type;
this.mass = mass;
- this.charge = (byte) charge;
+ this.charge = charge;
this.color = (byte) color;
this.ID = ID;
if (bindsBO.put(ID, this) != null) {
- Minecraft.getMinecraft().crashed(new CrashReport("Primitive definition", new tElementalException("Duplicate ID")));
+ Minecraft.getMinecraft().crashed(new CrashReport("Primitive definition", new EMException("Duplicate ID")));
}
STACKS_REGISTERED.add(this);
}
//
- protected void init(cElementalPrimitive antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, cElementalDecay... elementalDecaysArray) {
+ protected void init(EMPrimitive antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, EMDecay... elementalDecaysArray) {
anti = antiParticle;
this.rawLifeTime = rawLifeTime;
naturalDecayInstant = (byte) naturalInstant;
@@ -79,8 +79,8 @@ public abstract class cElementalPrimitive extends cElementalDefinition {
}
@Override
- public String getName() {
- return "Undefined: " + name;
+ public String getLocalizedName() {
+ return "Undefined: " + getName();
}
@Override
@@ -90,11 +90,11 @@ public abstract class cElementalPrimitive extends cElementalDefinition {
@Override
public String getShortSymbol() {
- return symbol;
+ return getSymbol();
}
@Override
- public iElementalDefinition getAnti() {
+ public IEMDefinition getAnti() {
return anti;//no need for copy
}
@@ -114,28 +114,28 @@ public abstract class cElementalPrimitive extends cElementalDefinition {
}
@Override
- public cElementalDecay[] getNaturalDecayInstant() {
+ public EMDecay[] getNaturalDecayInstant() {
if (naturalDecayInstant < 0) {
return elementalDecays;
}else if (naturalDecayInstant>=elementalDecays.length){
- return cElementalDecay.noProduct;
+ return EMDecay.NO_PRODUCT;
}
- return new cElementalDecay[]{elementalDecays[naturalDecayInstant]};
+ return new EMDecay[]{elementalDecays[naturalDecayInstant]};
}
@Override
- public cElementalDecay[] getEnergyInducedDecay(long energyLevel) {
+ public EMDecay[] getEnergyInducedDecay(long energyLevel) {
if (energeticDecayInstant < 0) {
return elementalDecays;
}else if (energeticDecayInstant>=elementalDecays.length){
- return cElementalDecay.noProduct;
+ return EMDecay.NO_PRODUCT;
}
- return new cElementalDecay[]{elementalDecays[energeticDecayInstant]};
+ return new EMDecay[]{elementalDecays[energeticDecayInstant]};
}
@Override
public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) {
- return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel);
+ return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel);
}
@Override
@@ -159,7 +159,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition {
}
@Override
- public cElementalDecay[] getDecayArray() {
+ public EMDecay[] getDecayArray() {
return elementalDecays;
}
@@ -169,22 +169,22 @@ public abstract class cElementalPrimitive extends cElementalDefinition {
}
@Override
- public final cElementalConstantStackMap getSubParticles() {
+ public final EMConstantStackMap getSubParticles() {
return null;
}
@Override
- public aFluidDequantizationInfo someAmountIntoFluidStack() {
+ public EMFluidDequantizationInfo someAmountIntoFluidStack() {
return null;
}
@Override
- public aItemDequantizationInfo someAmountIntoItemsStack() {
+ public EMItemDequantizationInfo someAmountIntoItemsStack() {
return null;
}
@Override
- public aOredictDequantizationInfo someAmountIntoOredictStack() {
+ public EMOredictDequantizationInfo someAmountIntoOredictStack() {
return null;
}
@@ -197,12 +197,12 @@ public abstract class cElementalPrimitive extends cElementalDefinition {
public final NBTTagCompound toNBT() {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setByte("t", nbtType);
- nbt.setInteger("c", ID);
+ nbt.setInteger("c", getID());
return nbt;
}
- public static cElementalPrimitive fromNBT(NBTTagCompound content) {
- cElementalPrimitive primitive = bindsBO.get(content.getInteger("c"));
+ public static EMPrimitive fromNBT(NBTTagCompound content) {
+ EMPrimitive primitive = bindsBO.get(content.getInteger("c"));
return primitive == null ? null__ : primitive;
}
@@ -228,7 +228,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition {
lines.add("CLASS = " + nbtType + ' ' + getClassType());
}
if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) {
- lines.add("NAME = "+getName());
+ lines.add("NAME = "+ getLocalizedName());
lines.add("SYMBOL = "+getSymbol());
}
if(areBitsSet(SCAN_GET_CHARGE,capabilities)) {
@@ -248,7 +248,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition {
public static void run() {
try {
- cElementalDefinition.addCreatorFromNBT(nbtType, cElementalPrimitive.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-128);
+ EMComplex.addCreatorFromNBT(nbtType, EMPrimitive.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-128);
} catch (Exception e) {
if (DEBUG_MODE) {
e.printStackTrace();
@@ -260,16 +260,24 @@ public abstract class cElementalPrimitive extends cElementalDefinition {
}
@Override
- public final int compareTo(iElementalDefinition o) {
+ public final int compareTo(IEMDefinition o) {
if (getClassType() == o.getClassType()) {
- int oID = ((cElementalPrimitive) o).ID;
- return Integer.compare(ID, oID);
+ int oID = ((EMPrimitive) o).getID();
+ return Integer.compare(getID(), oID);
}
return compareClassID(o);
}
@Override
public final int hashCode() {
+ return getID();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getID() {
return ID;
}
} \ No newline at end of file
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java
new file mode 100644
index 0000000000..7ae6d0395c
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/IEMDefinition.java
@@ -0,0 +1,84 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.templates;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo;
+import net.minecraft.nbt.NBTTagCompound;
+
+import java.util.ArrayList;
+
+/**
+ * Created by danie_000 on 11.11.2016.
+ */
+public interface IEMDefinition extends Comparable<IEMDefinition>,Cloneable {//IMMUTABLE
+ double STABLE_RAW_LIFE_TIME =1.5e36D;
+ double NO_DECAY_RAW_LIFE_TIME=-1D;
+ long DEFAULT_ENERGY_LEVEL=0;
+ double DEFAULT_ENERGY_REQUIREMENT=25000D;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels
+
+ //Nomenclature
+ String getLocalizedName();
+
+ String getSymbol();
+
+ String getShortSymbol();
+
+ void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel);
+
+ 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
+
+ //Not dynamically changing stuff
+ IEMDefinition getAnti();//gives new anti particle def
+
+ EMDecay[] getDecayArray();//possible decays
+
+ EMDecay[] getNaturalDecayInstant();//natural decay if lifespan <1tick
+
+ EMDecay[] getEnergyInducedDecay(long energyLevel);//energetic decay
+
+ boolean usesSpecialEnergeticDecayHandling();
+
+ boolean usesMultipleDecayCalls(long energyLevel);
+
+ boolean decayMakesEnergy(long energyLevel);
+
+ boolean fusionMakesEnergy(long energyLevel);
+
+ double getEnergyDiffBetweenStates(long currentEnergy, long newEnergyLevel);//positive or negative
+
+ double getMass();//mass... MeV/c^2
+
+ int getCharge();//charge 1/3 electron charge
+
+ //dynamically changing stuff
+ byte getColor();//-1 nope cannot 0 it can but undefined
+
+ double getRawTimeSpan(long currentEnergy);//defined in static fields or generated
+
+ boolean isTimeSpanHalfLife();
+
+ EMConstantStackMap getSubParticles();//contents... null if none
+
+ EMFluidDequantizationInfo someAmountIntoFluidStack();
+
+ EMItemDequantizationInfo someAmountIntoItemsStack();
+
+ EMOredictDequantizationInfo someAmountIntoOredictStack();
+
+ NBTTagCompound toNBT();
+
+ EMDefinitionStack getStackForm(double amount);
+
+ IEMDefinition clone();
+
+ default int compareClassID(IEMDefinition obj) {
+ return (int) getClassType() - obj.getClassType();
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java
deleted file mode 100644
index 8065e9c170..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.templates;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo;
-import net.minecraft.nbt.NBTTagCompound;
-
-import java.util.ArrayList;
-
-/**
- * Created by danie_000 on 11.11.2016.
- */
-public abstract class iElementalDefinition implements Comparable<iElementalDefinition>,Cloneable {//IMMUTABLE
- public static final double STABLE_RAW_LIFE_TIME =1.5e36D;
- public static final double NO_DECAY_RAW_LIFE_TIME=-1D;
- public static final long DEFAULT_ENERGY_LEVEL=0;
- public static final double DEFAULT_ENERGY_REQUIREMENT=25000D;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels
-
- //Nomenclature
- public abstract String getName();
-
- public abstract String getSymbol();
-
- public abstract String getShortSymbol();
-
- public abstract void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel);
-
- public abstract void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel);
-
- public abstract byte getType();
-
- public abstract byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED
-
- //Not dynamically changing stuff
- public abstract iElementalDefinition getAnti();//gives new anti particle def
-
- public abstract cElementalDecay[] getDecayArray();//possible decays
-
- public abstract cElementalDecay[] getNaturalDecayInstant();//natural decay if lifespan <1tick
-
- public abstract cElementalDecay[] getEnergyInducedDecay(long energyLevel);//energetic decay
-
- public abstract boolean usesSpecialEnergeticDecayHandling();
-
- public abstract boolean usesMultipleDecayCalls(long energyLevel);
-
- public abstract boolean decayMakesEnergy(long energyLevel);
-
- public abstract boolean fusionMakesEnergy(long energyLevel);
-
- public abstract double getEnergyDiffBetweenStates(long currentEnergy, long newEnergyLevel);//positive or negative
-
- public abstract double getMass();//mass... MeV/c^2
-
- public abstract int getCharge();//charge 1/3 electron charge
-
- //dynamically changing stuff
- public abstract byte getColor();//-1 nope cannot 0 it can but undefined
-
- public abstract double getRawTimeSpan(long currentEnergy);//defined in static fields or generated
-
- public abstract boolean isTimeSpanHalfLife();
-
- public abstract cElementalConstantStackMap getSubParticles();//contents... null if none
-
- public abstract aFluidDequantizationInfo someAmountIntoFluidStack();
-
- public abstract aItemDequantizationInfo someAmountIntoItemsStack();
-
- public abstract aOredictDequantizationInfo someAmountIntoOredictStack();
-
- public abstract NBTTagCompound toNBT();
-
- public abstract cElementalDefinitionStack getStackForm(double amount);
-
- @Override
- public abstract iElementalDefinition clone();
-
- final int compareClassID(iElementalDefinition obj) {
- return (int) getClassType() - obj.getClassType();
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java
index 0d91b57ed5..d74c36170e 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java
@@ -1,28 +1,28 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
/**
* Created by Tec on 23.05.2017.
*/
-public class aFluidDequantizationInfo implements iExchangeInfo<iElementalStack,FluidStack> {
- private final iElementalStack in;
- private final FluidStack out;
+public class EMFluidDequantizationInfo implements IEMExchangeInfo<IEMStack,FluidStack> {
+ private final IEMStack in;
+ private final FluidStack out;
- public aFluidDequantizationInfo(iElementalStack emIn, FluidStack fluidStackOut){
+ public EMFluidDequantizationInfo(IEMStack emIn, FluidStack fluidStackOut){
in=emIn;
out=fluidStackOut;
}
- public aFluidDequantizationInfo(iElementalStack emIn, Fluid fluid, int fluidAmount){
+ public EMFluidDequantizationInfo(IEMStack emIn, Fluid fluid, int fluidAmount){
in=emIn;
out=new FluidStack(fluid,fluidAmount);
}
@Override
- public iElementalStack input() {
+ public IEMStack input() {
return in.clone();//MEH!
}
@@ -38,6 +38,6 @@ public class aFluidDequantizationInfo implements iExchangeInfo<iElementalStack,F
@Override
public boolean equals(Object obj) {
- return obj instanceof aFluidDequantizationInfo && hashCode() == obj.hashCode();
+ return obj instanceof EMFluidDequantizationInfo && hashCode() == obj.hashCode();
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java
index 39e4ec4671..43fb5550aa 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java
@@ -1,22 +1,22 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
/**
* Created by Tec on 23.05.2017.
*/
-public class aFluidQuantizationInfo implements iExchangeInfo<FluidStack, iElementalStack> {
- private final FluidStack in;
- private final iElementalStack out;
+public class EMFluidQuantizationInfo implements IEMExchangeInfo<FluidStack, IEMStack> {
+ private final FluidStack in;
+ private final IEMStack out;
- public aFluidQuantizationInfo(FluidStack fluidStackIn, iElementalStack emOut){
+ public EMFluidQuantizationInfo(FluidStack fluidStackIn, IEMStack emOut){
in=fluidStackIn;
out=emOut;
}
- public aFluidQuantizationInfo(Fluid fluid, int fluidAmount, iElementalStack emOut){
+ public EMFluidQuantizationInfo(Fluid fluid, int fluidAmount, IEMStack emOut){
in=new FluidStack(fluid,fluidAmount);
out=emOut;
}
@@ -27,7 +27,7 @@ public class aFluidQuantizationInfo implements iExchangeInfo<FluidStack, iElemen
}
@Override
- public iElementalStack output() {
+ public IEMStack output() {
return out.clone();
}
@@ -38,6 +38,6 @@ public class aFluidQuantizationInfo implements iExchangeInfo<FluidStack, iElemen
@Override
public boolean equals(Object obj) {
- return obj instanceof aFluidQuantizationInfo && hashCode() == obj.hashCode();
+ return obj instanceof EMFluidQuantizationInfo && hashCode() == obj.hashCode();
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java
index fb71275276..af741c703d 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java
@@ -1,6 +1,6 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_OreDictUnificator;
@@ -9,22 +9,22 @@ import net.minecraft.item.ItemStack;
/**
* Created by Tec on 23.05.2017.
*/
-public class aItemDequantizationInfo implements iExchangeInfo<iElementalStack,ItemStack> {
- private final iElementalStack in;
- private final ItemStack out;
+public class EMItemDequantizationInfo implements IEMExchangeInfo<IEMStack,ItemStack> {
+ private final IEMStack in;
+ private final ItemStack out;
- public aItemDequantizationInfo(iElementalStack emIn, ItemStack itemStackOut){
+ public EMItemDequantizationInfo(IEMStack emIn, ItemStack itemStackOut){
in=emIn;
out=itemStackOut;
}
- public aItemDequantizationInfo(iElementalStack emIn, OrePrefixes prefix, Materials material, int amount) {
+ public EMItemDequantizationInfo(IEMStack emIn, OrePrefixes prefix, Materials material, int amount) {
in = emIn;
out = GT_OreDictUnificator.get(prefix, material, amount);
}
@Override
- public iElementalStack input() {
+ public IEMStack input() {
return in.clone();
}
@@ -40,6 +40,6 @@ public class aItemDequantizationInfo implements iExchangeInfo<iElementalStack,It
@Override
public boolean equals(Object obj) {
- return obj instanceof aItemDequantizationInfo && hashCode() == obj.hashCode();
+ return obj instanceof EMItemDequantizationInfo && hashCode() == obj.hashCode();
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java
index da9950a186..553e806d38 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java
@@ -1,6 +1,6 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
@@ -11,18 +11,18 @@ import net.minecraftforge.oredict.OreDictionary;
/**
* Created by Tec on 23.05.2017.
*/
-public class aItemQuantizationInfo implements iExchangeInfo<ItemStack, iElementalStack> {
- private final ItemStack in;
- private final boolean skipNBT;
- private final iElementalStack out;
+public class EMItemQuantizationInfo implements IEMExchangeInfo<ItemStack, IEMStack> {
+ private final ItemStack in;
+ private final boolean skipNBT;
+ private final IEMStack out;
- public aItemQuantizationInfo(ItemStack itemStackIn, boolean skipNBT, iElementalStack emOut) {
+ public EMItemQuantizationInfo(ItemStack itemStackIn, boolean skipNBT, IEMStack emOut) {
in = itemStackIn;
out = emOut;
this.skipNBT = skipNBT;
}
- public aItemQuantizationInfo(OrePrefixes prefix, Materials material, int amount, boolean skipNBT, iElementalStack emOut) {
+ public EMItemQuantizationInfo(OrePrefixes prefix, Materials material, int amount, boolean skipNBT, IEMStack emOut) {
in = GT_OreDictUnificator.get(prefix, material, amount);
out = emOut;
this.skipNBT = skipNBT;
@@ -34,7 +34,7 @@ public class aItemQuantizationInfo implements iExchangeInfo<ItemStack, iElementa
}
@Override
- public iElementalStack output() {
+ public IEMStack output() {
return out.clone();
}
@@ -45,15 +45,15 @@ public class aItemQuantizationInfo implements iExchangeInfo<ItemStack, iElementa
@Override
public boolean equals(Object obj) {
- if(obj instanceof aItemQuantizationInfo){
+ if(obj instanceof EMItemQuantizationInfo){
//alias
- ItemStack stack=((aItemQuantizationInfo) obj).in;
- if(!in.getUnlocalizedName().equals(((aItemQuantizationInfo) obj).in.getUnlocalizedName())) {
+ ItemStack stack=((EMItemQuantizationInfo) obj).in;
+ if(!in.getUnlocalizedName().equals(((EMItemQuantizationInfo) obj).in.getUnlocalizedName())) {
return false;
}
if(!GameRegistry.findUniqueIdentifierFor(in.getItem()).equals(
- GameRegistry.findUniqueIdentifierFor(((aItemQuantizationInfo) obj).in.getItem()))) {
+ GameRegistry.findUniqueIdentifierFor(((EMItemQuantizationInfo) obj).in.getItem()))) {
return false;
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java
index 20f2252bd8..c8e337c7fd 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java
@@ -1,43 +1,43 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
/**
* Created by Tec on 23.05.2017.
*/
-public class aOredictDequantizationInfo implements iExchangeInfo<iElementalStack,String> {
- private final iElementalStack in;
- public final String out;
- public final int amount;
+public class EMOredictDequantizationInfo implements IEMExchangeInfo<IEMStack,String> {
+ private final IEMStack in;
+ private final String out;
+ private final int amount;
- public aOredictDequantizationInfo(iElementalStack emIn, String name, int qty) {
+ public EMOredictDequantizationInfo(IEMStack emIn, String name, int qty) {
in = emIn;
out =name;
amount = qty;
}
- public aOredictDequantizationInfo(iElementalStack emIn, OrePrefixes prefix, Materials material, int qty) {
+ public EMOredictDequantizationInfo(IEMStack emIn, OrePrefixes prefix, Materials material, int qty) {
in = emIn;
out = prefix.name() + material.mName;
amount = qty;
}
- public aOredictDequantizationInfo(iElementalStack emIn, OrePrefixes prefix, String materialName, int qty) {
+ public EMOredictDequantizationInfo(IEMStack emIn, OrePrefixes prefix, String materialName, int qty) {
in = emIn;
out = prefix.name() + materialName;
amount = qty;
}
@Override
- public iElementalStack input() {
+ public IEMStack input() {
return in.clone();//MEH!
}
@Override
public String output() {
- return out;
+ return getOut();
}
@Override
@@ -47,6 +47,14 @@ public class aOredictDequantizationInfo implements iExchangeInfo<iElementalStack
@Override
public boolean equals(Object obj) {
- return obj instanceof aOredictDequantizationInfo && hashCode() == obj.hashCode();
+ return obj instanceof EMOredictDequantizationInfo && hashCode() == obj.hashCode();
+ }
+
+ public String getOut() {
+ return out;
+ }
+
+ public int getAmount() {
+ return amount;
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java
new file mode 100644
index 0000000000..0ca0415b0d
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java
@@ -0,0 +1,60 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+
+/**
+ * Created by Tec on 23.05.2017.
+ */
+public class EMOredictQuantizationInfo implements IEMExchangeInfo<String, IEMStack> {
+ private final String in;
+ private final int amount;
+ private final IEMStack out;
+
+ public EMOredictQuantizationInfo(String name, int qty, IEMStack emOut){
+ in=name;
+ amount=qty;
+ out=emOut;
+ }
+
+ public EMOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, IEMStack emOut){
+ in=prefix.name() + material.mName;
+ amount=qty;
+ out=emOut;
+ }
+
+ public EMOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, IEMStack emOut){
+ in=prefix.name() + materialName;
+ amount=qty;
+ out=emOut;
+ }
+
+ @Override
+ public String input() {
+ return getIn();
+ }
+
+ @Override
+ public IEMStack output() {
+ return out.clone();
+ }
+
+ @Override
+ public int hashCode() {
+ return getIn().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return obj instanceof EMOredictQuantizationInfo && hashCode() == obj.hashCode();
+ }
+
+ public String getIn() {
+ return in;
+ }
+
+ public int getAmount() {
+ return amount;
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java
new file mode 100644
index 0000000000..fca79b0b6f
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java
@@ -0,0 +1,172 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.oredict.OreDictionary;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED;
+import static java.lang.Math.pow;
+
+/**
+ * Created by Tec on 26.05.2017.
+ */
+public class EMTransformationInfo {
+ /**
+ * Atom count per Mol
+ */
+ public static final double AVOGADRO_CONSTANT =6.02214076e23D;
+ /**
+ * Min. chance of existing
+ */
+ public static final double AVOGADRO_CONSTANT_UNCERTAINTY =(144*1000) / AVOGADRO_CONSTANT;
+ /**
+ * Quantity considered to be indifferent when computing stuff
+ */
+ public static final double AVOGADRO_CONSTANT_EPSILON = AVOGADRO_CONSTANT / pow(2,48);
+ public static final double AVOGADRO_CONSTANT_DIMINISHED = AVOGADRO_CONSTANT - AVOGADRO_CONSTANT_EPSILON;
+ public static final double AVOGADRO_CONSTANT_144 = AVOGADRO_CONSTANT *144D;
+ public static final double AVOGADRO_CONSTANT_144_DIMINISHED = AVOGADRO_CONSTANT_144 - AVOGADRO_CONSTANT_EPSILON;
+ public static final double AVOGADRO_CONSTANT_1000 = AVOGADRO_CONSTANT *1000D;
+ public static final double AVOGADRO_CONSTANT_1000_DIMINISHED = AVOGADRO_CONSTANT_1000 - AVOGADRO_CONSTANT_EPSILON;
+
+ public static EMTransformationInfo TRANSFORMATION_INFO = new EMTransformationInfo();
+
+ private Map<Integer, EMFluidQuantizationInfo> fluidQuantization;
+ private Map<EMItemQuantizationInfo, EMItemQuantizationInfo> itemQuantization;
+ private Map<Integer, EMOredictQuantizationInfo> oredictQuantization;
+
+ private Map<IEMDefinition, EMFluidDequantizationInfo> fluidDequantization;
+ private Map<IEMDefinition, EMItemDequantizationInfo> itemDequantization;
+ private Map<IEMDefinition, EMOredictDequantizationInfo> oredictDequantization;
+
+ private EMTransformationInfo() {
+ this(
+ new HashMap<>(16), new HashMap<>(16), new HashMap<>(64),
+ new HashMap<>(16), new HashMap<>(16), new HashMap<>(64)
+ );
+ }
+
+ public EMTransformationInfo(
+ Map<Integer, EMFluidQuantizationInfo> fluidQuantization,
+ Map<EMItemQuantizationInfo, EMItemQuantizationInfo> itemQuantization,
+ Map<Integer, EMOredictQuantizationInfo> oredictQuantization,
+ Map<IEMDefinition, EMFluidDequantizationInfo> fluidDequantization,
+ Map<IEMDefinition, EMItemDequantizationInfo> itemDequantization,
+ Map<IEMDefinition, EMOredictDequantizationInfo> oredictDequantization) {
+ this.setFluidQuantization(fluidQuantization);
+ this.setItemQuantization(itemQuantization);
+ this.setOredictQuantization(oredictQuantization);
+ this.setFluidDequantization(fluidDequantization);
+ this.setItemDequantization(itemDequantization);
+ this.setOredictDequantization(oredictDequantization);
+ }
+
+ public void addFluid(IEMStack em, FluidStack fluidStack){
+ getFluidQuantization().put(fluidStack.getFluidID(),new EMFluidQuantizationInfo(fluidStack,em));
+ getFluidDequantization().put(em.getDefinition(),new EMFluidDequantizationInfo(em,fluidStack));
+ STACKS_REGISTERED.add(em.getDefinition());
+ STACKS_REGISTERED.add(em.getDefinition().getAnti());
+ }
+
+ public void addFluid(IEMStack em, Fluid fluid, int fluidAmount){
+ getFluidQuantization().put(fluid.getID(),new EMFluidQuantizationInfo(fluid,fluidAmount,em));
+ getFluidDequantization().put(em.getDefinition(),new EMFluidDequantizationInfo(em,fluid,fluidAmount));
+ STACKS_REGISTERED.add(em.getDefinition());
+ STACKS_REGISTERED.add(em.getDefinition().getAnti());
+ }
+
+ private void addItemQuantization(EMItemQuantizationInfo aIQI){
+ getItemQuantization().put(aIQI,aIQI);
+ }
+
+ public void addItem(IEMStack em, ItemStack itemStack, boolean skipNBT){
+ addItemQuantization(new EMItemQuantizationInfo(itemStack,skipNBT,em));
+ getItemDequantization().put(em.getDefinition(),new EMItemDequantizationInfo(em,itemStack));
+ STACKS_REGISTERED.add(em.getDefinition());
+ STACKS_REGISTERED.add(em.getDefinition().getAnti());
+ }
+
+ public void addItem(IEMStack em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT){
+ addItemQuantization(new EMItemQuantizationInfo(prefix,material,amount,skipNBT,em));
+ getItemDequantization().put(em.getDefinition(),new EMItemDequantizationInfo(em,prefix,material,amount));
+ STACKS_REGISTERED.add(em.getDefinition());
+ STACKS_REGISTERED.add(em.getDefinition().getAnti());
+ }
+
+ public void addOredict(IEMStack em, String name, int qty){
+ getOredictQuantization().put(OreDictionary.getOreID(name),new EMOredictQuantizationInfo(name,qty,em));
+ getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,name,qty));
+ STACKS_REGISTERED.add(em.getDefinition());
+ STACKS_REGISTERED.add(em.getDefinition().getAnti());
+ }
+
+ public void addOredict(IEMStack em, OrePrefixes prefix, Materials material, int qty){
+ getOredictQuantization().put(OreDictionary.getOreID(prefix.name() + material.mName),new EMOredictQuantizationInfo(prefix,material,qty,em));
+ getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,prefix,material,qty));
+ STACKS_REGISTERED.add(em.getDefinition());
+ STACKS_REGISTERED.add(em.getDefinition().getAnti());
+ }
+
+ public void addOredict(IEMStack em, OrePrefixes prefix, String materialName, int qty){
+ getOredictQuantization().put(OreDictionary.getOreID(prefix.name() + materialName),new EMOredictQuantizationInfo(prefix,materialName,qty,em));
+ getOredictDequantization().put(em.getDefinition(),new EMOredictDequantizationInfo(em,prefix,materialName,qty));
+ STACKS_REGISTERED.add(em.getDefinition());
+ STACKS_REGISTERED.add(em.getDefinition().getAnti());
+ }
+
+ public Map<Integer, EMFluidQuantizationInfo> getFluidQuantization() {
+ return fluidQuantization;
+ }
+
+ public void setFluidQuantization(Map<Integer, EMFluidQuantizationInfo> fluidQuantization) {
+ this.fluidQuantization = fluidQuantization;
+ }
+
+ public Map<EMItemQuantizationInfo, EMItemQuantizationInfo> getItemQuantization() {
+ return itemQuantization;
+ }
+
+ public void setItemQuantization(Map<EMItemQuantizationInfo, EMItemQuantizationInfo> itemQuantization) {
+ this.itemQuantization = itemQuantization;
+ }
+
+ public Map<Integer, EMOredictQuantizationInfo> getOredictQuantization() {
+ return oredictQuantization;
+ }
+
+ public void setOredictQuantization(Map<Integer, EMOredictQuantizationInfo> oredictQuantization) {
+ this.oredictQuantization = oredictQuantization;
+ }
+
+ public Map<IEMDefinition, EMFluidDequantizationInfo> getFluidDequantization() {
+ return fluidDequantization;
+ }
+
+ public void setFluidDequantization(Map<IEMDefinition, EMFluidDequantizationInfo> fluidDequantization) {
+ this.fluidDequantization = fluidDequantization;
+ }
+
+ public Map<IEMDefinition, EMItemDequantizationInfo> getItemDequantization() {
+ return itemDequantization;
+ }
+
+ public void setItemDequantization(Map<IEMDefinition, EMItemDequantizationInfo> itemDequantization) {
+ this.itemDequantization = itemDequantization;
+ }
+
+ public Map<IEMDefinition, EMOredictDequantizationInfo> getOredictDequantization() {
+ return oredictDequantization;
+ }
+
+ public void setOredictDequantization(Map<IEMDefinition, EMOredictDequantizationInfo> oredictDequantization) {
+ this.oredictDequantization = oredictDequantization;
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java
index 2e8ef92073..e20b0af3b5 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java
@@ -3,7 +3,7 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformation
/**
* Created by Tec on 23.05.2017.
*/
-public interface iExchangeInfo<IN,OUT> {
+public interface IEMExchangeInfo<IN,OUT> {
OUT output();//what should be given - ItemStack,FluidStack,AspectStack, (EM definitionStack->)EM instance stack - etc.
//This must return new Object! - if obj is immutable don't care that much (applies to defStacks)
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java
deleted file mode 100644
index 252b524185..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack;
-import gregtech.api.enums.Materials;
-import gregtech.api.enums.OrePrefixes;
-
-/**
- * Created by Tec on 23.05.2017.
- */
-public class aOredictQuantizationInfo implements iExchangeInfo<String, iElementalStack> {
- public final String in;
- public final int amount;
- private final iElementalStack out;
-
- public aOredictQuantizationInfo(String name, int qty, iElementalStack emOut){
- in=name;
- amount=qty;
- out=emOut;
- }
-
- public aOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, iElementalStack emOut){
- in=prefix.name() + material.mName;
- amount=qty;
- out=emOut;
- }
-
- public aOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, iElementalStack emOut){
- in=prefix.name() + materialName;
- amount=qty;
- out=emOut;
- }
-
- @Override
- public String input() {
- return in;
- }
-
- @Override
- public iElementalStack output() {
- return out.clone();
- }
-
- @Override
- public int hashCode() {
- return in.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- return obj instanceof aOredictQuantizationInfo && hashCode() == obj.hashCode();
- }
-}
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
deleted file mode 100644
index 39f946c54a..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
-import gregtech.api.enums.Materials;
-import gregtech.api.enums.OrePrefixes;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.oredict.OreDictionary;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED;
-import static java.lang.Math.pow;
-
-/**
- * Created by Tec on 26.05.2017.
- */
-public class bTransformationInfo {
- /**
- * Atom count per Mol
- */
- public static final double AVOGADRO_CONSTANT =6.02214076e23D;
- /**
- * Min. chance of existing
- */
- public static final double AVOGADRO_CONSTANT_UNCERTAINTY =(144*1000) / AVOGADRO_CONSTANT;
- /**
- * Quantity considered to be indifferent when computing stuff
- */
- public static final double AVOGADRO_CONSTANT_EPSILON = AVOGADRO_CONSTANT / pow(2,48);
- public static final double AVOGADRO_CONSTANT_DIMINISHED = AVOGADRO_CONSTANT - AVOGADRO_CONSTANT_EPSILON;
- public static final double AVOGADRO_CONSTANT_144 = AVOGADRO_CONSTANT *144D;
- public static final double AVOGADRO_CONSTANT_144_DIMINISHED = AVOGADRO_CONSTANT_144 - AVOGADRO_CONSTANT_EPSILON*144D;
- public static final double AVOGADRO_CONSTANT_1000 = AVOGADRO_CONSTANT *1000D;
- public static final double AVOGADRO_CONSTANT_1000_DIMINISHED = AVOGADRO_CONSTANT_1000 - AVOGADRO_CONSTANT_EPSILON*1000D;
-
- public static bTransformationInfo TRANSFORMATION_INFO = new bTransformationInfo();
-
- public Map<Integer,aFluidQuantizationInfo> fluidQuantization;
- public Map<aItemQuantizationInfo,aItemQuantizationInfo> itemQuantization;
- public Map<Integer,aOredictQuantizationInfo> oredictQuantization;
-
- public Map<iElementalDefinition,aFluidDequantizationInfo> fluidDequantization;
- public Map<iElementalDefinition,aItemDequantizationInfo> itemDequantization;
- public Map<iElementalDefinition,aOredictDequantizationInfo> oredictDequantization;
-
- private bTransformationInfo() {
- this(
- new HashMap<>(16), new HashMap<>(16), new HashMap<>(64),
- new HashMap<>(16), new HashMap<>(16), new HashMap<>(64)
- );
- }
-
- public bTransformationInfo(
- Map<Integer, aFluidQuantizationInfo> fluidQuantization,
- Map<aItemQuantizationInfo, aItemQuantizationInfo> itemQuantization,
- Map<Integer, aOredictQuantizationInfo> oredictQuantization,
- Map<iElementalDefinition, aFluidDequantizationInfo> fluidDequantization,
- Map<iElementalDefinition, aItemDequantizationInfo> itemDequantization,
- Map<iElementalDefinition, aOredictDequantizationInfo> oredictDequantization) {
- this.fluidQuantization = fluidQuantization;
- this.itemQuantization = itemQuantization;
- this.oredictQuantization = oredictQuantization;
- this.fluidDequantization = fluidDequantization;
- this.itemDequantization = itemDequantization;
- this.oredictDequantization = oredictDequantization;
- }
-
- public void addFluid(iElementalStack em, FluidStack fluidStack){
- fluidQuantization.put(fluidStack.getFluidID(),new aFluidQuantizationInfo(fluidStack,em));
- fluidDequantization.put(em.getDefinition(),new aFluidDequantizationInfo(em,fluidStack));
- STACKS_REGISTERED.add(em.getDefinition());
- STACKS_REGISTERED.add(em.getDefinition().getAnti());
- }
-
- public void addFluid(iElementalStack em, Fluid fluid, int fluidAmount){
- fluidQuantization.put(fluid.getID(),new aFluidQuantizationInfo(fluid,fluidAmount,em));
- fluidDequantization.put(em.getDefinition(),new aFluidDequantizationInfo(em,fluid,fluidAmount));
- STACKS_REGISTERED.add(em.getDefinition());
- STACKS_REGISTERED.add(em.getDefinition().getAnti());
- }
-
- private void addItemQuantization(aItemQuantizationInfo aIQI){
- itemQuantization.put(aIQI,aIQI);
- }
-
- public void addItem(iElementalStack em, ItemStack itemStack, boolean skipNBT){
- addItemQuantization(new aItemQuantizationInfo(itemStack,skipNBT,em));
- itemDequantization.put(em.getDefinition(),new aItemDequantizationInfo(em,itemStack));
- STACKS_REGISTERED.add(em.getDefinition());
- STACKS_REGISTERED.add(em.getDefinition().getAnti());
- }
-
- public void addItem(iElementalStack 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));
- STACKS_REGISTERED.add(em.getDefinition());
- STACKS_REGISTERED.add(em.getDefinition().getAnti());
- }
-
- public void addOredict(iElementalStack em, String name, int qty){
- oredictQuantization.put(OreDictionary.getOreID(name),new aOredictQuantizationInfo(name,qty,em));
- oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,name,qty));
- STACKS_REGISTERED.add(em.getDefinition());
- STACKS_REGISTERED.add(em.getDefinition().getAnti());
- }
-
- public void addOredict(iElementalStack 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));
- STACKS_REGISTERED.add(em.getDefinition());
- STACKS_REGISTERED.add(em.getDefinition().getAnti());
- }
-
- public void addOredict(iElementalStack 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));
- STACKS_REGISTERED.add(em.getDefinition());
- STACKS_REGISTERED.add(em.getDefinition().getAnti());
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java
new file mode 100644
index 0000000000..77ac6c46c4
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java
@@ -0,0 +1,1694 @@
+package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex;
+
+import com.github.technus.tectech.Reference;
+import com.github.technus.tectech.TecTech;
+import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader;
+import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition;
+import com.github.technus.tectech.util.Util;
+import com.github.technus.tectech.util.XSTR;
+import cpw.mods.fml.common.Loader;
+import gregtech.api.enums.Materials;
+import net.minecraft.nbt.NBTTagCompound;
+
+import java.util.*;
+
+import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition.getNbtTagCompound;
+import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.deadEnd;
+import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*;
+import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE;
+import static gregtech.api.enums.OrePrefixes.dust;
+
+/**
+ * Created by danie_000 on 18.11.2016.
+ */
+public final class EMAtomDefinition extends EMComplex {
+ public static final long ATOM_COMPLEXITY_LIMIT=65536L;
+ private static final byte BYTE_OFFSET=32;
+
+ private final int hash;
+ public static double refMass, refUnstableMass;
+
+ private static final byte nbtType = (byte) 'a';
+ private static final Random xstr = new XSTR();//NEEDS SEPARATE!
+ private static Map<Integer, TreeSet<Integer>> stableIsotopes = new HashMap<>();
+ private static final Map<Integer, EMAtomDefinition> stableAtoms = new HashMap<>();
+ private static Map<Integer, TreeMap<Double, Integer>> mostStableUnstableIsotopes = new HashMap<>();
+ private static final Map<Integer, EMAtomDefinition> unstableAtoms = new HashMap<>();
+ private static EMDefinitionStack alpha,deuterium,tritium,helium_3,beryllium_8,carbon_14,neon_24,silicon_34;
+ private static final HashMap<EMAtomDefinition,Double> lifetimeOverrides = new HashMap<>();
+
+ private final EMNuclideIAEA iaea;
+
+ private static EMAtomDefinition somethingHeavy;
+ public static EMAtomDefinition getSomethingHeavy() {
+ return somethingHeavy;
+ }
+
+ private static final ArrayList<Runnable> overrides = new ArrayList<>();
+ public static void addOverride(EMAtomDefinition atom, double rawLifeTime){
+ lifetimeOverrides.put(atom,rawLifeTime);
+ }
+
+ //float-mass in eV/c^2
+ private final double mass;
+ //public final int charge;
+ private final int charge;
+ //int -electric charge in 1/3rds of electron charge for optimization
+ private final int chargeLeptons;
+ private double rawLifeTime;
+ //generation max present inside - minus if contains any anti quark
+ private final byte type;
+
+ private final byte decayMode;//t neutron to proton+,0,f proton to neutron
+ //public final boolean stable;
+
+ private final int neutralCount;
+ private final int element;
+
+ private final boolean iaeaDefinitionExistsAndHasEnergyLevels;
+
+ private final EMConstantStackMap elementalStacks;
+
+ //stable is rawLifeTime>=10^9
+
+ public EMAtomDefinition(EMDefinitionStack... things) throws EMException {
+ this(true, new EMConstantStackMap(things));
+ }
+
+ private EMAtomDefinition(boolean check, EMDefinitionStack... things) throws EMException {
+ this(check, new EMConstantStackMap(things));
+ }
+
+ public EMAtomDefinition(EMConstantStackMap things) throws EMException {
+ this(true, things);
+ }
+
+ private EMAtomDefinition(boolean check, EMConstantStackMap things) throws EMException {
+ if (check && !canTheyBeTogether(things)) {
+ throw new EMException("Atom Definition error");
+ }
+ elementalStacks = things;
+
+ double mass = 0;
+ int cLeptons = 0;
+ int cNucleus = 0;
+ int neutralCount = 0, element = 0;
+ int type = 0;
+ boolean containsAnti = false;
+ for (EMDefinitionStack stack : elementalStacks.valuesToArray()) {
+ IEMDefinition def = stack.getDefinition();
+ int amount = (int) stack.getAmount();
+ if((int) stack.getAmount() != stack.getAmount()){
+ throw new ArithmeticException("Amount cannot be safely converted to int!");
+ }
+ mass += stack.getMass();
+ if (def.getType() < 0) {
+ containsAnti = true;
+ }
+ type = Math.max(type, Math.abs(def.getType()));
+
+ if (def instanceof EMLeptonDefinition) {
+ cLeptons += stack.getCharge();
+ } else {
+ cNucleus += stack.getCharge();
+ if (def.getCharge() == 3) {
+ element += amount;
+ } else if (def.getCharge() == -3) {
+ element -= amount;
+ } else if (def.getCharge() == 0) {
+ neutralCount += amount;
+ }
+ }
+ }
+ this.type = containsAnti ? (byte) -type : (byte) type;
+ //this.mass = mass;
+ chargeLeptons = cLeptons;
+ charge = cNucleus + cLeptons;
+ this.neutralCount = neutralCount;
+ this.element = element;
+
+ element = Math.abs(element);
+
+ //stability curve
+ int StableIsotope = stableIzoCurve(element);
+ int izoDiff = neutralCount - StableIsotope;
+ int izoDiffAbs = Math.abs(izoDiff);
+
+ xstr.setSeed((element + 1L) * (neutralCount + 100L));
+ iaea = EMNuclideIAEA.get(element,neutralCount);
+ if(getIaea() !=null){
+ if(Double.isNaN(getIaea().getMass())) {
+ this.mass = mass;
+ } else {
+ this.mass = getIaea().getMass();
+ }
+
+ if(Double.isNaN(getIaea().getHalfTime())) {
+ Double overriddenLifeTime= lifetimeOverrides.get(this);
+ double rawLifeTimeTemp;
+ if(overriddenLifeTime!=null) {
+ rawLifeTimeTemp = overriddenLifeTime;
+ } else {
+ rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti);
+ }
+ rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME);
+ }else {
+ rawLifeTime = containsAnti ? getIaea().getHalfTime() * 1.5514433E-21d * (1d + xstr.nextDouble() * 9d) : getIaea().getHalfTime();
+ }
+ iaeaDefinitionExistsAndHasEnergyLevels = getIaea().getEnergeticStatesArray().length>1;
+ }else{
+ this.mass=mass;
+
+ Double overriddenLifeTime= lifetimeOverrides.get(this);
+ double rawLifeTimeTemp;
+ if(overriddenLifeTime!=null) {
+ rawLifeTimeTemp = overriddenLifeTime;
+ } else {
+ rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti);
+ }
+ rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME);
+
+ iaeaDefinitionExistsAndHasEnergyLevels =false;
+ }
+
+ if(getIaea() ==null || getIaea().getEnergeticStatesArray()[0].energy!=0) {
+ if (izoDiff == 0) {
+ decayMode = 0;
+ } else {
+ decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) : (byte) -Math.min(2, 1 + izoDiffAbs / 4);
+ }
+ }else{
+ decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4)+ BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET);
+ }
+ //this.stable = this.rawLifeTime >= STABLE_RAW_LIFE_TIME;
+ hash=super.hashCode();
+ }
+
+ private static int stableIzoCurve(int element) {
+ return (int) Math.round(-1.19561E-06D * Math.pow(element, 4D) +
+ 1.60885E-04D * Math.pow(element, 3D) +
+ 3.76604E-04D * Math.pow(element, 2D) +
+ 1.08418E+00D * (double) element);
+ }
+
+ private static double calculateLifeTime(int izoDiff, int izoDiffAbs, int element, int isotope, boolean containsAnti) {
+ double rawLifeTime;
+
+ if (element <= 83 && isotope < 127 && (izoDiffAbs == 0 || element == 1 && isotope == 0 || element == 2 && isotope == 1 || izoDiffAbs == 1 && element > 2 && element % 2 == 1 || izoDiffAbs == 3 && element > 30 && element % 2 == 0 || izoDiffAbs == 5 && element > 30 && element % 2 == 0 || izoDiffAbs == 2 && element > 20 && element % 2 == 1)) {
+ rawLifeTime = (1D + xstr.nextDouble() * 9D) * (containsAnti ? 2.381e4D : 1.5347e25D);
+ } else {
+ //Y = (X-A)/(B-A) * (D-C) + C
+ double unstabilityEXP;
+ if (element == 0) {
+ return 1e-35D;
+ } else if (element == 1) {
+ unstabilityEXP = 1.743D - Math.abs(izoDiff - 1) * 9.743D;
+ } else if (element == 2) {
+ switch (isotope) {
+ case 4:
+ unstabilityEXP = 1.61D;
+ break;
+ case 5:
+ unstabilityEXP = -7.523D;
+ break;
+ case 6:
+ unstabilityEXP = -1.51D;
+ break;
+ default:
+ unstabilityEXP = -(izoDiffAbs * 6.165D);
+ break;
+ }
+ } else if (element <= 83 || isotope <= 127 && element <= 120) {
+ double elementPow4 = Math.pow(element, 4);
+
+ unstabilityEXP = Math.min(element / 2.4D, 6 + ((element + 1) % 2) * 3e6D / elementPow4) + -izoDiff * elementPow4 / 1e8D - Math.abs(izoDiff - 1 + element / 60D) * (3D - element / 12.5D + element * element / 1500D);
+ } else if (element < 180) {
+ unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5D - (element - 85) / 3D) - Math.abs(izoDiff) * (3D - element / 13D + element * element / 1600D);
+ } else {
+ return -1;
+ }
+ if ((isotope == 127 || isotope == 128) && element < 120 && element > 83) {
+ unstabilityEXP -= 1.8D;
+ }
+ if (element > 83 && element < 93 && isotope % 2 == 0 && izoDiff == 3) {
+ unstabilityEXP += 6;
+ }
+ if (element > 93 && element < 103 && isotope % 2 == 0 && izoDiff == 4) {
+ unstabilityEXP += 6;
+ }
+ rawLifeTime = (containsAnti ? 1e-8D : 1) * Math.pow(10D, unstabilityEXP) * (1D + xstr.nextDouble() * 9D);
+ }
+
+ if (rawLifeTime < 8e-15D) {
+ return 1e-35D;
+ }
+ if (rawLifeTime > 8e28D) {
+ return 8e30D;
+ }
+ return rawLifeTime;
+ }
+
+ private static boolean canTheyBeTogether(EMConstantStackMap stacks) {
+ boolean nuclei = false;
+ long qty=0;
+ for (EMDefinitionStack stack : stacks.valuesToArray()) {
+ if (stack.getDefinition() instanceof EMHadronDefinition) {
+ if (((EMHadronDefinition) stack.getDefinition()).getAmount() != 3) {
+ return false;
+ }
+ nuclei = true;
+ } else if (!(stack.getDefinition() instanceof EMLeptonDefinition)) {
+ return false;
+ }
+ if((int) stack.getAmount() != stack.getAmount()){
+ throw new ArithmeticException("Amount cannot be safely converted to int!");
+ }
+ qty+= stack.getAmount();
+ }
+ return nuclei && qty<ATOM_COMPLEXITY_LIMIT;
+ }
+
+ @Override
+ public int getCharge() {
+ return charge;
+ }
+
+ public int getChargeLeptons() {
+ return chargeLeptons;
+ }
+
+ public int getChargeHadrons() {
+ return getCharge() - getChargeLeptons();
+ }
+
+ public int getIonizationElementWise() {
+ return getElement() * 3 + getChargeLeptons();
+ }
+
+ @Override
+ public double getMass() {
+ return mass;
+ }
+
+ @Override
+ public byte getType() {
+ return type;
+ }
+
+ @Override
+ public double getRawTimeSpan(long currentEnergy) {
+ if(currentEnergy<=0) {
+ return rawLifeTime;
+ }
+ if(iaeaDefinitionExistsAndHasEnergyLevels){
+ if(currentEnergy>= getIaea().getEnergeticStatesArray().length){
+ return getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length-1].Thalf/(currentEnergy- getIaea().getEnergeticStatesArray().length+1);
+ }
+ return getIaea().getEnergeticStatesArray()[(int)currentEnergy].Thalf;
+ }
+ return rawLifeTime/(currentEnergy+1);
+ }
+
+ @Override
+ public boolean isTimeSpanHalfLife() {
+ return true;
+ }
+
+ @Override
+ public byte getColor() {
+ return -10;
+ }
+
+ @Override
+ public String getLocalizedName() {
+ int element = Math.abs(this.getElement());
+ boolean negative = this.getElement() < 0;
+ try {
+ if (Math.abs(getType()) != 1) {
+ return (negative ? "~? " : "? ") + Nomenclature.NAME[element];
+ }
+ return negative ? '~' + Nomenclature.NAME[element] : Nomenclature.NAME[element];
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ return (negative ? "Element: ~" : "Element: ") + element;
+ }
+ }
+
+ @Override
+ public String getSymbol() {
+ int element = Math.abs(this.getElement());
+ boolean negative = this.getElement() < 0;
+ try {
+ return (negative ? "~" : "") + Nomenclature.SYMBOL[element] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() +element) + " C:" + getCharge();
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ try {
+ int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10;
+ return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() +element) + " C:" + getCharge();
+ } catch (Exception E) {
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ return (negative ? "~" : "") + "? N:" + getNeutralCount() + " I:" + (getNeutralCount() +element) + " C:" + getCharge();
+ }
+ }
+ }
+
+ @Override
+ public String getShortSymbol() {
+ int element = Math.abs(this.getElement());
+ boolean negative = this.getElement() < 0;
+ try {
+ return (negative ? "~" : "") + Nomenclature.SYMBOL[element];
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ try {
+ int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10;
+ return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1];
+ } catch (Exception E) {
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ return (negative ? "~" : "") + "?";
+ }
+ }
+ }
+
+ @Override
+ public EMConstantStackMap getSubParticles() {
+ return elementalStacks.clone();
+ }
+
+ @Override
+ public EMDecay[] getDecayArray() {
+ ArrayList<EMDecay> decaysList =new ArrayList<>(4);
+ return getDecayArray(decaysList, getDecayMode(),true);
+ }
+
+ private EMDecay[] getDecayArray(ArrayList<EMDecay> decaysList, int decayMode, boolean tryAnti) {//todo?
+ if (getType() == 1) {
+ switch (decayMode) {
+ case -2:
+ if(TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) {
+ return decaysList.toArray(EMDecay.NO_PRODUCT);
+ } else if(PbetaDecay(decaysList)) {
+ return decaysList.toArray(EMDecay.NO_PRODUCT);
+ }
+ break;
+ case -1:
+ if(Emmision(decaysList, EMHadronDefinition.hadron_p1)) {
+ return decaysList.toArray(EMDecay.NO_PRODUCT);
+ }
+ break;
+ case 0:
+ if(alphaDecay(decaysList)) {
+ return decaysList.toArray(EMDecay.NO_PRODUCT);
+ }
+ break;
+ case 1:
+ if(Emmision(decaysList, EMHadronDefinition.hadron_n1)) {
+ return decaysList.toArray(EMDecay.NO_PRODUCT);
+ }
+ break;
+ case 2:
+ if(MbetaDecay(decaysList)) {
+ return decaysList.toArray(EMDecay.NO_PRODUCT);
+ }
+ break;
+ default:
+ if(decayMode>8){
+ if(iaeaDecay(decaysList,0)) {
+ return decaysList.toArray(EMDecay.NO_PRODUCT);
+ }
+ return getDecayArray(decaysList,decayMode- BYTE_OFFSET,false);
+ }
+ }
+ return EMDecay.NO_DECAY;
+ }else if(getType() ==-1){
+ EMAtomDefinition anti =getAnti();
+ if(anti!=null) {
+ return anti.getDecayArray(decaysList, decayMode, false);
+ }
+ }
+ return getNaturalDecayInstant();
+ }
+
+ private boolean iaeaDecay(ArrayList<EMDecay> decaysList, long energy){
+ EMNuclideIAEA.energeticState state;
+ if(energy> getIaea().getEnergeticStatesArray().length) {
+ state = getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1];
+ } else if(energy<=0) {
+ state = getIaea().getEnergeticStatesArray()[0];
+ } else {
+ state = getIaea().getEnergeticStatesArray()[(int) energy];
+ }
+ for (int i=0;i<state.decaymodes.length;i++){
+ if(!getDecayFromIaea(decaysList,state.decaymodes[i],energy)) {
+ decaysList.clear();
+ return false;
+ }
+ }
+ return !decaysList.isEmpty();
+ }
+
+ private boolean getDecayFromIaea(ArrayList<EMDecay> decaysList, EMNuclideIAEA.iaeaDecay decay, long energy){
+ EMDefinitionStackMap withThis =elementalStacks.toMutable(), newStuff =new EMDefinitionStackMap();
+ switch (decay.decayName){
+ case "D": {
+ if (withThis.removeAllAmountsExact(deuterium.getDefinition().getSubParticles())){
+ withThis.putReplace(deuterium);
+ decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }
+ } break;
+ case "3H": {
+ if (withThis.removeAllAmountsExact(tritium.getDefinition().getSubParticles())){
+ withThis.putReplace(tritium);
+ decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }
+ } break;
+ case "3HE": {
+ if (withThis.removeAllAmountsExact(helium_3.getDefinition().getSubParticles())){
+ withThis.putReplace(helium_3);
+ decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }
+ } break;
+ case "8BE": {
+ if (withThis.removeAllAmountsExact(beryllium_8.getDefinition().getSubParticles())){
+ withThis.putReplace(beryllium_8);
+ decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }
+ } break;
+ case "14C": {
+ if (withThis.removeAllAmountsExact(carbon_14.getDefinition().getSubParticles())){
+ newStuff.putReplace(carbon_14);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "24NE": {
+ if (withThis.removeAllAmountsExact(neon_24.getDefinition().getSubParticles())){
+ newStuff.putReplace(neon_24);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "34SI": {
+ if (withThis.removeAllAmountsExact(silicon_34.getDefinition().getSubParticles())){
+ newStuff.putReplace(silicon_34);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "A": case "A?": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2, EMHadronDefinition.hadron_p2)){
+ newStuff.putReplace(alpha);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "B+": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_n1);
+ newStuff.putReplace(EMLeptonDefinition.lepton_e_1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "2B+": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_n2);
+ newStuff.putReplace(EMLeptonDefinition.lepton_e_2);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "B-": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_p1);
+ newStuff.putReplace(EMLeptonDefinition.lepton_e1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "2B-": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_p2);
+ newStuff.putReplace(EMLeptonDefinition.lepton_e2);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_2);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "EC": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_n1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "2EC": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e2)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_n2);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "B++EC": case "EC+B+": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_n2);
+ newStuff.putReplace(EMLeptonDefinition.lepton_e_1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "B+A": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3, EMHadronDefinition.hadron_n1)){
+ newStuff.putReplace(EMLeptonDefinition.lepton_e_1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1);
+ newStuff.putReplace(alpha);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "B+P": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_n1);
+ newStuff.putReplace(EMLeptonDefinition.lepton_e_1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1);
+ newStuff.putReplace(EMHadronDefinition.hadron_p1);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "B+2P": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_n1);
+ newStuff.putReplace(EMLeptonDefinition.lepton_e_1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1);
+ newStuff.putReplace(EMHadronDefinition.hadron_p2);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "B-A": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3, EMHadronDefinition.hadron_p1)){
+ newStuff.putReplace(EMLeptonDefinition.lepton_e1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1);
+ newStuff.putReplace(alpha);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "B-N": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_p1);
+ newStuff.putReplace(EMLeptonDefinition.lepton_e1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1);
+ newStuff.putReplace(EMHadronDefinition.hadron_n1);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "B-2N": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_p1);
+ newStuff.putReplace(EMLeptonDefinition.lepton_e1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1);
+ newStuff.putReplace(EMHadronDefinition.hadron_n2);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "B-P": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){
+ newStuff.putReplace(EMLeptonDefinition.lepton_e1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1);
+ newStuff.putReplace(EMHadronDefinition.hadron_p1);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "ECA": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1, EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)){
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1);
+ newStuff.putReplace(alpha);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "ECP": {
+ if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p2)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_n1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1);
+ newStuff.putReplace(EMHadronDefinition.hadron_p1);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "EC2P": {
+ if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_n1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1);
+ newStuff.putReplace(EMHadronDefinition.hadron_p2);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "ECP+EC2P": {//todo look at branching ratios
+ if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e2, EMHadronDefinition.hadron_p5)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_n1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2);
+ newStuff.putReplace(EMHadronDefinition.hadron_p3);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "N": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){
+ newStuff.putReplace(EMHadronDefinition.hadron_n1);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "2N": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){
+ newStuff.putReplace(EMHadronDefinition.hadron_n2);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "P": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)){
+ newStuff.putReplace(EMHadronDefinition.hadron_p1);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "2P": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){
+ newStuff.putReplace(EMHadronDefinition.hadron_p2);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "SF": {
+ if (Fission(decaysList, withThis, newStuff, decay.chance, false)) {
+ return true;
+ }
+ } break;
+ case "B-F": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_p1);
+ newStuff.putReplace(EMLeptonDefinition.lepton_e1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1);
+ try{
+ if(Fission(decaysList,withThis,newStuff,decay.chance,false)) {
+ return true;
+ }
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "ECF": case "ECSF": case "EC(+SF)": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_n1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1);
+ try{
+ if(Fission(decaysList,withThis,newStuff,decay.chance,false)) {
+ return true;
+ }
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "SF(+EC+B+)": case "SF+EC+B+": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_n2);
+ newStuff.putReplace(EMLeptonDefinition.lepton_e_1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2);
+ try{
+ if(Fission(decaysList,withThis,newStuff,decay.chance,false)) {
+ return true;
+ }
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "SF+EC+B-": {
+ if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1)){
+ newStuff.putReplace(EMLeptonDefinition.lepton_e1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1);
+ try{
+ if(Fission(decaysList,withThis,newStuff,decay.chance,false)) {
+ return true;
+ }
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "IT": case "IT?": case "G": {
+ if(energy>0){
+ decaysList.add(new EMDecay(decay.chance, this, boson_Y__));
+ }else{
+ if(DEBUG_MODE) {
+ TecTech.LOGGER.info("Tried to emit Gamma from ground state");
+ }
+ decaysList.add(new EMDecay(decay.chance, this));
+ }
+ return true;
+ } //break;
+ case "IT+EC+B+": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){
+ withThis.putUnifyExact(EMHadronDefinition.hadron_n2);
+ newStuff.putReplace(EMLeptonDefinition.lepton_e_1);
+ newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2);
+ newStuff.putReplace(EMBosonDefinition.boson_Y__1);
+ try{
+ newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
+ decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ }catch (Exception e){
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ } break;
+ case "DEAD_END":
+ decaysList.add(deadEnd);
+ return true;
+ default: throw new Error("Unsupported decay mode: " + decay.decayName + ' ' + getNeutralCount() + ' ' + getElement());
+ }
+ if(DEBUG_MODE) {
+ TecTech.LOGGER.info("Failed to decay " + getElement() + ' ' + getNeutralCount() + ' ' + decay.decayName);
+ }
+ return false;
+ }
+
+ private boolean Emmision(ArrayList<EMDecay> decaysList, EMDefinitionStack emit) {
+ EMDefinitionStackMap tree = elementalStacks.toMutable();
+ if (tree.removeAmountExact(emit)) {
+ try {
+ decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), emit));
+ return true;
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean alphaDecay(ArrayList<EMDecay> decaysList) {
+ EMDefinitionStackMap tree = elementalStacks.toMutable();
+ if (tree.removeAllAmountsExact(alpha.getDefinition().getSubParticles())) {
+ try {
+ decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), alpha));
+ return true;
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean MbetaDecay(ArrayList<EMDecay> decaysList) {
+ EMDefinitionStackMap tree = elementalStacks.toMutable();
+ if (tree.removeAmountExact(EMHadronDefinition.hadron_n1)) {
+ try {
+ tree.putUnifyExact(EMHadronDefinition.hadron_p1);
+ decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), EMLeptonDefinition.lepton_e1, EMNeutrinoDefinition.lepton_Ve_1));
+ return true;
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean PbetaDecay(ArrayList<EMDecay> decaysList) {
+ EMDefinitionStackMap tree = elementalStacks.toMutable();
+ if (tree.removeAmountExact(EMHadronDefinition.hadron_p1)) {
+ try {
+ tree.putUnifyExact(EMHadronDefinition.hadron_n1);
+ decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), EMLeptonDefinition.lepton_e_1, EMNeutrinoDefinition.lepton_Ve1));
+ return true;
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean ElectronCapture(ArrayList<EMDecay> decaysList) {
+ EMDefinitionStackMap tree = elementalStacks.toMutable();
+ if (tree.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)) {
+ try {
+ tree.putUnifyExact(EMHadronDefinition.hadron_n1);
+ decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), EMNeutrinoDefinition.lepton_Ve1));
+ return true;
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean Fission(ArrayList<EMDecay> decaysList, EMDefinitionStackMap fissile, EMDefinitionStackMap particles, double probability, boolean spontaneousCheck) {
+ EMDefinitionStackMap heavy = new EMDefinitionStackMap();
+ double[] liquidDrop = liquidDropFunction(Math.abs(getElement())<=97);
+
+ for(EMDefinitionStack stack: fissile.valuesToArray()){
+ if(spontaneousCheck && stack.getDefinition() instanceof EMHadronDefinition &&
+ (stack.getAmount() <=80 || stack.getAmount() <90 && XSTR_INSTANCE.nextInt(10)< stack.getAmount() -80)) {
+ return false;
+ }
+ if(stack.getDefinition().getCharge()==0){
+ //if(stack.definition instanceof dHadronDefinition){
+ double neutrals= stack.getAmount() *liquidDrop[2];
+ int neutrals_cnt=(int)Math.floor(neutrals);
+ neutrals_cnt+=neutrals-neutrals_cnt>XSTR_INSTANCE.nextDouble()?1:0;
+ particles.putUnifyExact(new EMDefinitionStack(stack.getDefinition(), neutrals_cnt));
+
+ int heavy_cnt=(int)Math.ceil(stack.getAmount() *liquidDrop[1]);
+ while(heavy_cnt+neutrals_cnt> stack.getAmount()) {
+ heavy_cnt--;
+ }
+ fissile.removeAmountExact(new EMDefinitionStack(stack.getDefinition(),heavy_cnt+neutrals_cnt));
+ heavy.putReplace(new EMDefinitionStack(stack.getDefinition(), heavy_cnt));
+ //}else{
+ // particles.add(stack);
+ // light.remove(stack.definition);
+ //}
+ }else{
+ int heavy_cnt=(int)Math.ceil(stack.getAmount() *liquidDrop[0]);
+ if(heavy_cnt%2==1 && XSTR_INSTANCE.nextDouble()>0.05D) {
+ heavy_cnt--;
+ }
+ EMDefinitionStack new_stack =new EMDefinitionStack(stack.getDefinition(), heavy_cnt);
+ fissile.removeAmountExact(new_stack);
+ heavy.putReplace(new_stack);
+ }
+ }
+
+ try {
+ particles.putReplace(new EMDefinitionStack(new EMAtomDefinition(fissile.toImmutable_optimized_unsafe_LeavesExposedElementalTree()),1));
+ particles.putReplace(new EMDefinitionStack(new EMAtomDefinition(heavy.toImmutable_optimized_unsafe_LeavesExposedElementalTree()),1));
+ decaysList.add(new EMDecay(probability, particles.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ return true;
+ } catch (Exception e) {
+ if(DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ return false;
+ }
+
+ private static double[] liquidDropFunction(boolean asymmetric) {
+ double[] out = new double[3];
+
+ out[0] = XSTR_INSTANCE.nextGaussian();
+
+ if (out[0] < 1 && out[0] >= -1) {
+ if (XSTR_INSTANCE.nextBoolean()) {
+ out[0] = XSTR_INSTANCE.nextDouble() * 2d - 1d;
+ }
+ }
+
+ if (asymmetric && out[0] > XSTR_INSTANCE.nextDouble() && XSTR_INSTANCE.nextInt(4) == 0) {
+ out[0] = -out[0];
+ }
+
+ //scale to splitting ratio
+ out[0] = out[0] * 0.05d + .6d;
+
+ if (out[0] < 0 || out[0] > 1) {
+ return liquidDropFunction(asymmetric);
+ }
+ if (out[0] < .5d) {
+ out[0] = 1d - out[0];
+ }
+
+ //extra neutrals
+ out[2] = 0.012d + XSTR_INSTANCE.nextDouble() * 0.01d;
+
+ if (asymmetric) {
+ out[1] = out[0];
+ } else {
+ out[1] = out[0] - out[2] * .5d;
+ }
+
+ return out;
+ }
+
+ @Override
+ public EMDecay[] getEnergyInducedDecay(long energyLevel) {
+ if (iaeaDefinitionExistsAndHasEnergyLevels) {
+ ArrayList<EMDecay> decays =new ArrayList<>(4);
+ if(iaeaDecay(decays,energyLevel)){
+ return decays.toArray(EMDecay.NO_PRODUCT);
+ }
+ }
+ if(energyLevel< Math.abs(getCharge())/3+ getNeutralCount()) {
+ return new EMDecay[]{new EMDecay(1, this, boson_Y__)};
+ }
+ return getNaturalDecayInstant();
+ }
+
+ @Override
+ public double getEnergyDiffBetweenStates(long currentEnergyLevel,long newEnergyLevel) {
+ if(iaeaDefinitionExistsAndHasEnergyLevels){
+ double result=0;
+ boolean backwards=newEnergyLevel<currentEnergyLevel;
+ if(backwards){
+ long temp=currentEnergyLevel;
+ currentEnergyLevel=newEnergyLevel;
+ newEnergyLevel=temp;
+ }
+
+ if(currentEnergyLevel<=0){
+ if(newEnergyLevel<=0) {
+ return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel);
+ } else {
+ result += IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * -currentEnergyLevel;
+ }
+ }else {
+ result -= getIaea().getEnergeticStatesArray()[(int) Math.min(getIaea().getEnergeticStatesArray().length - 1, currentEnergyLevel)].energy;
+ }
+ if(newEnergyLevel>= getIaea().getEnergeticStatesArray().length){
+ if(currentEnergyLevel>= getIaea().getEnergeticStatesArray().length) {
+ return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel);
+ } else {
+ result += IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - getIaea().getEnergeticStatesArray().length + 1);
+ }
+ result+= getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length-1].energy;
+ }else {
+ result += getIaea().getEnergeticStatesArray()[(int) newEnergyLevel].energy;
+ }
+
+ return backwards?-result:result;
+ }
+ return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel);
+ }
+
+ @Override
+ public boolean usesSpecialEnergeticDecayHandling() {
+ return iaeaDefinitionExistsAndHasEnergyLevels;
+ }
+
+ @Override
+ public boolean usesMultipleDecayCalls(long energyLevel) {
+ if(!iaeaDefinitionExistsAndHasEnergyLevels) return false;
+ EMNuclideIAEA.energeticState state;
+ if(energyLevel> getIaea().getEnergeticStatesArray().length) {
+ state = getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1];
+ } else if(energyLevel<=0) {
+ state = getIaea().getEnergeticStatesArray()[0];
+ } else {
+ state = getIaea().getEnergeticStatesArray()[(int) energyLevel];
+ }
+ for (EMNuclideIAEA.iaeaDecay decay:state.decaymodes){
+ if(decay.decayName.contains("F")) return true;//if is fissile
+ }
+ return false;
+ }
+
+ @Override
+ public boolean decayMakesEnergy(long energyLevel) {
+ return iaeaDefinitionExistsAndHasEnergyLevels;
+ }
+
+ @Override
+ public boolean fusionMakesEnergy(long energyLevel) {
+ return getIaea() !=null || iaeaDefinitionExistsAndHasEnergyLevels;
+ }
+
+ @Override
+ public EMDecay[] getNaturalDecayInstant() {
+ //disembody
+ ArrayList<EMDefinitionStack> decaysInto = new ArrayList<>();
+ for (EMDefinitionStack elementalStack : elementalStacks.valuesToArray()) {
+ if (elementalStack.getDefinition().getType() == 1 || elementalStack.getDefinition().getType() == -1) {
+ //covers both quarks and antiquarks
+ decaysInto.add(elementalStack);
+ } else {
+ //covers both quarks and antiquarks
+ decaysInto.add(new EMDefinitionStack(boson_Y__, 2));
+ }
+ }
+ return new EMDecay[]{new EMDecay(0.75D, decaysInto.toArray(new EMDefinitionStack[0])), deadEnd};
+ }
+
+ //@Override
+ //public iElementalDefinition getAnti() {
+ // cElementalDefinitionStack[] stacks = this.elementalStacks.values();
+ // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length];
+ // for (int i = 0; i < antiElements.length; i++) {
+ // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount);
+ // }
+ // try {
+ // return new dAtomDefinition(false, antiElements);
+ // } catch (tElementalException e) {
+ // if (DEBUG_MODE) e.printStackTrace();
+ // return null;
+ // }
+ //}
+
+ @Override
+ public EMAtomDefinition getAnti() {
+ EMDefinitionStackMap anti = new EMDefinitionStackMap();
+ for (EMDefinitionStack stack : elementalStacks.valuesToArray()) {
+ anti.putReplace(new EMDefinitionStack(stack.getDefinition().getAnti(), stack.getAmount()));
+ }
+ try {
+ return new EMAtomDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree());
+ } catch (EMException e) {
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+ }
+
+ @Override
+ public EMFluidDequantizationInfo someAmountIntoFluidStack() {
+ return EMTransformationInfo.TRANSFORMATION_INFO.getFluidDequantization().get(this);
+ }
+
+ @Override
+ public EMItemDequantizationInfo someAmountIntoItemsStack() {
+ return EMTransformationInfo.TRANSFORMATION_INFO.getItemDequantization().get(this);
+ }
+
+ @Override
+ public EMOredictDequantizationInfo someAmountIntoOredictStack() {
+ return EMTransformationInfo.TRANSFORMATION_INFO.getOredictDequantization().get(this);
+ }
+
+ public EMNuclideIAEA getIaea() {
+ return iaea;
+ }
+
+ public byte getDecayMode() {
+ return decayMode;
+ }
+
+ public int getNeutralCount() {
+ return neutralCount;
+ }
+
+ public int getElement() {
+ return element;
+ }
+
+ private static final class Nomenclature {
+ private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"};
+ private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"};
+ private static final String[] SYMBOL_IUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"};
+ }
+
+ @Override
+ public NBTTagCompound toNBT() {
+ return getNbtTagCompound(nbtType, elementalStacks);
+ }
+
+ public static EMAtomDefinition fromNBT(NBTTagCompound nbt) {
+ EMDefinitionStack[] stacks = new EMDefinitionStack[nbt.getInteger("i")];
+ for (int i = 0; i < stacks.length; i++) {
+ stacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i)));
+ }
+ try {
+ return new EMAtomDefinition(stacks);
+ } catch (EMException e) {
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+ }
+
+ public static void run() {
+ for (Runnable r : overrides) {
+ r.run();
+ }
+
+ for(Map.Entry<EMAtomDefinition,Double> entry:lifetimeOverrides.entrySet()){
+ try {
+ lifetimeOverrides.put(new EMAtomDefinition(entry.getKey().elementalStacks), entry.getValue());
+ }catch (EMException e){
+ e.printStackTrace(); //Impossible
+ }
+ }
+
+ //populate stable isotopes
+ for (int element = 1; element < 83; element++)//Up to Bismuth exclusive
+ {
+ for (int isotope = 0; isotope < 130; isotope++) {
+ xstr.setSeed((long) (element + 1) * (isotope + 100));
+ //stability curve
+ int StableIsotope = stableIzoCurve(element);
+ int izoDiff = isotope - StableIsotope;
+ int izoDiffAbs = Math.abs(izoDiff);
+ double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false);
+ EMNuclideIAEA nuclide = EMNuclideIAEA.get(element, isotope);
+ if (rawLifeTime >= STABLE_RAW_LIFE_TIME || nuclide != null && nuclide.getHalfTime() >= STABLE_RAW_LIFE_TIME) {
+ TreeSet<Integer> isotopes = stableIsotopes.computeIfAbsent(element, k -> new TreeSet<>());
+ isotopes.add(isotope);
+ }
+ }
+ }
+
+ //populate unstable isotopes
+ for (int element = 83; element < 150; element++) {
+ for (int isotope = 100; isotope < 180; isotope++) {
+ xstr.setSeed((long) (element + 1) * (isotope + 100));
+ //stability curve
+ int Isotope = stableIzoCurve(element);
+ int izoDiff = isotope - Isotope;
+ int izoDiffAbs = Math.abs(izoDiff);
+ double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false);
+ TreeMap<Double, Integer> isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>());
+ isotopes.put(rawLifeTime, isotope);
+ }
+ }
+
+ try {
+ for (Map.Entry<Integer, TreeSet<Integer>> integerTreeSetEntry : stableIsotopes.entrySet()) {
+ stableAtoms.put(integerTreeSetEntry.getKey(), new EMAtomDefinition(
+ new EMDefinitionStack(EMHadronDefinition.hadron_p, integerTreeSetEntry.getKey()),
+ new EMDefinitionStack(EMHadronDefinition.hadron_n, integerTreeSetEntry.getValue().first()),
+ new EMDefinitionStack(EMLeptonDefinition.lepton_e, integerTreeSetEntry.getKey())));
+ if (DEBUG_MODE) {
+ TecTech.LOGGER.info("Added Stable Atom:" + integerTreeSetEntry.getKey() + ' ' + integerTreeSetEntry.getValue().first() + ' ' + stableAtoms.get(integerTreeSetEntry.getKey()).getMass());
+ }
+ }
+ for (Map.Entry<Integer, TreeMap<Double, Integer>> integerTreeMapEntry : mostStableUnstableIsotopes.entrySet()) {
+ unstableAtoms.put(integerTreeMapEntry.getKey(), new EMAtomDefinition(
+ new EMDefinitionStack(EMHadronDefinition.hadron_p, integerTreeMapEntry.getKey()),
+ new EMDefinitionStack(EMHadronDefinition.hadron_n, integerTreeMapEntry.getValue().lastEntry().getValue()),
+ new EMDefinitionStack(EMLeptonDefinition.lepton_e, integerTreeMapEntry.getKey())));
+ if (DEBUG_MODE) {
+ TecTech.LOGGER.info("Added Unstable Atom:" + integerTreeMapEntry.getKey() + ' ' + integerTreeMapEntry.getValue().lastEntry().getValue() + ' ' + unstableAtoms.get(integerTreeMapEntry.getKey()).getMass());
+ }
+ }
+ deuterium=new EMAtomDefinition(
+ EMHadronDefinition.hadron_p1,
+ EMHadronDefinition.hadron_n1,
+ EMLeptonDefinition.lepton_e1).getStackForm(1);
+ tritium=new EMAtomDefinition(
+ EMHadronDefinition.hadron_p1,
+ EMHadronDefinition.hadron_n2,
+ EMLeptonDefinition.lepton_e1).getStackForm(1);
+ helium_3=new EMAtomDefinition(
+ EMHadronDefinition.hadron_p2,
+ EMHadronDefinition.hadron_n1,
+ EMLeptonDefinition.lepton_e2).getStackForm(1);
+ alpha = new EMAtomDefinition(
+ EMHadronDefinition.hadron_p2,
+ EMHadronDefinition.hadron_n2).getStackForm(1);
+ beryllium_8=new EMAtomDefinition(
+ new EMDefinitionStack(EMHadronDefinition.hadron_p, 4),
+ new EMDefinitionStack(EMHadronDefinition.hadron_n, 4),
+ new EMDefinitionStack(EMLeptonDefinition.lepton_e, 4)).getStackForm(1);
+ carbon_14=new EMAtomDefinition(
+ new EMDefinitionStack(EMHadronDefinition.hadron_p, 6),
+ new EMDefinitionStack(EMHadronDefinition.hadron_n, 8),
+ new EMDefinitionStack(EMLeptonDefinition.lepton_e, 6)).getStackForm(1);
+ neon_24=new EMAtomDefinition(
+ new EMDefinitionStack(EMHadronDefinition.hadron_p, 10),
+ new EMDefinitionStack(EMHadronDefinition.hadron_n, 14),
+ new EMDefinitionStack(EMLeptonDefinition.lepton_e, 10)).getStackForm(1);
+ silicon_34=new EMAtomDefinition(
+ new EMDefinitionStack(EMHadronDefinition.hadron_p, 14),
+ new EMDefinitionStack(EMHadronDefinition.hadron_n, 20),
+ new EMDefinitionStack(EMLeptonDefinition.lepton_e, 14)).getStackForm(1);
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+
+ try {
+ EMComplex.addCreatorFromNBT(nbtType, EMAtomDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)64);
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+ if(DEBUG_MODE) {
+ TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + 64);
+ }
+ }
+
+ public static void setTransformation(){
+ /*----STABLE ATOMS----**/
+ refMass = getFirstStableIsotope(1).getMass() * AVOGADRO_CONSTANT_144;
+
+ EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(1), AVOGADRO_CONSTANT_144),Materials.Hydrogen.mGas,144);
+ EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(2), AVOGADRO_CONSTANT_144),Materials.Helium.mGas, 144);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(3), AVOGADRO_CONSTANT_144), dust, Materials.Lithium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(4), AVOGADRO_CONSTANT_144), dust, Materials.Beryllium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(5), AVOGADRO_CONSTANT_144), dust, Materials.Boron,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(6), AVOGADRO_CONSTANT_144), dust, Materials.Carbon,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(7), AVOGADRO_CONSTANT_144),Materials.Nitrogen.mGas, 144);
+ EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(8), AVOGADRO_CONSTANT_144),Materials.Oxygen.mGas, 144);
+ EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(9), AVOGADRO_CONSTANT_144),Materials.Fluorine.mGas, 144);
+ //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Materials.Neon.mGas.getID(), 144);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(11), AVOGADRO_CONSTANT_144), dust, Materials.Sodium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(12), AVOGADRO_CONSTANT_144), dust, Materials.Magnesium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(13), AVOGADRO_CONSTANT_144), dust, Materials.Aluminium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(14), AVOGADRO_CONSTANT_144), dust, Materials.Silicon,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(15), AVOGADRO_CONSTANT_144), dust, Materials.Phosphorus,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(16), AVOGADRO_CONSTANT_144), dust, Materials.Sulfur,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(17), AVOGADRO_CONSTANT_144),Materials.Argon.mGas, 144);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(19), AVOGADRO_CONSTANT_144), dust, Materials.Potassium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(20), AVOGADRO_CONSTANT_144), dust, Materials.Calcium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(21), AVOGADRO_CONSTANT_144), dust, Materials.Scandium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(22), AVOGADRO_CONSTANT_144), dust, Materials.Titanium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(23), AVOGADRO_CONSTANT_144), dust, Materials.Vanadium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(24), AVOGADRO_CONSTANT_144), dust, Materials.Chrome,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(25), AVOGADRO_CONSTANT_144), dust, Materials.Manganese,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(26), AVOGADRO_CONSTANT_144), dust, Materials.Iron,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(27), AVOGADRO_CONSTANT_144), dust, Materials.Cobalt,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(28), AVOGADRO_CONSTANT_144), dust, Materials.Nickel,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(29), AVOGADRO_CONSTANT_144), dust, Materials.Copper,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(30), AVOGADRO_CONSTANT_144), dust, Materials.Zinc,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(31), AVOGADRO_CONSTANT_144), dust, Materials.Gallium,1);
+ //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Germanium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(33), AVOGADRO_CONSTANT_144), dust, Materials.Arsenic,1);
+ //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Selenium,1);
+ //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Bromine,1);
+ //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Krypton,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(37), AVOGADRO_CONSTANT_144), dust, Materials.Rubidium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(38), AVOGADRO_CONSTANT_144), dust, Materials.Strontium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(39), AVOGADRO_CONSTANT_144), dust, Materials.Yttrium,1);
+ //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Zirconium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(41), AVOGADRO_CONSTANT_144), dust, Materials.Niobium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(42), AVOGADRO_CONSTANT_144), dust, Materials.Molybdenum,1);
+ //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Technetium,1);
+ //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Ruthenium,1);
+ //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhodium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(46), AVOGADRO_CONSTANT_144), dust, Materials.Palladium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(47), AVOGADRO_CONSTANT_144), dust, Materials.Silver,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(48), AVOGADRO_CONSTANT_144), dust, Materials.Cadmium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(49), AVOGADRO_CONSTANT_144), dust, Materials.Indium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(50), AVOGADRO_CONSTANT_144), dust, Materials.Tin,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(51), AVOGADRO_CONSTANT_144), dust, Materials.Antimony,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(52), AVOGADRO_CONSTANT_144), dust, Materials.Tellurium,1);
+ //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Iodine,1);
+ //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Materials.Xenon.mGas.getID(), 144);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(55), AVOGADRO_CONSTANT_144), dust, Materials.Caesium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(56), AVOGADRO_CONSTANT_144), dust, Materials.Barium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(57), AVOGADRO_CONSTANT_144), dust, Materials.Lanthanum,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(58), AVOGADRO_CONSTANT_144), dust, Materials.Cerium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(59), AVOGADRO_CONSTANT_144), dust, Materials.Praseodymium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(60), AVOGADRO_CONSTANT_144), dust, Materials.Neodymium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(61), AVOGADRO_CONSTANT_144), dust, Materials.Promethium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(62), AVOGADRO_CONSTANT_144), dust, Materials.Samarium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(63), AVOGADRO_CONSTANT_144), dust, Materials.Europium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(64), AVOGADRO_CONSTANT_144), dust, Materials.Gadolinium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(65), AVOGADRO_CONSTANT_144), dust, Materials.Terbium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(66), AVOGADRO_CONSTANT_144), dust, Materials.Dysprosium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(67), AVOGADRO_CONSTANT_144), dust, Materials.Holmium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(68), AVOGADRO_CONSTANT_144), dust, Materials.Erbium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(69), AVOGADRO_CONSTANT_144), dust, Materials.Thulium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(70), AVOGADRO_CONSTANT_144), dust, Materials.Ytterbium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(71), AVOGADRO_CONSTANT_144), dust, Materials.Lutetium,1);
+ //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Hafnum,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(73), AVOGADRO_CONSTANT_144), dust, Materials.Tantalum,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(74), AVOGADRO_CONSTANT_144), dust, Materials.Tungsten,1);
+ //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhenium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(76), AVOGADRO_CONSTANT_144), dust, Materials.Osmium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(77), AVOGADRO_CONSTANT_144), dust, Materials.Iridium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(78), AVOGADRO_CONSTANT_144), dust, Materials.Platinum,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(79), AVOGADRO_CONSTANT_144), dust, Materials.Gold,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(80), AVOGADRO_CONSTANT_144),Materials.Mercury.mFluid, 144);
+ //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Thallium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getFirstStableIsotope(82), AVOGADRO_CONSTANT_144), dust, Materials.Lead,1);
+
+ /*----UNSTABLE ATOMS----**/
+ refUnstableMass = getFirstStableIsotope(82).getMass() * AVOGADRO_CONSTANT_144;
+
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1);
+ //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Polonium,1);
+ //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Materials.Astatine.mPlasma.getID(), 144);
+ EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getBestUnstableIsotope(86), AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144);
+ //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Francium,1);
+ //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Radium,1);
+ //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Actinium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(90), AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1);
+ //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Protactinium,1);
+ ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Materials.Uranium,1);
+ //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Neptunium,1);
+ ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Materials.Plutonium,1);
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(getBestUnstableIsotope(95), AVOGADRO_CONSTANT_144), dust, Materials.Americium,1);
+
+ try {
+ EMAtomDefinition temp;
+ EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(deuterium.getDefinition(), AVOGADRO_CONSTANT_144),Materials.Deuterium.mGas, 144);
+
+ EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(tritium.getDefinition(), AVOGADRO_CONSTANT_144),Materials.Tritium.mGas, 144);
+
+ EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(helium_3.getDefinition(), AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144);
+
+ temp=new EMAtomDefinition(
+ new EMDefinitionStack(EMLeptonDefinition.lepton_e, 92),
+ new EMDefinitionStack(EMHadronDefinition.hadron_p, 92),
+ new EMDefinitionStack(EMHadronDefinition.hadron_n, 146)
+ );
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium/*238*/,1);
+
+ double tempMass=temp.getMass();
+
+ temp=new EMAtomDefinition(
+ new EMDefinitionStack(EMLeptonDefinition.lepton_e, 92),
+ new EMDefinitionStack(EMHadronDefinition.hadron_p, 92),
+ new EMDefinitionStack(EMHadronDefinition.hadron_n, 143)
+ );
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium235,1);
+
+ TecTech.LOGGER.info("Diff Mass U : "+(tempMass-temp.getMass()));
+
+ temp=new EMAtomDefinition(
+ new EMDefinitionStack(EMLeptonDefinition.lepton_e, 94),
+ new EMDefinitionStack(EMHadronDefinition.hadron_p, 94),
+ new EMDefinitionStack(EMHadronDefinition.hadron_n, 145)
+ );
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium/*239*/,1);
+
+ somethingHeavy=new EMAtomDefinition(
+ new EMDefinitionStack(EMLeptonDefinition.lepton_e, 94),
+ new EMDefinitionStack(EMHadronDefinition.hadron_p, 94),
+ new EMDefinitionStack(EMHadronDefinition.hadron_n, 147)
+ );
+ EMTransformationInfo.TRANSFORMATION_INFO.addOredict(new EMDefinitionStack(somethingHeavy, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium241,1);
+
+ TecTech.LOGGER.info("Diff Mass Pu: "+(somethingHeavy.getMass()-temp.getMass()));
+
+ TecTech.LOGGER.info("Neutron Mass: "+ EMHadronDefinition.hadron_n.getMass());
+
+ } catch (EMException e) {
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ }
+ }
+
+ if(Loader.isModLoaded(Reference.GTPLUSPLUS)) {
+ new GtppAtomLoader().run();
+ }
+ }
+
+ public static EMAtomDefinition getFirstStableIsotope(int element) {
+ return stableAtoms.get(element);
+ }
+
+ public static EMAtomDefinition getBestUnstableIsotope(int element) {
+ return unstableAtoms.get(element);
+ }
+
+ @Override
+ public byte getClassType() {
+ return 64;
+ }
+
+ public static byte getClassTypeStatic(){
+ return 64;
+ }
+
+ @Override
+ public int hashCode() {
+ return hash;
+ }
+
+ @Override
+ public void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel) {
+ if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) {
+ lines.add(getShortSymbol());
+ }
+ }
+
+ @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_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) {
+ lines.add("NAME = "+ getLocalizedName());
+ lines.add("SYMBOL = "+getSymbol());
+ }
+ if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) {
+ lines.add("CHARGE = " + getCharge() / 3D + " e");
+ }
+ if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) {
+ lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR");
+ }
+ if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) {
+ lines.add("MASS = " + getMass() + " eV/c\u00b2");
+ }
+ if(iaeaDefinitionExistsAndHasEnergyLevels && Util.areBitsSet(SCAN_GET_ENERGY_STATES,capabilities)){
+ for(int i = 1; i< getIaea().getEnergeticStatesArray().length; i++){
+ lines.add("E LEVEL "+i+" = "+ getIaea().getEnergeticStatesArray()[i].energy+" eV");
+ }
+ }
+ if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){
+ lines.add("HALF LIFE = "+getRawTimeSpan(energyLevel)+ " s");
+ lines.add(" At current energy level");
+ }
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java
index aa0951d98c..384087770f 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java
@@ -1,16 +1,16 @@
package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex;
import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalDefinitionStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.*;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition;
import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM;
import com.github.technus.tectech.util.Util;
import gregtech.api.enums.Materials;
@@ -22,59 +22,59 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
-import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition.getNbtTagCompound;
+import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition.getNbtTagCompound;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.TRANSFORMATION_INFO;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.TRANSFORMATION_INFO;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__;
import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*;
import static gregtech.api.enums.OrePrefixes.dust;
/**
* Created by danie_000 on 17.11.2016.
*/
-public final class dHadronDefinition extends cElementalDefinition {//TODO Optimize map i/o
+public final class EMHadronDefinition extends EMComplex {//TODO Optimize map i/o
private final int hash;
- private static final byte nbtType = (byte) 'h';
+ private static final byte nbtType = (byte) 'h';
//Helpers
- public static final Map<dHadronDefinition,String> SYMBOL_MAP =new HashMap<>();
- public static final Map<dHadronDefinition,String> NAME_MAP =new HashMap<>();
- public static dHadronDefinition hadron_p, hadron_n, hadron_p_, hadron_n_;
- public static cElementalDefinitionStack hadron_p1, hadron_n1, hadron_p2, hadron_n2, hadron_p3, hadron_n3, hadron_p5;
+ public static final Map<EMHadronDefinition,String> SYMBOL_MAP =new HashMap<>();
+ public static final Map<EMHadronDefinition,String> NAME_MAP =new HashMap<>();
+ public static EMHadronDefinition hadron_p, hadron_n, hadron_p_, hadron_n_;
+ public static EMDefinitionStack hadron_p1, hadron_n1, hadron_p2, hadron_n2, hadron_p3, hadron_n3, hadron_p5;
private static double protonMass = 0D;
private static double neutronMass = 0D;
private static final double actualProtonMass=938272081.3D;
private static final double actualNeutronMass=939565413.3D;
//float-mass in eV/c^2
- public final double mass;
+ private final double mass;
//int -electric charge in 1/3rds of electron charge for optimization
- public final int charge;
- public final double rawLifeTime;
- public final int amount;
+ private final int charge;
+ private final double rawLifeTime;
+ private final int amount;
//generation max present inside - minus if contains any antiquark
- public final byte type;
+ private final byte type;
//private final FluidStack fluidThing;
//private final ItemStack itemThing;
- private final cElementalConstantStackMap quarkStacks;
+ private final EMConstantStackMap quarkStacks;
- public dHadronDefinition(cElementalDefinitionStack... quarks) throws tElementalException {
- this(true, new cElementalConstantStackMap(quarks));
+ public EMHadronDefinition(EMDefinitionStack... quarks) throws EMException {
+ this(true, new EMConstantStackMap(quarks));
}
- private dHadronDefinition(boolean check, cElementalDefinitionStack... quarks) throws tElementalException {
- this(check, new cElementalConstantStackMap(quarks));
+ private EMHadronDefinition(boolean check, EMDefinitionStack... quarks) throws EMException {
+ this(check, new EMConstantStackMap(quarks));
}
- public dHadronDefinition(cElementalConstantStackMap quarks) throws tElementalException {
+ public EMHadronDefinition(EMConstantStackMap quarks) throws EMException {
this(true, quarks);
}
- private dHadronDefinition(boolean check, cElementalConstantStackMap quarks) throws tElementalException {
+ private EMHadronDefinition(boolean check, EMConstantStackMap quarks) throws EMException {
if (check && !canTheyBeTogether(quarks)) {
- throw new tElementalException("Hadron Definition error");
+ throw new EMException("Hadron Definition error");
}
quarkStacks = quarks;
@@ -83,34 +83,34 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi
int type = 0;
boolean containsAnti = false;
double mass = 0;
- for (cElementalDefinitionStack quarkStack : quarkStacks.valuesToArray()) {
- amount += quarkStack.amount;
- if((int)quarkStack.amount!=quarkStack.amount){
+ for (EMDefinitionStack quarkStack : quarkStacks.valuesToArray()) {
+ amount += quarkStack.getAmount();
+ if((int) quarkStack.getAmount() != quarkStack.getAmount()){
throw new ArithmeticException("Amount cannot be safely converted to int!");
}
mass += quarkStack.getMass();
charge += quarkStack.getCharge();
- type = Math.max(Math.abs(quarkStack.definition.getType()), type);
- if (quarkStack.definition.getType() < 0) {
+ type = Math.max(Math.abs(quarkStack.getDefinition().getType()), type);
+ if (quarkStack.getDefinition().getType() < 0) {
containsAnti = true;
}
}
this.amount = amount;
this.charge = charge;
this.type = containsAnti ? (byte) -type : (byte) type;
- long mult = this.amount * this.amount * (this.amount - 1);
+ long mult = this.getAmount() * this.getAmount() * (this.getAmount() - 1);
mass = mass * 5.543D * mult;//yes it becomes heavier
- if (mass == protonMass && this.amount == 3) {
- rawLifeTime = iElementalDefinition.STABLE_RAW_LIFE_TIME;
+ if (mass == protonMass && this.getAmount() == 3) {
+ rawLifeTime = IEMDefinition.STABLE_RAW_LIFE_TIME;
mass=actualProtonMass;
- } else if (mass == neutronMass && this.amount == 3) {
+ } else if (mass == neutronMass && this.getAmount() == 3) {
rawLifeTime = 882D;
mass=actualNeutronMass;
} else {
- if (this.amount == 3) {
+ if (this.getAmount() == 3) {
rawLifeTime = 1.34D / mass * Math.pow(9.81, charge);
- } else if (this.amount == 2) {
+ } else if (this.getAmount() == 2) {
rawLifeTime = 1.21D / mass / Math.pow(19.80, charge);
} else {
rawLifeTime = 1.21D / mass / Math.pow(9.80, charge);
@@ -121,37 +121,37 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi
}
//public but u can just try{}catch(){} the constructor it still calls this method
- private static boolean canTheyBeTogether(cElementalConstantStackMap stacks) {
+ private static boolean canTheyBeTogether(EMConstantStackMap stacks) {
long amount = 0;
- for (cElementalDefinitionStack quarks : stacks.valuesToArray()) {
- if (!(quarks.definition instanceof eQuarkDefinition)) {
+ for (EMDefinitionStack quarks : stacks.valuesToArray()) {
+ if (!(quarks.getDefinition() instanceof EMQuarkDefinition)) {
return false;
}
- if((int)quarks.amount!=quarks.amount){
+ if((int) quarks.getAmount() != quarks.getAmount()){
throw new ArithmeticException("Amount cannot be safely converted to int!");
}
- amount += quarks.amount;
+ amount += quarks.getAmount();
}
return amount >= 2 && amount <= 12;
}
@Override
- public String getName() {
+ public String getLocalizedName() {
StringBuilder name= new StringBuilder(getSimpleName());
name.append(':');
String sym= NAME_MAP.get(this);
if(sym!=null){
name.append(' ').append(sym);
}else {
- for (cElementalDefinitionStack quark : quarkStacks.valuesToArray()) {
- name.append(' ').append(quark.definition.getSymbol()).append((int)quark.amount);
+ for (EMDefinitionStack quark : quarkStacks.valuesToArray()) {
+ name.append(' ').append(quark.getDefinition().getSymbol()).append((int) quark.getAmount());
}
}
return name.toString();
}
private String getSimpleName() {
- switch (amount) {
+ switch (getAmount()) {
case 2:
return "Meson";
case 3:
@@ -174,9 +174,9 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi
return sym;
}else {
StringBuilder symbol = new StringBuilder(8);
- for (cElementalDefinitionStack quark : quarkStacks.valuesToArray()) {
- for (int i = 0; i < quark.amount; i++) {
- symbol.append(quark.definition.getSymbol());
+ for (EMDefinitionStack quark : quarkStacks.valuesToArray()) {
+ for (int i = 0; i < quark.getAmount(); i++) {
+ symbol.append(quark.getDefinition().getSymbol());
}
}
return symbol.toString();
@@ -190,9 +190,9 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi
return sym;
}else {
StringBuilder symbol = new StringBuilder(8);
- for (cElementalDefinitionStack quark : quarkStacks.valuesToArray()) {
- for (int i = 0; i < quark.amount; i++) {
- symbol.append(quark.definition.getShortSymbol());
+ for (EMDefinitionStack quark : quarkStacks.valuesToArray()) {
+ for (int i = 0; i < quark.getAmount(); i++) {
+ symbol.append(quark.getDefinition().getShortSymbol());
}
}
return symbol.toString();
@@ -205,44 +205,44 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi
}
@Override
- public cElementalConstantStackMap getSubParticles() {
+ public EMConstantStackMap getSubParticles() {
return quarkStacks;
}
@Override
- public cElementalDecay[] getNaturalDecayInstant() {
- cElementalDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray();
- if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) {
- return cElementalDecay.noProduct;
+ public EMDecay[] getNaturalDecayInstant() {
+ EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray();
+ if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getType() == -quarkStacks[1].getDefinition().getType()) {
+ return EMDecay.NO_PRODUCT;
}
- ArrayList<cElementalDefinitionStack> decaysInto = new ArrayList<>();
- for (cElementalDefinitionStack quarks : quarkStacks) {
- if (quarks.definition.getType() == 1 || quarks.definition.getType() == -1) {
+ ArrayList<EMDefinitionStack> decaysInto = new ArrayList<>();
+ for (EMDefinitionStack quarks : quarkStacks) {
+ if (quarks.getDefinition().getType() == 1 || quarks.getDefinition().getType() == -1) {
//covers both quarks and antiquarks
decaysInto.add(quarks);
} else {
//covers both quarks and antiquarks
- decaysInto.add(new cElementalDefinitionStack(boson_Y__, 2));
+ decaysInto.add(new EMDefinitionStack(boson_Y__, 2));
}
}
- return new cElementalDecay[]{
- new cElementalDecay(0.75D, decaysInto.toArray(new cElementalDefinitionStack[0])),
- eBosonDefinition.deadEnd
+ return new EMDecay[]{
+ new EMDecay(0.75D, decaysInto.toArray(new EMDefinitionStack[0])),
+ EMBosonDefinition.deadEnd
};
}
@Override
- public cElementalDecay[] getEnergyInducedDecay(long energyLevel) {
- cElementalDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray();
- if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) {
- return cElementalDecay.noProduct;
+ public EMDecay[] getEnergyInducedDecay(long energyLevel) {
+ EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray();
+ if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getType() == -quarkStacks[1].getDefinition().getType()) {
+ return EMDecay.NO_PRODUCT;
}
- return new cElementalDecay[]{new cElementalDecay(0.75D, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks
+ return new EMDecay[]{new EMDecay(0.75D, quarkStacks), EMBosonDefinition.deadEnd}; //decay into quarks
}
@Override
public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) {
- return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel);
+ return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel);
}
@Override
@@ -266,49 +266,49 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi
}
@Override
- public cElementalDecay[] getDecayArray() {
- cElementalDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray();
- if (amount == 2 && quarkStacks.length == 2 &&
- quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() &&
- quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) {
- return cElementalDecay.noProduct;
- } else if (amount != 3) {
- return new cElementalDecay[]{new cElementalDecay(0.95D, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks
+ public EMDecay[] getDecayArray() {
+ EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray();
+ if (getAmount() == 2 && quarkStacks.length == 2 &&
+ quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() &&
+ quarkStacks[0].getDefinition().getType() == -quarkStacks[1].getDefinition().getType()) {
+ return EMDecay.NO_PRODUCT;
+ } else if (getAmount() != 3) {
+ return new EMDecay[]{new EMDecay(0.95D, quarkStacks), EMBosonDefinition.deadEnd}; //decay into quarks
} else {
- ArrayList<eQuarkDefinition> newBaryon = new ArrayList<>();
- iElementalDefinition[] Particles = new iElementalDefinition[2];
- for (cElementalDefinitionStack quarks : quarkStacks) {
- for (int i = 0; i < quarks.amount; i++) {
- newBaryon.add((eQuarkDefinition) quarks.definition);
+ ArrayList<EMQuarkDefinition> newBaryon = new ArrayList<>();
+ IEMDefinition[] Particles = new IEMDefinition[2];
+ for (EMDefinitionStack quarks : quarkStacks) {
+ for (int i = 0; i < quarks.getAmount(); i++) {
+ newBaryon.add((EMQuarkDefinition) quarks.getDefinition());
}
}
//remove last
- eQuarkDefinition lastQuark = newBaryon.remove(2);
+ EMQuarkDefinition lastQuark = newBaryon.remove(2);
- cElementalDefinitionStack[] decay;
+ EMDefinitionStack[] decay;
if (Math.abs(lastQuark.getType()) > 1) {
- decay = lastQuark.getDecayArray()[1].outputStacks.valuesToArray();
+ decay = lastQuark.getDecayArray()[1].getOutputStacks().valuesToArray();
} else {
- decay = lastQuark.getDecayArray()[2].outputStacks.valuesToArray();
+ decay = lastQuark.getDecayArray()[2].getOutputStacks().valuesToArray();
}
- newBaryon.add((eQuarkDefinition) decay[0].definition);
- Particles[0] = decay[1].definition;
- Particles[1] = decay[2].definition;
+ newBaryon.add((EMQuarkDefinition) decay[0].getDefinition());
+ Particles[0] = decay[1].getDefinition();
+ Particles[1] = decay[2].getDefinition();
- cElementalDefinitionStack[] contentOfBaryon = newBaryon.stream()
- .map(eQuarkDefinition -> new cElementalDefinitionStack(eQuarkDefinition,1))
- .toArray(cElementalDefinitionStack[]::new);
+ EMDefinitionStack[] contentOfBaryon = newBaryon.stream()
+ .map(eQuarkDefinition -> new EMDefinitionStack(eQuarkDefinition,1))
+ .toArray(EMDefinitionStack[]::new);
try {
- return new cElementalDecay[]{
- new cElementalDecay(0.001D, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1], boson_Y__),
- new cElementalDecay(0.99D, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]),
- eBosonDefinition.deadEnd};
- } catch (tElementalException e) {
+ return new EMDecay[]{
+ new EMDecay(0.001D, new EMHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1], boson_Y__),
+ new EMDecay(0.99D, new EMHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]),
+ EMBosonDefinition.deadEnd};
+ } catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
}
- return new cElementalDecay[]{eBosonDefinition.deadEnd};
+ return new EMDecay[]{EMBosonDefinition.deadEnd};
}
}
}
@@ -325,7 +325,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi
@Override
public double getRawTimeSpan(long currentEnergy) {
- return rawLifeTime;
+ return getRawLifeTime();
}
@Override
@@ -354,14 +354,14 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi
//}
@Override
- public iElementalDefinition getAnti() {
- cElementalDefinitionStackMap anti = new cElementalDefinitionStackMap();
- for (cElementalDefinitionStack stack : quarkStacks.valuesToArray()) {
- anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount));
+ public IEMDefinition getAnti() {
+ EMDefinitionStackMap anti = new EMDefinitionStackMap();
+ for (EMDefinitionStack stack : quarkStacks.valuesToArray()) {
+ anti.putReplace(new EMDefinitionStack(stack.getDefinition().getAnti(), stack.getAmount()));
}
try {
- return new dHadronDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree());
- } catch (tElementalException e) {
+ return new EMHadronDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree());
+ } catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
}
@@ -370,17 +370,17 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi
}
@Override
- public aFluidDequantizationInfo someAmountIntoFluidStack() {
+ public EMFluidDequantizationInfo someAmountIntoFluidStack() {
return null;
}
@Override
- public aItemDequantizationInfo someAmountIntoItemsStack() {
+ public EMItemDequantizationInfo someAmountIntoItemsStack() {
return null;
}
@Override
- public aOredictDequantizationInfo someAmountIntoOredictStack() {
+ public EMOredictDequantizationInfo someAmountIntoOredictStack() {
return null;
}
@@ -389,14 +389,14 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi
return getNbtTagCompound(nbtType, quarkStacks);
}
- public static dHadronDefinition fromNBT(NBTTagCompound nbt) {
- cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[nbt.getInteger("i")];
+ public static EMHadronDefinition fromNBT(NBTTagCompound nbt) {
+ EMDefinitionStack[] stacks = new EMDefinitionStack[nbt.getInteger("i")];
for (int i = 0; i < stacks.length; i++) {
- stacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i)));
+ stacks[i] = EMDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i)));
}
try {
- return new dHadronDefinition(stacks);
- } catch (tElementalException e) {
+ return new EMHadronDefinition(stacks);
+ } catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
}
@@ -406,45 +406,45 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi
public static void run() {
try {
- hadron_p = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1)));
- protonMass = hadron_p.mass;
+ hadron_p = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1)));
+ protonMass = hadron_p.getMass();
//redefine the proton with proper lifetime (the lifetime is based on mass comparison)
- hadron_p = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1)));
+ hadron_p = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1)));
SYMBOL_MAP.put(hadron_p,"p");
NAME_MAP.put(hadron_p,"Proton");
DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p);
- hadron_p_ = (dHadronDefinition) hadron_p.getAnti();
+ hadron_p_ = (EMHadronDefinition) hadron_p.getAnti();
SYMBOL_MAP.put(hadron_p_,"~p");
NAME_MAP.put(hadron_p_,"Anti Proton");
DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p_);
- hadron_n = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2)));
- neutronMass = hadron_n.mass;
+ hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2)));
+ neutronMass = hadron_n.getMass();
//redefine the neutron with proper lifetime (the lifetime is based on mass comparison)
- hadron_n = new dHadronDefinition(new cElementalConstantStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2)));
+ hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2)));
SYMBOL_MAP.put(hadron_n, "n");
NAME_MAP.put(hadron_n, "Neutron");
DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n);
- hadron_n_ = (dHadronDefinition) hadron_n.getAnti();
+ hadron_n_ = (EMHadronDefinition) hadron_n.getAnti();
SYMBOL_MAP.put(hadron_n_,"~n");
NAME_MAP.put(hadron_n_,"Anti Neutron");
DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n_);
- } catch (tElementalException e) {
+ } catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
}
protonMass = -1;
neutronMass = -1;
}
- hadron_p1 = new cElementalDefinitionStack(hadron_p, 1D);
- hadron_n1 = new cElementalDefinitionStack(hadron_n, 1D);
- hadron_p2 = new cElementalDefinitionStack(hadron_p, 2D);
- hadron_n2 = new cElementalDefinitionStack(hadron_n, 2D);
- hadron_p3 = new cElementalDefinitionStack(hadron_p, 3D);
- hadron_n3 = new cElementalDefinitionStack(hadron_n, 3D);
- hadron_p5 = new cElementalDefinitionStack(hadron_p, 5D);
+ hadron_p1 = new EMDefinitionStack(hadron_p, 1D);
+ hadron_n1 = new EMDefinitionStack(hadron_n, 1D);
+ hadron_p2 = new EMDefinitionStack(hadron_p, 2D);
+ hadron_n2 = new EMDefinitionStack(hadron_n, 2D);
+ hadron_p3 = new EMDefinitionStack(hadron_p, 3D);
+ hadron_n3 = new EMDefinitionStack(hadron_n, 3D);
+ hadron_p5 = new EMDefinitionStack(hadron_p, 5D);
try {
- cElementalDefinition.addCreatorFromNBT(nbtType, dHadronDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-64);
+ EMComplex.addCreatorFromNBT(nbtType, EMHadronDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-64);
} catch (Exception e) {
if (DEBUG_MODE) {
e.printStackTrace();
@@ -457,11 +457,11 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi
public static void setTransformations(){
//Added to atom map, but should be in its own
- cElementalDefinitionStack neutrons=new cElementalDefinitionStack(hadron_n, 1000* AVOGADRO_CONSTANT_144);
- TRANSFORMATION_INFO.oredictDequantization.put(neutrons.definition,new aOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1));
- TRANSFORMATION_INFO.oredictQuantization.put(
+ EMDefinitionStack neutrons =new EMDefinitionStack(hadron_n, 1000* AVOGADRO_CONSTANT_144);
+ TRANSFORMATION_INFO.getOredictDequantization().put(neutrons.getDefinition(),new EMOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1));
+ TRANSFORMATION_INFO.getOredictQuantization().put(
OreDictionary.getOreID(OrePrefixes.ingotHot.name()+Materials.Neutronium.mName),
- new aOredictQuantizationInfo(OrePrefixes.ingotHot,Materials.Neutronium,1 ,neutrons)
+ new EMOredictQuantizationInfo(OrePrefixes.ingotHot,Materials.Neutronium,1 ,neutrons)
);
}
@@ -509,4 +509,12 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi
lines.add(" "+"At current energy level");
}
}
+
+ public double getRawLifeTime() {
+ return rawLifeTime;
+ }
+
+ public int getAmount() {
+ return amount;
+ }
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMNuclideIAEA.java
index 8b09bfd2e0..9a22f54941 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMNuclideIAEA.java
@@ -7,10 +7,10 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.TreeMap;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.STABLE_RAW_LIFE_TIME;
import static com.github.technus.tectech.util.Util.splitButDifferent;
-public final class iaeaNuclide {
+public final class EMNuclideIAEA {
public static final double AMU_TO_EV_DIV_C_C=9.31494061E08D,MICRO_AMU_TO_EV_DIV_C_C=9.31494061E02D;
//Nuclide T1/2 T1/2 [s] Decay Modes ? Q Q?- Q? QEC Q?- n Sn Sp Binding/A Atomic Mass Mass Excess Discovery
@@ -18,13 +18,13 @@ public final class iaeaNuclide {
//Z,N,symb,radius, unc, energy, unc, jp, half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quad , unc,Qb-,unc,Qb- n,unc,Qa, unc, Qec, unc,Sn,unc, Sp,unc,Binding/A,unc,atomic mass, unc, mass excess,unc,
//Z,N,symbol,energy , unc, jp,half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quadrupole , unc,
- private static final HashMap<Integer,iaeaNuclide> NUCLIDES=new HashMap<>();
+ private static final HashMap<Integer, EMNuclideIAEA> NUCLIDES =new HashMap<>();
public static void run(){
String line="";
try {
- BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("nuclides.csv")));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(EMNuclideIAEA.class.getResourceAsStream("nuclides.csv")));
ArrayList<String[]> blockOfData=new ArrayList<>(4);
while((line=reader.readLine())!=null) {
String[] split= splitButDifferent(line,",");
@@ -32,13 +32,13 @@ public final class iaeaNuclide {
throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuclides database " + line);
}
if(!split[1].isEmpty() && !blockOfData.isEmpty()) {
- new iaeaNuclide(blockOfData.toArray(new String[blockOfData.size()][]));
+ new EMNuclideIAEA(blockOfData.toArray(new String[blockOfData.size()][]));
blockOfData.clear();
}
blockOfData.add(split);
}
if(!blockOfData.isEmpty()) {
- new iaeaNuclide(blockOfData.toArray(new String[blockOfData.size()][]));
+ new EMNuclideIAEA(blockOfData.toArray(new String[blockOfData.size()][]));
blockOfData.clear();
}
reader.close();
@@ -48,7 +48,7 @@ public final class iaeaNuclide {
}
try {
- BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("nuclidesTable.csv")));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(EMNuclideIAEA.class.getResourceAsStream("nuclidesTable.csv")));
while((line=reader.readLine())!=null) {
String[] split= splitButDifferent(line,",");
if(split.length!=47) {
@@ -63,7 +63,7 @@ public final class iaeaNuclide {
}
try {
- BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("energyLevels.csv")));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(EMNuclideIAEA.class.getResourceAsStream("energyLevels.csv")));
while((line=reader.readLine())!=null) {
String[] split= splitButDifferent(line,",");
if(split.length!=27) {
@@ -77,27 +77,28 @@ public final class iaeaNuclide {
e.printStackTrace();
}
- for(iaeaNuclide nuclide:NUCLIDES.values()) {
+ for(EMNuclideIAEA nuclide:NUCLIDES.values()) {
nuclide.makeArrayOfEnergyStates();
}
}
- public static iaeaNuclide get(int protons, int neutrons){
+ public static EMNuclideIAEA get(int protons, int neutrons){
return NUCLIDES.get((protons<<16)+neutrons);
}
- public final short N,Z;
- public final double halfTime;//sec
- public final double mass;//eV/c^2
- public final short discovery;//year
- private TreeMap<Double,energeticState> energeticStates;
- public energeticState[] energeticStatesArray;
+ private final short N;
+ private final short Z;
+ private final double halfTime;//sec
+ private final double mass;//eV/c^2
+ private final short discovery;//year
+ private TreeMap<Double,energeticState> energeticStates;
+ private energeticState[] energeticStatesArray;
- private iaeaNuclide(String[][] rows){
+ private EMNuclideIAEA(String[][] rows){
N=Short.parseShort(rows[1][2]);
Z=Short.parseShort(rows[1][0]);
- NUCLIDES.put(((int)Z <<16)+N,this);
+ NUCLIDES.put(((int) getZ() <<16)+ getN(),this);
String[] parts = splitButDifferent(rows[0][16], "|");
double Mass=doubleOrNaN(parts[0],"mass");
@@ -125,7 +126,7 @@ public final class iaeaNuclide {
// if (add(cells[17])) System.out.println(N + " " + Z);
// if (add(cells[20])) System.out.println(N + " " + Z);
//}
- new energeticState(this, halfTime, getDecaysFixed(
+ new energeticState(this, getHalfTime(), getDecaysFixed(
cells[14],
doubleOrNaN(cells[15],"chance1"),
cells[17],
@@ -137,11 +138,11 @@ public final class iaeaNuclide {
private static final energeticState[] empty=new energeticState[0];
private void makeArrayOfEnergyStates(){
if(energeticStates==null || energeticStates.isEmpty()) {
- energeticStatesArray = empty;
+ setEnergeticStatesArray(empty);
} else {
- energeticStatesArray = energeticStates.values().toArray(new energeticState[0]);
- double life=halfTime;
- for (energeticState energeticState : energeticStatesArray) {
+ setEnergeticStatesArray(energeticStates.values().toArray(new energeticState[0]));
+ double life= getHalfTime();
+ for (energeticState energeticState : getEnergeticStatesArray()) {
if(Double.isNaN(energeticState.Thalf)){
energeticState.Thalf=life;
}else {
@@ -161,19 +162,47 @@ public final class iaeaNuclide {
}
return value != 0 ?value:Double.NaN;
} catch (Exception e) {
- System.out.println("Invalid Value " + name + ' ' + N + ' ' + Z + ' ' + s);
+ System.out.println("Invalid Value " + name + ' ' + getN() + ' ' + getZ() + ' ' + s);
e.printStackTrace();
}
}
return Double.NaN;
}
+ public short getN() {
+ return N;
+ }
+
+ public short getZ() {
+ return Z;
+ }
+
+ public double getHalfTime() {
+ return halfTime;
+ }
+
+ public double getMass() {
+ return mass;
+ }
+
+ public short getDiscovery() {
+ return discovery;
+ }
+
+ public energeticState[] getEnergeticStatesArray() {
+ return energeticStatesArray;
+ }
+
+ public void setEnergeticStatesArray(energeticState[] energeticStatesArray) {
+ this.energeticStatesArray = energeticStatesArray;
+ }
+
public static final class energeticState{
public final double energy;
public double Thalf;
public final iaeaDecay[] decaymodes;
- private energeticState(iaeaNuclide nuclide,double Thalf,iaeaDecay[] decaymodes){
+ private energeticState(EMNuclideIAEA nuclide, double Thalf, iaeaDecay[] decaymodes){
energy=0;
this.Thalf=Thalf;
this.decaymodes=decaymodes;
@@ -184,17 +213,17 @@ public final class iaeaNuclide {
}
private energeticState(String[] cells){
- iaeaNuclide nuclide= get((int)doubleOrNaN(cells[0],"protons"),(int)doubleOrNaN(cells[1],"neutrons"));
+ EMNuclideIAEA nuclide = get((int)doubleOrNaN(cells[0],"protons"),(int)doubleOrNaN(cells[1],"neutrons"));
if(nuclide==null) {
throw new Error("Missing nuclide " + (int) doubleOrNaN(cells[0], "protons") + ' ' + (int) doubleOrNaN(cells[1], "neutrons"));
}
energy =doubleOrNaN(cells[3],"energy level",nuclide)*1000D;//to eV
if(energy<0) {
- throw new Error("Invalid energy " + nuclide.N + ' ' + nuclide.Z + ' ' + cells[3]);
+ throw new Error("Invalid energy " + nuclide.getN() + ' ' + nuclide.getZ() + ' ' + cells[3]);
}
Thalf =doubleOrNaN(cells[10],"half life",nuclide);
if(nuclide.energeticStates==null) {
- new Exception("Should be initialized before doing this... "+ nuclide.N + ' ' +nuclide.Z).printStackTrace();
+ new Exception("Should be initialized before doing this... "+ nuclide.getN() + ' ' + nuclide.getZ()).printStackTrace();
nuclide.energeticStates = new TreeMap<>();
}
nuclide.energeticStates.put(energy,this);
@@ -216,7 +245,7 @@ public final class iaeaNuclide {
return doubleOrNaN(s,name,null);
}
- private double doubleOrNaN(String s, String name, iaeaNuclide nuclide){
+ private double doubleOrNaN(String s, String name, EMNuclideIAEA nuclide){
s = s.replaceAll("#", "");
if (!s.isEmpty()) {
try {
@@ -225,7 +254,7 @@ public final class iaeaNuclide {
if(nuclide==null){
System.out.println("Invalid Value " + name + ' ' + s);
}else {
- System.out.println("Invalid Value " + name + ' ' + nuclide.N + ' ' + nuclide.Z + ' ' + s);
+ System.out.println("Invalid Value " + name + ' ' + nuclide.getN() + ' ' + nuclide.getZ() + ' ' + s);
}
e.printStackTrace();
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java
deleted file mode 100644
index 291ec8fe6b..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java
+++ /dev/null
@@ -1,1678 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex;
-
-import com.github.technus.tectech.Reference;
-import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader;
-import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalDefinitionStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition;
-import com.github.technus.tectech.util.Util;
-import com.github.technus.tectech.util.XSTR;
-import cpw.mods.fml.common.Loader;
-import gregtech.api.enums.Materials;
-import net.minecraft.nbt.NBTTagCompound;
-
-import java.util.*;
-
-import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition.getNbtTagCompound;
-import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd;
-import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*;
-import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE;
-import static gregtech.api.enums.OrePrefixes.dust;
-
-/**
- * Created by danie_000 on 18.11.2016.
- */
-public final class dAtomDefinition extends cElementalDefinition {
- public static final long ATOM_COMPLEXITY_LIMIT=65536L;
- private static final byte BYTE_OFFSET=32;
-
- private final int hash;
- public static double refMass, refUnstableMass;
-
- private static final byte nbtType = (byte) 'a';
- private static final Random xstr = new XSTR();//NEEDS SEPARATE!
- private static Map<Integer, TreeSet<Integer>> stableIsotopes = new HashMap<>();
- private static final Map<Integer, dAtomDefinition> stableAtoms = new HashMap<>();
- private static Map<Integer, TreeMap<Double, Integer>> mostStableUnstableIsotopes = new HashMap<>();
- private static final Map<Integer, dAtomDefinition> unstableAtoms = new HashMap<>();
- private static cElementalDefinitionStack alpha,deuterium,tritium,helium_3,beryllium_8,carbon_14,neon_24,silicon_34;
- private static final HashMap<dAtomDefinition,Double> lifetimeOverrides = new HashMap<>();
-
- public final iaeaNuclide iaea;
-
- private static dAtomDefinition somethingHeavy;
- public static dAtomDefinition getSomethingHeavy() {
- return somethingHeavy;
- }
-
- private static final ArrayList<Runnable> overrides = new ArrayList<>();
- public static void addOverride(dAtomDefinition atom, double rawLifeTime){
- lifetimeOverrides.put(atom,rawLifeTime);
- }
-
- //float-mass in eV/c^2
- public final double mass;
- //public final int charge;
- public final int charge;
- //int -electric charge in 1/3rds of electron charge for optimization
- public final int chargeLeptons;
- private double rawLifeTime;
- //generation max present inside - minus if contains any anti quark
- public final byte type;
-
- public final byte decayMode;//t neutron to proton+,0,f proton to neutron
- //public final boolean stable;
-
- public final int neutralCount;
- public final int element;
-
- private final boolean iaeaDefinitionExistsAndHasEnergyLevels;
-
- private final cElementalConstantStackMap elementalStacks;
-
- //stable is rawLifeTime>=10^9
-
- public dAtomDefinition(cElementalDefinitionStack... things) throws tElementalException {
- this(true, new cElementalConstantStackMap(things));
- }
-
- private dAtomDefinition(boolean check, cElementalDefinitionStack... things) throws tElementalException {
- this(check, new cElementalConstantStackMap(things));
- }
-
- public dAtomDefinition(cElementalConstantStackMap things) throws tElementalException {
- this(true, things);
- }
-
- private dAtomDefinition(boolean check, cElementalConstantStackMap things) throws tElementalException {
- if (check && !canTheyBeTogether(things)) {
- throw new tElementalException("Atom Definition error");
- }
- elementalStacks = things;
-
- double mass = 0;
- int cLeptons = 0;
- int cNucleus = 0;
- int neutralCount = 0, element = 0;
- int type = 0;
- boolean containsAnti = false;
- for (cElementalDefinitionStack stack : elementalStacks.valuesToArray()) {
- iElementalDefinition def = stack.definition;
- int amount = (int)stack.amount;
- if((int)stack.amount!=stack.amount){
- throw new ArithmeticException("Amount cannot be safely converted to int!");
- }
- mass += stack.getMass();
- if (def.getType() < 0) {
- containsAnti = true;
- }
- type = Math.max(type, Math.abs(def.getType()));
-
- if (def instanceof eLeptonDefinition) {
- cLeptons += stack.getCharge();
- } else {
- cNucleus += stack.getCharge();
- if (def.getCharge() == 3) {
- element += amount;
- } else if (def.getCharge() == -3) {
- element -= amount;
- } else if (def.getCharge() == 0) {
- neutralCount += amount;
- }
- }
- }
- this.type = containsAnti ? (byte) -type : (byte) type;
- //this.mass = mass;
- chargeLeptons = cLeptons;
- charge = cNucleus + cLeptons;
- this.neutralCount = neutralCount;
- this.element = element;
-
- element = Math.abs(element);
-
- //stability curve
- int StableIsotope = stableIzoCurve(element);
- int izoDiff = neutralCount - StableIsotope;
- int izoDiffAbs = Math.abs(izoDiff);
-
- xstr.setSeed((element + 1L) * (neutralCount + 100L));
- iaea =iaeaNuclide.get(element,neutralCount);
- if(iaea!=null){
- if(Double.isNaN(iaea.mass)) {
- this.mass = mass;
- } else {
- this.mass = iaea.mass;
- }
-
- if(Double.isNaN(iaea.halfTime)) {
- Double overriddenLifeTime= lifetimeOverrides.get(this);
- double rawLifeTimeTemp;
- if(overriddenLifeTime!=null) {
- rawLifeTimeTemp = overriddenLifeTime;
- } else {
- rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti);
- }
- rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME);
- }else {
- rawLifeTime = containsAnti ? iaea.halfTime * 1.5514433E-21d * (1d + xstr.nextDouble() * 9d) : iaea.halfTime;
- }
- iaeaDefinitionExistsAndHasEnergyLevels =iaea.energeticStatesArray.length>1;
- }else{
- this.mass=mass;
-
- Double overriddenLifeTime= lifetimeOverrides.get(this);
- double rawLifeTimeTemp;
- if(overriddenLifeTime!=null) {
- rawLifeTimeTemp = overriddenLifeTime;
- } else {
- rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti);
- }
- rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME);
-
- iaeaDefinitionExistsAndHasEnergyLevels =false;
- }
-
- if(iaea==null || iaea.energeticStatesArray[0].energy!=0) {
- if (izoDiff == 0) {
- decayMode = 0;
- } else {
- decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) : (byte) -Math.min(2, 1 + izoDiffAbs / 4);
- }
- }else{
- decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4)+ BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET);
- }
- //this.stable = this.rawLifeTime >= STABLE_RAW_LIFE_TIME;
- hash=super.hashCode();
- }
-
- private static int stableIzoCurve(int element) {
- return (int) Math.round(-1.19561E-06D * Math.pow(element, 4D) +
- 1.60885E-04D * Math.pow(element, 3D) +
- 3.76604E-04D * Math.pow(element, 2D) +
- 1.08418E+00D * (double) element);
- }
-
- private static double calculateLifeTime(int izoDiff, int izoDiffAbs, int element, int isotope, boolean containsAnti) {
- double rawLifeTime;
-
- if (element <= 83 && isotope < 127 && (izoDiffAbs == 0 || element == 1 && isotope == 0 || element == 2 && isotope == 1 || izoDiffAbs == 1 && element > 2 && element % 2 == 1 || izoDiffAbs == 3 && element > 30 && element % 2 == 0 || izoDiffAbs == 5 && element > 30 && element % 2 == 0 || izoDiffAbs == 2 && element > 20 && element % 2 == 1)) {
- rawLifeTime = (1D + xstr.nextDouble() * 9D) * (containsAnti ? 2.381e4D : 1.5347e25D);
- } else {
- //Y = (X-A)/(B-A) * (D-C) + C
- double unstabilityEXP;
- if (element == 0) {
- return 1e-35D;
- } else if (element == 1) {
- unstabilityEXP = 1.743D - Math.abs(izoDiff - 1) * 9.743D;
- } else if (element == 2) {
- switch (isotope) {
- case 4:
- unstabilityEXP = 1.61D;
- break;
- case 5:
- unstabilityEXP = -7.523D;
- break;
- case 6:
- unstabilityEXP = -1.51D;
- break;
- default:
- unstabilityEXP = -(izoDiffAbs * 6.165D);
- break;
- }
- } else if (element <= 83 || isotope <= 127 && element <= 120) {
- double elementPow4 = Math.pow(element, 4);
-
- unstabilityEXP = Math.min(element / 2.4D, 6 + ((element + 1) % 2) * 3e6D / elementPow4) + -izoDiff * elementPow4 / 1e8D - Math.abs(izoDiff - 1 + element / 60D) * (3D - element / 12.5D + element * element / 1500D);
- } else if (element < 180) {
- unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5D - (element - 85) / 3D) - Math.abs(izoDiff) * (3D - element / 13D + element * element / 1600D);
- } else {
- return -1;
- }
- if ((isotope == 127 || isotope == 128) && element < 120 && element > 83) {
- unstabilityEXP -= 1.8D;
- }
- if (element > 83 && element < 93 && isotope % 2 == 0 && izoDiff == 3) {
- unstabilityEXP += 6;
- }
- if (element > 93 && element < 103 && isotope % 2 == 0 && izoDiff == 4) {
- unstabilityEXP += 6;
- }
- rawLifeTime = (containsAnti ? 1e-8D : 1) * Math.pow(10D, unstabilityEXP) * (1D + xstr.nextDouble() * 9D);
- }
-
- if (rawLifeTime < 8e-15D) {
- return 1e-35D;
- }
- if (rawLifeTime > 8e28D) {
- return 8e30D;
- }
- return rawLifeTime;
- }
-
- private static boolean canTheyBeTogether(cElementalConstantStackMap stacks) {
- boolean nuclei = false;
- long qty=0;
- for (cElementalDefinitionStack stack : stacks.valuesToArray()) {
- if (stack.definition instanceof dHadronDefinition) {
- if (((dHadronDefinition) stack.definition).amount != 3) {
- return false;
- }
- nuclei = true;
- } else if (!(stack.definition instanceof eLeptonDefinition)) {
- return false;
- }
- if((int)stack.amount!=stack.amount){
- throw new ArithmeticException("Amount cannot be safely converted to int!");
- }
- qty+=stack.amount;
- }
- return nuclei && qty<ATOM_COMPLEXITY_LIMIT;
- }
-
- @Override
- public int getCharge() {
- return charge;
- }
-
- public int getChargeLeptons() {
- return chargeLeptons;
- }
-
- public int getChargeHadrons() {
- return charge - chargeLeptons;
- }
-
- public int getIonizationElementWise() {
- return element * 3 + chargeLeptons;
- }
-
- @Override
- public double getMass() {
- return mass;
- }
-
- @Override
- public byte getType() {
- return type;
- }
-
- @Override
- public double getRawTimeSpan(long currentEnergy) {
- if(currentEnergy<=0) {
- return rawLifeTime;
- }
- if(iaeaDefinitionExistsAndHasEnergyLevels){
- if(currentEnergy>=iaea.energeticStatesArray.length){
- return iaea.energeticStatesArray[iaea.energeticStatesArray.length-1].Thalf/(currentEnergy-iaea.energeticStatesArray.length+1);
- }
- return iaea.energeticStatesArray[(int)currentEnergy].Thalf;
- }
- return rawLifeTime/(currentEnergy+1);
- }
-
- @Override
- public boolean isTimeSpanHalfLife() {
- return true;
- }
-
- @Override
- public byte getColor() {
- return -10;
- }
-
- @Override
- public String getName() {
- int element = Math.abs(this.element);
- boolean negative = this.element < 0;
- try {
- if (Math.abs(type) != 1) {
- return (negative ? "~? " : "? ") + Nomenclature.NAME[element];
- }
- return negative ? '~' + Nomenclature.NAME[element] : Nomenclature.NAME[element];
- } catch (Exception e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- return (negative ? "Element: ~" : "Element: ") + element;
- }
- }
-
- @Override
- public String getSymbol() {
- int element = Math.abs(this.element);
- boolean negative = this.element < 0;
- try {
- return (negative ? "~" : "") + Nomenclature.SYMBOL[element] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C:" + getCharge();
- } catch (Exception e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- try {
- int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10;
- return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C:" + getCharge();
- } catch (Exception E) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- return (negative ? "~" : "") + "? N:" + neutralCount + " I:" + (neutralCount+element) + " C:" + getCharge();
- }
- }
- }
-
- @Override
- public String getShortSymbol() {
- int element = Math.abs(this.element);
- boolean negative = this.element < 0;
- try {
- return (negative ? "~" : "") + Nomenclature.SYMBOL[element];
- } catch (Exception e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- try {
- int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10;
- return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1];
- } catch (Exception E) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- return (negative ? "~" : "") + "?";
- }
- }
- }
-
- @Override
- public cElementalConstantStackMap getSubParticles() {
- return elementalStacks.clone();
- }
-
- @Override
- public cElementalDecay[] getDecayArray() {
- ArrayList<cElementalDecay> decaysList=new ArrayList<>(4);
- return getDecayArray(decaysList,decayMode,true);
- }
-
- private cElementalDecay[] getDecayArray(ArrayList<cElementalDecay> decaysList,int decayMode,boolean tryAnti) {//todo?
- if (type == 1) {
- switch (decayMode) {
- case -2:
- if(TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) {
- return decaysList.toArray(cElementalDecay.noProduct);
- } else if(PbetaDecay(decaysList)) {
- return decaysList.toArray(cElementalDecay.noProduct);
- }
- break;
- case -1:
- if(Emmision(decaysList, dHadronDefinition.hadron_p1)) {
- return decaysList.toArray(cElementalDecay.noProduct);
- }
- break;
- case 0:
- if(alphaDecay(decaysList)) {
- return decaysList.toArray(cElementalDecay.noProduct);
- }
- break;
- case 1:
- if(Emmision(decaysList, dHadronDefinition.hadron_n1)) {
- return decaysList.toArray(cElementalDecay.noProduct);
- }
- break;
- case 2:
- if(MbetaDecay(decaysList)) {
- return decaysList.toArray(cElementalDecay.noProduct);
- }
- break;
- default:
- if(decayMode>8){
- if(iaeaDecay(decaysList,0)) {
- return decaysList.toArray(cElementalDecay.noProduct);
- }
- return getDecayArray(decaysList,decayMode- BYTE_OFFSET,false);
- }
- }
- return cElementalDecay.noDecay;
- }else if(type ==-1){
- dAtomDefinition anti=getAnti();
- if(anti!=null) {
- return anti.getDecayArray(decaysList, decayMode, false);
- }
- }
- return getNaturalDecayInstant();
- }
-
- private boolean iaeaDecay(ArrayList<cElementalDecay> decaysList,long energy){
- iaeaNuclide.energeticState state;
- if(energy>iaea.energeticStatesArray.length) {
- state = iaea.energeticStatesArray[iaea.energeticStatesArray.length - 1];
- } else if(energy<=0) {
- state = iaea.energeticStatesArray[0];
- } else {
- state = iaea.energeticStatesArray[(int) energy];
- }
- for (int i=0;i<state.decaymodes.length;i++){
- if(!getDecayFromIaea(decaysList,state.decaymodes[i],energy)) {
- decaysList.clear();
- return false;
- }
- }
- return !decaysList.isEmpty();
- }
-
- private boolean getDecayFromIaea(ArrayList<cElementalDecay> decaysList, iaeaNuclide.iaeaDecay decay, long energy){
- cElementalDefinitionStackMap withThis =elementalStacks.toMutable(), newStuff =new cElementalDefinitionStackMap();
- switch (decay.decayName){
- case "D": {
- if (withThis.removeAllAmounts(false, deuterium.definition.getSubParticles())){
- withThis.putReplace(deuterium);
- decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }
- } break;
- case "3H": {
- if (withThis.removeAllAmounts(false, tritium.definition.getSubParticles())){
- withThis.putReplace(tritium);
- decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- 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_optimized_unsafe_LeavesExposedElementalTree()));
- 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_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }
- } break;
- case "14C": {
- if (withThis.removeAllAmounts(false, carbon_14.definition.getSubParticles())){
- newStuff.putReplace(carbon_14);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "24NE": {
- if (withThis.removeAllAmounts(false, neon_24.definition.getSubParticles())){
- newStuff.putReplace(neon_24);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "34SI": {
- if (withThis.removeAllAmounts(false, silicon_34.definition.getSubParticles())){
- newStuff.putReplace(silicon_34);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "A": case "A?": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2,dHadronDefinition.hadron_p2)){
- newStuff.putReplace(alpha);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "B+": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1)){
- withThis.putUnify(dHadronDefinition.hadron_n1);
- newStuff.putReplace(eLeptonDefinition.lepton_e_1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "2B+": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){
- withThis.putUnify(dHadronDefinition.hadron_n2);
- newStuff.putReplace(eLeptonDefinition.lepton_e_2);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "B-": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){
- withThis.putUnify(dHadronDefinition.hadron_p1);
- newStuff.putReplace(eLeptonDefinition.lepton_e1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "2B-": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){
- withThis.putUnify(dHadronDefinition.hadron_p2);
- newStuff.putReplace(eLeptonDefinition.lepton_e2);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_2);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "EC": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)){
- withThis.putUnify(dHadronDefinition.hadron_n1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "2EC": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e2)){
- withThis.putUnify(dHadronDefinition.hadron_n2);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "B++EC": case "EC+B+": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){
- withThis.putUnify(dHadronDefinition.hadron_n2);
- newStuff.putReplace(eLeptonDefinition.lepton_e_1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "B+A": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p3, dHadronDefinition.hadron_n1)){
- newStuff.putReplace(eLeptonDefinition.lepton_e_1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1);
- newStuff.putReplace(alpha);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "B+P": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){
- withThis.putUnify(dHadronDefinition.hadron_n1);
- newStuff.putReplace(eLeptonDefinition.lepton_e_1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1);
- newStuff.putReplace(dHadronDefinition.hadron_p1);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "B+2P": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p3)){
- withThis.putUnify(dHadronDefinition.hadron_n1);
- newStuff.putReplace(eLeptonDefinition.lepton_e_1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1);
- newStuff.putReplace(dHadronDefinition.hadron_p2);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "B-A": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n3, dHadronDefinition.hadron_p1)){
- newStuff.putReplace(eLeptonDefinition.lepton_e1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1);
- newStuff.putReplace(alpha);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "B-N": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){
- withThis.putUnify(dHadronDefinition.hadron_p1);
- newStuff.putReplace(eLeptonDefinition.lepton_e1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1);
- newStuff.putReplace(dHadronDefinition.hadron_n1);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "B-2N": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n3)){
- withThis.putUnify(dHadronDefinition.hadron_p1);
- newStuff.putReplace(eLeptonDefinition.lepton_e1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1);
- newStuff.putReplace(dHadronDefinition.hadron_n2);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "B-P": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){
- newStuff.putReplace(eLeptonDefinition.lepton_e1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1);
- newStuff.putReplace(dHadronDefinition.hadron_p1);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "ECA": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1,eLeptonDefinition.lepton_e1,dHadronDefinition.hadron_p3)){
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1);
- newStuff.putReplace(alpha);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "ECP": {
- if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e1,dHadronDefinition.hadron_p2)){
- withThis.putUnify(dHadronDefinition.hadron_n1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1);
- newStuff.putReplace(dHadronDefinition.hadron_p1);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "EC2P": {
- if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e1,dHadronDefinition.hadron_p3)){
- withThis.putUnify(dHadronDefinition.hadron_n1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1);
- newStuff.putReplace(dHadronDefinition.hadron_p2);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "ECP+EC2P": {//todo look at branching ratios
- if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e2,dHadronDefinition.hadron_p5)){
- withThis.putUnify(dHadronDefinition.hadron_n1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2);
- newStuff.putReplace(dHadronDefinition.hadron_p3);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "N": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){
- newStuff.putReplace(dHadronDefinition.hadron_n1);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "2N": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){
- newStuff.putReplace(dHadronDefinition.hadron_n2);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "P": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1)){
- newStuff.putReplace(dHadronDefinition.hadron_p1);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "2P": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){
- newStuff.putReplace(dHadronDefinition.hadron_p2);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "SF": {
- if (Fission(decaysList, withThis, newStuff, decay.chance, false)) {
- return true;
- }
- } break;
- case "B-F": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){
- withThis.putUnify(dHadronDefinition.hadron_p1);
- newStuff.putReplace(eLeptonDefinition.lepton_e1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1);
- try{
- if(Fission(decaysList,withThis,newStuff,decay.chance,false)) {
- return true;
- }
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "ECF": case "ECSF": case "EC(+SF)": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)){
- withThis.putUnify(dHadronDefinition.hadron_n1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1);
- try{
- if(Fission(decaysList,withThis,newStuff,decay.chance,false)) {
- return true;
- }
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "SF(+EC+B+)": case "SF+EC+B+": {
- if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){
- withThis.putUnify(dHadronDefinition.hadron_n2);
- newStuff.putReplace(eLeptonDefinition.lepton_e_1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2);
- try{
- if(Fission(decaysList,withThis,newStuff,decay.chance,false)) {
- return true;
- }
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "SF+EC+B-": {
- if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e1)){
- newStuff.putReplace(eLeptonDefinition.lepton_e1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1);
- try{
- if(Fission(decaysList,withThis,newStuff,decay.chance,false)) {
- return true;
- }
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "IT": case "IT?": case "G": {
- if(energy>0){
- decaysList.add(new cElementalDecay(decay.chance, this, boson_Y__));
- }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);
- newStuff.putReplace(eLeptonDefinition.lepton_e_1);
- newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2);
- newStuff.putReplace(eBosonDefinition.boson_Y__1);
- try{
- newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- } break;
- case "DEAD_END":
- decaysList.add(deadEnd);
- return true;
- default: throw new Error("Unsupported decay mode: " + decay.decayName + ' ' + neutralCount+ ' ' +element);
- }
- if(DEBUG_MODE) {
- TecTech.LOGGER.info("Failed to decay " + element + ' ' + neutralCount + ' ' + decay.decayName);
- }
- return false;
- }
-
- private boolean Emmision(ArrayList<cElementalDecay> decaysList, cElementalDefinitionStack emit) {
- cElementalDefinitionStackMap tree = elementalStacks.toMutable();
- if (tree.removeAmount(false, emit)) {
- try {
- decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), emit));
- return true;
- } catch (Exception e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- return false;
- }
-
- private boolean alphaDecay(ArrayList<cElementalDecay> decaysList) {
- cElementalDefinitionStackMap tree = elementalStacks.toMutable();
- if (tree.removeAllAmounts(false, alpha.definition.getSubParticles())) {
- try {
- decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), alpha));
- return true;
- } catch (Exception e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- return false;
- }
-
- private boolean MbetaDecay(ArrayList<cElementalDecay> decaysList) {
- cElementalDefinitionStackMap tree = elementalStacks.toMutable();
- if (tree.removeAmount(false, dHadronDefinition.hadron_n1)) {
- try {
- tree.putUnify(dHadronDefinition.hadron_p1);
- decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e1, eNeutrinoDefinition.lepton_Ve_1));
- return true;
- } catch (Exception e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- return false;
- }
-
- private boolean PbetaDecay(ArrayList<cElementalDecay> decaysList) {
- cElementalDefinitionStackMap tree = elementalStacks.toMutable();
- if (tree.removeAmount(false, dHadronDefinition.hadron_p1)) {
- try {
- tree.putUnify(dHadronDefinition.hadron_n1);
- decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), eLeptonDefinition.lepton_e_1, eNeutrinoDefinition.lepton_Ve1));
- return true;
- } catch (Exception e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- return false;
- }
-
- private boolean ElectronCapture(ArrayList<cElementalDecay> decaysList) {
- cElementalDefinitionStackMap tree = elementalStacks.toMutable();
- if (tree.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)) {
- try {
- tree.putUnify(dHadronDefinition.hadron_n1);
- decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), eNeutrinoDefinition.lepton_Ve1));
- return true;
- } catch (Exception e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- }
- return false;
- }
-
- private boolean Fission(ArrayList<cElementalDecay> decaysList, cElementalDefinitionStackMap fissile, cElementalDefinitionStackMap particles, double probability, boolean spontaneousCheck) {
- cElementalDefinitionStackMap heavy = new cElementalDefinitionStackMap();
- double[] liquidDrop = liquidDropFunction(Math.abs(element)<=97);
-
- for(cElementalDefinitionStack stack: fissile.valuesToArray()){
- if(spontaneousCheck && stack.definition instanceof dHadronDefinition &&
- (stack.amount<=80 || stack.amount<90 && XSTR_INSTANCE.nextInt(10)<stack.amount-80)) {
- return false;
- }
- if(stack.definition.getCharge()==0){
- //if(stack.definition instanceof dHadronDefinition){
- double neutrals=stack.amount*liquidDrop[2];
- int neutrals_cnt=(int)Math.floor(neutrals);
- neutrals_cnt+=neutrals-neutrals_cnt>XSTR_INSTANCE.nextDouble()?1:0;
- particles.putUnify(new cElementalDefinitionStack(stack.definition, neutrals_cnt));
-
- int heavy_cnt=(int)Math.ceil(stack.amount*liquidDrop[1]);
- while(heavy_cnt+neutrals_cnt>stack.amount) {
- heavy_cnt--;
- }
- fissile.removeAmount(false,new cElementalDefinitionStack(stack.definition,heavy_cnt+neutrals_cnt));
- heavy.putReplace(new cElementalDefinitionStack(stack.definition, heavy_cnt));
- //}else{
- // particles.add(stack);
- // light.remove(stack.definition);
- //}
- }else{
- int heavy_cnt=(int)Math.ceil(stack.amount*liquidDrop[0]);
- if(heavy_cnt%2==1 && XSTR_INSTANCE.nextDouble()>0.05D) {
- heavy_cnt--;
- }
- cElementalDefinitionStack new_stack=new cElementalDefinitionStack(stack.definition, heavy_cnt);
- fissile.removeAmount(false,new_stack);
- heavy.putReplace(new_stack);
- }
- }
-
- try {
- particles.putReplace(new cElementalDefinitionStack(new dAtomDefinition(fissile.toImmutable_optimized_unsafe_LeavesExposedElementalTree()),1));
- particles.putReplace(new cElementalDefinitionStack(new dAtomDefinition(heavy.toImmutable_optimized_unsafe_LeavesExposedElementalTree()),1));
- decaysList.add(new cElementalDecay(probability, particles.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
- return true;
- } catch (Exception e) {
- if(DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- return false;
- }
-
- private static double[] liquidDropFunction(boolean asymmetric) {
- double[] out = new double[3];
-
- out[0] = XSTR_INSTANCE.nextGaussian();
-
- if (out[0] < 1 && out[0] >= -1) {
- if (XSTR_INSTANCE.nextBoolean()) {
- out[0] = XSTR_INSTANCE.nextDouble() * 2d - 1d;
- }
- }
-
- if (asymmetric && out[0] > XSTR_INSTANCE.nextDouble() && XSTR_INSTANCE.nextInt(4) == 0) {
- out[0] = -out[0];
- }
-
- //scale to splitting ratio
- out[0] = out[0] * 0.05d + .6d;
-
- if (out[0] < 0 || out[0] > 1) {
- return liquidDropFunction(asymmetric);
- }
- if (out[0] < .5d) {
- out[0] = 1d - out[0];
- }
-
- //extra neutrals
- out[2] = 0.012d + XSTR_INSTANCE.nextDouble() * 0.01d;
-
- if (asymmetric) {
- out[1] = out[0];
- } else {
- out[1] = out[0] - out[2] * .5d;
- }
-
- return out;
- }
-
- @Override
- public cElementalDecay[] getEnergyInducedDecay(long energyLevel) {
- if (iaeaDefinitionExistsAndHasEnergyLevels) {
- ArrayList<cElementalDecay> decays=new ArrayList<>(4);
- if(iaeaDecay(decays,energyLevel)){
- return decays.toArray(cElementalDecay.noProduct);
- }
- }
- if(energyLevel< Math.abs(charge)/3+neutralCount) {
- return new cElementalDecay[]{new cElementalDecay(1, this, boson_Y__)};
- }
- return getNaturalDecayInstant();
- }
-
- @Override
- public double getEnergyDiffBetweenStates(long currentEnergyLevel,long newEnergyLevel) {
- if(iaeaDefinitionExistsAndHasEnergyLevels){
- double result=0;
- boolean backwards=newEnergyLevel<currentEnergyLevel;
- if(backwards){
- long temp=currentEnergyLevel;
- currentEnergyLevel=newEnergyLevel;
- newEnergyLevel=temp;
- }
-
- if(currentEnergyLevel<=0){
- if(newEnergyLevel<=0) {
- return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel);
- } else {
- result += iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * -currentEnergyLevel;
- }
- }else {
- result -= iaea.energeticStatesArray[(int) Math.min(iaea.energeticStatesArray.length - 1, currentEnergyLevel)].energy;
- }
- if(newEnergyLevel>=iaea.energeticStatesArray.length){
- if(currentEnergyLevel>=iaea.energeticStatesArray.length) {
- return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel);
- } else {
- result += iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - iaea.energeticStatesArray.length + 1);
- }
- result+=iaea.energeticStatesArray[iaea.energeticStatesArray.length-1].energy;
- }else {
- result += iaea.energeticStatesArray[(int) Math.max(0, newEnergyLevel)].energy;
- }
-
- return backwards?-result:result;
- }
- return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel);
- }
-
- @Override
- public boolean usesSpecialEnergeticDecayHandling() {
- return iaeaDefinitionExistsAndHasEnergyLevels;
- }
-
- @Override
- public boolean usesMultipleDecayCalls(long energyLevel) {
- if(!iaeaDefinitionExistsAndHasEnergyLevels) return false;
- iaeaNuclide.energeticState state;
- if(energyLevel>iaea.energeticStatesArray.length) {
- state = iaea.energeticStatesArray[iaea.energeticStatesArray.length - 1];
- } else if(energyLevel<=0) {
- state = iaea.energeticStatesArray[0];
- } else {
- state = iaea.energeticStatesArray[(int) energyLevel];
- }
- for (iaeaNuclide.iaeaDecay decay:state.decaymodes){
- if(decay.decayName.contains("F")) return true;//if is fissile
- }
- return false;
- }
-
- @Override
- public boolean decayMakesEnergy(long energyLevel) {
- return iaeaDefinitionExistsAndHasEnergyLevels;
- }
-
- @Override
- public boolean fusionMakesEnergy(long energyLevel) {
- return iaea!=null || iaeaDefinitionExistsAndHasEnergyLevels;
- }
-
- @Override
- public cElementalDecay[] getNaturalDecayInstant() {
- //disembody
- ArrayList<cElementalDefinitionStack> decaysInto = new ArrayList<>();
- for (cElementalDefinitionStack elementalStack : elementalStacks.valuesToArray()) {
- if (elementalStack.definition.getType() == 1 || elementalStack.definition.getType() == -1) {
- //covers both quarks and antiquarks
- decaysInto.add(elementalStack);
- } else {
- //covers both quarks and antiquarks
- decaysInto.add(new cElementalDefinitionStack(boson_Y__, 2));
- }
- }
- return new cElementalDecay[]{new cElementalDecay(0.75D, decaysInto.toArray(new cElementalDefinitionStack[0])), deadEnd};
- }
-
- //@Override
- //public iElementalDefinition getAnti() {
- // cElementalDefinitionStack[] stacks = this.elementalStacks.values();
- // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length];
- // for (int i = 0; i < antiElements.length; i++) {
- // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount);
- // }
- // try {
- // return new dAtomDefinition(false, antiElements);
- // } catch (tElementalException e) {
- // if (DEBUG_MODE) e.printStackTrace();
- // return null;
- // }
- //}
-
- @Override
- public dAtomDefinition getAnti() {
- cElementalDefinitionStackMap anti = new cElementalDefinitionStackMap();
- for (cElementalDefinitionStack stack : elementalStacks.valuesToArray()) {
- anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount));
- }
- try {
- return new dAtomDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree());
- } catch (tElementalException e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- return null;
- }
- }
-
- @Override
- public aFluidDequantizationInfo someAmountIntoFluidStack() {
- return bTransformationInfo.TRANSFORMATION_INFO.fluidDequantization.get(this);
- }
-
- @Override
- public aItemDequantizationInfo someAmountIntoItemsStack() {
- return bTransformationInfo.TRANSFORMATION_INFO.itemDequantization.get(this);
- }
-
- @Override
- public aOredictDequantizationInfo someAmountIntoOredictStack() {
- return bTransformationInfo.TRANSFORMATION_INFO.oredictDequantization.get(this);
- }
-
- private static final class Nomenclature {
- private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"};
- private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"};
- private static final String[] SYMBOL_IUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"};
- }
-
- @Override
- public NBTTagCompound toNBT() {
- return getNbtTagCompound(nbtType, elementalStacks);
- }
-
- public static dAtomDefinition fromNBT(NBTTagCompound nbt) {
- cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[nbt.getInteger("i")];
- for (int i = 0; i < stacks.length; i++) {
- stacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i)));
- }
- try {
- return new dAtomDefinition(stacks);
- } catch (tElementalException e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- return null;
- }
- }
-
- public static void run() {
- for (Runnable r : overrides) {
- r.run();
- }
-
- for(Map.Entry<dAtomDefinition,Double> entry:lifetimeOverrides.entrySet()){
- try {
- lifetimeOverrides.put(new dAtomDefinition(entry.getKey().elementalStacks), entry.getValue());
- }catch (tElementalException e){
- e.printStackTrace(); //Impossible
- }
- }
-
- //populate stable isotopes
- for (int element = 1; element < 83; element++)//Up to Bismuth exclusive
- {
- for (int isotope = 0; isotope < 130; isotope++) {
- xstr.setSeed((long) (element + 1) * (isotope + 100));
- //stability curve
- int StableIsotope = stableIzoCurve(element);
- int izoDiff = isotope - StableIsotope;
- int izoDiffAbs = Math.abs(izoDiff);
- double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false);
- iaeaNuclide nuclide = iaeaNuclide.get(element, isotope);
- if (rawLifeTime >= STABLE_RAW_LIFE_TIME || nuclide != null && nuclide.halfTime >= STABLE_RAW_LIFE_TIME) {
- TreeSet<Integer> isotopes = stableIsotopes.computeIfAbsent(element, k -> new TreeSet<>());
- isotopes.add(isotope);
- }
- }
- }
-
- //populate unstable isotopes
- for (int element = 83; element < 150; element++) {
- for (int isotope = 100; isotope < 180; isotope++) {
- xstr.setSeed((long) (element + 1) * (isotope + 100));
- //stability curve
- int Isotope = stableIzoCurve(element);
- int izoDiff = isotope - Isotope;
- int izoDiffAbs = Math.abs(izoDiff);
- double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false);
- TreeMap<Double, Integer> isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>());
- isotopes.put(rawLifeTime, isotope);
- }
- }
-
- try {
- for (Map.Entry<Integer, TreeSet<Integer>> integerTreeSetEntry : stableIsotopes.entrySet()) {
- stableAtoms.put(integerTreeSetEntry.getKey(), new dAtomDefinition(
- new cElementalDefinitionStack(dHadronDefinition.hadron_p, integerTreeSetEntry.getKey()),
- new cElementalDefinitionStack(dHadronDefinition.hadron_n, integerTreeSetEntry.getValue().first()),
- new cElementalDefinitionStack(eLeptonDefinition.lepton_e, integerTreeSetEntry.getKey())));
- if (DEBUG_MODE) {
- TecTech.LOGGER.info("Added Stable Atom:" + integerTreeSetEntry.getKey() + ' ' + integerTreeSetEntry.getValue().first() + ' ' + stableAtoms.get(integerTreeSetEntry.getKey()).getMass());
- }
- }
- for (Map.Entry<Integer, TreeMap<Double, Integer>> integerTreeMapEntry : mostStableUnstableIsotopes.entrySet()) {
- unstableAtoms.put(integerTreeMapEntry.getKey(), new dAtomDefinition(
- new cElementalDefinitionStack(dHadronDefinition.hadron_p, integerTreeMapEntry.getKey()),
- new cElementalDefinitionStack(dHadronDefinition.hadron_n, integerTreeMapEntry.getValue().lastEntry().getValue()),
- new cElementalDefinitionStack(eLeptonDefinition.lepton_e, integerTreeMapEntry.getKey())));
- if (DEBUG_MODE) {
- TecTech.LOGGER.info("Added Unstable Atom:" + integerTreeMapEntry.getKey() + ' ' + integerTreeMapEntry.getValue().lastEntry().getValue() + ' ' + unstableAtoms.get(integerTreeMapEntry.getKey()).getMass());
- }
- }
- deuterium=new dAtomDefinition(
- dHadronDefinition.hadron_p1,
- dHadronDefinition.hadron_n1,
- eLeptonDefinition.lepton_e1).getStackForm(1);
- tritium=new dAtomDefinition(
- dHadronDefinition.hadron_p1,
- dHadronDefinition.hadron_n2,
- eLeptonDefinition.lepton_e1).getStackForm(1);
- helium_3=new dAtomDefinition(
- dHadronDefinition.hadron_p2,
- dHadronDefinition.hadron_n1,
- eLeptonDefinition.lepton_e2).getStackForm(1);
- alpha = new dAtomDefinition(
- dHadronDefinition.hadron_p2,
- dHadronDefinition.hadron_n2).getStackForm(1);
- beryllium_8=new dAtomDefinition(
- new cElementalDefinitionStack(dHadronDefinition.hadron_p, 4),
- new cElementalDefinitionStack(dHadronDefinition.hadron_n, 4),
- new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 4)).getStackForm(1);
- carbon_14=new dAtomDefinition(
- new cElementalDefinitionStack(dHadronDefinition.hadron_p, 6),
- new cElementalDefinitionStack(dHadronDefinition.hadron_n, 8),
- new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 6)).getStackForm(1);
- neon_24=new dAtomDefinition(
- new cElementalDefinitionStack(dHadronDefinition.hadron_p, 10),
- new cElementalDefinitionStack(dHadronDefinition.hadron_n, 14),
- new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 10)).getStackForm(1);
- silicon_34=new dAtomDefinition(
- new cElementalDefinitionStack(dHadronDefinition.hadron_p, 14),
- new cElementalDefinitionStack(dHadronDefinition.hadron_n, 20),
- new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 14)).getStackForm(1);
- } catch (Exception e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- }
-
- try {
- cElementalDefinition.addCreatorFromNBT(nbtType, dAtomDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)64);
- } catch (Exception e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- if(DEBUG_MODE) {
- TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + 64);
- }
- }
-
- public static void setTransformation(){
- /*----STABLE ATOMS----**/
- refMass = getFirstStableIsotope(1).getMass() * AVOGADRO_CONSTANT_144;
-
- bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(1), AVOGADRO_CONSTANT_144),Materials.Hydrogen.mGas,144);
- bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(2), AVOGADRO_CONSTANT_144),Materials.Helium.mGas, 144);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(3), AVOGADRO_CONSTANT_144), dust, Materials.Lithium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(4), AVOGADRO_CONSTANT_144), dust, Materials.Beryllium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(5), AVOGADRO_CONSTANT_144), dust, Materials.Boron,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(6), AVOGADRO_CONSTANT_144), dust, Materials.Carbon,1);
- bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(7), AVOGADRO_CONSTANT_144),Materials.Nitrogen.mGas, 144);
- bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(8), AVOGADRO_CONSTANT_144),Materials.Oxygen.mGas, 144);
- bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(9), AVOGADRO_CONSTANT_144),Materials.Fluorine.mGas, 144);
- //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Materials.Neon.mGas.getID(), 144);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(11), AVOGADRO_CONSTANT_144), dust, Materials.Sodium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(12), AVOGADRO_CONSTANT_144), dust, Materials.Magnesium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(13), AVOGADRO_CONSTANT_144), dust, Materials.Aluminium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(14), AVOGADRO_CONSTANT_144), dust, Materials.Silicon,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(15), AVOGADRO_CONSTANT_144), dust, Materials.Phosphorus,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(16), AVOGADRO_CONSTANT_144), dust, Materials.Sulfur,1);
- bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(17), AVOGADRO_CONSTANT_144),Materials.Argon.mGas, 144);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(19), AVOGADRO_CONSTANT_144), dust, Materials.Potassium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(20), AVOGADRO_CONSTANT_144), dust, Materials.Calcium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(21), AVOGADRO_CONSTANT_144), dust, Materials.Scandium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(22), AVOGADRO_CONSTANT_144), dust, Materials.Titanium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(23), AVOGADRO_CONSTANT_144), dust, Materials.Vanadium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(24), AVOGADRO_CONSTANT_144), dust, Materials.Chrome,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(25), AVOGADRO_CONSTANT_144), dust, Materials.Manganese,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(26), AVOGADRO_CONSTANT_144), dust, Materials.Iron,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(27), AVOGADRO_CONSTANT_144), dust, Materials.Cobalt,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(28), AVOGADRO_CONSTANT_144), dust, Materials.Nickel,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(29), AVOGADRO_CONSTANT_144), dust, Materials.Copper,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(30), AVOGADRO_CONSTANT_144), dust, Materials.Zinc,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(31), AVOGADRO_CONSTANT_144), dust, Materials.Gallium,1);
- //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Germanium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(33), AVOGADRO_CONSTANT_144), dust, Materials.Arsenic,1);
- //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Selenium,1);
- //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Bromine,1);
- //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Krypton,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(37), AVOGADRO_CONSTANT_144), dust, Materials.Rubidium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(38), AVOGADRO_CONSTANT_144), dust, Materials.Strontium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(39), AVOGADRO_CONSTANT_144), dust, Materials.Yttrium,1);
- //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Zirconium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(41), AVOGADRO_CONSTANT_144), dust, Materials.Niobium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(42), AVOGADRO_CONSTANT_144), dust, Materials.Molybdenum,1);
- //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Technetium,1);
- //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Ruthenium,1);
- //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhodium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(46), AVOGADRO_CONSTANT_144), dust, Materials.Palladium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(47), AVOGADRO_CONSTANT_144), dust, Materials.Silver,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(48), AVOGADRO_CONSTANT_144), dust, Materials.Cadmium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(49), AVOGADRO_CONSTANT_144), dust, Materials.Indium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(50), AVOGADRO_CONSTANT_144), dust, Materials.Tin,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(51), AVOGADRO_CONSTANT_144), dust, Materials.Antimony,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(52), AVOGADRO_CONSTANT_144), dust, Materials.Tellurium,1);
- //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Iodine,1);
- //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Materials.Xenon.mGas.getID(), 144);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(55), AVOGADRO_CONSTANT_144), dust, Materials.Caesium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(56), AVOGADRO_CONSTANT_144), dust, Materials.Barium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(57), AVOGADRO_CONSTANT_144), dust, Materials.Lanthanum,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(58), AVOGADRO_CONSTANT_144), dust, Materials.Cerium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(59), AVOGADRO_CONSTANT_144), dust, Materials.Praseodymium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(60), AVOGADRO_CONSTANT_144), dust, Materials.Neodymium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(61), AVOGADRO_CONSTANT_144), dust, Materials.Promethium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(62), AVOGADRO_CONSTANT_144), dust, Materials.Samarium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(63), AVOGADRO_CONSTANT_144), dust, Materials.Europium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(64), AVOGADRO_CONSTANT_144), dust, Materials.Gadolinium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(65), AVOGADRO_CONSTANT_144), dust, Materials.Terbium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(66), AVOGADRO_CONSTANT_144), dust, Materials.Dysprosium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(67), AVOGADRO_CONSTANT_144), dust, Materials.Holmium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(68), AVOGADRO_CONSTANT_144), dust, Materials.Erbium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(69), AVOGADRO_CONSTANT_144), dust, Materials.Thulium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(70), AVOGADRO_CONSTANT_144), dust, Materials.Ytterbium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(71), AVOGADRO_CONSTANT_144), dust, Materials.Lutetium,1);
- //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Hafnum,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(73), AVOGADRO_CONSTANT_144), dust, Materials.Tantalum,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(74), AVOGADRO_CONSTANT_144), dust, Materials.Tungsten,1);
- //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhenium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(76), AVOGADRO_CONSTANT_144), dust, Materials.Osmium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(77), AVOGADRO_CONSTANT_144), dust, Materials.Iridium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(78), AVOGADRO_CONSTANT_144), dust, Materials.Platinum,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(79), AVOGADRO_CONSTANT_144), dust, Materials.Gold,1);
- bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(80), AVOGADRO_CONSTANT_144),Materials.Mercury.mFluid, 144);
- //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Thallium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(82), AVOGADRO_CONSTANT_144), dust, Materials.Lead,1);
-
- /*----UNSTABLE ATOMS----**/
- refUnstableMass = getFirstStableIsotope(82).getMass() * AVOGADRO_CONSTANT_144;
-
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1);
- //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Polonium,1);
- //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Materials.Astatine.mPlasma.getID(), 144);
- bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86), AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144);
- //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Francium,1);
- //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Radium,1);
- //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Actinium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90), AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1);
- //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Protactinium,1);
- ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Materials.Uranium,1);
- //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Neptunium,1);
- ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Materials.Plutonium,1);
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95), AVOGADRO_CONSTANT_144), dust, Materials.Americium,1);
-
- try {
- dAtomDefinition temp;
- bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(deuterium.definition, AVOGADRO_CONSTANT_144),Materials.Deuterium.mGas, 144);
-
- bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(tritium.definition, AVOGADRO_CONSTANT_144),Materials.Tritium.mGas, 144);
-
- bTransformationInfo.TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(helium_3.definition, AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144);
-
- temp=new dAtomDefinition(
- new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92),
- new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92),
- new cElementalDefinitionStack(dHadronDefinition.hadron_n, 146)
- );
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium/*238*/,1);
-
- double tempMass=temp.getMass();
-
- temp=new dAtomDefinition(
- new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92),
- new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92),
- new cElementalDefinitionStack(dHadronDefinition.hadron_n, 143)
- );
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium235,1);
-
- TecTech.LOGGER.info("Diff Mass U : "+(tempMass-temp.getMass()));
-
- temp=new dAtomDefinition(
- new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94),
- new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94),
- new cElementalDefinitionStack(dHadronDefinition.hadron_n, 145)
- );
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium/*239*/,1);
-
- somethingHeavy=new dAtomDefinition(
- new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94),
- new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94),
- new cElementalDefinitionStack(dHadronDefinition.hadron_n, 147)
- );
- bTransformationInfo.TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(somethingHeavy, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium241,1);
-
- TecTech.LOGGER.info("Diff Mass Pu: "+(somethingHeavy.getMass()-temp.getMass()));
-
- TecTech.LOGGER.info("Neutron Mass: "+dHadronDefinition.hadron_n.getMass());
-
- } catch (tElementalException e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- }
-
- if(Loader.isModLoaded(Reference.GTPLUSPLUS)) {
- new GtppAtomLoader().run();
- }
- }
-
- public static dAtomDefinition getFirstStableIsotope(int element) {
- return stableAtoms.get(element);
- }
-
- public static dAtomDefinition getBestUnstableIsotope(int element) {
- return unstableAtoms.get(element);
- }
-
- @Override
- public byte getClassType() {
- return 64;
- }
-
- public static byte getClassTypeStatic(){
- return 64;
- }
-
- @Override
- public int hashCode() {
- return hash;
- }
-
- @Override
- public void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel) {
- if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) {
- lines.add(getShortSymbol());
- }
- }
-
- @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_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) {
- lines.add("NAME = "+getName());
- lines.add("SYMBOL = "+getSymbol());
- }
- if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) {
- lines.add("CHARGE = " + getCharge() / 3D + " e");
- }
- if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) {
- lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR");
- }
- if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) {
- lines.add("MASS = " + getMass() + " eV/c\u00b2");
- }
- if(iaeaDefinitionExistsAndHasEnergyLevels && Util.areBitsSet(SCAN_GET_ENERGY_STATES,capabilities)){
- for(int i=1;i<iaea.energeticStatesArray.length;i++){
- lines.add("E LEVEL "+i+" = "+iaea.energeticStatesArray[i].energy+" eV");
- }
- }
- if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){
- lines.add("HALF LIFE = "+getRawTimeSpan(energyLevel)+ " s");
- lines.add(" At current energy level");
- }
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java
new file mode 100644
index 0000000000..e3efa3b7e6
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java
@@ -0,0 +1,45 @@
+package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive;
+
+import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.*;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.*;
+
+/**
+ * Created by danie_000 on 22.10.2016.
+ */
+public final class EMBosonDefinition extends EMPrimitive {
+ public static final EMBosonDefinition
+ boson_Y__ = new EMBosonDefinition("Photon", "\u03b3", 1e-18D, -1, 27),
+ boson_H__ = new EMBosonDefinition("Higgs", "\u0397", 126.09e9D, -2, 28);
+ //deadEnd
+ public static final EMDecay deadEnd = new EMDecay(boson_Y__, boson_Y__);
+ public static final EMDecay deadEndHalf = new EMDecay(boson_Y__);
+ public static final EMDefinitionStack boson_Y__1 =new EMDefinitionStack(boson_Y__,1);
+
+ private EMBosonDefinition(String name, String symbol, double mass, int color, int ID) {
+ super(name, symbol, 0, mass, 0, color, ID);
+ }
+
+ public static void run() {
+ boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
+ boson_H__.init(null, 1.56e-22D, 2, 2,
+ new EMDecay(0.01D, quark_b, quark_b_),
+ new EMDecay(0.02D, lepton_t, lepton_t_),
+ new EMDecay(0.96D, new EMDefinitionStack(boson_Y__, 4)),
+ deadEnd);
+ }
+
+ @Override
+ public String getLocalizedName() {
+ return "Boson: " + getName();
+ }
+
+ @Override
+ public boolean isTimeSpanHalfLife() {
+ return this==boson_H__;
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java
new file mode 100644
index 0000000000..98bdf7ca5c
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java
@@ -0,0 +1,69 @@
+package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive;
+
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*;
+
+/**
+ * Created by danie_000 on 22.10.2016.
+ */
+public final class EMLeptonDefinition extends EMPrimitive {
+ public static final EMLeptonDefinition
+ lepton_e = new EMLeptonDefinition("Electron", "\u03b2-", 1, 0.511e6D, -3, 15),
+ lepton_m = new EMLeptonDefinition("Muon", "\u03bc-", 2, 105.658e6D, -3, 17),
+ lepton_t = new EMLeptonDefinition("Tauon", "\u03c4-", 3, 1776.83e6D, -3, 19),
+ lepton_e_ = new EMLeptonDefinition("Positron", "\u03b2+", -1, 0.511e6D, 3, 16),
+ lepton_m_ = new EMLeptonDefinition("Antimuon", "\u03bc+", -2, 105.658e6D, 3, 18),
+ lepton_t_ = new EMLeptonDefinition("Antitauon", "\u03c4+", -3, 1776.83e6D, 3, 20);
+
+ public static final EMDefinitionStack lepton_e1 = new EMDefinitionStack(lepton_e, 1);
+ public static final EMDefinitionStack lepton_e2 = new EMDefinitionStack(lepton_e, 2);
+ public static final EMDefinitionStack lepton_e_1 = new EMDefinitionStack(lepton_e_, 1);
+ public static final EMDefinitionStack lepton_e_2 = new EMDefinitionStack(lepton_e_, 2);
+
+ private EMLeptonDefinition(String name, String symbol, int type, double mass, int charge, int ID) {
+ super(name, symbol, type, mass, charge, -1, ID);
+ //this.itemThing=null;
+ //this.fluidThing=null;
+ }
+
+ public static void run() {
+ lepton_e.init(lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1,
+ deadEnd,
+ new EMDecay(lepton_e,boson_Y__));
+ lepton_m.init(lepton_m_, 2.197019e-6D, 0, 1,
+ new EMDecay(0.9D, lepton_e, lepton_Ve_, lepton_Vm),
+ deadEnd);//makes photons and don't care
+ lepton_t.init(lepton_t_, 2.906e-13D, 1, 3,
+ new EMDecay(0.05F, lepton_m, lepton_Vm_, lepton_Vt, boson_H__),
+ new EMDecay(0.1D, lepton_e, lepton_Ve_, lepton_Vm),
+ new EMDecay(0.8D, lepton_m, lepton_Vm_, lepton_Vt, boson_Y__),
+ deadEnd);//makes photons and don't care
+
+ lepton_e_.init(lepton_e, STABLE_RAW_LIFE_TIME, 0, 1,
+ deadEnd,
+ new EMDecay(lepton_e,boson_Y__));
+ lepton_m_.init(lepton_m, 2.197019e-6F, 0, 1,
+ new EMDecay(0.9F, lepton_e_, lepton_Ve, lepton_Vm_),
+ deadEnd);//makes photons and don't care
+ lepton_t_.init(lepton_t, 2.906e-13F, 1, 3,
+ new EMDecay(0.05F, lepton_m_, lepton_Vm, lepton_Vt_, boson_H__),
+ new EMDecay(0.1F, lepton_e_, lepton_Ve, lepton_Vm_),
+ new EMDecay(0.8F, lepton_m_, lepton_Vm, lepton_Vt_, boson_Y__),
+ deadEnd);//makes photons and don't care
+ }
+
+ @Override
+ public String getLocalizedName() {
+ return "Lepton: " + getName();
+ }
+
+ @Override
+ public boolean isTimeSpanHalfLife() {
+ return true;
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java
new file mode 100644
index 0000000000..e77c74ed89
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java
@@ -0,0 +1,59 @@
+package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive;
+
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*;
+
+/**
+ * Created by danie_000 on 22.10.2016.
+ */
+public final class EMNeutrinoDefinition extends EMPrimitive {
+ public static final EMNeutrinoDefinition
+ lepton_Ve = new EMNeutrinoDefinition("Electron neutrino", "\u03bd\u03b2", 1, 2e0D, 21),
+ lepton_Vm = new EMNeutrinoDefinition("Muon neutrino", "\u03bd\u03bc", 2, 0.15e6D, 23),
+ lepton_Vt = new EMNeutrinoDefinition("Tauon neutrino", "\u03bd\u03c4", 3, 15e6D, 25),
+ lepton_Ve_ = new EMNeutrinoDefinition("Positron neutrino", "~\u03bd\u03b2", -1, 2e0D, 22),
+ lepton_Vm_ = new EMNeutrinoDefinition("Antimuon neutrino", "~\u03bd\u03bc", -2, 0.15e6D, 24),
+ lepton_Vt_ = new EMNeutrinoDefinition("Antitauon neutrino", "~\u03bd\u03c4", -3, 15e6D, 26);
+
+ public static final EMDefinitionStack lepton_Ve1 = new EMDefinitionStack(lepton_Ve, 1);
+ public static final EMDefinitionStack lepton_Ve2 = new EMDefinitionStack(lepton_Ve, 2);
+ public static final EMDefinitionStack lepton_Ve_1 = new EMDefinitionStack(lepton_Ve_, 1);
+ public static final EMDefinitionStack lepton_Ve_2 = new EMDefinitionStack(lepton_Ve_, 2);
+
+ private EMNeutrinoDefinition(String name, String symbol, int type, double mass, int ID) {
+ super(name, symbol, type, mass, 0, -1, ID);
+ }
+
+ public static void run() {
+ lepton_Ve.init(lepton_Ve_, 1D, -1, -1,
+ EMDecay.NO_PRODUCT);
+ lepton_Vm.init(lepton_Vm_, 1D, 1, 0,
+ new EMDecay(0.825D, nothing),
+ deadEndHalf);
+ lepton_Vt.init(lepton_Vt_, 1, 1, 0,
+ new EMDecay(0.75F, nothing),
+ deadEnd);
+
+ lepton_Ve_.init(lepton_Ve, 1, -1, -1,
+ EMDecay.NO_PRODUCT);
+ lepton_Vm_.init(lepton_Vm, 1, 1, 0,
+ new EMDecay(0.825F, nothing),
+ deadEndHalf);
+ lepton_Vt_.init(lepton_Vt, 1, 1, 0,
+ new EMDecay(0.75F, nothing),
+ deadEnd);
+ }
+
+ @Override
+ public String getLocalizedName() {
+ return "Lepton: " + getName();
+ }
+
+ @Override
+ public boolean isTimeSpanHalfLife() {
+ return true;
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java
new file mode 100644
index 0000000000..68591cc4e6
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java
@@ -0,0 +1,39 @@
+package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive;
+
+import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY;
+
+/**
+ * Created by danie_000 on 22.10.2016.
+ */
+public final class EMPrimitiveDefinition extends EMPrimitive {
+ public static final EMPrimitiveDefinition
+ nbtE__ = new EMPrimitiveDefinition("NBT ERROR", "!", 0, 0D, Integer.MIN_VALUE, Integer.MIN_VALUE+10_000),
+ null__ = new EMPrimitiveDefinition("NULL POINTER", ".", 0, 0D, -3, Integer.MAX_VALUE-10_000),
+ space__ = new EMPrimitiveDefinition("Space", "_", 0, 0D, -4, 0),
+ magic = new EMPrimitiveDefinition("Magic", "Ma", 4, 1e5D, 0, 1),
+ magic_ = new EMPrimitiveDefinition("Antimagic", "~Ma", -4, 1e5D, 0, 2);
+
+ private EMPrimitiveDefinition(String name, String symbol, int type, double mass, int color, int ID) {
+ super(name, symbol, type, mass, 0, color, ID);
+ }
+
+ public static void run() {
+ nbtE__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
+ null__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
+ space__.init(space__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
+ magic.init(magic_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
+ magic_.init(magic, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
+ }
+
+ @Override
+ public String getLocalizedName() {
+ return "Primitive: " + getName();
+ }
+
+ @Override
+ public boolean isTimeSpanHalfLife() {
+ return false;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java
new file mode 100644
index 0000000000..b0a5c419e1
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java
@@ -0,0 +1,106 @@
+package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive;
+
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*;
+
+/**
+ * Created by danie_000 on 22.10.2016.
+ */
+public final class EMQuarkDefinition extends EMPrimitive {
+ public static final EMQuarkDefinition
+ quark_u = new EMQuarkDefinition("Up", "u", 1, 2.3e6D, 2, 3),
+ quark_c = new EMQuarkDefinition("Charm", "c", 2, 1.29e9D, 2, 9),
+ quark_t = new EMQuarkDefinition("Top", "t", 3, 172.44e9D, 2, 13),
+ quark_d = new EMQuarkDefinition("Down", "d", 1, 4.8e6D, -1, 5),
+ quark_s = new EMQuarkDefinition("Strange", "s", 2, 95e6D, -1, 7),
+ quark_b = new EMQuarkDefinition("Bottom", "b", 3, 4.65e9D, -1, 11),
+ quark_u_ = new EMQuarkDefinition("AntiUp", "~u", -1, 2.3e6D, -2, 4),
+ quark_c_ = new EMQuarkDefinition("AntiCharm", "~c", -2, 1.29e9D, -2, 10),
+ quark_t_ = new EMQuarkDefinition("AntiTop", "~t", -3, 172.44e9D, -2, 14),
+ quark_d_ = new EMQuarkDefinition("AntiDown", "~d", -1, 4.8e6D, 1, 6),
+ quark_s_ = new EMQuarkDefinition("AntiStrange", "~s", -2, 95e6D, 1, 8),
+ quark_b_ = new EMQuarkDefinition("AntiBottom", "~b", -3, 4.65e9D, 1, 12);
+
+ private EMQuarkDefinition(String name, String symbol, int type, double mass, int charge, int ID) {
+ super(name, symbol, type, mass, charge, 0, ID);
+ }
+
+ public static void run() {
+ quark_u.init(quark_u_, STABLE_RAW_LIFE_TIME, 3, -1,
+ new EMDecay(1.23201e-5D, quark_b/*,lepton_t_,lepton_Vt*/),
+ new EMDecay(0.050778116D, quark_s/*,lepton_m_,lepton_Vm*/),
+ new EMDecay(0.9D, quark_d, lepton_e_, lepton_Ve),
+ EMBosonDefinition.deadEnd);//makes photons and don't care
+ quark_c.init(quark_c_, 0.5e-13D, 1, -1,
+ new EMDecay(0.00169744D, quark_b/*,lepton_t_,lepton_Vt*/),
+ new EMDecay(0.05071504D, quark_d, lepton_m_, lepton_Vm),
+ new EMDecay(0.9D, quark_s, lepton_e_, lepton_Ve),
+ EMBosonDefinition.deadEnd);//makes photons and don't care
+ quark_t.init(quark_t_, 2.5e-26D, 0, -1,
+ new EMDecay(7.51689e-5D, quark_d, lepton_t_, lepton_Vt),
+ new EMDecay(0.00163216D, quark_s, lepton_m_, lepton_Vm),
+ new EMDecay(0.9D, quark_b, lepton_e_, lepton_Ve),
+ EMBosonDefinition.deadEnd);//makes photons and don't care
+
+ quark_d.init(quark_d_, STABLE_RAW_LIFE_TIME, 3, -1,
+ new EMDecay(7.51689e-5D, quark_t/*,lepton_t,lepton_Vt_*/),
+ new EMDecay(0.05071504D, quark_c/*,lepton_m,lepton_Vm_*/),
+ new EMDecay(0.9D, quark_u, lepton_e, lepton_Ve_),
+ EMBosonDefinition.deadEnd);//makes photons and don't care
+ quark_s.init(quark_s_, 0.6e-9D, 1, -1,
+ new EMDecay(0.00163216D, quark_t/*,lepton_t,lepton_Vt_*/),
+ new EMDecay(0.050778116D, quark_u, lepton_m, lepton_Vm_),
+ new EMDecay(0.9D, quark_c, lepton_e, lepton_Ve_),
+ EMBosonDefinition.deadEnd);//makes photons and don't care
+ quark_b.init(quark_b_, 0.7e-13D, 0, -1,
+ new EMDecay(1.23201e-5D, quark_u, lepton_t, lepton_Vt_),
+ new EMDecay(0.00169744D, quark_c, lepton_m, lepton_Vm_),
+ new EMDecay(0.9D, quark_t, lepton_e, lepton_Ve_),
+ EMBosonDefinition.deadEnd);//makes photons and don't care
+
+ quark_u_.init(quark_u, STABLE_RAW_LIFE_TIME, 3, -1,
+ new EMDecay(1.23201e-5D, quark_b_/*,lepton_t,lepton_Vt_*/),
+ new EMDecay(0.050778116D, quark_s_/*,lepton_m,lepton_Vm_*/),
+ new EMDecay(0.9D, quark_d_, lepton_e, lepton_Ve_),
+ EMBosonDefinition.deadEnd);//makes photons and don't care
+ quark_c_.init(quark_c, 0.5e-13D, 1, -1,
+ new EMDecay(0.00169744F, quark_b_/*,lepton_t,lepton_Vt_*/),
+ new EMDecay(0.05071504F, quark_d_, lepton_m, lepton_Vm_),
+ new EMDecay(0.9F, quark_s_, lepton_e, lepton_Ve_),
+ EMBosonDefinition.deadEnd);//makes photons and don't care
+ quark_t_.init(quark_t, 2.5e-26F, 0, -1,
+ new EMDecay(7.51689e-5F, quark_d_, lepton_t, lepton_Vt_),
+ new EMDecay(0.00163216F, quark_s_, lepton_m, lepton_Vm_),
+ new EMDecay(0.9F, quark_b_, lepton_e, lepton_Ve_),
+ EMBosonDefinition.deadEnd);//makes photons and don't care
+
+ quark_d_.init(quark_d, STABLE_RAW_LIFE_TIME, 3, -1,
+ new EMDecay(7.51689e-5F, quark_t_/*,lepton_t_,lepton_Vt*/),
+ new EMDecay(0.05071504F, quark_c_/*,lepton_m_,lepton_Vm*/),
+ new EMDecay(0.9F, quark_u_, lepton_e_, lepton_Ve),
+ EMBosonDefinition.deadEnd);//makes photons and don't care
+ quark_s_.init(quark_s, 0.6e-9F, 1, -1,
+ new EMDecay(0.00163216F, quark_t_/*,lepton_t_,lepton_Vt*/),
+ new EMDecay(0.050778116F, quark_u_, lepton_m_, lepton_Vm),
+ new EMDecay(0.9F, quark_c_, lepton_e_, lepton_Ve),
+ EMBosonDefinition.deadEnd);//makes photons and don't care
+ quark_b_.init(quark_b, 0.7e-13F, 0, -1,
+ new EMDecay(1.23201e-5F, quark_u_, lepton_t_, lepton_Vt),
+ new EMDecay(0.00169744F, quark_c_, lepton_m_, lepton_Vm),
+ new EMDecay(0.9F, quark_t_, lepton_e_, lepton_Ve),
+ EMBosonDefinition.deadEnd);//makes photons and don't care
+ }
+
+ @Override
+ public String getLocalizedName() {
+ return "Quark: " + getName();
+ }
+
+ @Override
+ public boolean isTimeSpanHalfLife() {
+ return true;
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java
deleted file mode 100644
index 8096743b78..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive;
-
-import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay.noDecay;
-
-/**
- * Created by danie_000 on 22.10.2016.
- */
-public final class cPrimitiveDefinition extends cElementalPrimitive {
- public static final cPrimitiveDefinition
- nbtE__ = new cPrimitiveDefinition("NBT ERROR", "!", 0, 0D, Integer.MIN_VALUE, Integer.MIN_VALUE+10_000),
- null__ = new cPrimitiveDefinition("NULL POINTER", ".", 0, 0D, -3, Integer.MAX_VALUE-10_000),
- space__ = new cPrimitiveDefinition("Space", "_", 0, 0D, -4, 0),
- magic = new cPrimitiveDefinition("Magic", "Ma", 4, 1e5D, 0, 1),
- magic_ = new cPrimitiveDefinition("Antimagic", "~Ma", -4, 1e5D, 0, 2);
-
- private cPrimitiveDefinition(String name, String symbol, int type, double mass, int color, int ID) {
- super(name, symbol, type, mass, 0, color, ID);
- }
-
- public static void run() {
- nbtE__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay);
- null__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay);
- space__.init(space__, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay);
- magic.init(magic_, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay);
- magic_.init(magic, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay);
- }
-
- @Override
- public String getName() {
- return "Primitive: " + name;
- }
-
- @Override
- public boolean isTimeSpanHalfLife() {
- return false;
- }
-} \ No newline at end of file
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java
deleted file mode 100644
index e87df806d3..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive;
-
-import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay.*;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition.*;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition.*;
-
-/**
- * Created by danie_000 on 22.10.2016.
- */
-public final class eBosonDefinition extends cElementalPrimitive {
- public static final eBosonDefinition
- boson_Y__ = new eBosonDefinition("Photon", "\u03b3", 1e-18D, -1, 27),
- boson_H__ = new eBosonDefinition("Higgs", "\u0397", 126.09e9D, -2, 28);
- //deadEnd
- public static final cElementalDecay deadEnd = new cElementalDecay(boson_Y__, boson_Y__);
- public static final cElementalDecay deadEndHalf = new cElementalDecay(boson_Y__);
- public static final cElementalDefinitionStack boson_Y__1=new cElementalDefinitionStack(boson_Y__,1);
-
- private eBosonDefinition(String name, String symbol, double mass, int color, int ID) {
- super(name, symbol, 0, mass, 0, color, ID);
- }
-
- public static void run() {
- boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay);
- boson_H__.init(null, 1.56e-22D, 2, 2,
- new cElementalDecay(0.01D, quark_b, quark_b_),
- new cElementalDecay(0.02D, lepton_t, lepton_t_),
- new cElementalDecay(0.96D, new cElementalDefinitionStack(boson_Y__, 4)),
- deadEnd);
- }
-
- @Override
- public String getName() {
- return "Boson: " + name;
- }
-
- @Override
- public boolean isTimeSpanHalfLife() {
- return this==boson_H__;
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java
deleted file mode 100644
index c8e3b07f02..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive;
-
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.*;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition.*;
-
-/**
- * Created by danie_000 on 22.10.2016.
- */
-public final class eLeptonDefinition extends cElementalPrimitive {
- public static final eLeptonDefinition
- lepton_e = new eLeptonDefinition("Electron", "\u03b2-", 1, 0.511e6D, -3, 15),
- lepton_m = new eLeptonDefinition("Muon", "\u03bc-", 2, 105.658e6D, -3, 17),
- lepton_t = new eLeptonDefinition("Tauon", "\u03c4-", 3, 1776.83e6D, -3, 19),
- lepton_e_ = new eLeptonDefinition("Positron", "\u03b2+", -1, 0.511e6D, 3, 16),
- lepton_m_ = new eLeptonDefinition("Antimuon", "\u03bc+", -2, 105.658e6D, 3, 18),
- lepton_t_ = new eLeptonDefinition("Antitauon", "\u03c4+", -3, 1776.83e6D, 3, 20);
-
- public static final cElementalDefinitionStack lepton_e1 = new cElementalDefinitionStack(lepton_e, 1);
- public static final cElementalDefinitionStack lepton_e2 = new cElementalDefinitionStack(lepton_e, 2);
- public static final cElementalDefinitionStack lepton_e_1 = new cElementalDefinitionStack(lepton_e_, 1);
- public static final cElementalDefinitionStack lepton_e_2 = new cElementalDefinitionStack(lepton_e_, 2);
-
- private eLeptonDefinition(String name, String symbol, int type, double mass, int charge, int ID) {
- super(name, symbol, type, mass, charge, -1, ID);
- //this.itemThing=null;
- //this.fluidThing=null;
- }
-
- public static void run() {
- lepton_e.init(lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1,
- deadEnd,
- new cElementalDecay(lepton_e,boson_Y__));
- lepton_m.init(lepton_m_, 2.197019e-6D, 0, 1,
- new cElementalDecay(0.9D, lepton_e, lepton_Ve_, lepton_Vm),
- deadEnd);//makes photons and don't care
- lepton_t.init(lepton_t_, 2.906e-13D, 1, 3,
- new cElementalDecay(0.05F, lepton_m, lepton_Vm_, lepton_Vt, boson_H__),
- new cElementalDecay(0.1D, lepton_e, lepton_Ve_, lepton_Vm),
- new cElementalDecay(0.8D, lepton_m, lepton_Vm_, lepton_Vt, boson_Y__),
- deadEnd);//makes photons and don't care
-
- lepton_e_.init(lepton_e, STABLE_RAW_LIFE_TIME, 0, 1,
- deadEnd,
- new cElementalDecay(lepton_e,boson_Y__));
- lepton_m_.init(lepton_m, 2.197019e-6F, 0, 1,
- new cElementalDecay(0.9F, lepton_e_, lepton_Ve, lepton_Vm_),
- deadEnd);//makes photons and don't care
- lepton_t_.init(lepton_t, 2.906e-13F, 1, 3,
- new cElementalDecay(0.05F, lepton_m_, lepton_Vm, lepton_Vt_, boson_H__),
- new cElementalDecay(0.1F, lepton_e_, lepton_Ve, lepton_Vm_),
- new cElementalDecay(0.8F, lepton_m_, lepton_Vm, lepton_Vt_, boson_Y__),
- deadEnd);//makes photons and don't care
- }
-
- @Override
- public String getName() {
- return "Lepton: " + name;
- }
-
- @Override
- public boolean isTimeSpanHalfLife() {
- return true;
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java
deleted file mode 100644
index 0f0725d208..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive;
-
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.*;
-
-/**
- * Created by danie_000 on 22.10.2016.
- */
-public final class eNeutrinoDefinition extends cElementalPrimitive {
- public static final eNeutrinoDefinition
- lepton_Ve = new eNeutrinoDefinition("Electron neutrino", "\u03bd\u03b2", 1, 2e0D, 21),
- lepton_Vm = new eNeutrinoDefinition("Muon neutrino", "\u03bd\u03bc", 2, 0.15e6D, 23),
- lepton_Vt = new eNeutrinoDefinition("Tauon neutrino", "\u03bd\u03c4", 3, 15e6D, 25),
- lepton_Ve_ = new eNeutrinoDefinition("Positron neutrino", "~\u03bd\u03b2", -1, 2e0D, 22),
- lepton_Vm_ = new eNeutrinoDefinition("Antimuon neutrino", "~\u03bd\u03bc", -2, 0.15e6D, 24),
- lepton_Vt_ = new eNeutrinoDefinition("Antitauon neutrino", "~\u03bd\u03c4", -3, 15e6D, 26);
-
- public static final cElementalDefinitionStack lepton_Ve1 = new cElementalDefinitionStack(lepton_Ve, 1);
- public static final cElementalDefinitionStack lepton_Ve2 = new cElementalDefinitionStack(lepton_Ve, 2);
- public static final cElementalDefinitionStack lepton_Ve_1 = new cElementalDefinitionStack(lepton_Ve_, 1);
- public static final cElementalDefinitionStack lepton_Ve_2 = new cElementalDefinitionStack(lepton_Ve_, 2);
-
- private eNeutrinoDefinition(String name, String symbol, int type, double mass, int ID) {
- super(name, symbol, type, mass, 0, -1, ID);
- }
-
- public static void run() {
- lepton_Ve.init(lepton_Ve_, 1D, -1, -1,
- cElementalDecay.noProduct);
- lepton_Vm.init(lepton_Vm_, 1D, 1, 0,
- new cElementalDecay(0.825D, nothing),
- deadEndHalf);
- lepton_Vt.init(lepton_Vt_, 1, 1, 0,
- new cElementalDecay(0.75F, nothing),
- deadEnd);
-
- lepton_Ve_.init(lepton_Ve, 1, -1, -1,
- cElementalDecay.noProduct);
- lepton_Vm_.init(lepton_Vm, 1, 1, 0,
- new cElementalDecay(0.825F, nothing),
- deadEndHalf);
- lepton_Vt_.init(lepton_Vt, 1, 1, 0,
- new cElementalDecay(0.75F, nothing),
- deadEnd);
- }
-
- @Override
- public String getName() {
- return "Lepton: " + name;
- }
-
- @Override
- public boolean isTimeSpanHalfLife() {
- return true;
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java
deleted file mode 100644
index 798066466b..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecay;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive;
-
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition.*;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition.*;
-
-/**
- * Created by danie_000 on 22.10.2016.
- */
-public final class eQuarkDefinition extends cElementalPrimitive {
- public static final eQuarkDefinition
- quark_u = new eQuarkDefinition("Up", "u", 1, 2.3e6D, 2, 3),
- quark_c = new eQuarkDefinition("Charm", "c", 2, 1.29e9D, 2, 9),
- quark_t = new eQuarkDefinition("Top", "t", 3, 172.44e9D, 2, 13),
- quark_d = new eQuarkDefinition("Down", "d", 1, 4.8e6D, -1, 5),
- quark_s = new eQuarkDefinition("Strange", "s", 2, 95e6D, -1, 7),
- quark_b = new eQuarkDefinition("Bottom", "b", 3, 4.65e9D, -1, 11),
- quark_u_ = new eQuarkDefinition("AntiUp", "~u", -1, 2.3e6D, -2, 4),
- quark_c_ = new eQuarkDefinition("AntiCharm", "~c", -2, 1.29e9D, -2, 10),
- quark_t_ = new eQuarkDefinition("AntiTop", "~t", -3, 172.44e9D, -2, 14),
- quark_d_ = new eQuarkDefinition("AntiDown", "~d", -1, 4.8e6D, 1, 6),
- quark_s_ = new eQuarkDefinition("AntiStrange", "~s", -2, 95e6D, 1, 8),
- quark_b_ = new eQuarkDefinition("AntiBottom", "~b", -3, 4.65e9D, 1, 12);
-
- private eQuarkDefinition(String name, String symbol, int type, double mass, int charge, int ID) {
- super(name, symbol, type, mass, charge, 0, ID);
- }
-
- public static void run() {
- quark_u.init(quark_u_, STABLE_RAW_LIFE_TIME, 3, -1,
- new cElementalDecay(1.23201e-5D, quark_b/*,lepton_t_,lepton_Vt*/),
- new cElementalDecay(0.050778116D, quark_s/*,lepton_m_,lepton_Vm*/),
- new cElementalDecay(0.9D, quark_d, lepton_e_, lepton_Ve),
- eBosonDefinition.deadEnd);//makes photons and don't care
- quark_c.init(quark_c_, 0.5e-13D, 1, -1,
- new cElementalDecay(0.00169744D, quark_b/*,lepton_t_,lepton_Vt*/),
- new cElementalDecay(0.05071504D, quark_d, lepton_m_, lepton_Vm),
- new cElementalDecay(0.9D, quark_s, lepton_e_, lepton_Ve),
- eBosonDefinition.deadEnd);//makes photons and don't care
- quark_t.init(quark_t_, 2.5e-26D, 0, -1,
- new cElementalDecay(7.51689e-5D, quark_d, lepton_t_, lepton_Vt),
- new cElementalDecay(0.00163216D, quark_s, lepton_m_, lepton_Vm),
- new cElementalDecay(0.9D, quark_b, lepton_e_, lepton_Ve),
- eBosonDefinition.deadEnd);//makes photons and don't care
-
- quark_d.init(quark_d_, STABLE_RAW_LIFE_TIME, 3, -1,
- new cElementalDecay(7.51689e-5D, quark_t/*,lepton_t,lepton_Vt_*/),
- new cElementalDecay(0.05071504D, quark_c/*,lepton_m,lepton_Vm_*/),
- new cElementalDecay(0.9D, quark_u, lepton_e, lepton_Ve_),
- eBosonDefinition.deadEnd);//makes photons and don't care
- quark_s.init(quark_s_, 0.6e-9D, 1, -1,
- new cElementalDecay(0.00163216D, quark_t/*,lepton_t,lepton_Vt_*/),
- new cElementalDecay(0.050778116D, quark_u, lepton_m, lepton_Vm_),
- new cElementalDecay(0.9D, quark_c, lepton_e, lepton_Ve_),
- eBosonDefinition.deadEnd);//makes photons and don't care
- quark_b.init(quark_b_, 0.7e-13D, 0, -1,
- new cElementalDecay(1.23201e-5D, quark_u, lepton_t, lepton_Vt_),
- new cElementalDecay(0.00169744D, quark_c, lepton_m, lepton_Vm_),
- new cElementalDecay(0.9D, quark_t, lepton_e, lepton_Ve_),
- eBosonDefinition.deadEnd);//makes photons and don't care
-
- quark_u_.init(quark_u, STABLE_RAW_LIFE_TIME, 3, -1,
- new cElementalDecay(1.23201e-5D, quark_b_/*,lepton_t,lepton_Vt_*/),
- new cElementalDecay(0.050778116D, quark_s_/*,lepton_m,lepton_Vm_*/),
- new cElementalDecay(0.9D, quark_d_, lepton_e, lepton_Ve_),
- eBosonDefinition.deadEnd);//makes photons and don't care
- quark_c_.init(quark_c, 0.5e-13D, 1, -1,
- new cElementalDecay(0.00169744F, quark_b_/*,lepton_t,lepton_Vt_*/),
- new cElementalDecay(0.05071504F, quark_d_, lepton_m, lepton_Vm_),
- new cElementalDecay(0.9F, quark_s_, lepton_e, lepton_Ve_),
- eBosonDefinition.deadEnd);//makes photons and don't care
- quark_t_.init(quark_t, 2.5e-26F, 0, -1,
- new cElementalDecay(7.51689e-5F, quark_d_, lepton_t, lepton_Vt_),
- new cElementalDecay(0.00163216F, quark_s_, lepton_m, lepton_Vm_),
- new cElementalDecay(0.9F, quark_b_, lepton_e, lepton_Ve_),
- eBosonDefinition.deadEnd);//makes photons and don't care
-
- quark_d_.init(quark_d, STABLE_RAW_LIFE_TIME, 3, -1,
- new cElementalDecay(7.51689e-5F, quark_t_/*,lepton_t_,lepton_Vt*/),
- new cElementalDecay(0.05071504F, quark_c_/*,lepton_m_,lepton_Vm*/),
- new cElementalDecay(0.9F, quark_u_, lepton_e_, lepton_Ve),
- eBosonDefinition.deadEnd);//makes photons and don't care
- quark_s_.init(quark_s, 0.6e-9F, 1, -1,
- new cElementalDecay(0.00163216F, quark_t_/*,lepton_t_,lepton_Vt*/),
- new cElementalDecay(0.050778116F, quark_u_, lepton_m_, lepton_Vm),
- new cElementalDecay(0.9F, quark_c_, lepton_e_, lepton_Ve),
- eBosonDefinition.deadEnd);//makes photons and don't care
- quark_b_.init(quark_b, 0.7e-13F, 0, -1,
- new cElementalDecay(1.23201e-5F, quark_u_, lepton_t_, lepton_Vt),
- new cElementalDecay(0.00169744F, quark_c_, lepton_m_, lepton_Vm),
- new cElementalDecay(0.9F, quark_t_, lepton_e_, lepton_Ve),
- eBosonDefinition.deadEnd);//makes photons and don't care
- }
-
- @Override
- public String getName() {
- return "Quark: " + name;
- }
-
- @Override
- public boolean isTimeSpanHalfLife() {
- return true;
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java
index 05f251924e..f5cfad22f3 100644
--- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java
+++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java
@@ -1,9 +1,11 @@
package com.github.technus.tectech.recipe;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.IEMMapRead;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMComplex;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.util.GT_Recipe;
import net.minecraft.item.ItemStack;
@@ -17,16 +19,16 @@ import java.util.HashSet;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
public class TT_recipe extends GT_Recipe {
- public static final String E_RECIPE_ID = "eRecipeID";
- public final cElementalConstantStackMap[] input;
- public final cElementalConstantStackMap[] output;
- public final cElementalConstantStackMap[] eCatalyst;
- public final IAdditionalCheck additionalCheck;
+ public static final String E_RECIPE_ID = "eRecipeID";
+ public final EMConstantStackMap[] input;
+ public final IEMMapRead<? extends IEMStack>[] output;
+ public final EMConstantStackMap[] eCatalyst;
+ public final IAdditionalCheck additionalCheck;
public TT_recipe(boolean aOptimize,
ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances,
FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue,
- cElementalConstantStackMap[] in, cElementalConstantStackMap[] out, cElementalConstantStackMap[] catalyst, IAdditionalCheck check){
+ EMConstantStackMap[] in, IEMMapRead<? extends IEMStack>[] out, EMConstantStackMap[] catalyst, IAdditionalCheck check){
super(aOptimize,aInputs,aOutputs,aSpecialItems,aChances,aFluidInputs,aFluidOutputs,aDuration,aEUt,aSpecialValue);
input=in;
output=out;
@@ -38,11 +40,11 @@ public class TT_recipe extends GT_Recipe {
return EMisRecipeInputEqual(consume,doNotCheckStackSizes,itemStacks,fluidStacks,null,null);
}
- public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in){
+ public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap[] in){
return EMisRecipeInputEqual(consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,null);
}
- public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in, cElementalInstanceStackMap[] catalyst) {
+ public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap[] in, EMInstanceStackMap[] catalyst) {
if(additionalCheck !=null && !additionalCheck.check(this,consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,catalyst)) {
return false;
}
@@ -51,7 +53,7 @@ public class TT_recipe extends GT_Recipe {
for (int i = 0; i < eCatalyst.length; i++) {
if (eCatalyst[i] != null && eCatalyst[i].hasStacks()) {
if (catalyst[i] != null && catalyst[i].hasStacks()) {
- if (!catalyst[i].removeAllAmounts(true, eCatalyst[i])) {
+ if (!catalyst[i].containsAllAmounts(eCatalyst[i])) {
return false;
}
} else {
@@ -68,8 +70,14 @@ public class TT_recipe extends GT_Recipe {
for (int i = 0; i < input.length; i++) {
if (input[i] != null && input[i].hasStacks()) {
if (in[i] != null && in[i].hasStacks()) {
- if (!in[i].removeAllAmounts(consume, input[i])) {
- return false;
+ if(consume){
+ if (!in[i].removeAllAmounts(input[i])) {
+ return false;
+ }
+ }else {
+ if (!in[i].containsAllAmounts(input[i])) {
+ return false;
+ }
}
} else {
return false;
@@ -83,11 +91,13 @@ public class TT_recipe extends GT_Recipe {
return super.isRecipeInputEqual(consume, doNotCheckStackSizes, fluidStacks, itemStacks);
}
- public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in){
+ @Deprecated
+ public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap in){
return EMisRecipeInputEqualConsumeFromOne(consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,null);
}
- public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in, cElementalInstanceStackMap[] catalyst) {
+ @Deprecated
+ public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap in, EMInstanceStackMap[] catalyst) {
if(additionalCheck !=null && !additionalCheck.check(this,consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,catalyst)) {
return false;
}
@@ -96,7 +106,7 @@ public class TT_recipe extends GT_Recipe {
for (int i = 0; i < eCatalyst.length; i++) {
if (eCatalyst[i] != null && eCatalyst[i].hasStacks()) {
if (catalyst[i] != null && catalyst[i].hasStacks()) {
- if (!catalyst[i].removeAllAmounts(true, eCatalyst[i])) {
+ if (!catalyst[i].containsAllAmounts(eCatalyst[i])) {
return false;
}
} else {
@@ -110,11 +120,17 @@ public class TT_recipe extends GT_Recipe {
}
if (input != null) {
if (in != null) {
- for (cElementalConstantStackMap anInput : input) {
+ for (EMConstantStackMap anInput : input) {
if (anInput != null && anInput.hasStacks()) {
if (in.hasStacks()) {
- if (!in.removeAllAmounts(consume, anInput)) {
- return false;
+ if(consume){
+ if (!in.removeAllAmounts(anInput)) {
+ return false;
+ }
+ }else {
+ if (!in.containsAllAmounts(anInput)) {
+ return false;
+ }
}
} else {
return false;
@@ -129,8 +145,8 @@ public class TT_recipe extends GT_Recipe {
}
public interface IAdditionalCheck {
- boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in, cElementalInstanceStackMap[] e);
- boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in, cElementalInstanceStackMap[] e);
+ boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap[] in, EMInstanceStackMap[] e);
+ boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap in, EMInstanceStackMap[] e);
}
public static class TT_Recipe_Map<T extends TT_recipe> {
@@ -166,12 +182,20 @@ public class TT_recipe extends GT_Recipe {
}
public static class GT_Recipe_MapTT extends GT_Recipe.GT_Recipe_Map {
- public static GT_Recipe_MapTT sResearchableFakeRecipes =new GT_Recipe_MapTT(new HashSet<>(32), "gt.recipe.researchStation", "Research station", null, "gregtech:textures/gui/multimachines/ResearchFake", 1, 1,1,0,1,"", 1, "", true, false);//nei to false - using custom handler
- public static GT_Recipe_MapTT sScannableFakeRecipes = new GT_Recipe_MapTT(new HashSet<>(32),"gt.recipe.em_scanner","EM Scanner Research", null,"gregtech:textures/gui/multimachines/ResearchFake",1,1,1,0,1,"",1,"",true,false);
- public static ArrayList<GT_Recipe_AssemblyLine> sAssemblylineRecipes=new ArrayList<>();
+ public static GT_Recipe_MapTT sResearchableFakeRecipes = new GT_Recipe_MapTT(new HashSet<>(32), "gt.recipe.researchStation", "Research station", null, "gregtech:textures/gui/multimachines/ResearchFake", 1, 1, 1, 0, 1, "", 1, "", true, false);//nei to false - using custom handler
+ public static GT_Recipe_MapTT sScannableFakeRecipes = new GT_Recipe_MapTT(new HashSet<>(32), "gt.recipe.em_scanner", "EM Scanner Research", null, "gregtech:textures/gui/multimachines/ResearchFake", 1, 1, 1, 0, 1, "", 1, "", true, false);
+ public static ArrayList<GT_Recipe_AssemblyLine> sAssemblylineRecipes = new ArrayList<>();
- public GT_Recipe_MapTT(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) {
- super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed);
+ public GT_Recipe_MapTT(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath,
+ int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids,
+ int aAmperage,
+ String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost,
+ boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) {
+ super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath,
+ aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids,
+ aAmperage,
+ aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost,
+ aShowVoltageAmperageInNEI, aNEIAllowed);
}
}
@@ -181,7 +205,7 @@ public class TT_recipe extends GT_Recipe {
public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem,
ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems,
FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue,
- cElementalConstantStackMap[] in, cElementalConstantStackMap[] out, cElementalConstantStackMap[] catalyst, IAdditionalCheck check) {
+ EMConstantStackMap[] in, EMConstantStackMap[] out, EMConstantStackMap[] catalyst, IAdditionalCheck check) {
super(aOptimize, aInputs, aOutputs, aSpecialItems, null, aFluidInputs, null, aDuration, aEUt, aSpecialValue, in, out, catalyst, check);
mResearchItem=researchItem;
}
@@ -189,28 +213,28 @@ public class TT_recipe extends GT_Recipe {
public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem,
ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems,
FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue,
- cElementalConstantStackMap[] in) {
+ EMConstantStackMap[] in) {
this(aOptimize, researchItem, aInputs, aOutputs, aSpecialItems, aFluidInputs, aDuration, aEUt, aSpecialValue, in, null, null,null);
}
}
public static class TT_EMRecipe extends TT_recipe{
- public final iElementalDefinition mResearchEM;
- public final GT_Recipe scannerRecipe;
+ public final IEMDefinition mResearchEM;
+ public final GT_Recipe scannerRecipe;
- public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, iElementalDefinition researchEM,
+ public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, IEMDefinition researchEM,
ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems,
FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue,
- cElementalConstantStackMap[] in, cElementalConstantStackMap[] out, cElementalConstantStackMap[] catalyst, IAdditionalCheck check) {
+ EMConstantStackMap[] in, EMConstantStackMap[] out, EMConstantStackMap[] catalyst, IAdditionalCheck check) {
super(aOptimize, aInputs, aOutputs, aSpecialItems, null, aFluidInputs, null, aDuration, aEUt, aSpecialValue, in, out, catalyst, check);
mResearchEM=researchEM;
this.scannerRecipe=scannerRecipe;
}
- public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, iElementalDefinition researchEM,
+ public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, IEMDefinition researchEM,
ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems,
FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue,
- cElementalConstantStackMap[] in) {
+ EMConstantStackMap[] in) {
this(aOptimize, scannerRecipe, researchEM, aInputs, aOutputs, aSpecialItems, aFluidInputs, aDuration, aEUt, aSpecialValue, in, null, null,null);
}
}
@@ -219,8 +243,8 @@ public class TT_recipe extends GT_Recipe {
public static TT_Recipe_Map_EM<TT_EMRecipe> sCrafterRecipesEM = new TT_Recipe_Map_EM<>("EM Crafter Recipes","gt.recipe.em_crafter",null);
public static TT_Recipe_Map_EM<TT_EMRecipe> sMachineRecipesEM = new TT_Recipe_Map_EM<>("EM Machinert Recipe","gt.recipe.em_machinery",null);
- private final HashMap<iElementalDefinition,T> mRecipeMap;
- public final String mNEIName,mUnlocalizedName,mNEIGUIPath;
+ private final HashMap<IEMDefinition,T> mRecipeMap;
+ public final String mNEIName,mUnlocalizedName,mNEIGUIPath;
public TT_Recipe_Map_EM(String mNEIName,String mUnlocalizedName,String mNEIGUIPath){
mRecipeMap =new HashMap<>(16);
@@ -229,7 +253,7 @@ public class TT_recipe extends GT_Recipe {
this.mNEIGUIPath=mNEIGUIPath;
}
- public T findRecipe(iElementalDefinition stack){
+ public T findRecipe(IEMDefinition stack){
return mRecipeMap.get(stack);
}
@@ -238,7 +262,7 @@ public class TT_recipe extends GT_Recipe {
return null;
}
try {
- return mRecipeMap.get(cElementalDefinition.fromNBT(dataHandler.stackTagCompound.getCompoundTag(E_RECIPE_ID)));
+ return mRecipeMap.get(EMComplex.fromNBT(dataHandler.stackTagCompound.getCompoundTag(E_RECIPE_ID)));
}catch (Exception e){
if (DEBUG_MODE) {
e.printStackTrace();
diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java
index ffa69ef78e..c72bf0ab9e 100644
--- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java
+++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java
@@ -1,9 +1,9 @@
package com.github.technus.tectech.recipe;
import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
import com.github.technus.tectech.thing.CustomItemList;
import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM;
import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting;
@@ -150,7 +150,7 @@ public class TT_recipeAdder extends GT_RecipeAdder {
public static boolean addResearchableEMmachineRecipe(
ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage,
- ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalConstantStackMap[] eInputs,
+ ItemStack[] aInputs, FluidStack[] aFluidInputs, EMConstantStackMap[] eInputs,
ItemStack aOutput, int machineDuration, int machineEUt, int machineAmperage) {
if(aInputs==null) {
aInputs = nullItem;
@@ -184,7 +184,7 @@ public class TT_recipeAdder extends GT_RecipeAdder {
public static boolean addResearchableEMcrafterRecipe(
ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage,
- cElementalConstantStackMap[] eInputs, cElementalConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check,
+ EMConstantStackMap[] eInputs, EMConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check,
ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) {
if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null) {
return false;
@@ -206,8 +206,8 @@ public class TT_recipeAdder extends GT_RecipeAdder {
}
public static boolean addScannableEMmachineRecipe(
- iElementalDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage,
- ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalConstantStackMap[] eInputs,
+ IEMDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage,
+ ItemStack[] aInputs, FluidStack[] aFluidInputs, EMConstantStackMap[] eInputs,
ItemStack aOutput, int machineDuration, int machineEUt, int machineAmperage) {
if(aInputs==null) {
aInputs = nullItem;
@@ -234,7 +234,7 @@ public class TT_recipeAdder extends GT_RecipeAdder {
computationRequiredPerSec = Short.MAX_VALUE;
}
ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE);
- ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalConstantStackMap(new cElementalDefinitionStack(aResearchEM,1)));
+ ElementalDefinitionContainer_EM.setContent(placeholder,new EMConstantStackMap(new EMDefinitionStack(aResearchEM,1)));
GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_machine.machine)}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16);
TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,aInputs,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")},
aFluidInputs,machineDuration,machineEUt,machineAmperage,eInputs));
@@ -242,8 +242,8 @@ public class TT_recipeAdder extends GT_RecipeAdder {
}
public static boolean addScannableEMcrafterRecipe(
- iElementalDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage,
- cElementalConstantStackMap[] eInputs, cElementalConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check,
+ IEMDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage,
+ EMConstantStackMap[] eInputs, EMConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check,
ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) {
if (aResearchEM==null || totalComputationRequired<=0 || aOutput == null) {
return false;
@@ -259,7 +259,7 @@ public class TT_recipeAdder extends GT_RecipeAdder {
computationRequiredPerSec = Short.MAX_VALUE;
}
ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE);
- ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalConstantStackMap(new cElementalDefinitionStack(aResearchEM,1)));
+ ElementalDefinitionContainer_EM.setContent(placeholder,new EMConstantStackMap(new EMDefinitionStack(aResearchEM,1)));
GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafting.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16);
TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,null,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")},
null,crafterDuration,crafterEUt,crafterAmperage,eInputs,null,catalyst,check));
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 b1f6d8887b..107cb97103 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
@@ -3,11 +3,11 @@ package com.github.technus.tectech.thing.item;
import com.github.technus.tectech.util.CommonValues;
import com.github.technus.tectech.util.Util;
import com.github.technus.tectech.font.TecTechFontRender;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalContainer;
-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.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.IEMContainer;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition;
import com.github.technus.tectech.thing.item.renderElemental.IElementalItem;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.SideOnly;
@@ -31,7 +31,7 @@ import java.util.TreeSet;
import static com.github.technus.tectech.Reference.MODID;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.*;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.*;
import static cpw.mods.fml.relauncher.Side.CLIENT;
import static net.minecraft.util.StatCollector.translateToLocal;
@@ -39,7 +39,7 @@ import static net.minecraft.util.StatCollector.translateToLocal;
* Created by Tec on 15.03.2017.
*/
public final class DebugElementalInstanceContainer_EM extends Item implements IElementalItem {
- public static final TreeSet<iElementalDefinition> STACKS_REGISTERED =new TreeSet<>();
+ public static final TreeSet<IEMDefinition> STACKS_REGISTERED =new TreeSet<>();
public static DebugElementalInstanceContainer_EM INSTANCE;
@@ -58,23 +58,23 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE
aStack.stackSize = 1;
if (tTileEntity instanceof IGregTechTileEntity) {
IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity();
- if (metaTE instanceof iElementalContainer) {
- cElementalInstanceStackMap content = ((iElementalContainer) metaTE).getContentHandler();
+ if (metaTE instanceof IEMContainer) {
+ EMInstanceStackMap content = ((IEMContainer) metaTE).getContentHandler();
if (tNBT.hasKey("content")) {
try {
- content.putUnifyAll(cElementalInstanceStackMap.fromNBT(tNBT.getCompoundTag("content")));
- } catch (tElementalException e) {
+ content.putUnifyAll(EMInstanceStackMap.fromNBT(tNBT.getCompoundTag("content")));
+ } catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
}
return true;
}
- ((iElementalContainer) metaTE).purgeOverflow();
+ ((IEMContainer) metaTE).purgeOverflow();
tNBT.removeTag("content");
tNBT.removeTag("symbols");
tNBT.removeTag("info");
} else if (content.hasStacks()) {
- ((iElementalContainer) metaTE).purgeOverflow();
+ ((IEMContainer) metaTE).purgeOverflow();
tNBT.setTag("info", content.getInfoNBT());
tNBT.setTag("content", content.toNBT());
tNBT.setTag("symbols", content.getShortSymbolsNBT());
@@ -87,7 +87,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE
return aPlayer instanceof EntityPlayerMP;
}
- public ItemStack setContent(ItemStack aStack,cElementalInstanceStackMap content){
+ public ItemStack setContent(ItemStack aStack, EMInstanceStackMap content){
NBTTagCompound tNBT = aStack.getTagCompound();
if(tNBT==null){
tNBT=new NBTTagCompound();
@@ -95,8 +95,8 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE
}
if (tNBT.hasKey("content")) {
try {
- content.putUnifyAll(cElementalInstanceStackMap.fromNBT(tNBT.getCompoundTag("content")));
- } catch (tElementalException e) {
+ content.putUnifyAll(EMInstanceStackMap.fromNBT(tNBT.getCompoundTag("content")));
+ } catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
}
@@ -141,10 +141,10 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE
ItemStack that = new ItemStack(this, 1);
that.setTagCompound(new NBTTagCompound());
list.add(that);
- for(iElementalDefinition definition: STACKS_REGISTERED){
- list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 1 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT))));
- list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 144 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT_144))));
- list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 1000 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT_1000))));
+ for(IEMDefinition definition: STACKS_REGISTERED){
+ list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 1 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT))));
+ list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 144 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT_144))));
+ list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" 1000 mol"),new EMInstanceStackMap(new EMInstanceStack(definition, AVOGADRO_CONSTANT_1000))));
}
}
diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java
index 2513bdf8bf..2cca6474f4 100644
--- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java
+++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java
@@ -3,8 +3,8 @@ package com.github.technus.tectech.thing.item;
import com.github.technus.tectech.util.CommonValues;
import com.github.technus.tectech.util.Util;
import com.github.technus.tectech.font.TecTechFontRender;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalConstantStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
import com.github.technus.tectech.thing.item.renderElemental.IElementalItem;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.SideOnly;
@@ -38,18 +38,18 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem
}
//return previous thing
- public static cElementalConstantStackMap setContent(ItemStack containerItem, cElementalConstantStackMap definitions){
+ public static EMConstantStackMap setContent(ItemStack containerItem, EMConstantStackMap definitions){
if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM) {
NBTTagCompound tNBT = containerItem.stackTagCompound;
if (tNBT == null) {
tNBT = containerItem.stackTagCompound = new NBTTagCompound();
}
- cElementalConstantStackMap oldMap =null;
+ EMConstantStackMap oldMap =null;
if (tNBT.hasKey("content")) {
try {
- oldMap= cElementalConstantStackMap.fromNBT(tNBT.getCompoundTag("content"));
- } catch (tElementalException e) {
+ oldMap= EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content"));
+ } catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
}
@@ -63,7 +63,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem
return null;
}
- public static cElementalConstantStackMap getContent(ItemStack containerItem){
+ public static EMConstantStackMap getContent(ItemStack containerItem){
if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM){
NBTTagCompound tNBT = containerItem.stackTagCompound;
@@ -71,8 +71,8 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem
return null;
}
try {
- return cElementalConstantStackMap.fromNBT(tNBT.getCompoundTag("content"));
- } catch (tElementalException e) {
+ return EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content"));
+ } catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
}
@@ -81,18 +81,18 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem
return null;
}
- public static cElementalConstantStackMap clearContent(ItemStack containerItem){
+ public static EMConstantStackMap clearContent(ItemStack containerItem){
if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM){
NBTTagCompound tNBT = containerItem.stackTagCompound;
if (tNBT == null) {
return null;
}
- cElementalConstantStackMap oldMap =null;
+ EMConstantStackMap oldMap =null;
if (tNBT.hasKey("content")) {
try {
- oldMap= cElementalConstantStackMap.fromNBT(tNBT.getCompoundTag("content"));
- } catch (tElementalException e) {
+ oldMap= EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content"));
+ } catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
}
diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java
index e43feb2351..e517fe5f2a 100644
--- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java
+++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java
@@ -5,7 +5,7 @@ import com.github.technus.tectech.TecTech;
import com.github.technus.tectech.util.Util;
import com.github.technus.tectech.font.TecTechFontRender;
import com.github.technus.tectech.loader.gui.ModGuiHandler;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
import com.github.technus.tectech.thing.CustomItemList;
import com.github.technus.tectech.thing.item.renderElemental.IElementalItem;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -44,7 +44,7 @@ public final class ElementalDefinitionScanStorage_EM extends Item implements IEl
}
//return previous thing
- public static void setContent(ItemStack containerItem, cElementalInstanceStackMap definitions, int[] detailsOnDepthLevels){
+ public static void setContent(ItemStack containerItem, EMInstanceStackMap definitions, int[] detailsOnDepthLevels){
if(containerItem.getItem() instanceof ElementalDefinitionScanStorage_EM) {
if (containerItem.stackTagCompound == null) {
containerItem.stackTagCompound = new NBTTagCompound();
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java
index d25a0c62ed..0950a173ab 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java
@@ -1,9 +1,9 @@
package com.github.technus.tectech.thing.metaTileEntity.hatch;
import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalContainer;
-import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.IEMContainer;
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
import com.github.technus.tectech.mechanics.pipe.IConnectsToElementalPipe;
import com.github.technus.tectech.util.Util;
import cpw.mods.fml.relauncher.Side;
@@ -24,7 +24,7 @@ import net.minecraftforge.fluids.FluidStack;
import org.apache.commons.lang3.reflect.FieldUtils;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144;
import static com.github.technus.tectech.util.CommonValues.*;
import static gregtech.api.enums.Dyes.MACHINE_METAL;
import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity;
@@ -34,16 +34,16 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted;
/**
* Created by danie_000 on 11.12.2016.
*/
-public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch implements iElementalContainer, IConnectsToElementalPipe {
+public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch implements IEMContainer, IConnectsToElementalPipe {
private static Textures.BlockIcons.CustomIcon EM_T_SIDES;
private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE;
private static Textures.BlockIcons.CustomIcon EM_T_CONN;
private String clientLocale = "en_US";
- protected cElementalInstanceStackMap content = new cElementalInstanceStackMap();
+ protected EMInstanceStackMap content = new EMInstanceStackMap();
//float lifeTimeMult=1f;
- public int postEnergize = 0;
+ public int postEnergize = 0;
public double overflowMatter = 0f;
public short id = -1;
private byte deathDelay = 2;
@@ -95,13 +95,13 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta
overflowMatter = aNBT.getFloat("overflowMatter")+aNBT.getDouble("OverflowMatter");
id = aNBT.getShort("eID");
try {
- content = cElementalInstanceStackMap.fromNBT(aNBT.getCompoundTag("eM_Stacks"));
- } catch (tElementalException e) {
+ content = EMInstanceStackMap.fromNBT(aNBT.getCompoundTag("eM_Stacks"));
+ } catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
}
if (content == null) {
- content = new cElementalInstanceStackMap();
+ content = new EMInstanceStackMap();
}
}
}
@@ -165,7 +165,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta
}
@Override
- public cElementalInstanceStackMap getContentHandler() {
+ public EMInstanceStackMap getContentHandler() {
return content;
}
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 a61bf27fe3..4a0bb55784 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
@@ -1,17 +1,17 @@
package com.github.technus.tectech.thing.metaTileEntity.multi;
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.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition;
+import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition;
import com.github.technus.tectech.mechanics.constructable.IConstructable;
-import com.github.technus.tectech.mechanics.elementalMatter.core.decay.cElementalDecayResult;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalDefinitionStackMap;
-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.dAtomDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.templates.EMPrimitive;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition;
import com.github.technus.tectech.mechanics.structure.IStructureDefinition;
import com.github.technus.tectech.mechanics.structure.StructureDefinition;
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
@@ -38,7 +38,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import java.util.HashMap;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT;
import static com.github.technus.tectech.mechanics.structure.StructureUtility.*;
import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset;
import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage;
@@ -61,9 +61,9 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
private static double MASS_TO_EU_INSTANT;
private static int STARTUP_COST, KEEPUP_COST;
- protected byte eTier = 0;
- protected cElementalInstanceStack stack;
- private long plasmaEnergy;
+ protected byte eTier = 0;
+ protected EMInstanceStack stack;
+ private long plasmaEnergy;
protected boolean started = false;
//endregion
@@ -73,7 +73,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
public static final HashMap<String, IPrimitiveColliderHandler> PRIMITIVE_FUSE_HANDLERS = new HashMap<>();
public interface IPrimitiveColliderHandler {
- void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out);
+ void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out);
}
public interface IColliderHandler extends IPrimitiveColliderHandler {
@@ -81,23 +81,23 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
}
static {
- FUSE_HANDLERS.put((dAtomDefinition.getClassTypeStatic() << 16) | dAtomDefinition.getClassTypeStatic(), new IColliderHandler() {
+ FUSE_HANDLERS.put((EMAtomDefinition.getClassTypeStatic() << 16) | EMAtomDefinition.getClassTypeStatic(), new IColliderHandler() {
@Override
- public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) {
+ public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) {
try {
- cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap();
- defs.putUnifyAll(in1.definition.getSubParticles());
- defs.putUnifyAll(in2.definition.getSubParticles());
- dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree());
- out.putUnify(new cElementalInstanceStack(atom, Math.min(in1.amount, in2.amount)));
+ EMDefinitionStackMap defs = new EMDefinitionStackMap();
+ defs.putUnifyAllExact(in1.getDefinition().getSubParticles());
+ defs.putUnifyAllExact(in2.getDefinition().getSubParticles());
+ EMAtomDefinition atom = new EMAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree());
+ out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount())));
} 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));
+ if (in1.getAmount() > in2.getAmount()) {
+ out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount()));
+ } else if (in2.getAmount() > in1.getAmount()) {
+ out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount()));
}
}
@@ -106,27 +106,27 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
return 1;
}
});
- registerSimpleAtomFuse(dHadronDefinition.getClassTypeStatic());
- registerSimpleAtomFuse(dComplexAspectDefinition.getClassTypeStatic());
- registerSimpleAtomFuse(cElementalPrimitive.getClassTypeStatic());
+ registerSimpleAtomFuse(EMHadronDefinition.getClassTypeStatic());
+ registerSimpleAtomFuse(EMComplexAspectDefinition.getClassTypeStatic());
+ registerSimpleAtomFuse(EMPrimitive.getClassTypeStatic());
- FUSE_HANDLERS.put((dHadronDefinition.getClassTypeStatic() << 16) | dHadronDefinition.getClassTypeStatic(), new IColliderHandler() {
+ FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMHadronDefinition.getClassTypeStatic(), new IColliderHandler() {
@Override
- public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) {
+ public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) {
try {
- cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap();
- defs.putUnifyAll(in1.definition.getSubParticles());
- defs.putUnifyAll(in2.definition.getSubParticles());
- dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree());
- out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount)));
+ EMDefinitionStackMap defs = new EMDefinitionStackMap();
+ defs.putUnifyAllExact(in1.getDefinition().getSubParticles());
+ defs.putUnifyAllExact(in2.getDefinition().getSubParticles());
+ EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree());
+ out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount())));
} 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));
+ if (in1.getAmount() > in2.getAmount()) {
+ out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount()));
+ } else if (in2.getAmount() > in1.getAmount()) {
+ out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount()));
}
}
@@ -135,23 +135,23 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
return 2;
}
});
- FUSE_HANDLERS.put((dHadronDefinition.getClassTypeStatic() << 16) | cElementalPrimitive.getClassTypeStatic(), new IColliderHandler() {
+ FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMPrimitive.getClassTypeStatic(), new IColliderHandler() {
@Override
- public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) {
+ public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) {
try {
- cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap();
- defs.putUnifyAll(in1.definition.getSubParticles());
- defs.putUnify(in2.definition.getStackForm(1));
- dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree());
- out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount)));
+ EMDefinitionStackMap defs = new EMDefinitionStackMap();
+ defs.putUnifyAllExact(in1.getDefinition().getSubParticles());
+ defs.putUnifyExact(in2.getDefinition().getStackForm(1));
+ EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree());
+ out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount())));
} 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));
+ if (in1.getAmount() > in2.getAmount()) {
+ out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount()));
+ } else if (in2.getAmount() > in1.getAmount()) {
+ out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount()));
}
}
@@ -161,13 +161,13 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
}
});
- registerSimpleAspectFuse(dComplexAspectDefinition.getClassTypeStatic());
- registerSimpleAspectFuse(cElementalPrimitive.getClassTypeStatic());
+ registerSimpleAspectFuse(EMComplexAspectDefinition.getClassTypeStatic());
+ registerSimpleAspectFuse(EMPrimitive.getClassTypeStatic());
- FUSE_HANDLERS.put((cElementalPrimitive.getClassTypeStatic() << 16) | cElementalPrimitive.getClassTypeStatic(), new IColliderHandler() {
+ FUSE_HANDLERS.put((EMPrimitive.getClassTypeStatic() << 16) | EMPrimitive.getClassTypeStatic(), new IColliderHandler() {
@Override
- public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) {
- IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get(in1.definition.getClass().getName() + '\0' + in2.definition.getClass().getName());
+ public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) {
+ IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get(in1.getDefinition().getClass().getName() + '\0' + in2.getDefinition().getClass().getName());
if (collisionHandler != null) {
collisionHandler.collide(in2, in1, out);
} else {
@@ -181,40 +181,40 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
}
});
- PRIMITIVE_FUSE_HANDLERS.put(eQuarkDefinition.class.getName() + '\0' + eQuarkDefinition.class.getName(), (in1, in2, out) -> {
+ PRIMITIVE_FUSE_HANDLERS.put(EMQuarkDefinition.class.getName() + '\0' + EMQuarkDefinition.class.getName(), (in1, in2, out) -> {
try {
- cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap();
- defs.putUnify(in1.definition.getStackForm(1));
- defs.putUnify(in2.definition.getStackForm(1));
- dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree());
- out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount)));
+ EMDefinitionStackMap defs = new EMDefinitionStackMap();
+ defs.putUnifyExact(in1.getDefinition().getStackForm(1));
+ defs.putUnifyExact(in2.getDefinition().getStackForm(1));
+ EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree());
+ out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount())));
} 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));
+ if (in1.getAmount() > in2.getAmount()) {
+ out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount()));
+ } else if (in2.getAmount() > in1.getAmount()) {
+ out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount()));
}
});
- PRIMITIVE_FUSE_HANDLERS.put(ePrimalAspectDefinition.class.getName() + '\0' + ePrimalAspectDefinition.class.getName(), (in1, in2, out) -> {
+ PRIMITIVE_FUSE_HANDLERS.put(EMPrimalAspectDefinition.class.getName() + '\0' + EMPrimalAspectDefinition.class.getName(), (in1, in2, out) -> {
if (fuseAspects(in1, in2, out)) 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));
+ if (in1.getAmount() > in2.getAmount()) {
+ out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount()));
+ } else if (in2.getAmount() > in1.getAmount()) {
+ out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount()));
}
});
}
- private static boolean fuseAspects(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) {
+ private static boolean fuseAspects(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) {
try {
- cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap();
- defs.putUnify(in1.definition.getStackForm(1));
- defs.putUnify(in2.definition.getStackForm(1));
- dComplexAspectDefinition aspect = new dComplexAspectDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree());
- out.putUnify(new cElementalInstanceStack(aspect, Math.min(in1.amount, in2.amount)));
+ EMDefinitionStackMap defs = new EMDefinitionStackMap();
+ defs.putUnifyExact(in1.getDefinition().getStackForm(1));
+ defs.putUnifyExact(in2.getDefinition().getStackForm(1));
+ EMComplexAspectDefinition aspect = new EMComplexAspectDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree());
+ out.putUnify(new EMInstanceStack(aspect, Math.min(in1.getAmount(), in2.getAmount())));
} catch (Exception e) {
out.putUnifyAll(in1, in2);
return true;
@@ -223,14 +223,14 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
}
private static void registerSimpleAspectFuse(byte classTypeStatic) {
- FUSE_HANDLERS.put((dComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() {
+ FUSE_HANDLERS.put((EMComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() {
@Override
- public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) {
+ public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) {
if (fuseAspects(in1, in2, out)) 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));
+ if (in1.getAmount() > in2.getAmount()) {
+ out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount()));
+ } else if (in2.getAmount() > in1.getAmount()) {
+ out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount()));
}
}
@@ -242,23 +242,23 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
}
private static void registerSimpleAtomFuse(byte classTypeStatic) {
- FUSE_HANDLERS.put((dAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() {
+ FUSE_HANDLERS.put((EMAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() {
@Override
- public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) {
+ public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) {
try {
- cElementalDefinitionStackMap defs = new cElementalDefinitionStackMap();
- defs.putUnifyAll(in1.definition.getSubParticles());
- defs.putUnify(in2.definition.getStackForm(1));
- dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree());
- out.putUnify(new cElementalInstanceStack(atom, Math.min(in1.amount, in2.amount)));
+ EMDefinitionStackMap defs = new EMDefinitionStackMap();
+ defs.putUnifyAllExact(in1.getDefinition().getSubParticles());
+ defs.putUnifyExact(in2.getDefinition().getStackForm(1));
+ EMAtomDefinition atom = new EMAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree());
+ out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount())));
} 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));
+ if (in1.getAmount() > in2.getAmount()) {
+ out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount()));
+ } else if (in2.getAmount() > in1.getAmount()) {
+ out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount()));
}
}
@@ -378,27 +378,27 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
protected double fuse(GT_MetaTileEntity_EM_collider partner) {///CAN MAKE EU
if (partner.stack != null && stack != null) {//todo add single event mode as an option
- boolean check = stack.definition.fusionMakesEnergy(stack.getEnergy()) &&
- partner.stack.definition.fusionMakesEnergy(partner.stack.getEnergy());
+ boolean check = stack.getDefinition().fusionMakesEnergy(stack.getEnergy()) &&
+ partner.stack.getDefinition().fusionMakesEnergy(partner.stack.getEnergy());
- cElementalInstanceStack stack2 = partner.stack;
- double preMass = add(stack2.getMass(),stack.getMass());
+ EMInstanceStack stack2 = partner.stack;
+ double preMass = add(stack2.getMass(),stack.getMass());
//System.out.println("preMass = " + preMass);
- cElementalInstanceStackMap map = new cElementalInstanceStackMap();
- IColliderHandler colliderHandler;
- if (stack2.definition.getClassType() > stack.definition.getClassType()) {//always bigger first
- colliderHandler = FUSE_HANDLERS.get((stack2.definition.getClassType() << 16) | stack.definition.getClassType());
+ EMInstanceStackMap map = new EMInstanceStackMap();
+ IColliderHandler colliderHandler;
+ if (stack2.getDefinition().getClassType() > stack.getDefinition().getClassType()) {//always bigger first
+ colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getClassType() << 16) | stack.getDefinition().getClassType());
if (handleRecipe(stack2, map, colliderHandler)) return 0;
} else {
- colliderHandler = FUSE_HANDLERS.get((stack.definition.getClassType() << 16) | stack2.definition.getClassType());
+ colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getClassType() << 16) | stack2.getDefinition().getClassType());
if (handleRecipe(stack2, map, colliderHandler)) return 0;
}
- for (cElementalInstanceStack newStack : map.valuesToArray()) {
- check &= newStack.definition.fusionMakesEnergy(newStack.getEnergy());
+ for (EMInstanceStack newStack : map.valuesToArray()) {
+ check &= newStack.getDefinition().fusionMakesEnergy(newStack.getEnergy());
}
//System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass());
- outputEM = new cElementalInstanceStackMap[]{map};
+ outputEM = new EMInstanceStackMap[]{map};
partner.stack = stack = null;
//System.out.println("check = " + check);
@@ -410,21 +410,21 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
protected double collide(GT_MetaTileEntity_EM_collider partner) {//DOES NOT MAKE EU!
if (partner.stack != null && stack != null) {//todo add single event mode as an option
- cElementalInstanceStack stack2 = partner.stack;
- double preMass = stack2.getMass() + stack.getMass();
+ EMInstanceStack stack2 = partner.stack;
+ double preMass = stack2.getMass() + stack.getMass();
//System.out.println("preMass = " + preMass);
- cElementalInstanceStackMap map = new cElementalInstanceStackMap();
- IColliderHandler colliderHandler;
- if (stack2.definition.getClassType() > stack.definition.getClassType()) {//always bigger first
- colliderHandler = FUSE_HANDLERS.get((stack2.definition.getClassType() << 16) | stack.definition.getClassType());
+ EMInstanceStackMap map = new EMInstanceStackMap();
+ IColliderHandler colliderHandler;
+ if (stack2.getDefinition().getClassType() > stack.getDefinition().getClassType()) {//always bigger first
+ colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getClassType() << 16) | stack.getDefinition().getClassType());
if (handleRecipe(stack2, map, colliderHandler)) return 0;
} else {
- colliderHandler = FUSE_HANDLERS.get((stack.definition.getClassType() << 16) | stack2.definition.getClassType());
+ colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getClassType() << 16) | stack2.getDefinition().getClassType());
if (handleRecipe(stack2, map, colliderHandler)) return 0;
}
//System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass());
- outputEM = new cElementalInstanceStackMap[]{map};
+ outputEM = new EMInstanceStackMap[]{map};
partner.stack = stack = null;
//System.out.println("check = " + check);
@@ -434,12 +434,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
return 0;
}
- private boolean handleRecipe(cElementalInstanceStack stack2, cElementalInstanceStackMap map, IColliderHandler colliderHandler) {
+ private boolean handleRecipe(EMInstanceStack stack2, EMInstanceStackMap map, IColliderHandler colliderHandler) {
if (colliderHandler != null && eTier >= colliderHandler.getRequiredTier()) {
colliderHandler.collide(stack2, stack, map);
} else {
map.putUnifyAll(stack, stack2);
- outputEM = new cElementalInstanceStackMap[]{map};
+ outputEM = new EMInstanceStackMap[]{map};
return true;
}
return false;
@@ -472,16 +472,17 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
}
}
- private cElementalInstanceStackMap tickStack() {
+ private EMInstanceStackMap tickStack() {
if (stack == null) {
return null;
}
- cElementalDecayResult newInstances = stack.decay(1, stack.age += 1, 0);
+ stack.setAge(stack.getAge() + 1);
+ EMDecayResult newInstances = stack.decay(1, stack.getAge(), 0);
if (newInstances == null) {
stack.nextColor();
return null;
} else {
- stack = newInstances.getOutput().remove(newInstances.getOutput().getLast().definition);
+ stack = newInstances.getOutput().removeKey(newInstances.getOutput().getLast().getDefinition());
return newInstances.getOutput();
}
}
@@ -525,12 +526,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
if (started) {
if (stack == null) {
for (GT_MetaTileEntity_Hatch_InputElemental inputElemental : eInputHatches) {
- cElementalInstanceStackMap container = inputElemental.getContentHandler();
+ EMInstanceStackMap container = inputElemental.getContentHandler();
if (container.isEmpty()) {
continue;
}
- stack = container.remove(container.getFirst().definition);
- long eut = KEEPUP_COST + (long) (KEEPUP_COST * Math.abs(stack.getMass() / dAtomDefinition.getSomethingHeavy().getMass())) / 2;
+ stack = container.removeKey(container.getFirst().getDefinition());
+ long eut = KEEPUP_COST + (long) (KEEPUP_COST * Math.abs(stack.getMass() / EMAtomDefinition.getSomethingHeavy().getMass())) / 2;
if (eut < Integer.MIN_VALUE + 7) {
return false;
}
@@ -575,12 +576,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
collide(partner);//todo
break;
default: {
- outputEM = new cElementalInstanceStackMap[2];
+ outputEM = new EMInstanceStackMap[2];
outputEM[1] = tickStack();
if (outputEM[1] == null) {
outputEM[1] = partner.tickStack();
} else {
- cElementalInstanceStackMap map = partner.tickStack();
+ EMInstanceStackMap map = partner.tickStack();
if (map != null) {
outputEM[1].putUnifyAll(map);
}
@@ -659,7 +660,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
eTier = aNBT.getByte("eTier");//collider tier
started = aNBT.getBoolean("eStarted");
if (aNBT.hasKey("eStack")) {
- stack = cElementalInstanceStack.fromNBT(aNBT.getCompoundTag("eStack"));
+ stack = EMInstanceStack.fromNBT(aNBT.getCompoundTag("eStack"));
}
plasmaEnergy = aNBT.getLong("ePlasmaEnergy");
}
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 ed245b0e97..84dafb8db2 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,8 +1,8 @@
package com.github.technus.tectech.thing.metaTileEntity.multi;
import com.github.technus.tectech.mechanics.constructable.IConstructable;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder;
import com.github.technus.tectech.mechanics.structure.Structure;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti;
@@ -31,7 +31,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import org.apache.commons.lang3.reflect.FieldUtils;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT;
import static com.github.technus.tectech.mechanics.structure.Structure.adders;
import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset;
import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage;
@@ -115,7 +115,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase
@Override
public boolean checkRecipe_EM(ItemStack itemStack) {
- cElementalInstanceStackMap map = getInputsClone_EM();
+ EMInstanceStackMap map = getInputsClone_EM();
if (map != null && map.hasStacks()) {
for (GT_MetaTileEntity_Hatch_InputElemental i : eInputHatches) {
i.getContentHandler().clear();
@@ -125,20 +125,20 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase
return false;
}
- private boolean startRecipe(cElementalInstanceStackMap input) {
+ private boolean startRecipe(EMInstanceStackMap input) {
mMaxProgresstime = 20;
mEfficiencyIncrease = 10000;
- outputEM = new cElementalInstanceStackMap[2];
+ outputEM = new EMInstanceStackMap[2];
outputEM[0] = input;
- outputEM[1] = new cElementalInstanceStackMap();
+ outputEM[1] = new EMInstanceStackMap();
- for (cElementalInstanceStack stack : outputEM[0].valuesToArray()) {
- if (stack.getEnergy() == 0 && stack.definition.decayMakesEnergy(1) &&
+ for (EMInstanceStack stack : outputEM[0].valuesToArray()) {
+ if (stack.getEnergy() == 0 && stack.getDefinition().decayMakesEnergy(1) &&
getBaseMetaTileEntity().decreaseStoredEnergyUnits(
(long) (stack.getEnergySettingCost(1) * URANIUM_MASS_TO_EU_INSTANT), false)) {
stack.setEnergy(1);
- } else if (!stack.definition.decayMakesEnergy(stack.getEnergy())) {
- outputEM[0].remove(stack.definition);
+ } else if (!stack.getDefinition().decayMakesEnergy(stack.getEnergy())) {
+ outputEM[0].removeKey(stack.getDefinition());
outputEM[1].putReplace(stack);
}
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java
index 208219cd59..466f82071b 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java
@@ -1,12 +1,12 @@
package com.github.technus.tectech.thing.metaTileEntity.multi;
import com.github.technus.tectech.mechanics.constructable.IConstructable;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidDequantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemDequantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictDequantizationInfo;
import com.github.technus.tectech.mechanics.structure.Structure;
import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder;
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
@@ -26,9 +26,9 @@ import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.STABLE_RAW_LIFE_TIME;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass;
import static com.github.technus.tectech.mechanics.structure.Structure.adders;
import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset;
import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT;
@@ -72,7 +72,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo
super(aName);
}
- private void startRecipe(iElementalStack from, long energy) {
+ private void startRecipe(IEMStack from, long energy) {
mMaxProgresstime = 20;
mEfficiencyIncrease = 10000;
double mass = from.getMass();
@@ -98,12 +98,12 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo
@Override
public boolean checkRecipe_EM(ItemStack itemStack) {
for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) {
- cElementalInstanceStackMap map = in.getContentHandler();
- for (cElementalInstanceStack stack : map.valuesToArray()) {
+ EMInstanceStackMap map = in.getContentHandler();
+ for (EMInstanceStack stack : map.valuesToArray()) {
{
- aFluidDequantizationInfo info = stack.getDefinition().someAmountIntoFluidStack();
+ EMFluidDequantizationInfo info = stack.getDefinition().someAmountIntoFluidStack();
if (info != null) {
- if (map.removeAllAmounts(false, info.input())) {
+ if (map.removeAllAmounts(info.input())) {
mOutputFluids = new FluidStack[]{info.output()};
startRecipe(info.input(), stack.getEnergy());
return true;
@@ -111,9 +111,9 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo
}
}
{
- aItemDequantizationInfo info = stack.getDefinition().someAmountIntoItemsStack();
+ EMItemDequantizationInfo info = stack.getDefinition().someAmountIntoItemsStack();
if (info != null) {
- if (map.removeAllAmounts(false, info.input())) {
+ if (map.removeAllAmounts(info.input())) {
mOutputItems = new ItemStack[]{info.output()};
startRecipe(info.input(), stack.getEnergy());
return true;
@@ -121,10 +121,10 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo
}
}
{
- aOredictDequantizationInfo info = stack.getDefinition().someAmountIntoOredictStack();
+ EMOredictDequantizationInfo info = stack.getDefinition().someAmountIntoOredictStack();
if (info != null) {
- if (map.removeAllAmounts(false, info.input())) {
- ArrayList<ItemStack> items = OreDictionary.getOres(info.out);
+ if (map.removeAllAmounts(info.input())) {
+ ArrayList<ItemStack> items = OreDictionary.getOres(info.getOut());
if (items != null && !items.isEmpty()) {
mOutputItems = new ItemStack[]{items.get(0)};
startRecipe(info.input(), stack.getEnergy());
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java
index f5504eadc7..630569a25d 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java
@@ -3,12 +3,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi;
import com.github.technus.tectech.Reference;
import com.github.technus.tectech.TecTech;
import com.github.technus.tectech.mechanics.constructable.IConstructable;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iElementalStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidQuantizationInfo;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemQuantizationInfo;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictQuantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidQuantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemQuantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictQuantizationInfo;
import com.github.technus.tectech.mechanics.structure.Structure;
import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder;
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
@@ -29,11 +29,11 @@ import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.DEFAULT_ENERGY_LEVEL;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.TRANSFORMATION_INFO;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.DEFAULT_ENERGY_LEVEL;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.IEMDefinition.STABLE_RAW_LIFE_TIME;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.TRANSFORMATION_INFO;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass;
import static com.github.technus.tectech.mechanics.structure.Structure.adders;
import static com.github.technus.tectech.recipe.TT_recipeAdder.nullFluid;
import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem;
@@ -98,9 +98,9 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock
if (inI.length > 0) {
for (ItemStack is : inI) {
//ITEM STACK quantization
- aItemQuantizationInfo aIQI = TRANSFORMATION_INFO.itemQuantization.get(new aItemQuantizationInfo(is, false, null));
+ EMItemQuantizationInfo aIQI = TRANSFORMATION_INFO.getItemQuantization().get(new EMItemQuantizationInfo(is, false, null));
if (aIQI == null) {
- aIQI = TRANSFORMATION_INFO.itemQuantization.get(new aItemQuantizationInfo(is, true, null));//todo check if works?
+ aIQI = TRANSFORMATION_INFO.getItemQuantization().get(new EMItemQuantizationInfo(is, true, null));//todo check if works?
}
if (aIQI == null) {
//ORE DICT quantization //todo fix for uranium?
@@ -109,12 +109,12 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock
if (DEBUG_MODE) {
TecTech.LOGGER.info("Quantifier-Ore-recipe " + is.getItem().getUnlocalizedName() + '.' + is.getItemDamage() + ' ' + OreDictionary.getOreName(ID));
}
- aOredictQuantizationInfo aOQI = TRANSFORMATION_INFO.oredictQuantization.get(ID);
+ EMOredictQuantizationInfo aOQI = TRANSFORMATION_INFO.getOredictQuantization().get(ID);
if (aOQI == null) {
continue;
}
- iElementalStack into = aOQI.output();
- if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aOQI.amount, is.getItemDamage())}, null, inI)) {
+ IEMStack into = aOQI.output();
+ if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aOQI.getAmount(), is.getItemDamage())}, null, inI)) {
startRecipe(into);
return true;
}
@@ -124,7 +124,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock
if (DEBUG_MODE) {
TecTech.LOGGER.info("Quantifier-Item-recipe " + is.getItem().getUnlocalizedName() + '.' + is.getItemDamage());
}
- iElementalStack into = aIQI.output();
+ IEMStack into = aIQI.output();
if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aIQI.input().stackSize, is.getItemDamage())}, null, inI)) {
startRecipe(into);
return true;
@@ -136,11 +136,11 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock
FluidStack[] inF = storedFluids.toArray(nullFluid);
if (inF.length > 0) {
for (FluidStack fs : inF) {
- aFluidQuantizationInfo aFQI = TRANSFORMATION_INFO.fluidQuantization.get(fs.getFluid().getID());
+ EMFluidQuantizationInfo aFQI = TRANSFORMATION_INFO.getFluidQuantization().get(fs.getFluid().getID());
if (aFQI == null) {
continue;
}
- iElementalStack into = aFQI.output();
+ IEMStack into = aFQI.output();
if (into != null && fs.amount >= aFQI.input().amount && isInputEqual(true, false,
new FluidStack[]{aFQI.input()}, nullItem, inF, (ItemStack[]) null)) {
startRecipe(into);
@@ -152,7 +152,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock
return false;
}
- private void startRecipe(iElementalStack into) {
+ private void startRecipe(IEMStack into) {
mMaxProgresstime = 20;
mEfficiencyIncrease = 10000;
double mass = into.getMass();
@@ -163,10 +163,10 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock
} else {
mEUt = (int) -V[6];
}
- outputEM = new cElementalInstanceStackMap[]{
- into instanceof cElementalInstanceStack ?
- new cElementalInstanceStackMap((cElementalInstanceStack) into) :
- new cElementalInstanceStackMap(new cElementalInstanceStack(into.getDefinition(), into.getAmount()))
+ outputEM = new EMInstanceStackMap[]{
+ into instanceof EMInstanceStack ?
+ new EMInstanceStackMap((EMInstanceStack) into) :
+ new EMInstanceStackMap(new EMInstanceStack(into.getDefinition(), into.getAmount()))
};
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java
index d02088e805..74bb817142 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java
@@ -2,10 +2,10 @@ package com.github.technus.tectech.thing.metaTileEntity.multi;
import com.github.technus.tectech.TecTech;
import com.github.technus.tectech.mechanics.constructable.IConstructable;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-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.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder;
import com.github.technus.tectech.mechanics.structure.Structure;
import com.github.technus.tectech.recipe.TT_recipe;
@@ -35,7 +35,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import org.apache.commons.lang3.reflect.FieldUtils;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__;
import static com.github.technus.tectech.mechanics.structure.Structure.adders;
import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID;
import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset;
@@ -59,9 +59,9 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa
SCAN_GET_COLOR = 256, SCAN_GET_AGE = 512, SCAN_GET_TIMESPAN_MULT = 1024, SCAN_GET_CLASS_TYPE = 2048;
private TT_recipe.TT_EMRecipe.TT_EMRecipe eRecipe;
- private cElementalDefinitionStack objectResearched;
- private cElementalInstanceStackMap objectsScanned;
- private String machineType;
+ private EMDefinitionStack objectResearched;
+ private EMInstanceStackMap objectsScanned;
+ private String machineType;
private long computationRemaining, computationRequired;
private int[] scanComplexity;
@@ -219,31 +219,31 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa
public boolean checkRecipe_EM(ItemStack itemStack) {
eRecipe = null;
if (!eInputHatches.isEmpty() && eInputHatches.get(0).getContentHandler().hasStacks() && !eOutputHatches.isEmpty()) {
- cElementalInstanceStackMap researchEM = eInputHatches.get(0).getContentHandler();
+ EMInstanceStackMap researchEM = eInputHatches.get(0).getContentHandler();
if (ItemList.Tool_DataOrb.isStackEqual(itemStack, false, true)) {
GT_Recipe scannerRecipe = null;
- for (cElementalInstanceStack stackEM : researchEM.valuesToArray()) {
+ for (EMInstanceStack stackEM : researchEM.valuesToArray()) {
objectsScanned = null;
- eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(stackEM.definition);
+ eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(stackEM.getDefinition());
if (eRecipe != null) {
scannerRecipe = eRecipe.scannerRecipe;
machineType = machine;
- objectResearched = new cElementalDefinitionStack(stackEM.definition, 1);
+ objectResearched = new EMDefinitionStack(stackEM.getDefinition(), 1);
//cleanMassEM_EM(objectResearched.getMass());
- researchEM.remove(objectResearched.definition);
+ researchEM.removeKey(objectResearched.getDefinition());
break;
}
- eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(stackEM.definition);
+ eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(stackEM.getDefinition());
if (eRecipe != null) {
scannerRecipe = eRecipe.scannerRecipe;
machineType = crafter;
- objectResearched = new cElementalDefinitionStack(stackEM.definition, 1);
+ objectResearched = new EMDefinitionStack(stackEM.getDefinition(), 1);
//cleanMassEM_EM(objectResearched.getMass());
- researchEM.remove(objectResearched.definition);
+ researchEM.removeKey(objectResearched.getDefinition());
break;
}
cleanStackEM_EM(stackEM);
- researchEM.remove(stackEM.definition);
+ researchEM.removeKey(stackEM.getDefinition());
}
if (eRecipe != null && scannerRecipe != null) {//todo make sure it werks
computationRequired = computationRemaining = scannerRecipe.mDuration * 20L;
@@ -409,8 +409,8 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa
computationRemaining = aNBT.getLong("eComputationRemaining");
computationRequired = aNBT.getLong("eComputationRequired");
if (aNBT.hasKey("eObject")) {
- objectResearched = cElementalDefinitionStack.fromNBT(aNBT.getCompoundTag("eObject"));
- if (objectResearched.definition == nbtE__) {
+ objectResearched = EMDefinitionStack.fromNBT(aNBT.getCompoundTag("eObject"));
+ if (objectResearched.getDefinition() == nbtE__) {
objectResearched = null;
}
} else {
@@ -423,10 +423,10 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa
}
try {
if (aNBT.hasKey("eScanObjects")) {
- objectsScanned = cElementalInstanceStackMap.fromNBT(aNBT.getCompoundTag("eScanObjects"));
+ objectsScanned = EMInstanceStackMap.fromNBT(aNBT.getCompoundTag("eScanObjects"));
}
- } catch (tElementalException e) {
- objectsScanned = new cElementalInstanceStackMap();
+ } catch (EMException e) {
+ objectsScanned = new EMInstanceStackMap();
}
}
@@ -445,11 +445,11 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa
if (computationRemaining > 0 && objectResearched != null) {
eRecipe = null;
if (ItemList.Tool_DataOrb.isStackEqual(mInventory[1], false, true)) {
- eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(objectResearched.definition);
+ eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(objectResearched.getDefinition());
if (eRecipe != null) {
machineType = machine;
} else {
- eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(objectResearched.definition);
+ eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(objectResearched.getDefinition());
if (eRecipe != null) {
machineType = crafter;
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
index ba6ae223f6..9a6f99bed8 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
@@ -10,10 +10,10 @@ import com.github.technus.tectech.mechanics.alignment.IAlignmentLimits;
import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing;
import com.github.technus.tectech.mechanics.alignment.enumerable.Flip;
import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack;
-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.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
import com.github.technus.tectech.mechanics.structure.IStructureDefinition;
import com.github.technus.tectech.mechanics.structure.Structure;
import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder;
@@ -109,7 +109,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
//storage for output EM that will be auto handled in case of failure to finish recipe
//if you succed to use a recipe - be sure to output EM from outputEM to hatches in the output method
- protected cElementalInstanceStackMap[] outputEM;
+ protected EMInstanceStackMap[] outputEM;
//are parameters correct - change in check recipe/output/update params etc. (maintenance status boolean)
protected boolean eParameters = true;
@@ -842,13 +842,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
int outputLen = aNBT.getInteger("eOutputStackCount");
if (outputLen > 0) {
- outputEM = new cElementalInstanceStackMap[outputLen];
+ outputEM = new EMInstanceStackMap[outputLen];
NBTTagCompound compound = aNBT.getCompoundTag("outputEM");
for (int i = 0; i < outputEM.length; i++) {
if (compound.hasKey(Integer.toString(i))) {
try {
- outputEM[i] = cElementalInstanceStackMap.fromNBT(compound.getCompoundTag(Integer.toString(i)));
- } catch (tElementalException e) {
+ outputEM[i] = EMInstanceStackMap.fromNBT(compound.getCompoundTag(Integer.toString(i)));
+ } catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
}
@@ -966,7 +966,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
private void cleanOrExplode() {
if (outputEM != null) {
float mass = 0;
- for (cElementalInstanceStackMap tree : outputEM) {
+ for (EMInstanceStackMap tree : outputEM) {
if (tree != null) {
mass += tree.getMass();
}
@@ -1155,7 +1155,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
explodeMultiblock();
}
if (outputEM != null) {
- for (cElementalInstanceStackMap tree : outputEM) {
+ for (EMInstanceStackMap tree : outputEM) {
if (tree != null && tree.hasStacks()) {
explodeMultiblock();
}
@@ -1297,26 +1297,26 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
}
double remaining = voider.overflowMax - voider.getOverflowMatter();
for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) {
- for (cElementalInstanceStack instance : in.getContentHandler().valuesToArray()) {
- double qty = div(remaining,instance.definition.getMass());
+ for (EMInstanceStack instance : in.getContentHandler().valuesToArray()) {
+ double qty = div(remaining, instance.getDefinition().getMass());
if (qty > 0) {
- qty = min(qty, instance.amount);
- if (voider.addOverflowMatter(instance.definition.getMass() * qty)) {
+ qty = min(qty, instance.getAmount());
+ if (voider.addOverflowMatter(instance.getDefinition().getMass() * qty)) {
voider.setOverflowMatter(voider.overflowMax);
}
- in.getContentHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty));
+ in.getContentHandler().removeAmount(new EMDefinitionStack(instance.getDefinition(), qty));
}
}
}
for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) {
- for (cElementalInstanceStack instance : out.getContentHandler().valuesToArray()) {
- double qty = div(remaining,instance.definition.getMass());
+ for (EMInstanceStack instance : out.getContentHandler().valuesToArray()) {
+ double qty = div(remaining, instance.getDefinition().getMass());
if (qty > 0) {
- qty = min(qty, instance.amount);
- if (voider.addOverflowMatter(instance.definition.getMass() * qty)) {
+ qty = min(qty, instance.getAmount());
+ if (voider.addOverflowMatter(instance.getDefinition().getMass() * qty)) {
voider.setOverflowMatter(voider.overflowMax);
}
- out.getContentHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty));
+ out.getContentHandler().removeAmount(new EMDefinitionStack(instance.getDefinition(), qty));
}
}
}
@@ -1929,8 +1929,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
//region convenience copies input and output EM
//new Method
- public final cElementalInstanceStackMap getInputsClone_EM() {
- cElementalInstanceStackMap in = new cElementalInstanceStackMap();
+ public final EMInstanceStackMap getInputsClone_EM() {
+ EMInstanceStackMap in = new EMInstanceStackMap();
for (GT_MetaTileEntity_Hatch_ElementalContainer hatch : eInputHatches) {
in.putUnifyAll(hatch.getContentHandler());
}
@@ -1938,8 +1938,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
}
//new Method
- public final cElementalInstanceStackMap getOutputsClone_EM() {
- cElementalInstanceStackMap out = new cElementalInstanceStackMap();
+ public final EMInstanceStackMap getOutputsClone_EM() {
+ EMInstanceStackMap out = new EMInstanceStackMap();
for (GT_MetaTileEntity_Hatch_ElementalContainer hatch : eOutputHatches) {
out.putUnifyAll(hatch.getContentHandler());
}
@@ -1974,7 +1974,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
cleanMassEM_EM(target.getContentHandler().getMass());
}
- public void cleanStackEM_EM(cElementalInstanceStack target) {
+ public void cleanStackEM_EM(EMInstanceStack target) {
if (target == null) {
return;
}
@@ -2006,7 +2006,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
return;
}
float mass = 0;
- for (cElementalInstanceStackMap map : outputEM) {
+ for (EMInstanceStackMap map : outputEM) {
if (map != null) {
mass += map.getMass();
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java
index 093a418056..d1eafa22fc 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java
@@ -1,9 +1,9 @@
package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine;
import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl;
@@ -12,7 +12,8 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
import java.util.Arrays;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY;
import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*;
import static com.github.technus.tectech.util.CommonValues.V;
import static com.github.technus.tectech.util.DoubleCount.*;
@@ -74,7 +75,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav
radius = 0.5D - (12D - tier) / 64D;
maxRCF = Math.pow(Math.E, tier) * 12D;
maxRPM = Math.sqrt(maxRCF / (0.001118D * radius));
- double maxSafeMass = dAtomDefinition.getSomethingHeavy().getMass() * (1 << tier);
+ double maxSafeMass = EMAtomDefinition.getSomethingHeavy().getMass() * (1 << tier);
maxForce = maxSafeMass * maxRCF;// (eV/c^2 * m/s) / g
maxCapacity = maxSafeMass * AVOGADRO_CONSTANT_144 * radius;// eV/c^2
}
@@ -83,12 +84,12 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav
return RPM * RPM * radius * 0.001118;
}
- private void addRandomly(cElementalInstanceStack me, cElementalInstanceStackMap[] toThis, int fractionCount) {
- double amountPerFraction = div(me.amount,fractionCount);
- cElementalInstanceStack[] stacks = new cElementalInstanceStack[fractionCount];
+ private void addRandomly(EMInstanceStack me, EMInstanceStackMap[] toThis, int fractionCount) {
+ double amountPerFraction = div(me.getAmount(),fractionCount);
+ EMInstanceStack[] stacks = new EMInstanceStack[fractionCount];
for (int i = 0; i < fractionCount; i++) {
stacks[i] = me.clone();
- stacks[i].amount = amountPerFraction;
+ stacks[i].setAmount(amountPerFraction);
toThis[i].putReplace(stacks[i]);
}
//int remainingAmount = (int) (me.amount % fractionCount);
@@ -112,23 +113,23 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav
}
@Override
- public MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) {
- cElementalInstanceStackMap input = inputs[0];
+ public MultiblockControl<EMInstanceStackMap[]> process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) {
+ EMInstanceStackMap input = inputs[0];
if (input == null || input.isEmpty()) return null;//nothing in only valid input
- cElementalInstanceStack[] stacks = input.valuesToArray();
+ EMInstanceStack[] stacks = input.valuesToArray();
double inputMass = 0;
- for (cElementalInstanceStack stack : stacks) {
+ for (EMInstanceStack stack : stacks) {
inputMass += Math.abs(stack.getMass());
}
double excessMass = 0;
while (inputMass > maxCapacity) {
- cElementalInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)];
- double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount();
- randomStack.amount= sub(randomStack.amount,amountToRemove);//mutates the parent InstanceStackMap
- if (randomStack.amount <= 0) {
- input.remove(randomStack.definition);
+ EMInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)];
+ double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount();
+ randomStack.setAmount(sub(randomStack.getAmount(),amountToRemove));//mutates the parent InstanceStackMap
+ if (randomStack.getAmount() < AVOGADRO_CONSTANT_UNCERTAINTY) {
+ input.removeKey(randomStack.getDefinition());
stacks = input.valuesToArray();
}
double mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove;
@@ -142,10 +143,10 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav
if (inputMass * RCF > maxForce) return new MultiblockControl<>(excessMass);//AND THEN IT EXPLODES
// how many output hatches to use
- int fractionCount = (int) settingFraction.get();
- cElementalInstanceStackMap[] outputs = new cElementalInstanceStackMap[fractionCount];
+ int fractionCount = (int) settingFraction.get();
+ EMInstanceStackMap[] outputs = new EMInstanceStackMap[fractionCount];
for (int i = 0; i < fractionCount; i++) {
- outputs[i] = new cElementalInstanceStackMap();
+ outputs[i] = new EMInstanceStackMap();
}
//mixing factor...
@@ -165,21 +166,21 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav
stacks = input.takeAll().valuesToArray();//cleanup stacks
if (stacks.length > 1) {
Arrays.sort(stacks, (o1, o2) -> {
- double m1 = o1.definition.getMass();
- double m2 = o2.definition.getMass();
+ double m1 = o1.getDefinition().getMass();
+ double m2 = o2.getDefinition().getMass();
if (m1 < m2) return -1;
if (m1 > m2) return 1;
return o1.compareTo(o2);
});
double absMassPerOutput = 0;//"volume"
- for (cElementalInstanceStack stack : stacks) {
+ for (EMInstanceStack stack : stacks) {
double tempMass=Math.abs(stack.getMass());
if(tempMass!=0) {
- double amount = stack.amount;
- stack.amount = mul(stack.amount,mixingFactor);
+ double amount = stack.getAmount();
+ stack.setAmount(mul(stack.getAmount(),mixingFactor));
addRandomly(stack, outputs, fractionCount);
- stack.amount = sub(amount,stack.amount);
+ stack.setAmount(sub(amount, stack.getAmount()));
absMassPerOutput += tempMass;
}
}
@@ -197,7 +198,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav
for (int stackNo = 0; stackNo < stacks.length; stackNo++) {
if (stacks[stackNo] != null) {
double stackMass = Math.abs(stacks[stackNo].getMass());
- double amount = div(remaining,Math.abs(stacks[stackNo].definition.getMass()));
+ double amount = div(remaining,Math.abs(stacks[stackNo].getDefinition().getMass()));
//if(DEBUG_MODE){
// TecTech.LOGGER.info("stackMass "+stackMass);
// TecTech.LOGGER.info("defMass "+stacks[stackNo].definition.getMass());
@@ -207,16 +208,16 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav
if (stackMass == 0) {
addRandomly(stacks[stackNo], outputs, fractionCount);
stacks[stackNo] = null;
- } else if (amount >= stacks[stackNo].amount) {
+ } else if (amount >= stacks[stackNo].getAmount()) {
remaining= sub(remaining,stackMass);
outputs[fraction].putUnify(stacks[stackNo]);
stacks[stackNo] = null;
} else if (amount > 0) {
- remaining= sub(remaining, mul(amount,stacks[stackNo].definition.getMass()));
- cElementalInstanceStack clone = stacks[stackNo].clone();
- clone.amount = amount;
+ remaining= sub(remaining, mul(amount, stacks[stackNo].getDefinition().getMass()));
+ EMInstanceStack clone = stacks[stackNo].clone();
+ clone.setAmount(amount);
outputs[fraction].putUnify(clone);
- stacks[stackNo].amount= sub(stacks[stackNo].amount,amount);
+ stacks[stackNo].setAmount(sub(stacks[stackNo].getAmount(),amount));
//if(DEBUG_MODE){
// TecTech.LOGGER.info("remainingAfter "+remaining);
// TecTech.LOGGER.info("amountCloneAfter "+clone.amount+"/"+stacks[stackNo].amount);
@@ -228,7 +229,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav
}
}
//add remaining
- for (cElementalInstanceStack stack : stacks) {
+ for (EMInstanceStack stack : stacks) {
if (stack != null) {
outputs[fractionCount - 1].putUnify(stack);
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java
index d335bac7ab..4c95c2acd7 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java
@@ -1,6 +1,6 @@
package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
@@ -24,7 +24,7 @@ public class Behaviour_Electrolyzer implements GT_MetaTileEntity_EM_machine.IBeh
}
@Override
- public MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) {
+ public MultiblockControl<EMInstanceStackMap[]> process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) {
return null;
}
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java
index 6ac6ac74c4..70d93b36ed 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java
@@ -1,15 +1,16 @@
package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine;
import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_144;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY;
import static com.github.technus.tectech.util.CommonValues.V;
import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*;
import static com.github.technus.tectech.util.DoubleCount.mul;
@@ -88,7 +89,7 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_
public Behaviour_ElectromagneticSeparator(int desiredTier){
tier=(byte) desiredTier;
ticks =Math.max(20,(1<<(12-desiredTier))*20);
- maxCapacity= dAtomDefinition.getSomethingHeavy().getMass()*(2<<tier)* AVOGADRO_CONSTANT_144;
+ maxCapacity= EMAtomDefinition.getSomethingHeavy().getMass()*(2<<tier)* AVOGADRO_CONSTANT_144;
maxCharge=144D*(1<<(tier-5));
switch (tier){
case 12:
@@ -143,23 +144,23 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_
}
@Override
- public MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) {
- cElementalInstanceStackMap input = inputs[0];
+ public MultiblockControl<EMInstanceStackMap[]> process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) {
+ EMInstanceStackMap input = inputs[0];
if (input == null || input.isEmpty()) return null;//nothing in only valid input
- cElementalInstanceStack[] stacks = input.valuesToArray();
+ EMInstanceStack[] stacks = input.valuesToArray();
double inputMass = 0;
- for (cElementalInstanceStack stack : stacks) {
+ for (EMInstanceStack stack : stacks) {
inputMass += Math.abs(stack.getMass());
}
float excessMass = 0;
while (inputMass > maxCapacity) {
- cElementalInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)];
- double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount();
- randomStack.amount= sub(randomStack.amount,amountToRemove);//mutates the parent InstanceStackMap
- if (randomStack.amount <= 0) {
- input.remove(randomStack.definition);
+ EMInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)];
+ double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount();
+ randomStack.setAmount(sub(randomStack.getAmount(),amountToRemove));//mutates the parent InstanceStackMap
+ if (randomStack.getAmount() < AVOGADRO_CONSTANT_UNCERTAINTY) {
+ input.removeKey(randomStack.getDefinition());
}
double mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove;
excessMass += mass;
@@ -174,9 +175,9 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_
int mTicks=(int)(ticks*(inputMass/maxCapacity));
mTicks=Math.max(mTicks,20);
- cElementalInstanceStackMap[] outputs = new cElementalInstanceStackMap[3];
+ EMInstanceStackMap[] outputs = new EMInstanceStackMap[3];
for (int i = 0; i < 3; i++) {
- outputs[i] = new cElementalInstanceStackMap();
+ outputs[i] = new EMInstanceStackMap();
}
double offsetIn=offsetSetting.get();
@@ -186,8 +187,8 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_
//take all from hatch handler and put into new map - this takes from hatch to inner data storage
stacks = input.takeAll().valuesToArray();//cleanup stacks
- for(cElementalInstanceStack stack:stacks){
- double charge=stack.definition.getCharge()-offsetIn;
+ for(EMInstanceStack stack:stacks){
+ double charge= stack.getDefinition().getCharge()-offsetIn;
if(charge<precisionMinimalIn && charge>-precisionMinimalIn){
outputs[1].putReplace(stack);
}else if(charge>=precisionFullIn){
@@ -195,13 +196,13 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_
}else if(charge<=-precisionFullIn){
outputs[0].putReplace(stack);
}else{
- double amount=mul(stack.amount,(Math.abs(charge)-precisionMinimalIn+1D)/levelsCountPlus1);//todo check
- if (amount < stack.amount) {
- cElementalInstanceStack clone = stack.clone();
- clone.amount = sub(clone.amount, amount);
+ double amount=mul(stack.getAmount(),(Math.abs(charge)-precisionMinimalIn+1D)/levelsCountPlus1);//todo check
+ if (amount < stack.getAmount()) {
+ EMInstanceStack clone = stack.clone();
+ clone.setAmount(sub(clone.getAmount(), amount));
outputs[1].putReplace(clone);
- stack.amount = amount;
+ stack.setAmount(amount);
}
if(charge>0){
outputs[2].putReplace(stack);
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java
index 97ece16fb1..7d472de847 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java
@@ -1,6 +1,6 @@
package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
@@ -24,7 +24,7 @@ public class Behaviour_PrecisionLaser implements GT_MetaTileEntity_EM_machine.IB
}
@Override
- public MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) {
+ public MultiblockControl<EMInstanceStackMap[]> process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) {
return null;
}
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java
index f7aa945d69..05050a3c66 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java
@@ -1,6 +1,6 @@
package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
@@ -26,9 +26,9 @@ public class Behaviour_Recycler implements GT_MetaTileEntity_EM_machine.IBehavio
}
@Override
- public MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) {
+ public MultiblockControl<EMInstanceStackMap[]> process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) {
double mass=0;
- for (cElementalInstanceStackMap input : inputs) {
+ for (EMInstanceStackMap input : inputs) {
if (input != null) {
mass += input.getMass();
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java
index 2dc9067e22..fa517c73d4 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java
@@ -1,6 +1,6 @@
package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
@@ -24,7 +24,7 @@ public class Behaviour_Scanner implements GT_MetaTileEntity_EM_machine.IBehaviou
}
@Override
- public MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) {
+ public MultiblockControl<EMInstanceStackMap[]> process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) {
return null;
}
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java
index d9217171d3..e653c1a357 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java
@@ -2,7 +2,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine;
import com.github.technus.tectech.TecTech;
import com.github.technus.tectech.mechanics.constructable.IConstructable;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.cElementalInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder;
import com.github.technus.tectech.mechanics.structure.Structure;
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
@@ -161,7 +161,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa
* @param parameters array passed from previous method!
* @return null if recipe should not start, control object to set machine state and start recipe
*/
- MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters);
+ MultiblockControl<EMInstanceStackMap[]> process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters);
}
private void quantumStuff(boolean shouldIExist) {
@@ -254,7 +254,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa
return false;
}
- cElementalInstanceStackMap[] handles = new cElementalInstanceStackMap[6];
+ EMInstanceStackMap[] handles = new EMInstanceStackMap[6];
for (int i = 0; i < 6; i++) {
int pointer = (int) inputMux[i].get();
if (pointer >= 0 && pointer < eInputHatches.size()) {
@@ -272,7 +272,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa
}
}
- MultiblockControl<cElementalInstanceStackMap[]> control = currentBehaviour.process(handles, this, parametrization);
+ MultiblockControl<EMInstanceStackMap[]> control = currentBehaviour.process(handles, this, parametrization);
if (control == null) {
return false;
}
@@ -311,7 +311,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa
return;
}
- cElementalInstanceStackMap[] handles = new cElementalInstanceStackMap[6];
+ EMInstanceStackMap[] handles = new EMInstanceStackMap[6];
for (int i = 0; i < 6; i++) {
int pointer = (int) outputMux[i].get();
if (pointer >= 0 && pointer < eOutputHatches.size()) {
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo
index 7059fdf6fd..a195157a17 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo
@@ -23,16 +23,16 @@ BlockFakeLight.java
for turrets:
floodlightb
+mega - projects
+
fix eu/t checks if needs maintenance!!!
make microwave grinder cap autosmelting based on power
-
iterative halflife formula:
=prev qty* 2^(-t diff / t half)
-
actual ion cannons
diff --git a/src/main/java/com/github/technus/tectech/util/DoubleCount.java b/src/main/java/com/github/technus/tectech/util/DoubleCount.java
index b37c0987ae..576123079c 100644
--- a/src/main/java/com/github/technus/tectech/util/DoubleCount.java
+++ b/src/main/java/com/github/technus/tectech/util/DoubleCount.java
@@ -3,26 +3,40 @@ package com.github.technus.tectech.util;
import java.util.Arrays;
import static java.lang.Math.*;
-import static java.lang.Math.max;
-import static java.lang.Math.ulp;
public class DoubleCount {
- public static double[] distribute(double count,double... probabilities) throws ArithmeticException {
- if (probabilities == null) {
+ /**
+ * Distributes count across probabilities
+ *
+ * @param count the count to divide
+ * @param probabilities probability ratios to divide by, descending
+ * @return divided count
+ * @throws ArithmeticException
+ */
+ public static double[] distribute(double count, double... probabilities) throws ArithmeticException {
+ if (probabilities == null || Double.isNaN(count)) {
return null;
} else if (count == 0) {
return new double[probabilities.length];
+ } else if (Double.isInfinite(count)) {
+ double[] doubles = new double[probabilities.length];
+ Arrays.fill(doubles, count);
+ return doubles;
} else {
switch (probabilities.length) {
default: {
- int size = probabilities.length;
+ int size = probabilities.length;
double[] output = new double[size];
size--;
- double remaining = count, previous = probabilities[size], probability, out, sum = 0;
+ double remaining = count, previous = probabilities[size], probability, out;
for (int i = size - 1; i >= 0; i--) {
probability = probabilities[i];
- remaining -= out = count * probability - ulp(probability);
- sum += output[i] = out;
+ out = count * probability;
+ out -= ulpSigned(out);
+
+ remaining -= out;
+ output[i] = out;
+
if (previous < probability) {
throw new ArithmeticException("Malformed probability order: " + Arrays.toString(probabilities));
}
@@ -31,14 +45,10 @@ public class DoubleCount {
break;
}
}
- if (remaining * count < 0) {
+ if (remaining * count < 0) {//overshoot
finishIt(size, output, remaining);
} else {
- sum += output[size] = remaining - ulp(remaining) * size;
- if (sum > count) {
- remaining = sum - count;
- finishIt(size, output, remaining);
- }
+ output[size] = remaining;
}
return output;
}
@@ -50,84 +60,58 @@ public class DoubleCount {
}
}
+ public static double ulpSigned(double number) {
+ if (number == 0) {
+ return 0;
+ }
+ return number > 0 ? ulp(number) : -ulp(number);
+ }
+
private static void finishIt(int size, double[] output, double remaining) {
for (int i = size - 1; i >= 0; i--) {
if (abs(output[i]) >= abs(remaining)) {
output[i] -= remaining;
break;
} else {
- remaining+=output[i];
- output[i]=0;
+ remaining += output[i];
+ output[i] = 0;
}
}
}
- public static double div(double count,double divisor){
- if (divisor == 0) {
- throw new ArithmeticException("Divide by 0");
- }else if(count==0 || divisor==1){
- return count;
- }else if(divisor==-1){
- return -count;
+ public static double div(double count, double divisor) {
+ if (count == 0 || abs(divisor) == 1 || abs(count)==abs(divisor)) {
+ return count/divisor;
} else {
double result = count / divisor;
- if(result*count<0){
- return 0;
- }
- return result-ulp(result);
+ return result - ulpSigned(result);
}
}
- public static double mul(double count,double multiplier){
- if(count==0 || multiplier==1){
- return count;
- }else if(multiplier==-1){
- return -count;
+ public static double mul(double count, double multiplier) {
+ if (count == 0 || multiplier == 0 || abs(multiplier)==1 || abs(count)==1) {
+ return count*multiplier;
} else {
double result = count * multiplier;
- if(result*count<0){
- return 0;
- }
- return result-ulp(result);
+ return result - ulpSigned(result);
}
}
- public static double sub(double count,double value){
- if(value==0){
- return count;
- }
- if(count==0){
- return -value;
- }
- if(value==count){
- return 0;
- }
- return value < 0 ? addInternal(count, -value) : subInternal(count, value);
- }
-
- public static double add(double count,double value){
- if(value==0){
- return count;
- }
- if(count==0){
- return value;
- }
- return value < 0 ? subInternal(count, -value) : addInternal(count, value);
- }
-
- private static double subInternal(double count,double value){
- double result = count - max(value,ulp(count));
- if (result+value>count || value>count-result){
- result-=ulp(result);
+ public static double sub(double count, double value) {
+ if (count == 0 || value == 0 || count == value) {
+ return count - value;
+ } else {
+ double result = count - value;
+ return result - ulpSigned(result);
}
- return result;
}
- private static double addInternal(double count,double value){
- double result = count + value;
- if (result-value>count || result-count>value){
- result-=ulp(result);
+ public static double add(double count, double value) {
+ if (count == 0 || value == 0 || count == -value) {
+ return count + value;
+ } else {
+ double result = count + value;
+ return result - ulpSigned(result);
}
- return result;
}
}