From b5399199a88d7c6c19a2ed494aa9c66b81bf2249 Mon Sep 17 00:00:00 2001 From: Tec Date: Sat, 22 Jan 2022 23:33:56 +0100 Subject: Rework API, add locale --- .../java/com/github/technus/tectech/TecTech.java | 19 +- .../dreamcraft/DreamCraftRecipeLoader.java | 8 +- .../tectech/compatibility/gtpp/GtppAtomLoader.java | 68 +- .../blocks/turretbases/TurretBaseEM.java | 2 +- .../blocks/turretheads/TurretHeadEM.java | 2 +- .../entity/projectiles/projectileEM.java | 4 +- .../tileentity/turret/TileTurretHeadEM.java | 6 +- .../spartakcore/SpartakCoreRecipeLoader.java | 9 +- .../definitions/EMComplexAspectDefinition.java | 78 +- .../definitions/EMPrimalAspectDefinition.java | 41 +- .../transformations/AspectDefinitionCompat.java | 7 +- .../AspectDefinitionCompatEnabled.java | 11 +- .../GT_MetaTileEntity_EM_essentiaDequantizer.java | 8 +- .../GT_MetaTileEntity_EM_essentiaQuantizer.java | 4 +- .../technus/tectech/loader/ElementalLoader.java | 29 +- .../github/technus/tectech/loader/MainLoader.java | 26 +- .../tectech/loader/gui/CreativeTabTecTech.java | 2 - .../tectech/loader/recipe/BaseRecipeLoader.java | 125 +++ .../tectech/loader/recipe/BloodyRecipeLoader.java | 6 +- .../tectech/loader/recipe/RecipeLoader.java | 121 -- .../tectech/loader/thing/MachineLoader.java | 15 +- .../tectech/mechanics/anomaly/AnomalyHandler.java | 14 +- .../elementalMatter/core/EMException.java | 3 - .../elementalMatter/core/commands/EMGive.java | 118 +- .../elementalMatter/core/commands/EMList.java | 56 +- .../core/definitions/EMComplexTemplate.java | 20 +- .../core/definitions/EMDefinitionsRegistry.java | 110 -- .../core/definitions/EMPrimitiveTemplate.java | 67 +- .../core/definitions/IEMDefinition.java | 32 +- .../registry/EMDefinitionsRegistry.java | 189 ++++ .../core/definitions/registry/EMIndirectType.java | 37 + .../core/definitions/registry/EMType.java | 63 ++ .../core/maps/EMConstantStackMap.java | 5 +- .../core/maps/EMDefinitionStackMap.java | 5 +- .../core/maps/EMInstanceStackMap.java | 32 +- .../elementalMatter/core/maps/IEMMapRead.java | 20 +- .../elementalMatter/core/maps/IEMMapWrite.java | 12 +- .../core/maps/IEMMapWriteExact.java | 6 +- .../core/stacks/EMDefinitionStack.java | 10 +- .../core/stacks/EMInstanceStack.java | 61 +- .../elementalMatter/core/stacks/IEMStack.java | 33 +- .../core/transformations/EMDequantizationInfo.java | 56 + .../transformations/EMFluidDequantizationInfo.java | 43 - .../transformations/EMFluidQuantizationInfo.java | 4 +- .../transformations/EMItemDequantizationInfo.java | 45 - .../transformations/EMItemQuantizationInfo.java | 4 +- .../EMOredictDequantizationInfo.java | 60 - .../transformations/EMOredictQuantizationInfo.java | 41 +- .../core/transformations/EMTransformationInfo.java | 165 --- .../transformations/EMTransformationRegistry.java | 134 +++ .../core/transformations/IEMExchangeInfo.java | 11 - .../core/transformations/OreDictionaryStack.java | 19 + .../definitions/complex/EMAtomDefinition.java | 1187 ++++++++++---------- .../definitions/complex/EMHadronDefinition.java | 229 ++-- .../definitions/primitive/EMBosonDefinition.java | 38 +- .../definitions/primitive/EMFermionDefinition.java | 16 + .../primitive/EMGaugeBosonDefinition.java | 83 ++ .../definitions/primitive/EMLeptonDefinition.java | 43 +- .../primitive/EMNeutrinoDefinition.java | 41 +- .../primitive/EMPrimitiveDefinition.java | 50 +- .../definitions/primitive/EMQuarkDefinition.java | 87 +- .../primitive/EMScalarBosonDefinition.java | 46 + .../github/technus/tectech/recipe/TT_recipe.java | 19 +- .../tectech/thing/block/QuantumGlassBlock.java | 2 +- .../tectech/thing/casing/GT_Block_CasingsNH.java | 2 +- .../tectech/thing/casing/GT_Block_CasingsTT.java | 2 +- .../tectech/thing/casing/GT_Block_HintTT.java | 2 +- .../technus/tectech/thing/item/AvrProgrammer.java | 2 +- .../thing/item/ConstructableTriggerItem.java | 2 +- .../item/DebugElementalInstanceContainer_EM.java | 32 +- .../item/ElementalDefinitionContainer_EM.java | 11 +- .../item/ElementalDefinitionScanStorage_EM.java | 2 +- .../technus/tectech/thing/item/EuMeterGT.java | 2 +- .../thing/item/FrontRotationTriggerItem.java | 2 +- .../tectech/thing/item/ParametrizerMemoryCard.java | 2 +- .../tectech/thing/metaTileEntity/Textures.java | 2 +- ...GT_MetaTileEntity_Hatch_ElementalContainer.java | 8 +- .../multi/GT_MetaTileEntity_EM_collider.java | 717 ------------ .../multi/GT_MetaTileEntity_EM_decay.java | 4 +- .../multi/GT_MetaTileEntity_EM_dequantizer.java | 49 +- .../multi/GT_MetaTileEntity_EM_quantizer.java | 11 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 10 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 4 +- .../em_collider/GT_MetaTileEntity_EM_collider.java | 709 ++++++++++++ .../multi/em_collider/IColliderHandler.java | 5 + .../em_collider/IPrimitiveColliderHandler.java | 8 + .../multi/em_machine/Behaviour_Centrifuge.java | 7 +- .../Behaviour_ElectromagneticSeparator.java | 9 +- .../github/technus/tectech/util/DoubleCount.java | 6 + .../java/com/github/technus/tectech/util/Util.java | 12 + src/main/resources/assets/tectech/lang/en_US.lang | 103 +- 91 files changed, 2929 insertions(+), 2703 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java delete mode 100644 src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMDefinitionsRegistry.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictDequantizationInfo.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/IEMExchangeInfo.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java create mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java (limited to 'src') 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() { @Override public int size() { return 0; @@ -123,8 +130,8 @@ public class TecTech { } @Override - public Iterator iterator() { - return new Iterator() { + public Iterator iterator() { + return new Iterator() { @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 @@ -218,45 +200,25 @@ public final class EMComplexAspectDefinition extends EMComplexTemplate { return mass; } - @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 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 defToAspect = new HashMap<>(); private final HashMap 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/BaseRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java new file mode 100644 index 0000000000..d91d0e5900 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java @@ -0,0 +1,125 @@ +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; +import com.github.technus.tectech.thing.casing.TT_Container_Casings; +import com.github.technus.tectech.thing.item.ConstructableTriggerItem; +import com.github.technus.tectech.thing.item.EuMeterGT; +import com.github.technus.tectech.thing.item.FrontRotationTriggerItem; +import cpw.mods.fml.common.Loader; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +import static gregtech.api.enums.GT_Values.RA; + +/** + * Created by danie_000 on 16.11.2016. + */ +public class BaseRecipeLoader { + public static Materials getOrDefault(String name,Materials def){ + Materials mat=Materials.get(name); + return mat == Materials._NULL || mat == null ? def : mat; + } + + 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 + // =================================================================================================== + + for(int i=0;i<=15;i++) { + RA.addAssemblerRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(i), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cobalt, 1)}, Materials.Aluminium.getMolten(864), new ItemStack(TT_Container_Casings.sHintCasingsTT, 1, i), 32, 120); + } + + //Scrench + GT_ModHandler.addCraftingRecipe(new ItemStack(FrontRotationTriggerItem.INSTANCE,1), + GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[]{"fPR", " RP", "S h", +