aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorTec <daniel112092@gmail.com>2022-01-22 23:33:56 +0100
committerTec <daniel112092@gmail.com>2022-01-23 13:20:57 +0100
commitb5399199a88d7c6c19a2ed494aa9c66b81bf2249 (patch)
tree469136ee701ef5a8871bdbb019f77965507d7810 /src/main/java/com
parent62021d238a0c38401b50211d59e72e169399f444 (diff)
downloadGT5-Unofficial-b5399199a88d7c6c19a2ed494aa9c66b81bf2249.tar.gz
GT5-Unofficial-b5399199a88d7c6c19a2ed494aa9c66b81bf2249.tar.bz2
GT5-Unofficial-b5399199a88d7c6c19a2ed494aa9c66b81bf2249.zip
Rework API, add locale
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/github/technus/tectech/TecTech.java19
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java8
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/gtpp/GtppAtomLoader.java68
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java2
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java2
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java4
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java6
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java9
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java78
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java41
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java7
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java11
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java8
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java4
-rw-r--r--src/main/java/com/github/technus/tectech/loader/ElementalLoader.java29
-rw-r--r--src/main/java/com/github/technus/tectech/loader/MainLoader.java26
-rw-r--r--src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java2
-rw-r--r--src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java (renamed from src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java)20
-rw-r--r--src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java6
-rw-r--r--src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java15
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java14
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java3
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java118
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java56
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java20
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java110
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java67
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java32
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java189
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java37
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java63
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java5
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java5
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java32
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java20
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java12
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java6
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java10
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java61
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java33
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java56
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java43
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java4
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java45
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java4
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java60
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java41
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java165
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java134
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java11
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java19
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java1187
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java229
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java38
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java16
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java83
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java43
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java41
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java50
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java87
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java46
-rw-r--r--src/main/java/com/github/technus/tectech/recipe/TT_recipe.java19
-rw-r--r--src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java32
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java11
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java49
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java11
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java10
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java (renamed from src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java)48
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java5
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java7
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java9
-rw-r--r--src/main/java/com/github/technus/tectech/util/DoubleCount.java6
-rw-r--r--src/main/java/com/github/technus/tectech/util/Util.java12
88 files changed, 2037 insertions, 1888 deletions
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java
index ef5e146bfa..d730d64a65 100644
--- a/src/main/java/com/github/technus/tectech/TecTech.java
+++ b/src/main/java/com/github/technus/tectech/TecTech.java
@@ -2,6 +2,7 @@ package com.github.technus.tectech;
import com.github.technus.tectech.loader.MainLoader;
import com.github.technus.tectech.loader.TecTechConfig;
+import com.github.technus.tectech.loader.gui.CreativeTabTecTech;
import com.github.technus.tectech.mechanics.anomaly.AnomalyHandler;
import com.github.technus.tectech.mechanics.anomaly.CancerCommand;
import com.github.technus.tectech.mechanics.anomaly.ChargeCommand;
@@ -11,6 +12,8 @@ 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.EMGive;
import com.github.technus.tectech.mechanics.elementalMatter.core.commands.EMList;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry;
import com.github.technus.tectech.proxy.CommonProxy;
import com.github.technus.tectech.util.XSTR;
import cpw.mods.fml.common.FMLCommonHandler;
@@ -41,7 +44,8 @@ public class TecTech {
public static TecTech instance;
public static final XSTR RANDOM = XSTR.XSTR_INSTANCE;
- public static final LogHelper LOGGER = new LogHelper(Reference.MODID);
+ public static final LogHelper LOGGER = new LogHelper(Reference.MODID);
+ public static CreativeTabTecTech creativeTabTecTech;
private static IngameErrorLog moduleAdminErrorLogs;
public static TecTechConfig configTecTech;
@@ -50,6 +54,9 @@ public class TecTech {
public static AnomalyHandler anomalyHandler;
public static PlayerPersistence playerPersistence;
+ public static final EMDefinitionsRegistry definitionsRegistry =new EMDefinitionsRegistry();
+ public static final EMTransformationRegistry transformationInfo =new EMTransformationRegistry();
+
/**
* For Loader.isModLoaded checks during the runtime
*/
@@ -106,7 +113,7 @@ public class TecTech {
Field field= GT_Proxy.class.getDeclaredField("mEvents");
field.setAccessible(true);
modifiersField.setInt( field, field.getModifiers() & ~Modifier.FINAL );
- field.set(GT_Mod.gregtechproxy, new Collection() {
+ field.set(GT_Mod.gregtechproxy, new Collection<Object>() {
@Override
public int size() {
return 0;
@@ -123,8 +130,8 @@ public class TecTech {
}
@Override
- public Iterator iterator() {
- return new Iterator() {
+ public Iterator<Object> iterator() {
+ return new Iterator<Object>() {
@Override
public boolean hasNext() {
return false;
@@ -188,13 +195,13 @@ public class TecTech {
}
- MainLoader.load();
+ MainLoader.load(definitionsRegistry);
MainLoader.addAfterGregTechPostLoadRunner();
}
@Mod.EventHandler
public void PostLoad(FMLPostInitializationEvent PostEvent) {
- MainLoader.postLoad();
+ MainLoader.postLoad(definitionsRegistry,transformationInfo);
chunkDataHandler.registerChunkMetaDataHandler(anomalyHandler=new AnomalyHandler());
}
diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java
index 00b31915c2..4ebe84147f 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java
@@ -1,5 +1,6 @@
package com.github.technus.tectech.compatibility.dreamcraft;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry;
import com.github.technus.tectech.recipe.TT_recipeAdder;
import com.github.technus.tectech.thing.CustomItemList;
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
@@ -23,12 +24,12 @@ import net.minecraftforge.fluids.FluidStack;
import java.lang.reflect.Method;
-import static com.github.technus.tectech.loader.recipe.RecipeLoader.getOrDefault;
+import static com.github.technus.tectech.loader.recipe.BaseRecipeLoader.getOrDefault;
/**
* Created by Tec on 06.08.2017.
*/
-public class DreamCraftRecipeLoader implements Runnable {
+public class DreamCraftRecipeLoader {
//region reflect a bit
@SuppressWarnings("rawtypes")
private Class CUSTOM_ITEM_LIST;
@@ -48,8 +49,7 @@ public class DreamCraftRecipeLoader implements Runnable {
}
//endregion
- @Override
- public void run() {
+ public void run(EMTransformationRegistry transformationInfo) {
//region reflect a bit
try {
CUSTOM_ITEM_LIST = Class.forName("com.dreammaster.gthandler.CustomItemList");
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 ee7d293e08..67a363fc6c 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,18 +1,19 @@
package com.github.technus.tectech.compatibility.gtpp;
import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry;
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.EMTransformationInfo.AVOGADRO_CONSTANT_144;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.*;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.getBestUnstableIsotope;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.getFirstStableIsotope;
-public class GtppAtomLoader implements Runnable{
+public class GtppAtomLoader {
//region reflect a bit
- private Class ELEMENT;
+ private Class<?> ELEMENT;
private Object ELEMENT_INSTANCE;
private Method getUnlocalizedName,getFluid,generate;
@@ -41,14 +42,13 @@ public class GtppAtomLoader implements Runnable{
}
//endregion
- @Override
- public void run() {
+ public void setTransformations(EMTransformationRegistry transformationInfo) {
//region reflect a bit
try{
ELEMENT=Class.forName("gtPlusPlus.core.material.ELEMENT");
ELEMENT_INSTANCE=ELEMENT.getMethod("getInstance").invoke(null);
- Class clazz=Class.forName("gtPlusPlus.core.material.Material");
+ Class<?> clazz=Class.forName("gtPlusPlus.core.material.Material");
getUnlocalizedName=clazz.getMethod("getUnlocalizedName");
getFluid=clazz.getMethod("getFluid", int.class);
@@ -59,34 +59,34 @@ public class GtppAtomLoader implements Runnable{
}
//endregion
- EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), getFluid("NEON",144));
+ transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(10), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), getFluid("NEON",144));
generate("GERMANIUM",true,true);
- 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);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(32), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(34), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1);
+ transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(35), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), getFluid("BROMINE",144));
+ transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(36), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), getFluid("KRYPTON",144));
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(40), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(43), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(44), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(45), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(53), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("IODINE"),1);
+ transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(54), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),getFluid("XENON",144));
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(72), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(75), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(81), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),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);
+ transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(84), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(85), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(87), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(88), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(89), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(91), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(93), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),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);
+ transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(96), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(97), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(98), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(99), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1);
+ transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(100), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1);
}
}
diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java
index 9da3b82b40..654b4e37a6 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java
@@ -10,7 +10,7 @@ import net.minecraft.world.World;
import openmodularturrets.blocks.turretbases.BlockAbstractTurretBase;
import openmodularturrets.handler.ConfigHandler;
-import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech;
+import static com.github.technus.tectech.TecTech.creativeTabTecTech;
/**
* Created by Tec on 27/07/2017.
diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java
index 7b7167b915..da212d4853 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java
@@ -11,7 +11,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import openmodularturrets.tileentity.turretbase.TurretBase;
-import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech;
+import static com.github.technus.tectech.TecTech.creativeTabTecTech;
/**
* Created by Tec on 27/07/2017.
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 785b59f093..54bd3aaea5 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
@@ -52,10 +52,10 @@ public class projectileEM extends LaserProjectile {
charge=projectileContent.getCharge();
massFactor =(float) (projectileContent.getDefinition().getMass()/ EMHadronDefinition.hadron_n_.getMass());
- if(projectileContent.getDefinition().getMatterType()>1 || projectileContent.getDefinition().getMatterType()<-1) {
+ if(projectileContent.getDefinition().getGeneration()>1 || projectileContent.getDefinition().getGeneration()<-1) {
strange = true;
}
- if(projectileContent.getDefinition().getMatterType()<0) {
+ if(projectileContent.getDefinition().getGeneration()<0) {
antiMatter = true;
}
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 6dc5c4f60a..742232d8c6 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
@@ -14,7 +14,7 @@ import openmodularturrets.handler.ConfigHandler;
import openmodularturrets.tileentity.turrets.TurretHead;
import openmodularturrets.util.TurretHeadUtil;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT;
/**
* Created by Bass on 27/07/2017.
@@ -71,8 +71,8 @@ public class TileTurretHeadEM extends TurretHead{
return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), null);
}
EMInstanceStack stack = hatchContentPointer.getRandom();
- double amount = Math.min(AVOGADRO_CONSTANT, stack.getAmount());
- hatchContentPointer.removeAmount(stack.getDefinition(),AVOGADRO_CONSTANT);
+ double amount = Math.min(EM_COUNT_PER_MATERIAL_AMOUNT, stack.getAmount());
+ hatchContentPointer.removeAmount(stack.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT);
stack=stack.clone();
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/spartakcore/SpartakCoreRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java
index 3fabfd67b2..b2050bbac5 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java
@@ -1,5 +1,6 @@
package com.github.technus.tectech.compatibility.spartakcore;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry;
import com.github.technus.tectech.recipe.TT_recipeAdder;
import com.github.technus.tectech.thing.CustomItemList;
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
@@ -19,15 +20,13 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
-import static com.github.technus.tectech.loader.recipe.RecipeLoader.getOrDefault;
+import static com.github.technus.tectech.loader.recipe.BaseRecipeLoader.getOrDefault;
/**
* Created by Spartak1997 on 28.07.2019.
*/
-public class SpartakCoreRecipeLoader implements Runnable {
-
- @Override
- public void run() {
+public class SpartakCoreRecipeLoader {
+ public void run(EMTransformationRegistry transformationInfo) {
//Quantum Glass
GT_Values.RA.addAssemblerRecipe(new ItemStack[]{
diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java
index a062fa0dab..40419604e4 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java
@@ -2,24 +2,21 @@ 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.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry;
-import com.github.technus.tectech.util.Util;
-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.decay.EMDecay;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.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 com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
+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.util.Util;
import java.util.ArrayList;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd;
import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*;
import static net.minecraft.util.StatCollector.translateToLocal;
@@ -30,7 +27,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate {
private final int hash;
private final double mass;
- private static final byte nbtType = (byte) 'c';
+ private static final String nbtType = "`";
private final EMConstantStackMap aspectStacks;
@@ -76,7 +73,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate {
@Override
public String getLocalizedName() {
- String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectTag(this);
+ String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectLocalizedName(this);
if (name != null) {
name = name.substring(0, 1).toUpperCase() + name.substring(1);
} else {
@@ -124,25 +121,10 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate {
}
@Override
- protected int getIndirectTagValue() {
+ protected String getIndirectTagValue() {
return nbtType;
}
- public static EMComplexAspectDefinition 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 EMComplexAspectDefinition(stacks);
- } catch (EMException e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- return null;
- }
- }
-
@Override
public double getRawTimeSpan(long currentEnergy) {
return -1;
@@ -159,12 +141,12 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate {
}
@Override
- public byte getMatterType() {
+ public int getGeneration() {
return 0;
}
@Override
- public byte getColor() {
+ public int getMaxColors() {
return -1;
}
@@ -175,7 +157,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate {
@Override
public EMDecay[] getEnergyInducedDecay(long energyLevel) {
- return new EMDecay[]{new EMDecay(0.75F, aspectStacks), EMBosonDefinition.deadEnd};
+ return new EMDecay[]{new EMDecay(0.75F, aspectStacks), deadEnd};
}
@Override
@@ -219,44 +201,24 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate {
}
@Override
- public EMFluidDequantizationInfo someAmountIntoFluidStack() {
- return null;
- }
-
- @Override
- public EMItemDequantizationInfo someAmountIntoItemsStack() {
- return null;
- }
-
- @Override
- public EMOredictDequantizationInfo someAmountIntoOredictStack() {
- return null;
- }
-
- @Override
public IEMDefinition getAnti() {
return null;
}
- public static void run() {
- try {
- EMDefinitionsRegistry.registerDefinitionClass(nbtType, EMComplexAspectDefinition::fromNBT,EMComplexAspectDefinition.class, getClassTypeStatic());
- } catch (Exception e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- }
+ public static void run(EMDefinitionsRegistry registry) {
+ registry.registerDefinitionClass(nbtType, new EMIndirectType((definitionsRegistry, nbt)->
+ new EMComplexAspectDefinition(EMConstantStackMap.fromNBT(definitionsRegistry,nbt)), EMComplexAspectDefinition.class, "tt.keyword.Aspect"));
if (DEBUG_MODE) {
TecTech.LOGGER.info("Registered Elemental Matter Class: ComplexAspect " + nbtType + ' ' + getClassTypeStatic());
}
}
@Override
- public byte getClassType() {
+ public int getMatterMassType() {
return getClassTypeStatic();
}
- public static byte getClassTypeStatic() {
+ public static int getClassTypeStatic() {
return -96;
}
@@ -275,7 +237,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate {
@Override
public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) {
if (Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) {
- lines.add(translateToLocal("tt.keyword.CLASS") + " = " + nbtType + ' ' + getClassType());
+ lines.add(translateToLocal("tt.keyword.CLASS") + " = " + nbtType + ' ' + getMatterMassType());
}
if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS, capabilities)) {
lines.add(translateToLocal("tt.keyword.NAME") + " = " + getLocalizedName());
@@ -285,7 +247,7 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate {
lines.add(translateToLocal("tt.keyword.CHARGE") + " = " + getCharge() / 3f + " e");
}
if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) {
- lines.add(getColor() < 0 ? translateToLocal("tt.keyword.COLORLESS") : translateToLocal("tt.keyphrase.CARRIES_COLOR"));
+ lines.add(hasColor() ? translateToLocal("tt.keyword.COLORLESS") : translateToLocal("tt.keyphrase.CARRIES_COLOR"));
}
if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) {
lines.add(translateToLocal("tt.keyword.MASS") + " = " + getMass() + " eV/c\u00b2");
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
index e62c2e5278..885a71ef28 100644
--- 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
@@ -1,6 +1,9 @@
package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions;
+import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType;
import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY;
import static net.minecraft.util.StatCollector.translateToLocal;
@@ -10,29 +13,35 @@ import static net.minecraft.util.StatCollector.translateToLocal;
*/
public final class EMPrimalAspectDefinition extends EMPrimitiveTemplate {
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);
+ magic_air = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 45,"a`"),
+ magic_earth = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 44,"e`"),
+ magic_fire = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3D, 43,"f`"),
+ magic_water = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7D, 42,"w`"),
+ magic_order = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5D, 40,"o`"),
+ magic_entropy = new EMPrimalAspectDefinition(translateToLocal("tt.keyword.Chaos"), "c`", 1e5D, 41,"c`");
- private EMPrimalAspectDefinition(String name, String symbol, double mass, int ID) {
- super(name, symbol, 0, mass, 0, -1, ID);
+ private EMPrimalAspectDefinition(String name, String symbol, double mass, int ID,String bind) {
+ super(name, symbol, 0, mass, 0, -1, ID,bind);
}
- 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);
+ public static void run(EMDefinitionsRegistry registry) {
+ registry.registerDefinitionClass(new EMType(EMPrimalAspectDefinition.class,"tt.keyword.Primal"));
+ magic_air.init(registry,null, -1F, -1, -1, NO_DECAY);
+ magic_earth.init(registry,null, -1F, -1, -1, NO_DECAY);
+ magic_fire.init(registry,null, -1F, -1, -1, NO_DECAY);
+ magic_water.init(registry,null, -1F, -1, -1, NO_DECAY);
+ magic_order.init(registry,null, -1F, -1, -1, NO_DECAY);
+ magic_entropy.init(registry,null, -1F, -1, -1, NO_DECAY);
}
@Override
public String getLocalizedName() {
- return translateToLocal("tt.keyword.Primal") + ": " + getName();
+ String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectLocalizedName(this);
+ if (name != null) {
+ return translateToLocal("tt.keyword.Primal") + ": " + getUnlocalizedName()+" ("+name+")";
+ } else {
+ return translateToLocal("tt.keyword.Primal") + ": " + getUnlocalizedName();
+ }
}
@Override
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 a4328d2e03..c1c6c6dcb2 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
@@ -2,6 +2,7 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.tran
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
import java.util.HashMap;
@@ -13,12 +14,16 @@ public class AspectDefinitionCompat {
private final HashMap<IEMDefinition,String> defToAspect = new HashMap<>();
private final HashMap<String, IEMDefinition> aspectToDef = new HashMap<>();
- public void run(){}
+ public void run(EMDefinitionsRegistry registry){}
public String getAspectTag(IEMDefinition definition){
return null;
}
+ public String getAspectLocalizedName(IEMDefinition definition){
+ return null;
+ }
+
public IEMDefinition getDefinition(String aspect){
return null;
}
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 ead8a5fdef..ccccff7c3d 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
@@ -2,20 +2,20 @@ package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.tran
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.definitions.registry.EMDefinitionsRegistry;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
import thaumcraft.api.aspects.Aspect;
import java.util.ArrayList;
import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition.*;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry.STACKS_REGISTERED;
/**
* Created by Tec on 21.05.2017.
*/
public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat {
@Override
- public void run(){
+ public void run(EMDefinitionsRegistry registry){
getDefToAspect().put(magic_air,"aer");
getDefToAspect().put(magic_earth,"terra");
getDefToAspect().put(magic_fire,"ignis");
@@ -51,6 +51,7 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat
}
getAspectToDef().put(aspect.getTag(),newAspect);
getDefToAspect().put(newAspect,aspect.getTag());
+ registry.registerForDisplay(newAspect);
}catch (EMException e) {
/**/
}finally {
@@ -60,7 +61,6 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat
}
}
}
- STACKS_REGISTERED.addAll(getDefToAspect().keySet());
}
@Override
@@ -68,6 +68,11 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat
return getDefToAspect().get(definition);
}
+ public String getAspectLocalizedName(IEMDefinition definition){
+ Aspect aspect = Aspect.aspects.get(getAspectTag(definition));
+ return aspect != null ? aspect.getName() : null;
+ }
+
@Override
public IEMDefinition getDefinition(String aspect) {
return getAspectToDef().get(aspect);
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 dbcbe7d86b..267af79784 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
@@ -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.EMTransformationInfo.AVOGADRO_CONSTANT;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_DIMINISHED;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_ITEM_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;
@@ -100,7 +100,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_
}
EMInstanceStack stack = inputHatchContainer.getRandom();
- if (stack.getAmount() < AVOGADRO_CONSTANT_DIMINISHED) {
+ if (stack.getAmount() < EM_COUNT_PER_ITEM_DIMINISHED) {
cleanStackEM_EM(inputHatchContainer.removeKey(stack.getDefinition()));
mEUt = (int) -V[6];
} else {
@@ -111,7 +111,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_
cleanStackEM_EM(inputHatchContainer.removeKey(stack.getDefinition()));
mEUt = (int) -V[7];
} else {
- inputHatchContainer.removeAmount(stack.getDefinition().getStackForm(AVOGADRO_CONSTANT));
+ inputHatchContainer.removeAmount(stack.getDefinition().getStackForm(EM_COUNT_PER_MATERIAL_AMOUNT));
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 5fe8c973fe..a381a37f89 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
@@ -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.EMTransformationInfo.AVOGADRO_CONSTANT;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT;
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;
@@ -90,7 +90,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu
mEfficiencyIncrease = 10000;
eAmpereFlow = 1;
outputEM = new EMInstanceStackMap[]{
- new EMInstanceStackMap(new EMInstanceStack(definition,AVOGADRO_CONSTANT))
+ new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT))
};
if (definition instanceof EMPrimalAspectDefinition) {
mEUt = (int) -V[8];
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 61989e7b13..773361bd0f 100644
--- a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java
@@ -2,36 +2,33 @@ package com.github.technus.tectech.loader;
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.definitions.registry.EMDefinitionsRegistry;
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.*;
/**
* Created by danie_000 on 16.11.2016.
*/
-public class ElementalLoader implements Runnable {
- @Override
- public void run() {
+public class ElementalLoader {
+ public void run(EMDefinitionsRegistry registry) {
// ===================================================================================================
// Definition init
// ===================================================================================================
- EMPrimitiveDefinition.run();
+ EMPrimitiveDefinition.run(registry);
- EMQuarkDefinition.run();
- EMLeptonDefinition.run();
- EMNeutrinoDefinition.run();
- EMBosonDefinition.run();
+ EMQuarkDefinition.run(registry);
+ EMLeptonDefinition.run(registry);
+ EMNeutrinoDefinition.run(registry);
+ EMGaugeBosonDefinition.run(registry);
+ EMScalarBosonDefinition.run(registry);
- EMHadronDefinition.run();
+ EMHadronDefinition.run(registry);
- EMNuclideIAEA.run();
+ EMAtomDefinition.run(registry);
- EMAtomDefinition.run();
-
- EMPrimalAspectDefinition.run();
-
- EMComplexAspectDefinition.run();
+ EMPrimalAspectDefinition.run(registry);
+ EMComplexAspectDefinition.run(registry);
}
}
diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java
index b3c8d24a7c..e2f1e2882f 100644
--- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java
@@ -8,14 +8,16 @@ import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.
import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompatEnabled;
import com.github.technus.tectech.loader.gui.CreativeTabTecTech;
import com.github.technus.tectech.loader.gui.ModGuiHandler;
-import com.github.technus.tectech.loader.recipe.RecipeLoader;
+import com.github.technus.tectech.loader.recipe.BaseRecipeLoader;
import com.github.technus.tectech.loader.thing.ComponentLoader;
import com.github.technus.tectech.loader.thing.CoverLoader;
import com.github.technus.tectech.loader.thing.MachineLoader;
import com.github.technus.tectech.loader.thing.ThingsLoader;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry;
import com.github.technus.tectech.thing.casing.TT_Container_Casings;
import com.github.technus.tectech.thing.metaTileEntity.Textures;
-import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_collider;
+import com.github.technus.tectech.thing.metaTileEntity.multi.em_collider.GT_MetaTileEntity_EM_collider;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ProgressManager;
import cpw.mods.fml.common.network.NetworkRegistry;
@@ -43,7 +45,7 @@ import static com.github.technus.tectech.TecTech.*;
import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat.aspectDefinitionCompat;
import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat;
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.TecTech.creativeTabTecTech;
import static gregtech.api.enums.GT_Values.W;
public final class MainLoader {
@@ -65,17 +67,17 @@ public final class MainLoader {
//set expanded texture arrays for tiers
try {
- new Textures();
+ Textures.run();
}catch (Throwable t){
LOGGER.error("Loading textures...",t);
}
}
- public static void load() {
+ public static void load(EMDefinitionsRegistry registry) {
ProgressManager.ProgressBar progressBarLoad = ProgressManager.push("TecTech Loader", 9);
progressBarLoad.step("Elemental Things");
- new ElementalLoader().run();
+ new ElementalLoader().run(registry);
LOGGER.info("Elemental Init Done");
progressBarLoad.step("Thaumcraft Compatibility");
@@ -120,7 +122,7 @@ public final class MainLoader {
ProgressManager.pop(progressBarLoad);
}
- public static void postLoad() {
+ public static void postLoad(EMDefinitionsRegistry registry, EMTransformationRegistry transformationInfo) {
ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 6);
progressBarPostLoad.step("Dreamcraft Compatibility");
@@ -138,15 +140,11 @@ public final class MainLoader {
}
progressBarPostLoad.step("Thaumcraft Compatibility");
- if (Loader.isModLoaded(Reference.THAUMCRAFT)) {
- aspectDefinitionCompat = new AspectDefinitionCompatEnabled();
- aspectDefinitionCompat.run();
- } else {
- aspectDefinitionCompat = new AspectDefinitionCompat();
- }
+ aspectDefinitionCompat = Loader.isModLoaded(Reference.THAUMCRAFT) ? new AspectDefinitionCompatEnabled() : new AspectDefinitionCompat();
+ aspectDefinitionCompat.run(registry);
progressBarPostLoad.step("Recipes");
- new RecipeLoader().run();
+ new BaseRecipeLoader().run(transformationInfo);
TecTech.LOGGER.info("Recipe Init Done");
progressBarPostLoad.step("Register Extra Hazmat Suits");
diff --git a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java
index d360162fb6..e5b9fea395 100644
--- a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java
+++ b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java
@@ -11,8 +11,6 @@ import net.minecraft.item.Item;
import java.util.List;
public class CreativeTabTecTech extends CreativeTabs {
- public static CreativeTabTecTech creativeTabTecTech;
-
public CreativeTabTecTech(String name) {
super(name);
}
diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java
index b5333c8e0d..d91d0e5900 100644
--- a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java
@@ -2,7 +2,9 @@ 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.gtpp.GtppAtomLoader;
import com.github.technus.tectech.compatibility.spartakcore.SpartakCoreRecipeLoader;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry;
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;
@@ -27,16 +29,18 @@ import static gregtech.api.enums.GT_Values.RA;
/**
* Created by danie_000 on 16.11.2016.
*/
-public class RecipeLoader implements Runnable {
+public class BaseRecipeLoader {
public static Materials getOrDefault(String name,Materials def){
Materials mat=Materials.get(name);
return mat == Materials._NULL || mat == null ? def : mat;
}
- @Override
- public void run() {
- EMAtomDefinition.setTransformations();
- EMHadronDefinition.setTransformations();
+ public void run(EMTransformationRegistry transformationInfo) {
+ EMAtomDefinition.setTransformations(transformationInfo);
+ EMHadronDefinition.setTransformations(transformationInfo);
+ if (Loader.isModLoaded(Reference.GTPLUSPLUS)) {
+ new GtppAtomLoader().setTransformations(transformationInfo);
+ }
// ===================================================================================================
// Recipes init - common goes here rest goes into methods below
@@ -110,11 +114,11 @@ public class RecipeLoader implements Runnable {
RA.addAssemblerRecipe(ItemList.Hatch_DataAccess_EV.get(1), CustomItemList.dataOut_Hatch.get(1), CustomItemList.dataOutAss_Hatch.get(1), 2048, 12000);
if (Loader.isModLoaded(Reference.DREAMCRAFT)) {
- new DreamCraftRecipeLoader().run();//init recipes for GTNH version
+ new DreamCraftRecipeLoader().run(transformationInfo);//init recipes for GTNH version
} else if (Loader.isModLoaded(Reference.SPARTAKCORE)) {
- new SpartakCoreRecipeLoader().run();//init recipes for SpartakCore version
+ new SpartakCoreRecipeLoader().run(transformationInfo);//init recipes for SpartakCore version
} else {
- new BloodyRecipeLoader().run();//init recipes for NON-GTNH version
+ new BloodyRecipeLoader().run(transformationInfo);//init recipes for NON-GTNH version
}
}
}
diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java
index 7b8cc14f4d..a57f268d4e 100644
--- a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java
@@ -1,5 +1,6 @@
package com.github.technus.tectech.loader.recipe;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry;
import com.github.technus.tectech.recipe.TT_recipeAdder;
import com.github.technus.tectech.thing.CustomItemList;
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
@@ -22,9 +23,8 @@ import net.minecraftforge.fluids.FluidStack;
/**
* Created by Tec on 06.08.2017.
*/
-public class BloodyRecipeLoader implements Runnable {
- @Override
- public void run() {
+public class BloodyRecipeLoader {
+ public void run(EMTransformationRegistry transformationInfo) {
//Quantum Glass
GT_Values.RA.addAssemblerRecipe(new ItemStack[]{
CustomItemList.eM_Containment.get(1),
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 b3df7483f5..4dd9d3422d 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
@@ -6,6 +6,7 @@ import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.
import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_essentiaQuantizer;
import com.github.technus.tectech.thing.metaTileEntity.hatch.*;
import com.github.technus.tectech.thing.metaTileEntity.multi.*;
+import com.github.technus.tectech.thing.metaTileEntity.multi.em_collider.GT_MetaTileEntity_EM_collider;
import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine;
import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data;
import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM;
@@ -15,7 +16,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.EMTransformationInfo.AVOGADRO_CONSTANT;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT;
import static com.github.technus.tectech.util.CommonValues.V;
import static com.github.technus.tectech.thing.CustomItemList.*;
@@ -74,22 +75,22 @@ public class MachineLoader implements Runnable {
// ===================================================================================================
eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_OverflowElemental(
- 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f*AVOGADRO_CONSTANT).getStackForm(1L));
+ 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L));
eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_OverflowElemental(
- 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f*AVOGADRO_CONSTANT).getStackForm(1L));
+ 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L));
eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_OverflowElemental(
- 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f*AVOGADRO_CONSTANT).getStackForm(1L));
+ 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L));
eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_OverflowElemental(
- 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f*AVOGADRO_CONSTANT).getStackForm(1L));
+ 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L));
eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_OverflowElemental(
- 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f*AVOGADRO_CONSTANT).getStackForm(1L));
+ 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L));
eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_OverflowElemental(
- 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f*AVOGADRO_CONSTANT).getStackForm(1L));
+ 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L));
// ===================================================================================================
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 c6ac34b66d..84f8a5e9d6 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
@@ -31,18 +31,18 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-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;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED;
public class AnomalyHandler implements IChunkMetaDataHandler {
- private static final double SWAP_THRESHOLD = EMAtomDefinition.getSomethingHeavy().getMass() * 1000D * AVOGADRO_CONSTANT_144;//can be const as it is computed later...
+ private static final double SWAP_THRESHOLD = EMAtomDefinition.getSomethingHeavy().getMass() * 1000D * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED;//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";
private static final int MEAN_DELAY =50;
- private static final double CANCER_EFFECTIVENESS = 1/AVOGADRO_CONSTANT;
- private static final double CHARGE_EFFECTIVENESS = 10/AVOGADRO_CONSTANT;
- private static final double CHARGE_EXPLOSIVENESS = 5/AVOGADRO_CONSTANT;
+ private static final double CANCER_EFFECTIVENESS = 1/ EM_COUNT_PER_MATERIAL_AMOUNT;
+ private static final double CHARGE_EFFECTIVENESS = 10/ EM_COUNT_PER_MATERIAL_AMOUNT;
+ private static final double CHARGE_EXPLOSIVENESS = 5/ EM_COUNT_PER_MATERIAL_AMOUNT;
private boolean fixMe=false;
private final ArrayList<EntityPlayer> playersWithCharge = new ArrayList<>();
@@ -133,7 +133,7 @@ public class AnomalyHandler implements IChunkMetaDataHandler {
}
private void swapSomething(Chunk a,Chunk b,double mass) {
- float explosionPower=(float) Math.log(mass/AVOGADRO_CONSTANT);
+ float explosionPower=(float) Math.log(mass/ EM_COUNT_PER_MATERIAL_AMOUNT);
for (int i = 0; i < Math.min((int)explosionPower,64); i++) {
int x = TecTech.RANDOM.nextInt(16);
int y = TecTech.RANDOM.nextInt(a.worldObj.getActualHeight());
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java
index e00e72446d..d607dfad73 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java
@@ -19,7 +19,4 @@ public final class EMException extends RuntimeException {
public EMException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
-
- public EMException() {
- }
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java
index af4caf854b..18f2f76498 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java
@@ -1,36 +1,31 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.commands;
import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType;
import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap;
+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.definitions.EMPrimitiveTemplate;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentText;
-import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
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.EMPrimitiveDefinition.nbtE__;
/**
* Created by danie_000 on 30.12.2017.
*/
public class EMGive implements ICommand {
- ArrayList<String> aliases=new ArrayList<>();
+ ArrayList<String> aliases = new ArrayList<>();
- public EMGive(){
+ public EMGive() {
aliases.add("em_give");
aliases.add("give_em");
aliases.add("gib_em");
@@ -39,27 +34,24 @@ public class EMGive implements ICommand {
@Override
public void processCommand(ICommandSender sender, String[] args) {
if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) {
- if(args.length < 3) {
+ if (args.length < 3) {
sender.addChatMessage(new ChatComponentText(getCommandUsage(sender)));
- }else{
- TecTech.LOGGER.info("Spawninig EM for "+((EntityPlayerMP) sender).getDisplayName()+" - "+Arrays.toString(args));
+ } else {
+ TecTech.LOGGER.info("Spawninig EM for " + ((EntityPlayerMP) sender).getDisplayName() + " - " + Arrays.toString(args));
- ArrayList<String> list = new ArrayList<>(Arrays.asList(args));
- String energy=list.remove(0);
+ ArrayList<String> list = new ArrayList<>(Arrays.asList(args));
+ String energy = list.remove(0);
- EMDefinitionStack def = getDefinitionStack(list);
- if(def!=null) {
- EMInstanceStack instanceStack = new EMInstanceStack(def, 1D, 0D, Long.parseLong(energy));
+ EMDefinitionStack def = getDefinitionStack(TecTech.definitionsRegistry, list);
+ if (def != null) {
+ EMInstanceStack instanceStack = new EMInstanceStack(def, 1, 0, Long.parseLong(energy));
sender.addChatMessage(new ChatComponentText(instanceStack.getDefinition().getSymbol() + " - " + instanceStack.getDefinition().getLocalizedName()));
EMInstanceStackMap instanceMap = new EMInstanceStackMap(instanceStack);
ItemStack itemStack = new ItemStack(DebugElementalInstanceContainer_EM.INSTANCE);
- NBTTagCompound contents = new NBTTagCompound();
- contents.setTag("info", instanceMap.getInfoNBT());
- contents.setTag("content", instanceMap.toNBT());
- itemStack.setTagCompound(contents);
+ DebugElementalInstanceContainer_EM.INSTANCE.setContent(itemStack, instanceMap);
((EntityPlayerMP) sender).inventory.addItemStackToInventory(itemStack);
}
@@ -67,40 +59,45 @@ public class EMGive implements ICommand {
}
}
- private EMDefinitionStack getDefinitionStack(ArrayList<String> args){
- if(args.get(0).equals("<")){
- args.remove(0);
+ private EMDefinitionStack getDefinitionStack(EMDefinitionsRegistry registry, ArrayList<String> args) {
+ double amount;
+ if (args.size() == 0) {
return null;
}
- double amount=Double.parseDouble(args.remove(0));
- try{
- int id=Integer.parseInt(args.get(0));
- args.remove(0);
- IEMDefinition primitive = IEMDefinition.getBindsPrimitive().get(id);
- return new EMDefinitionStack(primitive,amount);
- }catch (NumberFormatException e){
- byte clazz = (byte) args.remove(0).charAt(0);
- Method constructor = IEMDefinition.getBindsComplex().get(clazz);
-
- EMDefinitionStackMap stacks =new EMDefinitionStackMap();
- while(args.size()>0){
- EMDefinitionStack tempStack =getDefinitionStack(args);
- if(tempStack==null) {
- break;
- }else {
- stacks.putUnifyExact(tempStack);
- }
+ String defTag = args.remove(0);
+ if ("<".equals(defTag)) {
+ return null;
+ }
+ try {
+ amount = Double.parseDouble(defTag);
+ if (args.size() == 0) {
+ return null;
}
-
- try {
- return ((IEMDefinition) constructor.invoke(null, stacks.toNBT())).getStackForm(amount);
- } catch (Exception e1) {
- if (DEBUG_MODE) {
- e.printStackTrace();
+ defTag = args.remove(0);
+ if ("<".equals(defTag)) {
+ return null;
+ }
+ } catch (Exception e) {
+ amount = 1;
+ }
+ IEMDefinition definition = registry.getDirectBinds().get(defTag);
+ if (definition != null) {
+ return definition.getStackForm(amount);
+ }
+ EMIndirectType emIndirectType = registry.getIndirectBinds().get(defTag);
+ if (emIndirectType != null) {
+ EMDefinitionStackMap stacks = new EMDefinitionStackMap();
+ while (args.size() > 0) {
+ EMDefinitionStack definitionStack = getDefinitionStack(registry, args);
+ if (definitionStack == null) {
+ break;
+ } else {
+ stacks.putUnifyExact(definitionStack);
}
- return nbtE__.getStackForm(amount);
}
+ return emIndirectType.create(registry, stacks.toNBT(registry)).getStackForm(amount);
}
+ return null;
}
@Override
@@ -120,33 +117,20 @@ public class EMGive implements ICommand {
@Override
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args) {
- if(args.length==2){
- return completionsForClassOrID();
+ if (args.length > 1 && args.length % 2 == 0) {
+ return new ArrayList<>(TecTech.definitionsRegistry.getBinds().keySet());
}
return null;
}
- private List<String> completionsForClassOrID(){
- ArrayList<String> strings=new ArrayList<>(8);
- Map<Byte,Method> binds= IEMDefinition.getBindsComplex();
- for (Map.Entry<Byte,Method> e:binds.entrySet()) {
- strings.add(String.valueOf((char)e.getKey().byteValue()));
- }
- Map<Integer, EMPrimitiveTemplate> bindsBO = IEMDefinition.getBindsPrimitive();
- for (Map.Entry<Integer, EMPrimitiveTemplate> e:bindsBO.entrySet()) {
- strings.add(String.valueOf(e.getKey().byteValue()));
- }
- return strings;
- }
-
@Override
public String getCommandUsage(ICommandSender p_71518_1_) {
- return "em_give Energy Count ClassOrId (Count ClassOrId ... <)";
+ return "em_give Energy Count ClassOrId ( (Count ClassOrId ... <) ...<)";
}
@Override
public int compareTo(Object o) {
- if(o instanceof ICommand){
+ if (o instanceof ICommand) {
return getCommandName().compareTo(((ICommand) o).getCommandName());
}
return 0;
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java
index 13531dbf85..90eddf1e23 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java
@@ -1,15 +1,15 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.commands;
-import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate;
-import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
+import com.github.technus.tectech.TecTech;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType;
+import com.github.technus.tectech.util.Util;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;
-import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
+import java.util.stream.Collectors;
/**
* Created by danie_000 on 30.12.2017.
@@ -26,27 +26,32 @@ public class EMList implements ICommand {
public void processCommand(ICommandSender sender, String[] args) {
if (!sender.getEntityWorld().isRemote) {
if(args.length == 0) {
- sender.addChatMessage(new ChatComponentText(" Available Classes: tag - name"));
- Map<Byte,Method> binds= IEMDefinition.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) EMPrimitiveTemplate.nbtType))){
- Map<Integer, EMPrimitiveTemplate> bindsBO = IEMDefinition.getBindsPrimitive();
- for (Map.Entry<Integer, EMPrimitiveTemplate> e:bindsBO.entrySet()) {
- sender.addChatMessage(new ChatComponentText(e.getKey() + " - "+e.getValue().getLocalizedName()));
- }
- }else{
- sender.addChatMessage(new ChatComponentText("Complex definition - needs contents"));
- }
- }else{
- sender.addChatMessage(new ChatComponentText(getCommandUsage(sender)));
+ listClasses(sender);
+ }else {
+ listDefinitions(sender, Util.getConcated(args," "));
}
}
}
+ private void listDefinitions(ICommandSender sender, String arg) {
+ sender.addChatMessage(new ChatComponentText(" Available Direct: tag - name symbol"));
+ for (EMType directType : TecTech.definitionsRegistry.getDirectTypes().values()) {
+ if ("*".equals(arg) || arg.equalsIgnoreCase(directType.getLocalizedName())) {
+ directType.getDefinitions().forEach((bind, definition) ->
+ sender.addChatMessage(new ChatComponentText(bind + " - " + definition.getLocalizedName() + " " + definition.getSymbol())));
+ }
+ }
+ }
+
+ private void listClasses(ICommandSender sender) {
+ sender.addChatMessage(new ChatComponentText(" Available Direct: name (use name as parameter to learn more"));
+ TecTech.definitionsRegistry.getDirectTypes().forEach((aClass, emDirectType) ->
+ sender.addChatMessage(new ChatComponentText(emDirectType.getLocalizedName())));
+ sender.addChatMessage(new ChatComponentText(" Available Indirect: tag - name"));
+ TecTech.definitionsRegistry.getIndirectBinds().forEach((bind, emIndirectType) ->
+ sender.addChatMessage(new ChatComponentText(bind+" - "+emIndirectType.getLocalizedName())));
+ }
+
@Override
public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) {
return false;
@@ -65,19 +70,14 @@ public class EMList implements ICommand {
@Override
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args) {
if(args.length==0){
- Map<Byte,Method> binds= IEMDefinition.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());
- }
- return strings;
+ return TecTech.definitionsRegistry.getDirectTypes().values().stream().map(EMType::getLocalizedName).collect(Collectors.toList());
}
return null;
}
@Override
public String getCommandUsage(ICommandSender p_71518_1_) {
- return "em_list (optional class tag)";
+ return "em_list (optional Direct Name or *)";
}
@Override
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java
index 94a50ce322..13838cf443 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java
@@ -1,5 +1,6 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.definitions;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
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;
@@ -30,11 +31,6 @@ public abstract class EMComplexTemplate implements IEMDefinition {
}
@Override
- public final EMDefinitionStack getStackForm(double amount) {
- return new EMDefinitionStack(this, amount);
- }
-
- @Override
public final boolean equals(Object obj) {
if(this==obj) {
return true;
@@ -50,24 +46,22 @@ public abstract class EMComplexTemplate implements IEMDefinition {
@Override
public int hashCode() {//Internal amounts should be also hashed
- int hash = -(getSubParticles().size() << 4);
+ int hash = -(getSubParticles().size() << 16);
for (EMDefinitionStack stack : getSubParticles().valuesToArray()) {
int amount=(int) stack.getAmount();
- hash += ((amount & 0x1) == 0 ? -amount : amount) + stack.getDefinition().hashCode();
+ hash += ((amount & 0x1) == 0 ? -amount : amount) * (stack.getDefinition().hashCode()<<4);
}
return hash;
}
@Override
public String toString() {
- return getLocalizedName()+ '\n' + getSymbol();
+ return getLocalizedName()+ " " + getSymbol();
}
- public NBTTagCompound toNBT() {
- NBTTagCompound nbtTagCompound = getSubParticles().toNBT();
- nbtTagCompound.setInteger(EMDefinitionsRegistry.getIndirectTagName(), getIndirectTagValue());
- return nbtTagCompound;
+ public NBTTagCompound toNBT(EMDefinitionsRegistry registry) {
+ return registry.indirectToNBT(getIndirectTagValue(),getSubParticles());
}
- protected abstract int getIndirectTagValue();
+ protected abstract String getIndirectTagValue();
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java
deleted file mode 100644
index c0f9df32f2..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.definitions;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
-import net.minecraft.nbt.NBTTagCompound;
-
-import java.util.*;
-import java.util.function.Function;
-
-import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__;
-
-public class EMDefinitionsRegistry {
- private static final NavigableSet<IEMDefinition> STACKS_REGISTERED = new TreeSet<>();
- private static final Map<Integer, IEMDefinition> DIRECT_BINDS = new HashMap<>();
- private static final Map<Integer, Function<NBTTagCompound, ? extends IEMDefinition>> CLASS_BINDS = new HashMap<>();//creator methods in subclasses
- private static final Map<Integer, Class<? extends IEMDefinition>> CLASSES = new HashMap<>();
- private static final Map<Class<? extends IEMDefinition>, Integer> CLASS_TYPES = new HashMap<>();
- private static final String INDIRECT_TAG = "t";
- private static final String DIRECT_TAG = "c";
-
- private EMDefinitionsRegistry() {
- }
-
- static {
- CLASS_BINDS.put(0, EMDefinitionsRegistry::getDefinitionDirect);
- CLASS_BINDS.put((int) 'p', EMDefinitionsRegistry::getDefinitionDirect);
- }
-
- private static IEMDefinition getDefinitionDirect(NBTTagCompound nbt) {
- return DIRECT_BINDS.get(nbt.getInteger(getDirectTagName()));
- }
-
- public static IEMDefinition fromNBT(NBTTagCompound nbt) {
- IEMDefinition apply;
- try {
- apply = CLASS_BINDS.get(nbt.getInteger(getIndirectTagName())).apply(nbt);
- } catch (Exception e) {
- EMException emException = new EMException("Failed to create from: " + nbt.toString(), e);
- if (DEBUG_MODE) {
- emException.printStackTrace();
- return nbtE__;
- } else {
- throw emException;
- }
- }
- if (!DEBUG_MODE) {
- if (apply == nbtE__) {
- throw new EMException("Deserialized to NBT ERROR!");
- } else if (apply == null__ || apply == null) {
- throw new EMException("Deserialized to NULL POINTER!");
- }
- }
- if (apply == null) {
- return null__;
- }
- return apply;
- }
-
- public static <T extends IEMDefinition> void registerDefinitionClass(int shortcutNBT, Function<NBTTagCompound, T> creator, Class<T> clazz, int classID) {
- if (CLASS_BINDS.put(shortcutNBT, creator) != null) {
- EMException e = new EMException("Duplicate NBT shortcut! " + shortcutNBT + " used for NBT based creation");
- if (DEBUG_MODE) {
- e.printStackTrace();
- } else {
- throw e;
- }
- }
- if (CLASSES.put(classID, clazz) != null) {
- EMException e = new EMException("Duplicate Class ID! " + classID + " used for class comparison");
- if (DEBUG_MODE) {
- e.printStackTrace();
- } else {
- throw e;
- }
- }
- CLASS_TYPES.put(clazz, classID);
- }
-
- public static void registerDirectDefinition(IEMDefinition definition, int id) {
- IEMDefinition old = DIRECT_BINDS.put(id, definition);
- if (old != null) {
- EMException e = new EMException("Duplicate primitive EM ID: " + id +
- " for " + definition.getLocalizedName() +
- " and " + old.getLocalizedName());
- if (DEBUG_MODE) {
- e.printStackTrace();
- } else {
- throw e;
- }
- }
- }
-
- public static NavigableSet<IEMDefinition> getStacksRegisteredForDisplay() {
- return STACKS_REGISTERED;
- }
-
- public static void registerForDisplay(IEMDefinition definition){
- STACKS_REGISTERED.add(definition);
- STACKS_REGISTERED.add(definition.getAnti());
- }
-
- public static String getIndirectTagName() {
- return INDIRECT_TAG;
- }
-
- public static String getDirectTagName() {
- return DIRECT_TAG;
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java
index b529b79cc0..0f25d73704 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java
@@ -2,10 +2,8 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.definitions;
import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap;
-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;
@@ -25,41 +23,43 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate {
//int -electric charge in 1/3rds of electron charge for optimization
private final int charge;
//byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable)
- private final byte color;
+ private final int color;
//-1/-2/-3 anti matter generations, +1/+2/+3 matter generations, 0 self anti
- private final byte type;
+ private final int generation;
- private EMPrimitiveTemplate anti;//IMMUTABLE
+ private IEMDefinition anti;//IMMUTABLE
private EMDecay[] elementalDecays;
private byte naturalDecayInstant;
private byte energeticDecayInstant;
private double rawLifeTime;
private final int ID;
+ private final String bind;
//no _ at end - normal particle
// _ at end - anti particle
// __ at end - self is antiparticle
- protected EMPrimitiveTemplate(String name, String symbol, int type, double mass, int charge, int color, int ID) {
+ protected EMPrimitiveTemplate(String name, String symbol, int generation, double mass, int charge, int color, int ID, String bind) {
this.name = name;
this.symbol = symbol;
- this.type = (byte) type;
+ this.generation = generation;
this.mass = mass;
this.charge = charge;
- this.color = (byte) color;
+ this.color = color;
this.ID = ID;
- EMDefinitionsRegistry.registerDirectDefinition(this,ID);
+ this.bind=bind;
}
//
- protected void init(EMPrimitiveTemplate antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, EMDecay... elementalDecaysArray) {
+ protected void init(EMDefinitionsRegistry registry,IEMDefinition antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, EMDecay... elementalDecaysArray) {
anti = antiParticle;
this.rawLifeTime = rawLifeTime;
naturalDecayInstant = (byte) naturalInstant;
energeticDecayInstant = (byte) energeticInstant;
elementalDecays =elementalDecaysArray;
- EMDefinitionsRegistry.registerForDisplay(this);
+ registry.registerForDisplay(this);
+ registry.registerDirectDefinition(bind,this);
}
@Override
@@ -83,7 +83,7 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate {
}
@Override
- public byte getColor() {
+ public int getMaxColors() {
return color;
}
@@ -153,44 +153,27 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate {
}
@Override
- public EMFluidDequantizationInfo someAmountIntoFluidStack() {
- return null;
- }
-
- @Override
- public EMItemDequantizationInfo someAmountIntoItemsStack() {
- return null;
- }
-
- @Override
- public EMOredictDequantizationInfo someAmountIntoOredictStack() {
- return null;
- }
-
- @Override
- public byte getMatterType() {
- return type;
+ public int getGeneration() {
+ return generation;
}
@Override
- public final NBTTagCompound toNBT() {
- NBTTagCompound nbt = new NBTTagCompound();
- nbt.setInteger(EMDefinitionsRegistry.getDirectTagName(), ID);
- return nbt;
+ public final NBTTagCompound toNBT(EMDefinitionsRegistry registry) {
+ return registry.directToNBT(bind);
}
@Override
- protected final int getIndirectTagValue() {
+ protected final String getIndirectTagValue() {
throw new EMException("This class should only be used directly!");
}
@Override
- public final byte getClassType() {
+ public final int getMatterMassType() {
return getClassTypeStatic();
}
- public static byte getClassTypeStatic(){
- return -128;
+ public static int getClassTypeStatic(){
+ return Short.MIN_VALUE;
}
@Override
@@ -203,7 +186,7 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate {
@Override
public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) {
if(areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) {
- lines.add("CLASS = " + EMDefinitionsRegistry.getDirectTagName() + ' ' + getClassType());
+ lines.add("DIRECT = " + bind + ' ' + getMatterMassType());
}
if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) {
lines.add("NAME = "+ getLocalizedName());
@@ -213,7 +196,7 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate {
lines.add("CHARGE = " + getCharge() / 3D + " e");
}
if(areBitsSet(SCAN_GET_COLOR,capabilities)) {
- lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR");
+ lines.add(hasColor() ? "COLORLESS" : "CARRIES COLOR");
}
if(areBitsSet(SCAN_GET_MASS,capabilities)) {
lines.add("MASS = " + getMass() + " eV/c\u00b2");
@@ -226,7 +209,7 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate {
@Override
public final int compareTo(IEMDefinition o) {
- if (getClassType() == o.getClassType()) {
+ if (getMatterMassType() == o.getMatterMassType()) {
int oID = ((EMPrimitiveTemplate) o).ID;
return Integer.compare(ID, oID);
}
@@ -238,7 +221,7 @@ public abstract class EMPrimitiveTemplate extends EMComplexTemplate {
return ID;
}
- public String getName() {
+ public String getUnlocalizedName() {
return name;
}
} \ No newline at end of file
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java
index 06bfc61737..8125812dc6 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java
@@ -1,11 +1,9 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.definitions;
import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
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;
@@ -31,9 +29,9 @@ public interface IEMDefinition extends Comparable<IEMDefinition>,Cloneable {//IM
void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel);
- byte getMatterType();
+ int getMatterMassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED
- byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED
+ int getGeneration();
//Not dynamically changing stuff
IEMDefinition getAnti();//gives new anti particle def
@@ -59,7 +57,11 @@ public interface IEMDefinition extends Comparable<IEMDefinition>,Cloneable {//IM
int getCharge();//charge 1/3 electron charge
//dynamically changing stuff
- byte getColor();//-1 nope cannot 0 it can but undefined
+ int getMaxColors();
+
+ default boolean hasColor(){
+ return getMaxColors()>0;
+ }
double getRawTimeSpan(long currentEnergy);//defined in static fields or generated
@@ -67,19 +69,17 @@ public interface IEMDefinition extends Comparable<IEMDefinition>,Cloneable {//IM
EMConstantStackMap getSubParticles();//contents... null if none
- EMFluidDequantizationInfo someAmountIntoFluidStack();
-
- EMItemDequantizationInfo someAmountIntoItemsStack();
-
- EMOredictDequantizationInfo someAmountIntoOredictStack();
+ NBTTagCompound toNBT(EMDefinitionsRegistry registry);
- NBTTagCompound toNBT();
-
- EMDefinitionStack getStackForm(double amount);
+ default EMDefinitionStack getStackForm(double amount){
+ return new EMDefinitionStack(this,amount);
+ }
- IEMDefinition clone();
+ default IEMDefinition clone(){
+ return this;
+ }
default int compareClassID(IEMDefinition obj) {
- return (int) getClassType() - obj.getClassType();
+ return getMatterMassType() - obj.getMatterMassType();
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java
new file mode 100644
index 0000000000..458965da66
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java
@@ -0,0 +1,189 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.IEMMapRead;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+import java.util.*;
+
+import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__;
+
+public class EMDefinitionsRegistry {
+ private static final String TAG_NAME = "EM";
+
+ private final NavigableSet<IEMDefinition> stacksRegistered = new TreeSet<>();
+
+ private final Map<Integer, IEMDefinition> hashMap = new HashMap<>();
+ private final Map<Integer, IEMDefinition> hashMapR = Collections.unmodifiableMap(hashMap);
+
+ private final Map<Class<? extends IEMDefinition>, EMType> types = new HashMap<>();
+ private final Map<Class<? extends IEMDefinition>, EMType> typesR = Collections.unmodifiableMap(types);
+ private final Map<Class<? extends IEMDefinition>, EMType> directTypes = new HashMap<>();
+ private final Map<Class<? extends IEMDefinition>, EMType> directTypesR = Collections.unmodifiableMap(directTypes);
+ private final Map<Class<? extends IEMDefinition>, EMIndirectType> indirectTypes = new HashMap<>();
+ private final Map<Class<? extends IEMDefinition>, EMIndirectType> indirectTypesR = Collections.unmodifiableMap(indirectTypes);
+
+ private final Map<String, EMType> binds = new HashMap<>();
+ private final Map<String, EMType> bindsR = Collections.unmodifiableMap(binds);
+ private final Map<String, IEMDefinition> directBinds = new HashMap<>();
+ private final Map<String, IEMDefinition> directBindsR = Collections.unmodifiableMap(directBinds);
+ private final Map<String, EMIndirectType> indirectBinds = new HashMap<>();
+ private final Map<String, EMIndirectType> indirectBindsR = Collections.unmodifiableMap(indirectBinds);
+
+ public NBTTagCompound directToNBT(String bind) {
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt.setString(TAG_NAME, bind);
+ return nbt;
+ }
+
+ public NBTTagCompound indirectToNBT(String bind, IEMMapRead<EMDefinitionStack> content) {
+ NBTTagCompound nbt = content.toNBT(this);
+ nbt.setString(TAG_NAME, bind);
+ return nbt;
+ }
+
+ public IEMDefinition fromNBT(NBTTagCompound nbt) {
+ IEMDefinition definition;
+ try {
+ String bind = nbt.getString(TAG_NAME);
+ definition = directBinds.get(bind);
+ if (definition == null) {
+ definition = indirectBinds.get(bind).create(this, nbt);
+ }
+ } catch (Exception e) {
+ EMException emException = new EMException("Failed to create from: " + nbt.toString(), e);
+ if (DEBUG_MODE) {
+ emException.printStackTrace();
+ return nbtE__;
+ } else {
+ throw emException;
+ }
+ }
+ if (!DEBUG_MODE) {
+ if (definition == nbtE__) {
+ throw new EMException("Deserialized to NBT ERROR!");
+ } else if (definition == null) {
+ throw new EMException("Deserialized to NULL POINTER!");
+ } else if (definition == null__) {
+ throw new EMException("Deserialized to NULL!");
+ }
+ }
+ if (definition == null) {
+ return null__;
+ }
+ return definition;
+ }
+
+ public boolean isOccupied(String bind) {
+ return binds.containsKey(bind);
+ }
+
+ protected void addType(EMType emType) {
+ if (types.put(emType.getClazz(), emType) != null) {
+ EMException e = new EMException("Class collision! " + emType.getClazz().getName());
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ protected void bindType(String bind, EMType emType) {
+ if (binds.put(bind, emType) != null) {
+ EMException e = new EMException("NBT Bind collision! " + bind);
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ public void registerDefinitionClass(String bind, EMIndirectType emIndirectType) {
+ addType(emIndirectType);
+ indirectTypes.put(emIndirectType.getClazz(), emIndirectType);
+ bindType(bind, emIndirectType);
+ indirectBinds.put(bind, emIndirectType);
+ }
+
+ public void registerDefinitionClass(EMType emDirectType) {
+ addType(emDirectType);
+ }
+
+ public void registerDirectDefinition(String bind, IEMDefinition definition) {
+ if (hashMap.put(definition.hashCode(), definition) != null) {
+ EMException e = new EMException("Hash collision! " + definition.hashCode());
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ } else {
+ throw e;
+ }
+ }
+ EMType emType = directTypes.get(definition.getClass());
+ if (emType == null) {
+ emType = types.get(definition.getClass());
+ if (emType != null) {
+ directTypes.put(definition.getClass(), emType);
+ } else {
+ EMException e = new EMException("Direct Type bind missing! " + definition.getClass().getName());
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ } else {
+ throw e;
+ }
+ }
+ }
+ if (emType != null) {
+ directTypes.put(definition.getClass(), emType);
+ bindType(bind, emType);
+ emType.addDefinition(bind, definition);
+ directBinds.put(bind, definition);
+ }
+ }
+
+ public void registerForDisplay(IEMDefinition definition) {
+ stacksRegistered.add(definition);
+ IEMDefinition anti = definition.getAnti();
+ if (anti != null) {
+ stacksRegistered.add(anti);
+ }
+ }
+
+ @Deprecated
+ public Map<Integer, IEMDefinition> getHashMapping() {
+ return hashMapR;
+ }
+
+ public NavigableSet<IEMDefinition> getStacksRegisteredForDisplay() {
+ return stacksRegistered;
+ }
+
+ public Map<String, EMType> getBinds() {
+ return bindsR;
+ }
+
+ public Map<String, IEMDefinition> getDirectBinds() {
+ return directBindsR;
+ }
+
+ public Map<String, EMIndirectType> getIndirectBinds() {
+ return indirectBindsR;
+ }
+
+ public Map<Class<? extends IEMDefinition>, EMType> getTypes() {
+ return typesR;
+ }
+
+ public Map<Class<? extends IEMDefinition>, EMType> getDirectTypes() {
+ return directTypesR;
+ }
+
+ public Map<Class<? extends IEMDefinition>, EMIndirectType> getIndirectTypes() {
+ return indirectTypesR;
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java
new file mode 100644
index 0000000000..680dd029a4
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java
@@ -0,0 +1,37 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
+import net.minecraft.nbt.NBTTagCompound;
+
+import java.util.function.BiFunction;
+
+import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__;
+
+public class EMIndirectType extends EMType {
+ private final BiFunction<EMDefinitionsRegistry, NBTTagCompound, IEMDefinition> creator;
+
+ public EMIndirectType(BiFunction<EMDefinitionsRegistry, NBTTagCompound, IEMDefinition> creator, Class<? extends IEMDefinition> clazz, String unlocalizedName) {
+ super(clazz, unlocalizedName);
+ this.creator = creator;
+ }
+
+ protected BiFunction<EMDefinitionsRegistry,NBTTagCompound, IEMDefinition> getCreator() {
+ return creator;
+ }
+
+ public IEMDefinition create(EMDefinitionsRegistry registry,NBTTagCompound nbt){
+ try {
+ return creator.apply(registry, nbt);
+ }catch (Exception e){
+ EMException emException = new EMException("Failed to create from: " + nbt.toString(), e);
+ if (DEBUG_MODE) {
+ emException.printStackTrace();
+ return nbtE__;
+ } else {
+ throw emException;
+ }
+ }
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java
new file mode 100644
index 0000000000..73097db663
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java
@@ -0,0 +1,63 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
+import static net.minecraft.util.StatCollector.translateToLocal;
+
+public class EMType {
+ private final Map<String, IEMDefinition> definitions = new HashMap<>();
+ private final Map<String, IEMDefinition> definitionsR = Collections.unmodifiableMap(definitions);
+ private final Class<? extends IEMDefinition> clazz;
+ private final String unlocalizedName;
+
+ public EMType(Class<? extends IEMDefinition> clazz, String unlocalizedName) {
+ this.clazz = clazz;
+ this.unlocalizedName = unlocalizedName;
+ }
+
+ public Class<? extends IEMDefinition> getClazz() {
+ return clazz;
+ }
+
+ public String getUnlocalizedName() {
+ return unlocalizedName;
+ }
+
+ public String getLocalizedName() {
+ return translateToLocal(getUnlocalizedName());
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ return clazz==((EMType) o).clazz;
+ }
+
+ @Override
+ public int hashCode() {
+ return clazz.hashCode();
+ }
+
+ public void addDefinition(String bind, IEMDefinition definition) {
+ if (definitions.put(bind, definition) != null) {
+ EMException e = new EMException("NBT Bind collision on Direct bind!");
+ if (DEBUG_MODE) {
+ e.printStackTrace();
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ public Map<String, IEMDefinition> getDefinitions() {
+ return definitionsR;
+ }
+}
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
index e6cfa7d03e..f6bef9910e 100644
--- 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
@@ -1,5 +1,6 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
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.definitions.IEMDefinition;
@@ -45,10 +46,10 @@ public final class EMConstantStackMap/*IMMUTABLE*/ extends EMStackMap<EMDefiniti
return new EMDefinitionStackMap(new TreeMap<>(getBackingMap()));
}
- public static EMConstantStackMap fromNBT(NBTTagCompound nbt) throws EMException {
+ public static EMConstantStackMap fromNBT(EMDefinitionsRegistry registry, 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)));
+ defStacks[i] = EMDefinitionStack.fromNBT(registry,nbt.getCompoundTag(Integer.toString(i)));
if (defStacks[i].getDefinition().equals(nbtE__)) {
throw new EMException("Something went Wrong");
}
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
index 78bb8d740a..57b8f7bf1c 100644
--- 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
@@ -1,5 +1,6 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
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.definitions.IEMDefinition;
@@ -43,10 +44,10 @@ public final class EMDefinitionStackMap extends EMStackMap<EMDefinitionStack> im
return new EMConstantStackMap(getBackingMap());
}
- public static EMDefinitionStackMap fromNBT(NBTTagCompound nbt) throws EMException {
+ public static EMDefinitionStackMap fromNBT(EMDefinitionsRegistry registry, 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)));
+ defStacks[i] = EMDefinitionStack.fromNBT(registry,nbt.getCompoundTag(Integer.toString(i)));
if (defStacks[i].getDefinition().equals(nbtE__)) {
throw new EMException("Something went Wrong");
}
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
index 69dc53f83d..64ff7063e8 100644
--- 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
@@ -1,10 +1,12 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
+import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
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.definitions.IEMDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
@@ -13,9 +15,10 @@ 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.core.transformations.EMTransformationRegistry.AVOGADRO_CONSTANT;
import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__;
import static com.github.technus.tectech.util.DoubleCount.add;
+import static net.minecraft.util.StatCollector.translateToLocal;
/**
* Created by danie_000 on 22.01.2017.
@@ -91,7 +94,7 @@ public final class EMInstanceStackMap extends EMStackMap<EMInstanceStack> implem
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+
+ " #: " + EnumChatFormatting.GREEN + String.format("%.3E", instance.getAmount() /AVOGADRO_CONSTANT) +" "+translateToLocal("tt.keyword.mol")+ EnumChatFormatting.RESET+
" E: " + EnumChatFormatting.GREEN + instance.getEnergy() + EnumChatFormatting.RESET+
" T: " + EnumChatFormatting.GREEN + (instance.getLifeTime()<0?"STABLE":String.format("%.3E",instance.getLifeTime()));
}
@@ -120,16 +123,15 @@ public final class EMInstanceStackMap extends EMStackMap<EMInstanceStack> implem
}
public double tickContent(double lifeTimeMult, int postEnergize, double seconds){
- cleanUp();
+ //cleanUp();
double diff=0;
- for (EMInstanceStack instance : valuesToArray()) {
+ for (EMInstanceStack instance : takeAllToArray()) {
instance.setAge(instance.getAge() + seconds);
EMDecayResult newInstances = instance.decay(lifeTimeMult, instance.getAge(), postEnergize);
if (newInstances == null) {
- instance.nextColor();
+ putUnify(instance);
} else {
diff=add(diff,newInstances.getMassDiff());
- removeAmount(instance);//todo check maybe this should be removeKey
putUnifyAll(newInstances.getOutput());
}
}
@@ -157,10 +159,10 @@ public final class EMInstanceStackMap extends EMStackMap<EMInstanceStack> implem
return nbt;
}
- public static EMInstanceStackMap fromNBT(NBTTagCompound nbt) throws EMException {
+ public static EMInstanceStackMap fromNBT(EMDefinitionsRegistry registry, 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)));
+ instances[i] = EMInstanceStack.fromNBT(registry,nbt.getCompoundTag(Integer.toString(i)));
if (instances[i].getDefinition().equals(nbtE__)) {
throw new EMException("Something went Wrong");
}
@@ -188,6 +190,12 @@ public final class EMInstanceStackMap extends EMStackMap<EMInstanceStack> implem
return build.toString();
}
+ public EMInstanceStack[] takeAllToArray(){
+ EMInstanceStack[] newStack = valuesToArray();//just in case to uncouple The map
+ this.getBackingMap().clear();
+ return newStack;
+ }
+
public EMInstanceStackMap takeAll(){
EMInstanceStackMap newStack =new EMInstanceStackMap(false,new TreeMap<>(this.getBackingMap()));//just in case to uncouple The map
this.getBackingMap().clear();
@@ -212,7 +220,7 @@ public final class EMInstanceStackMap extends EMStackMap<EMInstanceStack> implem
return stack;
}
double newAmount = add(target.getAmount(), stack.getAmount());
- if (IEMMapRead.isValidAmount(newAmount)) {
+ if (IEMStack.isValidAmount(newAmount)) {
stack=target.unifyIntoThis(stack);
putReplace(stack);
return stack;
@@ -230,7 +238,7 @@ public final class EMInstanceStackMap extends EMStackMap<EMInstanceStack> implem
return stack;
}
double newAmount = target.getAmount()+stack.getAmount();
- if (IEMMapRead.isValidAmount(newAmount)) {
+ if (IEMStack.isValidAmount(newAmount)) {
stack=target.unifyIntoThis(stack);
putReplace(stack);
return stack;
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java
index 1322566914..c0420fa2b2 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java
@@ -1,6 +1,7 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.maps;
import com.github.technus.tectech.TecTech;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
import net.minecraft.nbt.NBTTagCompound;
@@ -9,18 +10,11 @@ import net.minecraft.util.EnumChatFormatting;
import java.lang.reflect.Array;
import java.util.*;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.*;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.*;
import static com.github.technus.tectech.util.DoubleCount.ulpSigned;
+import static net.minecraft.util.StatCollector.translateToLocal;
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;
- }
-
NavigableMap<IEMDefinition,T> getBackingMap();
IEMMapRead<T> clone();
@@ -105,7 +99,7 @@ public interface IEMMapRead<T extends IEMStack> extends Comparable<IEMMapRead<?>
for (T defStack : values()) {
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;
+ info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.getAmount()/AVOGADRO_CONSTANT+" "+translateToLocal("tt.keyword.mol");
i += 3;
}
return info;
@@ -132,12 +126,12 @@ public interface IEMMapRead<T extends IEMStack> extends Comparable<IEMMapRead<?>
return nbt;
}
- default NBTTagCompound toNBT() {
+ default NBTTagCompound toNBT(EMDefinitionsRegistry registry) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("i", size());
int i = 0;
for (Map.Entry<IEMDefinition, T> entry : entrySet()) {
- nbt.setTag(Integer.toString(i++), entry.getValue().toNBT());
+ nbt.setTag(Integer.toString(i++), entry.getValue().toNBT(registry));
}
return nbt;
}
@@ -265,7 +259,7 @@ public interface IEMMapRead<T extends IEMStack> extends Comparable<IEMMapRead<?>
}
default boolean containsAmount(IEMDefinition def, double amountToConsume) {
- double amountRequired=amountToConsume-AVOGADRO_CONSTANT_EPSILON;
+ double amountRequired=amountToConsume- EM_COUNT_EPSILON;
if(amountRequired==amountToConsume){
amountRequired-=ulpSigned(amountRequired);
}
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
index f13e82fb26..15815f2ee0 100644
--- 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
@@ -2,11 +2,11 @@ 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.definitions.IEMDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry;
import java.util.Map;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_EPSILON;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_EPSILON;
import static com.github.technus.tectech.util.DoubleCount.*;
public interface IEMMapWrite<T extends IEMStack> extends IEMMapWriteExact<T> {
@@ -15,11 +15,11 @@ public interface IEMMapWrite<T extends IEMStack> extends IEMMapWriteExact<T> {
/**
* Consumes amount from map
* @param def def to consume
- * @param amountToConsume should be comparable to {@link EMTransformationInfo#AVOGADRO_CONSTANT}
+ * @param amountToConsume should be comparable to {@link EMTransformationRegistry#EM_COUNT_PER_MATERIAL_AMOUNT}
* @return consumed successfully
*/
default boolean removeAmount(IEMDefinition def, double amountToConsume){
- double amountRequired=amountToConsume-AVOGADRO_CONSTANT_EPSILON;
+ double amountRequired=amountToConsume- EM_COUNT_EPSILON;
if(amountRequired==amountToConsume){
amountRequired-=ulpSigned(amountRequired);
}
@@ -31,7 +31,7 @@ public interface IEMMapWrite<T extends IEMStack> extends IEMMapWriteExact<T> {
if(current!=null){
if(current.getAmount()>=amountRequired){
double newAmount=sub(current.getAmount(),amountToConsume);
- if(IEMMapRead.isValidAmount(current.getAmount())){
+ if(IEMStack.isValidAmount(newAmount)){
current=(T)current.mutateAmount(newAmount);
getBackingMap().put(current.getDefinition(),current);
}else {
@@ -88,7 +88,7 @@ public interface IEMMapWrite<T extends IEMStack> extends IEMMapWriteExact<T> {
return stack;
}
double newAmount = add(target.getAmount(), stack.getAmount());
- if (IEMMapRead.isValidAmount(newAmount)) {
+ if (IEMStack.isValidAmount(newAmount)) {
stack=(T) target.mutateAmount(newAmount);
putReplace(stack);
return stack;
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
index 167ec8451d..9da971944c 100644
--- 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
@@ -7,7 +7,7 @@ import java.util.Map;
public interface IEMMapWriteExact<T extends IEMStack> extends IEMMapRead<T> {
default void cleanUp(){
- entrySet().removeIf(entry -> IEMMapRead.isInvalidAmount(entry.getValue().getAmount()));
+ entrySet().removeIf(entry -> entry.getValue().isInvalidAmount());
}
default void clear() {
@@ -95,7 +95,7 @@ public interface IEMMapWriteExact<T extends IEMStack> extends IEMMapRead<T> {
if(current!=null){
double newAmount=current.getAmount()-amountToConsume;
if(newAmount>=0){
- if(IEMMapRead.isValidAmount(current.getAmount())){
+ if(current.isValidAmount()){
current=(T)current.mutateAmount(newAmount);
getBackingMap().put(current.getDefinition(),current);
} else {
@@ -142,7 +142,7 @@ public interface IEMMapWriteExact<T extends IEMStack> extends IEMMapRead<T> {
return stack;
}
double newAmount = target.getAmount()+stack.getAmount();
- if (IEMMapRead.isValidAmount(newAmount)) {
+ if (IEMStack.isValidAmount(newAmount)) {
stack=(T) target.mutateAmount(newAmount);
putReplace(stack);
return stack;
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
index f868dbe0ad..c1e6a729f8 100644
--- 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
@@ -1,6 +1,6 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.stacks;
-import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
import net.minecraft.nbt.NBTTagCompound;
@@ -41,16 +41,16 @@ public final class EMDefinitionStack implements IEMStack {
return amount;
}
- public NBTTagCompound toNBT() {
+ public NBTTagCompound toNBT(EMDefinitionsRegistry registry) {
NBTTagCompound nbt = new NBTTagCompound();
- nbt.setTag("d", getDefinition().toNBT());
+ nbt.setTag("d", getDefinition().toNBT(registry));
nbt.setDouble("Q", getAmount());
return nbt;
}
- public static EMDefinitionStack fromNBT(NBTTagCompound nbt) {
+ public static EMDefinitionStack fromNBT(EMDefinitionsRegistry registry,NBTTagCompound nbt) {
return new EMDefinitionStack(
- EMDefinitionsRegistry.fromNBT(nbt.getCompoundTag("d")),
+ registry.fromNBT(nbt.getCompoundTag("d")),
nbt.getLong("q")+nbt.getDouble("Q"));
}
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
index 6347cd2144..b67d2ce121 100644
--- 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
@@ -1,12 +1,12 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.stacks;
import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry;
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.definitions.IEMDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
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.definitions.IEMDefinition;
import com.github.technus.tectech.util.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.crash.CrashReport;
@@ -14,19 +14,22 @@ 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.core.transformations.EMTransformationRegistry.AVOGADRO_CONSTANT;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd;
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.*;
+import static java.lang.Math.max;
+import static java.lang.Math.min;
+import static net.minecraft.util.StatCollector.translateToLocal;
/**
* 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
+ public static double DECAY_CALL_PER = EM_COUNT_PER_MATERIAL_AMOUNT;//todo
private final IEMDefinition definition;
private double amount;
@@ -35,7 +38,7 @@ public final class EMInstanceStack implements IEMStack {
//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 int color;
private double lifeTime;
private double lifeTimeMult;
@@ -53,11 +56,10 @@ public final class EMInstanceStack implements IEMStack {
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);
+ if (getDefinition().hasColor()) {
+ this.color = (byte) TecTech.RANDOM.nextInt(getDefinition().getMaxColors());
+ } else {//transforms colorable??? into proper color
+ this.color = getDefinition().getMaxColors();
}
this.lifeTimeMult = lifeTimeMult;
lifeTime = getDefinition().getRawTimeSpan(energy) * this.lifeTimeMult;
@@ -119,11 +121,11 @@ public final class EMInstanceStack implements IEMStack {
return definition;
}
- public byte getColor() {
+ public int getColor() {
return color;
}
- public void setColor(byte color) {//does not allow changing magic element
+ public void setColor(int color) {//does not allow changing magic element
if (this.color < 0 || this.color > 2 || color < 0 || color >= 3) {
return;
}
@@ -131,10 +133,9 @@ public final class EMInstanceStack implements IEMStack {
}
public void nextColor() {//does not allow changing magic element
- if (color < 0 || color > 2) {
- return;
+ if (definition.hasColor()) {
+ color = (byte) TecTech.RANDOM.nextInt(definition.getMaxColors());
}
- color = (byte) TecTech.RANDOM.nextInt(3);
}
public double getLifeTime() {
@@ -524,7 +525,7 @@ public final class EMInstanceStack implements IEMStack {
lines.add("ENERGY = " + energy);
}
if (Util.areBitsSet(SCAN_GET_AMOUNT, capabilities)) {
- lines.add("AMOUNT = " + getAmount() / AVOGADRO_CONSTANT + " mol");
+ lines.add("AMOUNT = " + getAmount() /AVOGADRO_CONSTANT + " "+translateToLocal("tt.keyword.mol"));
}
scanContents(lines, getDefinition().getSubParticles(), 1, detailsOnDepthLevels);
}
@@ -546,25 +547,25 @@ public final class EMInstanceStack implements IEMStack {
}
}
- public NBTTagCompound toNBT() {
+ public NBTTagCompound toNBT(EMDefinitionsRegistry registry) {
NBTTagCompound nbt = new NBTTagCompound();
- nbt.setTag("d", getDefinition().toNBT());
+ nbt.setTag("d", getDefinition().toNBT(registry));
nbt.setDouble("Q", getAmount());
- nbt.setLong("e", energy);
- nbt.setByte("c", color);
- nbt.setDouble("A", getAge());
nbt.setDouble("M", lifeTimeMult);
+ nbt.setDouble("A", getAge());
+ nbt.setLong("e", energy);
+ nbt.setInteger("c", color);
return nbt;
}
- public static EMInstanceStack fromNBT(NBTTagCompound nbt) {
+ public static EMInstanceStack fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) {
EMInstanceStack instance = new EMInstanceStack(
- EMDefinitionsRegistry.fromNBT(nbt.getCompoundTag("d")),
- nbt.getLong("q") + nbt.getDouble("Q"),
- nbt.getFloat("m") + nbt.getDouble("M"),
- nbt.getLong("a") + nbt.getDouble("A"),
+ registry.fromNBT(nbt.getCompoundTag("d")),
+ nbt.getDouble("Q"),
+ nbt.getDouble("M"),
+ nbt.getDouble("A"),
nbt.getLong("e"));
- instance.setColor(nbt.getByte("c"));
+ instance.setColor(nbt.getInteger("c"));
return instance;
}
@@ -587,7 +588,7 @@ public final class EMInstanceStack implements IEMStack {
@Override
public String toString() {
- return getDefinition().toString() + '\n' + getAmount() / AVOGADRO_CONSTANT + " mol\n" + getMass();
+ return getDefinition().toString() + ' ' + getAmount() /AVOGADRO_CONSTANT + " "+translateToLocal("tt.keyword.mol")+" " + getMass()+" eV/c^2";
}
public void setAmount(double amount) {
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
index 5672b31c04..e5cfab9752 100644
--- 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
@@ -1,37 +1,56 @@
package com.github.technus.tectech.mechanics.elementalMatter.core.stacks;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
import net.minecraft.nbt.NBTTagCompound;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_MINIMUM;
+
/**
* Created by danie_000 on 30.01.2017.
*/
-public interface IEMStack extends Comparable<IEMStack>,Cloneable {
+public interface IEMStack extends Comparable<IEMStack>, Cloneable {
+ static boolean isValidAmount(double amount) {
+ return amount >= EM_COUNT_MINIMUM;
+ }
+
+ static boolean isInvalidAmount(double amount) {
+ return amount < EM_COUNT_MINIMUM;
+ }
+ default boolean isValidAmount() {
+ return isValidAmount(getAmount());
+ }
+
+ default boolean isInvalidAmount() {
+ return isInvalidAmount(getAmount());
+ }
+
IEMDefinition getDefinition();
double getAmount();
- default double getCharge(){
- return getDefinition().getCharge()*getAmount();
+ default double getCharge() {
+ return getDefinition().getCharge() * getAmount();
}
- default double getMass(){
- return getDefinition().getMass()*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();
+ NBTTagCompound toNBT(EMDefinitionsRegistry registry);
@Override
- default int compareTo(IEMStack o){
+ default int compareTo(IEMStack o) {
return getDefinition().compareTo(o.getDefinition());
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java
new file mode 100644
index 0000000000..855be96797
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java
@@ -0,0 +1,56 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public class EMDequantizationInfo {
+ private final IEMStack definition;
+ private Object stack;
+
+ public EMDequantizationInfo(IEMStack definition) {
+ this.definition = definition;
+ }
+
+ public IEMStack getInput() {
+ return definition;
+ }
+
+ public FluidStack getFluid() {
+ return ((FluidStack) stack).copy();
+ }
+
+ public void setFluid(FluidStack fluid) {
+ this.stack = fluid;
+ }
+
+ public ItemStack getItem() {
+ return ((ItemStack) stack).copy();
+ }
+
+ public void setItem(ItemStack item) {
+ this.stack = item;
+ }
+
+ public OreDictionaryStack getOre() {
+ return (OreDictionaryStack) stack;
+ }
+
+ public void setOre(OreDictionaryStack ore) {
+ this.stack = ore;
+ }
+
+ public Object getStack() {
+ return stack;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return o instanceof EMDequantizationInfo && definition.equals(((EMDequantizationInfo) o).definition);
+ }
+
+ @Override
+ public int hashCode() {
+ return definition.hashCode();
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java
deleted file mode 100644
index d74c36170e..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-
-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 EMFluidDequantizationInfo implements IEMExchangeInfo<IEMStack,FluidStack> {
- private final IEMStack in;
- private final FluidStack out;
-
- public EMFluidDequantizationInfo(IEMStack emIn, FluidStack fluidStackOut){
- in=emIn;
- out=fluidStackOut;
- }
-
- public EMFluidDequantizationInfo(IEMStack emIn, Fluid fluid, int fluidAmount){
- in=emIn;
- out=new FluidStack(fluid,fluidAmount);
- }
-
- @Override
- public IEMStack input() {
- return in.clone();//MEH!
- }
-
- @Override
- public FluidStack output() {
- return out.copy();
- }
-
- @Override
- public int hashCode() {
- return in.getDefinition().hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- return obj instanceof EMFluidDequantizationInfo && hashCode() == obj.hashCode();
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java
index 43fb5550aa..cf0cc6218c 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java
@@ -7,7 +7,7 @@ import net.minecraftforge.fluids.FluidStack;
/**
* Created by Tec on 23.05.2017.
*/
-public class EMFluidQuantizationInfo implements IEMExchangeInfo<FluidStack, IEMStack> {
+public class EMFluidQuantizationInfo {
private final FluidStack in;
private final IEMStack out;
@@ -21,12 +21,10 @@ public class EMFluidQuantizationInfo implements IEMExchangeInfo<FluidStack, IEMS
out=emOut;
}
- @Override
public FluidStack input() {
return in.copy();
}
- @Override
public IEMStack output() {
return out.clone();
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java
deleted file mode 100644
index af741c703d..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java
+++ /dev/null
@@ -1,45 +0,0 @@
-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;
-import gregtech.api.util.GT_OreDictUnificator;
-import net.minecraft.item.ItemStack;
-
-/**
- * Created by Tec on 23.05.2017.
- */
-public class EMItemDequantizationInfo implements IEMExchangeInfo<IEMStack,ItemStack> {
- private final IEMStack in;
- private final ItemStack out;
-
- public EMItemDequantizationInfo(IEMStack emIn, ItemStack itemStackOut){
- in=emIn;
- out=itemStackOut;
- }
-
- public EMItemDequantizationInfo(IEMStack emIn, OrePrefixes prefix, Materials material, int amount) {
- in = emIn;
- out = GT_OreDictUnificator.get(prefix, material, amount);
- }
-
- @Override
- public IEMStack input() {
- return in.clone();
- }
-
- @Override
- public ItemStack output() {
- return out.copy();
- }
-
- @Override
- public int hashCode() {
- return in.getDefinition().hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- return obj instanceof EMItemDequantizationInfo && hashCode() == obj.hashCode();
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java
index 553e806d38..c5db63b3ad 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java
@@ -11,7 +11,7 @@ import net.minecraftforge.oredict.OreDictionary;
/**
* Created by Tec on 23.05.2017.
*/
-public class EMItemQuantizationInfo implements IEMExchangeInfo<ItemStack, IEMStack> {
+public class EMItemQuantizationInfo {
private final ItemStack in;
private final boolean skipNBT;
private final IEMStack out;
@@ -28,12 +28,10 @@ public class EMItemQuantizationInfo implements IEMExchangeInfo<ItemStack, IEMSta
this.skipNBT = skipNBT;
}
- @Override
public ItemStack input() {
return in.copy();
}
- @Override
public IEMStack output() {
return out.clone();
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java
deleted file mode 100644
index c8e337c7fd..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java
+++ /dev/null
@@ -1,60 +0,0 @@
-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 EMOredictDequantizationInfo implements IEMExchangeInfo<IEMStack,String> {
- private final IEMStack in;
- private final String out;
- private final int amount;
-
- public EMOredictDequantizationInfo(IEMStack emIn, String name, int qty) {
- in = emIn;
- out =name;
- amount = qty;
- }
-
- public EMOredictDequantizationInfo(IEMStack emIn, OrePrefixes prefix, Materials material, int qty) {
- in = emIn;
- out = prefix.name() + material.mName;
- amount = qty;
- }
-
- public EMOredictDequantizationInfo(IEMStack emIn, OrePrefixes prefix, String materialName, int qty) {
- in = emIn;
- out = prefix.name() + materialName;
- amount = qty;
- }
-
- @Override
- public IEMStack input() {
- return in.clone();//MEH!
- }
-
- @Override
- public String output() {
- return getOut();
- }
-
- @Override
- public int hashCode() {
- return in.getDefinition().hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- 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
index 0ca0415b0d..3c54dd86ac 100644
--- 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
@@ -3,46 +3,41 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformation
import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
+import net.minecraftforge.oredict.OreDictionary;
/**
* Created by Tec on 23.05.2017.
*/
-public class EMOredictQuantizationInfo implements IEMExchangeInfo<String, IEMStack> {
- private final String in;
+public class EMOredictQuantizationInfo {
+ private final int id;
private final int amount;
private final IEMStack out;
- public EMOredictQuantizationInfo(String name, int qty, IEMStack emOut){
- in=name;
- amount=qty;
- out=emOut;
+ public EMOredictQuantizationInfo(int id, int amount, IEMStack out) {
+ this.id = id;
+ this.amount = amount;
+ this.out = out;
}
- public EMOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, IEMStack emOut){
- in=prefix.name() + material.mName;
- amount=qty;
- out=emOut;
+ public EMOredictQuantizationInfo(String name, int qty, IEMStack emOut) {
+ this(OreDictionary.getOreID(name),qty,emOut);
}
- public EMOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, IEMStack emOut){
- in=prefix.name() + materialName;
- amount=qty;
- out=emOut;
+ public EMOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, IEMStack emOut) {
+ this(prefix, material.mName, qty,emOut);
}
- @Override
- public String input() {
- return getIn();
+ public EMOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, IEMStack emOut) {
+ this(OreDictionary.getOreID(prefix.name() + materialName),qty,emOut);
}
- @Override
- public IEMStack output() {
- return out.clone();
+ public IEMStack getOut() {
+ return out;
}
@Override
public int hashCode() {
- return getIn().hashCode();
+ return getId();
}
@Override
@@ -50,8 +45,8 @@ public class EMOredictQuantizationInfo implements IEMExchangeInfo<String, IEMSta
return obj instanceof EMOredictQuantizationInfo && hashCode() == obj.hashCode();
}
- public String getIn() {
- return in;
+ public int getId() {
+ return id;
}
public int getAmount() {
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
deleted file mode 100644
index d6f6731aec..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry;
-import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
-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 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));
- EMDefinitionsRegistry.registerForDisplay(em.getDefinition());
- }
-
- 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));
- EMDefinitionsRegistry.registerForDisplay(em.getDefinition());
- }
-
- 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));
- EMDefinitionsRegistry.registerForDisplay(em.getDefinition());
- }
-
- 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));
- EMDefinitionsRegistry.registerForDisplay(em.getDefinition());
- }
-
- 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));
- EMDefinitionsRegistry.registerForDisplay(em.getDefinition());
- }
-
- 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));
- EMDefinitionsRegistry.registerForDisplay(em.getDefinition());
- }
-
- 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));
- EMDefinitionsRegistry.registerForDisplay(em.getDefinition());
- }
-
- 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/EMTransformationRegistry.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java
new file mode 100644
index 0000000000..5e41beb9fd
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java
@@ -0,0 +1,134 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
+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;
+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 java.util.function.Function;
+
+import static java.lang.Math.pow;
+
+/**
+ * Created by Tec on 26.05.2017.
+ */
+public class EMTransformationRegistry {
+ /**
+ * Atom count per Mol
+ */
+ public static final double AVOGADRO_CONSTANT = 6.02214076e23D;
+ /**
+ * Scale to 1m^3 of C-12
+ */
+ public static final double EM_COUNT_PER_CUBE = AVOGADRO_CONSTANT * 1650_000D / 0.012;
+ public static final double EM_COUNT_PER_MATERIAL_AMOUNT = EM_COUNT_PER_CUBE / 144 / 9;
+ public static final double EM_COUNT_PER_ITEM = EM_COUNT_PER_CUBE * 9;
+ public static final double EM_COUNT_PER_1k = EM_COUNT_PER_MATERIAL_AMOUNT * 1000;
+
+ public static final double EM_COUNT_MINIMUM = 1 / EM_COUNT_PER_CUBE;
+ /**
+ * Quantity considered to be indifferent when computing stuff
+ */
+ public static final double EM_COUNT_EPSILON = EM_COUNT_PER_CUBE / pow(2, 40);
+
+ public static final double EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT - EM_COUNT_EPSILON;
+ public static final double EM_COUNT_PER_CUBE_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * 144 * 9;
+ public static final double EM_COUNT_PER_ITEM_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * 144;
+ public static final double EM_COUNT_PER_1k_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * 1000;
+
+ private final Map<Integer, EMFluidQuantizationInfo> fluidQuantization;
+ private final Map<EMItemQuantizationInfo, EMItemQuantizationInfo> itemQuantization;
+ private final Map<Integer, EMOredictQuantizationInfo> oredictQuantization;
+
+ private final Map<IEMDefinition, EMDequantizationInfo> infoMap;
+ private final Function<IEMStack, EMDequantizationInfo> creator;
+
+ public EMTransformationRegistry() {
+ this(EMDequantizationInfo::new);
+ }
+
+ public EMTransformationRegistry(Function<IEMStack, EMDequantizationInfo> creator) {
+ this(creator,
+ new HashMap<>(16), new HashMap<>(16), new HashMap<>(64),
+ new HashMap<>(256)
+ );
+ }
+
+ public EMTransformationRegistry(Function<IEMStack, EMDequantizationInfo> creator,
+ Map<Integer, EMFluidQuantizationInfo> fluidQuantization,
+ Map<EMItemQuantizationInfo, EMItemQuantizationInfo> itemQuantization,
+ Map<Integer, EMOredictQuantizationInfo> oredictQuantization,
+ Map<IEMDefinition, EMDequantizationInfo> infoMap) {
+ this.creator = creator;
+ this.fluidQuantization = fluidQuantization;
+ this.itemQuantization = itemQuantization;
+ this.oredictQuantization = oredictQuantization;
+ this.infoMap = infoMap;
+ }
+
+ protected EMDequantizationInfo compute(IEMStack em) {
+ return infoMap.computeIfAbsent(em.getDefinition(), stack -> creator.apply(em));
+ }
+
+ public void addFluid(IEMStack em, FluidStack fluidStack) {
+ getFluidQuantization().put(fluidStack.getFluidID(), new EMFluidQuantizationInfo(fluidStack, em));
+ compute(em).setFluid(fluidStack);
+ }
+
+ public void addFluid(IEMStack em, Fluid fluid, int fluidAmount) {
+ addFluid(em, new FluidStack(fluid, fluidAmount));
+ }
+
+ protected void addItemQuantization(EMItemQuantizationInfo aIQI) {
+ getItemQuantization().put(aIQI, aIQI);
+ }
+
+ public void addItem(IEMStack em, ItemStack itemStack, boolean skipNBT) {
+ addItemQuantization(new EMItemQuantizationInfo(itemStack, skipNBT, em));
+ compute(em).setItem(itemStack);
+ }
+
+ public void addItem(IEMStack em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT) {
+ addItem(em, GT_OreDictUnificator.get(prefix, material, amount), skipNBT);
+ }
+
+ public void addOredict(IEMStack em, int id, int qty) {
+ getOredictQuantization().put(id, new EMOredictQuantizationInfo(id, qty, em));
+ compute(em).setOre(new OreDictionaryStack(qty, id));
+ }
+
+ public void addOredict(IEMStack em, String name, int qty) {
+ addOredict(em, OreDictionary.getOreID(name), qty);
+ }
+
+ public void addOredict(IEMStack em, OrePrefixes prefix, Materials material, int qty) {
+ addOredict(em, prefix, material.mName, qty);
+ }
+
+ public void addOredict(IEMStack em, OrePrefixes prefix, String materialName, int qty) {
+ addOredict(em, OreDictionary.getOreID(prefix.name() + materialName), qty);
+ }
+
+ public Map<Integer, EMFluidQuantizationInfo> getFluidQuantization() {
+ return fluidQuantization;
+ }
+
+ public Map<EMItemQuantizationInfo, EMItemQuantizationInfo> getItemQuantization() {
+ return itemQuantization;
+ }
+
+ public Map<Integer, EMOredictQuantizationInfo> getOredictQuantization() {
+ return oredictQuantization;
+ }
+
+ public Map<IEMDefinition, EMDequantizationInfo> getInfoMap() {
+ return infoMap;
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java
deleted file mode 100644
index e20b0af3b5..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
-
-/**
- * Created by Tec on 23.05.2017.
- */
-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)
-
- IN input();//same as above but for input
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java
new file mode 100644
index 0000000000..f5d8d42061
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java
@@ -0,0 +1,19 @@
+package com.github.technus.tectech.mechanics.elementalMatter.core.transformations;
+
+public class OreDictionaryStack {
+ private final int amount;
+ private final int id;
+
+ public OreDictionaryStack(int amount, int id) {
+ this.amount = amount;
+ this.id = id;
+ }
+
+ public int getAmount() {
+ return amount;
+ }
+
+ public int getOreId() {
+ return id;
+ }
+}
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
index 37ecb861f8..76f4457e94 100644
--- 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
@@ -1,69 +1,65 @@
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.EMException;
import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate;
-import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
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.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.core.transformations.EMTransformationRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition;
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.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.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.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.Materials.*;
import static gregtech.api.enums.OrePrefixes.dust;
import static net.minecraft.util.StatCollector.translateToLocal;
/**
* Created by danie_000 on 18.11.2016.
*/
-public final class EMAtomDefinition extends EMComplexTemplate {
- public static final long ATOM_COMPLEXITY_LIMIT=65536L;
- private static final byte BYTE_OFFSET=32;
+public class EMAtomDefinition extends EMComplexTemplate {
+ public static final long ATOM_COMPLEXITY_LIMIT = 65536L;
+ private static final byte BYTE_OFFSET = 32;
- private final int hash;
+ private final int hash;
public static double refMass, refUnstableMass;
- private static final byte nbtType = (byte) 'a';
+ private static final String nbtType = "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 static EMDefinitionStack alpha, deuterium, tritium, helium_3, beryllium_8, carbon_14, neon_24, silicon_34, uranium_238, uranium_235, plutonium_239, plutonium_241;
+ 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);
+
+ public static void addOverride(EMAtomDefinition atom, double rawLifeTime) {
+ lifetimeOverrides.put(atom, rawLifeTime);
}
//float-mass in eV/c^2
@@ -106,23 +102,23 @@ public final class EMAtomDefinition extends EMComplexTemplate {
}
elementalStacks = things;
- double mass = 0;
- int cLeptons = 0;
- int cNucleus = 0;
- int neutralCount = 0, element = 0;
- int type = 0;
+ 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()){
+ if ((int) stack.getAmount() != stack.getAmount()) {
throw new ArithmeticException("Amount cannot be safely converted to int!");
}
mass += stack.getMass();
- if (def.getMatterType() < 0) {
+ if (def.getGeneration() < 0) {
containsAnti = true;
}
- type = Math.max(type, Math.abs(def.getMatterType()));
+ type = Math.max(type, Math.abs(def.getGeneration()));
if (def instanceof EMLeptonDefinition) {
cLeptons += stack.getCharge();
@@ -148,57 +144,57 @@ public final class EMAtomDefinition extends EMComplexTemplate {
//stability curve
int StableIsotope = stableIzoCurve(element);
- int izoDiff = neutralCount - StableIsotope;
- int izoDiffAbs = Math.abs(izoDiff);
+ 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())) {
+ 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);
+ if (Double.isNaN(getIaea().getHalfTime())) {
+ Double overriddenLifeTime = lifetimeOverrides.get(this);
double rawLifeTimeTemp;
- if(overriddenLifeTime!=null) {
+ if (overriddenLifeTime != null) {
rawLifeTimeTemp = overriddenLifeTime;
} else {
rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti);
}
rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME);
- }else {
+ } else {
rawLifeTime = containsAnti ? getIaea().getHalfTime() * 1.5514433E-21d * (1d + xstr.nextDouble() * 9d) : getIaea().getHalfTime();
}
- iaeaDefinitionExistsAndHasEnergyLevels = getIaea().getEnergeticStatesArray().length>1;
- }else{
- this.mass=mass;
+ iaeaDefinitionExistsAndHasEnergyLevels = getIaea().getEnergeticStatesArray().length > 1;
+ } else {
+ this.mass = mass;
- Double overriddenLifeTime= lifetimeOverrides.get(this);
+ Double overriddenLifeTime = lifetimeOverrides.get(this);
double rawLifeTimeTemp;
- if(overriddenLifeTime!=null) {
+ if (overriddenLifeTime != null) {
rawLifeTimeTemp = overriddenLifeTime;
} else {
rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti);
}
rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME);
- iaeaDefinitionExistsAndHasEnergyLevels =false;
+ iaeaDefinitionExistsAndHasEnergyLevels = false;
}
- if(getIaea() ==null || getIaea().getEnergeticStatesArray()[0].energy!=0) {
+ 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);
+ } 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();
+ hash = super.hashCode();
}
private static int stableIzoCurve(int element) {
@@ -267,7 +263,7 @@ public final class EMAtomDefinition extends EMComplexTemplate {
private static boolean canTheyBeTogether(EMConstantStackMap stacks) {
boolean nuclei = false;
- long qty=0;
+ long qty = 0;
for (EMDefinitionStack stack : stacks.valuesToArray()) {
if (stack.getDefinition() instanceof EMHadronDefinition) {
if (((EMHadronDefinition) stack.getDefinition()).getAmount() != 3) {
@@ -277,12 +273,12 @@ public final class EMAtomDefinition extends EMComplexTemplate {
} else if (!(stack.getDefinition() instanceof EMLeptonDefinition)) {
return false;
}
- if((int) stack.getAmount() != stack.getAmount()){
+ if ((int) stack.getAmount() != stack.getAmount()) {
throw new ArithmeticException("Amount cannot be safely converted to int!");
}
- qty+= stack.getAmount();
+ qty += stack.getAmount();
}
- return nuclei && qty<ATOM_COMPLEXITY_LIMIT;
+ return nuclei && qty < ATOM_COMPLEXITY_LIMIT;
}
@Override
@@ -308,22 +304,22 @@ public final class EMAtomDefinition extends EMComplexTemplate {
}
@Override
- public byte getMatterType() {
+ public int getGeneration() {
return type;
}
@Override
public double getRawTimeSpan(long currentEnergy) {
- if(currentEnergy<=0) {
+ 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);
+ 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 getIaea().getEnergeticStatesArray()[(int) currentEnergy].Thalf;
}
- return rawLifeTime/(currentEnergy+1);
+ return rawLifeTime / (currentEnergy + 1);
}
@Override
@@ -332,16 +328,16 @@ public final class EMAtomDefinition extends EMComplexTemplate {
}
@Override
- public byte getColor() {
+ public int getMaxColors() {
return -10;
}
@Override
public String getLocalizedName() {
- int element = Math.abs(this.getElement());
+ int element = Math.abs(this.getElement());
boolean negative = this.getElement() < 0;
try {
- if (Math.abs(getMatterType()) != 1) {
+ if (Math.abs(getGeneration()) != 1) {
return (negative ? "~? " : "? ") + Nomenclature.NAME[element];
}
return negative ? '~' + Nomenclature.NAME[element] : Nomenclature.NAME[element];
@@ -349,35 +345,35 @@ public final class EMAtomDefinition extends EMComplexTemplate {
if (DEBUG_MODE) {
e.printStackTrace();
}
- return translateToLocal("tt.keyword.Element")+(negative ? ": ~" : ": ") + element;
+ return translateToLocal("tt.keyword.Element") + (negative ? ": ~" : ": ") + element;
}
}
@Override
public String getSymbol() {
- int element = Math.abs(this.getElement());
+ int element = Math.abs(this.getElement());
boolean negative = this.getElement() < 0;
try {
- return (negative ? "~" : "") + Nomenclature.SYMBOL[element] + " N:" + getNeutralCount() + " I:" + (getNeutralCount() +element) + " C:" + getCharge();
+ 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();
+ 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();
+ return (negative ? "~" : "") + "? N:" + getNeutralCount() + " I:" + (getNeutralCount() + element) + " C:" + getCharge();
}
}
}
@Override
public String getShortSymbol() {
- int element = Math.abs(this.getElement());
+ int element = Math.abs(this.getElement());
boolean negative = this.getElement() < 0;
try {
return (negative ? "~" : "") + Nomenclature.SYMBOL[element];
@@ -404,69 +400,69 @@ public final class EMAtomDefinition extends EMComplexTemplate {
@Override
public EMDecay[] getDecayArray() {
- ArrayList<EMDecay> decaysList =new ArrayList<>(4);
- return getDecayArray(decaysList, getDecayMode(),true);
+ ArrayList<EMDecay> decaysList = new ArrayList<>(4);
+ return getDecayArray(decaysList, getDecayMode(), true);
}
private EMDecay[] getDecayArray(ArrayList<EMDecay> decaysList, int decayMode, boolean tryAnti) {//todo?
- if (getMatterType() == 1) {
+ if (getGeneration() == 1) {
switch (decayMode) {
case -2:
- if(TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) {
+ if (TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) {
return decaysList.toArray(EMDecay.NO_PRODUCT);
- } else if(PbetaDecay(decaysList)) {
+ } else if (PbetaDecay(decaysList)) {
return decaysList.toArray(EMDecay.NO_PRODUCT);
}
break;
case -1:
- if(Emmision(decaysList, EMHadronDefinition.hadron_p1)) {
+ if (Emmision(decaysList, EMHadronDefinition.hadron_p1)) {
return decaysList.toArray(EMDecay.NO_PRODUCT);
}
break;
case 0:
- if(alphaDecay(decaysList)) {
+ if (alphaDecay(decaysList)) {
return decaysList.toArray(EMDecay.NO_PRODUCT);
}
break;
case 1:
- if(Emmision(decaysList, EMHadronDefinition.hadron_n1)) {
+ if (Emmision(decaysList, EMHadronDefinition.hadron_n1)) {
return decaysList.toArray(EMDecay.NO_PRODUCT);
}
break;
case 2:
- if(MbetaDecay(decaysList)) {
+ if (MbetaDecay(decaysList)) {
return decaysList.toArray(EMDecay.NO_PRODUCT);
}
break;
default:
- if(decayMode>8){
- if(iaeaDecay(decaysList,0)) {
+ if (decayMode > 8) {
+ if (iaeaDecay(decaysList, 0)) {
return decaysList.toArray(EMDecay.NO_PRODUCT);
}
- return getDecayArray(decaysList,decayMode- BYTE_OFFSET,false);
+ return getDecayArray(decaysList, decayMode - BYTE_OFFSET, false);
}
}
return EMDecay.NO_DECAY;
- }else if(getMatterType() ==-1){
- EMAtomDefinition anti =getAnti();
- if(anti!=null) {
+ } else if (getGeneration() == -1) {
+ EMAtomDefinition anti = getAnti();
+ if (anti != null) {
return anti.getDecayArray(decaysList, decayMode, false);
}
}
return getNaturalDecayInstant();
}
- private boolean iaeaDecay(ArrayList<EMDecay> decaysList, long energy){
+ private boolean iaeaDecay(ArrayList<EMDecay> decaysList, long energy) {
EMNuclideIAEA.energeticState state;
- if(energy> getIaea().getEnergeticStatesArray().length) {
+ if (energy > getIaea().getEnergeticStatesArray().length) {
state = getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1];
- } else if(energy<=0) {
+ } 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)) {
+ for (int i = 0; i < state.decaymodes.length; i++) {
+ if (!getDecayFromIaea(decaysList, state.decaymodes[i], energy)) {
decaysList.clear();
return false;
}
@@ -474,511 +470,553 @@ public final class EMAtomDefinition extends EMComplexTemplate {
return !decaysList.isEmpty();
}
- private boolean getDecayFromIaea(ArrayList<EMDecay> decaysList, EMNuclideIAEA.iaeaDecay decay, long energy){
- EMDefinitionStackMap withThis =elementalStacks.toMutable(), newStuff =new EMDefinitionStackMap();
- switch (decay.decayName){
+ 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())){
+ if (withThis.removeAllAmountsExact(deuterium.getDefinition().getSubParticles())) {
withThis.putReplace(deuterium);
- decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
}
- } break;
+ }
+ break;
case "3H": {
- if (withThis.removeAllAmountsExact(tritium.getDefinition().getSubParticles())){
+ if (withThis.removeAllAmountsExact(tritium.getDefinition().getSubParticles())) {
withThis.putReplace(tritium);
- decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
}
- } break;
+ }
+ break;
case "3HE": {
- if (withThis.removeAllAmountsExact(helium_3.getDefinition().getSubParticles())){
+ if (withThis.removeAllAmountsExact(helium_3.getDefinition().getSubParticles())) {
withThis.putReplace(helium_3);
- decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
}
- } break;
+ }
+ break;
case "8BE": {
- if (withThis.removeAllAmountsExact(beryllium_8.getDefinition().getSubParticles())){
+ if (withThis.removeAllAmountsExact(beryllium_8.getDefinition().getSubParticles())) {
withThis.putReplace(beryllium_8);
- decaysList.add(new EMDecay(decay.chance,withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
}
- } break;
+ }
+ break;
case "14C": {
- if (withThis.removeAllAmountsExact(carbon_14.getDefinition().getSubParticles())){
+ if (withThis.removeAllAmountsExact(carbon_14.getDefinition().getSubParticles())) {
newStuff.putReplace(carbon_14);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "24NE": {
- if (withThis.removeAllAmountsExact(neon_24.getDefinition().getSubParticles())){
+ if (withThis.removeAllAmountsExact(neon_24.getDefinition().getSubParticles())) {
newStuff.putReplace(neon_24);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "34SI": {
- if (withThis.removeAllAmountsExact(silicon_34.getDefinition().getSubParticles())){
+ if (withThis.removeAllAmountsExact(silicon_34.getDefinition().getSubParticles())) {
newStuff.putReplace(silicon_34);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
- case "A": case "A?": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2, EMHadronDefinition.hadron_p2)){
+ }
+ break;
+ case "A":
+ case "A?": {
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2, EMHadronDefinition.hadron_p2)) {
newStuff.putReplace(alpha);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "B+": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)){
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)) {
withThis.putUnifyExact(EMHadronDefinition.hadron_n1);
newStuff.putReplace(EMLeptonDefinition.lepton_e_1);
newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "2B+": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)) {
withThis.putUnifyExact(EMHadronDefinition.hadron_n2);
newStuff.putReplace(EMLeptonDefinition.lepton_e_2);
newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "B-": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) {
withThis.putUnifyExact(EMHadronDefinition.hadron_p1);
newStuff.putReplace(EMLeptonDefinition.lepton_e1);
newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "2B-": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)) {
withThis.putUnifyExact(EMHadronDefinition.hadron_p2);
newStuff.putReplace(EMLeptonDefinition.lepton_e2);
newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_2);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "EC": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)){
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)) {
withThis.putUnifyExact(EMHadronDefinition.hadron_n1);
newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "2EC": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e2)){
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e2)) {
withThis.putUnifyExact(EMHadronDefinition.hadron_n2);
newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
- case "B++EC": case "EC+B+": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){
+ }
+ 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{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "B+A": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3, EMHadronDefinition.hadron_n1)){
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3, EMHadronDefinition.hadron_n1)) {
newStuff.putReplace(EMLeptonDefinition.lepton_e_1);
newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1);
newStuff.putReplace(alpha);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "B+P": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){
+ 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{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "B+2P": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3)){
+ 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{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "B-A": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3, EMHadronDefinition.hadron_p1)){
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3, EMHadronDefinition.hadron_p1)) {
newStuff.putReplace(EMLeptonDefinition.lepton_e1);
newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1);
newStuff.putReplace(alpha);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "B-N": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){
+ 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{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "B-2N": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3)){
+ 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{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "B-P": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) {
newStuff.putReplace(EMLeptonDefinition.lepton_e1);
newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1);
newStuff.putReplace(EMHadronDefinition.hadron_p1);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "ECA": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1, EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)){
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1, EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)) {
newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1);
newStuff.putReplace(alpha);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "ECP": {
- if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p2)){
+ 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{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "EC2P": {
- if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)){
+ 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{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "ECP+EC2P": {//todo look at branching ratios
- if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e2, EMHadronDefinition.hadron_p5)){
+ 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{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "N": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) {
newStuff.putReplace(EMHadronDefinition.hadron_n1);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "2N": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)){
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)) {
newStuff.putReplace(EMHadronDefinition.hadron_n2);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "P": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)){
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)) {
newStuff.putReplace(EMHadronDefinition.hadron_p1);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "2P": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)){
+ if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)) {
newStuff.putReplace(EMHadronDefinition.hadron_p2);
- try{
+ try {
newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1));
- decaysList.add(new EMDecay(decay.chance,newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "SF": {
if (Fission(decaysList, withThis, newStuff, decay.chance, false)) {
return true;
}
- } break;
+ }
+ break;
case "B-F": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)){
+ 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)) {
+ try {
+ if (Fission(decaysList, withThis, newStuff, decay.chance, false)) {
return true;
}
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } 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)){
+ }
+ 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)) {
+ try {
+ if (Fission(decaysList, withThis, newStuff, decay.chance, false)) {
return true;
}
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } 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)){
+ }
+ 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)) {
+ try {
+ if (Fission(decaysList, withThis, newStuff, decay.chance, false)) {
return true;
}
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "SF+EC+B-": {
- if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1)){
+ 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)) {
+ try {
+ if (Fission(decaysList, withThis, newStuff, decay.chance, false)) {
return true;
}
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
- case "IT": case "IT?": case "G": {
- if(energy>0){
+ }
+ break;
+ case "IT":
+ case "IT?":
+ case "G": {
+ if (energy > 0) {
decaysList.add(new EMDecay(decay.chance, this, boson_Y__));
- }else{
- if(DEBUG_MODE) {
+ } else {
+ if (DEBUG_MODE) {
TecTech.LOGGER.info("Tried to emit Gamma from ground state");
}
decaysList.add(new EMDecay(decay.chance, this));
@@ -986,28 +1024,30 @@ public final class EMAtomDefinition extends EMComplexTemplate {
return true;
} //break;
case "IT+EC+B+": {
- if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)){
+ 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(EMGaugeBosonDefinition.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()));
+ decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree()));
return true;
- }catch (Exception e){
- if(DEBUG_MODE) {
+ } catch (Exception e) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
}
- } break;
+ }
+ break;
case "DEAD_END":
decaysList.add(deadEnd);
return true;
- default: throw new Error("Unsupported decay mode: " + decay.decayName + ' ' + getNeutralCount() + ' ' + getElement());
+ default:
+ throw new Error("Unsupported decay mode: " + decay.decayName + ' ' + getNeutralCount() + ' ' + getElement());
}
- if(DEBUG_MODE) {
+ if (DEBUG_MODE) {
TecTech.LOGGER.info("Failed to decay " + getElement() + ' ' + getNeutralCount() + ' ' + decay.decayName);
}
return false;
@@ -1093,48 +1133,48 @@ public final class EMAtomDefinition extends EMComplexTemplate {
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);
+ 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)) {
+ 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.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));
+ 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) {
+ } 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);
+ 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));
+ 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) {
+ if (DEBUG_MODE) {
e.printStackTrace();
}
}
@@ -1181,51 +1221,51 @@ public final class EMAtomDefinition extends EMComplexTemplate {
@Override
public EMDecay[] getEnergyInducedDecay(long energyLevel) {
if (iaeaDefinitionExistsAndHasEnergyLevels) {
- ArrayList<EMDecay> decays =new ArrayList<>(4);
- if(iaeaDecay(decays,energyLevel)){
+ ArrayList<EMDecay> decays = new ArrayList<>(4);
+ if (iaeaDecay(decays, energyLevel)) {
return decays.toArray(EMDecay.NO_PRODUCT);
}
}
- if(energyLevel< Math.abs(getCharge())/3+ getNeutralCount()) {
+ 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) {
+ 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 {
+ } else {
result -= getIaea().getEnergeticStatesArray()[(int) Math.min(getIaea().getEnergeticStatesArray().length - 1, currentEnergyLevel)].energy;
}
- if(newEnergyLevel>= getIaea().getEnergeticStatesArray().length){
- if(currentEnergyLevel>= getIaea().getEnergeticStatesArray().length) {
+ 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()[getIaea().getEnergeticStatesArray().length - 1].energy;
+ } else {
result += getIaea().getEnergeticStatesArray()[(int) newEnergyLevel].energy;
}
- return backwards?-result:result;
+ return backwards ? -result : result;
}
- return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel);
+ return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel);
}
@Override
@@ -1235,17 +1275,17 @@ public final class EMAtomDefinition extends EMComplexTemplate {
@Override
public boolean usesMultipleDecayCalls(long energyLevel) {
- if(!iaeaDefinitionExistsAndHasEnergyLevels) return false;
+ if (!iaeaDefinitionExistsAndHasEnergyLevels) return false;
EMNuclideIAEA.energeticState state;
- if(energyLevel> getIaea().getEnergeticStatesArray().length) {
+ if (energyLevel > getIaea().getEnergeticStatesArray().length) {
state = getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1];
- } else if(energyLevel<=0) {
+ } 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
+ for (EMNuclideIAEA.iaeaDecay decay : state.decaymodes) {
+ if (decay.decayName.contains("F")) return true;//if is fissile
}
return false;
}
@@ -1257,7 +1297,7 @@ public final class EMAtomDefinition extends EMComplexTemplate {
@Override
public boolean fusionMakesEnergy(long energyLevel) {
- return getIaea() !=null || iaeaDefinitionExistsAndHasEnergyLevels;
+ return getIaea() != null || iaeaDefinitionExistsAndHasEnergyLevels;
}
@Override
@@ -1265,7 +1305,7 @@ public final class EMAtomDefinition extends EMComplexTemplate {
//disembody
ArrayList<EMDefinitionStack> decaysInto = new ArrayList<>();
for (EMDefinitionStack elementalStack : elementalStacks.valuesToArray()) {
- if (elementalStack.getDefinition().getMatterType() == 1 || elementalStack.getDefinition().getMatterType() == -1) {
+ if (elementalStack.getDefinition().getGeneration() == 1 || elementalStack.getDefinition().getGeneration() == -1) {
//covers both quarks and antiquarks
decaysInto.add(elementalStack);
} else {
@@ -1278,10 +1318,10 @@ public final class EMAtomDefinition extends EMComplexTemplate {
//@Override
//public iElementalDefinition getAnti() {
- // cElementalDefinitionStack[] stacks = this.elementalStacks.values();
- // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length];
+ // EMDefinitionStack[] stacks = this.elementalStacks.values();
+ // EMDefinitionStack[] antiElements = new EMDefinitionStack[stacks.length];
// for (int i = 0; i < antiElements.length; i++) {
- // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount);
+ // antiElements[i] = new EMDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount);
// }
// try {
// return new dAtomDefinition(false, antiElements);
@@ -1307,21 +1347,6 @@ public final class EMAtomDefinition extends EMComplexTemplate {
}
}
- @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;
}
@@ -1339,55 +1364,43 @@ public final class EMAtomDefinition extends EMComplexTemplate {
}
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 = 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
- protected int getIndirectTagValue() {
+ protected String getIndirectTagValue() {
return nbtType;
}
- 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(EMDefinitionsRegistry registry) {
+ registry.registerDefinitionClass(nbtType, new EMIndirectType((definitionsRegistry, nbt) ->
+ new EMAtomDefinition(EMConstantStackMap.fromNBT(definitionsRegistry, nbt)), EMAtomDefinition.class, "tt.keyword.Element"));
+ EMNuclideIAEA.run();
- public static void run() {
for (Runnable r : overrides) {
r.run();
}
- for(Map.Entry<EMAtomDefinition,Double> entry:lifetimeOverrides.entrySet()){
+ for (Map.Entry<EMAtomDefinition, Double> entry : lifetimeOverrides.entrySet()) {
try {
lifetimeOverrides.put(new EMAtomDefinition(entry.getKey().elementalStacks), entry.getValue());
- }catch (EMException e){
+ } catch (EMException e) {
e.printStackTrace(); //Impossible
}
}
//populate stable isotopes
- for (int element = 1; element < 83; element++)//Up to Bismuth exclusive
- {
+ 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);
+ 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);
@@ -1396,16 +1409,16 @@ public final class EMAtomDefinition extends EMComplexTemplate {
}
//populate unstable isotopes
- for (int element = 83; element < 150; element++) {
+ for (int element = 1; 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);
+ 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);//todo dont add stable ones
}
}
@@ -1428,213 +1441,221 @@ public final class EMAtomDefinition extends EMComplexTemplate {
TecTech.LOGGER.info("Added Unstable Atom:" + integerTreeMapEntry.getKey() + ' ' + integerTreeMapEntry.getValue().lastEntry().getValue() + ' ' + unstableAtoms.get(integerTreeMapEntry.getKey()).getMass());
}
}
- deuterium=new EMAtomDefinition(
+
+ deuterium = new EMAtomDefinition(
EMHadronDefinition.hadron_p1,
EMHadronDefinition.hadron_n1,
EMLeptonDefinition.lepton_e1).getStackForm(1);
- tritium=new EMAtomDefinition(
+ registry.registerForDisplay(deuterium.getDefinition());
+
+ tritium = new EMAtomDefinition(
EMHadronDefinition.hadron_p1,
EMHadronDefinition.hadron_n2,
EMLeptonDefinition.lepton_e1).getStackForm(1);
- helium_3=new EMAtomDefinition(
+ registry.registerForDisplay(tritium.getDefinition());
+
+ helium_3 = new EMAtomDefinition(
EMHadronDefinition.hadron_p2,
EMHadronDefinition.hadron_n1,
EMLeptonDefinition.lepton_e2).getStackForm(1);
+ registry.registerForDisplay(helium_3.getDefinition());
+
alpha = new EMAtomDefinition(
EMHadronDefinition.hadron_p2,
EMHadronDefinition.hadron_n2).getStackForm(1);
- beryllium_8=new EMAtomDefinition(
+ registry.registerForDisplay(alpha.getDefinition());
+
+ 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(
+ registry.registerForDisplay(beryllium_8.getDefinition());
+
+ 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(
+ registry.registerForDisplay(carbon_14.getDefinition());
+
+ 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(
+ registry.registerForDisplay(neon_24.getDefinition());
+
+ 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 {
- EMDefinitionsRegistry.registerDefinitionClass(nbtType, EMAtomDefinition::fromNBT,EMAtomDefinition.class,getClassTypeStatic());
- } catch (Exception e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- if(DEBUG_MODE) {
- TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + getClassTypeStatic());
- }
- }
-
- public static void setTransformations(){
- /*----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);
+ registry.registerForDisplay(silicon_34.getDefinition());
- EMTransformationInfo.TRANSFORMATION_INFO.addFluid(new EMDefinitionStack(helium_3.getDefinition(), AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144);
-
- temp=new EMAtomDefinition(
+ uranium_238 = 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();
+ new EMDefinitionStack(EMHadronDefinition.hadron_n, 146)).getStackForm(1);
+ registry.registerForDisplay(uranium_238.getDefinition());
- temp=new EMAtomDefinition(
+ uranium_235 = 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);
+ new EMDefinitionStack(EMHadronDefinition.hadron_n, 143)).getStackForm(1);
+ registry.registerForDisplay(uranium_235.getDefinition());
- TecTech.LOGGER.info("Diff Mass U : "+(tempMass-temp.getMass()));
+ TecTech.LOGGER.info("Diff Mass U : " + (uranium_238.getDefinition().getMass() - uranium_235.getDefinition().getMass()));
- temp=new EMAtomDefinition(
+ plutonium_239 = 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);
+ new EMDefinitionStack(EMHadronDefinition.hadron_n, 145)).getStackForm(1);
+ registry.registerForDisplay(plutonium_239.getDefinition());
- somethingHeavy=new EMAtomDefinition(
+ plutonium_241 = 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);
+ new EMDefinitionStack(EMHadronDefinition.hadron_n, 147)).getStackForm(1);
+ registry.registerForDisplay(plutonium_241.getDefinition());
- TecTech.LOGGER.info("Diff Mass Pu: "+(somethingHeavy.getMass()-temp.getMass()));
+ TecTech.LOGGER.info("Diff Mass Pu: " + (plutonium_241.getDefinition().getMass() - plutonium_239.getDefinition().getMass()));
- TecTech.LOGGER.info("Neutron Mass: "+ EMHadronDefinition.hadron_n.getMass());
+ somethingHeavy=(EMAtomDefinition) plutonium_241.getDefinition();
- } catch (EMException e) {
+ } catch (Exception e) {
if (DEBUG_MODE) {
e.printStackTrace();
}
}
- if(Loader.isModLoaded(Reference.GTPLUSPLUS)) {
- new GtppAtomLoader().run();
+ if (DEBUG_MODE) {
+ TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + getClassTypeStatic());
+ }
+
+ for (int i = 1; i <= 118; i++) {
+ EMAtomDefinition firstStableIsotope = getFirstStableIsotope(i);
+ if(firstStableIsotope==null){
+ firstStableIsotope = getBestUnstableIsotope(i);
+ if(firstStableIsotope==null){
+ continue;
+ }
+ }
+ registry.registerForDisplay(firstStableIsotope);
}
}
+ public static void setTransformations(EMTransformationRegistry transformationInfo) {
+ /*----STABLE ATOMS----**/
+ refMass = getFirstStableIsotope(1).getMass() * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED;
+
+ transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(1), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Hydrogen.mGas, 144);
+ transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(2), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Helium.mGas, 144);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(3), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Lithium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(4), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Beryllium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(5), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Boron, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(6), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Carbon, 1);
+ transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(7), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Nitrogen.mGas, 144);
+ transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(8), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Oxygen.mGas, 144);
+ transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(9), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Fluorine.mGas, 144);
+ //transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Neon.mGas.getID(), 144);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(11), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Sodium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(12), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Magnesium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(13), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Aluminium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(14), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Silicon, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(15), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Phosphorus, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(16), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Sulfur, 1);
+ transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(17), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Argon.mGas, 144);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(19), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Potassium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(20), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Calcium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(21), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Scandium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(22), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Titanium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(23), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Vanadium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(24), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Chrome, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(25), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Manganese, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(26), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Iron, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(27), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Cobalt, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(28), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Nickel, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(29), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Copper, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(30), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Zinc, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(31), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Gallium, 1);
+ //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),dust, Germanium,1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(33), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Arsenic, 1);
+ //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),dust, Selenium,1);
+ //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),dust, Bromine,1);
+ //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),dust, Krypton,1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(37), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Rubidium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(38), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Strontium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(39), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Yttrium, 1);
+ //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),dust, Zirconium,1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(41), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Niobium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(42), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Molybdenum, 1);
+ //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),dust, Technetium,1);
+ //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),dust, Ruthenium,1);
+ //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),dust, Rhodium,1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(46), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Palladium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(47), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Silver, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(48), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Cadmium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(49), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Indium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(50), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Tin, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(51), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Antimony, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(52), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Tellurium, 1);
+ //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),dust, Iodine,1);
+ //transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Xenon.mGas.getID(), 144);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(55), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Caesium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(56), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Barium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(57), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Lanthanum, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(58), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Cerium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(59), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Praseodymium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(60), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Neodymium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(62), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Samarium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(63), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Europium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(64), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Gadolinium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(65), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Terbium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(66), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Dysprosium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(67), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Holmium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(68), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Erbium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(69), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Thulium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(70), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Ytterbium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(71), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Lutetium, 1);
+ //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),dust, Hafnum,1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(73), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Tantalum, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(74), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Tungsten, 1);
+ //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),dust, Rhenium,1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(76), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Osmium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(77), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Iridium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(78), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Platinum, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(79), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Gold, 1);
+ transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(80), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Mercury.mFluid, 144);
+ //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),dust, Thallium,1);
+ transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(82), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Lead, 1);
+
+ /*----UNSTABLE ATOMS----**/
+ refUnstableMass = getFirstStableIsotope(82).getMass() * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED;
+
+ transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(61), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Promethium, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(83), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Bismuth, 1);
+ //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),dust, Polonium,1);
+ //transformationInfo.addFluid(new EMDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Astatine.mPlasma.getID(), 144);
+ transformationInfo.addFluid(new EMDefinitionStack(getBestUnstableIsotope(86), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Radon.mGas, 144);
+ //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),dust, Francium,1);
+ //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),dust, Radium,1);
+ //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),dust, Actinium,1);
+ transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(90), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Thorium, 1);
+ //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),dust, Protactinium,1);
+ ////transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Uranium,1);
+ //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),dust, Neptunium,1);
+ ////transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Plutonium,1);
+ transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(95), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Americium, 1);
+
+
+ transformationInfo.addFluid(new EMDefinitionStack(deuterium.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Deuterium.mGas, 144);
+ transformationInfo.addFluid(new EMDefinitionStack(tritium.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Tritium.mGas, 144);
+ transformationInfo.addFluid(new EMDefinitionStack(helium_3.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Helium_3.mGas, 144);
+
+ transformationInfo.addOredict(new EMDefinitionStack(uranium_238.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Uranium/*238*/, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(uranium_235.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Uranium235, 1);
+
+ transformationInfo.addOredict(new EMDefinitionStack(plutonium_239.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Plutonium/*239*/, 1);
+ transformationInfo.addOredict(new EMDefinitionStack(plutonium_241.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Plutonium241, 1);
+ }
+
public static EMAtomDefinition getFirstStableIsotope(int element) {
return stableAtoms.get(element);
}
@@ -1644,11 +1665,11 @@ public final class EMAtomDefinition extends EMComplexTemplate {
}
@Override
- public byte getClassType() {
+ public int getMatterMassType() {
return getClassTypeStatic();
}
- public static byte getClassTypeStatic(){
+ public static int getClassTypeStatic() {
return 64;
}
@@ -1659,36 +1680,36 @@ public final class EMAtomDefinition extends EMComplexTemplate {
@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)) {
+ 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 = " + getIndirectTagValue() + ' ' + getClassType());
+ if (Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) {
+ lines.add("CLASS = " + getIndirectTagValue() + ' ' + getMatterMassType());
}
- 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_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)) {
+ 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_COLOR, capabilities)) {
+ lines.add(hasColor() ? "COLORLESS" : "CARRIES COLOR");
}
- if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) {
+ 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 (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");
+ 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/EMHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java
index c1db8e4460..aedb11ac05 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java
@@ -4,21 +4,20 @@ import com.github.technus.tectech.TecTech;
import com.github.technus.tectech.mechanics.elementalMatter.core.EMException;
import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate;
-import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType;
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.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.EMDequantizationInfo;
import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictQuantizationInfo;
-import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.OreDictionaryStack;
import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition;
import com.github.technus.tectech.util.Util;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
-import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
@@ -26,29 +25,28 @@ import java.util.HashMap;
import java.util.Map;
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.core.transformations.EMTransformationInfo.TRANSFORMATION_INFO;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.boson_Y__;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd;
import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*;
-import static gregtech.api.enums.OrePrefixes.dust;
import static net.minecraft.util.StatCollector.translateToLocal;
/**
* Created by danie_000 on 17.11.2016.
*/
-public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i/o
+public class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i/o
private final int hash;
- private static final byte nbtType = (byte) 'h';
+ private static final String nbtType = "h";
//Helpers
- 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 final Map<EMHadronDefinition, String> SYMBOL_MAP = new HashMap<>();
+ public static final Map<EMHadronDefinition, String> UNLOCALIZED_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;
+ 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
private final double mass;
@@ -81,20 +79,20 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
}
quarkStacks = quarks;
- int amount = 0;
- int charge = 0;
- int type = 0;
+ int amount = 0;
+ int charge = 0;
+ int type = 0;
boolean containsAnti = false;
- double mass = 0;
+ double mass = 0;
for (EMDefinitionStack quarkStack : quarkStacks.valuesToArray()) {
amount += quarkStack.getAmount();
- if((int) quarkStack.getAmount() != 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.getDefinition().getMatterType()), type);
- if (quarkStack.getDefinition().getMatterType() < 0) {
+ type = Math.max(Math.abs(quarkStack.getDefinition().getGeneration()), type);
+ if (quarkStack.getDefinition().getGeneration() < 0) {
containsAnti = true;
}
}
@@ -106,10 +104,10 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
if (mass == protonMass && this.getAmount() == 3) {
rawLifeTime = IEMDefinition.STABLE_RAW_LIFE_TIME;
- mass=actualProtonMass;
+ mass = actualProtonMass;
} else if (mass == neutronMass && this.getAmount() == 3) {
rawLifeTime = 882D;
- mass=actualNeutronMass;
+ mass = actualNeutronMass;
} else {
if (this.getAmount() == 3) {
rawLifeTime = 1.34D / mass * Math.pow(9.81, charge);
@@ -119,8 +117,8 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
rawLifeTime = 1.21D / mass / Math.pow(9.80, charge);
}
}
- this.mass=mass;
- hash=super.hashCode();
+ this.mass = mass;
+ hash = super.hashCode();
}
//public but u can just try{}catch(){} the constructor it still calls this method
@@ -130,7 +128,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
if (!(quarks.getDefinition() instanceof EMQuarkDefinition)) {
return false;
}
- if((int) quarks.getAmount() != quarks.getAmount()){
+ if ((int) quarks.getAmount() != quarks.getAmount()) {
throw new ArithmeticException("Amount cannot be safely converted to int!");
}
amount += quarks.getAmount();
@@ -140,12 +138,12 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
@Override
public String getLocalizedName() {
- StringBuilder name= new StringBuilder(getSimpleName());
+ StringBuilder name = new StringBuilder(getSimpleName());
name.append(':');
- String sym= translateToLocal(NAME_MAP.get(this));
- if(sym!=null){
+ String sym = translateToLocal(UNLOCALIZED_NAME_MAP.get(this));
+ if (sym != null) {
name.append(' ').append(sym);
- }else {
+ } else {
for (EMDefinitionStack quark : quarkStacks.valuesToArray()) {
name.append(' ').append(quark.getDefinition().getSymbol()).append((int) quark.getAmount());
}
@@ -172,10 +170,10 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
@Override
public String getSymbol() {
- String sym=SYMBOL_MAP.get(this);
- if(sym!=null){
+ String sym = SYMBOL_MAP.get(this);
+ if (sym != null) {
return sym;
- }else {
+ } else {
StringBuilder symbol = new StringBuilder(8);
for (EMDefinitionStack quark : quarkStacks.valuesToArray()) {
for (int i = 0; i < quark.getAmount(); i++) {
@@ -188,10 +186,10 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
@Override
public String getShortSymbol() {
- String sym=SYMBOL_MAP.get(this);
- if(sym!=null){
+ String sym = SYMBOL_MAP.get(this);
+ if (sym != null) {
return sym;
- }else {
+ } else {
StringBuilder symbol = new StringBuilder(8);
for (EMDefinitionStack quark : quarkStacks.valuesToArray()) {
for (int i = 0; i < quark.getAmount(); i++) {
@@ -203,7 +201,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
}
@Override
- public byte getColor() {
+ public int getMaxColors() {
return -7;
}
@@ -215,12 +213,12 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
@Override
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().getMatterType() == -quarkStacks[1].getDefinition().getMatterType()) {
+ if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getGeneration() == -quarkStacks[1].getDefinition().getGeneration()) {
return EMDecay.NO_PRODUCT;
}
ArrayList<EMDefinitionStack> decaysInto = new ArrayList<>();
for (EMDefinitionStack quarks : quarkStacks) {
- if (quarks.getDefinition().getMatterType() == 1 || quarks.getDefinition().getMatterType() == -1) {
+ if (quarks.getDefinition().getGeneration() == 1 || quarks.getDefinition().getGeneration() == -1) {
//covers both quarks and antiquarks
decaysInto.add(quarks);
} else {
@@ -230,22 +228,22 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
}
return new EMDecay[]{
new EMDecay(0.75D, decaysInto.toArray(new EMDefinitionStack[0])),
- EMBosonDefinition.deadEnd
+ deadEnd
};
}
@Override
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().getMatterType() == -quarkStacks[1].getDefinition().getMatterType()) {
+ if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getGeneration() == -quarkStacks[1].getDefinition().getGeneration()) {
return EMDecay.NO_PRODUCT;
}
- return new EMDecay[]{new EMDecay(0.75D, quarkStacks), EMBosonDefinition.deadEnd}; //decay into quarks
+ return new EMDecay[]{new EMDecay(0.75D, quarkStacks), deadEnd}; //decay into quarks
}
@Override
public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) {
- return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel);
+ return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel);
}
@Override
@@ -273,10 +271,10 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray();
if (getAmount() == 2 && quarkStacks.length == 2 &&
quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() &&
- quarkStacks[0].getDefinition().getMatterType() == -quarkStacks[1].getDefinition().getMatterType()) {
+ quarkStacks[0].getDefinition().getGeneration() == -quarkStacks[1].getDefinition().getGeneration()) {
return EMDecay.NO_PRODUCT;
} else if (getAmount() != 3) {
- return new EMDecay[]{new EMDecay(0.95D, quarkStacks), EMBosonDefinition.deadEnd}; //decay into quarks
+ return new EMDecay[]{new EMDecay(0.95D, quarkStacks), deadEnd}; //decay into quarks
} else {
ArrayList<EMQuarkDefinition> newBaryon = new ArrayList<>();
IEMDefinition[] Particles = new IEMDefinition[2];
@@ -289,7 +287,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
EMQuarkDefinition lastQuark = newBaryon.remove(2);
EMDefinitionStack[] decay;
- if (Math.abs(lastQuark.getMatterType()) > 1) {
+ if (Math.abs(lastQuark.getGeneration()) > 1) {
decay = lastQuark.getDecayArray()[1].getOutputStacks().valuesToArray();
} else {
decay = lastQuark.getDecayArray()[2].getOutputStacks().valuesToArray();
@@ -299,19 +297,19 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
Particles[1] = decay[2].getDefinition();
EMDefinitionStack[] contentOfBaryon = newBaryon.stream()
- .map(eQuarkDefinition -> new EMDefinitionStack(eQuarkDefinition,1))
+ .map(eQuarkDefinition -> new EMDefinitionStack(eQuarkDefinition, 1))
.toArray(EMDefinitionStack[]::new);
try {
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};
+ deadEnd};
} catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
}
- return new EMDecay[]{EMBosonDefinition.deadEnd};
+ return new EMDecay[]{deadEnd};
}
}
}
@@ -337,7 +335,7 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
}
@Override
- public byte getMatterType() {
+ public int getGeneration() {
return type;
}
@@ -373,64 +371,48 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
}
@Override
- public EMFluidDequantizationInfo someAmountIntoFluidStack() {
- return null;
- }
-
- @Override
- public EMItemDequantizationInfo someAmountIntoItemsStack() {
- return null;
- }
-
- @Override
- public EMOredictDequantizationInfo someAmountIntoOredictStack() {
- return null;
- }
-
- @Override
- protected int getIndirectTagValue() {
+ protected String getIndirectTagValue() {
return nbtType;
}
- public static EMHadronDefinition 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 EMHadronDefinition(stacks);
- } catch (EMException e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- return null;
- }
- }
-
- public static void run() {
+ public static void run(EMDefinitionsRegistry registry) {
+ registry.registerDefinitionClass(nbtType, new EMIndirectType((definitionsRegistry, nbt) ->
+ new EMHadronDefinition(EMConstantStackMap.fromNBT(definitionsRegistry, nbt)), EMHadronDefinition.class, "tt.keyword.Hadron"));
try {
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 EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1)));
- SYMBOL_MAP.put(hadron_p,"p");
- NAME_MAP.put(hadron_p,translateToLocal("tt.keyword.Proton"));
- EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_p);
+ SYMBOL_MAP.put(hadron_p, "p");
+ UNLOCALIZED_NAME_MAP.put(hadron_p, "tt.keyword.Proton");
+ registry.registerForDisplay(hadron_p);
+ registry.registerDirectDefinition("p",hadron_p);
+
hadron_p_ = (EMHadronDefinition) hadron_p.getAnti();
- SYMBOL_MAP.put(hadron_p_,"~p");
- NAME_MAP.put(hadron_p_,translateToLocal("tt.keyword.AntiProton"));
- EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_p_);
+ SYMBOL_MAP.put(hadron_p_, "~p");
+ UNLOCALIZED_NAME_MAP.put(hadron_p_, "tt.keyword.AntiProton");
+ registry.registerForDisplay(hadron_p_);
+ registry.registerDirectDefinition("~p",hadron_p_);
+
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 EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2)));
SYMBOL_MAP.put(hadron_n, "n");
- NAME_MAP.put(hadron_n,translateToLocal("tt.keyword.Neutron"));
- EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_n);
+ UNLOCALIZED_NAME_MAP.put(hadron_n, "tt.keyword.Neutron");
+ registry.registerForDisplay(hadron_n);
+ registry.registerDirectDefinition("n",hadron_n);
+
hadron_n_ = (EMHadronDefinition) hadron_n.getAnti();
- SYMBOL_MAP.put(hadron_n_,"~n");
- NAME_MAP.put(hadron_n_,translateToLocal("tt.keyword.AntiNeutron"));
- EMDefinitionsRegistry.getStacksRegisteredForDisplay().add(hadron_n_);
+ SYMBOL_MAP.put(hadron_n_, "~n");
+ UNLOCALIZED_NAME_MAP.put(hadron_n_, "tt.keyword.AntiNeutron");
+ registry.registerForDisplay(hadron_n_);
+ registry.registerDirectDefinition("~n",hadron_n_);
+
+ TecTech.LOGGER.info("Old Neutron Mass: " + neutronMass);
+ TecTech.LOGGER.info("Old Proton Mass: " + protonMass);
+ TecTech.LOGGER.info("New Neutron Mass: " + EMHadronDefinition.hadron_n.getMass());
+ TecTech.LOGGER.info("New Proton Mass: " + EMHadronDefinition.hadron_p.getMass());
} catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
@@ -446,34 +428,29 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
hadron_n3 = new EMDefinitionStack(hadron_n, 3D);
hadron_p5 = new EMDefinitionStack(hadron_p, 5D);
- try {
- EMDefinitionsRegistry.registerDefinitionClass(nbtType, EMHadronDefinition::fromNBT,EMHadronDefinition.class,getClassTypeStatic());
- } catch (Exception e) {
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- }
- if(DEBUG_MODE) {
+ if (DEBUG_MODE) {
TecTech.LOGGER.info("Registered Elemental Matter Class: Hadron " + nbtType + ' ' + getClassTypeStatic());
}
}
- public static void setTransformations(){
+ public static void setTransformations(EMTransformationRegistry transformationInfo) {//Todo use Neutronium atom?
//Added to atom map, but should be in its own
- 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 EMOredictQuantizationInfo(OrePrefixes.ingotHot,Materials.Neutronium,1 ,neutrons)
+ EMDefinitionStack neutrons = new EMDefinitionStack(hadron_n, 1000 * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED);
+ EMDequantizationInfo emDequantizationInfo = new EMDequantizationInfo(neutrons);
+ emDequantizationInfo.setOre(new OreDictionaryStack(1,OreDictionary.getOreID(OrePrefixes.dust.name() + Materials.Neutronium.mName)));//todo shitty looking, but works...
+ transformationInfo.getInfoMap().put(neutrons.getDefinition(), emDequantizationInfo);
+ transformationInfo.getOredictQuantization().put(
+ OreDictionary.getOreID(OrePrefixes.ingotHot.name() + Materials.Neutronium.mName),
+ new EMOredictQuantizationInfo(OrePrefixes.ingotHot, Materials.Neutronium, 1, neutrons)
);
}
@Override
- public byte getClassType() {
+ public int getMatterMassType() {
return getClassTypeStatic();
}
- public static byte getClassTypeStatic(){
+ public static int getClassTypeStatic() {
return -64;
}
@@ -484,32 +461,32 @@ public final class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize
@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)) {
+ 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 = " + getIndirectTagValue() + ' ' + getClassType());
+ if (Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) {
+ lines.add("CLASS = " + getIndirectTagValue() + ' ' + getMatterMassType());
}
- if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) {
- lines.add("NAME = "+getSimpleName());
+ if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) {
+ lines.add("NAME = " + getSimpleName());
//lines.add("SYMBOL = "+getSymbol());
}
- if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) {
+ 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_COLOR, capabilities)) {
+ lines.add(hasColor() ? "COLORLESS" : "CARRIES COLOR");
}
- if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) {
+ if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) {
lines.add("MASS = " + getMass() + " eV/c\u00b2");
}
- if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){
- lines.add("HALF LIFE = "+getRawTimeSpan(energyLevel)+ " s");
- lines.add(" "+"At current energy level");
+ 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
index f20f872a6e..9b77a6cab8 100644
--- 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
@@ -1,46 +1,16 @@
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.definitions.EMPrimitiveTemplate;
-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.*;
import static net.minecraft.util.StatCollector.translateToLocal;
-/**
- * Created by danie_000 on 22.10.2016.
- */
-public final class EMBosonDefinition extends EMPrimitiveTemplate {
- 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);
+public abstract class EMBosonDefinition extends EMPrimitiveTemplate {
+ protected EMBosonDefinition(String name, String symbol, int generation, double mass, int charge, int color, int ID, String bind) {
+ super(name, symbol, generation, mass, charge, color, ID, bind);
}
@Override
public String getLocalizedName() {
- return translateToLocal("tt.keyword.Boson")+": " + getName();
- }
-
- @Override
- public boolean isTimeSpanHalfLife() {
- return this==boson_H__;
+ return translateToLocal("tt.keyword.Boson")+": " + translateToLocal(getUnlocalizedName());
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java
new file mode 100644
index 0000000000..f8f05b80ee
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java
@@ -0,0 +1,16 @@
+package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate;
+
+import static net.minecraft.util.StatCollector.translateToLocal;
+
+public abstract class EMFermionDefinition extends EMPrimitiveTemplate {
+ protected EMFermionDefinition(String name, String symbol, int generation, double mass, int charge, int color, int ID, String bind) {
+ super(name, symbol, generation, mass, charge, color, ID, bind);
+ }
+
+ @Override
+ public String getLocalizedName() {
+ return translateToLocal("tt.keyword.Fermion")+": " + translateToLocal(getUnlocalizedName());
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java
new file mode 100644
index 0000000000..fb8128c3a5
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java
@@ -0,0 +1,83 @@
+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.definitions.registry.EMDefinitionsRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
+
+import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.*;
+import static net.minecraft.util.StatCollector.translateToLocal;
+
+/**
+ * Created by danie_000 on 22.10.2016.
+ */
+public class EMGaugeBosonDefinition extends EMBosonDefinition {
+ public static final EMGaugeBosonDefinition
+ boson_g__ = new EMGaugeBosonDefinition("tt.keyword.Gluon", "g", 0, 0, 8, 27, "g"),
+ boson_Y__ = new EMGaugeBosonDefinition("tt.keyword.Photon", "\u03b3", 1e-18D, 0, -1, 28, "Y"),
+ boson_Z = new EMGaugeBosonDefinition("tt.keyword.Weak0", "Z0", 91.1876e9, 0, -1, 29, "Z0"),
+ boson_W_ = new EMGaugeBosonDefinition("tt.keyword.WeakPlus", "W+", 80.379e9, 3, -1, 30, "W+"),
+ boson_W = new EMGaugeBosonDefinition("tt.keyword.WeakMinus", "W-", 80.379e9, -3, -1, 31, "W-");
+ //deadEnd
+ public static final EMDecay deadEnd = new EMDecay(boson_Y__, boson_Y__);
+ public static final EMDefinitionStack boson_Y__1 = new EMDefinitionStack(boson_Y__, 1);
+ public static final EMDecay deadEndHalf = new EMDecay(boson_Y__1);
+
+ protected EMGaugeBosonDefinition(String name, String symbol, double mass, int charge, int color, int ID, String bind) {
+ super(name, symbol, 0, mass, charge, color, ID, bind);
+ }
+
+ public static void run(EMDefinitionsRegistry registry) {
+ registry.registerDefinitionClass(new EMType(EMGaugeBosonDefinition.class, "tt.keyword.GaugeBoson"));
+ boson_g__.init(registry, boson_g__, 3e-50, 0, 0, deadEndHalf);
+ boson_Y__.init(registry, boson_Y__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
+ boson_Z.init(registry, boson_Z, 3e-25, 11, 11,
+ new EMDecay(0.03363, lepton_e, lepton_e_),
+ new EMDecay(0.03366, lepton_m, lepton_m_),
+ new EMDecay(0.03367, lepton_t, lepton_t_),
+ new EMDecay(0.068333, lepton_Ve, lepton_Ve_),
+ new EMDecay(0.068333, lepton_Vm, lepton_Vm_),
+ new EMDecay(0.068333, lepton_Vt, lepton_Vt_),
+ new EMDecay(0.118, quark_u, quark_u_),
+ new EMDecay(0.118, quark_c, quark_c_),
+ new EMDecay(0.152, quark_d, quark_d_),
+ new EMDecay(0.152, quark_s, quark_s_),
+ new EMDecay(0.152, quark_b, quark_b_),
+ deadEnd);
+ boson_W.init(registry, boson_W_, 3e-25, 9, 9,
+ new EMDecay(0.108, lepton_e, lepton_Ve_),
+ new EMDecay(0.108, lepton_m, lepton_Vm_),
+ new EMDecay(0.108, lepton_t, lepton_Vt_),
+ new EMDecay(0.112666, quark_u_, quark_d),
+ new EMDecay(0.112666, quark_u_, quark_s),
+ new EMDecay(0.112666, quark_u_, quark_b),
+ new EMDecay(0.112666, quark_c_, quark_d),
+ new EMDecay(0.112666, quark_c_, quark_s),
+ new EMDecay(0.112666, quark_c_, quark_b),
+ deadEnd);
+ boson_W_.init(registry, boson_W, 3e-25, 9, 9,
+ new EMDecay(0.108, lepton_e_, lepton_Ve),
+ new EMDecay(0.108, lepton_m_, lepton_Vm),
+ new EMDecay(0.108, lepton_t_, lepton_Vt),
+ new EMDecay(0.112666, quark_u, quark_d_),
+ new EMDecay(0.112666, quark_u, quark_s_),
+ new EMDecay(0.112666, quark_u, quark_b_),
+ new EMDecay(0.112666, quark_c, quark_d_),
+ new EMDecay(0.112666, quark_c, quark_s_),
+ new EMDecay(0.112666, quark_c, quark_b_),
+ deadEnd);
+ }
+
+ @Override
+ public String getLocalizedName() {
+ return translateToLocal("tt.keyword.GaugeBoson") + ": " + translateToLocal(getUnlocalizedName());
+ }
+
+ @Override
+ public boolean isTimeSpanHalfLife() {
+ return false;
+ }
+}
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
index 38e537ec59..c665bf23b4 100644
--- 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
@@ -1,57 +1,60 @@
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.definitions.registry.EMDefinitionsRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType;
import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate;
-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.EMGaugeBosonDefinition.boson_Y__;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd;
import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMScalarBosonDefinition.boson_H__;
import static net.minecraft.util.StatCollector.translateToLocal;
/**
* Created by danie_000 on 22.10.2016.
*/
-public final class EMLeptonDefinition extends EMPrimitiveTemplate {
+public class EMLeptonDefinition extends EMFermionDefinition {
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);
+ lepton_e = new EMLeptonDefinition("tt.keyword.Electron", "\u03b2-", 1, 0.511e6D, -3, 15,"e-"),
+ lepton_m = new EMLeptonDefinition("tt.keyword.Muon", "\u03bc-", 2, 105.658e6D, -3, 17,"m-"),
+ lepton_t = new EMLeptonDefinition("tt.keyword.Tauon", "\u03c4-", 3, 1776.83e6D, -3, 19,"t-"),
+ lepton_e_ = new EMLeptonDefinition("tt.keyword.Positron", "\u03b2+", -1, 0.511e6D, 3, 16,"e+"),
+ lepton_m_ = new EMLeptonDefinition("tt.keyword.Antimuon", "\u03bc+", -2, 105.658e6D, 3, 18,"m+"),
+ lepton_t_ = new EMLeptonDefinition("tt.keyword.Antitauon", "\u03c4+", -3, 1776.83e6D, 3, 20,"t+");
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);
+ protected EMLeptonDefinition(String name, String symbol, int type, double mass, int charge, int ID,String bind) {
+ super(name, symbol, type, mass, charge, -1, ID,bind);
//this.itemThing=null;
//this.fluidThing=null;
}
- public static void run() {
- lepton_e.init(lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1,
+ public static void run(EMDefinitionsRegistry registry) {
+ registry.registerDefinitionClass(new EMType(EMLeptonDefinition.class,"tt.keyword.Lepton"));
+ lepton_e.init(registry,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,
+ lepton_m.init(registry,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,
+ lepton_t.init(registry,lepton_t_, 2.903e-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,
+ lepton_e_.init(registry,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,
+ lepton_m_.init(registry,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,
+ lepton_t_.init(registry,lepton_t, 2.903e-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__),
@@ -60,7 +63,7 @@ public final class EMLeptonDefinition extends EMPrimitiveTemplate {
@Override
public String getLocalizedName() {
- return translateToLocal("tt.keyword.Lepton")+": " + getName();
+ return translateToLocal("tt.keyword.Lepton")+": " + translateToLocal(getUnlocalizedName());
}
@Override
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
index 9af7b97cb4..9ef04e8c7e 100644
--- 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
@@ -1,56 +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.definitions.registry.EMDefinitionsRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType;
import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate;
-import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMBosonDefinition.*;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEndHalf;
import static net.minecraft.util.StatCollector.translateToLocal;
/**
* Created by danie_000 on 22.10.2016.
*/
-public final class EMNeutrinoDefinition extends EMPrimitiveTemplate {
+public class EMNeutrinoDefinition extends EMLeptonDefinition {
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);
+ lepton_Ve = new EMNeutrinoDefinition("tt.keyword.ElectronNeutrino", "\u03bd\u03b2", 1, 2e0D, 21,"Ve-"),
+ lepton_Vm = new EMNeutrinoDefinition("tt.keyword.MuonNeutrino", "\u03bd\u03bc", 2, 0.15e6D, 23,"Vm-"),
+ lepton_Vt = new EMNeutrinoDefinition("tt.keyword.TauonNeutrino", "\u03bd\u03c4", 3, 15e6D, 25,"Vt-"),
+ lepton_Ve_ = new EMNeutrinoDefinition("tt.keyword.PositronNeutrino", "~\u03bd\u03b2", -1, 2e0D, 22,"Ve+"),
+ lepton_Vm_ = new EMNeutrinoDefinition("tt.keyword.AntimuonNeutrino", "~\u03bd\u03bc", -2, 0.15e6D, 24,"Vm+"),
+ lepton_Vt_ = new EMNeutrinoDefinition("tt.keyword.AntitauonNeutrino", "~\u03bd\u03c4", -3, 15e6D, 26,"Vt+");
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);
+ protected EMNeutrinoDefinition(String name, String symbol, int type, double mass, int ID,String bind) {
+ super(name, symbol, type, mass, 0, ID,bind);
}
- public static void run() {
- lepton_Ve.init(lepton_Ve_, 1D, -1, -1,
+ public static void run(EMDefinitionsRegistry registry) {
+ registry.registerDefinitionClass(new EMType(EMNeutrinoDefinition.class,"tt.keyword.Neutrino"));
+ lepton_Ve.init(registry,lepton_Ve_, 1D, -1, -1,
EMDecay.NO_PRODUCT);
- lepton_Vm.init(lepton_Vm_, 1D, 1, 0,
+ lepton_Vm.init(registry,lepton_Vm_, 1D, 1, 0,
new EMDecay(0.825D, nothing),
deadEndHalf);
- lepton_Vt.init(lepton_Vt_, 1, 1, 0,
+ lepton_Vt.init(registry,lepton_Vt_, 1, 1, 0,
new EMDecay(0.75F, nothing),
deadEnd);
- lepton_Ve_.init(lepton_Ve, 1, -1, -1,
+ lepton_Ve_.init(registry,lepton_Ve, 1, -1, -1,
EMDecay.NO_PRODUCT);
- lepton_Vm_.init(lepton_Vm, 1, 1, 0,
+ lepton_Vm_.init(registry,lepton_Vm, 1, 1, 0,
new EMDecay(0.825F, nothing),
deadEndHalf);
- lepton_Vt_.init(lepton_Vt, 1, 1, 0,
+ lepton_Vt_.init(registry,lepton_Vt, 1, 1, 0,
new EMDecay(0.75F, nothing),
deadEnd);
}
@Override
public String getLocalizedName() {
- return translateToLocal("tt.keyword.Neutrino")+": " + getName();
+ return translateToLocal("tt.keyword.Neutrino")+": " + translateToLocal(getUnlocalizedName());
}
@Override
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
index 41da06567d..60f87ac83b 100644
--- 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
@@ -1,6 +1,8 @@
package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType;
import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY;
import static net.minecraft.util.StatCollector.translateToLocal;
@@ -8,29 +10,45 @@ import static net.minecraft.util.StatCollector.translateToLocal;
/**
* Created by danie_000 on 22.10.2016.
*/
-public final class EMPrimitiveDefinition extends EMPrimitiveTemplate {
+public class EMPrimitiveDefinition extends EMPrimitiveTemplate {
public static final EMPrimitiveDefinition
- nbtE__ = new EMPrimitiveDefinition("NBT ERROR", "!", 0, 0D, Integer.MIN_VALUE, 0),
- null__ = new EMPrimitiveDefinition("NULL POINTER", ".", 0, 0D, -3, Integer.MIN_VALUE),
- space__ = new EMPrimitiveDefinition("Space", "_", 0, 0D, -4, Integer.MIN_VALUE+1),
- 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);
+ nbtE__ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveNBTERROR" , "!" , 0 , 0D , -1 , Integer.MIN_VALUE , "!" ),
+ null__ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveNULLPOINTER" , "." , 0 , 0D , -3 , Integer.MIN_VALUE+1 , "." ),
+ space = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveSpace" , "_" , 0 , 0D , -4 , Integer.MIN_VALUE + 2 , "_" ),
+ space_ = new EMPrimitiveDefinition ( "tt.keyword.PrimitivePresence" , "~_" , 0 , 0D , -4 , Integer.MIN_VALUE + 3 , "~_" ),
+ mass = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveMass" , "#" , 0 , 1 , -4 , Integer.MIN_VALUE + 4 , "#" ),
+ mass_ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveDarkMass" , "~#" , 0 , 1 , -4 , Integer.MIN_VALUE + 5 , "~#" ),
+ energy = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveEnergy" , "E" , 4 , 0D , -4 , Integer.MIN_VALUE + 6 , "E" ),
+ energy_ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveDarkEnergy" , "~E" , -4 , 0 , -4 , Integer.MIN_VALUE + 7 , "~E" ),
+ magic = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveMagic" , "Ma" , 5 , 1e5D , 0 , Integer.MIN_VALUE + 8 , "Ma" ),
+ magic_ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveAntimagic" , "~Ma" , -5 , 1e5D , 0 , Integer.MIN_VALUE + 9 , "~Ma" );
+
+
+ protected EMPrimitiveDefinition(String name, String symbol, int type, double mass, int color, int ID, String bind) {
+ super(name, symbol, type, mass, 0, color, ID, bind);
}
- 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);
+ public static void run(EMDefinitionsRegistry registry) {
+ registry.registerDefinitionClass(new EMType(EMPrimitiveDefinition.class, "tt.keyword.Primitive"));
+ nbtE__.init(registry, null, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
+ null__.init(registry, null, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
+
+ space.init(registry, space_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
+ space_.init(registry, space, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
+
+ mass.init(registry, mass_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
+ mass_.init(registry, mass, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
+
+ energy.init(registry, energy_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
+ energy_.init(registry, energy, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
+
+ magic.init(registry, magic_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
+ magic_.init(registry, magic, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY);
}
@Override
public String getLocalizedName() {
- return translateToLocal("tt.keyword.Primitive")+": " + getName();
+ return translateToLocal("tt.keyword.Primitive") + ": " + translateToLocal(getUnlocalizedName());
}
@Override
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
index 3f19205aeb..19162bf90d 100644
--- 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
@@ -1,8 +1,10 @@
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.definitions.EMPrimitiveTemplate;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd;
import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*;
import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*;
import static net.minecraft.util.StatCollector.translateToLocal;
@@ -10,94 +12,95 @@ import static net.minecraft.util.StatCollector.translateToLocal;
/**
* Created by danie_000 on 22.10.2016.
*/
-public final class EMQuarkDefinition extends EMPrimitiveTemplate {
+public class EMQuarkDefinition extends EMFermionDefinition {
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);
+ quark_u = new EMQuarkDefinition("tt.keyword.QuarkUp", "u", 1, 2.3e6D, 2, 3,"u"),
+ quark_c = new EMQuarkDefinition("tt.keyword.QuarkCharm", "c", 2, 1.29e9D, 2, 9,"c"),
+ quark_t = new EMQuarkDefinition("tt.keyword.QuarkTop", "t", 3, 172.44e9D, 2, 13,"t"),
+ quark_d = new EMQuarkDefinition("tt.keyword.QuarkDown", "d", 1, 4.8e6D, -1, 5,"d"),
+ quark_s = new EMQuarkDefinition("tt.keyword.QuarkStrange", "s", 2, 95e6D, -1, 7,"s"),
+ quark_b = new EMQuarkDefinition("tt.keyword.QuarkBottom", "b", 3, 4.65e9D, -1, 11,"b"),
+ quark_u_ = new EMQuarkDefinition("tt.keyword.QuarkAntiUp", "~u", -1, 2.3e6D, -2, 4,"~u"),
+ quark_c_ = new EMQuarkDefinition("tt.keyword.QuarkAntiCharm", "~c", -2, 1.29e9D, -2, 10,"~c"),
+ quark_t_ = new EMQuarkDefinition("tt.keyword.QuarkAntiTop", "~t", -3, 172.44e9D, -2, 14,"~t"),
+ quark_d_ = new EMQuarkDefinition("tt.keyword.QuarkAntiDown", "~d", -1, 4.8e6D, 1, 6,"~d"),
+ quark_s_ = new EMQuarkDefinition("tt.keyword.QuarkAntiStrange", "~s", -2, 95e6D, 1, 8,"~s"),
+ quark_b_ = new EMQuarkDefinition("tt.keyword.QuarkAntiBottom", "~b", -3, 4.65e9D, 1, 12,"~b");
- private EMQuarkDefinition(String name, String symbol, int type, double mass, int charge, int ID) {
- super(name, symbol, type, mass, charge, 0, ID);
+ protected EMQuarkDefinition(String name, String symbol, int type, double mass, int charge, int ID,String bind) {
+ super(name, symbol, type, mass, charge, 0, ID,bind);
}
- public static void run() {
- quark_u.init(quark_u_, STABLE_RAW_LIFE_TIME, 3, -1,
+ public static void run(EMDefinitionsRegistry registry) {
+ registry.registerDefinitionClass(new EMType(EMQuarkDefinition.class,"tt.keyword.Quark"));
+ quark_u.init(registry,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,
+ deadEnd);//makes photons and don't care
+ quark_c.init(registry,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,
+ deadEnd);//makes photons and don't care
+ quark_t.init(registry,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
+ deadEnd);//makes photons and don't care
- quark_d.init(quark_d_, STABLE_RAW_LIFE_TIME, 3, -1,
+ quark_d.init(registry,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,
+ deadEnd);//makes photons and don't care
+ quark_s.init(registry,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,
+ deadEnd);//makes photons and don't care
+ quark_b.init(registry,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
+ deadEnd);//makes photons and don't care
- quark_u_.init(quark_u, STABLE_RAW_LIFE_TIME, 3, -1,
+ quark_u_.init(registry,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,
+ deadEnd);//makes photons and don't care
+ quark_c_.init(registry,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,
+ deadEnd);//makes photons and don't care
+ quark_t_.init(registry,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
+ deadEnd);//makes photons and don't care
- quark_d_.init(quark_d, STABLE_RAW_LIFE_TIME, 3, -1,
+ quark_d_.init(registry,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,
+ deadEnd);//makes photons and don't care
+ quark_s_.init(registry,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,
+ deadEnd);//makes photons and don't care
+ quark_b_.init(registry,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
+ deadEnd);//makes photons and don't care
}
@Override
public String getLocalizedName() {
- return translateToLocal("tt.keyword.Quark")+": " + getName();
+ return translateToLocal("tt.keyword.Quark")+": " + translateToLocal(getUnlocalizedName());
}
@Override
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java
new file mode 100644
index 0000000000..5070954847
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java
@@ -0,0 +1,46 @@
+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.definitions.registry.EMDefinitionsRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType;
+
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.*;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*;
+import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.*;
+import static net.minecraft.util.StatCollector.translateToLocal;
+
+/**
+ * Created by danie_000 on 22.10.2016.
+ */
+public class EMScalarBosonDefinition extends EMBosonDefinition {
+ public static final EMScalarBosonDefinition
+ boson_H__ = new EMScalarBosonDefinition("tt.keyword.Higgs", "H0", 125.09e9D, -2, 32,"H0");
+
+ private EMScalarBosonDefinition(String name, String symbol, double mass, int color, int ID,String bind) {
+ super(name, symbol, 0, mass, 0, color, ID,bind);
+ }
+
+ public static void run(EMDefinitionsRegistry registry) {
+ registry.registerDefinitionClass(new EMType(EMScalarBosonDefinition.class,"tt.keyword.ScalarBoson"));
+ boson_H__.init(registry,boson_H__, 1.56e-22D, 8, 8,
+ new EMDecay ( 0.0002171 , lepton_m , lepton_m_ ),
+ new EMDecay ( 0.001541 , boson_Z, boson_Y__ ),
+ new EMDecay ( 0.02641 , boson_Z, boson_Z),
+ new EMDecay ( 0.02884 , quark_c , quark_c_ ),
+ new EMDecay ( 0.06256 , lepton_t , lepton_t_ ),
+ new EMDecay ( 0.0818 , boson_g__ , boson_g__ ),
+ new EMDecay ( 0.2152 , boson_W_, boson_W),
+ new EMDecay ( 0.5809 , quark_b , quark_b_ ),
+ deadEnd);
+ }
+
+ @Override
+ public String getLocalizedName() {
+ return translateToLocal("tt.keyword.ScalarBoson")+": " + translateToLocal(getUnlocalizedName());
+ }
+
+ @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 b7310485a2..68607ae737 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,11 +1,10 @@
package com.github.technus.tectech.recipe;
-import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry;
+import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
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.definitions.IEMDefinition;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.util.GT_Recipe;
import net.minecraft.item.ItemStack;
@@ -16,8 +15,6 @@ import java.util.Collection;
import java.util.HashMap;
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 EMConstantStackMap[] input;
@@ -257,20 +254,6 @@ public class TT_recipe extends GT_Recipe {
return mRecipeMap.get(stack);
}
- public T findRecipe(ItemStack dataHandler){
- if(dataHandler==null || dataHandler.stackTagCompound==null) {
- return null;
- }
- try {
- return mRecipeMap.get(EMDefinitionsRegistry.fromNBT(dataHandler.stackTagCompound.getCompoundTag(E_RECIPE_ID)));
- }catch (Exception e){
- if (DEBUG_MODE) {
- e.printStackTrace();
- }
- return null;
- }
- }
-
public void add(T recipe){
mRecipeMap.put(recipe.mResearchEM,recipe);
}
diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java
index d34d12c754..42fb14f55d 100644
--- a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java
+++ b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java
@@ -13,7 +13,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import static com.github.technus.tectech.Reference.MODID;
-import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech;
+import static com.github.technus.tectech.TecTech.creativeTabTecTech;
/**
* Created by danie_000 on 17.12.2016.
diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java
index bac2dfb9ac..2a8bb37a0b 100644
--- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java
+++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java
@@ -10,7 +10,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
-import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech;
+import static com.github.technus.tectech.TecTech.creativeTabTecTech;
import static com.github.technus.tectech.thing.metaTileEntity.Textures.*;
/**
diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java
index eb590ab2e2..f3574007f2 100644
--- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java
+++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java
@@ -18,7 +18,7 @@ import net.minecraft.world.IBlockAccess;
import java.util.List;
import static com.github.technus.tectech.TecTech.tectechTexturePage1;
-import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech;
+import static com.github.technus.tectech.TecTech.creativeTabTecTech;
/**
* Created by danie_000 on 03.10.2016.
diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java
index c65870eeb7..9648e41d8d 100644
--- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java
+++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java
@@ -16,7 +16,7 @@ import net.minecraft.world.IBlockAccess;
import java.util.List;
-import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech;
+import static com.github.technus.tectech.TecTech.creativeTabTecTech;
/**
* Created by danie_000 on 03.10.2016.
diff --git a/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java b/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java
index 90f3312342..cc071d2326 100644
--- a/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java
+++ b/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java
@@ -28,7 +28,7 @@ import java.io.OutputStream;
import java.util.List;
import static com.github.technus.tectech.Reference.MODID;
-import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech;
+import static com.github.technus.tectech.TecTech.creativeTabTecTech;
import static net.minecraft.util.StatCollector.translateToLocal;
@Optional.InterfaceList(
diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java
index 752f2d1bcc..3d00fcdf35 100644
--- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java
+++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java
@@ -12,7 +12,7 @@ import net.minecraft.world.World;
import java.util.List;
import static com.github.technus.tectech.Reference.MODID;
-import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech;
+import static com.github.technus.tectech.TecTech.creativeTabTecTech;
import static net.minecraft.util.StatCollector.translateToLocal;
/**
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 2062173cfd..d909054196 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
@@ -1,15 +1,15 @@
package com.github.technus.tectech.thing.item;
-import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMDefinitionsRegistry;
-import com.github.technus.tectech.util.CommonValues;
-import com.github.technus.tectech.util.Util;
+import com.github.technus.tectech.TecTech;
import com.github.technus.tectech.font.TecTechFontRender;
-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.IEMContainer;
import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition;
+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.renderElemental.IElementalItem;
+import com.github.technus.tectech.util.CommonValues;
+import com.github.technus.tectech.util.Util;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -30,8 +30,8 @@ import java.util.List;
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.EMTransformationInfo.*;
+import static com.github.technus.tectech.TecTech.creativeTabTecTech;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.*;
import static cpw.mods.fml.relauncher.Side.CLIENT;
import static net.minecraft.util.StatCollector.translateToLocal;
@@ -61,7 +61,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE
EMInstanceStackMap content = ((IEMContainer) metaTE).getContentHandler();
if (tNBT.hasKey("content")) {
try {
- content.putUnifyAll(EMInstanceStackMap.fromNBT(tNBT.getCompoundTag("content")));
+ content.putUnifyAll(EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content")));
} catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
@@ -75,7 +75,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE
} else if (content.hasStacks()) {
((IEMContainer) metaTE).purgeOverflow();
tNBT.setTag("info", content.getInfoNBT());
- tNBT.setTag("content", content.toNBT());
+ tNBT.setTag("content", content.toNBT(TecTech.definitionsRegistry));
tNBT.setTag("symbols", content.getShortSymbolsNBT());
content.clear();
}
@@ -94,7 +94,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE
}
if (tNBT.hasKey("content")) {
try {
- content.putUnifyAll(EMInstanceStackMap.fromNBT(tNBT.getCompoundTag("content")));
+ content.putUnifyAll(EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content")));
} catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
@@ -106,7 +106,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE
tNBT.removeTag("symbols");
} else if (content.hasStacks()) {
tNBT.setTag("info", content.getInfoNBT());
- tNBT.setTag("content", content.toNBT());
+ tNBT.setTag("content", content.toNBT(TecTech.definitionsRegistry));
tNBT.setTag("symbols", content.getShortSymbolsNBT());
content.clear();
}
@@ -140,10 +140,10 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE
ItemStack that = new ItemStack(this, 1);
that.setTagCompound(new NBTTagCompound());
list.add(that);
- for(IEMDefinition definition: EMDefinitionsRegistry.getStacksRegisteredForDisplay()){
- 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))));
+ for(IEMDefinition definition: TecTech.definitionsRegistry.getStacksRegisteredForDisplay()){
+ list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.mbMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT))));
+ list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.itemMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_ITEM))));
+ list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1000+" "+translateToLocal("tt.keyword.mbMols")),new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_1k))));
}
}
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 2cca6474f4..f0f59e0e86 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
@@ -1,5 +1,6 @@
package com.github.technus.tectech.thing.item;
+import com.github.technus.tectech.TecTech;
import com.github.technus.tectech.util.CommonValues;
import com.github.technus.tectech.util.Util;
import com.github.technus.tectech.font.TecTechFontRender;
@@ -20,7 +21,7 @@ import java.util.List;
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.TecTech.creativeTabTecTech;
import static cpw.mods.fml.relauncher.Side.CLIENT;
import static net.minecraft.util.StatCollector.translateToLocal;
@@ -48,7 +49,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem
EMConstantStackMap oldMap =null;
if (tNBT.hasKey("content")) {
try {
- oldMap= EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content"));
+ oldMap= EMConstantStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content"));
} catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
@@ -56,7 +57,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem
}
}
tNBT.setTag("info", definitions.getInfoNBT());
- tNBT.setTag("content", definitions.toNBT());
+ tNBT.setTag("content", definitions.toNBT(TecTech.definitionsRegistry));
tNBT.setTag("symbols",definitions.getShortSymbolsNBT());
return oldMap;
}
@@ -71,7 +72,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem
return null;
}
try {
- return EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content"));
+ return EMConstantStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content"));
} catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
@@ -91,7 +92,7 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem
EMConstantStackMap oldMap =null;
if (tNBT.hasKey("content")) {
try {
- oldMap= EMConstantStackMap.fromNBT(tNBT.getCompoundTag("content"));
+ oldMap= EMConstantStackMap.fromNBT(TecTech.definitionsRegistry,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 e517fe5f2a..8b8133a1e2 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
@@ -25,7 +25,7 @@ import net.minecraft.world.World;
import java.util.List;
import static com.github.technus.tectech.Reference.MODID;
-import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech;
+import static com.github.technus.tectech.TecTech.creativeTabTecTech;
import static cpw.mods.fml.relauncher.Side.CLIENT;
import static net.minecraft.util.StatCollector.translateToLocal;
diff --git a/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java b/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java
index f4531a248b..4fca682268 100644
--- a/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java
+++ b/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java
@@ -22,7 +22,7 @@ import java.util.ArrayList;
import java.util.List;
import static com.github.technus.tectech.Reference.MODID;
-import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech;
+import static com.github.technus.tectech.TecTech.creativeTabTecTech;
import static net.minecraft.util.StatCollector.translateToLocal;
import static net.minecraft.util.StatCollector.translateToLocalFormatted;
diff --git a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java
index d71abb34b7..b74f40f336 100644
--- a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java
+++ b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java
@@ -12,7 +12,7 @@ import net.minecraft.world.World;
import java.util.List;
import static com.github.technus.tectech.Reference.MODID;
-import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech;
+import static com.github.technus.tectech.TecTech.creativeTabTecTech;
import static net.minecraft.util.StatCollector.translateToLocal;
/**
diff --git a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java
index 1d1da74a7a..7f9e0f0a4a 100644
--- a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java
+++ b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java
@@ -25,7 +25,7 @@ import net.minecraft.world.World;
import java.util.List;
import static com.github.technus.tectech.Reference.MODID;
-import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech;
+import static com.github.technus.tectech.TecTech.creativeTabTecTech;
import static com.github.technus.tectech.thing.CustomItemList.parametrizerMemory;
import static net.minecraft.util.StatCollector.translateToLocal;
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java
index 69ff06e9e7..bc853334d2 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java
@@ -193,7 +193,7 @@ public class Textures {
public static ITexture TESLA_TRANSCEIVER_TOP_BA = new GT_RenderedTexture(TESLA_TRANSCEIVER_TOP);
- public Textures(){
+ public static void run(){
for (byte i = 0; i < MACHINE_CASINGS_TT.length; i++) {
for (byte j = 0; j < MACHINE_CASINGS_TT[i].length; j++) {
MACHINE_CASINGS_TT[i][j] = new GT_SidedTexture(MACHINECASINGS_BOTTOM_TT[i], MACHINECASINGS_TOP_TT[i], MACHINECASINGS_SIDE_TT[i], Dyes.getModulation(j - 1, MACHINE_METAL.mRGBa));
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 0950a173ab..84f18ad2bf 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
@@ -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.EMTransformationInfo.AVOGADRO_CONSTANT_144;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED;
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;
@@ -83,7 +83,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta
//aNBT.setFloat("lifeTimeMult",lifeTimeMult);
aNBT.setDouble("OverflowMatter", overflowMatter);
content.cleanUp();
- aNBT.setTag("eM_Stacks", content.toNBT());
+ aNBT.setTag("eM_Stacks", content.toNBT(TecTech.definitionsRegistry));
aNBT.setShort("eID", id);
}
@@ -95,7 +95,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta
overflowMatter = aNBT.getFloat("overflowMatter")+aNBT.getDouble("OverflowMatter");
id = aNBT.getShort("eID");
try {
- content = EMInstanceStackMap.fromNBT(aNBT.getCompoundTag("eM_Stacks"));
+ content = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eM_Stacks"));
} catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
@@ -210,7 +210,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta
}
public double getMaxStackSize() {
- return mTier * (mTier - 7) * 64D * AVOGADRO_CONSTANT_144;
+ return mTier * (mTier - 7) * 64D * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED;
}
@Override
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 84dafb8db2..1978d2acfc 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
@@ -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.EMTransformationInfo.AVOGADRO_CONSTANT;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT;
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;
@@ -50,7 +50,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase
private static Textures.BlockIcons.CustomIcon ScreenOFF;
private static Textures.BlockIcons.CustomIcon ScreenON;
- public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10* AVOGADRO_CONSTANT;
+ public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10* EM_COUNT_PER_MATERIAL_AMOUNT;
private static final double URANIUM_MASS_TO_EU_PARTIAL = ConfigUtil.getDouble(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF;
public static final double URANIUM_MASS_TO_EU_INSTANT = URANIUM_MASS_TO_EU_PARTIAL * 20;
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 e769d3e480..7d5961f219 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.TecTech;
import com.github.technus.tectech.mechanics.constructable.IConstructable;
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.elementalMatter.core.transformations.EMDequantizationInfo;
+import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.OreDictionaryStack;
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;
@@ -100,38 +100,21 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo
for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) {
EMInstanceStackMap map = in.getContentHandler();
for (EMInstanceStack stack : map.valuesToArray()) {
- {
- EMFluidDequantizationInfo info = stack.getDefinition().someAmountIntoFluidStack();
- if (info != null) {
- if (map.removeAllAmounts(info.input())) {
- mOutputFluids = new FluidStack[]{info.output()};
- startRecipe(info.input(), stack.getEnergy());
- return true;
- }
- }
- }
- {
- EMItemDequantizationInfo info = stack.getDefinition().someAmountIntoItemsStack();
- if (info != null) {
- if (map.removeAllAmounts(info.input())) {
- mOutputItems = new ItemStack[]{info.output()};
- startRecipe(info.input(), stack.getEnergy());
- return true;
- }
- }
- }
- {
- EMOredictDequantizationInfo info = stack.getDefinition().someAmountIntoOredictStack();
- if (info != null) {
- 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());
- return true;
- }
+ EMDequantizationInfo emDequantizationInfo = TecTech.transformationInfo.getInfoMap().get(stack.getDefinition());
+ if(emDequantizationInfo!=null && emDequantizationInfo.getStack()!=null && map.removeAllAmounts(emDequantizationInfo.getInput())){
+ Object out=emDequantizationInfo.getStack();
+ if(out instanceof ItemStack){
+ mOutputItems=new ItemStack[]{emDequantizationInfo.getItem()};
+ }else if(out instanceof FluidStack){
+ mOutputFluids=new FluidStack[]{emDequantizationInfo.getFluid()};
+ }else if(out instanceof OreDictionaryStack){
+ ArrayList<ItemStack> items = OreDictionary.getOres(OreDictionary.getOreName(emDequantizationInfo.getOre().getOreId()));
+ if (items != null && !items.isEmpty()) {
+ mOutputItems = new ItemStack[]{items.get(0)};
}
}
+ startRecipe(emDequantizationInfo.getInput(), stack.getEnergy());
+ return true;
}
}
}
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 64949fe402..be036050be 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
@@ -31,7 +31,6 @@ import java.util.ArrayList;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.DEFAULT_ENERGY_LEVEL;
import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.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;
@@ -98,9 +97,9 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock
if (inI.length > 0) {
for (ItemStack is : inI) {
//ITEM STACK quantization
- EMItemQuantizationInfo aIQI = TRANSFORMATION_INFO.getItemQuantization().get(new EMItemQuantizationInfo(is, false, null));
+ EMItemQuantizationInfo aIQI = TecTech.transformationInfo.getItemQuantization().get(new EMItemQuantizationInfo(is, false, null));
if (aIQI == null) {
- aIQI = TRANSFORMATION_INFO.getItemQuantization().get(new EMItemQuantizationInfo(is, true, null));//todo check if works?
+ aIQI = TecTech.transformationInfo.getItemQuantization().get(new EMItemQuantizationInfo(is, true, null));//todo check if works?
}
if (aIQI == null) {
//ORE DICT quantization //todo fix for uranium?
@@ -109,11 +108,11 @@ 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));
}
- EMOredictQuantizationInfo aOQI = TRANSFORMATION_INFO.getOredictQuantization().get(ID);
+ EMOredictQuantizationInfo aOQI = TecTech.transformationInfo.getOredictQuantization().get(ID);
if (aOQI == null) {
continue;
}
- IEMStack into = aOQI.output();
+ IEMStack into = aOQI.getOut();
if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aOQI.getAmount(), is.getItemDamage())}, null, inI)) {
startRecipe(into);
return true;
@@ -136,7 +135,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock
FluidStack[] inF = storedFluids.toArray(nullFluid);
if (inF.length > 0) {
for (FluidStack fs : inF) {
- EMFluidQuantizationInfo aFQI = TRANSFORMATION_INFO.getFluidQuantization().get(fs.getFluid().getID());
+ EMFluidQuantizationInfo aFQI = TecTech.transformationInfo.getFluidQuantization().get(fs.getFluid().getID());
if (aFQI == null) {
continue;
}
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 74bb817142..89255b331a 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
@@ -309,7 +309,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa
NBTTagCompound tNBT = mInventory[1].getTagCompound();//code above makes it not null
tNBT.setString("eMachineType", machineType);
- tNBT.setTag(E_RECIPE_ID, objectResearched.toNBT());
+ tNBT.setTag(E_RECIPE_ID, objectResearched.toNBT(TecTech.definitionsRegistry));
tNBT.setString("author", EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.WHITE + ' ' + machineType + " EM Recipe Generator");
} else if (objectsScanned != null && CustomItemList.scanContainer.isStackEqual(mInventory[1], false, true)) {
ElementalDefinitionScanStorage_EM.setContent(mInventory[1], objectsScanned, scanComplexity);
@@ -387,7 +387,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa
aNBT.setLong("eComputationRemaining", computationRemaining);
aNBT.setLong("eComputationRequired", computationRequired);
if (objectResearched != null) {
- aNBT.setTag("eObject", objectResearched.toNBT());
+ aNBT.setTag("eObject", objectResearched.toNBT(TecTech.definitionsRegistry));
} else {
aNBT.removeTag("eObject");
}
@@ -397,7 +397,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa
aNBT.removeTag("eScanComplexity");
}
if (objectsScanned != null) {
- aNBT.setTag("eScanObjects", objectsScanned.toNBT());
+ aNBT.setTag("eScanObjects", objectsScanned.toNBT(TecTech.definitionsRegistry));
} else {
aNBT.removeTag("eScanObjects");
}
@@ -409,7 +409,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa
computationRemaining = aNBT.getLong("eComputationRemaining");
computationRequired = aNBT.getLong("eComputationRequired");
if (aNBT.hasKey("eObject")) {
- objectResearched = EMDefinitionStack.fromNBT(aNBT.getCompoundTag("eObject"));
+ objectResearched = EMDefinitionStack.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eObject"));
if (objectResearched.getDefinition() == nbtE__) {
objectResearched = null;
}
@@ -423,7 +423,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa
}
try {
if (aNBT.hasKey("eScanObjects")) {
- objectsScanned = EMInstanceStackMap.fromNBT(aNBT.getCompoundTag("eScanObjects"));
+ objectsScanned = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eScanObjects"));
}
} catch (EMException e) {
objectsScanned = new EMInstanceStackMap();
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 9a6f99bed8..2fe43cb8e1 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
@@ -757,7 +757,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
NBTTagCompound output = new NBTTagCompound();
for (int i = 0; i < outputEM.length; i++) {
if (outputEM[i] != null) {
- output.setTag(Integer.toString(i), outputEM[i].toNBT());
+ output.setTag(Integer.toString(i), outputEM[i].toNBT(TecTech.definitionsRegistry));
}
}
aNBT.setTag("outputEM", output);
@@ -847,7 +847,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
for (int i = 0; i < outputEM.length; i++) {
if (compound.hasKey(Integer.toString(i))) {
try {
- outputEM[i] = EMInstanceStackMap.fromNBT(compound.getCompoundTag(Integer.toString(i)));
+ outputEM[i] = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,compound.getCompoundTag(Integer.toString(i)));
} catch (EMException e) {
if (DEBUG_MODE) {
e.printStackTrace();
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/em_collider/GT_MetaTileEntity_EM_collider.java
index 3015d024c7..cf8f26ff02 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/em_collider/GT_MetaTileEntity_EM_collider.java
@@ -1,4 +1,4 @@
-package com.github.technus.tectech.thing.metaTileEntity.multi;
+package com.github.technus.tectech.thing.metaTileEntity.multi.em_collider;
import com.github.technus.tectech.TecTech;
import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition;
@@ -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.EMTransformationInfo.AVOGADRO_CONSTANT;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT;
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;
@@ -69,19 +69,11 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
//endregion
//region collision handlers
- public static final HashMap<Integer, IColliderHandler> FUSE_HANDLERS = new HashMap<>();
+ public static final HashMap<Long, IColliderHandler> FUSE_HANDLERS = new HashMap<>();
public static final HashMap<String, IPrimitiveColliderHandler> PRIMITIVE_FUSE_HANDLERS = new HashMap<>();
- public interface IPrimitiveColliderHandler {
- void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out);
- }
-
- public interface IColliderHandler extends IPrimitiveColliderHandler {
- byte getRequiredTier();
- }
-
static {
- FUSE_HANDLERS.put((EMAtomDefinition.getClassTypeStatic() << 16) | EMAtomDefinition.getClassTypeStatic(), new IColliderHandler() {
+ FUSE_HANDLERS.put(((long) EMAtomDefinition.getClassTypeStatic() << 16) | EMAtomDefinition.getClassTypeStatic(), new IColliderHandler() {
@Override
public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) {
try {
@@ -110,7 +102,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
registerSimpleAtomFuse(EMComplexAspectDefinition.getClassTypeStatic());
registerSimpleAtomFuse(EMPrimitiveTemplate.getClassTypeStatic());
- FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMHadronDefinition.getClassTypeStatic(), new IColliderHandler() {
+ FUSE_HANDLERS.put(((long) EMHadronDefinition.getClassTypeStatic() << 16) | EMHadronDefinition.getClassTypeStatic(), new IColliderHandler() {
@Override
public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) {
try {
@@ -135,7 +127,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
return 2;
}
});
- FUSE_HANDLERS.put((EMHadronDefinition.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() {
+ FUSE_HANDLERS.put(((long) EMHadronDefinition.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() {
@Override
public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) {
try {
@@ -164,7 +156,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
registerSimpleAspectFuse(EMComplexAspectDefinition.getClassTypeStatic());
registerSimpleAspectFuse(EMPrimitiveTemplate.getClassTypeStatic());
- FUSE_HANDLERS.put((EMPrimitiveTemplate.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() {
+ FUSE_HANDLERS.put(((long) EMPrimitiveTemplate.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() {
@Override
public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) {
IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get(in1.getDefinition().getClass().getName() + '\0' + in2.getDefinition().getClass().getName());
@@ -222,8 +214,8 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
return false;
}
- private static void registerSimpleAspectFuse(byte classTypeStatic) {
- FUSE_HANDLERS.put((EMComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() {
+ private static void registerSimpleAspectFuse(int classTypeStatic) {
+ FUSE_HANDLERS.put(((long) EMComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() {
@Override
public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) {
if (fuseAspects(in1, in2, out)) return;
@@ -241,8 +233,8 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
});
}
- private static void registerSimpleAtomFuse(byte classTypeStatic) {
- FUSE_HANDLERS.put((EMAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() {
+ private static void registerSimpleAtomFuse(int classTypeStatic) {
+ FUSE_HANDLERS.put(((long) EMAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() {
@Override
public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) {
try {
@@ -370,7 +362,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
}
public static void setValues(int heliumPlasmaValue) {
- double MASS_TO_EU_PARTIAL = heliumPlasmaValue / (1.75893000478707E07* AVOGADRO_CONSTANT);//mass diff
+ double MASS_TO_EU_PARTIAL = heliumPlasmaValue / (1.75893000478707E07* EM_COUNT_PER_MATERIAL_AMOUNT);//mass diff
MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20;
STARTUP_COST = -heliumPlasmaValue * 10000;
KEEPUP_COST = -heliumPlasmaValue;
@@ -387,11 +379,11 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
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 (stack2.getDefinition().getMatterMassType() > stack.getDefinition().getMatterMassType()) {//always bigger first
+ colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getMatterMassType() << 16) | stack.getDefinition().getMatterMassType());
if (handleRecipe(stack2, map, colliderHandler)) return 0;
} else {
- colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getClassType() << 16) | stack2.getDefinition().getClassType());
+ colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getMatterMassType() << 16) | stack2.getDefinition().getMatterMassType());
if (handleRecipe(stack2, map, colliderHandler)) return 0;
}
for (EMInstanceStack newStack : map.valuesToArray()) {
@@ -416,11 +408,11 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
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 (stack2.getDefinition().getMatterMassType() > stack.getDefinition().getMatterMassType()) {//always bigger first
+ colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getMatterMassType() << 16) | stack.getDefinition().getMatterMassType());
if (handleRecipe(stack2, map, colliderHandler)) return 0;
} else {
- colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getClassType() << 16) | stack2.getDefinition().getClassType());
+ colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getMatterMassType() << 16) | stack2.getDefinition().getMatterMassType());
if (handleRecipe(stack2, map, colliderHandler)) return 0;
}
//System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass());
@@ -649,7 +641,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
aNBT.setByte("eTier", eTier);//collider tier
aNBT.setBoolean("eStarted", started);
if (stack != null) {
- aNBT.setTag("eStack", stack.toNBT());
+ aNBT.setTag("eStack", stack.toNBT(TecTech.definitionsRegistry));
}
aNBT.setLong("ePlasmaEnergy", plasmaEnergy);
}
@@ -660,7 +652,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 = EMInstanceStack.fromNBT(aNBT.getCompoundTag("eStack"));
+ stack = EMInstanceStack.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eStack"));
}
plasmaEnergy = aNBT.getLong("ePlasmaEnergy");
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java
new file mode 100644
index 0000000000..0114ac847b
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java
@@ -0,0 +1,5 @@
+package com.github.technus.tectech.thing.metaTileEntity.multi.em_collider;
+
+public interface IColliderHandler extends IPrimitiveColliderHandler {
+ byte getRequiredTier();
+}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java
new file mode 100644
index 0000000000..3c4438b5e1
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java
@@ -0,0 +1,8 @@
+package com.github.technus.tectech.thing.metaTileEntity.multi.em_collider;
+
+import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap;
+import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack;
+
+public interface IPrimitiveColliderHandler {
+ void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out);
+}
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 d1eafa22fc..e6e618a31c 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
@@ -12,8 +12,7 @@ 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.EMTransformationInfo.AVOGADRO_CONSTANT_144;
-import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY;
+import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED;
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.*;
@@ -77,7 +76,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav
maxRPM = Math.sqrt(maxRCF / (0.001118D * radius));
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
+ maxCapacity = maxSafeMass * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * radius;// eV/c^2
}
private double getRCF(double RPM) {
@@ -128,7 +127,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav
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) {
+ if (randomStack.isInvalidAmount()) {
input.removeKey(randomStack.getDefinition());
stacks = input.valuesToArray();
}
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 70d93b36ed..3d1259f808 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
@@ -9,10 +9,9 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunctio
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.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.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED;
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.mul;
import static com.github.technus.tectech.util.DoubleCount.sub;
@@ -89,7 +88,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= EMAtomDefinition.getSomethingHeavy().getMass()*(2<<tier)* AVOGADRO_CONSTANT_144;
+ maxCapacity= EMAtomDefinition.getSomethingHeavy().getMass()*(2<<tier)* EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED;
maxCharge=144D*(1<<(tier-5));
switch (tier){
case 12:
@@ -159,7 +158,7 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_
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) {
+ if (randomStack.isInvalidAmount()) {
input.removeKey(randomStack.getDefinition());
}
double mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove;
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 576123079c..f5c391ab43 100644
--- a/src/main/java/com/github/technus/tectech/util/DoubleCount.java
+++ b/src/main/java/com/github/technus/tectech/util/DoubleCount.java
@@ -102,6 +102,9 @@ public class DoubleCount {
return count - value;
} else {
double result = count - value;
+ if(result==count||result==value){
+ return result;
+ }
return result - ulpSigned(result);
}
}
@@ -111,6 +114,9 @@ public class DoubleCount {
return count + value;
} else {
double result = count + value;
+ if(result==count||result==value){
+ return result;
+ }
return result - ulpSigned(result);
}
}
diff --git a/src/main/java/com/github/technus/tectech/util/Util.java b/src/main/java/com/github/technus/tectech/util/Util.java
index 1843770e3a..78522a2ae8 100644
--- a/src/main/java/com/github/technus/tectech/util/Util.java
+++ b/src/main/java/com/github/technus/tectech/util/Util.java
@@ -561,4 +561,16 @@ public final class Util {
int z=chunk.zPosition<<4;
return AxisAlignedBB.getBoundingBox(x,-128,z,x+16,512,z+16);
}
+
+ public static String getConcated(String[] strings,String separator){
+ StringBuilder stringBuilder = new StringBuilder();
+ for (String string : strings) {
+ stringBuilder.append(string).append(separator);
+ }
+ int length = stringBuilder.length();
+ if(length >=separator.length()){
+ stringBuilder.setLength(length -separator.length());
+ }
+ return stringBuilder.toString();
+ }
}