diff options
Diffstat (limited to 'src/main/java')
119 files changed, 6438 insertions, 1993 deletions
diff --git a/src/main/java/com/github/technus/tectech/CommonValues.java b/src/main/java/com/github/technus/tectech/CommonValues.java index aba9944770..cc6957cf56 100644 --- a/src/main/java/com/github/technus/tectech/CommonValues.java +++ b/src/main/java/com/github/technus/tectech/CommonValues.java @@ -6,7 +6,11 @@ import net.minecraft.util.EnumChatFormatting; * Created by danie_000 on 11.01.2017. */ public final class CommonValues { - public final static String TEC_MARK = + public final static String TEC_MARK_GENERAL = + EnumChatFormatting.BLUE + "Tec" + + EnumChatFormatting.DARK_BLUE + "Tech" + + EnumChatFormatting.BLUE + ": Interdimensional"; + public final static String TEC_MARK_EM = EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.BLUE + ": Elemental Matter"; diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 3f8f0549c0..df45b6585a 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -2,8 +2,6 @@ package com.github.technus.tectech; import com.github.technus.tectech.auxiliary.Reference; import com.github.technus.tectech.auxiliary.TecTechConfig; -import com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition; -import com.github.technus.tectech.loader.AtomOverrider; import com.github.technus.tectech.loader.MainLoader; import com.github.technus.tectech.proxy.CommonProxy; import cpw.mods.fml.common.Loader; @@ -30,7 +28,7 @@ import java.util.HashSet; import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; @Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, dependencies = "required-after:Forge@[10.13.4.1614,);" - + "required-after:YAMCore@[0.5.70,);" + "required-after:gregtech;" + "after:CoFHCore;" + "after:Thaumcraft;" + "after:dreamcraft;" + "after:miscutils;") + + "required-after:YAMCore@[0.5.70,);" + "required-after:gregtech;" + "after:CoFHCore;" + "after:Thaumcraft;" + "after:dreamcraft;") public class TecTech { @SidedProxy(clientSide = Reference.CLIENTSIDE, serverSide = Reference.SERVERSIDE) public static CommonProxy proxy; @@ -38,11 +36,11 @@ public class TecTech { @Instance(Reference.MODID) public static TecTech instance; + public static final XSTR Rnd = XSTR.XSTR_INSTANCE; public static final LogHelper Logger = new LogHelper(Reference.MODID); private static IngameErrorLog Module_AdminErrorLogs = null; public static MainLoader GTCustomLoader = null; public static TecTechConfig ModConfig; - public static XSTR Rnd = null; public static CreativeTabs mainTab = null; public static boolean hasCOFH = false, hasThaumcraft = false; @@ -57,7 +55,6 @@ public class TecTech { @EventHandler public void PreLoad(FMLPreInitializationEvent PreEvent) { Logger.setDebugOutput(true); - Rnd = new XSTR(); ModConfig = new TecTechConfig(PreEvent.getModConfigurationDirectory(), Reference.COLLECTIONNAME, Reference.MODID); @@ -74,7 +71,6 @@ public class TecTech { GTCustomLoader = new MainLoader(); - dAtomDefinition.overrides.add(new AtomOverrider()); TecTech.Logger.info("Added Atom Overrider"); } @@ -171,8 +167,6 @@ public class TecTech { modId = GameRegistry.findUniqueIdentifierFor(block).modId; if (modIDs.contains(modId)) {//Full Whitelisted Mods continue; - } else if (modId.equals("TConstruct")) { - block.slipperiness = 1;//cos we know it is slippery, right Greg? } else if (modId.equals("OpenBlocks")) { if (GameRegistry.findUniqueIdentifierFor(block).name.equals("grave")) continue; diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java index d1a45ec657..aa3f8eee1d 100644 --- a/src/main/java/com/github/technus/tectech/Util.java +++ b/src/main/java/com/github/technus/tectech/Util.java @@ -11,9 +11,11 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; +import org.apache.commons.lang3.StringUtils; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -29,14 +31,14 @@ import static gregtech.api.enums.GT_Values.E; * Created by Tec on 21.03.2017. */ public class Util { - public static String intToString(int number, int groupSize) { + public static String intBitsToString(int number) { StringBuilder result = new StringBuilder(); for (int i = 31; i >= 0; i--) { int mask = 1 << i; result.append((number & mask) != 0 ? "1" : "0"); - if (i % groupSize == 0) + if (i % 8 == 0) result.append(" "); } result.replace(result.length() - 1, result.length(), ""); @@ -44,6 +46,21 @@ public class Util { return result.toString(); } + public static String intBitsToShortString(int number) { + StringBuilder result = new StringBuilder(); + + for (int i = 31; i >= 0; i--) { + int mask = 1 << i; + result.append((number & mask) != 0 ? ":" : "."); + + if (i % 8 == 0) + result.append("|"); + } + result.replace(result.length() - 1, result.length(), ""); + + return result.toString(); + } + //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller //This only checks for REGULAR BLOCKS! public static boolean StructureChecker(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks @@ -322,7 +339,7 @@ public class Util { TileEntity tileEntity, int facing, boolean hintsOnly) { if(!tileEntity.hasWorldObj()) return false; World world = tileEntity.getWorldObj(); - if ((world.isRemote && !hintsOnly)||(!world.isRemote && hintsOnly)) return false; + if (!world.isRemote && hintsOnly) return false; //TE Rotation @@ -403,7 +420,8 @@ public class Util { break; default: //check for block if ((pointer = block - '0') >= 0) { - TecTech.proxy.hint_particle(world,x, y, z, blockType[pointer], blockMeta[pointer]); + if(world.getBlock(x,y,z)!=blockType[pointer] || world.getBlockMetadata(x,y,z)!=blockMeta[pointer]) + TecTech.proxy.hint_particle(world,x, y, z, blockType[pointer], blockMeta[pointer]); } else if ((pointer = block - ' ') >= 0) { switch(pointer){ case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: @@ -424,11 +442,11 @@ public class Util { if ((pointer = block - '0') >= 0) { world.setBlock(x, y, z, blockType[pointer], blockMeta[pointer], 2); } else if ((pointer = block - ' ') >= 0) { - switch(pointer){ - case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: - world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, pointer, 2); break; - default:world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, 12, 2); - } + //switch(pointer){ + // case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: + // world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, pointer, 2); break; + // default:world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, 12, 2); + //} } else world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, 15,2); } } @@ -801,4 +819,27 @@ public class Util { return i; } + + public static String[] splitButDifferent(String string,String delimiter){ + String[] strings= new String[StringUtils.countMatches(string,delimiter)+1]; + int lastEnd=0; + for(int i=0;i<strings.length-1;i++){ + int nextEnd=string.indexOf(delimiter,lastEnd); + strings[i]=string.substring(lastEnd,nextEnd); + lastEnd=nextEnd+delimiter.length(); + } + strings[strings.length-1]=string.substring(lastEnd); + return strings; + } + + public static String[] infoFromNBT(NBTTagCompound nbt) { + final String[] strings = new String[nbt.getInteger("i")]; + for (int i = 0; i < strings.length; i++) + strings[i] = nbt.getString(Integer.toString(i)); + return strings; + } + + public static boolean areBitsSet(int setBits,int testedValue){ + return (testedValue&setBits)==setBits; + } } diff --git a/src/main/java/com/github/technus/tectech/XSTR.java b/src/main/java/com/github/technus/tectech/XSTR.java index 4fa4b98fbd..cb19449d85 100644 --- a/src/main/java/com/github/technus/tectech/XSTR.java +++ b/src/main/java/com/github/technus/tectech/XSTR.java @@ -43,6 +43,14 @@ public class XSTR extends Random { private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL; private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) + private static final AtomicLong seedUniquifier = new AtomicLong(8682522807148012L); + public final static XSTR XSTR_INSTANCE=new XSTR(){ + @Override + public synchronized void setSeed(long seed) { + if(!Thread.currentThread().getStackTrace()[2].getClassName().equals(Random.class.getName())) + throw new NoSuchMethodError("This is meant to be shared!, leave seed state alone!"); + } + }; /* MODIFIED BY: Robotia @@ -58,9 +66,6 @@ public class XSTR extends Random { this(seedUniquifier() ^ System.nanoTime()); } - private static final AtomicLong seedUniquifier - = new AtomicLong(8682522807148012L); - private static long seedUniquifier() { // L'Ecuyer, "Tables of Linear Congruential Generators of // Different Sizes and Good Lattice Structure", 1999 @@ -115,8 +120,8 @@ public class XSTR extends Random { * @return Returns an XSRandom object with the same state as the original */ @Override - public gregtech.api.objects.XSTR clone() { - return new gregtech.api.objects.XSTR(getSeed()); + public XSTR clone() { + return new XSTR(getSeed()); } /** @@ -137,8 +142,8 @@ public class XSTR extends Random { return (int) x; } - boolean haveNextNextGaussian = false; - double nextNextGaussian = 0; + private boolean haveNextNextGaussian = false; + private double nextNextGaussian = 0; synchronized public double nextGaussian() { // See Knuth, ACP, Section 3.4.1 Algorithm C. diff --git a/src/main/java/com/github/technus/tectech/auxiliary/TecTechConfig.java b/src/main/java/com/github/technus/tectech/auxiliary/TecTechConfig.java index 87a2cdc54b..f5963a070c 100644 --- a/src/main/java/com/github/technus/tectech/auxiliary/TecTechConfig.java +++ b/src/main/java/com/github/technus/tectech/auxiliary/TecTechConfig.java @@ -55,4 +55,4 @@ public class TecTechConfig extends ConfigManager { protected void PostInit() { } -}
\ No newline at end of file +} 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 c870d7d829..7bf0b43cb6 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,11 +1,411 @@ package com.github.technus.tectech.compatibility.dreamcraft; +import com.github.technus.tectech.recipe.TT_recipeAdder; +import com.github.technus.tectech.thing.CustomItemList; +import com.github.technus.tectech.thing.block.QuantumGlassBlock; +import com.github.technus.tectech.thing.item.ConstructableTriggerItem; +import gregtech.api.enums.*; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + /** * Created by Tec on 06.08.2017. */ public class DreamCraftRecipeLoader implements Runnable { @Override public void run() { + Object[] o = new Object[0]; + + //Quantum Glass + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Containment.get(1, o), + GT_ModHandler.getIC2Item("reinforcedGlass", 1L) + }, Materials.Trinium.getMolten(576), new ItemStack(QuantumGlassBlock.INSTANCE, 1), 200, 500000); + + //BLUEprint + GT_ModHandler.addShapelessCraftingRecipe(new ItemStack(ConstructableTriggerItem.INSTANCE, 1), + GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[]{Dyes.dyeBlue, OrePrefixes.plate.get(Materials.Paper), Dyes.dyeBlue, Dyes.dyeWhite}); + + //region pipes + + //Data + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + ItemList.Circuit_Parts_GlassFiber.get(8, o), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silver, 8) + }, Materials.Polytetrafluoroethylene.getMolten(144), CustomItemList.DATApipe.get(1, o), 200, 30720, true); + + //endregion + + + //region casing + + //High Power Casing + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Iridium, 1), + GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Iridium, 6), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 1), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Cobalt, 16), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 16), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.NiobiumTitanium, 2) + }, Materials.TungstenSteel.getMolten(576), CustomItemList.eM_Power.get(1, o), 100, 30720); + + //Computer Casing + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Power.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.StainlessSteel, 8), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 1), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.NiobiumTitanium, 2) + }, Materials.Aluminium.getMolten(1296), CustomItemList.eM_Computer_Casing.get(1, o), 200, 122880); + //Computer Vent Casing + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.StainlessSteel, 1), + ItemList.Electric_Motor_IV.get(2, o), + GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.StainlessSteel, 2), + GT_OreDictUnificator.get(OrePrefixes.pipeTiny, Materials.StainlessSteel, 16), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Copper, 16), + GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Superconductor, 1) + }, Materials.SolderingAlloy.getMolten(1296), CustomItemList.eM_Computer_Vent.get(1, o), 100, 1920); + //Advanced Computer Casing + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Computer_Casing.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 1), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Cobalt, 64), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Electrum, 64), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Superconductor, 4) + }, Materials.Iridium.getMolten(1296), CustomItemList.eM_Computer_Bus.get(1, o), 200, 122880, true); + + //Molecular Casing + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Power.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Osmiridium, 6), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Trinium, 12), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.TungstenSteel, 24), + GT_OreDictUnificator.get(OrePrefixes.ring, Materials.TungstenSteel, 24), + ItemList.Field_Generator_IV.get(1, o) + }, Materials.Osmium.getMolten(1296), CustomItemList.eM_Containment.get(1, o), 800, 500000); + + //Hollow Casing + TT_recipeAdder.addResearchableAssemblylineRecipe(CustomItemList.eM_Containment.get(1), + 12000,32, 500000, 6, new ItemStack[]{ + CustomItemList.eM_Containment.get(1), + GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Neutronium, 2), + GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, Materials.Plutonium, 4), + GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Lead, 8), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 16), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Quantium, 16), + }, new FluidStack[]{ + Materials.Trinium.getMolten(1296), + Materials.Osmium.getMolten(1296), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Argon.getGas(576), + }, CustomItemList.eM_Hollow.get(2), 200, 2000000); + + //EM Coil + TT_recipeAdder.addResearchableAssemblylineRecipe(CustomItemList.eM_Hollow.get(1), + 48000,128, 1000000, 16, new ItemStack[]{ + CustomItemList.eM_Hollow.get(1), + ItemList.Casing_Fusion_Coil.get(4), + ItemList.Casing_Coil_NaquadahAlloy.get( 4), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Neutronium, 64), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Neutronium, 64), + }, new FluidStack[]{ + Materials.Glass.getMolten(2304), + Materials.Silicone.getMolten(1872), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Trinium.getMolten(1296), + }, CustomItemList.eM_Coil.get(4), 800, 2000000); + + //endregion + + + //region hatches + + //Dynamo Hatches UV-UIV + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Dynamo_UV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2)}, Materials.Silver.getMolten(1000), CustomItemList.eM_dynamomulti4_UV.get(1, o), 100, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_MAX_UV.get(1, o), CustomItemList.eM_dynamomulti4_UV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 4)}, Materials.Electrum.getMolten(1000), CustomItemList.eM_dynamomulti16_UV.get(1, o), 200, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UHV_UV.get(1, o), CustomItemList.eM_dynamomulti16_UV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 6)}, Materials.Tungsten.getMolten(1000), CustomItemList.eM_dynamomulti64_UV.get(1, o), 400, 122880); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Dynamo_MAX.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2)}, Materials.Silver.getMolten(2000), CustomItemList.eM_dynamomulti4_UHV.get(1, o), 100, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Transformer_UEV_UHV.get(1, o), CustomItemList.eM_dynamomulti4_UHV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 4)}, Materials.Electrum.getMolten(2000), CustomItemList.eM_dynamomulti16_UHV.get(1, o), 200, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UEV_UHV.get(1, o), CustomItemList.eM_dynamomulti16_UHV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 6)}, Materials.Tungsten.getMolten(2000), CustomItemList.eM_dynamomulti64_UHV.get(1, o), 400, 500000); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Hatch_Dynamo_UEV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Bedrockium, 2)}, Materials.Silver.getMolten(4000), CustomItemList.eM_dynamomulti4_UEV.get(1, o), 100, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Transformer_UIV_UEV.get(1, o), CustomItemList.eM_dynamomulti4_UEV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Bedrockium, 4)}, Materials.Electrum.getMolten(4000), CustomItemList.eM_dynamomulti16_UEV.get(1, o), 200, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UIV_UEV.get(1, o), CustomItemList.eM_dynamomulti16_UEV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Bedrockium, 6)}, Materials.Tungsten.getMolten(4000), CustomItemList.eM_dynamomulti64_UEV.get(1, o), 400, 2000000); + + //GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Hatch_Dynamo_UIV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 2)}, Materials.Silver.getMolten(8000), CustomItemList.eM_dynamomulti4_UIV.get(1, o), 100, 8000000); + //GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Transformer_UMV_UIV.get(1, o), CustomItemList.eM_dynamomulti4_UIV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 4)}, Materials.Electrum.getMolten(8000), CustomItemList.eM_dynamomulti16_UIV.get(1, o), 200, 8000000); + //GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UMV_UIV.get(1, o), CustomItemList.eM_dynamomulti16_UIV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_dynamomulti64_UIV.get(1, o), 400, 8000000); + + //Energy Hatches UV-UIV + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_UV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2)}, Materials.Silver.getMolten(1000), CustomItemList.eM_energymulti4_UV.get(1, o), 100, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_MAX_UV.get(1, o), CustomItemList.eM_energymulti4_UV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 4)}, Materials.Electrum.getMolten(1000), CustomItemList.eM_energymulti16_UV.get(1, o), 200, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UHV_UV.get(1, o), CustomItemList.eM_energymulti16_UV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 6)}, Materials.Tungsten.getMolten(1000), CustomItemList.eM_energymulti64_UV.get(1, o), 400, 122880); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_MAX.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2)}, Materials.Silver.getMolten(2000), CustomItemList.eM_energymulti4_UHV.get(1, o), 100, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Transformer_UEV_UHV.get(1, o), CustomItemList.eM_energymulti4_UHV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 4)}, Materials.Electrum.getMolten(2000), CustomItemList.eM_energymulti16_UHV.get(1, o), 200, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UEV_UHV.get(1, o), CustomItemList.eM_energymulti16_UHV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 6)}, Materials.Tungsten.getMolten(2000), CustomItemList.eM_energymulti64_UHV.get(1, o), 400, 500000); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Hatch_Energy_UEV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Bedrockium, 2)}, Materials.Silver.getMolten(4000), CustomItemList.eM_energymulti4_UEV.get(1, o), 100, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Transformer_UIV_UEV.get(1, o), CustomItemList.eM_energymulti4_UEV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Bedrockium, 4)}, Materials.Electrum.getMolten(4000), CustomItemList.eM_energymulti16_UEV.get(1, o), 200, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UIV_UEV.get(1, o), CustomItemList.eM_energymulti16_UEV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Bedrockium, 6)}, Materials.Tungsten.getMolten(4000), CustomItemList.eM_energymulti64_UEV.get(1, o), 400, 2000000); + + //GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Hatch_Energy_UIV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 2)}, Materials.Silver.getMolten(8000), CustomItemList.eM_energymulti4_UIV.get(1, o), 100, 8000000); + //GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Transformer_UMV_UIV.get(1, o), CustomItemList.eM_energymulti4_UIV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 4)}, Materials.Electrum.getMolten(8000), CustomItemList.eM_energymulti16_UIV.get(1, o), 200, 8000000); + //GT_Values.RA.addAssemblerRecipe(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UMV_UIV.get(1, o), CustomItemList.eM_energymulti16_UIV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BlackPlutonium, 6)}, Materials.Tungsten.getMolten(8000), CustomItemList.eM_energymulti64_UIV.get(1, o), 400, 8000000); + + //Data Input + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Computer_Casing.get(1, o), + ItemList.Hatch_Input_Bus_LuV.get(1, o), + ItemList.Circuit_Crystalcomputer.get(1, o), + CustomItemList.DATApipe.get(2, o) + }, Materials.Iridium.getMolten(1296), CustomItemList.dataIn_Hatch.get(1, o), 200, 122880, true); + //Data Output + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Computer_Casing.get(1, o), + ItemList.Hatch_Output_Bus_LuV.get(1, o), + ItemList.Circuit_Crystalcomputer.get(1, o), + CustomItemList.DATApipe.get(2, o) + }, Materials.Iridium.getMolten(1296), CustomItemList.dataOut_Hatch.get(1, o), 200, 122880, true); + + //Rack + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Computer_Bus.get(1, o), + ItemList.Hatch_Input_Bus_ZPM.get(1, o), + ItemList.Circuit_Crystalcomputer.get(2, o), + CustomItemList.DATApipe.get(4, o) + }, Materials.Iridium.getMolten(1296), CustomItemList.rack_Hatch.get(1, o), 800, 122880, true); + + //Object Holder + GT_Values.RA.addAssemblylineRecipe(ItemList.Hatch_Input_Bus_ZPM.get(1), 10000, new ItemStack[]{ + ItemList.Hatch_Input_Bus_ZPM.get(1), + CustomItemList.eM_Computer_Bus.get(1, o), + ItemList.Emitter_ZPM.get(8), + ItemList.Robot_Arm_ZPM.get(1), + ItemList.Electric_Motor_ZPM.get(2), + ItemList.Circuit_Crystalmainframe.get(1), + GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Naquadah, 2), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Naquadah, 16), + CustomItemList.DATApipe.get(2, o), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(500), + Materials.Iridium.getMolten(1000), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 1000) + }, CustomItemList.holder_Hatch.get(1), 1200, 100000); + + //Parameterizer + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Computer_Casing.get(1, o), + ItemList.Circuit_Masterquantumcomputer.get(1, o), + CustomItemList.DATApipe.get(4, o), + ItemList.Cover_Screen.get(1, o ), + new ItemStack(Blocks.stone_button, 16), + }, Materials.Iridium.getMolten(2592), CustomItemList.Parametrizer_Hatch.get(1, o), 800, 122880); + //Uncertainty + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Computer_Casing.get(1, o), + ItemList.Circuit_Ultimatecrystalcomputer.get(1, o), + CustomItemList.DATApipe.get(16, o), + ItemList.Cover_Screen.get(1, o ), + new ItemStack(Blocks.stone_button, 16), + }, Materials.Iridium.getMolten(2592), CustomItemList.Uncertainty_Hatch.get(1, o), 1200, 122880, true); + + //Elemental Input + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Containment.get(1, o), + ItemList.Hatch_Input_UV.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 2), + ItemList.Sensor_UV.get(1, o) + }, Materials.Osmiridium.getMolten(1296), CustomItemList.eM_in_UV.get(1, o), 800, 500000, true); + //Elemental Output + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Containment.get(1, o), + ItemList.Hatch_Output_UV.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 2), + ItemList.Emitter_UV.get(1, o) + }, Materials.Osmiridium.getMolten(1296), CustomItemList.eM_out_UV.get(1, o), 800, 500000, true); + //Overflow + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Containment.get(1, o), + ItemList.Hatch_Muffler_UV.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.Naquadah, 1), + ItemList.Field_Generator_UV.get(1, o) + }, Materials.Osmiridium.getMolten(1296), CustomItemList.eM_muffler_UV.get(1, o), 800, 500000, true); + + //endregion + + + //region multi blocks + + //Microwave Grinder + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + ItemList.Machine_HV_Microwave.get(1,o), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.StainlessSteel, 4), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 4), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.AnnealedCopper, 16), + ItemList.Upgrade_Overclocker.get(4, o), + }, Materials.Copper.getMolten(576), CustomItemList.Machine_Multi_Microwave.get(1, o), 800, 480); + + //Active Transformer + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + com.dreammaster.gthandler.CustomItemList.WetTransformer_ZPM_LuV.get(1, o), + com.dreammaster.gthandler.CustomItemList.HighEnergyFlowCircuit.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Superconductor, 16), + ItemList.Circuit_Chip_UHPIC.get(2, o), + }, Materials.TungstenSteel.getMolten(576), CustomItemList.Machine_Multi_Transformer.get(1, o), 400, 30720); + + //Network Switch + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.Machine_Multi_Transformer.get(1, o), + ItemList.Circuit_Ultimatecrystalcomputer.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Cobalt, 64), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 64), + CustomItemList.DATApipe.get(4, o), + }, Materials.Iridium.getMolten(1296), CustomItemList.Machine_Multi_Switch.get(1, o), 800, 122880); + + //Quantum Computer + GT_Values.RA.addAssemblylineRecipe(ItemList.Tool_DataOrb.get(1), 20000, new ItemStack[]{ + CustomItemList.Machine_Multi_Switch.get(1), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 2), + ItemList.Tool_DataOrb.get(1), + ItemList.Cover_Screen.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Superconductor, 8), + CustomItemList.DATApipe.get(8, o), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(1000), + Materials.Iridium.getMolten(1296), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Hydrogen.getGas(1000), + }, CustomItemList.Machine_Multi_Computer.get(1), 12000, 100000); + + //Research Station + GT_Values.RA.addAssemblylineRecipe(com.dreammaster.gthandler.CustomItemList.ScannerZPM.get(1), 80000, new ItemStack[]{ + CustomItemList.Machine_Multi_Switch.get(1), + ItemList.Sensor_ZPM.get(8), + ItemList.Circuit_Crystalmainframe.get(4), + ItemList.Field_Generator_ZPM.get(1), + ItemList.Electric_Motor_ZPM.get(2), + GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Naquadah, 4), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Naquadah, 32), + CustomItemList.DATApipe.get(16, o), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(1000), + Materials.Iridium.getMolten(1296), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Osmium.getMolten(1296), + }, CustomItemList.Machine_Multi_Research.get(1), 12000, 100000); + + //Matter Junction + TT_recipeAdder.addResearchableAssemblylineRecipe(CustomItemList.Machine_Multi_Switch.get(1), + 8000,32, 500000, 4, new ItemStack[]{ + CustomItemList.Machine_Multi_Transformer.get(1), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 4), + ItemList.Robot_Arm_LuV.get(2), + ItemList.Electric_Piston_LuV.get(2), + ItemList.Circuit_Wetwaresupercomputer.get(2), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Superconductor, 4), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(1000), + Materials.Naquadah.getMolten(1296), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Osmium.getMolten(1296), + }, CustomItemList.Machine_Multi_EMjunction.get(1), 12000, 100000); + + //Matter Quantizer + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Input_UV.get(1), + 12000,32, 500000, 6, new ItemStack[]{ + CustomItemList.Machine_Multi_Transformer.get(1), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 4), + ItemList.Emitter_UV.get(2), + ItemList.Circuit_Wetwaresupercomputer.get(1), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Superconductor, 2), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(1000), + Materials.Naquadah.getMolten(1296), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Osmium.getMolten(1296), + }, CustomItemList.Machine_Multi_MatterToEM.get(1), 12000, 100000); + + //Matter DeQuantizer + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Output_UV.get(1), + 12000,32, 500000, 6, new ItemStack[]{ + CustomItemList.Machine_Multi_Transformer.get(1), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 4), + ItemList.Sensor_UV.get(2), + ItemList.Circuit_Wetwaresupercomputer.get(1), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Superconductor, 2), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(1000), + Materials.Naquadah.getMolten(1296), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Osmium.getMolten(1296), + }, CustomItemList.Machine_Multi_EMToMatter.get(1), 12000, 100000); + + //Essentia Quantizer + TT_recipeAdder.addResearchableAssemblylineRecipe(CustomItemList.Machine_Multi_MatterToEM.get(1), + 15000,32, 500000, 8, new ItemStack[]{ + CustomItemList.Machine_Multi_MatterToEM.get(1), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Neutronium, 4), + ItemList.Emitter_UV.get(2), + ItemList.Circuit_Wetwaresupercomputer.get(1), + GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Draconium, 2), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(2000), + Materials.Void.getMolten(2592), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 4000), + Materials.Osmium.getMolten(1296), + }, CustomItemList.Machine_Multi_EssentiaToEM.get(1), 24000, 500000); + + //Essentia DeQuantizer + TT_recipeAdder.addResearchableAssemblylineRecipe(CustomItemList.Machine_Multi_EMToMatter.get(1), + 15000,32, 500000, 8, new ItemStack[]{ + CustomItemList.Machine_Multi_EMToMatter.get(1), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Neutronium, 4), + ItemList.Sensor_UV.get(2), + ItemList.Circuit_Wetwaresupercomputer.get(1), + GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Draconium, 2), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(2000), + Materials.Void.getMolten(2592), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 4000), + Materials.Osmium.getMolten(1296), + }, CustomItemList.Machine_Multi_EMToEssentia.get(1), 24000, 500000); + + //EM Scanner + TT_recipeAdder.addResearchableAssemblylineRecipe(CustomItemList.Machine_Multi_Research.get(1), + 150000,128, 500000, 16, new ItemStack[]{ + CustomItemList.Machine_Multi_EMjunction.get(1), + CustomItemList.eM_Computer_Bus.get(4), + ItemList.Field_Generator_UV.get(4), + ItemList.Sensor_UV.get(4), + com.dreammaster.gthandler.CustomItemList.NanoCircuit.get(4), + com.dreammaster.gthandler.CustomItemList.MysteriousCrystalLens.get(4), + GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Draconium, 4), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(2000), + Materials.Neutronium.getMolten(2592), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 4000), + Materials.Osmiridium.getMolten(1296), + }, CustomItemList.Machine_Multi_Scanner.get(1), 24000, 500000); + //Multi Infuser + TT_recipeAdder.addResearchableAssemblylineRecipe(CustomItemList.Machine_Multi_Transformer.get(1), + 192000,512, 2000000, 32, new ItemStack[]{ + CustomItemList.Machine_Multi_Transformer.get(1), + CustomItemList.eM_Coil.get(8), + CustomItemList.eM_Power.get( 8), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Neodymium, 16), + }, new FluidStack[]{ + Materials.Electrum.getMolten(2592), + Materials.Neutronium.getMolten(1872), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + }, CustomItemList.Machine_Multi_Infuser.get(1), 8000, 2000000); + //endregion } } 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 13e76073a5..aa6590c8ea 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,13 +1,11 @@ package com.github.technus.tectech.compatibility.gtpp; -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; import gregtech.api.enums.OrePrefixes; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.MaterialGenerator; -import static com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition.getBestUnstableIsotope; -import static com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition.getFirstStableIsotope; -import static com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition.transformation; +import static com.github.technus.tectech.elementalMatter.definitions.complex.atom.dAtomDefinition.*; public class GtppAtomLoader implements Runnable{ @Override diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompat.java index dc0c55439d..fba6f1e6e9 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompat.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.compatibility.thaumcraft; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; /** diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompatEnabled.java index fd50ff3af1..a66f51ff2d 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompatEnabled.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.compatibility.thaumcraft; -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinition; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; import com.github.technus.tectech.compatibility.thaumcraft.definitions.iElementalAspect; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.elementalMatter.core.templates.cElementalDefinition; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompat.java index 8e2c3a6684..8715e33dd8 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompat.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.compatibility.thaumcraft.definitions; -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinition; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.templates.cElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; import java.util.HashMap; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompatEnabled.java index c8ce016a20..210b88cb9e 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompatEnabled.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.compatibility.thaumcraft.definitions; -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinition; -import com.github.technus.tectech.elementalMatter.classes.tElementalException; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.tElementalException; +import com.github.technus.tectech.elementalMatter.core.templates.cElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; import thaumcraft.api.aspects.Aspect; import java.util.ArrayList; @@ -30,7 +30,7 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat ArrayList<Aspect> list=Aspect.getCompoundAspects(); Aspect[] array=list.toArray(new Aspect[0]); - while (!list.isEmpty()) { + while (list.size()>0) { for (Aspect aspect : array) { if (list.contains(aspect)) { Aspect[] content = aspect.getComponents(); diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java index 667072a62e..7eed0b309e 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java @@ -1,14 +1,25 @@ package com.github.technus.tectech.compatibility.thaumcraft.definitions; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.elementalMatter.classes.*; -import com.github.technus.tectech.elementalMatter.definitions.eBosonDefinition; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import com.github.technus.tectech.Util; +import com.github.technus.tectech.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.core.tElementalException; +import com.github.technus.tectech.elementalMatter.core.templates.cElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.transformations.aFluidDequantizationInfo; +import com.github.technus.tectech.elementalMatter.core.transformations.aItemDequantizationInfo; +import com.github.technus.tectech.elementalMatter.core.transformations.aOredictDequantizationInfo; +import com.github.technus.tectech.elementalMatter.definitions.primitive.eBosonDefinition; import net.minecraft.nbt.NBTTagCompound; +import java.util.ArrayList; + import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.elementalMatter.classes.cElementalDecay.noDecay; import static com.github.technus.tectech.compatibility.thaumcraft.definitions.AspectDefinitionCompat.aspectDefinitionCompat; +import static com.github.technus.tectech.elementalMatter.core.cElementalDecay.noDecay; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; /** * Created by Tec on 06.05.2017. @@ -56,11 +67,11 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme //public but u can just try{}catch(){} the constructor it still calls this method private static boolean canTheyBeTogether(cElementalDefinitionStackMap stacks) { - int amount = 0; + long amount = 0; for (cElementalDefinitionStack aspects : stacks.values()) { - if (aspects.definition instanceof dComplexAspectDefinition || aspects.definition instanceof ePrimalAspectDefinition) - amount += aspects.amount; - else return false; + if (!(aspects.definition instanceof dComplexAspectDefinition) && !(aspects.definition instanceof ePrimalAspectDefinition)) + return false; + amount += aspects.amount; } return amount==2; } @@ -119,11 +130,16 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme } @Override - public float getRawLifeTime() { + public float getRawTimeSpan(long currentEnergy) { return -1; } @Override + public boolean isTimeSpanHalfLife() { + return false; + } + + @Override public int getCharge() { return 0; } @@ -144,11 +160,21 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme } @Override - public cElementalDecay[] getEnergeticDecayInstant() { + public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { return new cElementalDecay[]{new cElementalDecay(0.75F, aspectStacks), eBosonDefinition.deadEnd}; } @Override + public float getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + return DEFAULT_ENERGY_REQUIREMENT*(newEnergyLevel-currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return false; + } + + @Override public cElementalDecay[] getNaturalDecayInstant() { return noDecay; } @@ -206,4 +232,26 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme public int hashCode() { return hash; } + + + + @Override + public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { + if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) + lines.add("CLASS = "+nbtType+" "+getClassType()); + if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS, capabilities)) { + lines.add("NAME = "+getName()); + //lines.add("SYMBOL = "+getSymbol()); + } + if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) + lines.add("CHARGE = "+getCharge()/3f+" eV"); + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) + lines.add(getColor()<0?"NOT COLORED":"CARRIES COLOR"); + if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) + lines.add("MASS = "+getMass()+" eV/c\u00b2"); + if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add("LIFE TIME = "+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/ePrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/ePrimalAspectDefinition.java index ff203da5bc..6205055967 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/ePrimalAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/ePrimalAspectDefinition.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.compatibility.thaumcraft.definitions; -import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; +import com.github.technus.tectech.elementalMatter.core.templates.cElementalPrimitive; -import static com.github.technus.tectech.elementalMatter.classes.cElementalDecay.noDecay; import static com.github.technus.tectech.compatibility.thaumcraft.definitions.AspectDefinitionCompat.aspectDefinitionCompat; +import static com.github.technus.tectech.elementalMatter.core.cElementalDecay.noDecay; /** * Created by Tec on 06.05.2017. @@ -38,5 +38,10 @@ public final class ePrimalAspectDefinition extends cElementalPrimitive implement public Object materializeIntoAspect() { return aspectDefinitionCompat.getAspect(this); } + + @Override + public boolean isTimeSpanHalfLife() { + return false; + } } 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 4ad1d4e9b1..2162f81ab5 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -2,13 +2,13 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; import com.github.technus.tectech.compatibility.thaumcraft.definitions.ePrimalAspectDefinition; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; @@ -19,11 +19,11 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.Util.StructureBuilder; +import static com.github.technus.tectech.Util.V; import static com.github.technus.tectech.compatibility.thaumcraft.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static gregtech.api.enums.GT_Values.E; -import static com.github.technus.tectech.Util.V; /** * Created by danie_000 on 17.12.2016. @@ -101,7 +101,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ } @Override - public boolean checkRecipe_EM(ItemStack itemStack) { + public boolean checkRecipe_EM(ItemStack itemStack, boolean noParametrizers) { container=essentiaContainerCompat.getContainer(this); if (eInputHatches.size() < 1 || container==null) { stopMachine(); @@ -131,7 +131,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "Transform quantum form back to...", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "regular one, but why?" }; 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 b38fab7286..350b918ba8 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 @@ -2,13 +2,13 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; import com.github.technus.tectech.compatibility.thaumcraft.definitions.ePrimalAspectDefinition; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; @@ -19,11 +19,11 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.Util.StructureBuilder; +import static com.github.technus.tectech.Util.V; import static com.github.technus.tectech.compatibility.thaumcraft.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static gregtech.api.enums.GT_Values.E; -import static com.github.technus.tectech.Util.V; /** * Created by danie_000 on 17.12.2016. @@ -103,14 +103,14 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "Conveniently convert regular stuff into quantum form.", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "To make it more inconvenient." }; } @Override - public boolean checkRecipe_EM(ItemStack itemStack) { + public boolean checkRecipe_EM(ItemStack itemStack, boolean noParametrizers) { container=essentiaContainerCompat.getContainer(this); cElementalInstanceStack newStack=essentiaContainerCompat.getFromContainer(container); if(newStack!=null){ diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStack.java deleted file mode 100644 index 7b5b45cc25..0000000000 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStack.java +++ /dev/null @@ -1,271 +0,0 @@ -package com.github.technus.tectech.elementalMatter.classes; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; -import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveDefinition.null__; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class cElementalInstanceStack implements iHasElementalDefinition { - public final iElementalDefinition definition; - //energy - if positive then particle should try to decay - public int energy; - //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) - private byte color; - public long age; - public int amount; - private float lifeTime; - private float lifeTimeMult; - - public cElementalInstanceStack(cElementalDefinitionStack stackSafe) { - this(stackSafe.definition, stackSafe.amount, 1F, 0, 0); - } - - public cElementalInstanceStack(cElementalDefinitionStack stackSafe, float lifeTimeMult, long age, int energy) { - this(stackSafe.definition, stackSafe.amount, lifeTimeMult, age, energy); - } - - public cElementalInstanceStack(iElementalDefinition defSafe, int amount) { - this(defSafe, amount, 1F, 0, 0); - } - - public cElementalInstanceStack(iElementalDefinition defSafe, int amount, float lifeTimeMult, long age, int energy) { - this.definition = defSafe == null ? null__ : defSafe; - byte color = definition.getColor(); - if (color < 0 || color > 2) {//transforms colorable??? into proper color - this.color = color; - } else { - this.color = (byte) (TecTech.Rnd.nextInt(3)); - } - this.lifeTimeMult = lifeTimeMult; - this.lifeTime = definition.getRawLifeTime() * this.lifeTimeMult; - this.age = age; - this.energy = energy; - this.amount = amount; - } - - //Clone proxy - private cElementalInstanceStack(cElementalInstanceStack stack) { - definition = stack.definition; - energy = stack.energy; - color = stack.color; - age = stack.age; - amount = stack.amount; - lifeTime = stack.lifeTime; - lifeTimeMult = stack.lifeTimeMult; - } - - @Override - public final cElementalInstanceStack clone() { - return new cElementalInstanceStack(this); - } - - @Override - public int getAmount() { - return amount; - } - - public int getCharge() { - return definition.getCharge() * amount; - } - - public float getMass() { - return definition.getMass() * amount; - } - - public cElementalDefinitionStack getDefinitionStack() { - return new cElementalDefinitionStack(definition, amount); - } - - @Override - public iElementalDefinition getDefinition() { - return definition; - } - - public byte getColor() { - return color; - } - - public byte setColor(byte color) {//does not allow changing magic element - if (this.color < 0 || this.color > 2 || color < 0 || color >= 3) return this.color; - return this.color = color; - } - - public byte nextColor() {//does not allow changing magic element - if (this.color < 0 || this.color > 2) return this.color; - return this.color = (byte) (TecTech.Rnd.nextInt(3)); - } - - public float getLifeTime() { - return lifeTime; - } - - public float multLifeTime(float mult) { - this.lifeTimeMult = mult; - this.lifeTime = definition.getRawLifeTime() * mult; - return this.lifeTime; - } - - public float getLifeTimeMult() { - return lifeTimeMult; - } - - public cElementalInstanceStackMap decay() { - return decay(1F, age, 0);//try to decay without changes - } - - public cElementalInstanceStackMap decay(long apparentAge, int postEnergize) { - return decay(1F,apparentAge,postEnergize); - } - - public cElementalInstanceStackMap decay(Float lifeTimeMult, long apparentAge, int postEnergize) { - if (this.energy > 0) { - this.energy--; - return decayCompute(definition.getEnergeticDecayInstant(), lifeTimeMult, 0, postEnergize + this.energy); - } else if (definition.getRawLifeTime() < 0) { - return null;//return null, decay cannot be achieved - } else if (1F > this.lifeTime) { - return decayCompute(definition.getNaturalDecayInstant(), lifeTimeMult, 0, postEnergize + this.energy); - } else if (((float) apparentAge) > this.lifeTime) { - return decayCompute(definition.getDecayArray(), lifeTimeMult, 0, postEnergize + this.energy); - } - return null;//return null since decay cannot be achieved - } - - //Use to get direct decay output providing correct decay array - public cElementalInstanceStackMap decayCompute(cElementalDecay[] decays, float lifeTimeMult, long newProductsAge, int energy) { - if (decays == null) return null;//Can not decay so it wont - else if (decays.length == 0) - return new cElementalInstanceStackMap();//provide non null 0 length array for annihilation - else if (decays.length == 1) {//only one type of decay :D, doesn't need dead end - return decays[0].getResults(lifeTimeMult, newProductsAge, energy, this.amount); - } else { - cElementalInstanceStackMap output = new cElementalInstanceStackMap(); - final int differentDecays = decays.length; - int[] qttyOfDecay = new int[differentDecays]; - int amountRemaining = this.amount, amount = this.amount; - float remainingProbability = 1F; - - for (int i = 0; i < differentDecays; i++) { - if (decays[i].probability > 1F) { - int thisDecayAmount = (int) (Math.floor(remainingProbability * (float) amount)); - if (thisDecayAmount == 0) { - //remainingProbability=something; - break; - } else if (thisDecayAmount <= amountRemaining) { - amountRemaining -= thisDecayAmount; - qttyOfDecay[i] += thisDecayAmount; - break; - } - //in case too much was made - qttyOfDecay[i] += amountRemaining; - amountRemaining = 0; - //remainingProbability=0; - break; - } - int thisDecayAmount = (int) (Math.floor(decays[i].probability * (float) amount)); - if (thisDecayAmount <= amountRemaining && thisDecayAmount > 0) {//some was made - remainingProbability -= (decays[i].probability); - amountRemaining -= thisDecayAmount; - qttyOfDecay[i] += thisDecayAmount; - } else if (thisDecayAmount > amountRemaining) {//too much was made - qttyOfDecay[i] += amountRemaining; - amountRemaining = 0; - //remainingProbability=0; - break; - }//if 0 - } - - for (int i = 0; i < amountRemaining; i++) { - double rand = (double) (TecTech.Rnd.nextFloat()); - for (int j = 0; j < differentDecays; j++) {//looking for the thing it decayed into - rand -= (double) (decays[j].probability); - if (rand <= 0D) { - qttyOfDecay[j]++; - break; - } - } - } - - for (int i = 0; i < differentDecays; i++) { - if (qttyOfDecay[i] > 0) - output.putUnifyAll(decays[i].getResults(lifeTimeMult, newProductsAge, energy, qttyOfDecay[i])); - } - return output; - } - } - - public cElementalInstanceStack unifyIntoThis(cElementalInstanceStack... instances) { - if (instances == null) return this; - //returns with the definition from the first object passed - int energy = this.energy * this.amount; - float lifeTimeMul = this.lifeTimeMult; - - for (cElementalInstanceStack instance : instances) { - if (instance != null && this.compareTo(instance) == 0) { - this.amount += instance.amount; - energy += instance.energy * instance.amount; - lifeTimeMul = Math.min(lifeTimeMul, instance.lifeTimeMult); - this.age = Math.max(this.age, instance.age); - } - } - - if (amount != 0) energy /= Math.abs(amount); - - this.energy = energy; - this.multLifeTime(lifeTimeMul); - return this; - } - - public NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setTag("d", definition.toNBT()); - nbt.setInteger("q", amount); - nbt.setInteger("e", energy); - nbt.setByte("c", color); - nbt.setLong("a", age); - nbt.setFloat("m", lifeTimeMult); - return nbt; - } - - public static cElementalInstanceStack fromNBT(NBTTagCompound nbt) { - NBTTagCompound definition = nbt.getCompoundTag("d"); - cElementalInstanceStack instance = new cElementalInstanceStack( - cElementalDefinition.fromNBT(definition), - nbt.getInteger("q"), - nbt.getFloat("m"), - nbt.getLong("a"), - nbt.getInteger("e")); - instance.setColor(nbt.getByte("c")); - return instance; - } - - @Override - public int compareTo(iHasElementalDefinition o) {//use for unification - return definition.compareTo(o.getDefinition()); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof iElementalDefinition) - return definition.compareTo((iElementalDefinition) obj) == 0; - if (obj instanceof iHasElementalDefinition) - return definition.compareTo(((iHasElementalDefinition) obj).getDefinition()) == 0; - return false; - } - - //Amount shouldn't be hashed if this is just indicating amount and not structure, DOES NOT CARE ABOUT INSTANCE INFO - @Override - public int hashCode() { - return definition.hashCode(); - } - - @Override - public String toString() { - return definition.getName()+ '\n' + definition.getSymbol() + '\n' + amount + '\n' + getMass(); - } -} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/tElementalRecipeCollision.java b/src/main/java/com/github/technus/tectech/elementalMatter/classes/tElementalRecipeCollision.java deleted file mode 100644 index a7ffa8c808..0000000000 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/tElementalRecipeCollision.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.github.technus.tectech.elementalMatter.classes; - -/** - * Created by danie_000 on 19.11.2016. - */ -public final class tElementalRecipeCollision extends Exception { - public tElementalRecipeCollision(String message) { - super(message); - } -} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDecay.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDecay.java index 1f6b38e22d..d80a2b4ccd 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDecay.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDecay.java @@ -1,6 +1,8 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; /** * Created by danie_000 on 22.10.2016. @@ -46,11 +48,11 @@ public final class cElementalDecay { this.probability = probability; } - public cElementalInstanceStackMap getResults(float lifeMult, long age, int energy, int amountDecaying) { + public cElementalInstanceStackMap getResults(float lifeMult, long age, long energy, long amountDecaying) { cElementalInstanceStackMap decayResult = new cElementalInstanceStackMap(); if (outputStacks == null) return decayResult;//This is to prevent null pointer exceptions. //Deny decay code is in instance! - int qtty = 0; + long qtty = 0; for (cElementalDefinitionStack stack : outputStacks.values()) qtty += stack.amount; if (qtty <= 0) return decayResult; //energy /= qtty; diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDefinitionStackMap.java index 47b1a29994..b3c66e42ce 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStackMap.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDefinitionStackMap.java @@ -1,11 +1,12 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; import net.minecraft.nbt.NBTTagCompound; import java.util.TreeMap; -import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; /** * Created by Tec on 12.05.2017. @@ -31,6 +32,10 @@ public final class cElementalDefinitionStackMap/*IMMUTABLE*/ extends cElementalS map = new TreeMap<>(in); } + cElementalDefinitionStackMap(cElementalMutableDefinitionStackMap unsafeMap){ + map=unsafeMap.map; + } + //IMMUTABLE DON'T NEED IT @Override public final cElementalDefinitionStackMap clone() { diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java index 7d27f573bb..ee8a81dbd1 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java @@ -1,20 +1,24 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; -import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import java.util.ArrayList; +import java.util.Iterator; import java.util.Map; import java.util.TreeMap; -import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; /** * Created by danie_000 on 22.01.2017. */ public final class cElementalInstanceStackMap implements Comparable<cElementalInstanceStackMap> { - private TreeMap<iElementalDefinition, cElementalInstanceStack> map; + TreeMap<iElementalDefinition, cElementalInstanceStack> map; //Constructors public cElementalInstanceStackMap() { @@ -123,7 +127,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn if (testOnly) return target.amount >= instance.amount; else { - final int diff = target.amount - instance.amount; + final long diff = target.amount - instance.amount; if (diff > 0) { target.amount = diff; return true; @@ -142,7 +146,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn if (testOnly) return target.amount >= stack.getAmount(); else { - final int diff = target.amount - stack.getAmount(); + final long diff = target.amount - stack.getAmount(); if (diff > 0) { target.amount = diff; return true; @@ -188,15 +192,35 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn } public boolean removeAllAmounts(boolean testOnly, cElementalStackMap container) { - return removeAllAmounts(testOnly, container.values()); + boolean test=true; + for (Iterator<Map.Entry<iElementalDefinition, cElementalDefinitionStack>> entries = container.map.entrySet().iterator(); entries.hasNext(); ) { + Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry = entries.next(); + test &= removeAmount(true, entry.getValue()); + } + if (testOnly || !test) return test; + for (Iterator<Map.Entry<iElementalDefinition, cElementalDefinitionStack>> entries = container.map.entrySet().iterator(); entries.hasNext(); ) { + Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry = entries.next(); + removeAmount(false, entry.getValue()); + } + return true; } public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStackMap container) { - return removeAllAmounts(testOnly, container.values()); + boolean test=true; + for (Iterator<Map.Entry<iElementalDefinition, cElementalInstanceStack>> entries = container.map.entrySet().iterator(); entries.hasNext(); ) { + Map.Entry<iElementalDefinition, cElementalInstanceStack> entry = entries.next(); + test &= removeAmount(true, entry.getValue()); + } + if (testOnly || !test) return test; + for (Iterator<Map.Entry<iElementalDefinition, cElementalInstanceStack>> entries = container.map.entrySet().iterator(); entries.hasNext(); ) { + Map.Entry<iElementalDefinition, cElementalInstanceStack> entry = entries.next(); + test &= removeAmount(false, entry.getValue()); + } + return true; } //Remove overflow - public float removeOverflow(int stacksCount, int stackCapacity) { + public float removeOverflow(int stacksCount, long stackCapacity) { float massRemoved = 0; if (map.size() > stacksCount) { @@ -284,6 +308,14 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn return info; } + public ArrayList<String> getScanInfo(int[] capabilities) { + ArrayList<String> list=new ArrayList<>(16); + for(Map.Entry<iElementalDefinition,cElementalInstanceStack> e:map.entrySet()){ + e.getValue().addScanResults(list,capabilities); + } + return list; + } + public cElementalInstanceStack[] values() { return map.values().toArray(new cElementalInstanceStack[0]); } @@ -318,32 +350,23 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn } //Tick Content - public void tickContent(float lifeTimeMult, int postEnergize) { - for (cElementalInstanceStack instance : this.values()) { - cElementalInstanceStackMap newThings = instance.decay(lifeTimeMult, instance.age += 20, postEnergize); - if (newThings == null) { - instance.nextColor(); - } else { - map.remove(instance.definition); - for (cElementalInstanceStack newInstance : newThings.values()) - putUnify(newInstance); - } - } - + public void tickContentByOneSecond(float lifeTimeMult, int postEnergize) { + tickContent(lifeTimeMult,postEnergize,1); } - public void tickContent(int postEnergize) { + public void tickContent(float lifeTimeMult, int postEnergize, int seconds){ for (cElementalInstanceStack instance : this.values()) { - cElementalInstanceStackMap newThings = instance.decay(instance.age += 20, postEnergize); - if (newThings == null) { + cElementalInstanceStackMap newInstances = instance.decay(lifeTimeMult, instance.age += seconds, postEnergize); + if (newInstances == null) { instance.nextColor(); } else { map.remove(instance.definition); - for (cElementalInstanceStack newInstance : newThings.values()) + for (cElementalInstanceStack newInstance : newInstances.values()) { putUnify(newInstance); + newInstance.nextColor(); + } } } - } //NBT @@ -356,11 +379,13 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn return nbt; } - public static String[] infoFromNBT(NBTTagCompound nbt) { - final String[] strings = new String[nbt.getInteger("i")]; - for (int i = 0; i < strings.length; i++) - strings[i] = nbt.getString(Integer.toString(i)); - return strings; + public NBTTagCompound getScanInfoNBT(int[] capabilities) { + final NBTTagCompound nbt = new NBTTagCompound(); + final ArrayList<String> info = getScanInfo(capabilities); + nbt.setInteger("i", info.size()); + for (int i = 0; i < info.size(); i++) + nbt.setString(Integer.toString(i), info.get(i)); + return nbt; } public NBTTagCompound toNBT() { @@ -427,4 +452,10 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn } return build.toString(); } + + public void cleanUp(){ + for(Map.Entry<iElementalDefinition, cElementalInstanceStack> entry:map.entrySet()){ + if(entry.getValue().amount<=0) map.remove(entry.getKey()); + } + } } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalMutableDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalMutableDefinitionStackMap.java index 10ae31bdb5..49823d4088 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalMutableDefinitionStackMap.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalMutableDefinitionStackMap.java @@ -1,13 +1,16 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; -import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; import net.minecraft.nbt.NBTTagCompound; +import java.util.Iterator; import java.util.Map; import java.util.TreeMap; -import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; /** * Created by danie_000 on 22.01.2017. @@ -51,6 +54,9 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa public cElementalDefinitionStackMap toImmutable() { return new cElementalDefinitionStackMap(map); } + public cElementalDefinitionStackMap toImmutable_unsafeMightLeaveExposedElementalTree() { + return new cElementalDefinitionStackMap(this); + } @Override @Deprecated @@ -92,7 +98,7 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa if (testOnly) return target.amount >= instance.amount; else { - final int diff = target.amount - instance.amount; + final long diff = target.amount - instance.amount; if (diff > 0) { map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); return true; @@ -111,7 +117,7 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa if (testOnly) return target.amount >= stack.getAmount(); else { - final int diff = target.amount - stack.getAmount(); + final long diff = target.amount - stack.getAmount(); if (diff > 0) { map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); return true; @@ -157,11 +163,31 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa } public boolean removeAllAmounts(boolean testOnly, cElementalStackMap container) { - return removeAllAmounts(testOnly, container.values()); + boolean test=true; + for (Iterator<Map.Entry<iElementalDefinition, cElementalDefinitionStack>> entries = container.map.entrySet().iterator(); entries.hasNext(); ) { + Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry = entries.next(); + test &= removeAmount(true, entry.getValue()); + } + if (testOnly || !test) return test; + for (Iterator<Map.Entry<iElementalDefinition, cElementalDefinitionStack>> entries = container.map.entrySet().iterator(); entries.hasNext(); ) { + Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry = entries.next(); + removeAmount(false, entry.getValue()); + } + return true; } public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStackMap container) { - return removeAllAmounts(testOnly, container.values()); + boolean test=true; + for (Iterator<Map.Entry<iElementalDefinition, cElementalInstanceStack>> entries = container.map.entrySet().iterator(); entries.hasNext(); ) { + Map.Entry<iElementalDefinition, cElementalInstanceStack> entry = entries.next(); + test &= removeAmount(true, entry.getValue()); + } + if (testOnly || !test) return test; + for (Iterator<Map.Entry<iElementalDefinition, cElementalInstanceStack>> entries = container.map.entrySet().iterator(); entries.hasNext(); ) { + Map.Entry<iElementalDefinition, cElementalInstanceStack> entry = entries.next(); + test &= removeAmount(false, entry.getValue()); + } + return true; } //Put replace @@ -220,4 +246,10 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa } return new cElementalMutableDefinitionStackMap(defStacks); } + + public void cleanUp(){ + for(Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry:map.entrySet()){ + if(entry.getValue().amount<=0) map.remove(entry.getKey()); + } + } } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java index 91dc8b9d7a..a5139bc254 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalStackMap.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java @@ -1,6 +1,7 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; @@ -26,6 +27,7 @@ abstract class cElementalStackMap implements Comparable<cElementalStackMap> { public final cElementalDefinitionStack getLast(){ return map.lastEntry().getValue(); } + public final cElementalDefinitionStack getDefinitionStack(iElementalDefinition def) { return map.get(def); } @@ -77,13 +79,6 @@ abstract class cElementalStackMap implements Comparable<cElementalStackMap> { return nbt; } - public static String[] infoFromNBT(NBTTagCompound nbt) { - final String[] strings = new String[nbt.getInteger("i")]; - for (int i = 0; i < strings.length; i++) - strings[i] = nbt.getString(Integer.toString(i)); - return strings; - } - public final NBTTagCompound toNBT() { final NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("i", map.size()); @@ -115,11 +110,27 @@ abstract class cElementalStackMap implements Comparable<cElementalStackMap> { } @Override - public int hashCode() {//Hash only definitions to compare contents not amounts or data + public final int hashCode() {//Hash only definitions to compare contents not amounts or data int hash = -(map.size() << 4); for (cElementalDefinitionStack s : map.values()) { hash += s.definition.hashCode(); } return hash; } + + public double getMass(){ + double mass=0; + for(cElementalDefinitionStack stack:map.values()){ + mass+=stack.getMass(); + } + return mass; + } + + public long getCharge(){ + long charge=0; + for(cElementalDefinitionStack stack:map.values()){ + charge+=stack.getCharge(); + } + return charge; + } } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iElementalInstanceContainer.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iElementalInstanceContainer.java index 27580a0b42..448328cb30 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iElementalInstanceContainer.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iElementalInstanceContainer.java @@ -1,6 +1,6 @@ -package com.github.technus.tectech.elementalMatter.interfaces; +package com.github.technus.tectech.elementalMatter.core.interfaces; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; /** * Created by danie_000 on 25.01.2017. diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iExchangeInfo.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iExchangeInfo.java index 7e0f782b68..cfae8a20a1 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iExchangeInfo.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iExchangeInfo.java @@ -1,4 +1,4 @@ -package com.github.technus.tectech.elementalMatter.interfaces; +package com.github.technus.tectech.elementalMatter.core.interfaces; /** * Created by Tec on 23.05.2017. diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iHasElementalDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iHasElementalDefinition.java index 12215d2d55..2659898d62 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iHasElementalDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iHasElementalDefinition.java @@ -1,4 +1,6 @@ -package com.github.technus.tectech.elementalMatter.interfaces; +package com.github.technus.tectech.elementalMatter.core.interfaces; + +import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; /** * Created by danie_000 on 30.01.2017. @@ -6,11 +8,11 @@ package com.github.technus.tectech.elementalMatter.interfaces; public interface iHasElementalDefinition extends Comparable<iHasElementalDefinition>,Cloneable { iElementalDefinition getDefinition(); - int getAmount(); + long getAmount(); - float getMass(); + long getCharge(); - int getCharge(); + float getMass(); iHasElementalDefinition clone(); } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/rElementalRecipe.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/rElementalRecipe.java index 4bd94bf5b4..b6cd7a5ccb 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/rElementalRecipe.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/rElementalRecipe.java @@ -1,4 +1,4 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/rElementalRecipeMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/rElementalRecipeMap.java index 57effa005e..41aff17327 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/rElementalRecipeMap.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/rElementalRecipeMap.java @@ -1,4 +1,4 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core; import java.util.HashMap; diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStack.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalDefinitionStack.java index 7ab4dcdc56..8a119e356c 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinitionStack.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalDefinitionStack.java @@ -1,19 +1,20 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core.stacks; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; -import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.templates.cElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; import net.minecraft.nbt.NBTTagCompound; -import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveDefinition.null__; +import static com.github.technus.tectech.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; /** * Created by danie_000 on 20.11.2016. */ public final class cElementalDefinitionStack implements iHasElementalDefinition { public final iElementalDefinition definition; - public final int amount; + public final long amount; - public cElementalDefinitionStack(iElementalDefinition def, int amount) { + public cElementalDefinitionStack(iElementalDefinition def, long amount) { this.definition = def == null ? null__ : def; this.amount = amount; } @@ -29,11 +30,11 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition } @Override - public int getAmount() { + public long getAmount() { return amount; } - public int getCharge() { + public long getCharge() { return definition.getCharge() * amount; } @@ -44,24 +45,24 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition public NBTTagCompound toNBT() { NBTTagCompound nbt = new NBTTagCompound(); nbt.setTag("d", definition.toNBT()); - nbt.setInteger("q", amount); + nbt.setLong("q", amount); return nbt; } public static cElementalDefinitionStack fromNBT(NBTTagCompound nbt) { return new cElementalDefinitionStack( cElementalDefinition.fromNBT(nbt.getCompoundTag("d")), - nbt.getInteger("q")); + nbt.getLong("q")); } - public cElementalDefinitionStack addAmountIntoNewInstance(int amount) { + public cElementalDefinitionStack addAmountIntoNewInstance(long amount) { if(amount==0) return this; return new cElementalDefinitionStack(definition, amount + this.amount); } public cElementalDefinitionStack addAmountIntoNewInstance(cElementalDefinitionStack... other) { if (other == null || other.length == 0) return this; - int i = 0; + long i = 0; for (cElementalDefinitionStack stack : other) i += stack.amount; return addAmountIntoNewInstance(i); diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalInstanceStack.java new file mode 100644 index 0000000000..e9de353597 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalInstanceStack.java @@ -0,0 +1,392 @@ +package com.github.technus.tectech.elementalMatter.core.stacks; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.Util; +import com.github.technus.tectech.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.templates.cElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.ArrayList; + +import static com.github.technus.tectech.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class cElementalInstanceStack implements iHasElementalDefinition { + public final iElementalDefinition definition; + //energy - if positive then particle should try to decay + private long energy; + //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) + private byte color; + public long age; + public long amount; + private float lifeTime; + private float lifeTimeMult; + + public cElementalInstanceStack(cElementalDefinitionStack stackSafe) { + this(stackSafe.definition, stackSafe.amount, 1F, 0, 0); + } + + public cElementalInstanceStack(cElementalDefinitionStack stackSafe, float lifeTimeMult, long age, long energy) { + this(stackSafe.definition, stackSafe.amount, lifeTimeMult, age, energy); + } + + public cElementalInstanceStack(iElementalDefinition defSafe, long amount) { + this(defSafe, amount, 1F, 0, 0); + } + + public cElementalInstanceStack(iElementalDefinition defSafe, long amount, float lifeTimeMult, long age, long energy) { + this.definition = defSafe == null ? null__ : defSafe; + byte color = definition.getColor(); + if (color < 0 || color > 2) {//transforms colorable??? into proper color + this.color = color; + } else { + this.color = (byte) (TecTech.Rnd.nextInt(3)); + } + this.lifeTimeMult = lifeTimeMult; + this.energy = energy; + this.lifeTime = definition.getRawTimeSpan(energy) * this.lifeTimeMult; + this.age = age; + this.amount = amount; + } + + //Clone proxy + private cElementalInstanceStack(cElementalInstanceStack stack) { + definition = stack.definition; + energy = stack.energy; + color = stack.color; + age = stack.age; + amount = stack.amount; + lifeTime = stack.lifeTime; + lifeTimeMult = stack.lifeTimeMult; + } + + @Override + public final cElementalInstanceStack clone() { + return new cElementalInstanceStack(this); + } + + @Override + public long getAmount() { + return amount; + } + + public long getCharge() { + return definition.getCharge() * amount; + } + + public float getMass() { + return definition.getMass() * amount; + } + + public long getEnergy() { + return energy; + } + + public void setEnergy(long newEnergyLevel){ + energy=newEnergyLevel; + setLifeTimeMultipleOfBaseValue(getLifeTimeMult()); + } + + @Deprecated //can be done from definition + public float getEnergySettingCost(long currentEnergyLevel, long newEnergyLevel){ + return definition.getEnergyDiffBetweenStates(currentEnergyLevel,newEnergyLevel); + } + + @Deprecated //can be done from definition + public float getEnergySettingCost(long newEnergyLevel){ + return definition.getEnergyDiffBetweenStates(energy,newEnergyLevel); + } + + public cElementalDefinitionStack getDefinitionStack() { + return new cElementalDefinitionStack(definition, amount); + } + + @Override + public iElementalDefinition getDefinition() { + return definition; + } + + public byte getColor() { + return color; + } + + public byte setColor(byte color) {//does not allow changing magic element + if (this.color < 0 || this.color > 2 || color < 0 || color >= 3) return this.color; + return this.color = color; + } + + public byte nextColor() {//does not allow changing magic element + if (this.color < 0 || this.color > 2) return this.color; + return this.color = (byte) (TecTech.Rnd.nextInt(3)); + } + + public float getLifeTime() { + return lifeTime; + } + + public float setLifeTimeMultipleOfBaseValue(float mult) { + if(mult<=0) //since infinity*0=nan + throw new IllegalArgumentException("mult must be >0"); + this.lifeTimeMult = mult; + if (definition.getRawTimeSpan(energy) <= 0) return this.lifeTime; + this.lifeTime = definition.getRawTimeSpan(energy) * this.lifeTimeMult; + return this.lifeTime; + } + + public float getLifeTimeMult() { + return lifeTimeMult; + } + + public cElementalInstanceStackMap decay() { + return decay(1F, age, 0);//try to decay without changes + } + + public cElementalInstanceStackMap decay(long apparentAge, long postEnergize) { + return decay(1F,apparentAge,postEnergize); + } + + public cElementalInstanceStackMap decay(float lifeTimeMult, long apparentAge, long postEnergize) { + long newEnergyLevel=postEnergize+this.energy; + if(newEnergyLevel>0) newEnergyLevel-=1; + else if(newEnergyLevel<0) newEnergyLevel+=1; + if (this.energy > 0 && !definition.usesSpecialEnergeticDecayHandling()) { + setLifeTimeMultipleOfBaseValue(getLifeTimeMult()); + return decayCompute(definition.getEnergyInducedDecay(this.energy), lifeTimeMult, -1, newEnergyLevel); + }else if (definition.getRawTimeSpan(energy) < 0) { + return null;//return null, decay cannot be achieved + } else if(definition.isTimeSpanHalfLife()){ + return exponentialDecayCompute(energy>0?definition.getEnergyInducedDecay(this.energy):definition.getDecayArray(), lifeTimeMult, -1, newEnergyLevel); + } else{ + if (1F > this.lifeTime) { + return decayCompute(energy>0?definition.getEnergyInducedDecay(this.energy):definition.getNaturalDecayInstant(), lifeTimeMult, 0, newEnergyLevel); + } else if (((float) apparentAge) > this.lifeTime) { + return decayCompute(energy>0?definition.getEnergyInducedDecay(this.energy):definition.getDecayArray(), lifeTimeMult, 0, newEnergyLevel); + } + } + return null;//return null since decay cannot be achieved + } + + //Use to get direct decay output providing correct decay array + private cElementalInstanceStackMap exponentialDecayCompute(cElementalDecay[] decays, float lifeTimeMult, long newProductsAge, long energy) { + double decayInverseRatio=Math.pow(2d,1d/* 1 second *//(double)lifeTime); + double newAmount=(double)amount/decayInverseRatio; + long amountRemaining=((long)Math.floor(newAmount))+(TecTech.Rnd.nextDouble()<=newAmount-Math.floor(newAmount)?1:0); + if(amountRemaining==amount) return null;//nothing decayed + else if(amountRemaining<=0) return decayCompute(decays,lifeTimeMult,newProductsAge,energy); + //split to non decaying and decaying part + long amount=this.amount; + this.amount-=amountRemaining; + cElementalInstanceStackMap products=decayCompute(decays,lifeTimeMult,newProductsAge,energy); + this.amount=amountRemaining; + products.putUnify(this.clone()); + this.amount=amount; + return products; + } + + //Use to get direct decay output providing correct decay array + public cElementalInstanceStackMap decayCompute(cElementalDecay[] decays, float lifeTimeMult, long newProductsAge, long energy) { + if (decays == null) return null;//Can not decay so it wont + else if (decays.length == 0) + return new cElementalInstanceStackMap();//provide non null 0 length array for annihilation + else if (decays.length == 1) {//only one type of decay :D, doesn't need dead end + cElementalInstanceStackMap products=decays[0].getResults(lifeTimeMult, newProductsAge, energy, this.amount); + if(newProductsAge<0){ + for(cElementalInstanceStack s:products.values()){ + if(s.definition.equals(definition)){ + s.age=this.age; + s.energy=this.energy; + } + } + }else{ + for(cElementalInstanceStack s:products.values()){ + if(s.definition.equals(definition)){ + s.energy=this.energy; + } + } + } + return products; + } else { + cElementalInstanceStackMap output = new cElementalInstanceStackMap(); + final int differentDecays = decays.length; + long[] qttyOfDecay = new long[differentDecays]; + long amountRemaining = this.amount, amount = this.amount; + float remainingProbability = 1F; + + for (int i = 0; i < differentDecays; i++) { + if (decays[i].probability > 1F) { + long thisDecayAmount = (long) (Math.floor(remainingProbability * (double) amount)); + if (thisDecayAmount == 0) { + //remainingProbability=something; + break; + } else if (thisDecayAmount <= amountRemaining) { + amountRemaining -= thisDecayAmount; + qttyOfDecay[i] += thisDecayAmount; + break; + } + //in case too much was made + qttyOfDecay[i] += amountRemaining; + amountRemaining = 0; + //remainingProbability=0; + break; + } + long thisDecayAmount = (long) (Math.floor(decays[i].probability * (double) amount)); + if (thisDecayAmount <= amountRemaining && thisDecayAmount > 0) {//some was made + remainingProbability -= (decays[i].probability); + amountRemaining -= thisDecayAmount; + qttyOfDecay[i] += thisDecayAmount; + } else if (thisDecayAmount > amountRemaining) {//too much was made + qttyOfDecay[i] += amountRemaining; + amountRemaining = 0; + //remainingProbability=0; + break; + }//if 0 + } + + for (int i = 0; i < amountRemaining; i++) { + double rand = TecTech.Rnd.nextDouble(); + for (int j = 0; j < differentDecays; j++) {//looking for the thing it decayed into + rand -= decays[j].probability; + if (rand <= 0D) { + qttyOfDecay[j]++; + break; + } + } + } + + for (int i = 0; i < differentDecays; i++) { + if (qttyOfDecay[i] > 0) + output.putUnifyAll(decays[i].getResults(lifeTimeMult, newProductsAge, energy, qttyOfDecay[i])); + } + + if(newProductsAge<0){ + for(cElementalInstanceStack s:output.values()){ + if(s.definition.equals(definition)){ + s.age=this.age; + s.energy=this.energy; + } + } + }else{ + for(cElementalInstanceStack s:output.values()){ + if(s.definition.equals(definition)){ + s.energy=this.energy; + } + } + } + return output; + } + } + + public cElementalInstanceStack unifyIntoThis(cElementalInstanceStack... instances) { + if (instances == null) return this; + //returns with the definition from the first object passed + long energy = this.energy * this.amount; + float lifeTimeMul = this.lifeTimeMult; + + for (cElementalInstanceStack instance : instances) { + if (instance != null && this.compareTo(instance) == 0) { + this.amount += instance.amount; + energy += instance.energy * instance.amount; + lifeTimeMul = Math.min(lifeTimeMul, instance.lifeTimeMult); + this.age = Math.max(this.age, instance.age); + } + } + + if (amount != 0) energy /= Math.abs(amount); + + this.energy = energy; + this.setLifeTimeMultipleOfBaseValue(lifeTimeMul); + return this; + } + + public void addScanResults(ArrayList<String> lines, int[] detailsOnDepthLevels){ + final int capabilities=detailsOnDepthLevels[0]; + if(Util.areBitsSet(SCAN_GET_DEPTH_LEVEL,capabilities)) + lines.add("DEPTH = "+0); + definition.addScanResults(lines,capabilities,energy); + if(Util.areBitsSet(SCAN_GET_TIMESPAN_MULT,capabilities)) { + lines.add("TIME SPAN MULTIPLIER = " + lifeTimeMult); + if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO,capabilities)) + lines.add("TIME SPAN MULTIPLIED = "+lifeTime+" s"); + } + if(Util.areBitsSet(SCAN_GET_AGE,capabilities)) + lines.add("AGE = " + age+" s"); + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) + lines.add("COLOR = "+color+" RGB or CMY"); + if(Util.areBitsSet(SCAN_GET_ENERGY_LEVEL,capabilities)) + lines.add("ENERGY LEVEL = "+energy); + if(Util.areBitsSet(SCAN_GET_AMOUNT,capabilities)) + lines.add("AMOUNT = "+amount); + lines.add(null);//def separator + scanContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); + } + + private void scanContents(ArrayList<String> lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){ + if(definitions!=null && depth<detailsOnDepthLevels.length){ + final int deeper=depth+1; + for(cElementalDefinitionStack definitionStack:definitions.values()) { + if(Util.areBitsSet(SCAN_GET_DEPTH_LEVEL,detailsOnDepthLevels[depth])) + lines.add("DEPTH = " + depth); + definition.addScanResults(lines,detailsOnDepthLevels[depth],energy); + if(Util.areBitsSet(SCAN_GET_AMOUNT,detailsOnDepthLevels[depth])) + lines.add("AMOUNT = "+definitionStack.amount); + lines.add(null);//def separator + scanContents(lines,definitionStack.definition.getSubParticles(),deeper,detailsOnDepthLevels); + } + } + } + + public NBTTagCompound toNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setTag("d", definition.toNBT()); + nbt.setLong("q", amount); + nbt.setLong("e", energy); + nbt.setByte("c", color); + nbt.setLong("a", age); + nbt.setFloat("m", lifeTimeMult); + return nbt; + } + + public static cElementalInstanceStack fromNBT(NBTTagCompound nbt) { + NBTTagCompound definition = nbt.getCompoundTag("d"); + cElementalInstanceStack instance = new cElementalInstanceStack( + cElementalDefinition.fromNBT(definition), + nbt.getLong("q"), + nbt.getFloat("m"), + nbt.getLong("a"), + nbt.getLong("e")); + instance.setColor(nbt.getByte("c")); + return instance; + } + + @Override + public int compareTo(iHasElementalDefinition o) {//use for unification + return definition.compareTo(o.getDefinition()); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof iElementalDefinition) + return definition.compareTo((iElementalDefinition) obj) == 0; + if (obj instanceof iHasElementalDefinition) + return definition.compareTo(((iHasElementalDefinition) obj).getDefinition()) == 0; + return false; + } + + //Amount shouldn't be hashed if this is just indicating amount and not structure, DOES NOT CARE ABOUT INSTANCE INFO + @Override + public int hashCode() { + return definition.hashCode(); + } + + @Override + public String toString() { + return definition.getName()+ '\n' + definition.getSymbol() + '\n' + amount + '\n' + getMass(); + } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/tElementalException.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/tElementalException.java index 0218d82a03..4bb3b4020f 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/tElementalException.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/tElementalException.java @@ -1,4 +1,4 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core; /** * Created by danie_000 on 19.11.2016. diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalDefinition.java index ce12ad5c3d..9eb682f4b8 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalDefinition.java @@ -1,7 +1,7 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core.templates; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; -import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; import net.minecraft.nbt.NBTTagCompound; import java.lang.reflect.Method; @@ -10,12 +10,12 @@ import java.util.HashSet; import java.util.Map; import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; /** * Created by danie_000 on 23.01.2017. */ -public abstract class cElementalDefinition implements iElementalDefinition { +public abstract class cElementalDefinition extends iElementalDefinition { //Nothing array public static final iElementalDefinition[] nothing = new cElementalPrimitive[0]; @@ -53,10 +53,6 @@ public abstract class cElementalDefinition implements iElementalDefinition { return compareInnerContentsWithAmounts(getSubParticles().values(), o.getSubParticles().values()); } - public final int compareClassID(iElementalDefinition obj) { - return ((int) getClassType()) - obj.getClassType(); - } - //use only for nested operations! private static int compareInnerContentsWithAmounts(cElementalDefinitionStack[] tc, cElementalDefinitionStack[] sc) { if (tc == null) { diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalPrimitive.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java index 4f878901ea..b44332d5c8 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/cElementalPrimitive.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java @@ -1,16 +1,24 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core.templates; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import com.github.technus.tectech.Util; +import com.github.technus.tectech.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; +import com.github.technus.tectech.elementalMatter.core.tElementalException; +import com.github.technus.tectech.elementalMatter.core.transformations.aFluidDequantizationInfo; +import com.github.technus.tectech.elementalMatter.core.transformations.aItemDequantizationInfo; +import com.github.technus.tectech.elementalMatter.core.transformations.aOredictDequantizationInfo; import net.minecraft.client.Minecraft; import net.minecraft.crash.CrashReport; import net.minecraft.nbt.NBTTagCompound; +import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveDefinition.null__; +import static com.github.technus.tectech.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; /** * Created by danie_000 on 22.10.2016. @@ -102,18 +110,28 @@ public abstract class cElementalPrimitive extends cElementalDefinition { } @Override - public cElementalDecay[] getEnergeticDecayInstant() { + public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { if (energeticDecayInstant < 0) return elementalDecays; return new cElementalDecay[]{elementalDecays[energeticDecayInstant]}; } @Override + public float getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + return DEFAULT_ENERGY_REQUIREMENT*(newEnergyLevel-currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return false; + } + + @Override public cElementalDecay[] getDecayArray() { return elementalDecays; } @Override - public float getRawLifeTime() { + public float getRawTimeSpan(long currentEnergy) { return rawLifeTime; } @@ -160,6 +178,26 @@ public abstract class cElementalPrimitive extends cElementalDefinition { return -128; } + @Override + public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { + if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) + lines.add("CLASS = "+nbtType+" "+getClassType()); + if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("NAME = "+getName()); + lines.add("SYMBOL = "+getSymbol()); + } + if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) + lines.add("CHARGE = "+getCharge()/3f+" eV"); + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) + lines.add(getColor()<0?"NOT COLORED":"CARRIES COLOR"); + if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) + lines.add("MASS = "+getMass()+" eV/c\u00b2"); + if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add((isTimeSpanHalfLife()?"HALF LIFE = ":"LIFE TIME = ")+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } + public static void run() { try { cElementalDefinition.addCreatorFromNBT(nbtType, cElementalPrimitive.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-128); diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/iElementalDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/iElementalDefinition.java new file mode 100644 index 0000000000..c34bca652e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/iElementalDefinition.java @@ -0,0 +1,74 @@ +package com.github.technus.tectech.elementalMatter.core.templates; + +import com.github.technus.tectech.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.core.transformations.aFluidDequantizationInfo; +import com.github.technus.tectech.elementalMatter.core.transformations.aItemDequantizationInfo; +import com.github.technus.tectech.elementalMatter.core.transformations.aOredictDequantizationInfo; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.ArrayList; + +/** + * Created by danie_000 on 11.11.2016. + */ +public abstract class iElementalDefinition implements Comparable<iElementalDefinition>,Cloneable {//IMMUTABLE + public static final float STABLE_RAW_LIFE_TIME =1.5e36f; + public static final float NO_DECAY_RAW_LIFE_TIME=-1; + public static final long DEFAULT_ENERGY_LEVEL=0; + public static final float DEFAULT_ENERGY_REQUIREMENT=25000f; + + //Nomenclature + public abstract String getName(); + + public abstract String getSymbol(); + + public abstract void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel); + + public abstract byte getType(); + + public abstract byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED + + //Not dynamically changing stuff + public abstract iElementalDefinition getAnti();//gives new anti particle def + + public abstract cElementalDecay[] getDecayArray();//possible decays + + public abstract cElementalDecay[] getNaturalDecayInstant();//natural decay if lifespan <1tick + + public abstract cElementalDecay[] getEnergyInducedDecay(long energyLevel);//energetic decay + + public abstract boolean usesSpecialEnergeticDecayHandling(); + + public abstract float getEnergyDiffBetweenStates(long currentEnergy, long newEnergyLevel);//positive or negative + + public abstract float getMass();//mass... MeV/c^2 + + public abstract int getCharge();//charge 1/3 electron charge + + //dynamically changing stuff + public abstract byte getColor();//-1 nope cannot 0 it can but undefined + + public abstract float getRawTimeSpan(long currentEnergy);//defined in static fields or generated + + public abstract boolean isTimeSpanHalfLife(); + + public abstract cElementalDefinitionStackMap getSubParticles();//contents... null if none + + public abstract aFluidDequantizationInfo someAmountIntoFluidStack(); + + public abstract aItemDequantizationInfo someAmountIntoItemsStack(); + + public abstract aOredictDequantizationInfo someAmountIntoOredictStack(); + + public abstract NBTTagCompound toNBT(); + + public abstract cElementalDefinitionStack getStackForm(int i); + + public abstract iElementalDefinition clone(); + + final int compareClassID(iElementalDefinition obj) { + return ((int) getClassType()) - obj.getClassType(); + } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/aFluidDequantizationInfo.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/aFluidDequantizationInfo.java index 9126ae2073..6da5ffe114 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/aFluidDequantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/aFluidDequantizationInfo.java @@ -1,7 +1,7 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core.transformations; -import com.github.technus.tectech.elementalMatter.interfaces.iExchangeInfo; -import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.interfaces.iExchangeInfo; +import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/aFluidQuantizationInfo.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/aFluidQuantizationInfo.java index 1c26cd2747..0848c7b9f9 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/aFluidQuantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/aFluidQuantizationInfo.java @@ -1,7 +1,7 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core.transformations; -import com.github.technus.tectech.elementalMatter.interfaces.iExchangeInfo; -import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.interfaces.iExchangeInfo; +import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/aItemDequantizationInfo.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/aItemDequantizationInfo.java index 08162a234c..c04f180215 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/aItemDequantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/aItemDequantizationInfo.java @@ -1,7 +1,7 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core.transformations; -import com.github.technus.tectech.elementalMatter.interfaces.iExchangeInfo; -import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.interfaces.iExchangeInfo; +import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_OreDictUnificator; diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/aItemQuantizationInfo.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/aItemQuantizationInfo.java index c58fd286b7..ce652e9d6d 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/aItemQuantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/aItemQuantizationInfo.java @@ -1,7 +1,7 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core.transformations; -import com.github.technus.tectech.elementalMatter.interfaces.iExchangeInfo; -import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.interfaces.iExchangeInfo; +import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/aOredictDequantizationInfo.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/aOredictDequantizationInfo.java index 0f71d1e017..e19ac74d63 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/aOredictDequantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/aOredictDequantizationInfo.java @@ -1,7 +1,7 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core.transformations; -import com.github.technus.tectech.elementalMatter.interfaces.iExchangeInfo; -import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.interfaces.iExchangeInfo; +import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import net.minecraftforge.oredict.OreDictionary; diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/aOredictQuantizationInfo.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/aOredictQuantizationInfo.java index 61c6a39064..9edaa93d98 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/aOredictQuantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/aOredictQuantizationInfo.java @@ -1,7 +1,7 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core.transformations; -import com.github.technus.tectech.elementalMatter.interfaces.iExchangeInfo; -import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.interfaces.iExchangeInfo; +import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import net.minecraftforge.oredict.OreDictionary; diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/classes/bTransformationInfo.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/bTransformationInfo.java index 5434c65d8f..e51142c841 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/classes/bTransformationInfo.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/bTransformationInfo.java @@ -1,7 +1,7 @@ -package com.github.technus.tectech.elementalMatter.classes; +package com.github.technus.tectech.elementalMatter.core.transformations; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; -import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import net.minecraft.item.ItemStack; diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/dAtomDefinition.java new file mode 100644 index 0000000000..75aabe9af3 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/dAtomDefinition.java @@ -0,0 +1,1444 @@ +package com.github.technus.tectech.elementalMatter.definitions.complex.atom; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.Util; +import com.github.technus.tectech.XSTR; +import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; +import com.github.technus.tectech.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; +import com.github.technus.tectech.elementalMatter.core.cElementalMutableDefinitionStackMap; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.core.tElementalException; +import com.github.technus.tectech.elementalMatter.core.templates.cElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.transformations.aFluidDequantizationInfo; +import com.github.technus.tectech.elementalMatter.core.transformations.aItemDequantizationInfo; +import com.github.technus.tectech.elementalMatter.core.transformations.aOredictDequantizationInfo; +import com.github.technus.tectech.elementalMatter.core.transformations.bTransformationInfo; +import com.github.technus.tectech.elementalMatter.definitions.complex.hadron.dHadronDefinition; +import com.github.technus.tectech.elementalMatter.definitions.primitive.eBosonDefinition; +import com.github.technus.tectech.elementalMatter.definitions.primitive.eLeptonDefinition; +import com.github.technus.tectech.elementalMatter.definitions.primitive.eNeutrinoDefinition; +import cpw.mods.fml.common.Loader; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.*; + +import static com.github.technus.tectech.XSTR.XSTR_INSTANCE; +import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; +import static com.github.technus.tectech.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static gregtech.api.enums.OrePrefixes.dust; + +/** + * Created by danie_000 on 18.11.2016. + */ +public final class dAtomDefinition extends cElementalDefinition { + public static final long ATOM_COMPLEXITY_LIMIT=65536L; + private static final byte BYTE_OFFSET=32; + + private final int hash; + public static final bTransformationInfo transformation=new bTransformationInfo(16,0,64); + public static float refMass, refUnstableMass; + + private static final byte nbtType = (byte) 'a'; + private static final Random xstr = new XSTR();//NEEDS SEPARATE! + private static Map<Integer, TreeSet<Integer>> stableIsotopes = new HashMap<>(); + private static final Map<Integer, dAtomDefinition> stableAtoms = new HashMap<>(); + private static Map<Integer, TreeMap<Float, Integer>> mostStableUnstableIsotopes = new HashMap<>(); + private static final Map<Integer, dAtomDefinition> unstableAtoms = new HashMap<>(); + private static cElementalDefinitionStack alpha,deuterium,tritium,helium_3,beryllium_8,carbon_14,neon_24,silicon_34; + private static final HashMap<dAtomDefinition,Float> lifetimeOverrides = new HashMap<>(); + public static final ArrayList<Runnable> overrides = new ArrayList<>(); + + public final iaeaNuclide iaea; + + public static void addOverride(dAtomDefinition atom, float rawLifeTime){ + lifetimeOverrides.put(atom,rawLifeTime); + } + + //float-mass in eV/c^2 + public final float mass; + //public final int charge; + public final int charge; + //int -electric charge in 1/3rds of electron charge for optimization + public final int chargeLeptons; + private float rawLifeTime; + //generation max present inside - minus if contains any anti quark + public final byte type; + + public final byte decayMode;//t neutron to proton+,0,f proton to neutron + //public final boolean stable; + + public final int neutralCount; + public final int element; + + private final boolean iaeaDefinitionExistsAndHasEnergyLevels; + + private final cElementalDefinitionStackMap elementalStacks; + + //stable is rawLifeTime>=10^9 + + @Deprecated + public dAtomDefinition(iElementalDefinition... things) throws tElementalException { + this(true, new cElementalDefinitionStackMap(things)); + } + + @Deprecated + private dAtomDefinition(boolean check, iElementalDefinition... things) throws tElementalException { + this(check, new cElementalDefinitionStackMap(things)); + } + + public dAtomDefinition(cElementalDefinitionStack... things) throws tElementalException { + this(true, new cElementalDefinitionStackMap(things)); + } + + private dAtomDefinition(boolean check, cElementalDefinitionStack... things) throws tElementalException { + this(check, new cElementalDefinitionStackMap(things)); + } + + public dAtomDefinition(cElementalDefinitionStackMap things) throws tElementalException { + this(true, things); + } + + private dAtomDefinition(boolean check, cElementalDefinitionStackMap things) throws tElementalException { + if (check && !canTheyBeTogether(things)) throw new tElementalException("Atom Definition error"); + this.elementalStacks = things; + + float mass = 0; + int cLeptons = 0; + int cNucleus = 0; + int neutralCount = 0, element = 0; + int type = 0; + boolean containsAnti = false; + for (cElementalDefinitionStack stack : elementalStacks.values()) { + iElementalDefinition def = stack.definition; + int amount = (int)stack.amount; + mass += stack.getMass(); + if (def.getType() < 0) containsAnti = true; + type = Math.max(type, Math.abs(def.getType())); + + if (def instanceof eLeptonDefinition) { + cLeptons += stack.getCharge(); + } else { + cNucleus += stack.getCharge(); + if (def.getCharge() == 3) element += amount; + else if (def.getCharge() == -3) element -= amount; + else if (def.getCharge() == 0) neutralCount += amount; + } + } + this.type = containsAnti ? (byte) -type : (byte) type; + //this.mass = mass; + this.chargeLeptons = cLeptons; + this.charge = cNucleus + cLeptons; + this.neutralCount = neutralCount; + this.element = element; + + element = Math.abs(element); + + //stability curve + int StableIsotope = stableIzoCurve(element); + int izoDiff = neutralCount - StableIsotope; + int izoDiffAbs = Math.abs(izoDiff); + + xstr.setSeed((element + 1L) * (neutralCount + 100L)); + this.iaea=iaeaNuclide.get(element,neutralCount); + if(iaea!=null){ + if(Float.isNaN(iaea.mass)) this.mass=mass; + else this.mass=iaea.mass; + + if(Float.isNaN(iaea.halfTime)) { + Float overriddenLifeTime=lifetimeOverrides.get(this); + float rawLifeTimeTemp; + if(overriddenLifeTime!=null) + rawLifeTimeTemp = overriddenLifeTime; + else { + rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); + } + this.rawLifeTime=rawLifeTimeTemp> STABLE_RAW_LIFE_TIME ? STABLE_RAW_LIFE_TIME :rawLifeTimeTemp; + }else { + this.rawLifeTime = containsAnti ? iaea.halfTime * 1.5514433E-21f * (1f + xstr.nextFloat() * 9f) : iaea.halfTime; + } + this.iaeaDefinitionExistsAndHasEnergyLevels =iaea.energeticStatesArray.length>1; + }else{ + this.mass=mass; + + Float overriddenLifeTime=lifetimeOverrides.get(this); + float rawLifeTimeTemp; + if(overriddenLifeTime!=null) + rawLifeTimeTemp = overriddenLifeTime; + else { + rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); + } + this.rawLifeTime=rawLifeTimeTemp> STABLE_RAW_LIFE_TIME ? STABLE_RAW_LIFE_TIME :rawLifeTimeTemp; + + this.iaeaDefinitionExistsAndHasEnergyLevels =false; + } + + if(iaea==null || iaea.energeticStatesArray[0].energy!=0) { + if (izoDiff == 0) + this.decayMode = 0; + else + this.decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) : (byte) -Math.min(2, 1 + izoDiffAbs / 4); + }else{ + this.decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4)+ BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET); + } + //this.stable = this.rawLifeTime >= STABLE_RAW_LIFE_TIME; + + hash=super.hashCode(); + } + + private static int stableIzoCurve(int element) { + return (int) Math.round(-1.19561E-06 * Math.pow(element, 4D) + + 1.60885E-04 * Math.pow(element, 3D) + + 3.76604E-04 * Math.pow(element, 2D) + + 1.08418E+00 * (double) element); + } + + private static float calculateLifeTime(int izoDiff, int izoDiffAbs, int element, int isotope, boolean containsAnti) { + float rawLifeTime; + + if (element <= 83 && isotope < 127 && (izoDiffAbs == 0 || + (element == 1 && isotope == 0) || + (element == 2 && isotope == 1) || + (izoDiffAbs == 1 && element > 2 && element % 2 == 1) || + (izoDiffAbs == 3 && element > 30 && element % 2 == 0) || + (izoDiffAbs == 5 && element > 30 && element % 2 == 0) || + (izoDiffAbs == 2 && element > 20 && element % 2 == 1))) { + rawLifeTime = containsAnti ? 2.381e4f * (1f + xstr.nextFloat() * 9f) : (1f + xstr.nextFloat() * 9f) * 1.5347e25F; + } else { + //Y = (X-A)/(B-A) * (D-C) + C + float unstabilityEXP = 0; + if (element == 0) { + return 1e-35f; + } else if (element == 1) { + unstabilityEXP = 1.743f - (Math.abs(izoDiff - 1) * 9.743f); + } else if (element == 2) { + switch (isotope) { + case 4: + unstabilityEXP = 1.61f; + break; + case 5: + unstabilityEXP = -7.523F; + break; + case 6: + unstabilityEXP = -1.51f; + break; + default: + unstabilityEXP = -(izoDiffAbs * 6.165F); + break; + } + } else if (element <= 83 || (isotope <= 127 && element <= 120)) { + float elementPow4 = (float) Math.pow(element, 4f); + + unstabilityEXP = Math.min(element / 2.4f, 6 + ((element + 1) % 2) * 3e6F / elementPow4) + (((float) -izoDiff * elementPow4) / 1e8F) - (Math.abs(izoDiff - 1 + element / 60F) * (3f - (element / 12.5f) + ((element * element) / 1500f))); + } else if (element < 180) { + unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5F - (element - 85) / 3F) - (Math.abs(izoDiff) * (3f - (element / 13f) + ((element * element) / 1600f))); + } else return -1; + if ((isotope == 127 || isotope == 128) && (element < 120 && element > 83)) unstabilityEXP -= 1.8f; + if (element > 83 && element < 93 && isotope % 2 == 0 && izoDiff == 3) unstabilityEXP += 6; + if (element > 93 && element < 103 && isotope % 2 == 0 && izoDiff == 4) unstabilityEXP += 6; + rawLifeTime = (containsAnti ? 1e-8f : 1f) * (float) (Math.pow(10F, unstabilityEXP)) * (1f + xstr.nextFloat() * 9f); + } + + if (rawLifeTime < 8e-15) return 1e-35f; + if (rawLifeTime > 8e28) return 8e30f; + return rawLifeTime; + } + + private static boolean canTheyBeTogether(cElementalDefinitionStackMap stacks) { + boolean nuclei = false; + long qty=0; + for (cElementalDefinitionStack stack : stacks.values()) { + if (stack.definition instanceof dHadronDefinition) { + if (((dHadronDefinition) stack.definition).amount != 3) return false; + nuclei = true; + } else if (!(stack.definition instanceof eLeptonDefinition)) return false; + qty+=stack.amount; + } + return nuclei && qty<ATOM_COMPLEXITY_LIMIT; + } + + @Override + public int getCharge() { + return charge; + } + + public int getChargeLeptons() { + return chargeLeptons; + } + + public int getChargeHadrons() { + return charge - chargeLeptons; + } + + public int getIonizationElementWise() { + return (element * 3) + chargeLeptons; + } + + @Override + public float getMass() { + return mass; + } + + @Override + public byte getType() { + return type; + } + + @Override + public float getRawTimeSpan(long currentEnergy) { + if(currentEnergy<=0) return rawLifeTime; + if(iaeaDefinitionExistsAndHasEnergyLevels){ + if(currentEnergy>=iaea.energeticStatesArray.length){ + return iaea.energeticStatesArray[iaea.energeticStatesArray.length-1].Thalf/(currentEnergy-iaea.energeticStatesArray.length+1); + } + return iaea.energeticStatesArray[(int)currentEnergy].Thalf; + } + return rawLifeTime/(currentEnergy+1); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } + + @Override + public byte getColor() { + return -10; + } + + @Override + public String getName() { + final int element = Math.abs(this.element); + final boolean negative = element < 0; + try { + if (type != 1) return (negative ? "~? " : "? ") + nomenclature.Name[element]; + return negative ? "~" + nomenclature.Name[-element] : nomenclature.Name[element]; + } catch (Exception e) { + if (DEBUG_MODE) e.printStackTrace(); + return (negative ? "Element: ~" : "Element: ") + element; + } + } + + @Override + public String getSymbol() { + final int element = Math.abs(this.element); + final boolean negative = element < 0; + try { + return (negative ? "~" : "") + nomenclature.Symbol[element] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C: " + getCharge(); + } catch (Exception e) { + if (DEBUG_MODE) e.printStackTrace(); + try { + int s100 = element / 100, s1 = (element / 10) % 10, s10 = (element) % 10; + return (negative ? "~" : "") + nomenclature.SymbolIUPAC[10 + s100] + nomenclature.SymbolIUPAC[s10] + nomenclature.SymbolIUPAC[s1] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C: " + getCharge(); + } catch (Exception E) { + if (DEBUG_MODE) e.printStackTrace(); + return (negative ? "~" : "") + "? N:" + neutralCount + " I:" + (neutralCount+element) + " C: " + getCharge(); + } + } + } + + @Override + public cElementalDefinitionStackMap getSubParticles() { + return elementalStacks.clone(); + } + + @Override + public cElementalDecay[] getDecayArray() { + ArrayList<cElementalDecay> decaysList=new ArrayList<>(4); + return getDecayArray(decaysList,decayMode,true); + } + + private cElementalDecay[] getDecayArray(ArrayList<cElementalDecay> decaysList,int decayMode,boolean tryAnti) { + if (this.type == 1) { + switch (decayMode) { + case -2: + if(TecTech.Rnd.nextBoolean() && ElectronCapture(decaysList)) + return decaysList.toArray(new cElementalDecay[decaysList.size()]); + else if(PbetaDecay(decaysList)) + return decaysList.toArray(new cElementalDecay[decaysList.size()]); + break; + case -1: + if(Emmision(decaysList, dHadronDefinition.hadron_p1)) + return decaysList.toArray(new cElementalDecay[decaysList.size()]); + break; + case 0: + if(alphaDecay(decaysList)) + return decaysList.toArray(new cElementalDecay[decaysList.size()]); + break; + case 1: + if(Emmision(decaysList, dHadronDefinition.hadron_n1)) + return decaysList.toArray(new cElementalDecay[decaysList.size()]); + break; + case 2: + if(MbetaDecay(decaysList)) + return decaysList.toArray(new cElementalDecay[decaysList.size()]); + break; + default: + if(decayMode>8){ + if(iaeaDecay(decaysList,0)) + return decaysList.toArray(new cElementalDecay[decaysList.size()]); + return getDecayArray(decaysList,decayMode-BYTE_OFFSET,false); + } + } + return cElementalDecay.noDecay; + }else if(this.type==-1){ + dAtomDefinition anti=getAnti(); + if(anti!=null) return anti.getDecayArray(decaysList,decayMode,false); + } + return getNaturalDecayInstant(); + } + + private boolean iaeaDecay(ArrayList<cElementalDecay> decaysList,long energy){ + iaeaNuclide.energeticState state; + if(energy>iaea.energeticStatesArray.length) state = iaea.energeticStatesArray[iaea.energeticStatesArray.length-1]; + else if(energy<=0) state = iaea.energeticStatesArray[0]; + else state=iaea.energeticStatesArray[(int)energy]; + for (int i=0;i<state.decaymodes.length;i++){ + if(!getDecayFromIaea(decaysList,state.decaymodes[i],energy)) { + decaysList.clear(); + return false; + } + } + return decaysList.size()>0; + } + + private boolean getDecayFromIaea(ArrayList<cElementalDecay> decaysList, iaeaNuclide.iaeaDecay decay, long energy){ + cElementalMutableDefinitionStackMap withThis=elementalStacks.toMutable(),newStuff=new cElementalMutableDefinitionStackMap(); + switch (decay.decayName){ + case "D": { + if (withThis.removeAllAmounts(false, deuterium.definition.getSubParticles())){ + withThis.putReplace(deuterium); + decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + } + } break; + case "3H": { + if (withThis.removeAllAmounts(false, tritium.definition.getSubParticles())){ + withThis.putReplace(tritium); + decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + } + } break; + case "3HE": { + if (withThis.removeAllAmounts(false, helium_3.definition.getSubParticles())){ + withThis.putReplace(helium_3); + decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + } + } break; + case "8BE": { + if (withThis.removeAllAmounts(false, beryllium_8.definition.getSubParticles())){ + withThis.putReplace(beryllium_8); + decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + } + } break; + case "14C": { + if (withThis.removeAllAmounts(false, carbon_14.definition.getSubParticles())){ + newStuff.putReplace(carbon_14); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "24NE": { + if (withThis.removeAllAmounts(false, neon_24.definition.getSubParticles())){ + newStuff.putReplace(neon_24); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "34SI": { + if (withThis.removeAllAmounts(false, silicon_34.definition.getSubParticles())){ + newStuff.putReplace(silicon_34); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "A": case "A?": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2,dHadronDefinition.hadron_p2)){ + newStuff.putReplace(alpha); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "B+": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1)){ + withThis.putUnify(dHadronDefinition.hadron_n1); + newStuff.putReplace(eLeptonDefinition.lepton_e_1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "2B+": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){ + withThis.putUnify(dHadronDefinition.hadron_n2); + newStuff.putReplace(eLeptonDefinition.lepton_e_2); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "B-": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ + withThis.putUnify(dHadronDefinition.hadron_p1); + newStuff.putReplace(eLeptonDefinition.lepton_e1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "2B-": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){ + withThis.putUnify(dHadronDefinition.hadron_p2); + newStuff.putReplace(eLeptonDefinition.lepton_e2); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_2); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "EC": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)){ + withThis.putUnify(dHadronDefinition.hadron_n1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "2EC": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e2)){ + withThis.putUnify(dHadronDefinition.hadron_n2); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "B++EC": case "EC+B+": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){ + withThis.putUnify(dHadronDefinition.hadron_n2); + newStuff.putReplace(eLeptonDefinition.lepton_e_1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "B+A": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p3, dHadronDefinition.hadron_n1)){ + newStuff.putReplace(eLeptonDefinition.lepton_e_1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(alpha); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "B+P": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){ + withThis.putUnify(dHadronDefinition.hadron_n1); + newStuff.putReplace(eLeptonDefinition.lepton_e_1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(dHadronDefinition.hadron_p1); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "B+2P": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p3)){ + withThis.putUnify(dHadronDefinition.hadron_n1); + newStuff.putReplace(eLeptonDefinition.lepton_e_1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(dHadronDefinition.hadron_p2); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "B-A": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n3, dHadronDefinition.hadron_p1)){ + newStuff.putReplace(eLeptonDefinition.lepton_e1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); + newStuff.putReplace(alpha); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "B-N": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){ + withThis.putUnify(dHadronDefinition.hadron_p1); + newStuff.putReplace(eLeptonDefinition.lepton_e1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); + newStuff.putReplace(dHadronDefinition.hadron_n1); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "B-2N": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n3)){ + withThis.putUnify(dHadronDefinition.hadron_p1); + newStuff.putReplace(eLeptonDefinition.lepton_e1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); + newStuff.putReplace(dHadronDefinition.hadron_n2); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "B-P": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ + newStuff.putReplace(eLeptonDefinition.lepton_e1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); + newStuff.putReplace(dHadronDefinition.hadron_p1); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "ECA": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1,eLeptonDefinition.lepton_e1,dHadronDefinition.hadron_p3)){ + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(alpha); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "ECP": { + if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e1,dHadronDefinition.hadron_p2)){ + withThis.putUnify(dHadronDefinition.hadron_n1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(dHadronDefinition.hadron_p1); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "EC2P": { + if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e1,dHadronDefinition.hadron_p3)){ + withThis.putUnify(dHadronDefinition.hadron_n1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(dHadronDefinition.hadron_p2); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "ECP+EC2P": {//todo look at branching ratios + if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e2,dHadronDefinition.hadron_p5)){ + withThis.putUnify(dHadronDefinition.hadron_n1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); + newStuff.putReplace(dHadronDefinition.hadron_p3); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "N": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ + newStuff.putReplace(dHadronDefinition.hadron_n1); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "2N": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){ + newStuff.putReplace(dHadronDefinition.hadron_n2); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "P": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1)){ + newStuff.putReplace(dHadronDefinition.hadron_p1); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "2P": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){ + newStuff.putReplace(dHadronDefinition.hadron_p2); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "SF": + if(Fission(decaysList,withThis,newStuff,decay.chance,false)) return true; + case "B-F": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ + withThis.putUnify(dHadronDefinition.hadron_p1); + newStuff.putReplace(eLeptonDefinition.lepton_e1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); + try{ + if(Fission(decaysList,withThis,newStuff,decay.chance,false)) return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "ECF": case "ECSF": case "EC(+SF)": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)){ + withThis.putUnify(dHadronDefinition.hadron_n1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); + try{ + if(Fission(decaysList,withThis,newStuff,decay.chance,false)) return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "SF(+EC+B+)": case "SF+EC+B+": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){ + withThis.putUnify(dHadronDefinition.hadron_n2); + newStuff.putReplace(eLeptonDefinition.lepton_e_1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); + try{ + if(Fission(decaysList,withThis,newStuff,decay.chance,false)) return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "SF+EC+B-": { + if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e1)){ + newStuff.putReplace(eLeptonDefinition.lepton_e1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); + try{ + if(Fission(decaysList,withThis,newStuff,decay.chance,false)) return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "IT": case "IT?": case "G": { + if(energy>0){ + decaysList.add(new cElementalDecay(decay.chance, this, eBosonDefinition.boson_Y__)); + return true; + }else{ + if(DEBUG_MODE) TecTech.Logger.info("Tried to emit Gamma from ground state"); + decaysList.add(new cElementalDecay(decay.chance, this)); + return true; + } + } //break; + case "IT+EC+B+": { + if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){ + withThis.putUnify(dHadronDefinition.hadron_n2); + newStuff.putReplace(eLeptonDefinition.lepton_e_1); + newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); + newStuff.putReplace(eBosonDefinition.boson_Y__1); + try{ + newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_unsafeMightLeaveExposedElementalTree()).getStackForm(1)); + decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + }catch (Exception e){ + if(DEBUG_MODE) e.printStackTrace(); + } + } + } break; + case "DEAD_END": + decaysList.add(deadEnd); + return true; + default: throw new Error("Unsupported decay mode: " + decay.decayName + " "+ neutralCount+" "+element); + } + if(DEBUG_MODE) TecTech.Logger.info("Failed to decay "+element+" "+neutralCount+" "+decay.decayName); + return false; + } + + private boolean Emmision(ArrayList<cElementalDecay> decaysList, cElementalDefinitionStack emit) { + final cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAmount(false, emit)) { + try { + decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_unsafeMightLeaveExposedElementalTree()), 1), emit)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) e.printStackTrace(); + } + } + return false; + } + + private boolean alphaDecay(ArrayList<cElementalDecay> decaysList) { + final cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAllAmounts(false, alpha.definition.getSubParticles())) { + try { + decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_unsafeMightLeaveExposedElementalTree()), 1), alpha)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) e.printStackTrace(); + } + } + return false; + } + + private boolean MbetaDecay(ArrayList<cElementalDecay> decaysList) { + final cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAmount(false, dHadronDefinition.hadron_n1)) { + try { + tree.putUnify(dHadronDefinition.hadron_p1); + decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_unsafeMightLeaveExposedElementalTree()), 1), eLeptonDefinition.lepton_e1, eNeutrinoDefinition.lepton_Ve_1)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) e.printStackTrace(); + } + } + return false; + } + + private boolean PbetaDecay(ArrayList<cElementalDecay> decaysList) { + final cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAmount(false, dHadronDefinition.hadron_p1)) { + try { + tree.putUnify(dHadronDefinition.hadron_n1); + decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_unsafeMightLeaveExposedElementalTree()), 1), eLeptonDefinition.lepton_e_1, eNeutrinoDefinition.lepton_Ve1)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) e.printStackTrace(); + } + } + return false; + } + + private boolean ElectronCapture(ArrayList<cElementalDecay> decaysList) { + final cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)) { + try { + tree.putUnify(dHadronDefinition.hadron_n1); + decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_unsafeMightLeaveExposedElementalTree()), 1), eNeutrinoDefinition.lepton_Ve1)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) e.printStackTrace(); + } + } + return false; + } + + private boolean Fission(ArrayList<cElementalDecay> decaysList, cElementalMutableDefinitionStackMap fissile, cElementalMutableDefinitionStackMap particles,float probability,boolean spontaneousCheck) { + final cElementalMutableDefinitionStackMap heavy = new cElementalMutableDefinitionStackMap(); + final double[] liquidDrop=liquidDropFunction(Math.abs(element)<=97); + + for(cElementalDefinitionStack stack: fissile.values()){ + if(spontaneousCheck && stack.definition instanceof dHadronDefinition && + (stack.amount<=80 || (stack.amount<90 && XSTR_INSTANCE.nextInt(10)<stack.amount-80))) + return false; + if(stack.definition.getCharge()==0){ + //if(stack.definition instanceof dHadronDefinition){ + double neutrals=stack.amount*liquidDrop[2]; + int neutrals_cnt=(int)Math.floor(neutrals); + neutrals_cnt+=neutrals-neutrals_cnt>XSTR_INSTANCE.nextDouble()?1:0; + particles.putUnify(new cElementalDefinitionStack(stack.definition, neutrals_cnt)); + + int heavy_cnt=(int)Math.ceil(stack.amount*liquidDrop[1]); + while(heavy_cnt+neutrals_cnt>stack.amount) + heavy_cnt--; + fissile.removeAmount(false,new cElementalDefinitionStack(stack.definition,heavy_cnt+neutrals_cnt)); + heavy.putReplace(new cElementalDefinitionStack(stack.definition, heavy_cnt)); + //}else{ + // particles.add(stack); + // light.remove(stack.definition); + //} + }else{ + int heavy_cnt=(int)Math.ceil(stack.amount*liquidDrop[0]); + if(heavy_cnt%2==1 && XSTR_INSTANCE.nextFloat()>0.05f) + heavy_cnt--; + cElementalDefinitionStack new_stack=new cElementalDefinitionStack(stack.definition, heavy_cnt); + fissile.removeAmount(false,new_stack); + heavy.putReplace(new_stack); + } + } + + try { + particles.putReplace(new cElementalDefinitionStack(new dAtomDefinition(fissile.toImmutable_unsafeMightLeaveExposedElementalTree()),1)); + particles.putReplace(new cElementalDefinitionStack(new dAtomDefinition(heavy.toImmutable_unsafeMightLeaveExposedElementalTree()),1)); + decaysList.add(new cElementalDecay(probability, particles.toImmutable_unsafeMightLeaveExposedElementalTree())); + return true; + } catch (Exception e) { + if(DEBUG_MODE) e.printStackTrace(); + } + return false; + } + + private static double[] liquidDropFunction(boolean asymmetric) { + double[] out = new double[3]; + + out[0] = XSTR_INSTANCE.nextGaussian(); + + if (out[0] < 1 && out[0] >= -1) + if (XSTR_INSTANCE.nextBoolean()) + out[0] = XSTR_INSTANCE.nextDouble() * 2d - 1d; + + if (asymmetric && out[0] > XSTR_INSTANCE.nextDouble() && XSTR_INSTANCE.nextInt(4) == 0) + out[0] = -out[0]; + + //scale to splitting ratio + out[0] = out[0] * 0.05d + .6d; + + if (out[0] < 0 || out[0] > 1) + return liquidDropFunction(asymmetric); + if (out[0] < .5d) + out[0] = 1d - out[0]; + + //extra neutrals + out[2] = 0.012d + XSTR_INSTANCE.nextDouble() * 0.01d; + + if (asymmetric) + out[1] = out[0]; + else + out[1] = out[0] - out[2] * .5d; + + return out; + } + + @Override + public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { + if (iaeaDefinitionExistsAndHasEnergyLevels) { + ArrayList<cElementalDecay> decays=new ArrayList<>(4); + if(iaeaDecay(decays,energyLevel)){ + return decays.toArray(new cElementalDecay[decays.size()]); + } + } + if(energyLevel< Math.abs(charge)/3+neutralCount) { + return new cElementalDecay[]{new cElementalDecay(1, this, eBosonDefinition.boson_Y__)}; + } + return getNaturalDecayInstant(); + } + + @Override + public float getEnergyDiffBetweenStates(long currentEnergyLevel,long newEnergyLevel) { + if(iaeaDefinitionExistsAndHasEnergyLevels){ + float result=0; + boolean backwards=newEnergyLevel<currentEnergyLevel; + if(backwards){ + long temp=currentEnergyLevel; + currentEnergyLevel=newEnergyLevel; + newEnergyLevel=temp; + } + + if(currentEnergyLevel<=0){ + if(newEnergyLevel<=0) return DEFAULT_ENERGY_REQUIREMENT*(newEnergyLevel-currentEnergyLevel); + else result+=DEFAULT_ENERGY_REQUIREMENT*(-currentEnergyLevel); + }else result-=iaea.energeticStatesArray[(int)Math.min(iaea.energeticStatesArray.length-1,currentEnergyLevel)].energy; + if(newEnergyLevel>=iaea.energeticStatesArray.length){ + if(currentEnergyLevel>=iaea.energeticStatesArray.length) return DEFAULT_ENERGY_REQUIREMENT*(newEnergyLevel-currentEnergyLevel); + else result+=DEFAULT_ENERGY_REQUIREMENT*(newEnergyLevel-iaea.energeticStatesArray.length+1); + result+=iaea.energeticStatesArray[iaea.energeticStatesArray.length-1].energy; + }else result+=iaea.energeticStatesArray[(int)Math.max(0,newEnergyLevel)].energy; + + return backwards?-result:result; + } + return DEFAULT_ENERGY_REQUIREMENT*(newEnergyLevel-currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return iaeaDefinitionExistsAndHasEnergyLevels; + } + + @Override + public cElementalDecay[] getNaturalDecayInstant() { + //disembody + ArrayList<cElementalDefinitionStack> decaysInto = new ArrayList<>(); + for (cElementalDefinitionStack elementalStack : elementalStacks.values()) { + if (elementalStack.definition.getType() == 1 || elementalStack.definition.getType() == -1) { + //covers both quarks and antiquarks + decaysInto.add(elementalStack); + } else { + //covers both quarks and antiquarks + decaysInto.add(new cElementalDefinitionStack(boson_Y__, 2)); + } + } + return new cElementalDecay[]{new cElementalDecay(0.75F, decaysInto.toArray(new cElementalDefinitionStack[decaysInto.size()])), eBosonDefinition.deadEnd}; + } + + //@Override + //public iElementalDefinition getAnti() { + // cElementalDefinitionStack[] stacks = this.elementalStacks.values(); + // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length]; + // for (int i = 0; i < antiElements.length; i++) { + // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); + // } + // try { + // return new dAtomDefinition(false, antiElements); + // } catch (tElementalException e) { + // if (DEBUG_MODE) e.printStackTrace(); + // return null; + // } + //} + + @Override + public dAtomDefinition getAnti() { + cElementalMutableDefinitionStackMap anti = new cElementalMutableDefinitionStackMap(); + for (cElementalDefinitionStack stack : elementalStacks.values()) + anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount)); + try { + return new dAtomDefinition(anti.toImmutable_unsafeMightLeaveExposedElementalTree()); + } catch (tElementalException e) { + if (DEBUG_MODE) e.printStackTrace(); + return null; + } + } + + @Override + public aFluidDequantizationInfo someAmountIntoFluidStack() { + return transformation.fluidDequantization.get(this); + } + + @Override + public aItemDequantizationInfo someAmountIntoItemsStack() { + return null; + } + + @Override + public aOredictDequantizationInfo someAmountIntoOredictStack() { + return transformation.oredictDequantization.get(this); + } + + private final static class nomenclature { + private nomenclature(){} + static final private 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"}; + static final private 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"}; + static final private String[] SymbolIUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; + } + + @Override + public NBTTagCompound toNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setByte("t", nbtType); + cElementalDefinitionStack[] elementalStacksValues = elementalStacks.values(); + nbt.setInteger("i", elementalStacksValues.length); + for (int i = 0; i < elementalStacksValues.length; i++) + nbt.setTag(Integer.toString(i), elementalStacksValues[i].toNBT()); + return nbt; + } + + public static iElementalDefinition fromNBT(NBTTagCompound nbt) { + cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < stacks.length; i++) + stacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); + try { + return new dAtomDefinition(stacks); + } catch (tElementalException e) { + if (DEBUG_MODE) e.printStackTrace(); + return null; + } + } + + public static void run() { + for (Runnable r : overrides) r.run(); + + for(Map.Entry<dAtomDefinition,Float> entry:lifetimeOverrides.entrySet()){ + try { + lifetimeOverrides.put(new dAtomDefinition(entry.getKey().elementalStacks), entry.getValue()); + }catch (tElementalException e){ + e.printStackTrace(); //Impossible + } + } + + //populate stable isotopes + for (int element = 1; element < 83; element++)//Up to Bismuth exclusive + for (int isotope = 0; isotope < 130; isotope++) { + xstr.setSeed((long) (element + 1) * (isotope + 100)); + //stability curve + final int StableIsotope = stableIzoCurve(element); + final int izoDiff = isotope - StableIsotope; + final int izoDiffAbs = Math.abs(izoDiff); + final float rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + iaeaNuclide nuclide=iaeaNuclide.get(element,isotope); + if (rawLifeTime>= STABLE_RAW_LIFE_TIME || (nuclide!=null && nuclide.halfTime >=STABLE_RAW_LIFE_TIME)) { + TreeSet<Integer> isotopes = stableIsotopes.get(element); + if (isotopes == null) stableIsotopes.put(element, isotopes = new TreeSet<>()); + isotopes.add(isotope); + } + } + + //populate unstable isotopes + for (int element = 83; element < 150; element++) + for (int isotope = 100; isotope < 180; isotope++) { + xstr.setSeed((long) (element + 1) * (isotope + 100)); + //stability curve + final int Isotope = stableIzoCurve(element); + final int izoDiff = isotope - Isotope; + final int izoDiffAbs = Math.abs(izoDiff); + final float rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + TreeMap<Float, Integer> isotopes = mostStableUnstableIsotopes.get(element); + if (isotopes == null) mostStableUnstableIsotopes.put(element, isotopes = new TreeMap<>()); + isotopes.put(rawLifeTime, isotope); + } + + try { + for (int key : stableIsotopes.keySet()) { + stableAtoms.put(key, new dAtomDefinition( + new cElementalDefinitionStack(dHadronDefinition.hadron_p, key), + new cElementalDefinitionStack(dHadronDefinition.hadron_n, stableIsotopes.get(key).first()), + new cElementalDefinitionStack(eLeptonDefinition.lepton_e, key))); + if (DEBUG_MODE) + TecTech.Logger.info("Added Stable Atom:" + key + " " + stableIsotopes.get(key).first() + " " + stableAtoms.get(key).getMass()); + } + for (int key : mostStableUnstableIsotopes.keySet()) { + unstableAtoms.put(key, new dAtomDefinition( + new cElementalDefinitionStack(dHadronDefinition.hadron_p, key), + new cElementalDefinitionStack(dHadronDefinition.hadron_n, mostStableUnstableIsotopes.get(key).lastEntry().getValue()), + new cElementalDefinitionStack(eLeptonDefinition.lepton_e, key))); + if (DEBUG_MODE) + TecTech.Logger.info("Added Unstable Atom:" + key + " " + mostStableUnstableIsotopes.get(key).lastEntry().getValue() + " " + unstableAtoms.get(key).getMass()); + } + deuterium=new dAtomDefinition( + dHadronDefinition.hadron_p1, + dHadronDefinition.hadron_n1, + eLeptonDefinition.lepton_e1).getStackForm(1); + tritium=new dAtomDefinition( + dHadronDefinition.hadron_p1, + dHadronDefinition.hadron_n2, + eLeptonDefinition.lepton_e1).getStackForm(1); + helium_3=new dAtomDefinition( + dHadronDefinition.hadron_p2, + dHadronDefinition.hadron_n1, + eLeptonDefinition.lepton_e2).getStackForm(1); + alpha = new dAtomDefinition( + dHadronDefinition.hadron_p2, + dHadronDefinition.hadron_n2).getStackForm(1); + beryllium_8=new dAtomDefinition( + new cElementalDefinitionStack(dHadronDefinition.hadron_p, 4), + new cElementalDefinitionStack(dHadronDefinition.hadron_n, 4), + new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 4)).getStackForm(1); + carbon_14=new dAtomDefinition( + new cElementalDefinitionStack(dHadronDefinition.hadron_p, 6), + new cElementalDefinitionStack(dHadronDefinition.hadron_n, 8), + new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 6)).getStackForm(1); + neon_24=new dAtomDefinition( + new cElementalDefinitionStack(dHadronDefinition.hadron_p, 10), + new cElementalDefinitionStack(dHadronDefinition.hadron_n, 14), + new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 10)).getStackForm(1); + silicon_34=new dAtomDefinition( + new cElementalDefinitionStack(dHadronDefinition.hadron_p, 14), + new cElementalDefinitionStack(dHadronDefinition.hadron_n, 20), + new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 14)).getStackForm(1); + } catch (Exception e) { + if (DEBUG_MODE) e.printStackTrace(); + } + + try { + cElementalDefinition.addCreatorFromNBT(nbtType, dAtomDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)64); + } catch (Exception e) { + if (DEBUG_MODE) e.printStackTrace(); + } + if(DEBUG_MODE) + TecTech.Logger.info("Registered Elemental Matter Class: Atom "+nbtType+" "+64); + } + + public static void setTransformation(){ + /*----STABLE ATOMS----**/ + refMass = getFirstStableIsotope(1).getMass() * 144F; + + transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(1), 144),Materials.Hydrogen.mGas.getID(),144); + transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(2), 144),Materials.Helium.mGas.getID(), 144); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(3), 144), dust, Materials.Lithium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(4), 144), dust, Materials.Beryllium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(5), 144), dust, Materials.Boron,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(6), 144), dust, Materials.Carbon,1); + transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(7), 144),Materials.Nitrogen.mGas.getID(), 144); + transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(8), 144),Materials.Oxygen.mGas.getID(), 144); + transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(9), 144),Materials.Fluorine.mGas.getID(), 144); + //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), 144),Materials.Neon.mGas.getID(), 144); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(11), 144), dust, Materials.Sodium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(12), 144), dust, Materials.Magnesium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(13), 144), dust, Materials.Aluminium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(14), 144), dust, Materials.Silicon,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(15), 144), dust, Materials.Phosphorus,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(16), 144), dust, Materials.Sulfur,1); + transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(17), 144),Materials.Chlorine.mGas.getID(), 144); + transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(18), 144),Materials.Argon.mGas.getID(), 144); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(19), 144), dust, Materials.Potassium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(20), 144), dust, Materials.Calcium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(21), 144), dust, Materials.Scandium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(22), 144), dust, Materials.Titanium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(23), 144), dust, Materials.Vanadium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(24), 144), dust, Materials.Chrome,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(25), 144), dust, Materials.Manganese,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(26), 144), dust, Materials.Iron,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(27), 144), dust, Materials.Cobalt,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(28), 144), dust, Materials.Nickel,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(29), 144), dust, Materials.Copper,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(30), 144), dust, Materials.Zinc,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(31), 144), dust, Materials.Gallium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), 144),OrePrefixes.dust, Materials.Germanium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(33), 144), dust, Materials.Arsenic,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), 144),OrePrefixes.dust, Materials.Selenium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(35), 144),OrePrefixes.dust, Materials.Bromine,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(36), 144),OrePrefixes.dust, Materials.Krypton,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(37), 144), dust, Materials.Rubidium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(38), 144), dust, Materials.Strontium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(39), 144), dust, Materials.Yttrium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), 144),OrePrefixes.dust, Materials.Zirconium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(41), 144), dust, Materials.Niobium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(42), 144), dust, Materials.Molybdenum,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), 144),OrePrefixes.dust, Materials.Technetium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), 144),OrePrefixes.dust, Materials.Ruthenium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), 144),OrePrefixes.dust, Materials.Rhodium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(46), 144), dust, Materials.Palladium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(47), 144), dust, Materials.Silver,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(48), 144), dust, Materials.Cadmium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(49), 144), dust, Materials.Indium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(50), 144), dust, Materials.Tin,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(51), 144), dust, Materials.Antimony,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(52), 144), dust, Materials.Tellurium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), 144),OrePrefixes.dust, Materials.Iodine,1); + //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), 144),Materials.Xenon.mGas.getID(), 144); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(55), 144), dust, Materials.Caesium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(56), 144), dust, Materials.Barium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(57), 144), dust, Materials.Lanthanum,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(58), 144), dust, Materials.Cerium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(59), 144), dust, Materials.Praseodymium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(60), 144), dust, Materials.Neodymium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(61), 144), dust, Materials.Promethium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(62), 144), dust, Materials.Samarium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(63), 144), dust, Materials.Europium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(64), 144), dust, Materials.Gadolinium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(65), 144), dust, Materials.Terbium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(66), 144), dust, Materials.Dysprosium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(67), 144), dust, Materials.Holmium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(68), 144), dust, Materials.Erbium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(69), 144), dust, Materials.Thulium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(70), 144), dust, Materials.Ytterbium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(71), 144), dust, Materials.Lutetium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), 144),OrePrefixes.dust, Materials.Hafnum,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(73), 144), dust, Materials.Tantalum,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(74), 144), dust, Materials.Tungsten,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), 144),OrePrefixes.dust, Materials.Rhenium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(76), 144), dust, Materials.Osmium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(77), 144), dust, Materials.Iridium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(78), 144), dust, Materials.Platinum,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(79), 144), dust, Materials.Gold,1); + transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(80), 144),Materials.Mercury.mFluid.getID(), 144); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), 144),OrePrefixes.dust, Materials.Thallium,1); + transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(82), 144), dust, Materials.Lead,1); + + /*----UNSTABLE ATOMS----**/ + refUnstableMass = getFirstStableIsotope(82).getMass() * 144F; + + transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(83), 144), dust, Materials.Bismuth,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),144),OrePrefixes.dust, Materials.Polonium,1); + //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),144),Materials.Astatine.mPlasma.getID(), 144); + transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86),144),Materials.Radon.mGas.getID(), 144); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),144),OrePrefixes.dust, Materials.Francium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),144),OrePrefixes.dust, Materials.Radium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),144),OrePrefixes.dust, Materials.Actinium,1); + transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90),144), dust, Materials.Thorium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),144),OrePrefixes.dust, Materials.Protactinium,1); + ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),144), dust, Materials.Uranium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),144),OrePrefixes.dust, Materials.Neptunium,1); + ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),144), dust, Materials.Plutonium,1); + transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95),144), dust, Materials.Americium,1); + + try { + dAtomDefinition temp; + transformation.addFluid(new cElementalDefinitionStack(deuterium.definition, 144),Materials.Deuterium.mGas.getID(), 144); + + transformation.addFluid(new cElementalDefinitionStack(tritium.definition, 144),Materials.Tritium.mGas.getID(), 144); + + transformation.addFluid(new cElementalDefinitionStack(helium_3.definition, 144),Materials.Helium_3.mGas.getID(), 144); + + temp=new dAtomDefinition( + new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), + new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), + new cElementalDefinitionStack(dHadronDefinition.hadron_n, 146) + ); + transformation.addOredict(new cElementalDefinitionStack(temp, 144),OrePrefixes.dust, Materials.Uranium/*238*/,1); + + temp=new dAtomDefinition( + new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), + new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), + new cElementalDefinitionStack(dHadronDefinition.hadron_n, 143) + ); + transformation.addOredict(new cElementalDefinitionStack(temp, 144),OrePrefixes.dust, Materials.Uranium235,1); + + temp=new dAtomDefinition( + new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), + new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), + new cElementalDefinitionStack(dHadronDefinition.hadron_n, 145) + ); + transformation.addOredict(new cElementalDefinitionStack(temp, 144),OrePrefixes.dust, Materials.Plutonium/*239*/,1); + + temp=new dAtomDefinition( + new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), + new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), + new cElementalDefinitionStack(dHadronDefinition.hadron_n, 147) + ); + transformation.addOredict(new cElementalDefinitionStack(temp, 144),OrePrefixes.dust, Materials.Plutonium241,1); + } catch (tElementalException e) { + if (DEBUG_MODE) e.printStackTrace(); + } + + if(Loader.isModLoaded("miscutils")) new GtppAtomLoader().run(); + } + + public static dAtomDefinition getFirstStableIsotope(int element) { + return stableAtoms.get(element); + } + + public static dAtomDefinition getBestUnstableIsotope(int element) { + return unstableAtoms.get(element); + } + + @Override + public byte getClassType() { + return 64; + } + + @Override + public int hashCode() { + return hash; + } + + + + @Override + public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { + if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) + lines.add("CLASS = "+nbtType+" "+getClassType()); + if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("NAME = "+getName()); + lines.add("SYMBOL = "+getSymbol()); + } + if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) + lines.add("CHARGE = "+getCharge()/3f+" eV"); + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) + lines.add(getColor()<0?"NOT COLORED":"CARRIES COLOR"); + if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) + lines.add("MASS = "+getMass()+" eV/c\u00b2"); + if(iaeaDefinitionExistsAndHasEnergyLevels){ + for(int i=1;i<iaea.energeticStatesArray.length;i++){ + lines.add("ENERGY LEVEL "+i+" = "+iaea.energeticStatesArray[i].energy+" eV"); + } + } + if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add("HALF LIFE = "+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" At current energy level"); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/iaeaNuclide.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/iaeaNuclide.java new file mode 100644 index 0000000000..5c4c10f86d --- /dev/null +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/iaeaNuclide.java @@ -0,0 +1,263 @@ +package com.github.technus.tectech.elementalMatter.definitions.complex.atom; + +import com.github.technus.tectech.Util; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.TreeMap; + +import static com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; + +public final class iaeaNuclide { + public static final double AMU_TO_EV_DIV_C_C=9.31494061E08D,MICRO_AMU_TO_EV_DIV_C_C=9.31494061E02D; + + //Nuclide T1/2 T1/2 [s] Decay Modes ? Q Q?- Q? QEC Q?- n Sn Sp Binding/A Atomic Mass Mass Excess Discovery + //Abund. [mole fract.] BR [%] [?N] [barn] [keV] [keV] [keV] [keV] [keV] [keV] [keV] [? AMU] [keV] + + //Z,N,symb,radius, unc, energy, unc, jp, half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quad , unc,Qb-,unc,Qb- n,unc,Qa, unc, Qec, unc,Sn,unc, Sp,unc,Binding/A,unc,atomic mass, unc, mass excess,unc, + //Z,N,symbol,energy , unc, jp,half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quadrupole , unc, + private static final HashMap<Integer,iaeaNuclide> NUCLIDES=new HashMap<>(); + + public static void run(){ + String line=""; + + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("nuclides.csv"))); + ArrayList<String[]> blockOfData=new ArrayList<>(4); + while((line=reader.readLine())!=null) { + String[] split= Util.splitButDifferent(line,","); + if(split.length!=19) throw new Error("Invalid count ("+split.length+") of separators in IAEA nuclides database " + line); + if(split[1].length()>0 && blockOfData.size()>0) { + new iaeaNuclide(blockOfData.toArray(new String[0][])); + blockOfData.clear(); + } + blockOfData.add(split); + } + if(blockOfData.size()>0) { + new iaeaNuclide(blockOfData.toArray(new String[0][])); + blockOfData.clear(); + } + reader.close(); + }catch (Exception e){ + System.out.println(line); + e.printStackTrace(); + } + + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("nuclidesTable.csv"))); + while((line=reader.readLine())!=null) { + String[] split= Util.splitButDifferent(line,","); + if(split.length!=47) throw new Error("Invalid count ("+split.length+") of separators in IAEA nuvlidesTable database " + line); + get(Integer.parseInt(split[0]),Integer.parseInt(split[1])).getMoreData(split); + } + reader.close(); + }catch (Exception e){ + System.out.println(line); + e.printStackTrace(); + } + + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("energyLevels.csv"))); + while((line=reader.readLine())!=null) { + String[] split= Util.splitButDifferent(line,","); + if(split.length!=27) throw new Error("Invalid count ("+split.length+") of separators in IAEA energyLevels database " + line); + new energeticState(split); + } + reader.close(); + }catch (Exception e){ + System.out.println(line); + e.printStackTrace(); + } + + for(iaeaNuclide nuclide:NUCLIDES.values()) + nuclide.makeArrayOfEnergyStates(); + } + + public static iaeaNuclide get(int protons, int neutrons){ + return NUCLIDES.get((protons<<16)+neutrons); + } + + public final short N,Z; + public final float halfTime;//sec + public final float mass;//eV/c^2 + public final short discovery;//year + private TreeMap<Float,energeticState> energeticStates; + public energeticState[] energeticStatesArray; + + + private iaeaNuclide(String[][] rows){ + N=Short.parseShort(rows[1][2]); + Z=Short.parseShort(rows[1][0]); + NUCLIDES.put((((int)Z)<<16)+N,this); + + String[] parts = Util.splitButDifferent(rows[0][16], "|"); + double Mass=doubleOrNaN(parts[0],"mass"); + if(Mass!=Double.NaN) mass = (float)(Mass*MICRO_AMU_TO_EV_DIV_C_C); + else mass=Float.NaN; + + discovery=(short)doubleOrNaN(rows[0][18],"discovery"); + + if(rows[0][3].contains("STABLE")){ + halfTime = STABLE_RAW_LIFE_TIME; + }else{ + parts = Util.splitButDifferent(rows[0][4], "|"); + halfTime = (float)doubleOrNaN(parts[0],"half life"); + } + } + + private void getMoreData(String[] cells){ + //if(DEBUG_MODE) { + // if (add(cells[14])) System.out.println(N + " " + Z); + // if (add(cells[17])) System.out.println(N + " " + Z); + // if (add(cells[20])) System.out.println(N + " " + Z); + //} + new energeticState(this, halfTime,getDecaysFixed(cells[14],doubleOrNaN(cells[15],"chance1"),cells[17],doubleOrNaN(cells[18],"chance1"),cells[20],doubleOrNaN(cells[21],"chance1"))); + } + + private static final energeticState[] empty=new energeticState[0]; + private void makeArrayOfEnergyStates(){ + if(energeticStates==null || energeticStates.size()==0)energeticStatesArray=empty; + else energeticStatesArray=energeticStates.values().toArray(new energeticState[energeticStates.size()]); + } + + private double doubleOrNaN(String s, String name){ + s=s.replaceAll("#",""); + if(s.length()>0) { + try { + double value=Double.parseDouble(s); + return value != 0 ?value:Float.NaN; + } catch (Exception e) { + System.out.println("Invalid Value " + name + " " + N + " " + Z + " " + s); + e.printStackTrace(); + } + } + return Double.NaN; + } + + public static class energeticState{ + public final float energy; + public final float Thalf; + public final iaeaDecay[] decaymodes; + + private energeticState(iaeaNuclide nuclide,float Thalf,iaeaDecay[] decaymodes){ + energy=0; + this.Thalf=Thalf; + this.decaymodes=decaymodes; + if(nuclide.energeticStates==null) + nuclide.energeticStates=new TreeMap<>(); + nuclide.energeticStates.put(energy,this); + } + + private energeticState(String[] cells){ + iaeaNuclide nuclide=get((int)doubleOrNaN(cells[0],"protons"),(int)doubleOrNaN(cells[1],"neutrons")); + if(nuclide==null) + throw new Error("Missing nuclide "+(int)doubleOrNaN(cells[0],"protons")+" "+(int)doubleOrNaN(cells[1],"neutrons")); + this.energy=(float) (doubleOrNaN(cells[3],"energy level",nuclide)*1000f);//to eV + if(energy<0) throw new Error("Invalid energy "+ nuclide.N +" "+nuclide.Z+ " "+cells[3]); + this.Thalf=(float) doubleOrNaN(cells[10],"half life",nuclide); + if(nuclide.energeticStates==null) { + new Exception("Should be initialized before doing this... "+ nuclide.N +" "+nuclide.Z).printStackTrace(); + nuclide.energeticStates = new TreeMap<>(); + } + nuclide.energeticStates.put(energy,this); + //if(DEBUG_MODE) { + // if (add(cells[12])) System.out.println(nuclide.N + " " + nuclide.Z); + // if (add(cells[15])) System.out.println(nuclide.N + " " + nuclide.Z); + // if (add(cells[18])) System.out.println(nuclide.N + " " + nuclide.Z); + //} + this.decaymodes=getDecaysFixed(cells[12],doubleOrNaN(cells[13],"chance 1",nuclide),cells[15],doubleOrNaN(cells[16],"chance 2",nuclide),cells[18],doubleOrNaN(cells[19],"chance 3",nuclide)); + } + + private double doubleOrNaN(String s, String name){ + return doubleOrNaN(s,name,null); + } + + private double doubleOrNaN(String s, String name, iaeaNuclide nuclide){ + s = s.replaceAll("#", ""); + if (s.length() > 0) { + try { + return Double.parseDouble(s); + } catch (Exception e) { + if(nuclide==null){ + System.out.println("Invalid Value " + name + " " + s); + }else { + System.out.println("Invalid Value " + name + " " + nuclide.N + " " + nuclide.Z + " " + s); + } + e.printStackTrace(); + } + } + return Double.NaN; + } + } + + private static HashSet<String> decays=new HashSet<>(); + private static boolean add(String s){ + if(decays.add(s)){ + System.out.println(s); + return true; + } + return false; + } + + private static iaeaDecay[] getDecaysFixed(String decay1, double chance1,String decay2, double chance2,String decay3, double chance3){ + boolean do1,do2,do3; + do1=(decay1.length()>0 && !Double.isNaN(chance1)); + do2=(decay2.length()>0 && !Double.isNaN(chance2)); + do3=(decay3.length()>0 && !Double.isNaN(chance3)); + TreeMap<Double,iaeaDecay> decays=new TreeMap<>(); + if(do1 && do2 && chance1==100 && chance2==100 && chance3!=100){ + decays.put(1D, new iaeaDecay(1f, decay1)); + if(do3) { + chance3/=100d; + decays.put(chance3, new iaeaDecay((float) (chance3), decay2)); + chance2=1d-chance3; + } + chance2/=2d; + decays.put(chance2, new iaeaDecay((float) (chance2), decay2)); + }else if(do1 && chance1==100){ + decays.put(1D, new iaeaDecay(1f, decay1)); + if(do2) { + chance2/=100d; + decays.put(chance2, new iaeaDecay((float) (chance2), decay2)); + } + if(do3) { + chance3 /= 100d; + if(do2) chance3 *= chance2; + decays.put(chance3, new iaeaDecay((float) (chance3), decay3)); + } + }else{ + double normalization=((do1?chance1:0)+(do2?chance2:0)+(do3?chance3:0)); + if(do1) { + chance1/=normalization; + decays.put(chance1, new iaeaDecay((float) (chance1), decay1)); + } + if(do2) { + chance2/=normalization; + decays.put(chance2, new iaeaDecay((float) (chance2), decay2)); + } + if(do3) { + chance3/=normalization; + decays.put(chance3, new iaeaDecay((float) (chance3), decay3)); + } + if(do1||do2||do3) + decays.put(1D,iaeaDecay.DEAD_END); + } + //if(DEBUG_MODE){ + // System.out.println("INVALID SUM?\t"+normalization+"\t"+decay1+"\t"+chance1+"\t"+decay2+"\t"+chance2+"\t"+decay3+"\t"+chance3); + //} + return decays.values().toArray(new iaeaDecay[decays.size()]); + } + + public static class iaeaDecay{ + public final float chance; + public final String decayName; + public static final iaeaDecay DEAD_END=new iaeaDecay(1f,"DEAD_END"); + private iaeaDecay(float chance,String decayName){ + this.chance=chance; + this.decayName=decayName; + } + } +} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/hadron/dHadronDefinition.java index db94932cd1..902f79b3f4 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/hadron/dHadronDefinition.java @@ -1,14 +1,30 @@ -package com.github.technus.tectech.elementalMatter.definitions; +package com.github.technus.tectech.elementalMatter.definitions.complex.hadron; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.elementalMatter.classes.*; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import com.github.technus.tectech.Util; +import com.github.technus.tectech.auxiliary.TecTechConfig; +import com.github.technus.tectech.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; +import com.github.technus.tectech.elementalMatter.core.cElementalMutableDefinitionStackMap; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.core.tElementalException; +import com.github.technus.tectech.elementalMatter.core.templates.cElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.transformations.*; +import com.github.technus.tectech.elementalMatter.definitions.primitive.eBosonDefinition; +import com.github.technus.tectech.elementalMatter.definitions.primitive.eQuarkDefinition; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.elementalMatter.definitions.eBosonDefinition.boson_Y__; +import static com.github.technus.tectech.elementalMatter.definitions.complex.atom.dAtomDefinition.transformation; +import static com.github.technus.tectech.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static gregtech.api.enums.OrePrefixes.dust; /** * Created by danie_000 on 17.11.2016. @@ -19,7 +35,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi private static final byte nbtType = (byte) 'h'; //Helpers public static dHadronDefinition hadron_p, hadron_n, hadron_p_, hadron_n_; - public static cElementalDefinitionStack hadron_p1, hadron_n1, hadron_p2, hadron_n2; + public static cElementalDefinitionStack hadron_p1, hadron_n1, hadron_p2, hadron_n2, hadron_p3, hadron_n3, hadron_p5; private static float protonMass = 0F; private static float neutronMass = 0F; @@ -80,7 +96,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi int mult = this.amount * this.amount * (this.amount - 1); this.mass = mass * 5.543F * (float) mult;//yes it becomes heavier - if (this.mass == protonMass && this.amount == 3) this.rawLifeTime = stableRawLifeTime; + if (this.mass == protonMass && this.amount == 3) this.rawLifeTime = STABLE_RAW_LIFE_TIME; else if (this.mass == neutronMass && this.amount == 3) this.rawLifeTime = 882F; else { if (this.amount == 3) { @@ -97,41 +113,39 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi //public but u can just try{}catch(){} the constructor it still calls this method private static boolean canTheyBeTogether(cElementalDefinitionStackMap stacks) { - int amount = 0; + long amount = 0; for (cElementalDefinitionStack quarks : stacks.values()) { if (!(quarks.definition instanceof eQuarkDefinition)) return false; amount += quarks.amount; } - if (amount < 2 || amount > 12) return false; - return true; + return amount >= 2 && amount <= 12; } @Override public String getName() { - String name; + StringBuilder name= new StringBuilder(getSimpleName()); + name.append(':'); + for (cElementalDefinitionStack quark : quarkStacks.values()) { + name.append(' ').append(quark.definition.getSymbol()).append(quark.amount); + } + return name.toString(); + } + + private String getSimpleName() { switch (amount) { case 2: - name = "Meson:"; - break; + return "Meson"; case 3: - name = "Baryon:"; - break; + return "Baryon"; case 4: - name = "Tetraquark:"; - break; + return "Tetraquark"; case 5: - name = "Pentaquark:"; - break; + return "Pentaquark"; case 6: - name = "Hexaquark:"; - break; + return "Hexaquark"; default: - name = "Hadron:"; + return "Hadron"; } - for (cElementalDefinitionStack quark : quarkStacks.values()) { - name += " " + quark.definition.getSymbol() + quark.amount; - } - return name; } @Override @@ -155,11 +169,14 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi @Override public cElementalDecay[] getNaturalDecayInstant() { + cElementalDefinitionStack[] quarkStacks = this.quarkStacks.values(); + if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) + return cElementalDecay.noProduct; ArrayList<cElementalDefinitionStack> decaysInto = new ArrayList<>(); - for (cElementalDefinitionStack quarkStack : quarkStacks.values()) { - if (quarkStack.definition.getType() == 1 || quarkStack.definition.getType() == -1) { + for (cElementalDefinitionStack quarks : quarkStacks) { + if (quarks.definition.getType() == 1 || quarks.definition.getType() == -1) { //covers both quarks and antiquarks - decaysInto.add(quarkStack); + decaysInto.add(quarks); } else { //covers both quarks and antiquarks decaysInto.add(new cElementalDefinitionStack(boson_Y__, 2)); @@ -172,18 +189,28 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi } @Override - public cElementalDecay[] getEnergeticDecayInstant() { + public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { cElementalDefinitionStack[] quarkStacks = this.quarkStacks.values(); if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) - return new cElementalDecay[]{eBosonDefinition.deadEnd}; + return cElementalDecay.noProduct; return new cElementalDecay[]{new cElementalDecay(0.75F, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks } @Override + public float getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + return DEFAULT_ENERGY_REQUIREMENT*(newEnergyLevel-currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return false; + } + + @Override public cElementalDecay[] getDecayArray() { cElementalDefinitionStack[] quarkStacks = this.quarkStacks.values(); if (amount == 2 && quarkStacks.length == 2 && quarkStacks[0].definition.getMass() == quarkStacks[1].definition.getMass() && quarkStacks[0].definition.getType() == -quarkStacks[1].definition.getType()) - return new cElementalDecay[]{eBosonDefinition.deadEnd}; + return cElementalDecay.noProduct; else if (amount != 3) return new cElementalDecay[]{new cElementalDecay(0.95F, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks else { @@ -212,9 +239,9 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi try { return new cElementalDecay[]{ - new cElementalDecay(0.98F, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), + new cElementalDecay(0.99F, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), new cElementalDecay(0.001F, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1], boson_Y__), - eBosonDefinition.deadEnd}; //decay into quarks + eBosonDefinition.deadEnd}; } catch (tElementalException e) { if (DEBUG_MODE) e.printStackTrace(); return new cElementalDecay[]{eBosonDefinition.deadEnd}; @@ -233,44 +260,49 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi } @Override - public float getRawLifeTime() { + public float getRawTimeSpan(long currentEnergy) { return rawLifeTime; } @Override - public byte getType() { - return type; + public boolean isTimeSpanHalfLife() { + return true; } @Override - public iElementalDefinition getAnti() { - cElementalDefinitionStack[] stacks = this.quarkStacks.values(); - cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length]; - for (int i = 0; i < antiElements.length; i++) { - antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); - } - try { - return new dHadronDefinition(false, antiElements); - } catch (tElementalException e) { - if (DEBUG_MODE) e.printStackTrace(); - return null; - } + public byte getType() { + return type; } //@Override //public iElementalDefinition getAnti() { - // cElementalMutableDefinitionStackMap anti = new cElementalMutableDefinitionStackMap(); - // for (cElementalDefinitionStack stack : quarkStacks.values()) - // anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount)); + // cElementalDefinitionStack[] stacks = this.quarkStacks.values(); + // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length]; + // for (int i = 0; i < antiElements.length; i++) { + // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); + // } // try { - // return new dHadronDefinition(anti.toImmutable()); + // return new dHadronDefinition(false, antiElements); // } catch (tElementalException e) { - // if (TecTechConfig.DEBUG_MODE) e.printStackTrace(); + // if (DEBUG_MODE) e.printStackTrace(); // return null; // } //} @Override + public iElementalDefinition getAnti() { + cElementalMutableDefinitionStackMap anti = new cElementalMutableDefinitionStackMap(); + for (cElementalDefinitionStack stack : quarkStacks.values()) + anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount)); + try { + return new dHadronDefinition(anti.toImmutable_unsafeMightLeaveExposedElementalTree()); + } catch (tElementalException e) { + if (TecTechConfig.DEBUG_MODE) e.printStackTrace(); + return null; + } + } + + @Override public aFluidDequantizationInfo someAmountIntoFluidStack() { return null; } @@ -329,6 +361,9 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi hadron_n1 = new cElementalDefinitionStack(hadron_n, 1); hadron_p2 = new cElementalDefinitionStack(hadron_p, 2); hadron_n2 = new cElementalDefinitionStack(hadron_n, 2); + hadron_p3 = new cElementalDefinitionStack(hadron_p, 3); + hadron_n3 = new cElementalDefinitionStack(hadron_n, 3); + hadron_p5 = new cElementalDefinitionStack(hadron_p, 5); try { cElementalDefinition.addCreatorFromNBT(nbtType, dHadronDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-64); @@ -339,6 +374,16 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi TecTech.Logger.info("Registered Elemental Matter Class: Hadron "+nbtType+" "+(-64)); } + public static void setTransformations(){ + //Added to atom map, but should be in its own + cElementalDefinitionStack neutrons=new cElementalDefinitionStack(dHadronDefinition.hadron_n, 100000); + transformation.oredictDequantization.put(neutrons.definition,new aOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1)); + bTransformationInfo.oredictQuantization.put( + OreDictionary.getOreID(OrePrefixes.ingotHot.name()+Materials.Neutronium.mName), + new aOredictQuantizationInfo(OrePrefixes.ingotHot,Materials.Neutronium,1 ,neutrons) + ); + } + @Override public byte getClassType() { return -64; @@ -348,4 +393,24 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi public int hashCode() { return hash; } + + @Override + public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { + if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) + lines.add("CLASS = "+nbtType+" "+getClassType()); + if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("NAME = "+getSimpleName()); + //lines.add("SYMBOL = "+getSymbol()); + } + if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) + lines.add("CHARGE = "+getCharge()/3f+" eV"); + if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) + lines.add(getColor()<0?"NOT COLORED":"CARRIES COLOR"); + if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) + lines.add("MASS = "+getMass()+" eV/c\u00b2"); + 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/elementalMatter/definitions/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dAtomDefinition.java deleted file mode 100644 index 5b7d8c349b..0000000000 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/dAtomDefinition.java +++ /dev/null @@ -1,753 +0,0 @@ -package com.github.technus.tectech.elementalMatter.definitions; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.elementalMatter.classes.*; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; -import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; -import cpw.mods.fml.common.Loader; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.objects.XSTR; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.*; - -import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.elementalMatter.definitions.eBosonDefinition.boson_Y__; -import static com.github.technus.tectech.elementalMatter.definitions.eBosonDefinition.deadEnd; -import static gregtech.api.enums.OrePrefixes.dust; - -/** - * Created by danie_000 on 18.11.2016. - */ -public final class dAtomDefinition extends cElementalDefinition { - private final int hash; - public static final bTransformationInfo transformation=new bTransformationInfo(16,0,64); - public static float refMass, refUnstableMass; - - private static final byte nbtType = (byte) 'a'; - private static final Random xstr = new XSTR();//NEEDS SEPARATE! - private static Map<Integer, TreeSet<Integer>> stableIsotopes = new HashMap<>(); - private static final Map<Integer, dAtomDefinition> stableAtoms = new HashMap<>(); - private static Map<Integer, TreeMap<Float, Integer>> mostStableUnstableIsotopes = new HashMap<>(); - private static final Map<Integer, dAtomDefinition> unstableAtoms = new HashMap<>(); - private static cElementalDefinitionStack alpha; - - private static final HashMap<dAtomDefinition,Float> lifetimeOverrides = new HashMap<>(); - public static final ArrayList<Runnable> overrides = new ArrayList<>(); - - public static void addOverride(dAtomDefinition atom, float rawLifeTime){ - lifetimeOverrides.put(atom,rawLifeTime); - } - - //float-mass in eV/c^2 - public final float mass; - //public final int charge; - public final int charge; - //int -electric charge in 1/3rds of electron charge for optimization - public final int chargeLeptons; - public final float rawLifeTime; - //generation max present inside - minus if contains any anti quark - public final byte type; - - public final byte decayMode;//t neutron to proton+,0,f proton to neutron - public final boolean stable; - - public final int neutralCount; - public final int element; - - private final cElementalDefinitionStackMap elementalStacks; - - //stable is rawLifeTime>=10^9 - - @Deprecated - public dAtomDefinition(iElementalDefinition... things) throws tElementalException { - this(true, new cElementalDefinitionStackMap(things)); - } - - @Deprecated - private dAtomDefinition(boolean check, iElementalDefinition... things) throws tElementalException { - this(check, new cElementalDefinitionStackMap(things)); - } - - public dAtomDefinition(cElementalDefinitionStack... things) throws tElementalException { - this(true, new cElementalDefinitionStackMap(things)); - } - - private dAtomDefinition(boolean check, cElementalDefinitionStack... things) throws tElementalException { - this(check, new cElementalDefinitionStackMap(things)); - } - - public dAtomDefinition(cElementalDefinitionStackMap things) throws tElementalException { - this(true, things); - } - - private dAtomDefinition(boolean check, cElementalDefinitionStackMap things) throws tElementalException { - if (check && !canTheyBeTogether(things)) throw new tElementalException("Atom Definition error"); - this.elementalStacks = things; - - float mass = 0; - int cLeptons = 0; - int cNucleus = 0; - int neutralCount = 0, element = 0; - int type = 0; - boolean containsAnti = false; - for (cElementalDefinitionStack stack : elementalStacks.values()) { - iElementalDefinition def = stack.definition; - int amount = stack.amount; - mass += stack.getMass(); - if (def.getType() < 0) containsAnti = true; - type = Math.max(type, Math.abs(def.getType())); - - if (def instanceof eLeptonDefinition) { - cLeptons += stack.getCharge(); - } else { - cNucleus += stack.getCharge(); - if (def.getCharge() == 3) element += amount; - else if (def.getCharge() == -3) element -= amount; - else if (def.getCharge() == 0) neutralCount += amount; - } - } - this.type = containsAnti ? (byte) -type : (byte) type; - this.mass = mass; - this.chargeLeptons = cLeptons; - this.charge = cNucleus + cLeptons; - this.neutralCount = neutralCount; - this.element = element; - - element = Math.abs(element); - - xstr.setSeed((long) (element + 1) * (neutralCount + 100)); - - //stability curve - int StableIsotope = stableIzoCurve(element); - int izoDiff = neutralCount - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); - - hash=super.hashCode(); - - Float overriddenLifeTime=lifetimeOverrides.get(this); - float rawLifeTimeTemp; - if(overriddenLifeTime!=null) - rawLifeTimeTemp = overriddenLifeTime; - else - rawLifeTimeTemp= calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); - - this.rawLifeTime=rawLifeTimeTemp>stableRawLifeTime?stableRawLifeTime:rawLifeTimeTemp; - - if (izoDiff == 0) - this.decayMode = 0; - else - this.decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) : (byte) -Math.min(2, 1 + izoDiffAbs / 4); - this.stable = this.rawLifeTime>=stableRawLifeTime; - } - - private static int stableIzoCurve(int element) { - return (int) Math.round(-1.19561E-06 * Math.pow(element, 4D) + - 1.60885E-04 * Math.pow(element, 3D) + - 3.76604E-04 * Math.pow(element, 2D) + - 1.08418E+00 * (double) element); - } - - private static float calculateLifeTime(int izoDiff, int izoDiffAbs, int element, int isotope, boolean containsAnti) { - float rawLifeTime; - - if (element <= 83 && isotope < 127 && (izoDiffAbs == 0 || - (element == 1 && isotope == 0) || - (element == 2 && isotope == 1) || - (izoDiffAbs == 1 && element > 2 && element % 2 == 1) || - (izoDiffAbs == 3 && element > 30 && element % 2 == 0) || - (izoDiffAbs == 5 && element > 30 && element % 2 == 0) || - (izoDiffAbs == 2 && element > 20 && element % 2 == 1))) { - rawLifeTime = containsAnti ? 2.381e4f * (1f + xstr.nextFloat() * 9f) : (1f + xstr.nextFloat() * 9f) * 1.5347e25F; - } else { - //Y = (X-A)/(B-A) * (D-C) + C - float unstabilityEXP = 0; - if (element == 0) { - return 1e-35f; - } else if (element == 1) { - unstabilityEXP = 1.743f - (Math.abs(izoDiff - 1) * 9.743f); - } else if (element == 2) { - switch (isotope) { - case 4: - unstabilityEXP = 1.61f; - break; - case 5: - unstabilityEXP = -7.523F; - break; - case 6: - unstabilityEXP = -1.51f; - break; - default: - unstabilityEXP = -(izoDiffAbs * 6.165F); - break; - } - } else if (element <= 83 || (isotope <= 127 && element <= 120)) { - float elementPow4 = (float) Math.pow(element, 4f); - - unstabilityEXP = Math.min(element / 2.4f, 6 + ((element + 1) % 2) * 3e6F / elementPow4) + (((float) -izoDiff * elementPow4) / 1e8F) - (Math.abs(izoDiff - 1 + element / 60F) * (3f - (element / 12.5f) + ((element * element) / 1500f))); - } else if (element < 180) { - unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5F - (element - 85) / 3F) - (Math.abs(izoDiff) * (3f - (element / 13f) + ((element * element) / 1600f))); - } else return -1; - if ((isotope == 127 || isotope == 128) && (element < 120 && element > 83)) unstabilityEXP -= 1.8f; - if (element > 83 && element < 93 && isotope % 2 == 0 && izoDiff == 3) unstabilityEXP += 6; - if (element > 93 && element < 103 && isotope % 2 == 0 && izoDiff == 4) unstabilityEXP += 6; - rawLifeTime = (containsAnti ? 1e-8f : 1f) * (float) (Math.pow(10F, unstabilityEXP)) * (1f + xstr.nextFloat() * 9f); - } - - if (rawLifeTime < 8e-15) return 1e-35f; - if (rawLifeTime > 8e28) return 8e30f; - return rawLifeTime; - } - - private static boolean canTheyBeTogether(cElementalDefinitionStackMap stacks) { - boolean nuclei = false; - for (cElementalDefinitionStack stack : stacks.values()) - if (stack.definition instanceof dHadronDefinition) { - if (((dHadronDefinition) stack.definition).amount != 3) return false; - nuclei = true; - } else if (!(stack.definition instanceof eLeptonDefinition)) return false; - return nuclei; - } - - @Override - public int getCharge() { - return charge; - } - - public int getChargeLeptons() { - return chargeLeptons; - } - - public int getChargeHadrons() { - return charge - chargeLeptons; - } - - public int getIonizationElementWise() { - return (element * 3) + chargeLeptons; - } - - @Override - public float getMass() { - return mass; - } - - @Override - public byte getType() { - return type; - } - - @Override - public float getRawLifeTime() { - return rawLifeTime; - } - - @Override - public byte getColor() { - return -10; - } - - @Override - public String getName() { - final int element = Math.abs(this.element); - final boolean negative = element < 0; - try { - if (type != 1) return (negative ? "~? " : "? ") + nomenclature.Name[element]; - return negative ? "~" + nomenclature.Name[element] : nomenclature.Name[element]; - } catch (Exception e) { - if (DEBUG_MODE) e.printStackTrace(); - return (negative ? "Element: ~" : "Element: ") + element; - } - } - - @Override - public String getSymbol() { - final int element = Math.abs(this.element); - final boolean negative = element < 0; - try { - return (negative ? "~" : "") + nomenclature.Symbol[element] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C: " + getCharge(); - } catch (Exception e) { - if (DEBUG_MODE) e.printStackTrace(); - try { - int s100 = element / 100, s1 = (element / 10) % 10, s10 = (element) % 10; - return (negative ? "~" : "") + nomenclature.SymbolIUPAC[10 + s100] + nomenclature.SymbolIUPAC[s10] + nomenclature.SymbolIUPAC[s1] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C: " + getCharge(); - } catch (Exception E) { - if (DEBUG_MODE) e.printStackTrace(); - return (negative ? "~" : "") + "? N:" + neutralCount + " I:" + (neutralCount+element) + " C: " + getCharge(); - } - } - } - - @Override - public cElementalDefinitionStackMap getSubParticles() { - return elementalStacks.clone(); - } - - @Override - public cElementalDecay[] getDecayArray() { - if (this.type == 1) { - switch (decayMode) { - case -2: - return PbetaDecay(); - case -1: - return Emmision(dHadronDefinition.hadron_p1); - case 0: - return alphaDecay(); - case 1: - return Emmision(dHadronDefinition.hadron_n1); - case 2: - return MbetaDecay(); - default: - return getNaturalDecayInstant(); - } - } else { - return getNaturalDecayInstant(); - } - } - - private cElementalDecay[] Emmision(cElementalDefinitionStack emit) { - final cElementalMutableDefinitionStackMap tree = new cElementalMutableDefinitionStackMap(elementalStacks.values()); - if (tree.removeAmount(false, emit)) { - try { - return new cElementalDecay[]{ - new cElementalDecay(0.5f, this), - new cElementalDecay(0.5f, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable()), 1), emit), - deadEnd - }; - } catch (Exception e) { - if (DEBUG_MODE) e.printStackTrace(); - } - } - return getNaturalDecayInstant(); - } - - private cElementalDecay[] alphaDecay() { - final cElementalMutableDefinitionStackMap tree = new cElementalMutableDefinitionStackMap(elementalStacks.values()); - if (tree.removeAllAmounts(false, dHadronDefinition.hadron_n2, dHadronDefinition.hadron_p2)) { - try { - return new cElementalDecay[]{ - new cElementalDecay(0.5f, this), - new cElementalDecay(0.5f, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable()), 1), alpha), - deadEnd - }; - } catch (Exception e) { - if (DEBUG_MODE) e.printStackTrace(); - } - } - return getNaturalDecayInstant(); - } - - private cElementalDecay[] MbetaDecay() { - final cElementalMutableDefinitionStackMap tree = new cElementalMutableDefinitionStackMap(elementalStacks.values()); - if (tree.removeAmount(false, dHadronDefinition.hadron_n1)) { - try { - tree.putUnify(dHadronDefinition.hadron_p1); - return new cElementalDecay[]{ - new cElementalDecay(0.5f, this), - new cElementalDecay(0.5f, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable()), 1), eLeptonDefinition.lepton_e1, eNeutrinoDefinition.lepton_Ve_1), - deadEnd - }; - } catch (Exception e) { - if (DEBUG_MODE) e.printStackTrace(); - } - } - return getNaturalDecayInstant(); - } - - private cElementalDecay[] PbetaDecay() { - final cElementalMutableDefinitionStackMap tree = new cElementalMutableDefinitionStackMap(elementalStacks.values()); - if (tree.removeAmount(false, dHadronDefinition.hadron_p1)) { - try { - tree.putUnify(dHadronDefinition.hadron_n1); - return new cElementalDecay[]{ - new cElementalDecay(0.5f, this), - new cElementalDecay(0.5f, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable()), 1), eLeptonDefinition.lepton_e_1, eNeutrinoDefinition.lepton_Ve1), - deadEnd - }; - } catch (Exception e) { - if (DEBUG_MODE) e.printStackTrace(); - } - } - return getNaturalDecayInstant(); - } - - @Override - public cElementalDecay[] getEnergeticDecayInstant() { - //strip leptons - boolean doIt = true; - ArrayList<cElementalDefinitionStack> decaysInto = new ArrayList<cElementalDefinitionStack>(); - ArrayList<cElementalDefinitionStack> newAtom = new ArrayList<cElementalDefinitionStack>(); - for (cElementalDefinitionStack elementalStack : elementalStacks.values()) { - if (elementalStack.definition instanceof eLeptonDefinition && doIt) { - doIt = false; - if (elementalStack.amount > 1) - newAtom.add(new cElementalDefinitionStack(elementalStack.definition, elementalStack.amount - 1)); - decaysInto.add(new cElementalDefinitionStack(elementalStack.definition, 1)); - } else { - newAtom.add(elementalStack); - } - } - try { - decaysInto.add(new cElementalDefinitionStack(new dAtomDefinition(newAtom.toArray(new cElementalDefinitionStack[newAtom.size()])), 1)); - return new cElementalDecay[]{new cElementalDecay(0.95F, decaysInto.toArray(new cElementalDefinitionStack[decaysInto.size()])), eBosonDefinition.deadEnd}; - } catch (tElementalException e) { - if (DEBUG_MODE) e.printStackTrace(); - for (cElementalDefinitionStack things : newAtom) { - decaysInto.add(things); - } - return new cElementalDecay[]{new cElementalDecay(0.75F, decaysInto.toArray(new cElementalDefinitionStack[decaysInto.size()])), eBosonDefinition.deadEnd}; - } - } - - @Override - public cElementalDecay[] getNaturalDecayInstant() { - //disembody - ArrayList<cElementalDefinitionStack> decaysInto = new ArrayList<cElementalDefinitionStack>(); - for (cElementalDefinitionStack elementalStack : elementalStacks.values()) { - if (elementalStack.definition.getType() == 1 || elementalStack.definition.getType() == -1) { - //covers both quarks and antiquarks - decaysInto.add(elementalStack); - } else { - //covers both quarks and antiquarks - decaysInto.add(new cElementalDefinitionStack(boson_Y__, 2)); - } - } - return new cElementalDecay[]{new cElementalDecay(0.75F, decaysInto.toArray(new cElementalDefinitionStack[decaysInto.size()])), eBosonDefinition.deadEnd}; - } - - @Override - public iElementalDefinition getAnti() { - cElementalDefinitionStack[] stacks = this.elementalStacks.values(); - cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length]; - for (int i = 0; i < antiElements.length; i++) { - antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); - } - try { - return new dAtomDefinition(false, antiElements); - } catch (tElementalException e) { - if (DEBUG_MODE) e.printStackTrace(); - return null; - } - } - - //@Override - //public iElementalDefinition getAnti() { - // cElementalMutableDefinitionStackMap anti = new cElementalMutableDefinitionStackMap(); - // for (cElementalDefinitionStack stack : elementalStacks.values()) - // anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount)); - // try { - // return new dAtomDefinition(anti.toImmutable()); - // } catch (tElementalException e) { - // if (TecTechConfig.DEBUG_MODE) e.printStackTrace(); - // return null; - // } - //} - - @Override - public aFluidDequantizationInfo someAmountIntoFluidStack() { - return transformation.fluidDequantization.get(this); - } - - @Override - public aItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public aOredictDequantizationInfo someAmountIntoOredictStack() { - return transformation.oredictDequantization.get(this); - } - - private final static class nomenclature { - static final private 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"}; - static final private 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"}; - static final private String[] SymbolIUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; - } - - @Override - public NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setByte("t", nbtType); - cElementalDefinitionStack[] elementalStacksValues = elementalStacks.values(); - nbt.setInteger("i", elementalStacksValues.length); - for (int i = 0; i < elementalStacksValues.length; i++) - nbt.setTag(Integer.toString(i), elementalStacksValues[i].toNBT()); - return nbt; - } - - public static iElementalDefinition fromNBT(NBTTagCompound nbt) { - cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < stacks.length; i++) - stacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - try { - return new dAtomDefinition(stacks); - } catch (tElementalException e) { - if (DEBUG_MODE) e.printStackTrace(); - return null; - } - } - - public static void run() { - for (Runnable r : overrides) r.run(); - - for(Map.Entry<dAtomDefinition,Float> entry:lifetimeOverrides.entrySet()){ - try { - lifetimeOverrides.put(new dAtomDefinition(entry.getKey().elementalStacks), entry.getValue()); - }catch (tElementalException e){ - e.printStackTrace(); //Impossible - } - } - - //populate stable isotopes - for (int element = 1; element < 84; element++)//Up to Astatine exclusive - for (int isotope = 0; isotope < 130; isotope++) { - xstr.setSeed((long) (element + 1) * (isotope + 100)); - //stability curve - final int StableIsotope = stableIzoCurve(element); - final int izoDiff = isotope - StableIsotope; - final int izoDiffAbs = Math.abs(izoDiff); - final float rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); - if (rawLifeTime>=stableRawLifeTime) { - TreeSet<Integer> isotopes = stableIsotopes.get(element); - if (isotopes == null) stableIsotopes.put(element, isotopes = new TreeSet<>()); - isotopes.add(isotope); - } - } - - //populate unstable isotopes - for (int element = 84; element < 150; element++) - for (int isotope = 100; isotope < 180; isotope++) { - xstr.setSeed((long) (element + 1) * (isotope + 100)); - //stability curve - final int Isotope = stableIzoCurve(element); - final int izoDiff = isotope - Isotope; - final int izoDiffAbs = Math.abs(izoDiff); - final float rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); - TreeMap<Float, Integer> isotopes = mostStableUnstableIsotopes.get(element); - if (isotopes == null) mostStableUnstableIsotopes.put(element, isotopes = new TreeMap<>()); - isotopes.put(rawLifeTime, isotope); - } - - try { - for (int key : stableIsotopes.keySet()) { - stableAtoms.put(key, new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, key), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, stableIsotopes.get(key).first()), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, key))); - if (DEBUG_MODE) - TecTech.Logger.info("Added Stable Atom:" + key + " " + stableIsotopes.get(key).first() + " " + stableAtoms.get(key).getMass()); - } - for (int key : mostStableUnstableIsotopes.keySet()) { - unstableAtoms.put(key, new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, key), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, mostStableUnstableIsotopes.get(key).lastEntry().getValue()), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, key))); - if (DEBUG_MODE) - TecTech.Logger.info("Added Unstable Atom:" + key + " " + mostStableUnstableIsotopes.get(key).lastEntry().getValue() + " " + unstableAtoms.get(key).getMass()); - } - alpha = new cElementalDefinitionStack( - new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 2), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 2)) - , 1); - } catch (Exception e) { - if (DEBUG_MODE) e.printStackTrace(); - } - - try { - cElementalDefinition.addCreatorFromNBT(nbtType, dAtomDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)64); - } catch (Exception e) { - if (DEBUG_MODE) e.printStackTrace(); - } - if(DEBUG_MODE) - TecTech.Logger.info("Registered Elemental Matter Class: Atom "+nbtType+" "+64); - } - - public static void setTransformation(){ - /*----STABLE ATOMS----**/ - refMass = getFirstStableIsotope(1).getMass() * 144F; - - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(1), 144),Materials.Hydrogen.mGas.getID(),144); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(2), 144),Materials.Helium.mGas.getID(), 144); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(3), 144), dust, Materials.Lithium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(4), 144), dust, Materials.Beryllium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(5), 144), dust, Materials.Boron,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(6), 144), dust, Materials.Carbon,1); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(7), 144),Materials.Nitrogen.mGas.getID(), 144); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(8), 144),Materials.Oxygen.mGas.getID(), 144); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(9), 144),Materials.Fluorine.mGas.getID(), 144); - //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), 144),Materials.Neon.mGas.getID(), 144); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(11), 144), dust, Materials.Sodium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(12), 144), dust, Materials.Magnesium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(13), 144), dust, Materials.Aluminium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(14), 144), dust, Materials.Silicon,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(15), 144), dust, Materials.Phosphorus,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(16), 144), dust, Materials.Sulfur,1); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(17), 144),Materials.Chlorine.mGas.getID(), 144); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(18), 144),Materials.Argon.mGas.getID(), 144); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(19), 144), dust, Materials.Potassium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(20), 144), dust, Materials.Calcium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(21), 144), dust, Materials.Scandium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(22), 144), dust, Materials.Titanium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(23), 144), dust, Materials.Vanadium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(24), 144), dust, Materials.Chrome,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(25), 144), dust, Materials.Manganese,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(26), 144), dust, Materials.Iron,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(27), 144), dust, Materials.Cobalt,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(28), 144), dust, Materials.Nickel,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(29), 144), dust, Materials.Copper,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(30), 144), dust, Materials.Zinc,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(31), 144), dust, Materials.Gallium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), 144),OrePrefixes.dust, Materials.Germanium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(33), 144), dust, Materials.Arsenic,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), 144),OrePrefixes.dust, Materials.Selenium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(35), 144),OrePrefixes.dust, Materials.Bromine,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(36), 144),OrePrefixes.dust, Materials.Krypton,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(37), 144), dust, Materials.Rubidium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(38), 144), dust, Materials.Strontium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(39), 144), dust, Materials.Yttrium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), 144),OrePrefixes.dust, Materials.Zirconium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(41), 144), dust, Materials.Niobium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(42), 144), dust, Materials.Molybdenum,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), 144),OrePrefixes.dust, Materials.Technetium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), 144),OrePrefixes.dust, Materials.Ruthenium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), 144),OrePrefixes.dust, Materials.Rhodium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(46), 144), dust, Materials.Palladium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(47), 144), dust, Materials.Silver,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(48), 144), dust, Materials.Cadmium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(49), 144), dust, Materials.Indium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(50), 144), dust, Materials.Tin,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(51), 144), dust, Materials.Antimony,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(52), 144), dust, Materials.Tellurium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), 144),OrePrefixes.dust, Materials.Iodine,1); - //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), 144),Materials.Xenon.mGas.getID(), 144); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(55), 144), dust, Materials.Caesium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(56), 144), dust, Materials.Barium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(57), 144), dust, Materials.Lanthanum,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(58), 144), dust, Materials.Cerium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(59), 144), dust, Materials.Praseodymium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(60), 144), dust, Materials.Neodymium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(61), 144), dust, Materials.Promethium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(62), 144), dust, Materials.Samarium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(63), 144), dust, Materials.Europium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(64), 144), dust, Materials.Gadolinium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(65), 144), dust, Materials.Terbium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(66), 144), dust, Materials.Dysprosium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(67), 144), dust, Materials.Holmium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(68), 144), dust, Materials.Erbium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(69), 144), dust, Materials.Thulium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(70), 144), dust, Materials.Ytterbium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(71), 144), dust, Materials.Lutetium,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), 144),OrePrefixes.dust, Materials.Hafnum,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(73), 144), dust, Materials.Tantalum,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(74), 144), dust, Materials.Tungsten,1); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), 144),OrePrefixes.dust, Materials.Rhenium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(76), 144), dust, Materials.Osmium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(77), 144), dust, Materials.Iridium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(78), 144), dust, Materials.Platinum,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(79), 144), dust, Materials.Gold,1); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(80), 144),Materials.Mercury.mFluid.getID(), 144); - //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), 144),OrePrefixes.dust, Materials.Thallium,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(82), 144), dust, Materials.Lead,1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(83), 144), dust, Materials.Bismuth,1); - - /*----UNSTABLE ATOMS----**/ - refUnstableMass = getFirstStableIsotope(83).getMass() * 144F; - - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),144),OrePrefixes.dust, Materials.Polonium,1); - //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),144),Materials.Astatine.mPlasma.getID(), 144); - transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86),144),Materials.Radon.mGas.getID(), 144); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),144),OrePrefixes.dust, Materials.Francium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),144),OrePrefixes.dust, Materials.Radium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),144),OrePrefixes.dust, Materials.Actinium,1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90),144), dust, Materials.Thorium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),144),OrePrefixes.dust, Materials.Protactinium,1); - ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),144), dust, Materials.Uranium,1); - //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),144),OrePrefixes.dust, Materials.Neptunium,1); - ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),144), dust, Materials.Plutonium,1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95),144), dust, Materials.Americium,1); - - /* ... */ - cElementalDefinitionStack neutrons=new cElementalDefinitionStack(dHadronDefinition.hadron_n, 100000); - transformation.oredictDequantization.put(neutrons.definition,new aOredictDequantizationInfo(neutrons, dust,Materials.Neutronium,1)); - bTransformationInfo.oredictQuantization.put( - OreDictionary.getOreID(OrePrefixes.ingotHot.name()+Materials.Neutronium.mName), - new aOredictQuantizationInfo(OrePrefixes.ingotHot,Materials.Neutronium,1 ,neutrons) - ); - - try { - dAtomDefinition temp; - temp=new dAtomDefinition( - eLeptonDefinition.lepton_e1, - dHadronDefinition.hadron_p1, - dHadronDefinition.hadron_n1 - ); - transformation.addFluid(new cElementalDefinitionStack(temp, 144),Materials.Deuterium.mGas.getID(), 144); - - temp=new dAtomDefinition( - eLeptonDefinition.lepton_e1, - dHadronDefinition.hadron_p1, - dHadronDefinition.hadron_n2 - ); - transformation.addFluid(new cElementalDefinitionStack(temp, 144),Materials.Tritium.mGas.getID(), 144); - - temp=new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 2), - dHadronDefinition.hadron_p2, - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 3) - ); - transformation.addFluid(new cElementalDefinitionStack(temp, 144),Materials.Helium_3.mGas.getID(), 144); - - temp=new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 146) - ); - transformation.addOredict(new cElementalDefinitionStack(temp, 144),OrePrefixes.dust, Materials.Uranium/*238*/,1); - - temp=new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 143) - ); - transformation.addOredict(new cElementalDefinitionStack(temp, 144),OrePrefixes.dust, Materials.Uranium235,1); - - temp=new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 145) - ); - transformation.addOredict(new cElementalDefinitionStack(temp, 144),OrePrefixes.dust, Materials.Plutonium/*239*/,1); - - temp=new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 147) - ); - transformation.addOredict(new cElementalDefinitionStack(temp, 144),OrePrefixes.dust, Materials.Plutonium241,1); - } catch (tElementalException e) { - if (DEBUG_MODE) e.printStackTrace(); - } - - if(Loader.isModLoaded("miscutils")) new GtppAtomLoader().run(); - } - - public static dAtomDefinition getFirstStableIsotope(int element) { - return stableAtoms.get(element); - } - - public static dAtomDefinition getBestUnstableIsotope(int element) { - return unstableAtoms.get(element); - } - - @Override - public byte getClassType() { - return 64; - } - - @Override - public int hashCode() { - return hash; - } -} diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/cPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/cPrimitiveDefinition.java index 3f06712940..1a4582386b 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/cPrimitiveDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/cPrimitiveDefinition.java @@ -1,9 +1,8 @@ -package com.github.technus.tectech.elementalMatter.definitions; +package com.github.technus.tectech.elementalMatter.definitions.primitive; -import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; +import com.github.technus.tectech.elementalMatter.core.templates.cElementalPrimitive; -import static com.github.technus.tectech.elementalMatter.classes.cElementalDecay.noDecay; -import static com.github.technus.tectech.elementalMatter.classes.cElementalDecay.noProduct; +import static com.github.technus.tectech.elementalMatter.core.cElementalDecay.noDecay; /** * Created by danie_000 on 22.10.2016. @@ -21,15 +20,20 @@ public final class cPrimitiveDefinition extends cElementalPrimitive { } public static void run() { - nbtE__.init(null__, -1F, -1, -1, noDecay); - null__.init(null__, -1F, -1, -1, noProduct); - space__.init(space__, -1F, -1, -1, noProduct); - magic.init(magic_, -1F, -1, -1, noDecay); - magic_.init(magic, -1F, -1, -1, noDecay); + nbtE__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); + null__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); + space__.init(space__, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); + magic.init(magic_, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); + magic_.init(magic, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); } @Override public String getName() { return "Primitive: " + name; } + + @Override + public boolean isTimeSpanHalfLife() { + return false; + } }
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eBosonDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eBosonDefinition.java index 1e2ff66d85..636cd9b8fc 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eBosonDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eBosonDefinition.java @@ -1,8 +1,8 @@ -package com.github.technus.tectech.elementalMatter.definitions; +package com.github.technus.tectech.elementalMatter.definitions.primitive; -import com.github.technus.tectech.elementalMatter.classes.cElementalDecay; -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; +import com.github.technus.tectech.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.core.templates.cElementalPrimitive; /** * Created by danie_000 on 22.10.2016. @@ -14,15 +14,14 @@ public final class eBosonDefinition extends cElementalPrimitive { //deadEnd public static final cElementalDecay deadEnd = new cElementalDecay(boson_Y__, boson_Y__); public static final cElementalDecay deadEndHalf = new cElementalDecay(boson_Y__); + public static final cElementalDefinitionStack boson_Y__1=new cElementalDefinitionStack(boson_Y__,1); private eBosonDefinition(String name, String symbol, int type, float mass, int charge, int color, int ID) { super(name, symbol, type, mass, charge, color, ID); } public static void run() { - boson_Y__.init(null, -1F, 0, 1, - new cElementalDecay(boson_Y__), - deadEnd); + boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, cElementalDecay.noDecay); boson_H__.init(null, 1.56e-22F, 0, 0, new cElementalDecay(0.96F, new cElementalDefinitionStack(boson_Y__, 4)), new cElementalDecay(0.02F, eLeptonDefinition.lepton_t, eLeptonDefinition.lepton_t_), @@ -34,4 +33,9 @@ public final class eBosonDefinition extends cElementalPrimitive { public String getName() { return "Boson: " + name; } + + @Override + public boolean isTimeSpanHalfLife() { + return false; + } } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eLeptonDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eLeptonDefinition.java index 4da388df21..0e7abf4a42 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eLeptonDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eLeptonDefinition.java @@ -1,10 +1,8 @@ -package com.github.technus.tectech.elementalMatter.definitions; +package com.github.technus.tectech.elementalMatter.definitions.primitive; -import com.github.technus.tectech.elementalMatter.classes.cElementalDecay; -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; - -import static com.github.technus.tectech.elementalMatter.definitions.eNeutrinoDefinition.*; +import com.github.technus.tectech.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.core.templates.cElementalPrimitive; /** * Created by danie_000 on 22.10.2016. @@ -19,7 +17,9 @@ public final class eLeptonDefinition extends cElementalPrimitive { lepton_t_ = new eLeptonDefinition("Antitauon", "\u03c4+", -3, 1776.83e6F, 3, -1, 20); public static final cElementalDefinitionStack lepton_e1 = new cElementalDefinitionStack(lepton_e, 1); + public static final cElementalDefinitionStack lepton_e2 = new cElementalDefinitionStack(lepton_e, 2); public static final cElementalDefinitionStack lepton_e_1 = new cElementalDefinitionStack(lepton_e_, 1); + public static final cElementalDefinitionStack lepton_e_2 = new cElementalDefinitionStack(lepton_e_, 2); private eLeptonDefinition(String name, String symbol, int type, float mass, int charge, int color, int ID) { super(name, symbol, type, mass, charge, color, ID); @@ -28,32 +28,28 @@ public final class eLeptonDefinition extends cElementalPrimitive { } public static void run() { - lepton_e.init(lepton_e_, 100000F, 2, 3, - new cElementalDecay(0.9F, lepton_e), - new cElementalDecay(0.05F, nothing), + lepton_e.init(lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1, eBosonDefinition.deadEnd,//makes photons and don't care new cElementalDecay(lepton_e, eBosonDefinition.boson_Y__)); lepton_m.init(lepton_m_, 2.197019e-6F, 0, 1, - new cElementalDecay(0.9F, lepton_e, lepton_Ve_, lepton_Vm), + new cElementalDecay(0.9F, lepton_e, eNeutrinoDefinition.lepton_Ve_, eNeutrinoDefinition.lepton_Vm), eBosonDefinition.deadEnd);//makes photons and don't care lepton_t.init(lepton_t_, 2.906e-13F, 1, 3, - new cElementalDecay(0.8F, lepton_m, lepton_Vm_, lepton_Vt, eBosonDefinition.boson_Y__), - new cElementalDecay(0.1F, lepton_e, lepton_Ve_, lepton_Vm), - new cElementalDecay(0.05F, lepton_m, lepton_Vm_, lepton_Vt, eBosonDefinition.boson_H__), + new cElementalDecay(0.8F, lepton_m, eNeutrinoDefinition.lepton_Vm_, eNeutrinoDefinition.lepton_Vt, eBosonDefinition.boson_Y__), + new cElementalDecay(0.1F, lepton_e, eNeutrinoDefinition.lepton_Ve_, eNeutrinoDefinition.lepton_Vm), + new cElementalDecay(0.05F, lepton_m, eNeutrinoDefinition.lepton_Vm_, eNeutrinoDefinition.lepton_Vt, eBosonDefinition.boson_H__), eBosonDefinition.deadEnd);//makes photons and don't care - lepton_e_.init(lepton_e, 100000F, 2, 3, - new cElementalDecay(0.9F, lepton_e_), - new cElementalDecay(0.05F, nothing), + lepton_e_.init(lepton_e, STABLE_RAW_LIFE_TIME, 0, 1, eBosonDefinition.deadEnd,//makes photons and don't care new cElementalDecay(lepton_e_, eBosonDefinition.boson_Y__)); - lepton_m_.init(lepton_m, 2.197e-6F, 0, 1, - new cElementalDecay(0.9F, lepton_e_, lepton_Ve, lepton_Vm_), + lepton_m_.init(lepton_m, 2.197019e-6F, 0, 1, + new cElementalDecay(0.9F, lepton_e_, eNeutrinoDefinition.lepton_Ve, eNeutrinoDefinition.lepton_Vm_), eBosonDefinition.deadEnd);//makes photons and don't care - lepton_t_.init(lepton_t, 2.9e-13F, 1, 3, - new cElementalDecay(0.8F, lepton_m_, lepton_Vm, lepton_Vt_, eBosonDefinition.boson_Y__), - new cElementalDecay(0.1F, lepton_e_, lepton_Ve, lepton_Vm_), - new cElementalDecay(0.05F, lepton_m_, lepton_Vm, lepton_Vt_, eBosonDefinition.boson_H__), + lepton_t_.init(lepton_t, 2.906e-13F, 1, 3, + new cElementalDecay(0.8F, lepton_m_, eNeutrinoDefinition.lepton_Vm, eNeutrinoDefinition.lepton_Vt_, eBosonDefinition.boson_Y__), + new cElementalDecay(0.1F, lepton_e_, eNeutrinoDefinition.lepton_Ve, eNeutrinoDefinition.lepton_Vm_), + new cElementalDecay(0.05F, lepton_m_, eNeutrinoDefinition.lepton_Vm, eNeutrinoDefinition.lepton_Vt_, eBosonDefinition.boson_H__), eBosonDefinition.deadEnd);//makes photons and don't care } @@ -61,4 +57,9 @@ public final class eLeptonDefinition extends cElementalPrimitive { public String getName() { return "Lepton: " + name; } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eNeutrinoDefinition.java index 947cc7c823..459719a8a4 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eNeutrinoDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eNeutrinoDefinition.java @@ -1,8 +1,8 @@ -package com.github.technus.tectech.elementalMatter.definitions; +package com.github.technus.tectech.elementalMatter.definitions.primitive; -import com.github.technus.tectech.elementalMatter.classes.cElementalDecay; -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; +import com.github.technus.tectech.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.core.templates.cElementalPrimitive; /** * Created by danie_000 on 22.10.2016. @@ -17,42 +17,41 @@ public final class eNeutrinoDefinition extends cElementalPrimitive { lepton_Vt_ = new eNeutrinoDefinition("Antitauon neutrino", "~\u03bd\u03c4", -3, 15e6F, 0, -1, 26); public static final cElementalDefinitionStack lepton_Ve1 = new cElementalDefinitionStack(lepton_Ve, 1); + public static final cElementalDefinitionStack lepton_Ve2 = new cElementalDefinitionStack(lepton_Ve, 2); public static final cElementalDefinitionStack lepton_Ve_1 = new cElementalDefinitionStack(lepton_Ve_, 1); + public static final cElementalDefinitionStack lepton_Ve_2 = new cElementalDefinitionStack(lepton_Ve_, 2); private eNeutrinoDefinition(String name, String symbol, int type, float mass, int charge, int color, int ID) { super(name, symbol, type, mass, charge, color, ID); } public static void run() { - lepton_Ve.init(lepton_Ve_, 1F, 1, 0, - new cElementalDecay(0.95F, nothing), - new cElementalDecay(0.1F, lepton_Ve), - eBosonDefinition.deadEndHalf); + lepton_Ve.init(lepton_Ve_, 1F, 0, 0, + cElementalDecay.noProduct); lepton_Vm.init(lepton_Vm_, 1F, 1, 0, - new cElementalDecay(0.9F, nothing), - new cElementalDecay(0.1F, lepton_Vm), + new cElementalDecay(0.825F, nothing), eBosonDefinition.deadEndHalf); lepton_Vt.init(lepton_Vt_, 1F, 1, 0, - new cElementalDecay(0.85F, nothing), - new cElementalDecay(0.1F, lepton_Vt), - eBosonDefinition.deadEndHalf); + new cElementalDecay(0.75F, nothing), + eBosonDefinition.deadEnd); - lepton_Ve_.init(lepton_Ve, 1F, 1, 0, - new cElementalDecay(0.95F, nothing), - new cElementalDecay(0.1F, lepton_Ve_), - eBosonDefinition.deadEndHalf); + lepton_Ve_.init(lepton_Ve, 1F, 0, 0, + cElementalDecay.noProduct); lepton_Vm_.init(lepton_Vm, 1F, 1, 0, - new cElementalDecay(0.9F, nothing), - new cElementalDecay(0.1F, lepton_Vm_), + new cElementalDecay(0.825F, nothing), eBosonDefinition.deadEndHalf); lepton_Vt_.init(lepton_Vt, 1F, 1, 0, - new cElementalDecay(0.85F, nothing), - new cElementalDecay(0.1F, lepton_Vt_), - eBosonDefinition.deadEndHalf); + new cElementalDecay(0.75F, nothing), + eBosonDefinition.deadEnd); } @Override public String getName() { return "Lepton: " + name; } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eQuarkDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eQuarkDefinition.java index 3b5d60cf20..3abf04464f 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/eQuarkDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eQuarkDefinition.java @@ -1,7 +1,7 @@ -package com.github.technus.tectech.elementalMatter.definitions; +package com.github.technus.tectech.elementalMatter.definitions.primitive; -import com.github.technus.tectech.elementalMatter.classes.cElementalDecay; -import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; +import com.github.technus.tectech.elementalMatter.core.cElementalDecay; +import com.github.technus.tectech.elementalMatter.core.templates.cElementalPrimitive; /** * Created by danie_000 on 22.10.2016. @@ -26,7 +26,7 @@ public final class eQuarkDefinition extends cElementalPrimitive { } public static void run() { - quark_u.init(quark_u_, 1e35F, 3, -1, + quark_u.init(quark_u_, STABLE_RAW_LIFE_TIME, 3, -1, new cElementalDecay(0.9F, quark_d, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), new cElementalDecay(0.050778116F, quark_s/*,lepton_m_,lepton_Vm*/), new cElementalDecay(1.23201e-5F, quark_b/*,lepton_t_,lepton_Vt*/), @@ -42,7 +42,7 @@ public final class eQuarkDefinition extends cElementalPrimitive { new cElementalDecay(7.51689e-5F, quark_d, eLeptonDefinition.lepton_t_, eNeutrinoDefinition.lepton_Vt), eBosonDefinition.deadEnd);//makes photons and don't care - quark_d.init(quark_d_, 1e35F, 3, -1, + quark_d.init(quark_d_, STABLE_RAW_LIFE_TIME, 3, -1, new cElementalDecay(0.9F, quark_u, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), new cElementalDecay(0.05071504F, quark_c/*,lepton_m,lepton_Vm_*/), new cElementalDecay(7.51689e-5F, quark_t/*,lepton_t,lepton_Vt_*/), @@ -58,7 +58,7 @@ public final class eQuarkDefinition extends cElementalPrimitive { new cElementalDecay(1.23201e-5F, quark_u, eLeptonDefinition.lepton_t, eNeutrinoDefinition.lepton_Vt_), eBosonDefinition.deadEnd);//makes photons and don't care - quark_u_.init(quark_u, 88, 3, -1, + quark_u_.init(quark_u, STABLE_RAW_LIFE_TIME, 3, -1, new cElementalDecay(0.9F, quark_d_, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), new cElementalDecay(0.050778116F, quark_s_/*,lepton_m,lepton_Vm_*/), new cElementalDecay(1.23201e-5F, quark_b_/*,lepton_t,lepton_Vt_*/), @@ -74,7 +74,7 @@ public final class eQuarkDefinition extends cElementalPrimitive { new cElementalDecay(7.51689e-5F, quark_d_, eLeptonDefinition.lepton_t, eNeutrinoDefinition.lepton_Vt_), eBosonDefinition.deadEnd);//makes photons and don't care - quark_d_.init(quark_d, 44F, 3, -1, + quark_d_.init(quark_d, STABLE_RAW_LIFE_TIME, 3, -1, new cElementalDecay(0.9F, quark_u_, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), new cElementalDecay(0.05071504F, quark_c_/*,lepton_m_,lepton_Vm*/), new cElementalDecay(7.51689e-5F, quark_t_/*,lepton_t_,lepton_Vt*/), @@ -95,4 +95,9 @@ public final class eQuarkDefinition extends cElementalPrimitive { public String getName() { return "Quark: " + name; } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iElementalDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iElementalDefinition.java deleted file mode 100644 index 522c6d9547..0000000000 --- a/src/main/java/com/github/technus/tectech/elementalMatter/interfaces/iElementalDefinition.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.github.technus.tectech.elementalMatter.interfaces; - -import com.github.technus.tectech.elementalMatter.classes.*; -import net.minecraft.nbt.NBTTagCompound; - -/** - * Created by danie_000 on 11.11.2016. - */ -public interface iElementalDefinition extends Comparable<iElementalDefinition>,Cloneable {//IMMUTABLE - float stableRawLifeTime=1.5e25f; - - //Nomenclature - String getName(); - - String getSymbol(); - - byte getType(); - - byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED - - //Not dynamically changing stuff - iElementalDefinition getAnti();//gives new anti particle def - - cElementalDecay[] getDecayArray();//possible decays - - cElementalDecay[] getNaturalDecayInstant();//natural decay if lifespan <1tick - - cElementalDecay[] getEnergeticDecayInstant();//energetic decay if lifespan <1tick - - float getMass();//mass... MeV/c^2 - - int getCharge();//charge 1/3 electron charge - - //dynamically changing stuff - byte getColor();//-1 nope cannot 0 it can but undefined - - float getRawLifeTime();//defined in static fields or generated - - cElementalDefinitionStackMap getSubParticles();//contents... null if none - - aFluidDequantizationInfo someAmountIntoFluidStack(); - - aItemDequantizationInfo someAmountIntoItemsStack(); - - aOredictDequantizationInfo someAmountIntoOredictStack(); - - NBTTagCompound toNBT(); - - cElementalDefinitionStack getStackForm(int i); - - iElementalDefinition clone(); -} diff --git a/src/main/java/com/github/technus/tectech/loader/AtomOverrider.java b/src/main/java/com/github/technus/tectech/loader/AtomOverrider.java deleted file mode 100644 index a5fac2c5c9..0000000000 --- a/src/main/java/com/github/technus/tectech/loader/AtomOverrider.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.github.technus.tectech.loader; - -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; -import com.github.technus.tectech.elementalMatter.classes.tElementalException; -import com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition; -import com.github.technus.tectech.elementalMatter.definitions.dHadronDefinition; -import com.github.technus.tectech.elementalMatter.definitions.eLeptonDefinition; - -import static com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition.addOverride; -import static com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition.stableRawLifeTime; - -/** - * Created by Tec on 29.05.2017. - */ -public class AtomOverrider implements Runnable{ - @Override - public void run() { - try { - addOverride(new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 2), - dHadronDefinition.hadron_p2, - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 3) - ), stableRawLifeTime);//He3 - - addOverride(new dAtomDefinition( - eLeptonDefinition.lepton_e1, - dHadronDefinition.hadron_p1, - dHadronDefinition.hadron_n1 - ), stableRawLifeTime);//D - - addOverride(new dAtomDefinition( - eLeptonDefinition.lepton_e1, - dHadronDefinition.hadron_p1, - dHadronDefinition.hadron_n2 - ), 1e9f);//T - - - }catch (tElementalException e){ - e.printStackTrace(); - } - } -} diff --git a/src/main/java/com/github/technus/tectech/loader/BloodyRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/BloodyRecipeLoader.java index b07aeb9bd8..783f508454 100644 --- a/src/main/java/com/github/technus/tectech/loader/BloodyRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/BloodyRecipeLoader.java @@ -1,11 +1,359 @@ package com.github.technus.tectech.loader; +import com.github.technus.tectech.recipe.TT_recipeAdder; +import com.github.technus.tectech.thing.CustomItemList; +import com.github.technus.tectech.thing.block.QuantumGlassBlock; +import com.github.technus.tectech.thing.item.ConstructableTriggerItem; +import gregtech.api.enums.*; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + /** * Created by Tec on 06.08.2017. */ public class BloodyRecipeLoader implements Runnable { @Override public void run() { + Object[] o = new Object[0]; + + //Quantum Glass + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Containment.get(1, o), + GT_ModHandler.getIC2Item("reinforcedGlass", 1L) + }, Materials.Osmium.getMolten(576), new ItemStack(QuantumGlassBlock.INSTANCE, 1), 200, 500000); + + //BLUEprint + GT_ModHandler.addShapelessCraftingRecipe(new ItemStack(ConstructableTriggerItem.INSTANCE, 1), + GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, + new Object[]{Dyes.dyeBlue, OrePrefixes.plate.get(Materials.Paper), Dyes.dyeBlue, Dyes.dyeWhite}); + + //region pipes + + //Data + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + ItemList.Circuit_Parts_GlassFiber.get(8, o), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silver, 8) + }, Materials.Polytetrafluoroethylene.getMolten(144), CustomItemList.DATApipe.get(1, o), 200, 30720, true); + + //endregion + + + //region casing + + //High Power Casing + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Iridium, 1), + GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Iridium, 6), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 1), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Cobalt, 16), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 16), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.NiobiumTitanium, 2) + }, Materials.TungstenSteel.getMolten(576), CustomItemList.eM_Power.get(1, o), 100, 30720); + + //Computer Casing + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Power.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.StainlessSteel, 8), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 1), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.NiobiumTitanium, 2) + }, Materials.Aluminium.getMolten(1296), CustomItemList.eM_Computer_Casing.get(1, o), 200, 122880); + //Computer Vent Casing + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.StainlessSteel, 1), + ItemList.Electric_Motor_IV.get(2, o), + GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.StainlessSteel, 2), + GT_OreDictUnificator.get(OrePrefixes.pipeTiny, Materials.StainlessSteel, 16), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Copper, 16), + GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Superconductor, 1) + }, Materials.SolderingAlloy.getMolten(1296), CustomItemList.eM_Computer_Vent.get(1, o), 100, 1920); + //Advanced Computer Casing + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Computer_Casing.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 1), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Cobalt, 64), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Electrum, 64), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Superconductor, 4) + }, Materials.Iridium.getMolten(1296), CustomItemList.eM_Computer_Bus.get(1, o), 200, 122880, true); + + //Molecular Casing + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Power.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Osmiridium, 6), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Osmium, 12), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.TungstenSteel, 24), + GT_OreDictUnificator.get(OrePrefixes.ring, Materials.TungstenSteel, 24), + ItemList.Field_Generator_IV.get(1, o) + }, Materials.Osmium.getMolten(1296), CustomItemList.eM_Containment.get(1, o), 800, 500000); + + //endregion + + + //region hatches + + //Dynamo Hatches UV-UIV + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Dynamo_UV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2)}, Materials.Silver.getMolten(1000), CustomItemList.eM_dynamomulti4_UV.get(1, o), 100, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_dynamomulti4_UV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 4)}, Materials.Electrum.getMolten(1000), CustomItemList.eM_dynamomulti16_UV.get(1, o), 200, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_dynamomulti16_UV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 6)}, Materials.Tungsten.getMolten(1000), CustomItemList.eM_dynamomulti64_UV.get(1, o), 400, 122880); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Dynamo_MAX.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2)}, Materials.Silver.getMolten(2000), CustomItemList.eM_dynamomulti4_UHV.get(1, o), 100, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_dynamomulti4_UHV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 4)}, Materials.Electrum.getMolten(2000), CustomItemList.eM_dynamomulti16_UHV.get(1, o), 200, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_dynamomulti16_UHV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 6)}, Materials.Tungsten.getMolten(2000), CustomItemList.eM_dynamomulti64_UHV.get(1, o), 400, 500000); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Dynamo_MAX.get(4, o), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Superconductor, 8), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 8)}, Materials.Silver.getMolten(4000), CustomItemList.eM_dynamomulti4_UEV.get(1, o), 100, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_dynamomulti4_UEV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Superconductor, 8), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 16)}, Materials.Electrum.getMolten(4000), CustomItemList.eM_dynamomulti16_UEV.get(1, o), 200, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_dynamomulti16_UEV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Superconductor, 8), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 24)}, Materials.Tungsten.getMolten(4000), CustomItemList.eM_dynamomulti64_UEV.get(1, o), 400, 2000000); + + //Energy Hatches UV-UIV + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_UV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2)}, Materials.Silver.getMolten(1000), CustomItemList.eM_energymulti4_UV.get(1, o), 100, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energymulti4_UV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 4)}, Materials.Electrum.getMolten(1000), CustomItemList.eM_energymulti16_UV.get(1, o), 200, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energymulti16_UV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 6)}, Materials.Tungsten.getMolten(1000), CustomItemList.eM_energymulti64_UV.get(1, o), 400, 122880); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_MAX.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2)}, Materials.Silver.getMolten(2000), CustomItemList.eM_energymulti4_UHV.get(1, o), 100, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energymulti4_UHV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 4)}, Materials.Electrum.getMolten(2000), CustomItemList.eM_energymulti16_UHV.get(1, o), 200, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energymulti16_UHV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 6)}, Materials.Tungsten.getMolten(2000), CustomItemList.eM_energymulti64_UHV.get(1, o), 400, 500000); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_MAX.get(4, o), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Superconductor, 8), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 8)}, Materials.Silver.getMolten(4000), CustomItemList.eM_energymulti4_UEV.get(1, o), 100, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energymulti4_UEV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Superconductor, 8), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 16)}, Materials.Electrum.getMolten(4000), CustomItemList.eM_energymulti16_UEV.get(1, o), 200, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{CustomItemList.eM_energymulti16_UEV.get(1, o), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Superconductor, 8), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 24)}, Materials.Tungsten.getMolten(4000), CustomItemList.eM_energymulti64_UEV.get(1, o), 400, 2000000); + + //Data Input + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Computer_Casing.get(1, o), + ItemList.Hatch_Input_Bus_LuV.get(1, o), + ItemList.Circuit_Crystalcomputer.get(1, o), + CustomItemList.DATApipe.get(2, o) + }, Materials.Iridium.getMolten(1296), CustomItemList.dataIn_Hatch.get(1, o), 200, 122880, true); + //Data Output + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Computer_Casing.get(1, o), + ItemList.Hatch_Output_Bus_LuV.get(1, o), + ItemList.Circuit_Crystalcomputer.get(1, o), + CustomItemList.DATApipe.get(2, o) + }, Materials.Iridium.getMolten(1296), CustomItemList.dataOut_Hatch.get(1, o), 200, 122880, true); + + //Rack + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Computer_Bus.get(1, o), + ItemList.Hatch_Input_Bus_ZPM.get(1, o), + ItemList.Circuit_Crystalcomputer.get(2, o), + CustomItemList.DATApipe.get(4, o) + }, Materials.Iridium.getMolten(1296), CustomItemList.rack_Hatch.get(1, o), 800, 122880, true); + + //Object Holder + GT_Values.RA.addAssemblylineRecipe(ItemList.Hatch_Input_Bus_ZPM.get(1), 10000, new ItemStack[]{ + ItemList.Hatch_Input_Bus_ZPM.get(1), + CustomItemList.eM_Computer_Bus.get(1, o), + ItemList.Emitter_ZPM.get(8), + ItemList.Robot_Arm_ZPM.get(1), + ItemList.Electric_Motor_ZPM.get(2), + ItemList.Circuit_Crystalmainframe.get(1), + GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Naquadah, 2), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Naquadah, 16), + CustomItemList.DATApipe.get(2, o), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(500), + Materials.Iridium.getMolten(1000), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 1000) + }, CustomItemList.holder_Hatch.get(1), 1200, 100000); + + //Parameterizer + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Computer_Casing.get(1, o), + ItemList.Circuit_Masterquantumcomputer.get(1, o), + CustomItemList.DATApipe.get(4, o), + ItemList.Cover_Screen.get(1, o ), + new ItemStack(Blocks.stone_button, 16), + }, Materials.Iridium.getMolten(2592), CustomItemList.Parametrizer_Hatch.get(1, o), 800, 122880); + //Uncertainty + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Computer_Casing.get(1, o), + ItemList.Circuit_Ultimatecrystalcomputer.get(1, o), + CustomItemList.DATApipe.get(16, o), + ItemList.Cover_Screen.get(1, o ), + new ItemStack(Blocks.stone_button, 16), + }, Materials.Iridium.getMolten(2592), CustomItemList.Uncertainty_Hatch.get(1, o), 1200, 122880, true); + + //Elemental Input + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Containment.get(1, o), + ItemList.Hatch_Input_UV.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 2), + ItemList.Sensor_UV.get(1, o) + }, Materials.Osmiridium.getMolten(1296), CustomItemList.eM_in_UV.get(1, o), 800, 500000, true); + //Elemental Output + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Containment.get(1, o), + ItemList.Hatch_Output_UV.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 2), + ItemList.Emitter_UV.get(1, o) + }, Materials.Osmiridium.getMolten(1296), CustomItemList.eM_out_UV.get(1, o), 800, 500000, true); + //Overflow + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Containment.get(1, o), + ItemList.Hatch_Muffler_UV.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.Naquadah, 1), + ItemList.Field_Generator_UV.get(1, o) + }, Materials.Osmiridium.getMolten(1296), CustomItemList.eM_muffler_UV.get(1, o), 800, 500000, true); + + //endregion + + + //region multiblocks + + //Microwave Grinder + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + ItemList.Machine_HV_Microwave.get(1,o), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.StainlessSteel, 4), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 4), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.AnnealedCopper, 16), + ItemList.Upgrade_Overclocker.get(4, o), + }, Materials.Copper.getMolten(576), CustomItemList.Machine_Multi_Microwave.get(1, o), 800, 480); + + //Active Transformer + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + ItemList.Transformer_ZPM_LuV.get(16, o), + ItemList.Circuit_Board_Elite.get(1, o),//? + GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Superconductor, 16), + ItemList.Circuit_Chip_UHPIC.get(2, o), + }, Materials.TungstenSteel.getMolten(576), CustomItemList.Machine_Multi_Transformer.get(1, o), 400, 30720); + + //Network Switch + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.Machine_Multi_Transformer.get(1, o), + ItemList.Circuit_Ultimatecrystalcomputer.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Cobalt, 64), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 64), + CustomItemList.DATApipe.get(4, o), + }, Materials.Iridium.getMolten(1296), CustomItemList.Machine_Multi_Switch.get(1, o), 800, 122880); + + //Quantum Computer + GT_Values.RA.addAssemblylineRecipe(ItemList.Tool_DataOrb.get(1), 20000, new ItemStack[]{ + CustomItemList.Machine_Multi_Switch.get(1), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 2), + ItemList.Tool_DataOrb.get(1), + ItemList.Cover_Screen.get(1, o), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Superconductor, 8), + CustomItemList.DATApipe.get(8, o), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(1000), + Materials.Iridium.getMolten(1296), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Hydrogen.getGas(1000), + }, CustomItemList.Machine_Multi_Computer.get(1), 12000, 100000); + + //Research Station + GT_Values.RA.addAssemblylineRecipe(ItemList.Tool_Scanner.get(1), 80000, new ItemStack[]{ + CustomItemList.Machine_Multi_Switch.get(1), + ItemList.Sensor_ZPM.get(8), + ItemList.Circuit_Crystalmainframe.get(4), + ItemList.Field_Generator_ZPM.get(1), + ItemList.Electric_Motor_ZPM.get(2), + GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Naquadah, 4), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Naquadah, 32), + CustomItemList.DATApipe.get(16, o), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(1000), + Materials.Iridium.getMolten(1296), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Osmium.getMolten(1296), + }, CustomItemList.Machine_Multi_Research.get(1), 12000, 100000); + + //Matter Junction + TT_recipeAdder.addResearchableAssemblylineRecipe(CustomItemList.Machine_Multi_Switch.get(1), + 8000,32, 500000, 4, new ItemStack[]{ + CustomItemList.Machine_Multi_Transformer.get(1), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 4), + ItemList.Robot_Arm_LuV.get(2), + ItemList.Electric_Piston_LuV.get(2), + ItemList.Circuit_Wetwaresupercomputer.get(2), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Superconductor, 4), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(1000), + Materials.Naquadah.getMolten(1296), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Osmium.getMolten(1296), + }, CustomItemList.Machine_Multi_EMjunction.get(1), 12000, 100000); + + //Matter Quantizer + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Input_UV.get(1), + 12000,32, 500000, 6, new ItemStack[]{ + CustomItemList.Machine_Multi_Transformer.get(1), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 4), + ItemList.Emitter_UV.get(2), + ItemList.Circuit_Wetwaresupercomputer.get(1), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Superconductor, 2), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(1000), + Materials.Naquadah.getMolten(1296), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Osmium.getMolten(1296), + }, CustomItemList.Machine_Multi_MatterToEM.get(1), 12000, 100000); + + //Matter DeQuantizer + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Output_UV.get(1), + 12000,32, 500000, 6, new ItemStack[]{ + CustomItemList.Machine_Multi_Transformer.get(1), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Naquadah, 4), + ItemList.Sensor_UV.get(2), + ItemList.Circuit_Wetwaresupercomputer.get(1), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Superconductor, 2), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(1000), + Materials.Naquadah.getMolten(1296), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), + Materials.Osmium.getMolten(1296), + }, CustomItemList.Machine_Multi_EMToMatter.get(1), 12000, 100000); + + //Essentia Quantizer + TT_recipeAdder.addResearchableAssemblylineRecipe(CustomItemList.Machine_Multi_MatterToEM.get(1), + 15000,32, 500000, 8, new ItemStack[]{ + CustomItemList.Machine_Multi_MatterToEM.get(1), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Neutronium, 4), + ItemList.Emitter_UV.get(2), + ItemList.Circuit_Wetwaresupercomputer.get(1), + GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Superconductor, 8), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(2000), + Materials.Void.getMolten(2592), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 4000), + Materials.Osmium.getMolten(1296), + }, CustomItemList.Machine_Multi_EssentiaToEM.get(1), 24000, 500000); + + //Essentia DeQuantizer + TT_recipeAdder.addResearchableAssemblylineRecipe(CustomItemList.Machine_Multi_EMToMatter.get(1), + 15000,32, 500000, 8, new ItemStack[]{ + CustomItemList.Machine_Multi_EMToMatter.get(1), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Neutronium, 4), + ItemList.Sensor_UV.get(2), + ItemList.Circuit_Wetwaresupercomputer.get(1), + GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Superconductor, 8), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(2000), + Materials.Void.getMolten(2592), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 4000), + Materials.Osmium.getMolten(1296), + }, CustomItemList.Machine_Multi_EMToEssentia.get(1), 24000, 500000); + //EM Scanner + TT_recipeAdder.addResearchableAssemblylineRecipe(CustomItemList.Machine_Multi_Research.get(1), + 150000,128, 500000, 16, new ItemStack[]{ + CustomItemList.Machine_Multi_EMjunction.get(1), + CustomItemList.eM_Computer_Bus.get(4), + ItemList.Field_Generator_UV.get(4), + ItemList.Sensor_UV.get(4), + ItemList.Circuit_Wetwaresupercomputer.get(4),//? + GT_OreDictUnificator.get(OrePrefixes.lens,Materials.Diamond,32), + GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Superconductor, 16), + }, new FluidStack[]{ + Materials.UUMatter.getFluid(2000), + Materials.Neutronium.getMolten(2592), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 4000), + Materials.Osmiridium.getMolten(1296), + }, CustomItemList.Machine_Multi_Scanner.get(1), 24000, 500000); + //endregion } } 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 eaff4b6cf4..51f49d0bf9 100644 --- a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java @@ -1,9 +1,12 @@ package com.github.technus.tectech.loader; -import com.github.technus.tectech.elementalMatter.classes.cElementalPrimitive; -import com.github.technus.tectech.elementalMatter.definitions.*; import com.github.technus.tectech.compatibility.thaumcraft.definitions.dComplexAspectDefinition; import com.github.technus.tectech.compatibility.thaumcraft.definitions.ePrimalAspectDefinition; +import com.github.technus.tectech.elementalMatter.core.templates.cElementalPrimitive; +import com.github.technus.tectech.elementalMatter.definitions.complex.atom.dAtomDefinition; +import com.github.technus.tectech.elementalMatter.definitions.complex.hadron.dHadronDefinition; +import com.github.technus.tectech.elementalMatter.definitions.complex.atom.iaeaNuclide; +import com.github.technus.tectech.elementalMatter.definitions.primitive.*; /** * Created by danie_000 on 16.11.2016. @@ -25,6 +28,8 @@ public class ElementalLoader implements Runnable { dHadronDefinition.run(); + iaeaNuclide.run(); + dAtomDefinition.run(); ePrimalAspectDefinition.run(); diff --git a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java index 8a17551e62..761af0b60d 100644 --- a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java @@ -4,6 +4,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.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM; import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DebugPowerGenerator; @@ -86,93 +87,136 @@ public class MachineLoader implements Runnable { // Multi AMP Power INPUTS // =================================================================================================== + eM_energymulti4_IV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 15100, "hatch.energymulti04.tier.05", "IV 4A Energy Hatch", 5, 4).getStackForm(1L)); + eM_energymulti16_IV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 15110, "hatch.energymulti16.tier.05", "IV 16A Energy Hatch", 5, 16).getStackForm(1L)); + eM_energymulti64_IV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 15120, "hatch.energymulti64.tier.05", "IV 64A Energy Hatch", 5, 64).getStackForm(1L)); + + eM_energymulti4_LuV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 15101, "hatch.energymulti04.tier.06", "LuV 4A Energy Hatch", 6, 4).getStackForm(1L)); + eM_energymulti16_LuV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 15111, "hatch.energymulti16.tier.06", "LuV 16A Energy Hatch", 6, 16).getStackForm(1L)); + eM_energymulti64_LuV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 15121, "hatch.energymulti64.tier.06", "LuV 64A Energy Hatch", 6, 64).getStackForm(1L)); + + eM_energymulti4_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 15102, "hatch.energymulti04.tier.07", "ZPM 4A Energy Hatch", 7, 4).getStackForm(1L)); + eM_energymulti16_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 15112, "hatch.energymulti16.tier.07", "ZPM 16A Energy Hatch", 7, 16).getStackForm(1L)); + eM_energymulti64_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyMulti( + 15122, "hatch.energymulti64.tier.07", "ZPM 64A Energy Hatch", 7, 64).getStackForm(1L)); + eM_energymulti4_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15100, "hatch.energymulti04.tier.08", "UV 4A Energy Hatch", 8, 4).getStackForm(1L)); + 15103, "hatch.energymulti04.tier.08", "UV 4A Energy Hatch", 8, 4).getStackForm(1L)); eM_energymulti16_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15110, "hatch.energymulti16.tier.08", "UV 16A Energy Hatch", 8, 16).getStackForm(1L)); + 15113, "hatch.energymulti16.tier.08", "UV 16A Energy Hatch", 8, 16).getStackForm(1L)); eM_energymulti64_UV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15120, "hatch.energymulti64.tier.08", "UV 64A Energy Hatch", 8, 64).getStackForm(1L)); + 15123, "hatch.energymulti64.tier.08", "UV 64A Energy Hatch", 8, 64).getStackForm(1L)); eM_energymulti4_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15101, "hatch.energymulti04.tier.09", "UHV 4A Energy Hatch", 9, 4).getStackForm(1L)); + 15104, "hatch.energymulti04.tier.09", "UHV 4A Energy Hatch", 9, 4).getStackForm(1L)); eM_energymulti16_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15111, "hatch.energymulti16.tier.09", "UHV 16A Energy Hatch", 9, 16).getStackForm(1L)); + 15114, "hatch.energymulti16.tier.09", "UHV 16A Energy Hatch", 9, 16).getStackForm(1L)); eM_energymulti64_UHV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15121, "hatch.energymulti64.tier.09", "UHV 64A Energy Hatch", 9, 64).getStackForm(1L)); + 15124, "hatch.energymulti64.tier.09", "UHV 64A Energy Hatch", 9, 64).getStackForm(1L)); eM_energymulti4_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15102, "hatch.energymulti04.tier.10", "UEV 4A Energy Hatch", 10, 4).getStackForm(1L)); + 15105, "hatch.energymulti04.tier.10", "UEV 4A Energy Hatch", 10, 4).getStackForm(1L)); eM_energymulti16_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15112, "hatch.energymulti16.tier.10", "UEV 16A Energy Hatch", 10, 16).getStackForm(1L)); + 15115, "hatch.energymulti16.tier.10", "UEV 16A Energy Hatch", 10, 16).getStackForm(1L)); eM_energymulti64_UEV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15122, "hatch.energymulti64.tier.10", "UEV 64A Energy Hatch", 10, 64).getStackForm(1L)); + 15125, "hatch.energymulti64.tier.10", "UEV 64A Energy Hatch", 10, 64).getStackForm(1L)); eM_energymulti4_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15103, "hatch.energymulti04.tier.11", "UIV 4A Energy Hatch", 11, 4).getStackForm(1L)); + 15106, "hatch.energymulti04.tier.11", "UIV 4A Energy Hatch", 11, 4).getStackForm(1L)); eM_energymulti16_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15113, "hatch.energymulti16.tier.11", "UIV 16A Energy Hatch", 11, 16).getStackForm(1L)); + 15116, "hatch.energymulti16.tier.11", "UIV 16A Energy Hatch", 11, 16).getStackForm(1L)); eM_energymulti64_UIV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15123, "hatch.energymulti64.tier.11", "UIV 64A Energy Hatch", 11, 64).getStackForm(1L)); + 15126, "hatch.energymulti64.tier.11", "UIV 64A Energy Hatch", 11, 64).getStackForm(1L)); eM_energymulti4_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15104, "hatch.energymulti04.tier.12", "UMV 4A Energy Hatch", 12, 4).getStackForm(1L)); + 15107, "hatch.energymulti04.tier.12", "UMV 4A Energy Hatch", 12, 4).getStackForm(1L)); eM_energymulti16_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15114, "hatch.energymulti16.tier.12", "UMV 16A Energy Hatch", 12, 16).getStackForm(1L)); + 15117, "hatch.energymulti16.tier.12", "UMV 16A Energy Hatch", 12, 16).getStackForm(1L)); eM_energymulti64_UMV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15124, "hatch.energymulti64.tier.12", "UMV 64A Energy Hatch", 12, 64).getStackForm(1L)); + 15127, "hatch.energymulti64.tier.12", "UMV 64A Energy Hatch", 12, 64).getStackForm(1L)); eM_energymulti4_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15105, "hatch.energymulti04.tier.13", "UXV 4A Energy Hatch", 13, 4).getStackForm(1L)); + 15108, "hatch.energymulti04.tier.13", "UXV 4A Energy Hatch", 13, 4).getStackForm(1L)); eM_energymulti16_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15115, "hatch.energymulti16.tier.13", "UXV 16A Energy Hatch", 13, 16).getStackForm(1L)); + 15118, "hatch.energymulti16.tier.13", "UXV 16A Energy Hatch", 13, 16).getStackForm(1L)); eM_energymulti64_UXV.set(new GT_MetaTileEntity_Hatch_EnergyMulti( - 15125, "hatch.energymulti64.tier.13", "UXV 64A Energy Hatch", 13, 64).getStackForm(1L)); + 15128, "hatch.energymulti64.tier.13", "UXV 64A Energy Hatch", 13, 64).getStackForm(1L)); // =================================================================================================== // Multi AMP Power OUTPUTS // =================================================================================================== + + eM_dynamomulti4_IV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 15200, "hatch.dynamomulti04.tier.05", "IV 4A Dynamo Hatch", 5, 4).getStackForm(1L)); + eM_dynamomulti16_IV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 15210, "hatch.dynamomulti16.tier.05", "IV 16A Dynamo Hatch", 5, 16).getStackForm(1L)); + eM_dynamomulti64_IV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 15220, "hatch.dynamomulti64.tier.05", "IV 64A Dynamo Hatch", 5, 64).getStackForm(1L)); + + eM_dynamomulti4_LuV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 15201, "hatch.dynamomulti04.tier.06", "LuV 4A Dynamo Hatch", 6, 4).getStackForm(1L)); + eM_dynamomulti16_LuV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 15211, "hatch.dynamomulti16.tier.06", "LuV 16A Dynamo Hatch", 6, 16).getStackForm(1L)); + eM_dynamomulti64_LuV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 15221, "hatch.dynamomulti64.tier.06", "LuV 64A Dynamo Hatch", 6, 64).getStackForm(1L)); + + eM_dynamomulti4_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 15202, "hatch.dynamomulti04.tier.07", "ZPM 4A Dynamo Hatch", 7, 4).getStackForm(1L)); + eM_dynamomulti16_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 15212, "hatch.dynamomulti16.tier.07", "ZPM 16A Dynamo Hatch", 7, 16).getStackForm(1L)); + eM_dynamomulti64_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoMulti( + 15222, "hatch.dynamomulti64.tier.07", "ZPM 64A Dynamo Hatch", 7, 64).getStackForm(1L)); + eM_dynamomulti4_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15200, "hatch.dynamomulti04.tier.08", "UV 4A Dynamo Hatch", 8, 4).getStackForm(1L)); + 15203, "hatch.dynamomulti04.tier.08", "UV 4A Dynamo Hatch", 8, 4).getStackForm(1L)); eM_dynamomulti16_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15210, "hatch.dynamomulti16.tier.08", "UV 16A Dynamo Hatch", 8, 16).getStackForm(1L)); + 15213, "hatch.dynamomulti16.tier.08", "UV 16A Dynamo Hatch", 8, 16).getStackForm(1L)); eM_dynamomulti64_UV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15220, "hatch.dynamomulti64.tier.08", "UV 64A Dynamo Hatch", 8, 64).getStackForm(1L)); + 15223, "hatch.dynamomulti64.tier.08", "UV 64A Dynamo Hatch", 8, 64).getStackForm(1L)); eM_dynamomulti4_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15201, "hatch.dynamomulti04.tier.09", "UHV 4A Dynamo Hatch", 9, 4).getStackForm(1L)); + 15204, "hatch.dynamomulti04.tier.09", "UHV 4A Dynamo Hatch", 9, 4).getStackForm(1L)); eM_dynamomulti16_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15211, "hatch.dynamomulti16.tier.09", "UHV 16A Dynamo Hatch", 9, 16).getStackForm(1L)); + 15214, "hatch.dynamomulti16.tier.09", "UHV 16A Dynamo Hatch", 9, 16).getStackForm(1L)); eM_dynamomulti64_UHV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15221, "hatch.dynamomulti64.tier.09", "UHV 64A Dynamo Hatch", 9, 64).getStackForm(1L)); + 15224, "hatch.dynamomulti64.tier.09", "UHV 64A Dynamo Hatch", 9, 64).getStackForm(1L)); eM_dynamomulti4_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15202, "hatch.dynamomulti04.tier.10", "UEV 4A Dynamo Hatch", 10, 4).getStackForm(1L)); + 15205, "hatch.dynamomulti04.tier.10", "UEV 4A Dynamo Hatch", 10, 4).getStackForm(1L)); eM_dynamomulti16_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15212, "hatch.dynamomulti16.tier.10", "UEV 16A Dynamo Hatch", 10, 16).getStackForm(1L)); + 15215, "hatch.dynamomulti16.tier.10", "UEV 16A Dynamo Hatch", 10, 16).getStackForm(1L)); eM_dynamomulti64_UEV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15222, "hatch.dynamomulti64.tier.10", "UEV 64A Dynamo Hatch", 10, 64).getStackForm(1L)); + 15225, "hatch.dynamomulti64.tier.10", "UEV 64A Dynamo Hatch", 10, 64).getStackForm(1L)); eM_dynamomulti4_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15203, "hatch.dynamomulti04.tier.11", "UIV 4A Dynamo Hatch", 11, 4).getStackForm(1L)); + 15206, "hatch.dynamomulti04.tier.11", "UIV 4A Dynamo Hatch", 11, 4).getStackForm(1L)); eM_dynamomulti16_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15213, "hatch.dynamomulti16.tier.11", "UIV 16A Dynamo Hatch", 11, 16).getStackForm(1L)); + 15216, "hatch.dynamomulti16.tier.11", "UIV 16A Dynamo Hatch", 11, 16).getStackForm(1L)); eM_dynamomulti64_UIV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15223, "hatch.dynamomulti64.tier.11", "UIV 64A Dynamo Hatch", 11, 64).getStackForm(1L)); + 15226, "hatch.dynamomulti64.tier.11", "UIV 64A Dynamo Hatch", 11, 64).getStackForm(1L)); eM_dynamomulti4_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15204, "hatch.dynamomulti04.tier.12", "UMV 4A Dynamo Hatch", 12, 4).getStackForm(1L)); + 15207, "hatch.dynamomulti04.tier.12", "UMV 4A Dynamo Hatch", 12, 4).getStackForm(1L)); eM_dynamomulti16_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15214, "hatch.dynamomulti16.tier.12", "UMV 16A Dynamo Hatch", 12, 16).getStackForm(1L)); + 15217, "hatch.dynamomulti16.tier.12", "UMV 16A Dynamo Hatch", 12, 16).getStackForm(1L)); eM_dynamomulti64_UMV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15224, "hatch.dynamomulti64.tier.12", "UMV 64A Dynamo Hatch", 12, 64).getStackForm(1L)); + 15227, "hatch.dynamomulti64.tier.12", "UMV 64A Dynamo Hatch", 12, 64).getStackForm(1L)); eM_dynamomulti4_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15205, "hatch.dynamomulti04.tier.13", "UXV 4A Dynamo Hatch", 13, 4).getStackForm(1L)); + 15208, "hatch.dynamomulti04.tier.13", "UXV 4A Dynamo Hatch", 13, 4).getStackForm(1L)); eM_dynamomulti16_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15215, "hatch.dynamomulti16.tier.13", "UXV 16A Dynamo Hatch", 13, 16).getStackForm(1L)); + 15218, "hatch.dynamomulti16.tier.13", "UXV 16A Dynamo Hatch", 13, 16).getStackForm(1L)); eM_dynamomulti64_UXV.set(new GT_MetaTileEntity_Hatch_DynamoMulti( - 15225, "hatch.dynamomulti64.tier.13", "UXV 64A Dynamo Hatch", 13, 64).getStackForm(1L)); + 15228, "hatch.dynamomulti64.tier.13", "UXV 64A Dynamo Hatch", 13, 64).getStackForm(1L)); // =================================================================================================== // MULTIBLOCKS @@ -217,6 +261,7 @@ public class MachineLoader implements Runnable { // =================================================================================================== Parametrizer_Hatch.set(new GT_MetaTileEntity_Hatch_Param(15420, "hatch.param.tier.07", "Parametrizer", 7).getStackForm(1L)); + ParametrizerX_Hatch.set(new GT_MetaTileEntity_Hatch_Param(15421, "hatch.param.tier.10", "Parametrizer X", 10).getStackForm(1L)); Uncertainty_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(15430, "hatch.certain.tier.07", "Uncertainty Resolver", 7).getStackForm(1L)); UncertaintyX_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(15431, "hatch.certain.tier.10", "Uncertainty Resolver X", 10).getStackForm(1L)); diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index 4259078c69..1fc1ddda22 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -9,7 +9,8 @@ import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.item.ConstructableTriggerItem; -import com.github.technus.tectech.thing.item.DebugContainer_EM; +import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; +import com.github.technus.tectech.thing.item.ElementalDefinitionScanStorage_EM; import com.github.technus.tectech.thing.item.ParametrizerMemoryCard; import cpw.mods.fml.common.ProgressManager; import cpw.mods.fml.relauncher.Side; @@ -89,7 +90,7 @@ public final class MainLoader { @SideOnly(Side.CLIENT) @Override public Item getTabIconItem() { - return DebugContainer_EM.INSTANCE; + return DebugElementalInstanceContainer_EM.INSTANCE; } @Override @@ -117,9 +118,10 @@ public final class MainLoader { QuantumGlassBlock.INSTANCE.setCreativeTab(mainTab); TT_Container_Casings.sBlockCasingsTT.setCreativeTab(mainTab); TT_Container_Casings.sHintCasingsTT.setCreativeTab(mainTab); - DebugContainer_EM.INSTANCE.setCreativeTab(mainTab); + DebugElementalInstanceContainer_EM.INSTANCE.setCreativeTab(mainTab); ConstructableTriggerItem.INSTANCE.setCreativeTab(mainTab); ParametrizerMemoryCard.INSTANCE.setCreativeTab(mainTab); + ElementalDefinitionScanStorage_EM.INSTANCE.setCreativeTab(mainTab); } private void registerExtraHazmats() { diff --git a/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java index a0c72baf51..1723506d6f 100644 --- a/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java @@ -1,8 +1,17 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.compatibility.dreamcraft.DreamCraftRecipeLoader; -import com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition; +import com.github.technus.tectech.elementalMatter.definitions.complex.atom.dAtomDefinition; +import com.github.technus.tectech.elementalMatter.definitions.complex.hadron.dHadronDefinition; +import com.github.technus.tectech.thing.casing.TT_Container_Casings; import cpw.mods.fml.common.Loader; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import net.minecraft.item.ItemStack; + +import static gregtech.api.enums.GT_Values.RA; /** * Created by danie_000 on 16.11.2016. @@ -10,14 +19,20 @@ import cpw.mods.fml.common.Loader; public class RecipeLoader implements Runnable { public void run() { dAtomDefinition.setTransformation(); + dHadronDefinition.setTransformations(); // =================================================================================================== // 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); - - if (Loader.isModLoaded("dreamcraft")) new DreamCraftRecipeLoader().run();//TODO init recipes for GTNH version - else new BloodyRecipeLoader().run();//TODO init recipes for NON-GTNH version + if (Loader.isModLoaded("dreamcraft")) new DreamCraftRecipeLoader().run();//init recipes for GTNH version + else new BloodyRecipeLoader().run();//init recipes for NON-GTNH version } } diff --git a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java index 7411bc9335..e42e8e8edc 100644 --- a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java @@ -3,13 +3,11 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; +import com.github.technus.tectech.thing.block.ReactorSimBlock; import com.github.technus.tectech.thing.casing.GT_Block_CasingsTT; import com.github.technus.tectech.thing.casing.GT_Block_HintTT; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.item.ConstructableTriggerItem; -import com.github.technus.tectech.thing.item.DebugContainer_EM; -import com.github.technus.tectech.thing.item.DefinitionContainer_EM; -import com.github.technus.tectech.thing.item.ParametrizerMemoryCard; +import com.github.technus.tectech.thing.item.*; import cpw.mods.fml.common.Loader; import openmodularturrets.blocks.turretbases.TurretBaseEM; import openmodularturrets.blocks.turretheads.TurretHeadEM; @@ -37,12 +35,16 @@ public class ThingsLoader implements Runnable { TecTech.Logger.info("TurretBaseEM registered"); } + ReactorSimBlock.run(); + TecTech.Logger.info("Reactor Simulator registered"); + ConstructableTriggerItem.run(); ParametrizerMemoryCard.run(); - TecTech.Logger.info("Useful item registered"); + ElementalDefinitionScanStorage_EM.run(); + TecTech.Logger.info("Useful Items registered"); - DefinitionContainer_EM.run(); - DebugContainer_EM.run(); + ElementalDefinitionContainer_EM.run(); + DebugElementalInstanceContainer_EM.run(); TecTech.Logger.info("Debug Items registered"); } } diff --git a/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java b/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java index b488e29ee7..05f5018fdc 100644 --- a/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java +++ b/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java @@ -7,11 +7,14 @@ import cpw.mods.fml.common.FMLCommonHandler; public class NEI_TT_Config implements IConfigureNEI {//must be NEI*Config public static boolean sIsAdded = true; public static TT_NEI_ResearchHandler TT_RH; + public static TT_NEI_ScannerHandler TT_SH; public void loadConfig() { sIsAdded = false; - if(FMLCommonHandler.instance().getEffectiveSide().isClient()) - TT_RH =new TT_NEI_ResearchHandler(TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes); + if(FMLCommonHandler.instance().getEffectiveSide().isClient()) { + TT_RH = new TT_NEI_ResearchHandler(TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes); + TT_SH = new TT_NEI_ScannerHandler(TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes); + } sIsAdded = true; } diff --git a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java index f4a8ca8e7e..38a127900b 100644 --- a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java +++ b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java @@ -86,7 +86,7 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { public void loadCraftingRecipes(ItemStack aResult) { ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); - ArrayList<ItemStack> tResults = new ArrayList(); + ArrayList<ItemStack> tResults = new ArrayList<>(); tResults.add(aResult); tResults.add(GT_OreDictUnificator.get(true, aResult)); if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { @@ -120,7 +120,7 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { public void loadUsageRecipes(ItemStack aInput) { ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); - ArrayList<ItemStack> tInputs = new ArrayList(); + ArrayList<ItemStack> tInputs = new ArrayList<>(); tInputs.add(aInput); tInputs.add(GT_OreDictUnificator.get(false, aInput)); if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { @@ -322,7 +322,7 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { if (this.permutated) { return; } - ArrayList<ItemStack> tDisplayStacks = new ArrayList(); + ArrayList<ItemStack> tDisplayStacks = new ArrayList<>(); for (ItemStack tStack : this.items) { if (GT_Utility.isStackValid(tStack)) { if (tStack.getItemDamage() == 32767) { diff --git a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ScannerHandler.java b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ScannerHandler.java new file mode 100644 index 0000000000..5ec6e18874 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ScannerHandler.java @@ -0,0 +1,817 @@ +package com.github.technus.tectech.nei; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.guihook.IContainerInputHandler; +import codechicken.nei.guihook.IContainerTooltipHandler; +import codechicken.nei.recipe.GuiCraftingRecipe; +import codechicken.nei.recipe.GuiRecipe; +import codechicken.nei.recipe.GuiUsageRecipe; +import codechicken.nei.recipe.TemplateRecipeHandler; +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.auxiliary.Reference; +import com.github.technus.tectech.recipe.TT_recipe; +import cpw.mods.fml.common.event.FMLInterModComms; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.gui.GT_GUIContainer_BasicMachine; +import gregtech.api.objects.ItemData; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.common.gui.GT_GUIContainer_FusionReactor; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { + public static final int sOffsetX = 5; + public static final int sOffsetY = 11; + + static { + GuiContainerManager.addInputHandler(new GT_RectHandler()); + GuiContainerManager.addTooltipHandler(new GT_RectHandler()); + } + + protected final TT_recipe.GT_Recipe_MapTT mRecipeMap; + + public TT_NEI_ScannerHandler(TT_recipe.GT_Recipe_MapTT aRecipeMap) { + this.mRecipeMap = aRecipeMap; + this.transferRects.add(new RecipeTransferRect(new Rectangle(65, 13, 36, 18), getOverlayIdentifier())); + if (!NEI_TT_Config.sIsAdded) { + FMLInterModComms.sendRuntimeMessage(TecTech.instance, "NEIPlugins", "register-crafting-handler", Reference.MODID+"@" + getRecipeName() + "@" + getOverlayIdentifier()); + GuiCraftingRecipe.craftinghandlers.add(this); + GuiUsageRecipe.usagehandlers.add(this); + } + } + + public List<GT_Recipe> getSortedRecipes() { + List<GT_Recipe> result = new ArrayList<>(this.mRecipeMap.mRecipeList); + Collections.sort(result); + return result; + } + + public static void drawText(int aX, int aY, String aString, int aColor) { + Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); + } + + public TemplateRecipeHandler newInstance() { + NEI_TT_Config.TT_SH=new TT_NEI_ScannerHandler(mRecipeMap); + return NEI_TT_Config.TT_SH; + } + + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOverlayIdentifier())) { + for (GT_Recipe tRecipe : getSortedRecipes()) { + if (!tRecipe.mHidden) { + this.arecipes.add(new CachedDefaultRecipe(tRecipe)); + } + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + public void loadCraftingRecipes(ItemStack aResult) { + ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); + + ArrayList<ItemStack> tResults = new ArrayList<>(); + tResults.add(aResult); + tResults.add(GT_OreDictUnificator.get(true, aResult)); + if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { + tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); + } + } + FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); + if (tFluid != null) { + tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); + for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { + if (tData.fluid.isFluidEqual(tFluid)) { + tResults.add(GT_Utility.copy(tData.filledContainer)); + } + } + } + for (GT_Recipe tRecipe : getSortedRecipes()) { + if (!tRecipe.mHidden) { + CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); + for (ItemStack tStack : tResults) { + if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { + this.arecipes.add(tNEIRecipe); + break; + } + } + } + } + CachedDefaultRecipe tNEIRecipe; + } + + public void loadUsageRecipes(ItemStack aInput) { + ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); + + ArrayList<ItemStack> tInputs = new ArrayList<>(); + tInputs.add(aInput); + tInputs.add(GT_OreDictUnificator.get(false, aInput)); + if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { + tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); + } + } + FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); + if (tFluid != null) { + tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); + for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { + if (tData.fluid.isFluidEqual(tFluid)) { + tInputs.add(GT_Utility.copy(tData.filledContainer)); + } + } + } + for (GT_Recipe tRecipe : getSortedRecipes()) { + if (!tRecipe.mHidden) { + CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); + for (ItemStack tStack : tInputs) { + if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { + this.arecipes.add(tNEIRecipe); + break; + } + } + } + } + CachedDefaultRecipe tNEIRecipe; + } + + public String getOverlayIdentifier() { + return this.mRecipeMap.mNEIName; + } + + public void drawBackground(int recipe) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(getGuiTexture()); + GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78); + } + + public int recipiesPerPage() { + return 1; + } + + public String getRecipeName() { + return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); + } + + public String getGuiTexture() { +// return "gregtech:textures/gui/" + this.mRecipeMap.mUnlocalizedName + ".png"; + return this.mRecipeMap.mNEIGUIPath; + } + + public List<String> handleItemTooltip(GuiRecipe gui, ItemStack aStack, List<String> currenttip, int aRecipeIndex) { + CachedRecipe tObject = this.arecipes.get(aRecipeIndex); + if ((tObject instanceof CachedDefaultRecipe)) { + CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; + for (PositionedStack tStack : tRecipe.mOutputs) { + if (aStack == tStack.item) { + if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) { + break; + } + currenttip.add(trans("150","Chance: ") + ((FixedPositionedStack) tStack).mChance / 100 + "." + (((FixedPositionedStack) tStack).mChance % 100 < 10 ? "0" + ((FixedPositionedStack) tStack).mChance % 100 : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "%"); + break; + } + } + for (PositionedStack tStack : tRecipe.mInputs) { + if (aStack == tStack.item) { + if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) || + (tStack.item.stackSize != 0)) { + break; + } + currenttip.add(trans("151","Does not get consumed in the process")); + break; + } + } + } + return currenttip; + } + + public void drawExtras(int aRecipeIndex) { + int tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; + int computation = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; + String[] recipeDesc = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.getNeiDesc(); + if (recipeDesc == null) { + int tSpecial = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue; + short ampere=(short) (tSpecial & 0xFFFF),minComputationPerSec=(short)(tSpecial>>>16); + if (tEUt != 0) { + drawText(10, 73, trans("152","Max Total: ") + ((1+((computation-minComputationPerSec)/minComputationPerSec)) * (long)tEUt * ampere * 20) + " EU", -16777216); + drawText(10, 83, trans("153","Usage: ") + ((long)tEUt*ampere) + " EU/t", -16777216); + if (this.mRecipeMap.mShowVoltageAmperageInNEI) { + drawText(10, 93, trans("154","Voltage: ") + tEUt + " EU", -16777216); + drawText(10, 103, trans("155","Amperage: ") + ampere, -16777216); + } else { + drawText(10, 93, trans("156","Voltage: unspecified"), -16777216); + drawText(10, 103, trans("157","Amperage: unspecified"), -16777216); + } + } + drawText(10, 113, "Computation: "+computation, -16777216); + drawText(10, 123, "Min Computation: "+minComputationPerSec + " /s", -16777216); + } else { + int i = 0; + for (String descLine : recipeDesc) { + drawText(10, 73 + 10 * i, descLine, -16777216); + i++; + } + } + } + + public static class GT_RectHandler + implements IContainerInputHandler, IContainerTooltipHandler { + public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) { + if (canHandle(gui)) { + if (button == 0) { + return transferRect(gui, false); + } + if (button == 1) { + return transferRect(gui, true); + } + } + return false; + } + + public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode) { + return false; + } + + public boolean canHandle(GuiContainer gui) { + return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) || ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))); + } + + public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) { + if ((canHandle(gui)) && (currenttip.isEmpty())) { + if (gui instanceof GT_GUIContainer_BasicMachine && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + currenttip.add("Recipes"); + } else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + currenttip.add("Recipes"); + } + + } + return currenttip; + } + + private boolean transferRect(GuiContainer gui, boolean usage) { + if (gui instanceof GT_GUIContainer_BasicMachine) { + return (canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI)); + } else if (gui instanceof GT_GUIContainer_FusionReactor) { + return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI)); + } + return false; + } + + public List<String> handleItemDisplayName(GuiContainer gui, ItemStack itemstack, List<String> currenttip) { + return currenttip; + } + + public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey, List<String> currenttip) { + return currenttip; + } + + public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) { + return false; + } + + public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) { + } + + public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) { + } + + public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) { + } + + public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { + return false; + } + + public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { + } + + public void onMouseDragged(GuiContainer gui, int mousex, int mousey, int button, long heldTime) { + } + } + + public static class FixedPositionedStack extends PositionedStack { + public final int mChance; + public boolean permutated = false; + + public FixedPositionedStack(Object object, int x, int y) { + this(object, x, y, 0); + } + + public FixedPositionedStack(Object object, int x, int y, int aChance) { + super(object, x, y, true); + this.mChance = aChance; + } + + public void generatePermutations() { + if (this.permutated) { + return; + } + ArrayList<ItemStack> tDisplayStacks = new ArrayList<>(); + for (ItemStack tStack : this.items) { + if (GT_Utility.isStackValid(tStack)) { + if (tStack.getItemDamage() == 32767) { + List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); + if (!permutations.isEmpty()) { + ItemStack stack; + for (Iterator i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, stack))) { + stack = (ItemStack) i$.next(); + } + } else { + ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize); + base.stackTagCompound = tStack.stackTagCompound; + tDisplayStacks.add(base); + } + } else { + tDisplayStacks.add(GT_Utility.copy(tStack)); + } + } + } + this.items = tDisplayStacks.toArray(new ItemStack[0]); + if (this.items.length == 0) { + this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; + } + this.permutated = true; + setPermutationToRender(0); + } + } + + public class CachedDefaultRecipe + extends CachedRecipe { + public final GT_Recipe mRecipe; + public final List<PositionedStack> mOutputs; + public final List<PositionedStack> mInputs; + + public CachedDefaultRecipe(GT_Recipe aRecipe) { + super(); + this.mRecipe = aRecipe; + + mOutputs = new ArrayList<>(); + mInputs = new ArrayList<>(); + + int tStartIndex = 0; + //switch (mRecipeMap.mUsualInputCount) { + //case 0: + // break; + //case 1: + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14+9)); + } + //tStartIndex++; + //break; + //case 2: + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + // } + // tStartIndex++; + // break; + //case 3: + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + // } + // tStartIndex++; + // break; + //case 4: + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23)); + // } + // tStartIndex++; + // break; + //case 5: + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 5)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23)); + // } + // tStartIndex++; + // break; + //case 6: + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 5)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 23)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23)); + // } + // tStartIndex++; + // break; + //case 7: + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, -4)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, -4)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, -4)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 32)); + // } + // tStartIndex++; + // break; + //case 8: + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, -4)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, -4)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, -4)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 32)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 32)); + // } + // tStartIndex++; + // break; + //default: + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, -4)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, -4)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, -4)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 32)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 32)); + // } + // tStartIndex++; + // if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + // this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 32)); + // } + // tStartIndex++; + //} + if (aRecipe.mSpecialItems != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); + } + //tStartIndex = 0; + //switch (mRecipeMap.mUsualOutputCount) { + //case 0: + // break; + //case 1: + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14+9, aRecipe.getOutputChance(tStartIndex))); + } + //tStartIndex++; + //break; + //case 2: + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // break; + //case 3: + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // break; + //case 4: + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // break; + //case 5: + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 5, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // break; + //case 6: + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 5, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 23, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // break; + //case 7: + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, -4, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, -4, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, -4, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 32, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // break; + //case 8: + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, -4, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, -4, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, -4, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 32, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 32, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // break; + //default: + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, -4, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, -4, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, -4, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 32, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 32, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + // if (aRecipe.getOutput(tStartIndex) != null) { + // this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 32, aRecipe.getOutputChance(tStartIndex))); + // } + // tStartIndex++; + //} + //if ((aRecipe.mFluidInputs.length > 0) && (aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) { + // this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 48, 52)); + // if ((aRecipe.mFluidInputs.length > 1) && (aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) { + // this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 30, 52)); + // } + //} + //if (aRecipe.mFluidOutputs.length > 1) { + // if (aRecipe.mFluidOutputs[0] != null && (aRecipe.mFluidOutputs[0].getFluid() != null)) { + // this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 120, 5)); + // } + // if (aRecipe.mFluidOutputs[1] != null && (aRecipe.mFluidOutputs[1].getFluid() != null)) { + // this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 138, 5)); + // } + // if (aRecipe.mFluidOutputs.length > 2 && aRecipe.mFluidOutputs[2] != null && (aRecipe.mFluidOutputs[2].getFluid() != null)) { + // this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[2], true), 102, 23)); + // } + // if (aRecipe.mFluidOutputs.length > 3 && aRecipe.mFluidOutputs[3] != null && (aRecipe.mFluidOutputs[3].getFluid() != null)) { + // this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[3], true), 120, 23)); + // } + // if (aRecipe.mFluidOutputs.length > 4 && aRecipe.mFluidOutputs[4] != null && (aRecipe.mFluidOutputs[4].getFluid() != null)) { + // this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[4], true), 138, 23)); + // } + //} else if ((aRecipe.mFluidOutputs.length > 0) && (aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) { + // this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 102, 52)); + //} + } + + public List<PositionedStack> getIngredients() { + return getCycledIngredients(cycleticks / 10, this.mInputs); + } + + public PositionedStack getResult() { + return null; + } + + public List<PositionedStack> getOtherStacks() { + return this.mOutputs; + } + } + + public String trans(String aKey, String aEnglish){ + return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_"+aKey, aEnglish, false); + } +} 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 aa1d85f109..439a28e384 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.recipe; -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinition; -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStackMap; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.core.templates.cElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_Recipe; import net.minecraft.item.ItemStack; diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index 51c9982752..6324854082 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java @@ -1,10 +1,10 @@ package com.github.technus.tectech.recipe; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStackMap; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; -import com.github.technus.tectech.thing.item.DefinitionContainer_EM; +import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_machine; import gregtech.api.enums.ItemList; @@ -104,8 +104,8 @@ public class TT_recipeAdder extends GT_RecipeAdder { else if(researchAmperage > Short.MAX_VALUE) researchAmperage=Short.MAX_VALUE; if(computationRequiredPerSec<=0) computationRequiredPerSec=1; else if(computationRequiredPerSec > Short.MAX_VALUE) computationRequiredPerSec=Short.MAX_VALUE; - ItemStack placeholder=new ItemStack(DefinitionContainer_EM.INSTANCE); - DefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(aResearchEM,1))); + ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); + ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(aResearchEM,1))); GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_machine.machine)}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,aInputs,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, aFluidInputs,machineDuration,machineEUt,machineAmperage,eInputs)); @@ -123,8 +123,8 @@ public class TT_recipeAdder extends GT_RecipeAdder { else if(researchAmperage > Short.MAX_VALUE) researchAmperage=Short.MAX_VALUE; if(computationRequiredPerSec<=0) computationRequiredPerSec=1; else if(computationRequiredPerSec > Short.MAX_VALUE) computationRequiredPerSec=Short.MAX_VALUE; - ItemStack placeholder=new ItemStack(DefinitionContainer_EM.INSTANCE); - DefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(aResearchEM,1))); + ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); + ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(aResearchEM,1))); GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafting.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,null,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, null,crafterDuration,crafterEUt,crafterAmperage,eInputs,null,catalyst,check)); diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java index 557fc7da68..543f6124a6 100644 --- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java +++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java @@ -13,22 +13,31 @@ import static gregtech.api.enums.GT_Values.W; public enum CustomItemList implements IItemContainer { Machine_DebugWriter,Machine_DebugGenny, EMpipe, DATApipe, rack_Hatch, holder_Hatch, + + eM_dynamomulti4_IV, eM_dynamomulti16_IV, eM_dynamomulti64_IV, + eM_dynamomulti4_LuV, eM_dynamomulti16_LuV, eM_dynamomulti64_LuV, + eM_dynamomulti4_ZPM, eM_dynamomulti16_ZPM, eM_dynamomulti64_ZPM, eM_dynamomulti4_UV, eM_dynamomulti16_UV, eM_dynamomulti64_UV, eM_dynamomulti4_UHV, eM_dynamomulti16_UHV, eM_dynamomulti64_UHV, eM_dynamomulti4_UEV, eM_dynamomulti16_UEV, eM_dynamomulti64_UEV, eM_dynamomulti4_UIV, eM_dynamomulti16_UIV, eM_dynamomulti64_UIV, eM_dynamomulti4_UMV, eM_dynamomulti16_UMV, eM_dynamomulti64_UMV, eM_dynamomulti4_UXV, eM_dynamomulti16_UXV, eM_dynamomulti64_UXV, + + eM_energymulti4_IV, eM_energymulti16_IV, eM_energymulti64_IV, + eM_energymulti4_LuV, eM_energymulti16_LuV, eM_energymulti64_LuV, + eM_energymulti4_ZPM, eM_energymulti16_ZPM, eM_energymulti64_ZPM, eM_energymulti4_UV, eM_energymulti16_UV, eM_energymulti64_UV, eM_energymulti4_UHV, eM_energymulti16_UHV, eM_energymulti64_UHV, eM_energymulti4_UEV, eM_energymulti16_UEV, eM_energymulti64_UEV, eM_energymulti4_UIV, eM_energymulti16_UIV, eM_energymulti64_UIV, eM_energymulti4_UMV, eM_energymulti16_UMV, eM_energymulti64_UMV, eM_energymulti4_UXV, eM_energymulti16_UXV, eM_energymulti64_UXV, + eM_in_UV, eM_in_UHV, eM_in_UEV, eM_in_UIV, eM_in_UMV, eM_in_UXV, eM_out_UV, eM_out_UHV, eM_out_UEV, eM_out_UIV, eM_out_UMV, eM_out_UXV, eM_muffler_UV, eM_muffler_UHV, eM_muffler_UEV, eM_muffler_UIV, eM_muffler_UMV, eM_muffler_UXV, - Parametrizer_Hatch, Uncertainty_Hatch, UncertaintyX_Hatch, dataIn_Hatch, dataOut_Hatch, + Parametrizer_Hatch, ParametrizerX_Hatch, Uncertainty_Hatch, UncertaintyX_Hatch, dataIn_Hatch, dataOut_Hatch, eM_Containment, eM_Containment_Field, eM_Containment_Advanced, eM_Coil, eM_Teleportation, eM_Dimensional, eM_Ultimate_Containment, eM_Ultimate_Containment_Advanced, eM_Ultimate_Containment_Field, eM_Spacetime, eM_Computer_Casing, eM_Computer_Bus, eM_Computer_Vent, eM_Hollow, eM_Power, debugBlock, Machine_Multi_Microwave, Machine_Multi_teslaCoil, 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 81b6787435..88ad7cfbcb 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 @@ -10,6 +10,7 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; import static com.github.technus.tectech.auxiliary.Reference.MODID; @@ -91,4 +92,18 @@ public final class QuantumGlassBlock extends BlockBase { GameRegistry.registerBlock(INSTANCE, QuantumGlassItem.class, INSTANCE.getUnlocalizedName()); GregTech_API.registerMachineBlock(INSTANCE, -1); } + + @Override + public void breakBlock(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMeta) { + if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) { + GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); + } + } + + @Override + public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { + if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) { + GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); + } + } } diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassItem.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassItem.java index e3db4d6bb7..171e8db6e9 100644 --- a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassItem.java +++ b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassItem.java @@ -8,7 +8,7 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; -import static com.github.technus.tectech.CommonValues.TEC_MARK; +import static com.github.technus.tectech.CommonValues.TEC_MARK_EM; /** * Created by Tec on 11.04.2017. @@ -22,7 +22,7 @@ public class QuantumGlassItem extends ItemBlock { @Override public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - aList.add(TEC_MARK); + aList.add(TEC_MARK_EM); aList.add("Dense yet transparent"); aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Glassy & Classy"); } diff --git a/src/main/java/com/github/technus/tectech/thing/block/ReactorSimBlock.java b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimBlock.java new file mode 100644 index 0000000000..2b3d78cd49 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimBlock.java @@ -0,0 +1,90 @@ +package com.github.technus.tectech.thing.block; + +import com.github.technus.tectech.thing.tileEntity.ReactorSimTileEntity; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ic2.core.IC2; +import ic2.core.IHasGui; +import ic2.core.block.TileEntityBlock; +import net.minecraft.block.Block; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +import static com.github.technus.tectech.auxiliary.Reference.MODID; + +/** + * Created by danie_000 on 30.09.2017. + */ +public class ReactorSimBlock extends Block implements ITileEntityProvider { + public static ReactorSimBlock INSTANCE; + public static IIcon stuff; + + public ReactorSimBlock() { + super(Material.iron); + this.setBlockBounds(0, 0, 0, 1, 1, 1); + setBlockName("reactorSim"); + setHarvestLevel("wrench", 3); + setHardness(50); + setResistance(30); + setLightOpacity(0); + setStepSound(Block.soundTypeMetal); + setBlockTextureName(MODID + ":blockReactorSimulator"); + } + + @Override + public boolean isOpaqueCube() { + return true; + } + + @Override + public boolean getCanBlockGrass() { + return true; + } + + @Override + public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z) { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister p_149651_1_) { + super.registerBlockIcons(p_149651_1_); + stuff = this.blockIcon; + } + + public static void run() { + INSTANCE = new ReactorSimBlock(); + GameRegistry.registerBlock(INSTANCE, ReactorSimItem.class, INSTANCE.getUnlocalizedName()); + GameRegistry.registerTileEntity(ReactorSimTileEntity.class,MODID+"_reactorSim"); + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return new ReactorSimTileEntity(); + } + + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float a, float b, float c) { + if(entityPlayer.isSneaking()) { + return false; + } else { + TileEntity te = world.getTileEntity(x,y,z); + return te instanceof IHasGui && (!IC2.platform.isSimulating() || IC2.platform.launchGui(entityPlayer, (IHasGui) te)); + } + } + + public void onNeighborBlockChange(World world, int x, int y, int z, Block srcBlock) { + TileEntity te = world.getTileEntity(x,y,z); + if(te instanceof TileEntityBlock) { + ((TileEntityBlock)te).onNeighborUpdate(srcBlock); + } + + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java new file mode 100644 index 0000000000..c21820eea5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java @@ -0,0 +1,29 @@ +package com.github.technus.tectech.thing.block; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import java.util.List; + +import static com.github.technus.tectech.CommonValues.TEC_MARK_GENERAL; + +/** + * Created by danie_000 on 30.09.2017. + */ +public class ReactorSimItem extends ItemBlock { + public static QuantumGlassItem INSTANCE; + + public ReactorSimItem(Block b) { + super(b); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + aList.add(TEC_MARK_GENERAL); + aList.add("ReactorSimulator 9001"); + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Explodes, but not as much..."); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java index 0a6136c53b..88bbbca39d 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsTT.java @@ -8,7 +8,8 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; -import static com.github.technus.tectech.CommonValues.TEC_MARK; +import static com.github.technus.tectech.CommonValues.TEC_MARK_EM; +import static com.github.technus.tectech.CommonValues.TEC_MARK_GENERAL; /** * Created by danie_000 on 03.10.2016. @@ -20,7 +21,8 @@ public class GT_Item_CasingsTT extends GT_Item_Casings_Abstract { @Override public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - aList.add(TEC_MARK); + if(aStack.getItemDamage()>0 && aStack.getItemDamage()<15) aList.add(TEC_MARK_EM); + else aList.add(TEC_MARK_GENERAL); switch (aStack.getItemDamage()) { case 0://"High Power Casing" aList.add("Well suited for high power applications."); diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_HintTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_HintTT.java index 1ed610534d..77e0a4172e 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_HintTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_HintTT.java @@ -8,7 +8,7 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; -import static com.github.technus.tectech.CommonValues.TEC_MARK; +import static com.github.technus.tectech.CommonValues.TEC_MARK_GENERAL; /** * Created by danie_000 on 03.10.2016. @@ -20,7 +20,7 @@ public class GT_Item_HintTT extends GT_Item_Casings_Abstract { @Override public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - aList.add(TEC_MARK); + aList.add(TEC_MARK_GENERAL); aList.add("Helps while building"); switch (aStack.getItemDamage()) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: 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 c4beb63656..0b2101d145 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 @@ -64,7 +64,7 @@ public class ConstructableTriggerItem extends Item { } return true; }else if (aPlayer instanceof EntityClientPlayerMP){//particles and text client side - if ((!aPlayer.isSneaking() || !aPlayer.capabilities.isCreativeMode)) { + //if ((!aPlayer.isSneaking() || !aPlayer.capabilities.isCreativeMode)) { if(tTileEntity instanceof IGregTechTileEntity) { IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); if (metaTE instanceof IConstructable) { @@ -85,31 +85,31 @@ public class ConstructableTriggerItem extends Item { TecTech.proxy.printInchat(multiblockMap.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack.stackSize)); return false; } - } else { - if(tTileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof IConstructable) { - TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack.stackSize)); - return false; - } else if(multiblockMap.containsKey(metaTE.getClass().getCanonicalName())){ - TecTech.proxy.printInchat(multiblockMap.get(metaTE.getClass().getCanonicalName()).getDescription(aStack.stackSize)); - return false; - } - } else if(tTileEntity instanceof IConstructable){ - TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack.stackSize)); - return false; - } else if(multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())){ - TecTech.proxy.printInchat(multiblockMap.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack.stackSize)); - return false; - } - } + //} else { + // if(tTileEntity instanceof IGregTechTileEntity) { + // IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); + // if (metaTE instanceof IConstructable) { + // TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack.stackSize)); + // return false; + // } else if(multiblockMap.containsKey(metaTE.getClass().getCanonicalName())){ + // TecTech.proxy.printInchat(multiblockMap.get(metaTE.getClass().getCanonicalName()).getDescription(aStack.stackSize)); + // return false; + // } + // } else if(tTileEntity instanceof IConstructable){ + // TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack.stackSize)); + // return false; + // } else if(multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())){ + // TecTech.proxy.printInchat(multiblockMap.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack.stackSize)); + // return false; + // } + //} } return false; } @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { - aList.add(CommonValues.TEC_MARK); + aList.add(CommonValues.TEC_MARK_GENERAL); aList.add("Triggers Constructable Interface"); aList.add(EnumChatFormatting.BLUE + "Shows multiblock construction details,"); aList.add(EnumChatFormatting.BLUE + "just Use on a multiblock controller."); diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java index 91eae64419..89362c9469 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/DebugContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java @@ -1,9 +1,10 @@ package com.github.technus.tectech.thing.item; import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; -import com.github.technus.tectech.elementalMatter.classes.tElementalException; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalInstanceContainer; +import com.github.technus.tectech.Util; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.core.interfaces.iElementalInstanceContainer; +import com.github.technus.tectech.elementalMatter.core.tElementalException; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -26,10 +27,10 @@ import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; /** * Created by Tec on 15.03.2017. */ -public class DebugContainer_EM extends Item { - public static DebugContainer_EM INSTANCE; +public class DebugElementalInstanceContainer_EM extends Item { + public static DebugElementalInstanceContainer_EM INSTANCE; - private DebugContainer_EM() { + private DebugElementalInstanceContainer_EM() { super(); setMaxStackSize(1); setUnlocalizedName("em.debugContainer"); @@ -71,12 +72,12 @@ public class DebugContainer_EM extends Item { @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { - aList.add(CommonValues.TEC_MARK); + aList.add(CommonValues.TEC_MARK_EM); try { NBTTagCompound tNBT = aStack.getTagCompound(); if (tNBT != null && tNBT.hasKey("info")) { aList.add("Contains:"); - Collections.addAll(aList, cElementalInstanceStackMap.infoFromNBT(tNBT.getCompoundTag("info"))); + Collections.addAll(aList, Util.infoFromNBT(tNBT.getCompoundTag("info"))); } else { aList.add("Container for elemental matter"); aList.add(EnumChatFormatting.BLUE + "Right click on elemental hatches"); @@ -87,7 +88,7 @@ public class DebugContainer_EM extends Item { } public static void run() { - INSTANCE = new DebugContainer_EM(); + INSTANCE = new DebugElementalInstanceContainer_EM(); GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); } diff --git a/src/main/java/com/github/technus/tectech/thing/item/DefinitionContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java index 53fcb764a0..931a0a94cc 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/DefinitionContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.item; import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStackMap; -import com.github.technus.tectech.elementalMatter.classes.tElementalException; +import com.github.technus.tectech.Util; +import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; +import com.github.technus.tectech.elementalMatter.core.tElementalException; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -19,10 +20,10 @@ import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; /** * Created by Tec on 15.03.2017. */ -public class DefinitionContainer_EM extends Item { - public static DefinitionContainer_EM INSTANCE; +public class ElementalDefinitionContainer_EM extends Item { + public static ElementalDefinitionContainer_EM INSTANCE; - private DefinitionContainer_EM() { + private ElementalDefinitionContainer_EM() { super(); setMaxStackSize(1); setUnlocalizedName("em.definitionContainer"); @@ -31,7 +32,7 @@ public class DefinitionContainer_EM extends Item { //return previous thing public static cElementalDefinitionStackMap setContent(ItemStack containerItem, cElementalDefinitionStackMap definitions){ - if(containerItem.getItem() instanceof DefinitionContainer_EM) { + if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM) { NBTTagCompound tNBT = containerItem.stackTagCompound; if (tNBT == null) tNBT=containerItem.stackTagCompound=new NBTTagCompound(); @@ -51,7 +52,7 @@ public class DefinitionContainer_EM extends Item { } public static cElementalDefinitionStackMap getContent(ItemStack containerItem){ - if(containerItem.getItem() instanceof DefinitionContainer_EM){ + if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM){ NBTTagCompound tNBT = containerItem.stackTagCompound; if (tNBT == null || !tNBT.hasKey("content")) return null; @@ -65,7 +66,7 @@ public class DefinitionContainer_EM extends Item { } public static cElementalDefinitionStackMap clearContent(ItemStack containerItem){ - if(containerItem.getItem() instanceof DefinitionContainer_EM){ + if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM){ NBTTagCompound tNBT = containerItem.stackTagCompound; if (tNBT == null) return null; @@ -86,12 +87,12 @@ public class DefinitionContainer_EM extends Item { @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { - aList.add(CommonValues.TEC_MARK); + aList.add(CommonValues.TEC_MARK_EM); try { NBTTagCompound tNBT = aStack.getTagCompound(); if (tNBT != null && tNBT.hasKey("info")) { aList.add("Should Contain:"); - Collections.addAll(aList, cElementalDefinitionStackMap.infoFromNBT(tNBT.getCompoundTag("info"))); + Collections.addAll(aList, Util.infoFromNBT(tNBT.getCompoundTag("info"))); } else { aList.add("Recipe Hint"); } @@ -101,7 +102,7 @@ public class DefinitionContainer_EM extends Item { } public static void run() { - INSTANCE = new DefinitionContainer_EM(); + INSTANCE = new ElementalDefinitionContainer_EM(); GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); } 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 new file mode 100644 index 0000000000..b650e4a564 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java @@ -0,0 +1,95 @@ +package com.github.technus.tectech.thing.item; + +import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.Util; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.IIcon; + +import java.util.Collections; +import java.util.List; + +import static com.github.technus.tectech.auxiliary.Reference.MODID; +import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; + +/** + * Created by Tec on 15.03.2017. + */ +public class ElementalDefinitionScanStorage_EM extends Item { + public static ElementalDefinitionScanStorage_EM INSTANCE; + public static IIcon offline, online; + + private ElementalDefinitionScanStorage_EM() { + super(); + setMaxStackSize(1); + setUnlocalizedName("em.definitionScanStorage"); + setTextureName(MODID + ":itemDefinitionScanStorage"); + } + + //return previous thing + public static void setContent(ItemStack containerItem, cElementalInstanceStackMap definitions, int[] detailsOnDepthLevels){ + if(containerItem.getItem() instanceof ElementalDefinitionScanStorage_EM) { + if (containerItem.stackTagCompound == null) containerItem.stackTagCompound=new NBTTagCompound(); + containerItem.stackTagCompound.setTag("elementalInfo", definitions.getScanInfoNBT(detailsOnDepthLevels)); + } + } + + public static void clearContent(ItemStack containerItem){ + if(containerItem.getItem() instanceof ElementalDefinitionScanStorage_EM){ + if (containerItem.stackTagCompound == null) return; + containerItem.stackTagCompound=null; + return; + } + return; + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { + aList.add(CommonValues.TEC_MARK_EM); + try { + if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("elementalInfo")) { + aList.add("Contains scan result"); + if(DEBUG_MODE) + Collections.addAll(aList, Util.infoFromNBT(aStack.stackTagCompound.getCompoundTag("elementalInfo"))); + } else { + aList.add("Storage for matter scan data"); + } + } catch (Exception e) { + aList.add("---Unexpected Termination---"); + } + } + + public static void run() { + INSTANCE = new ElementalDefinitionScanStorage_EM(); + GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { + offline =iconRegister.registerIcon(MODID + ":itemDefinitionScanStorageOff"); + online =this.itemIcon = iconRegister.registerIcon(this.getIconString()); + } + + @Override + public IIcon getIconIndex(ItemStack itemStack) { + NBTTagCompound tagCompound=itemStack.stackTagCompound; + if(tagCompound!=null && tagCompound.hasKey("elementalInfo")) + return online; + return offline; + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + ItemStack that = new ItemStack(this, 1); + list.add(that); + } +} 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 af733ac296..ce6d23ddbd 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 @@ -1,6 +1,7 @@ package com.github.technus.tectech.thing.item; import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.Util; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; @@ -51,20 +52,20 @@ public class ParametrizerMemoryCard extends Item { NBTTagCompound tNBT=aStack.getTagCompound(); if (aStack.getItemDamage()==1) { //write to parametrizer - parametrizer.exponent = tNBT.getInteger("exponent"); - parametrizer.value2 = tNBT.getInteger("value2"); - parametrizer.value1 = tNBT.getInteger("value1"); parametrizer.param = tNBT.getInteger("param"); - parametrizer.value1f = tNBT.getFloat("value1f"); - parametrizer.value2f = tNBT.getFloat("value2f"); + if(parametrizer.setUsingFloats(tNBT.getBoolean("usesFloats"))) { + parametrizer.value0i = (int)Float.intBitsToFloat(tNBT.getInteger("value0i")); + parametrizer.value1i = (int)Float.intBitsToFloat(tNBT.getInteger("value1i")); + }else{ + parametrizer.value0i = tNBT.getInteger("value0i"); + parametrizer.value1i = tNBT.getInteger("value1i"); + } } else { //read from parametrizer - tNBT.setInteger("exponent", parametrizer.exponent); - tNBT.setInteger("value2", parametrizer.value2); - tNBT.setInteger("value1", parametrizer.value1); tNBT.setInteger("param", parametrizer.param); - tNBT.setFloat("value1f", parametrizer.value1f); - tNBT.setFloat("value2f", parametrizer.value2f); + tNBT.setBoolean("usesFloats", parametrizer.isUsingFloats()); + tNBT.setInteger("value0i", parametrizer.value0i); + tNBT.setInteger("value1i", parametrizer.value1i); } return true; } @@ -100,13 +101,18 @@ public class ParametrizerMemoryCard extends Item { } aList.add(EnumChatFormatting.BLUE + "Sneak right click to lock/unlock"); + int temp; if(tNBT!=null && tNBT.hasKey("param")) { aList.add("Hatch ID: "+EnumChatFormatting.AQUA + tNBT.getInteger("param")); - aList.add("Value 0: "+EnumChatFormatting.AQUA + tNBT.getFloat("value1f")); - aList.add("Value 1: "+EnumChatFormatting.AQUA + tNBT.getFloat("value2f")); - aList.add("Mantissa 0: "+EnumChatFormatting.AQUA + tNBT.getInteger("value1")); - aList.add("Mantissa 1: "+EnumChatFormatting.AQUA + tNBT.getInteger("value2")); - aList.add("Exponent: "+EnumChatFormatting.AQUA + tNBT.getInteger("exponent")); + temp=tNBT.getInteger("value0i"); + aList.add("Value 0|I: "+EnumChatFormatting.AQUA + temp); + aList.add("Value 0|F: "+EnumChatFormatting.AQUA + Float.intBitsToFloat(temp)); + aList.add("Value 0|B: "+EnumChatFormatting.AQUA + Util.intBitsToShortString(temp)); + temp=tNBT.getInteger("value1i"); + aList.add("Value 1|I: "+EnumChatFormatting.AQUA + temp); + aList.add("Value 1|F: "+EnumChatFormatting.AQUA + Float.intBitsToFloat(temp)); + aList.add("Value 1|B: "+EnumChatFormatting.AQUA + Util.intBitsToShortString(temp)); + aList.add("Uses Floats: "+(tNBT.getBoolean("usesFloats")?EnumChatFormatting.GREEN+"TRUE":EnumChatFormatting.RED+"FALSE")); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java index 3eb0253b7f..8cfc075b31 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DataConnector.java @@ -153,7 +153,7 @@ public abstract class GT_MetaTileEntity_Hatch_DataConnector extends GT_MetaTileE @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, mDescription, "High speed fibre optics connector.", EnumChatFormatting.AQUA + "Must be painted to work" diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java index 6eb3b42f8a..78d278e463 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoMulti.java @@ -123,7 +123,7 @@ public class GT_MetaTileEntity_Hatch_DynamoMulti extends GT_MetaTileEntity_Hatch @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_GENERAL, mDescription //"Amperes Out: "+ EnumChatFormatting.AQUA+Amperes+" A" }; 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 c1efa781ab..a469872047 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 @@ -2,9 +2,9 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; -import com.github.technus.tectech.elementalMatter.classes.tElementalException; -import com.github.technus.tectech.elementalMatter.interfaces.iElementalInstanceContainer; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.core.interfaces.iElementalInstanceContainer; +import com.github.technus.tectech.elementalMatter.core.tElementalException; import com.github.technus.tectech.thing.metaTileEntity.pipe.iConnectsToEMpipe; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -108,7 +108,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta byte Tick = (byte) (aTick % 20); if (DECAY_AT == Tick) { purgeOverflow(); - content.tickContent(postEnergize);//Hatches don't life time mult things + content.tickContentByOneSecond(1,postEnergize);//Hatches don't life time mult things purgeOverflow(); } else if (OVERFLOW_AT == Tick) { if (overflowMatter <= 0) { @@ -245,7 +245,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, mDescription, "Max stacks amount: " + EnumChatFormatting.AQUA + getMaxStacksCount(), "Stack capacity: " + EnumChatFormatting.AQUA + getMaxStackSize(), diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java index 9053f24445..7610cd8242 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyMulti.java @@ -124,7 +124,7 @@ public class GT_MetaTileEntity_Hatch_EnergyMulti extends GT_MetaTileEntity_Hatch @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_GENERAL, mDescription, "Amperes In: " + EnumChatFormatting.AQUA + maxAmperesIn() + " A" }; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java index 93ec7cc899..45bd08fbca 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Holder.java @@ -115,7 +115,7 @@ public class GT_MetaTileEntity_Hatch_Holder extends GT_MetaTileEntity_Hatch { @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, mDescription, EnumChatFormatting.AQUA + "Advanced Holding Mechanism!" }; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java index 9cfebb76c1..1a9a811538 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java @@ -24,9 +24,9 @@ import net.minecraft.world.EnumSkyBlock; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.CommonValues.DISPERSE_AT; +import static com.github.technus.tectech.Util.V; import static com.github.technus.tectech.loader.MainLoader.elementalPollution; import static gregtech.api.enums.Dyes.MACHINE_METAL; -import static com.github.technus.tectech.Util.V; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; /** @@ -89,7 +89,7 @@ public class GT_MetaTileEntity_Hatch_MufflerElemental extends GT_MetaTileEntity_ @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, mDescription, "Mass capacity: " + EnumChatFormatting.AQUA + String.format(java.util.Locale.ENGLISH, "%+.2E", overflowMax) + " eV/c^2", "Disposal Speed: " + EnumChatFormatting.AQUA + String.format(java.util.Locale.ENGLISH, "%+.2E", overflowDisperse) + " (eV/c^2)/s", diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java index 0f37acdc42..6f79722ea6 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java @@ -1,8 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.Util; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Param; +import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_ParamAdv; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Param; +import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_ParamAdv; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -23,14 +26,13 @@ import net.minecraftforge.fluids.FluidStack; * Created by danie_000 on 15.12.2016. */ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { - public int exponent = 0; - public int value2 = 0; - public int value1 = 0; + private boolean usesFloat = false; + public int pointer = 0; public int param = -1; - public float value1f = 0; - public float value2f = 0; - public float input1f = 0; - public float input2f = 0; + public int value0i = 0; + public int value1i = 0; + public int input0i = 0; + public int input1i = 0; private static Textures.BlockIcons.CustomIcon ScreenON; private static Textures.BlockIcons.CustomIcon ScreenOFF; @@ -52,11 +54,13 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + if (mTier >= 10) return new GT_Container_ParamAdv(aPlayerInventory, aBaseMetaTileEntity); return new GT_Container_Param(aPlayerInventory, aBaseMetaTileEntity); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + if (mTier >= 10) return new GT_GUIContainer_ParamAdv(aPlayerInventory, aBaseMetaTileEntity); return new GT_GUIContainer_Param(aPlayerInventory, aBaseMetaTileEntity); } @@ -96,12 +100,24 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { @Override public String[] getInfoData() { + if(mTier>=10) + return new String[]{ + "Parametrizer ID: " + EnumChatFormatting.GREEN + param, + "Value 0I: " + EnumChatFormatting.AQUA + value0i, + "Value 0FB: " + EnumChatFormatting.AQUA + Float.intBitsToFloat(value0i)+" "+ Util.intBitsToShortString(value0i), + "Value 1I: " + EnumChatFormatting.BLUE + value1i, + "Value 1FB: " + EnumChatFormatting.BLUE + Float.intBitsToFloat(value1i)+" "+ Util.intBitsToShortString(value1i), + "Input 0I: " + EnumChatFormatting.GOLD + input0i, + "Input 0FB: " + EnumChatFormatting.GOLD + Float.intBitsToFloat(input0i)+" "+ Util.intBitsToShortString(input0i), + "Input 1I: " + EnumChatFormatting.YELLOW + input1i, + "Input 1FB: " + EnumChatFormatting.YELLOW + Float.intBitsToFloat(input1i)+" "+ Util.intBitsToShortString(input1i), + }; return new String[]{ - "Parameter ID: " + EnumChatFormatting.GREEN + param, - "Value 1: " + EnumChatFormatting.AQUA + value1f, - "Value 2: " + EnumChatFormatting.BLUE + value2f, - "Input 1: " + EnumChatFormatting.GOLD + input1f, - "Input 2: " + EnumChatFormatting.YELLOW + input2f + "Parametrizer ID: " + EnumChatFormatting.GREEN + param, + "Value 0I: " + EnumChatFormatting.AQUA + value0i, + "Value 1I: " + EnumChatFormatting.BLUE + value1i, + "Input 0I: " + EnumChatFormatting.GOLD + input0i, + "Input 1I: " + EnumChatFormatting.YELLOW + input1i, }; } @@ -122,24 +138,24 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - aNBT.setInteger("mEXP", exponent); - aNBT.setInteger("mV2", value2); - aNBT.setInteger("mV1", value1); - aNBT.setInteger("mParam", param); - //aNBT.setFloat("mI1",input1f);//no need to store this. - //aNBT.setFloat("mI2",input2f); + aNBT.setBoolean("eFloats", usesFloat); + aNBT.setInteger("ePointer", pointer); + aNBT.setInteger("eValue0i", value0i); + aNBT.setInteger("eValue1i", value1i); + aNBT.setInteger("eInput0i", value0i); + aNBT.setInteger("eInput1i", value1i); + aNBT.setInteger("eParam", param); } public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - exponent = aNBT.getInteger("mEXP"); - value2 = aNBT.getInteger("mV2"); - value1 = aNBT.getInteger("mV1"); - param = aNBT.getInteger("mParam"); - value1f = (float) (value1 * Math.pow(2, exponent)); - value2f = (float) (value2 * Math.pow(2, exponent)); - //input1f=aNBT.getFloat("mI1"); - //input2f=aNBT.getFloat("mI2"); + usesFloat = aNBT.getBoolean("eFloats"); + pointer = aNBT.getInteger("ePointer"); + value0i=aNBT.getInteger("eValue0i"); + value1i=aNBT.getInteger("eValue1i"); + value0i=aNBT.getInteger("eInput0i"); + value1i=aNBT.getInteger("eInput1i"); + param = aNBT.getInteger("eParam"); } @Override @@ -177,9 +193,22 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_GENERAL, mDescription, - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "E=M*C^2" + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "E=mine*craft^2" }; } + + public boolean isUsingFloats() { + return mTier >= 10 && usesFloat; + } + + //returns - succeded + public boolean setUsingFloats(boolean value){ + if(mTier>=10){ + usesFloat=value; + return true; + } + return !value; + } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java index 4a4e27b872..6b4c6cb3ec 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java @@ -221,7 +221,7 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, mDescription, EnumChatFormatting.AQUA + "Holds Computer Components" }; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java index 44d72cfaee..81f05fad7c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java @@ -171,7 +171,7 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, mDescription, EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Schrödinger equation in a box" }; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java index ef0b9ddfb1..3a6d4b74fa 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java @@ -15,16 +15,11 @@ import net.minecraft.item.ItemStack; import java.util.Iterator; public class GT_Container_Param extends GT_ContainerMetaTile_Machine { - public int exponent = 0; - public int value2 = 0; - public int value1 = 0; public int param = 0; - public float value2f = 0; - public float value1f = 0; - public float input1f = 0; - private int input1Bits = 0; - public float input2f = 0; - private int input2Bits = 0; + public int value0f = 0; + public int value1f = 0; + public int input0f = 0; + public int input1f = 0; public GT_Container_Param(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { super(aInventoryPlayer, aTileEntity); @@ -64,61 +59,63 @@ public class GT_Container_Param extends GT_ContainerMetaTile_Machine { GT_MetaTileEntity_Hatch_Param paramH = (GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity(); switch (aSlotIndex) { case 0: - paramH.param -= (aShifthold == 1 ? 512 : 64); + paramH.param -= (aShifthold == 1 ? 16 : 4); break; case 1: - paramH.value1 -= (aShifthold == 1 ? 512 : 64); + paramH.value0i -= (aShifthold == 1 ? 4096 : 256); break; case 2: - paramH.value2 -= (aShifthold == 1 ? 512 : 64); + paramH.value1i -= (aShifthold == 1 ? 4096 : 256); break; case 3: - paramH.exponent -= (aShifthold == 1 ? 16 : 8); + paramH.value0i >>= aShifthold == 1 ? 16 : 4; + paramH.value1i >>= aShifthold == 1 ? 16 : 4; break; case 4: - paramH.param -= (aShifthold == 1 ? 16 : 1); + paramH.param -= (aShifthold == 1 ? 2 : 1); break; case 5: - paramH.value1 -= (aShifthold == 1 ? 16 : 1); + paramH.value0i -= (aShifthold == 1 ? 16 : 1); break; case 6: - paramH.value2 -= (aShifthold == 1 ? 16 : 1); + paramH.value1i -= (aShifthold == 1 ? 16 : 1); break; case 7: - paramH.exponent -= (aShifthold == 1 ? 4 : 1); + paramH.value0i >>= aShifthold == 1 ? 2 : 1; + paramH.value1i >>= aShifthold == 1 ? 2 : 1; break; case 8: - paramH.param += (aShifthold == 1 ? 512 : 64); + paramH.param += (aShifthold == 1 ? 16 : 4); break; case 9: - paramH.value1 += (aShifthold == 1 ? 512 : 64); + paramH.value0i += (aShifthold == 1 ? 4096 : 256); break; case 10: - paramH.value2 += (aShifthold == 1 ? 512 : 64); + paramH.value1i += (aShifthold == 1 ? 4096 : 256); break; case 11: - paramH.exponent += (aShifthold == 1 ? 16 : 8); + paramH.value0i <<= aShifthold == 1 ? 16 : 4; + paramH.value1i <<= aShifthold == 1 ? 16 : 4; break; case 12: - paramH.param += (aShifthold == 1 ? 16 : 1); + paramH.param += (aShifthold == 1 ? 2 : 1); break; case 13: - paramH.value1 += (aShifthold == 1 ? 16 : 1); + paramH.value0i += (aShifthold == 1 ? 16 : 1); break; case 14: - paramH.value2 += (aShifthold == 1 ? 16 : 1); + paramH.value1i += (aShifthold == 1 ? 16 : 1); break; case 15: - paramH.exponent += (aShifthold == 1 ? 4 : 1); + paramH.value0i <<= aShifthold == 1 ? 2 : 1; + paramH.value1i <<= aShifthold == 1 ? 2 : 1; break; default: doStuff = false; } if (doStuff) { if (paramH.param > 9) paramH.param = 9; - if (paramH.param < -1) paramH.param = -1; - paramH.value1f = (float) (paramH.value1 * Math.pow(2, paramH.exponent)); - paramH.value2f = (float) (paramH.value2 * Math.pow(2, paramH.exponent)); + else if (paramH.param < -1) paramH.param = -1; } } return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); @@ -131,27 +128,24 @@ public class GT_Container_Param extends GT_ContainerMetaTile_Machine { return; } this.param = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).param; - this.value1 = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).value1; - this.value2 = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).value2; - this.exponent = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).exponent; - this.input1Bits = Float.floatToIntBits(((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).input1f); - this.input2Bits = Float.floatToIntBits(((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).input2f); + this.value0f = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).value0i; + this.value1f = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).value1i; + this.input0f = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).input0i; + this.input1f = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).input1i; Iterator var2 = this.crafters.iterator(); while (var2.hasNext()) { ICrafting var1 = (ICrafting) var2.next(); var1.sendProgressBarUpdate(this, 100, this.param & 0xFFFF); var1.sendProgressBarUpdate(this, 101, this.param >>> 16); - var1.sendProgressBarUpdate(this, 102, this.value1 & 0xFFFF); - var1.sendProgressBarUpdate(this, 103, this.value1 >>> 16); - var1.sendProgressBarUpdate(this, 104, this.value2 & 0xFFFF); - var1.sendProgressBarUpdate(this, 105, this.value2 >>> 16); - var1.sendProgressBarUpdate(this, 106, this.exponent & 0xFFFF); - var1.sendProgressBarUpdate(this, 107, this.exponent >>> 16); - var1.sendProgressBarUpdate(this, 108, this.input1Bits & 0xFFFF); - var1.sendProgressBarUpdate(this, 109, this.input1Bits >>> 16); - var1.sendProgressBarUpdate(this, 110, this.input2Bits & 0xFFFF); - var1.sendProgressBarUpdate(this, 111, this.input2Bits >>> 16); + var1.sendProgressBarUpdate(this, 102, this.value0f & 0xFFFF); + var1.sendProgressBarUpdate(this, 103, this.value0f >>> 16); + var1.sendProgressBarUpdate(this, 104, this.value1f & 0xFFFF); + var1.sendProgressBarUpdate(this, 105, this.value1f >>> 16); + var1.sendProgressBarUpdate(this, 106, this.input0f & 0xFFFF); + var1.sendProgressBarUpdate(this, 107, this.input0f >>> 16); + var1.sendProgressBarUpdate(this, 108, this.input1f & 0xFFFF); + var1.sendProgressBarUpdate(this, 109, this.input1f >>> 16); } } @@ -163,46 +157,33 @@ public class GT_Container_Param extends GT_ContainerMetaTile_Machine { this.param = (this.param & 0xFFFF0000 | par2); return; case 101: - this.param = (this.param & 0xFFFF | par2 << 16); + this.param = (this.param & 0xFFFF | (par2 << 16)); return; case 102: - this.value1 = (this.value1 & 0xFFFF0000 | par2); + this.value0f = (this.value0f & 0xFFFF0000 | par2); break; case 103: - this.value1 = (this.value1 & 0xFFFF | par2 << 16); + this.value0f = (this.value0f & 0xFFFF | (par2 << 16)); break; case 104: - this.value2 = (this.value2 & 0xFFFF0000 | par2); + this.value1f = (this.value1f & 0xFFFF0000 | par2); break; case 105: - this.value2 = (this.value2 & 0xFFFF | par2 << 16); + this.value1f = (this.value1f & 0xFFFF | (par2 << 16)); break; case 106: - this.exponent = (this.exponent & 0xFFFF0000 | par2); + this.input0f = (this.input0f & 0xFFFF0000 | par2); break; case 107: - this.exponent = (this.exponent & 0xFFFF | par2 << 16); + this.input0f = (this.input0f & 0xFFFF | (par2 << 16)); break; case 108: - this.input1Bits = (this.input1Bits & 0xFFFF0000 | par2); - this.input1f = Float.intBitsToFloat(input1Bits); + this.input1f = (this.input1f & 0xFFFF0000 | par2); return; case 109: - this.input1Bits = (this.input1Bits & 0xFFFF | par2 << 16); - this.input1f = Float.intBitsToFloat(input1Bits); - return; - case 110: - this.input2Bits = (this.input2Bits & 0xFFFF0000 | par2); - this.input2f = Float.intBitsToFloat(input2Bits); - return; - case 111: - this.input2Bits = (this.input2Bits & 0xFFFF | par2 << 16); - this.input2f = Float.intBitsToFloat(input2Bits); + this.input1f = (this.input1f & 0xFFFF | (par2 << 16)); return; default: - return; } - this.value1f = (float) (this.value1 * Math.pow(2, this.exponent)); - this.value2f = (float) (this.value2 * Math.pow(2, this.exponent)); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java new file mode 100644 index 0000000000..2c4670e52f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java @@ -0,0 +1,226 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; + +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import java.util.Iterator; + +public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { + public boolean usesFloats = false; + public int pointer=0; + public int param = 0; + public int value1f = 0; + public int value0f = 0; + public int input0f = 0; + public int input1f = 0; + + public GT_Container_ParamAdv(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + @Override + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 59, false, false, 1)); + + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 59, false, false, 1)); + + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 59, false, false, 1)); + + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 59, false, false, 1)); + } + + @Override + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (aSlotIndex < 0) { + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); + boolean doStuff = true; + if ((tSlot != null) && (this.mTileEntity.getMetaTileEntity() != null)) { + GT_MetaTileEntity_Hatch_Param paramH = (GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity(); + int columnPointer=paramH.pointer &0xff; + boolean secondRow=(paramH.pointer &0x0100)!=0; + boolean showInts=!paramH.isUsingFloats(); + switch (aSlotIndex) { + case 0: + paramH.param -= (aShifthold == 1 ? 16 : 4); + break; + case 1: + if (secondRow) secondRow = false; + else columnPointer -= (aShifthold == 1 ? 16 : 4); + break; + case 2: + if (secondRow) columnPointer -= (aShifthold == 1 ? 16 : 4); + else secondRow = true; + break; + case 3: + if (aShifthold == 1) { + if (secondRow) paramH.value1i = 0xFFFFFFFF; + else paramH.value0i = 0xFFFFFFFF; + } else { + if (secondRow) paramH.value1i |= 1 << columnPointer; + else paramH.value0i |= 1 << columnPointer; + } + break; + case 4: + paramH.param -= (aShifthold == 1 ? 2 : 1); + break; + case 5: + if (secondRow) secondRow = false; + else columnPointer -= (aShifthold == 1 ? 2 : 1); + break; + case 6: + if (secondRow) columnPointer -= (aShifthold == 1 ? 2 : 1); + else secondRow = true; + break; + case 7: + if (aShifthold == 1) { + if (secondRow) paramH.value1i = 0; + else paramH.value0i = 0; + } else { + if (secondRow) paramH.value1i &= ~(1 << columnPointer); + else paramH.value0i &= ~(1 << columnPointer); + } + break; + case 8: + paramH.param += (aShifthold == 1 ? 16 : 4); + break; + case 9: + if (secondRow) secondRow = false; + else columnPointer += (aShifthold == 1 ? 16 : 4); + break; + case 10: + if (secondRow) columnPointer += (aShifthold == 1 ? 16 : 4); + else secondRow = true; + break; + case 11: + showInts ^= true; + break; + case 12: + paramH.param += (aShifthold == 1 ? 2 : 1); + break; + case 13: + if (secondRow) secondRow = false; + else columnPointer += (aShifthold == 1 ? 2 : 1); + break; + case 14: + if (secondRow) columnPointer += (aShifthold == 1 ? 2 : 1); + else secondRow = true; + break; + case 15: + if (aShifthold == 1) { + if (secondRow) paramH.value1i ^= 0xFFFFFFFF; + else paramH.value0i ^= 0xFFFFFFFF; + } else { + if (secondRow) paramH.value1i ^= 1 << columnPointer; + else paramH.value0i ^= 1 << columnPointer; + } + break; + default: + doStuff = false; + } + if (doStuff) { + if(columnPointer>=32) columnPointer=31; + else if(columnPointer<0) columnPointer=0; + paramH.pointer=secondRow?columnPointer+0x100:columnPointer; + paramH.setUsingFloats(!showInts); + if (paramH.param > 9) paramH.param = 9; + else if (paramH.param < -1) paramH.param = -1; + } + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { + return; + } + this.param = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).param; + this.value0f = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).value0i; + this.value1f = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).value1i; + this.input0f = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).input0i; + this.input1f = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).input1i; + this.pointer = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).pointer; + this.usesFloats =((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).isUsingFloats(); + + Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) { + ICrafting var1 = (ICrafting) var2.next(); + var1.sendProgressBarUpdate(this, 100, this.param & 0xFFFF); + var1.sendProgressBarUpdate(this, 101, this.param >>> 16); + var1.sendProgressBarUpdate(this, 102, this.value0f & 0xFFFF); + var1.sendProgressBarUpdate(this, 103, this.value0f >>> 16); + var1.sendProgressBarUpdate(this, 104, this.value1f & 0xFFFF); + var1.sendProgressBarUpdate(this, 105, this.value1f >>> 16); + var1.sendProgressBarUpdate(this, 106, this.input0f & 0xFFFF); + var1.sendProgressBarUpdate(this, 107, this.input0f >>> 16); + var1.sendProgressBarUpdate(this, 108, this.input1f & 0xFFFF); + var1.sendProgressBarUpdate(this, 109, this.input1f >>> 16); + var1.sendProgressBarUpdate(this, 110, this.usesFloats?this.pointer+0x10000:this.pointer); + } + } + + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 100: + this.param = (this.param & 0xFFFF0000 | par2); + return; + case 101: + this.param = (this.param & 0xFFFF | (par2 << 16)); + return; + case 102: + this.value0f = (this.value0f & 0xFFFF0000 | par2); + break; + case 103: + this.value0f = (this.value0f & 0xFFFF | (par2 << 16)); + break; + case 104: + this.value1f = (this.value1f & 0xFFFF0000 | par2); + break; + case 105: + this.value1f = (this.value1f & 0xFFFF | (par2 << 16)); + break; + case 106: + this.input0f = (this.input0f & 0xFFFF0000 | par2); + break; + case 107: + this.input0f = (this.input0f & 0xFFFF | (par2 << 16)); + break; + case 108: + this.input1f = (this.input1f & 0xFFFF0000 | par2); + return; + case 109: + this.input1f = (this.input1f & 0xFFFF | (par2 << 16)); + return; + case 110: + this.pointer = par2 & 0xFFFF; + this.usesFloats=par2>=0x10000; + default: + } + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java index d883cb3332..4a7d25c95a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java @@ -1,9 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; +import com.github.technus.tectech.Util; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; +import java.util.Locale; + import static com.github.technus.tectech.TecTech.proxy; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; @@ -14,16 +17,16 @@ public class GT_GUIContainer_Param extends GT_GUIContainerMetaTile_Machine { protected void drawGuiContainerForegroundLayer(int par1, int par2) { if (this.mContainer != null) { - proxy.renderUnicodeString("Parametrizer: " + ((GT_Container_Param) this.mContainer).param, 46, 7, 167, 0xffffff); - proxy.renderUnicodeString("\u24EA\u2b07" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).input1f), 46, 16, 167, 0x22ddff); - proxy.renderUnicodeString("\u2460\u2b07" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).input2f), 46, 24, 167, 0x00ffff); - proxy.renderUnicodeString("\u24EA\u2b06" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).value1f), 46, 33, 167, 0x00bbff); - proxy.renderUnicodeString("\u2460\u2b06" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).value2f), 46, 41, 167, 0x0077ff); - proxy.renderUnicodeString("M\u24EA: " + ((GT_Container_Param) this.mContainer).value1, 46, 50, 167, 0x00bbff); - proxy.renderUnicodeString("M\u2460: " + ((GT_Container_Param) this.mContainer).value2, 46, 58, 167, 0x0077ff); - proxy.renderUnicodeString("E\u24EA\u2460: " + ((GT_Container_Param) this.mContainer).exponent, 46, 66, 167, 0x0033ff); + proxy.renderUnicodeString("Parameters: " + ((GT_Container_Param) this.mContainer).param, 46, 7, 167, 0xffffff); + Locale locale=java.util.Locale.getDefault(); + proxy.renderUnicodeString("\u24EA\u2b07" + String.format(locale, "%+d", ((GT_Container_Param) this.mContainer).input0f), 46, 16, 167, 0x22ddff); + proxy.renderUnicodeString("\u2460\u2b07" + String.format(locale, "%+d", ((GT_Container_Param) this.mContainer).input1f), 46, 24, 167, 0x00ffff); + proxy.renderUnicodeString("\u24EA\u2b06" + String.format(locale, "%+d", ((GT_Container_Param) this.mContainer).value0f), 46, 33, 167, 0x00bbff); + proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+d", ((GT_Container_Param) this.mContainer).value1f), 46, 41, 167, 0x0077ff); + proxy.renderUnicodeString("\u24EA\u2b06" + Util.intBitsToShortString(((GT_Container_Param) this.mContainer).value0f), 46, 50, 167, 0x00bbff); + proxy.renderUnicodeString("\u2460\u2b06" + Util.intBitsToShortString(((GT_Container_Param) this.mContainer).value1f), 46, 58, 167, 0x0077ff); } else { - proxy.renderUnicodeString("Parametrizer", 46, 7, 167, 0xffffff); + proxy.renderUnicodeString("Parameters", 46, 7, 167, 0xffffff); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java new file mode 100644 index 0000000000..8e34664919 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java @@ -0,0 +1,47 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; + +import com.github.technus.tectech.Util; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; + +import java.util.Locale; + +import static com.github.technus.tectech.TecTech.proxy; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + +public class GT_GUIContainer_ParamAdv extends GT_GUIContainerMetaTile_Machine { + public GT_GUIContainer_ParamAdv(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(new GT_Container_ParamAdv(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "ParametrizerAdv.png"); + } + + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + if (this.mContainer != null) { + proxy.renderUnicodeString("Parameters X: " + ((GT_Container_ParamAdv) this.mContainer).param, 46, 7, 167, 0xffffff); + Locale locale=java.util.Locale.getDefault(); + if (((GT_Container_ParamAdv) this.mContainer).usesFloats) { + proxy.renderUnicodeString("\u24EA\u2b07" + String.format(locale, "%+.5E", Float.intBitsToFloat(((GT_Container_ParamAdv) this.mContainer).input0f)), 46, 16, 167, 0x22ddff); + proxy.renderUnicodeString("\u2460\u2b07" + String.format(locale, "%+.5E", Float.intBitsToFloat(((GT_Container_ParamAdv) this.mContainer).input1f)), 46, 24, 167, 0x00ffff); + proxy.renderUnicodeString("\u24EA\u2b06" + String.format(locale, "%+.5E", Float.intBitsToFloat(((GT_Container_ParamAdv) this.mContainer).value0f)), 46, 33, 167, 0x00bbff); + proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+.5E", Float.intBitsToFloat(((GT_Container_ParamAdv) this.mContainer).value1f)), 46, 41, 167, 0x0077ff); + } else { + proxy.renderUnicodeString("\u24EA\u2b07" + String.format(locale, "%+d", ((GT_Container_ParamAdv) this.mContainer).input0f), 46, 16, 167, 0x22ddff); + proxy.renderUnicodeString("\u2460\u2b07" + String.format(locale, "%+d", ((GT_Container_ParamAdv) this.mContainer).input1f), 46, 24, 167, 0x00ffff); + proxy.renderUnicodeString("\u24EA\u2b06" + String.format(locale, "%+d", ((GT_Container_ParamAdv) this.mContainer).value0f), 46, 33, 167, 0x00bbff); + proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+d", ((GT_Container_ParamAdv) this.mContainer).value1f), 46, 41, 167, 0x0077ff); + } + proxy.renderUnicodeString("\u24EA\u2b06" + Util.intBitsToShortString(((GT_Container_ParamAdv) this.mContainer).value0f), 46, 50, 167, 0x00bbff); + proxy.renderUnicodeString("\u2460\u2b06" + Util.intBitsToShortString(((GT_Container_ParamAdv) this.mContainer).value1f), 46, 58, 167, 0x0077ff); + proxy.renderUnicodeString("Pointer " + Integer.toHexString(((GT_Container_ParamAdv) this.mContainer).pointer | 0x10000).substring(1), 46, 66, 167, 0x0033ff); + } else { + proxy.renderUnicodeString("Parameters X", 46, 7, 167, 0xffffff); + } + } + + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (this.width - this.xSize) / 2; + int y = (this.height - this.ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index c0cf09df77..f64e6c84d5 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -100,7 +101,7 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "Things+Anti Things don't like each other.", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Matter into power!" }; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index 61d370a672..a4eb61ae65 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -179,7 +180,7 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "Singularity based power generation.", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Super unstable!!!" }; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index 2cb7d1f3d5..2903b99759 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -5,6 +5,7 @@ import com.github.technus.tectech.TecTech; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -195,7 +196,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "Collide matter at extreme velocities.", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Faster than light!!!" }; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java index 0edbf3a75b..e8edf9f307 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java @@ -9,6 +9,7 @@ import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -40,7 +41,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB private static Textures.BlockIcons.CustomIcon ScreenON; private final ArrayList<GT_MetaTileEntity_Hatch_Rack> eRacks = new ArrayList<>(); - private int maxTemp = 0; + private int maxCurrentTemp = 0; //region Structure private static final String[][] front = new String[][]{{"A ", "A ", "A. ", "A ",},}; @@ -93,11 +94,25 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } @Override - public boolean checkRecipe_EM(ItemStack itemStack) { + public boolean checkRecipe_EM(ItemStack itemStack, boolean noParametrizers) { eAvailableData = 0; - maxTemp = 0; - if(eParamsIn[0]>=0 && eParamsIn[10]>=0){ - float eut=V[8] * eParamsIn[10]; + maxCurrentTemp = 0; + double overClockRatio,overVoltageRatio; + if (noParametrizers) { + overVoltageRatio=overClockRatio=1; + } else { + overClockRatio= getParameterIn(0,0); + overVoltageRatio= getParameterIn(0,1); + if(Double.isNaN(overClockRatio) || Double.isNaN(overVoltageRatio)) { + mMaxProgresstime = 0; + mEfficiencyIncrease = 0; + for (GT_MetaTileEntity_Hatch_Rack r : eRacks) + r.getBaseMetaTileEntity().setActive(false);//todo might be not needed + return false; + } + } + if(overClockRatio>0 && overVoltageRatio>=0.7f && overClockRatio<=3 && overVoltageRatio<=2){ + float eut=V[8] * (float)overVoltageRatio * (float)overClockRatio; if(eut<Integer.MAX_VALUE-7) mEUt = -(int)eut; else{ @@ -105,21 +120,21 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB mMaxProgresstime = 0; mEfficiencyIncrease = 0; for (GT_MetaTileEntity_Hatch_Rack r : eRacks) - r.getBaseMetaTileEntity().setActive(false); + r.getBaseMetaTileEntity().setActive(false);//todo might be not needed return false; } short thingsActive = 0; int rackComputation; - for (GT_MetaTileEntity_Hatch_Rack r : eRacks) { - if (!isValidMetaTileEntity(r)) continue; - if (r.heat > maxTemp) maxTemp = r.heat; - rackComputation = r.tickComponents(eParamsIn[0], eParamsIn[10]); + for (GT_MetaTileEntity_Hatch_Rack rack : eRacks) { + if (!isValidMetaTileEntity(rack)) continue; + if (rack.heat > maxCurrentTemp) maxCurrentTemp = rack.heat; + rackComputation = rack.tickComponents((float) overClockRatio, (float) overVoltageRatio); if (rackComputation > 0) { eAvailableData += rackComputation; thingsActive += 4; } - r.getBaseMetaTileEntity().setActive(true); + rack.getBaseMetaTileEntity().setActive(true); } for (GT_MetaTileEntity_Hatch_InputData di : eInputData) @@ -154,39 +169,35 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } @Override - public void updateParameters_EM() { - if (eParamsIn[0] < 0) - eParamsInStatus[0] = PARAM_TOO_LOW; - else if (eParamsIn[0] < 1) - eParamsInStatus[0] = PARAM_LOW; - else if (eParamsIn[0] == 1) - eParamsInStatus[0] = PARAM_OK; - else if (eParamsIn[0] <= 3) - eParamsInStatus[0] = PARAM_HIGH; - else eParamsInStatus[0] = PARAM_TOO_HIGH; - - if (eParamsIn[10] < 0.7f) - eParamsInStatus[10] = PARAM_TOO_LOW; - else if (eParamsIn[10] < 0.8f) - eParamsInStatus[10] = PARAM_LOW; - else if (eParamsIn[10] <= 1.2f) - eParamsInStatus[10] = PARAM_OK; - else if (eParamsIn[10] <= 2) - eParamsInStatus[10] = PARAM_HIGH; - else eParamsInStatus[10] = PARAM_TOO_HIGH; - - eParamsOut[0] = maxTemp; - eParamsOut[10] = eAvailableData; - - if (maxTemp < -10000) - eParamsOutStatus[0] = PARAM_TOO_LOW; - else if (maxTemp < 0) - eParamsOutStatus[0] = PARAM_LOW; - else if (maxTemp == 0) - eParamsOutStatus[0] = PARAM_OK; - else if (maxTemp <= 5000) - eParamsOutStatus[0] = PARAM_HIGH; - else eParamsOutStatus[0] = PARAM_TOO_HIGH; + public void updateParameters_EM(boolean busy) { + double ocRatio = getParameterIn(0, 0); + if (ocRatio < 0) setStatusOfParameterIn(0, 0, STATUS_TOO_LOW); + else if (ocRatio < 1) setStatusOfParameterIn(0, 0, STATUS_LOW); + else if (ocRatio == 1) setStatusOfParameterIn(0, 0, STATUS_OK); + else if (ocRatio <= 3) setStatusOfParameterIn(0, 0, STATUS_HIGH); + else if (Double.isNaN(ocRatio)) setStatusOfParameterIn(0, 0, STATUS_WRONG); + else setStatusOfParameterIn(0, 0, STATUS_TOO_HIGH); + + double ovRatio = getParameterIn(0, 1); + if (ovRatio < 0.7f) setStatusOfParameterIn(0, 1, STATUS_TOO_LOW); + else if (ovRatio < 0.8f) setStatusOfParameterIn(0, 1, STATUS_LOW); + else if (ovRatio <= 1.2f) setStatusOfParameterIn(0, 1, STATUS_OK); + else if (ovRatio <= 2) setStatusOfParameterIn(0, 1, STATUS_HIGH); + else if (Double.isNaN(ovRatio)) setStatusOfParameterIn(0, 1, STATUS_WRONG); + else setStatusOfParameterIn(0, 1, STATUS_TOO_HIGH); + + setParameterOut(0, 0, maxCurrentTemp); + setParameterOut(0, 1, eAvailableData); + + if (maxCurrentTemp < -10000) setStatusOfParameterOut(0, 0, STATUS_TOO_LOW); + else if (maxCurrentTemp < 0) setStatusOfParameterOut(0, 0, STATUS_LOW); + else if (maxCurrentTemp == 0) setStatusOfParameterOut(0, 0, STATUS_OK); + else if (maxCurrentTemp <= 5000) setStatusOfParameterOut(0, 0, STATUS_HIGH); + else setStatusOfParameterOut(0, 0, STATUS_TOO_HIGH); + + if (!busy) setStatusOfParameterOut(0, 1, STATUS_WRONG); + else if (eAvailableData <= 0) setStatusOfParameterOut(0, 1, STATUS_TOO_LOW); + else setStatusOfParameterOut(0, 1, STATUS_OK); } @Override @@ -279,8 +290,8 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, - Util.intToString(TecTech.Rnd.nextInt(), 8), + CommonValues.TEC_MARK_EM, + Util.intBitsToString(TecTech.Rnd.nextInt()), EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "You need it to process the number above" }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java index 679d69e721..b2942f8c1c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -101,7 +102,7 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "The most precise way of making stuff.", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "(Trans-Planck process)" }; 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 11f6793bc1..a8473b7525 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -1,10 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -20,7 +21,7 @@ import net.minecraft.util.EnumChatFormatting; import static com.github.technus.tectech.Util.StructureBuilder; import static com.github.technus.tectech.Util.VN; -import static com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition.stableRawLifeTime; +import static com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -103,16 +104,16 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "Is life time too long?", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Make it half-life (3) instead!" }; } @Override - public boolean checkRecipe_EM(ItemStack itemStack) { + public boolean checkRecipe_EM(ItemStack itemStack, boolean noParametrizers) { cElementalInstanceStackMap map= getInputsClone_EM(); - if(map!=null && map.hasStacks() && map.getFirst().getLifeTime()<stableRawLifeTime){ + if(map!=null && map.hasStacks() && map.getFirst().getLifeTime()< STABLE_RAW_LIFE_TIME){ return startRecipe(map.getFirst()); } mEfficiencyIncrease = 0; @@ -128,7 +129,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase mMaxProgresstime = 1;//(int)m3; mEfficiencyIncrease = 10000; m1 = input.getMass()/input.amount; - cElementalInstanceStackMap decayed=input.decayCompute(input.getDefinition().getDecayArray(),1,0,0); + cElementalInstanceStackMap decayed=input.decay(); m2 = decayed.getMass()/input.amount; //TecTech.Logger.info("I " + input.toString()); //TecTech.Logger.info("O " + decayed.toString()); 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 5ba101cd78..80e5d4aab2 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,14 +1,15 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.elementalMatter.classes.aOredictDequantizationInfo; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; -import com.github.technus.tectech.elementalMatter.interfaces.iExchangeInfo; -import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.core.interfaces.iExchangeInfo; +import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.elementalMatter.core.transformations.aOredictDequantizationInfo; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; @@ -20,11 +21,12 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; import static com.github.technus.tectech.Util.StructureBuilder; -import static com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition.refMass; -import static com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition.refUnstableMass; +import static com.github.technus.tectech.Util.V; +import static com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.elementalMatter.definitions.complex.atom.dAtomDefinition.refMass; +import static com.github.technus.tectech.elementalMatter.definitions.complex.atom.dAtomDefinition.refUnstableMass; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.github.technus.tectech.Util.V; /** * Created by danie_000 on 17.12.2016. @@ -81,7 +83,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo } @Override - public boolean checkRecipe_EM(ItemStack itemStack) { + public boolean checkRecipe_EM(ItemStack itemStack, boolean noParametrizers) { for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { cElementalInstanceStackMap map = in.getContainerHandler(); for (cElementalInstanceStack stack : map.values()) { @@ -89,7 +91,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo if (info != null) { if (map.removeAllAmounts(false, (iHasElementalDefinition) info.input())) { mOutputFluids = new FluidStack[]{(FluidStack) info.output()}; - startRecipe((iHasElementalDefinition) info.input()); + startRecipe((iHasElementalDefinition) info.input(),stack.getEnergy()); return true; } } @@ -98,7 +100,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo if (info != null) { if (map.removeAllAmounts(false, (iHasElementalDefinition) info.input())) { mOutputItems = new ItemStack[]{(ItemStack) info.output()}; - startRecipe((iHasElementalDefinition) info.input()); + startRecipe((iHasElementalDefinition) info.input(),stack.getEnergy()); return true; } } @@ -109,7 +111,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo ArrayList<ItemStack> items = OreDictionary.getOres(((aOredictDequantizationInfo) info).out); if (items != null && items.size() > 0) { mOutputItems = new ItemStack[]{items.get(0)}; - startRecipe((iHasElementalDefinition) info.input()); + startRecipe((iHasElementalDefinition) info.input(),stack.getEnergy()); return true; } } @@ -121,13 +123,13 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo return false; } - private void startRecipe(iHasElementalDefinition from) { + private void startRecipe(iHasElementalDefinition from, long energy) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; float mass = from.getMass(); float euMult = mass / refMass; eAmpereFlow = (int) Math.ceil(euMult); - if (mass > refUnstableMass || from.getDefinition().getRawLifeTime() < 1.5e25f) { + if (mass > refUnstableMass || from.getDefinition().getRawTimeSpan(energy) < STABLE_RAW_LIFE_TIME) { mEUt = (int) -V[10]; } else { mEUt = (int) -V[8]; @@ -137,7 +139,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "Transform quantum form back to...", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "regular one, but why?" }; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index bdca45aac5..4115a93910 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -4,8 +4,9 @@ import cofh.api.energy.IEnergyContainerItem; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_Container_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_GUIContainer_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import ic2.api.item.ElectricItem; @@ -91,7 +92,7 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa } @Override - public boolean checkRecipe_EM(ItemStack itemStack) { + public boolean checkRecipe_EM(ItemStack itemStack, boolean noParametrizers) { if (itemStack != null && itemStack.stackSize == 1) { Item ofThis = itemStack.getItem(); if (ofThis instanceof IElectricItem) { @@ -132,7 +133,7 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_GENERAL, "Power Transfer Extreme!", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Insanely fast charging!", EnumChatFormatting.BLUE + "Doesn't work while broken!", diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index 66ed00c1c0..044b7177e3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -1,9 +1,10 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; @@ -11,9 +12,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import static com.github.technus.tectech.Util.StructureBuilder; +import static com.github.technus.tectech.Util.V; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.github.technus.tectech.Util.V; /** * Created by danie_000 on 17.12.2016. @@ -70,34 +71,40 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "Reroutes Matter", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Axis aligned movement!" }; } @Override - public void updateParameters_EM() { + public void updateParameters_EM(boolean busy) { + double src, dest; for (int i = 0; i < 10; i++) { - if ((int) eParamsIn[i] < 0) eParamsInStatus[i] = PARAM_TOO_LOW; - else if ((int) eParamsIn[i] == 0) eParamsInStatus[i] = PARAM_UNUSED; - else if ((int) eParamsIn[i] > eInputHatches.size()) eParamsInStatus[i] = PARAM_TOO_HIGH; - else eParamsInStatus[i] = PARAM_OK; - } - for (int i = 10; i < 20; i++) { - if (eParamsInStatus[i - 10] == PARAM_OK) { - if ((int) eParamsIn[i] < 0) eParamsInStatus[i] = PARAM_TOO_LOW; - else if ((int) eParamsIn[i] == 0) eParamsInStatus[i] = PARAM_LOW; - else if ((int) eParamsIn[i] > eOutputHatches.size()) eParamsInStatus[i] = PARAM_TOO_HIGH; - else eParamsInStatus[i] = PARAM_OK; + src = getParameterIn(i, 0); + if (src <= 0) { + setStatusOfParameterIn(i, 0, STATUS_TOO_LOW); + setStatusOfParameterIn(i, 1, STATUS_UNUSED); + } else if (src > eInputHatches.size()) { + setStatusOfParameterIn(i, 0, STATUS_TOO_HIGH); + setStatusOfParameterIn(i, 1, STATUS_UNUSED); + } else if (Double.isNaN(src)) { + setStatusOfParameterIn(i, 0, STATUS_WRONG); + setStatusOfParameterIn(i, 1, STATUS_UNUSED); } else { - eParamsInStatus[i] = PARAM_UNUSED; + setStatusOfParameterIn(i, 0, STATUS_OK); + dest = getParameterIn(i, 1); + if (dest < 0) setStatusOfParameterIn(i, 1, STATUS_TOO_LOW); + else if (dest == 0) setStatusOfParameterIn(i, 1, STATUS_LOW); + else if (dest > eOutputHatches.size()) setStatusOfParameterIn(i, 1, STATUS_TOO_HIGH); + else if (Double.isNaN(dest)) setStatusOfParameterIn(i, 1, STATUS_WRONG); + else setStatusOfParameterIn(i, 1, STATUS_OK); } } } @Override - public boolean checkRecipe_EM(ItemStack itemStack) { + public boolean checkRecipe_EM(ItemStack itemStack, boolean noParametrizers) { for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) if (in.getContainerHandler().hasStacks()) { mEUt = -(int) V[8]; @@ -113,15 +120,19 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override public void outputAfterRecipe_EM() { + double src,dest; for (int i = 0; i < 10; i++) { - final int inIndex = (int) (eParamsIn[i]) - 1; - if (inIndex < 0 || inIndex > eInputHatches.size()) continue; - final int outIndex = (int) (eParamsIn[i + 10]) - 1; + src= getParameterIn(i,0); + dest= getParameterIn(i,1); + if(Double.isNaN(src) || Double.isNaN(dest)) continue; + final int inIndex = (int)src - 1; + if (inIndex < 0 || inIndex >= eInputHatches.size()) continue; + final int outIndex = (int)dest - 1; GT_MetaTileEntity_Hatch_InputElemental in = eInputHatches.get(inIndex); if (outIndex == -1) {//param==0 -> null the content cleanHatchContentEM_EM(in); } else { - if (outIndex < 0 || outIndex > eOutputHatches.size()) continue; + if (outIndex < 0 || outIndex >= eOutputHatches.size()) continue; GT_MetaTileEntity_Hatch_OutputElemental out = eOutputHatches.get(outIndex); out.getContainerHandler().putUnifyAll(in.getContainerHandler()); in.getContainerHandler().clear(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_machine.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_machine.java index adeba2bec4..3c1986d635 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_machine.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_machine.java @@ -1,27 +1,49 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.thing.block.QuantumGlassBlock; +import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.common.blocks.GT_Block_Machines; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import static com.github.technus.tectech.Util.StructureBuilder; +import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; + /** * Created by danie_000 on 17.12.2016. */ -public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBase_EM { +public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { public final static String machine="EM Machinery"; - + + //region structure private static final String[][] shape = new String[][]{ - {"",//left to right top - "", - ""},//front - {},//behind front - {} //behind + {"B0","A ","0 - 0","A ","B0",}, + {"A000","00000","00.00","00000","A000",}, + {"A121","1C1","2C2","1C1","A121",}, + {"A131","1C1","3C3","1C1","A131",}, + {"A121","1C1","2C2","1C1","A121",}, + {"A000","00000","00A00","00000","A000",}, + {"B0","A!!!","0!\"!0","A!!!","B0",}, + }; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{4, 0, 5, 6}; + private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalToMachineList", "addElementalInputToMachineList"}; + private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; + private static final String[] description = new String[]{ + EnumChatFormatting.AQUA+"Hint Details:", + "1 - Classic Hatches or High Power Casing", + "2 - Elemental Hatches or Molecular Casing", + "2 - Elemental Input Hatch", }; - private static final Block[] blockType = new Block[]{}; - private static final byte[] blockMeta = new byte[]{}; + //endregion public GT_MetaTileEntity_EM_machine(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -37,13 +59,24 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return false; + return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 1) + && eInputHatches.size()==1 && iGregTechTileEntity.getBlockAtSideAndDistance(iGregTechTileEntity.getBackFacing(),5) instanceof GT_Block_Machines; + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilder(shape, blockType, blockMeta,2, 2, 1, getBaseMetaTileEntity(),hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; } @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "Processing quantum matter since...", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "the time u started using it." }; 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 feda70465b..4f90191c07 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 @@ -2,10 +2,16 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.elementalMatter.classes.*; -import com.github.technus.tectech.elementalMatter.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.core.interfaces.iHasElementalDefinition; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.elementalMatter.core.transformations.aFluidQuantizationInfo; +import com.github.technus.tectech.elementalMatter.core.transformations.aItemQuantizationInfo; +import com.github.technus.tectech.elementalMatter.core.transformations.aOredictQuantizationInfo; +import com.github.technus.tectech.elementalMatter.core.transformations.bTransformationInfo; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -17,8 +23,9 @@ import net.minecraftforge.oredict.OreDictionary; import static com.github.technus.tectech.Util.*; import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition.refMass; -import static com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition.refUnstableMass; +import static com.github.technus.tectech.elementalMatter.core.templates.iElementalDefinition.DEFAULT_ENERGY_LEVEL; +import static com.github.technus.tectech.elementalMatter.definitions.complex.atom.dAtomDefinition.refMass; +import static com.github.technus.tectech.elementalMatter.definitions.complex.atom.dAtomDefinition.refUnstableMass; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -78,14 +85,14 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "Conveniently convert regular stuff into quantum form.", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "To make it more inconvenient." }; } @Override - public boolean checkRecipe_EM(ItemStack itemStack) {//TODO implement by item quantization, implement instance quantization + public boolean checkRecipe_EM(ItemStack itemStack, boolean noParametrizers) {//TODO implement by item quantization, implement instance quantization if (GregTech_API.sPostloadFinished) { ItemStack[] inI = getStoredInputs().toArray(new ItemStack[0]); if (inI.length > 0) { @@ -148,7 +155,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock float mass = into.getMass(); float euMult = mass / refMass; eAmpereFlow = (int) Math.ceil(euMult); - if (mass > refUnstableMass || into.getDefinition().getRawLifeTime() < 1.5e25f) { + if (mass > refUnstableMass || into.getDefinition().getRawTimeSpan(DEFAULT_ENERGY_LEVEL) < 1.5e25f) { mEUt = (int) -V[10]; } else { mEUt = (int) -V[8]; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 1d14ab7d72..382ab68609 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -6,6 +6,7 @@ import com.github.technus.tectech.recipe.TT_recipe; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Holder; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; @@ -176,10 +177,10 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } @Override - public boolean checkRecipe_EM(ItemStack itemStack) { + public boolean checkRecipe_EM(ItemStack itemStack, boolean noParametrizers) { tRecipe=null; aRecipe=null; - if(!eHolders.isEmpty() && eHolders.get(0).mInventory[0]!=null) { + if(eHolders.size()>0 && eHolders.get(0).mInventory[0]!=null) { holdItem = eHolders.get(0).mInventory[0].copy(); if(ItemList.Tool_DataStick.isStackEqual(itemStack, false, true)) { for (GT_Recipe.GT_Recipe_AssemblyLine assRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) { @@ -265,7 +266,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB @Override public void outputAfterRecipe_EM() { - if(!eHolders.isEmpty()) { + if(eHolders.size()>0) { if (tRecipe != null && ItemList.Tool_DataStick.isStackEqual(mInventory[1], false, true)){ eHolders.get(0).getBaseMetaTileEntity().setActive(false); eHolders.get(0).mInventory[0] = null; @@ -336,7 +337,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "Philosophers didn't even...", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "dream about it!" }; 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 e69a5fd60e..e92753a897 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 @@ -1,14 +1,15 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.recipe.TT_recipe; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.enums.ItemList; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -25,7 +26,7 @@ import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.Util.StructureBuilder; import static com.github.technus.tectech.Util.VN; -import static com.github.technus.tectech.elementalMatter.definitions.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -36,6 +37,11 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileE * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + public static final int SCAN_DO_NOTHING=0, + SCAN_GET_MASS=1, SCAN_GET_CHARGE=2, SCAN_GET_CLASS_TYPE=4, SCAN_GET_NOMENCLATURE=8, SCAN_GET_TIMESPAN_INFO=16, + SCAN_GET_AMOUNT=256, SCAN_GET_COLOR=512, SCAN_GET_ENERGY_LEVEL=1024, SCAN_GET_AGE=2048, SCAN_GET_TIMESPAN_MULT =4096, + SCAN_GET_DEPTH_LEVEL= 8192, SCAN_GET_ENERGY_STATES=16384; + private TT_recipe.TT_EMRecipe.TT_EMRecipe eRecipe; private cElementalDefinitionStack objectResearched; private String machineType; @@ -105,7 +111,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "What is existing here?", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "I HAVE NO IDEA (yet)!" }; @@ -172,9 +178,9 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } @Override - public boolean checkRecipe_EM(ItemStack itemStack) { + public boolean checkRecipe_EM(ItemStack itemStack, boolean noParametrizers) { eRecipe=null; - if(!eInputHatches.isEmpty() && eInputHatches.get(0).getContainerHandler().hasStacks() && !eOutputHatches.isEmpty()) { + if(eInputHatches.size()>0 && eInputHatches.get(0).getContainerHandler().hasStacks() && !eOutputHatches.isEmpty()) { cElementalInstanceStackMap researchEM = eInputHatches.get(0).getContainerHandler(); if(ItemList.Tool_DataOrb.isStackEqual(itemStack, false, true)) { GT_Recipe scannerRecipe=null; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index 25cac16c7c..c75453dc26 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; @@ -68,7 +69,7 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "Alters time to stabilize matter", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Wibbly wobbly timey wimey, stuff." }; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index 2e7760c36c..bfd2ffd3fe 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -6,6 +6,7 @@ import com.github.technus.tectech.dataFramework.QuantumDataPacket; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -16,10 +17,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import static com.github.technus.tectech.Util.StructureBuilder; +import static com.github.technus.tectech.Util.V; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.github.technus.tectech.Util.V; /** * Created by danie_000 on 17.12.2016. @@ -79,7 +80,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } @Override - public boolean checkRecipe_EM(ItemStack itemStack) { + public boolean checkRecipe_EM(ItemStack itemStack, boolean noParametrizers) { short thingsActive = 0; for (GT_MetaTileEntity_Hatch_InputData di : eInputData) if (di.q != null) @@ -101,12 +102,15 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas @Override public void outputAfterRecipe_EM() { if (eOutputData.size() > 0) { - float total = 0; + double total = 0; + double dest; + double weight; for (int i = 0; i < 10; i++) {//each param pair - if (eParamsIn[i] > 0 && eParamsIn[i + 10] >= 0) - total += eParamsIn[i];//Total weighted div + dest= getParameterIn(i,1); + weight= getParameterIn(i,0); + if (weight > 0 && dest >= 0) + total += weight;//Total weighted div } - total += total / 100F; final Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); QuantumDataPacket pack = new QuantumDataPacket(pos, 0); @@ -119,19 +123,27 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas long remaining = pack.computation; for (int i = 0; i < 10; i++) { - if (eParamsIn[i] > 0) { - final int outIndex = (int) (eParamsIn[i + 10]) - 1; - if (outIndex < 0 || outIndex > eOutputData.size()) continue; + dest= getParameterIn(i,1); + weight= getParameterIn(i,0); + if (weight > 0 && dest >= 0) { + final int outIndex = (int)dest - 1; + if (outIndex < 0 || outIndex >= eOutputData.size()) continue; GT_MetaTileEntity_Hatch_OutputData out = eOutputData.get(outIndex); - final long part = (long) ((pack.computation * eParamsIn[i]) / total); - if (part > 0) { - remaining -= part; - if (remaining > 0) - out.q = new QuantumDataPacket(pack, part); - else if (part + remaining > 0) { - out.q = new QuantumDataPacket(pack, part + remaining); + if(Double.isInfinite(total)){ + if(Double.isInfinite(weight)){ + out.q = new QuantumDataPacket(pack, remaining); break; - } else break; + } + }else{ + final long part = (long) Math.floor((pack.computation * weight) / total); + if (part > 0) { + remaining -= part; + if (remaining > 0) out.q = new QuantumDataPacket(pack, part); + else if (part + remaining > 0) { + out.q = new QuantumDataPacket(pack, part + remaining); + break; + } else break; + } } } } @@ -139,20 +151,24 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } @Override - public void updateParameters_EM() { + public void updateParameters_EM(boolean busy) { + double weight, dest; for (int i = 0; i < 10; i++) { - if (eParamsIn[i] < 0) eParamsInStatus[i] = PARAM_TOO_LOW; - else if (eParamsIn[i] == 0) eParamsInStatus[i] = PARAM_UNUSED; - else if (eParamsIn[i] == Float.POSITIVE_INFINITY) eParamsInStatus[i] = PARAM_TOO_HIGH; - else eParamsInStatus[i] = PARAM_OK; - } - for (int i = 10; i < 20; i++) { - if (eParamsInStatus[i - 10] == PARAM_OK) { - if ((int) eParamsIn[i] <= 0) eParamsInStatus[i] = PARAM_LOW; - else if ((int) eParamsIn[i] > eOutputData.size()) eParamsInStatus[i] = PARAM_TOO_HIGH; - else eParamsInStatus[i] = PARAM_OK; + weight = getParameterIn(i, 0); + if (weight <= 0) { + setStatusOfParameterIn(i, 0, STATUS_TOO_LOW); + setStatusOfParameterIn(i, 1, STATUS_UNUSED); + } else if (Double.isNaN(weight)) { + setStatusOfParameterIn(i, 0, STATUS_WRONG); + setStatusOfParameterIn(i, 1, STATUS_UNUSED); } else { - eParamsInStatus[i] = PARAM_UNUSED; + setStatusOfParameterIn(i, 0, STATUS_OK); + dest = getParameterIn(i, 1); + if (dest < 0) setStatusOfParameterIn(i, 1, STATUS_TOO_LOW); + else if (dest == 0) setStatusOfParameterIn(i, 1, STATUS_LOW); + else if (dest > eOutputData.size()) setStatusOfParameterIn(i, 1, STATUS_TOO_HIGH); + else if (Double.isNaN(dest)) setStatusOfParameterIn(i, 1, STATUS_WRONG); + else setStatusOfParameterIn(i, 1, STATUS_OK); } } } @@ -160,7 +176,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "User controlled computation power routing", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Quality of service is a must" }; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index be465b8cd0..4bb1e6de3b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -2,8 +2,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_Container_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_GUIContainer_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -103,7 +104,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_GENERAL, "Power substation", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "All the transformation!", EnumChatFormatting.BLUE + "Only 0.78125% power loss, HAYO!", @@ -111,7 +112,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo } @Override - public boolean checkRecipe_EM(ItemStack itemStack) { + public boolean checkRecipe_EM(ItemStack itemStack, boolean noParametrizers) { if (ePowerPass) { mEfficiencyIncrease = 10000; mMaxProgresstime = 20; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index 71565f2592..c410bb289c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -3,6 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -101,7 +102,7 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "It is not full of worms.", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "It is full of anti-worms!!!" }; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 8360b09708..b5ad2429e9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -3,8 +3,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.auxiliary.Reference; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_Container_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_GUIContainer_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -33,11 +34,12 @@ import static gregtech.api.GregTech_API.sBlockCasings4; /** * Created by danie_000 on 17.12.2016. */ -public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - private int powerSetting = 1000; - private int timerSetting = 360; +public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + public final static int POWER_SETTING_DEFAULT=1000, TIMER_SETTING_DEFAULT=360; + private int powerSetting = POWER_SETTING_DEFAULT; + private int timerSetting = TIMER_SETTING_DEFAULT; private int timerValue = 0; - private boolean hasBeenPausedThisCycle =false; + private boolean hasBeenPausedThisCycle=false; private boolean flipped=false; //region Structure @@ -72,14 +74,10 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock public GT_MetaTileEntity_TM_microwave(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); - eParamsIn[0] =powerSetting; - eParamsIn[10]=timerSetting; } public GT_MetaTileEntity_TM_microwave(String aName) { super(aName); - eParamsIn[0] =powerSetting; - eParamsIn[10]=timerSetting; } public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { @@ -103,7 +101,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "EMDisplay.png", false, false, true); + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "EMDisplay.png", false, false, true);//todo texture } @Override @@ -157,9 +155,13 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } @Override - public boolean checkRecipe_EM(ItemStack itemStack) { + public boolean checkRecipe_EM(ItemStack itemStack, boolean noParametrizers) { hasBeenPausedThisCycle =false; - if(powerSetting<=300 || eParamsInStatus[0] == PARAM_TOO_HIGH || timerSetting<=0 || timerSetting>3000) return false; + if(noParametrizers){ + powerSetting=POWER_SETTING_DEFAULT; + timerSetting=TIMER_SETTING_DEFAULT; + } + if(powerSetting<300 || timerSetting<=0 || timerSetting>3000) return false; if (timerValue <= 0) { timerValue=timerSetting; } @@ -239,27 +241,28 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } @Override - public void updateParameters_EM() { - if (eParamsIn[0] <= 300) - eParamsInStatus[0] = PARAM_TOO_LOW; - else if (eParamsIn[0] < 1000) - eParamsInStatus[0] = PARAM_LOW; - else if (eParamsIn[0] == 1000) - eParamsInStatus[0] = PARAM_OK; - else if (eParamsIn[0] <= Integer.MAX_VALUE) - eParamsInStatus[0] = PARAM_HIGH; - else eParamsInStatus[0] = PARAM_TOO_HIGH; - - if (eParamsIn[10] <= 1) - eParamsInStatus[10] = PARAM_TOO_LOW; - else if (eParamsIn[10] <= 3000) - eParamsInStatus[10] = PARAM_OK; - else eParamsInStatus[10] = PARAM_TOO_HIGH; - - powerSetting = (int)eParamsIn[0]; - timerSetting = (int)eParamsIn[10]; - - eParamsOut[0] = timerValue; + public void updateParameters_EM(boolean machineIsBusy) { + double powerParameter = getParameterIn(0, 0); + if (powerParameter < 300) setStatusOfParameterIn(0, 0, STATUS_TOO_LOW); + else if (powerParameter < 1000) setStatusOfParameterIn(0, 0, STATUS_LOW); + else if (powerParameter == 1000) setStatusOfParameterIn(0, 0, STATUS_OK); + else if (powerParameter == Double.POSITIVE_INFINITY) setStatusOfParameterIn(0, 0, STATUS_TOO_HIGH); + else if (Double.isNaN(powerParameter)) setStatusOfParameterIn(0, 0, STATUS_WRONG); + else setStatusOfParameterOut(0, 0, STATUS_HIGH); + + double timerParameter = getParameterIn(0, 1); + if (timerParameter <= 1) setStatusOfParameterIn(0, 1, STATUS_TOO_LOW); + else if (timerParameter <= 3000) setStatusOfParameterIn(0, 0, STATUS_OK); + else if (Double.isNaN(timerParameter)) setStatusOfParameterIn(0, 1, STATUS_WRONG); + else setStatusOfParameterIn(0, 1, STATUS_TOO_HIGH); + + setParameterOut(0, 0, timerValue); + setParameterOut(0, 1, timerSetting - timerValue); + + if (machineIsBusy) return; + + powerSetting = (int) powerParameter; + timerSetting = (int) timerParameter; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java index 769953d0ef..5342c9bc51 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java @@ -1,6 +1,6 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi.gui; +package com.github.technus.tectech.thing.metaTileEntity.multi.base; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.gui.GT_Slot_Holo; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java index 98e60e4498..94a70f6e50 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java @@ -1,11 +1,11 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi.gui; +package com.github.technus.tectech.thing.metaTileEntity.multi.base; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; import org.lwjgl.opengl.GL11; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_MultiblockBase_EM.*; +import static com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM.*; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; /** @@ -173,7 +173,7 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach private void LEDdrawP(int x, int y, int i, int j, byte status) { final int v = 192, su = 8, sv = 6, u = 11; switch (status) { - case PARAM_WRONG: + case STATUS_WRONG: if (counter < 2) { drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * j, su, sv); break; @@ -181,23 +181,23 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (8 + j), su, sv); break; } - case PARAM_OK://ok + case STATUS_OK://ok drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (4 + j), su, sv); break; - case PARAM_TOO_LOW://too low blink + case STATUS_TOO_LOW://too low blink if (counter < 3) { drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * j, su, sv); break; } - case PARAM_LOW:// too low + case STATUS_LOW:// too low drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (2 + j), su, sv); break; - case PARAM_TOO_HIGH://too high blink + case STATUS_TOO_HIGH://too high blink if (counter < 3) { drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (8 + j), su, sv); break; } - case PARAM_HIGH:// too high + case STATUS_HIGH:// too high drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (6 + j), su, sv); break; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java index 89b8f84253..93197b504e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java @@ -1,16 +1,14 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; +package com.github.technus.tectech.thing.metaTileEntity.multi.base; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.Util; import com.github.technus.tectech.Vec3pos; -import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; -import com.github.technus.tectech.elementalMatter.classes.tElementalException; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.elementalMatter.core.tElementalException; import com.github.technus.tectech.thing.metaTileEntity.hatch.*; -import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_Container_MultiMachineEM; -import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_GUIContainer_MultiMachineEM; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -48,7 +46,7 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture */ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEntity_MultiBlockBase { protected final static Map<String, Method> adderMethodMap = new HashMap<>(); - public static Method adderMethod; + private static Method adderMethod; protected cElementalInstanceStackMap[] outputEM; @@ -58,39 +56,43 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected static Textures.BlockIcons.CustomIcon ScreenOFF; protected static Textures.BlockIcons.CustomIcon ScreenON; - public ArrayList<GT_MetaTileEntity_Hatch_InputElemental> eInputHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_OutputElemental> eOutputHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_MufflerElemental> eMufflerHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_Param> eParamHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_Uncertainty> eUncertainHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_EnergyMulti> eEnergyMulti = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_DynamoMulti> eDynamoMulti = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_InputData> eInputData = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_OutputData> eOutputData = new ArrayList<>(); + protected ArrayList<GT_MetaTileEntity_Hatch_InputElemental> eInputHatches = new ArrayList<>(); + protected ArrayList<GT_MetaTileEntity_Hatch_OutputElemental> eOutputHatches = new ArrayList<>(); + protected ArrayList<GT_MetaTileEntity_Hatch_MufflerElemental> eMufflerHatches = new ArrayList<>(); + protected ArrayList<GT_MetaTileEntity_Hatch_Param> eParamHatches = new ArrayList<>(); + protected ArrayList<GT_MetaTileEntity_Hatch_Uncertainty> eUncertainHatches = new ArrayList<>(); + protected ArrayList<GT_MetaTileEntity_Hatch_EnergyMulti> eEnergyMulti = new ArrayList<>(); + protected ArrayList<GT_MetaTileEntity_Hatch_DynamoMulti> eDynamoMulti = new ArrayList<>(); + protected ArrayList<GT_MetaTileEntity_Hatch_InputData> eInputData = new ArrayList<>(); + protected ArrayList<GT_MetaTileEntity_Hatch_OutputData> eOutputData = new ArrayList<>(); // 0 and 10 are from first parametrizer // 1 and 11 are from second etc... - public final float[] eParamsIn = new float[20];//float number I from parametrizers - public final float[] eParamsOut = new float[20];//float number O to parametrizers - public final byte[] eParamsInStatus = new byte[20];//LED status for I - public final byte[] eParamsOutStatus = new byte[20];//LED status for O - public final static byte PARAM_UNUSED = 0, - PARAM_TOO_LOW = 1, PARAM_LOW = 2, - PARAM_WRONG = 3, PARAM_OK = 4, - PARAM_TOO_HIGH = 5, PARAM_HIGH = 6; + private final int[] iParamsIn = new int[20];//number I from parametrizers + private final int[] iParamsOut = new int[20];//number O to parametrizers + private final boolean[] bParamsAreFloats = new boolean[10]; + + final byte[] eParamsInStatus = new byte[20];//LED status for I + final byte[] eParamsOutStatus = new byte[20];//LED status for O + public final static byte STATUS_UNUSED = 0, + STATUS_TOO_LOW = 1, STATUS_LOW = 2, + STATUS_WRONG = 3, STATUS_OK = 4, + STATUS_TOO_HIGH = 5, STATUS_HIGH = 6; // 0,2,4,6 - ok // 1,3,5 - nok //TO ENABLE this change value in <init> to false and/or other than 0, can also be added in recipe check or whatever - public boolean eParameters = true, ePowerPass = false, eSafeVoid = false, eDismantleBoom = false; - public byte eCertainMode = 0, eCertainStatus = 0, minRepairStatus = 3; + protected boolean eParameters = true, ePowerPass = false, eSafeVoid = false, eDismantleBoom = false; + protected byte eCertainMode = 0, eCertainStatus = 0, minRepairStatus = 3; protected long eMaxAmpereFlow = 0;//don't modify! unless YOU REALLY HAVE TO private long maxEUinputMin = 0, maxEUinputMax = 0; - public long eAmpereFlow = 1; - public long eRequiredData = 0; - protected long eAvailableData = 0; + + public long eAmpereFlow = 1; // analogue of EU/t but for amperes used (so eu/t is actually eu*A/t) USE ONLY POSITIVE NUMBERS! + + protected long eRequiredData = 0; // data required to operate + protected long eAvailableData = 0; // data being available private boolean explodedThisTick=false; @@ -101,13 +103,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //if you want to add checks that run periodically when machine works then make onRunningTick better //if you want to add checks that run periodically when machine is built then use check params - public boolean checkRecipe_EM(ItemStack itemStack) { + public boolean checkRecipe_EM(ItemStack itemStack, boolean noParametrizers) { return false; } // My code handles AMPS, if you want overclocking just modify mEUt and mMaxProgressTime, leave amps as usual! // Set mEUt, Efficiencies, required computation, time, check input etc. - public void updateParameters_EM() { + public void updateParameters_EM(boolean busy) { } // update status of parameters in guis and "machine state" // Called before check recipe, before outputting, and every second the machine is active @@ -196,19 +198,17 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_GENERAL, "Nothing special just override me." }; } //RATHER LEAVE ALONE Section - protected boolean EM_areChunksAroundLoaded(){ + protected boolean areChunksAroundLoaded_EM(){ if(isValidMetaTileEntity(this) && getBaseMetaTileEntity().isServerSide()){ IGregTechTileEntity base=getBaseMetaTileEntity(); - final int x=base.getXCoord(); - final int y=base.getYCoord(); - final int z=base.getZCoord(); - return base.getWorld().checkChunksExist(x-48,y-48,z-48,x+48,y+48,z+48); + return base.getWorld().doChunksNearChunkExist(base.getXCoord(),base.getYCoord(),base.getZCoord(),3); + //todo check if it is actually checking if chunks are loaded }else return false; } @@ -302,22 +302,27 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } NBTTagCompound paramI = new NBTTagCompound(); - for (int i = 0; i < 20; i++) - paramI.setFloat(Integer.toString(i), eParamsIn[i]); + for (int i = 0; i < iParamsIn.length; i++) + paramI.setInteger(Integer.toString(i), iParamsIn[i]); aNBT.setTag("eParamsIn", paramI); NBTTagCompound paramO = new NBTTagCompound(); - for (int i = 0; i < 20; i++) - paramO.setFloat(Integer.toString(i), eParamsOut[i]); + for (int i = 0; i < iParamsOut.length; i++) + paramO.setInteger(Integer.toString(i), iParamsOut[i]); aNBT.setTag("eParamsOut", paramO); + NBTTagCompound paramB = new NBTTagCompound(); + for (int i = 0; i < bParamsAreFloats.length; i++) + paramB.setBoolean(Integer.toString(i), bParamsAreFloats[i]); + aNBT.setTag("eParamsB", paramB); + NBTTagCompound paramIs = new NBTTagCompound(); - for (int i = 0; i < 20; i++) + for (int i = 0; i < eParamsInStatus.length; i++) paramIs.setByte(Integer.toString(i), eParamsInStatus[i]); aNBT.setTag("eParamsInS", paramIs); NBTTagCompound paramOs = new NBTTagCompound(); - for (int i = 0; i < 20; i++) + for (int i = 0; i < eParamsOutStatus.length; i++) paramOs.setByte(Integer.toString(i), eParamsOutStatus[i]); aNBT.setTag("eParamsOutS", paramOs); } @@ -371,12 +376,16 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } else outputEM = new cElementalInstanceStackMap[0]; NBTTagCompound paramI = aNBT.getCompoundTag("eParamsIn"); - for (int i = 0; i < eParamsIn.length; i++) - eParamsIn[i] = paramI.getFloat(Integer.toString(i)); + for (int i = 0; i < iParamsIn.length; i++) + iParamsIn[i] = paramI.getInteger(Integer.toString(i)); NBTTagCompound paramO = aNBT.getCompoundTag("eParamsOut"); - for (int i = 0; i < eParamsOut.length; i++) - eParamsOut[i] = paramO.getFloat(Integer.toString(i)); + for (int i = 0; i < iParamsOut.length; i++) + iParamsOut[i] = paramO.getInteger(Integer.toString(i)); + + NBTTagCompound paramB = aNBT.getCompoundTag("eParamsB"); + for (int i = 0; i < bParamsAreFloats.length; i++) + bParamsAreFloats[i] = paramB.getBoolean(Integer.toString(i)); NBTTagCompound paramIs = aNBT.getCompoundTag("eParamsInS"); for (int i = 0; i < eParamsInStatus.length; i++) @@ -395,6 +404,61 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return false; } + //Param methods + public final boolean isParametrizerUsingFloat(int hatchNo){ + return bParamsAreFloats[hatchNo]; + } + + public final double getParameterIn(int hatchNo, int paramID){ + return bParamsAreFloats[hatchNo]?Float.intBitsToFloat(iParamsIn[hatchNo+10*paramID]):iParamsIn[hatchNo+10*paramID]; + } + + public final int getParameterInInt(int hatchNo, int paramID){ + return iParamsIn[hatchNo+10*paramID]; + } + + public final float getParameterInFloat(int hatchNo, int paramID){ + return Float.intBitsToFloat(iParamsIn[hatchNo+10*paramID]); + } + + public final void setParameterOut(int hatchNo, int paramID, double value){ + if(bParamsAreFloats[hatchNo]) { + iParamsOut[hatchNo+10*paramID]=Float.floatToIntBits((float) value); + }else{ + iParamsOut[hatchNo+10*paramID]=(int)value; + } + } + + public final boolean setParameterOutInt(int hatchNo, int paramID, int value){ + if(bParamsAreFloats[hatchNo]) return false; + iParamsOut[hatchNo+10*paramID]=value; + return true; + } + + public final boolean setParameterOutFloat(int hatchNo, int paramID, float value){ + if(bParamsAreFloats[hatchNo]) { + iParamsOut[hatchNo + 10 * paramID] = Float.floatToIntBits(value); + return true; + } + return false; + } + + public final byte getStatusOfParameterIn(int hatchNo, int paramID){ + return eParamsInStatus[hatchNo+10*paramID]; + } + + public final void setStatusOfParameterIn(int hatchNo, int paramID, byte status){ + eParamsInStatus[hatchNo+10*paramID]=status; + } + + public final byte getStatusOfParameterOut(int hatchNo, int paramID){ + return eParamsOutStatus[hatchNo+10*paramID]; + } + + public final void setStatusOfParameterOut(int hatchNo, int paramID, byte status){ + eParamsOutStatus[hatchNo+10*paramID]=status; + } + @Override public final boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { return checkMachine_EM(iGregTechTileEntity, itemStack); @@ -473,7 +537,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]); if (!mMachine) { - if ((ePowerPass && getEUVar() > V[3]) || (eDismantleBoom && mMaxProgresstime > 0 && EM_areChunksAroundLoaded())) + if ((ePowerPass && getEUVar() > V[3]) || (eDismantleBoom && mMaxProgresstime > 0 && areChunksAroundLoaded_EM())) explodeMultiblock(); if (outputEM != null) for (cElementalInstanceStackMap tree : outputEM) @@ -527,8 +591,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) if (isValidMetaTileEntity(hatch)) hatch.getBaseMetaTileEntity().setActive(true); - for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) - if (isValidMetaTileEntity(hatch)) hatch.getBaseMetaTileEntity().setActive(true); + for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches){ + if (isValidMetaTileEntity(hatch)) { + hatch.getBaseMetaTileEntity().setActive(true); + if(hatch.param>=0) bParamsAreFloats[hatch.param]=hatch.isUsingFloats(); + } + } } else { maxEUinputMin = 0; maxEUinputMax = 0; @@ -578,7 +646,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt float remaining = voider.overflowMax - voider.getOverflowMatter(); for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { for (cElementalInstanceStack instance : in.getContainerHandler().values()) { - int qty = (int) Math.floor(remaining / instance.definition.getMass()); + long qty = (long) Math.floor(remaining / instance.definition.getMass()); if (qty > 0) { qty = Math.min(qty, instance.amount); if (voider.addOverflowMatter(instance.definition.getMass() * qty)) @@ -589,7 +657,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) { for (cElementalInstanceStack instance : out.getContainerHandler().values()) { - int qty = (int) Math.floor(remaining / instance.definition.getMass()); + long qty = (long)Math.floor(remaining / instance.definition.getMass()); if (qty > 0) { qty = Math.min(qty, instance.amount); if (voider.addOverflowMatter(instance.definition.getMass() * qty)) @@ -675,6 +743,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (aBaseMetaTileEntity.isAllowedToWork()) { if (checkRecipe(mInventory[1])) { mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); + }else { + mMaxProgresstime=0; } updateSlots(); } else notAllowedToWork_stopMachine_EM(); @@ -686,6 +756,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (aBaseMetaTileEntity.isAllowedToWork()) { if (checkRecipe(mInventory[1])) { mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); + }else { + mMaxProgresstime=0; } updateSlots(); } //else notAllowedToWork_stopMachine_EM(); //it is already stopped here @@ -742,17 +814,41 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public boolean onRunningTick(ItemStack aStack) { - if (eRequiredData > eAvailableData || - (this.mEUt < 0 && !this.drainEnergyInput_EM((long) (-this.mEUt) * getMaxEfficiency(aStack) / (long) Math.max(1000, this.mEfficiency), eAmpereFlow))) { - stopMachine(); + if (eRequiredData > eAvailableData) { + if(energyFlow(aStack,false)) + stopMachine(); return false; } - if (this.mEUt > 0) + return energyFlow(aStack,true); + } + + //new method + private boolean energyFlow(ItemStack aStack,boolean allowProduction) { + long temp = mEUt * eAmpereFlow;//quick scope sign + if (allowProduction && temp > 0) { this.addEnergyOutput_EM((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); + } else if (temp < 0) { + if (!this.drainEnergyInput_EM(mEUt,(long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, this.mEfficiency), eAmpereFlow)) { + stopMachine(); + return false; + } + } return true; } //region energy + public final boolean energyFlowWithoutEffieciencyComputation(int eu,long ampere) { + long temp = eu * ampere;//quick scope sign + if (temp > 0) { + this.addEnergyOutput_EM(eu, ampere); + } else if (temp < 0) { + if (!this.drainEnergyInput_EM(eu,eu, ampere)) { + stopMachine(); + return false; + } + } + return true; + } @Override public final long maxEUStore() { @@ -779,17 +875,23 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final boolean addEnergyOutput(long EU) { if (EU <= 0L) return true; for (GT_MetaTileEntity_Hatch tHatch : eDynamoMulti) - if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(EU, false)) - return true; + if (isValidMetaTileEntity(tHatch)){ + if(tHatch.maxEUOutput()<EU) explodeMultiblock(); + if(tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(EU, false)) + return true; + } for (GT_MetaTileEntity_Hatch tHatch : mDynamoHatches) - if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(EU, false)) - return true; + if (isValidMetaTileEntity(tHatch)){ + if(tHatch.maxEUOutput()<EU) explodeMultiblock(); + if(tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(EU, false)) + return true; + } return false; } - //new method - public final boolean addEnergyOutput_EM(long EU, long Amperes) { - if (EU <= 0L || Amperes <= 0) return true; + private boolean addEnergyOutput_EM(long EU, long Amperes) { + if(EU<0) EU=-EU; + if(Amperes<0) Amperes=-Amperes; long euVar = EU * Amperes; long diff; for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { @@ -830,37 +932,38 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final boolean drainEnergyInput(long EU) { if (EU <= 0L) return true; for (GT_MetaTileEntity_Hatch tHatch : eEnergyMulti) - if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) + if (isValidMetaTileEntity(tHatch) && tHatch.maxEUInput()>EU && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) return true; for (GT_MetaTileEntity_Hatch tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) + if (isValidMetaTileEntity(tHatch) && tHatch.maxEUInput()>EU && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) return true; return false; } - //new method - public final boolean drainEnergyInput_EM(long EU, long Amperes) { - if (EU <= 0L || Amperes <= 0) return true; - long euVar = EU * Amperes; - if (euVar > getEUVar() || - EU > maxEUinputMax || - (euVar - 1) / maxEUinputMin + 1 > eMaxAmpereFlow) {// euVar==0? --> (euVar - 1) / maxEUinputMin + 1 = 1! + private boolean drainEnergyInput_EM(long EUt, long EUtEff, long Amperes) { + if(EUt<0) EUt=-EUt; + if(EUtEff<0) EUtEff=-EUtEff; + if(Amperes<0) Amperes=-Amperes; + long EUuse = EUtEff * Amperes; + if (EUuse > getEUVar() || //not enough power + EUt > maxEUinputMax || //TIER IS BASED ON BEST HATCH! not total EUtEff input + ((EUt*Amperes) - 1) / maxEUinputMin + 1 > eMaxAmpereFlow) {// EUuse==0? --> (EUuse - 1) / maxEUinputMin + 1 = 1! //if not too much A if (DEBUG_MODE) { - TecTech.Logger.debug("L1 " + euVar + " " + getEUVar() + " " + (euVar > getEUVar())); - TecTech.Logger.debug("L2 " + EU + " " + maxEUinputMax + " " + (EU > maxEUinputMax)); - TecTech.Logger.debug("L3 " + euVar + " " + eMaxAmpereFlow); - TecTech.Logger.debug("L4 " + ((euVar - 1) / maxEUinputMin + 1) + " " + eMaxAmpereFlow + " " + ((euVar - 1) / maxEUinputMin + 1 > eMaxAmpereFlow)); + TecTech.Logger.debug("L1 " + EUuse + " " + getEUVar() + " " + (EUuse > getEUVar())); + TecTech.Logger.debug("L2 " + EUtEff + " " + maxEUinputMax + " " + (EUtEff > maxEUinputMax)); + TecTech.Logger.debug("L3 " + EUuse + " " + eMaxAmpereFlow); + TecTech.Logger.debug("L4 " + ((EUuse - 1) / maxEUinputMin + 1) + " " + eMaxAmpereFlow + " " + ((EUuse - 1) / maxEUinputMin + 1 > eMaxAmpereFlow)); } return false; } //sub eu - setEUVar(getEUVar() - euVar); + setEUVar(getEUVar() - EUuse); return true; } //new method - public final boolean overclockAndPutValuesIn_EM(long EU, int time) {//TODO rewise - if (EU == 0) { + public final boolean overclockAndPutValuesIn_EM(long EU, int time) {//TODO revise + if (EU == 0L) { mEUt = 0; mMaxProgresstime = time; return true; @@ -882,7 +985,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return true; }//Use in EM check recipe return statement if you want overclocking - @Override + @Override // same as gt sum of all hatches public final long getMaxInputVoltage() { long rVoltage = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) @@ -893,6 +996,16 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } //new Method + public final long getMaxInputEnergy(){ + long energy = 0; + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) + if (isValidMetaTileEntity(tHatch)) energy += tHatch.maxEUInput(); + for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) + if (isValidMetaTileEntity(tHatch)) energy += tHatch.maxEUInput() * tHatch.Amperes; + return energy; + } + + //new Method public final int getMaxEnergyInputTier_EM() { return Util.getTier(maxEUinputMax); } @@ -901,6 +1014,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final int getMinEnergyInputTier_EM() { return Util.getTier(maxEUinputMin); } + + public final long getMaxAmpereFlowAtMinTierOfEnergyHatches(){ + return eAmpereFlow; + } + //endregion //new Method @@ -997,20 +1115,37 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public final boolean checkRecipe(ItemStack itemStack) {//do recipe checks, based on "machine content and state" hatchesStatusUpdate_EM(); - return checkRecipe_EM(itemStack); + return checkRecipe_EM(itemStack, eParamHatches.size()==0); } private void hatchesStatusUpdate_EM() { - for (GT_MetaTileEntity_Hatch_Param param : eParamHatches) { - final int paramID = param.param; - if (paramID < 0) continue; - eParamsIn[paramID] = param.value1f; - eParamsIn[paramID + 10] = param.value2f; - param.input1f = eParamsOut[paramID]; - param.input2f = eParamsOut[paramID + 10]; + if(mMaxProgresstime==0) { + for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { + if (!isValidMetaTileEntity(hatch) || hatch.param < 0) continue; + final int paramID = hatch.param; + bParamsAreFloats[hatch.param] = hatch.isUsingFloats(); + iParamsIn[paramID] = hatch.value0i; + iParamsIn[paramID + 10] = hatch.value1i; + hatch.input0i = iParamsOut[paramID]; + hatch.input1i = iParamsOut[paramID + 10]; + } + }else {//write only + for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { + if (!isValidMetaTileEntity(hatch) || hatch.param < 0) continue; + final int paramID = hatch.param; + if(bParamsAreFloats[hatch.param] == hatch.isUsingFloats()){ + hatch.input0i = iParamsOut[paramID]; + hatch.input1i = iParamsOut[paramID + 10]; + }else if(hatch.isUsingFloats()){ + hatch.input0i = Float.floatToIntBits((float)iParamsOut[paramID]); + hatch.input1i = Float.floatToIntBits((float)iParamsOut[paramID + 10]); + }else { + hatch.input0i = (int)Float.intBitsToFloat(iParamsOut[paramID]); + hatch.input1i = (int)Float.intBitsToFloat(iParamsOut[paramID + 10]); + } + } } - updateParameters_EM(); - + updateParameters_EM(mMaxProgresstime>0); eAvailableData = getAvailableData_EM(); for (GT_MetaTileEntity_Hatch_Uncertainty uncertainty : eUncertainHatches) @@ -1035,18 +1170,14 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public final void explodeMultiblock() { if(explodedThisTick)return; - extraExplosions_EM(); - explodeMultiblock_EM(); explodedThisTick=true; - } - - private void explodeMultiblock_EM(){ if (!TecTech.ModConfig.BOOM_ENABLE) { TecTech.proxy.broadcast("Multi Explode BOOM! " + getBaseMetaTileEntity().getXCoord() + " " + getBaseMetaTileEntity().getYCoord() + " " + getBaseMetaTileEntity().getZCoord()); StackTraceElement[] ste = Thread.currentThread().getStackTrace(); TecTech.proxy.broadcast("Multi Explode BOOM! " + ste[2].toString()); return; } + extraExplosions_EM(); GT_Pollution.addPollution(getBaseMetaTileEntity(), 600000); mInventory[1] = null; for (MetaTileEntity tTileEntity : mInputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); @@ -1072,6 +1203,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public void doExplosion(long aExplosionPower) { explodeMultiblock(); + super.doExplosion(aExplosionPower); }//Redirecting to explodemultiblock @Override @@ -1093,7 +1225,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) hatch.getBaseMetaTileEntity().setActive(false); } - if ((ePowerPass && getEUVar()>V[3]) || (eDismantleBoom && mMaxProgresstime > 0 && EM_areChunksAroundLoaded())) explodeMultiblock(); + if ((ePowerPass && getEUVar()>V[3]) || (eDismantleBoom && mMaxProgresstime > 0 && areChunksAroundLoaded_EM())) explodeMultiblock(); if (outputEM != null) for (cElementalInstanceStackMap output : outputEM) if (output.hasStacks()) explodeMultiblock(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo index 72adab9050..b255c2013c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo @@ -22,3 +22,15 @@ BlockFakeLight.java for turrets: floodlightb + + + +fix eu/t checks if needs maintenance!!! + +make microwave grinder cap autosmelting based on power + + +iterative halflife formula: + +=prev qty* 2^(-t diff / t half) + diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java index 1d8c8f0525..f3f07a2149 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java @@ -92,7 +92,7 @@ public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements iConn @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "Advanced data transmission", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Don't stare at the beam!", EnumChatFormatting.AQUA + "Must be painted to work", diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java index 4089ff0be4..f8b5e5476d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java @@ -91,7 +91,7 @@ public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements iConnec @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_EM, "Quantum tunneling device.", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Not a portal!!!", EnumChatFormatting.AQUA + "Must be painted to work", diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPowerGenerator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPowerGenerator.java index b7589fbea0..cfb0794142 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPowerGenerator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPowerGenerator.java @@ -129,7 +129,7 @@ public class GT_MetaTileEntity_DebugPowerGenerator extends GT_MetaTileEntity_Tie @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_GENERAL, this.mDescription, EnumChatFormatting.BLUE + "Infinite Producer/Consumer", EnumChatFormatting.BLUE + "Since i wanted one..." diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java index c8d686e022..b78ea6e572 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java @@ -143,7 +143,7 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK, + CommonValues.TEC_MARK_GENERAL, this.mDescription, EnumChatFormatting.BLUE + "Prints Multiblock NonTE structure check code", EnumChatFormatting.BLUE + "ABC axises aligned to machine front" diff --git a/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java b/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java new file mode 100644 index 0000000000..faf251536f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java @@ -0,0 +1,695 @@ +package com.github.technus.tectech.thing.tileEntity; + +import com.github.technus.tectech.auxiliary.Reference; +import ic2.api.energy.event.EnergyTileUnloadEvent; +import ic2.core.IC2; +import ic2.core.block.reactor.tileentity.TileEntityNuclearReactorElectric; +import ic2.core.init.MainConfig; +import ic2.core.util.ConfigUtil; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by danie_000 on 30.09.2017. + */ +public class ReactorSimTileEntity extends TileEntityNuclearReactorElectric { + private boolean hadRedstone =true; + + public ReactorSimTileEntity() { + super(); + //this.updateTicker = IC2.random.nextInt(this.getTickRate()); + //this.inputTank = new FluidTank(10000); + //this.outputTank = new FluidTank(10000); + //this.reactorSlot = new InvSlotReactor(this, "reactor", 0, 54); + //this.coolantinputSlot = new InvSlotConsumableLiquidByList(this, "coolantinputSlot", 55, InvSlot.Access.I, 1, InvSlot.InvSide.ANY, InvSlotConsumableLiquid.OpType.Drain, BlocksItems.getFluid(InternalName.fluidCoolant)); + //this.hotcoolinputSlot = new InvSlotConsumableLiquidByTank(this, "hotcoolinputSlot", 56, InvSlot.Access.I, 1, InvSlot.InvSide.ANY, InvSlotConsumableLiquid.OpType.Fill, this.outputTank); + //this.coolantoutputSlot = new InvSlotOutput(this, "coolantoutputSlot", 57, 1); + //this.hotcoolantoutputSlot = new InvSlotOutput(this, "hotcoolantoutputSlot", 58, 1); + } + + @Override + public void onLoaded() { + super.onLoaded(); + if(IC2.platform.isSimulating() && this.addedToEnergyNet) { + MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); + //this.addedToEnergyNet = false; + } + } + + public void onUnloaded() { + addedToEnergyNet=false; + super.onUnloaded(); + } + + @Override + public String getInventoryName() { + return "Nuclear Reactor Simulator"; + } + + //public int gaugeHeatScaled(int i) { + // return i * this.heat / (this.maxHeat / 100 * 85); + //} + + //public void readFromNBT(NBTTagCompound nbttagcompound) { + // super.readFromNBT(nbttagcompound); + // //this.heat = nbttagcompound.getInteger("heat"); + // //this.inputTank.readFromNBT(nbttagcompound.getCompoundTag("inputTank")); + // //this.outputTank.readFromNBT(nbttagcompound.getCompoundTag("outputTank")); + // //this.output = (float)nbttagcompound.getShort("output"); + //} + + //public void writeToNBT(NBTTagCompound nbttagcompound) { + // super.writeToNBT(nbttagcompound); + // //NBTTagCompound inputTankTag = new NBTTagCompound(); + // //this.inputTank.writeToNBT(inputTankTag); + // //nbttagcompound.setTag("inputTank", inputTankTag); + // //NBTTagCompound outputTankTag = new NBTTagCompound(); + // //this.outputTank.writeToNBT(outputTankTag); + // //nbttagcompound.setTag("outputTank", outputTankTag); + // //nbttagcompound.setInteger("heat", this.heat); + // //nbttagcompound.setShort("output", (short)((int)this.getReactorEnergyOutput())); + //} + + //public void setRedstoneSignal(boolean redstone) { + // this.redstone = redstone; + //} + + //public void drawEnergy(double amount) { + //} + + //public float sendEnergy(float send) { + // return 0.0F; + //} + + @Override + public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction) { + return false; + } + + @Override + public double getOfferedEnergy() { + return 0; + } + + //public int getSourceTier() { + // return 4; + //} + + @Override + public double getReactorEUEnergyOutput() { + return (double)(this.getReactorEnergyOutput() * 5.0F * ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear")); + } + + //public List<TileEntity> getSubTiles() { + // if(this.subTiles == null) { + // this.subTiles = new ArrayList(); + // this.subTiles.add(this); + // Direction[] arr$ = Direction.directions; + // int len$ = arr$.length; + // + // for(int i$ = 0; i$ < len$; ++i$) { + // Direction dir = arr$[i$]; + // TileEntity te = dir.applyToTileEntity(this); + // if(te instanceof TileEntityReactorChamberElectric && !te.isInvalid()) { + // this.subTiles.add(te); + // } + // } + // } + // + // return this.subTiles; + //} + + //private void processfluidsSlots() { + // RecipeOutput outputinputSlot = this.processInputSlot(true); + // if(outputinputSlot != null) { + // this.processInputSlot(false); + // List<ItemStack> outputoutputSlot = outputinputSlot.items; + // this.coolantoutputSlot.add(outputoutputSlot); + // } + // + // RecipeOutput outputoutputSlot1 = this.processOutputSlot(true); + // if(outputoutputSlot1 != null) { + // this.processOutputSlot(false); + // List<ItemStack> processResult = outputoutputSlot1.items; + // this.hotcoolantoutputSlot.add(processResult); + // } + // + //} + + //public void refreshChambers() { + // if(this.addedToEnergyNet) { + // MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); + // } + // + // this.subTiles = null; + // if(this.addedToEnergyNet) { + // MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); + // } + // + //} + + @Override + protected void updateEntityServer() { + if(this.updateTicker++ % this.getTickRate() == 0) { + if (!worldObj.isRemote && this.worldObj.doChunksNearChunkExist(this.xCoord, this.yCoord, this.zCoord, 2)) { + if(hadRedstone && !receiveredstone()) hadRedstone=false; + else if(!hadRedstone && receiveredstone()){ + doUpdates(); + hadRedstone=true; + } + markDirty(); + } + } + } + + //public void dropAllUnfittingStuff() { + // int i; + // ItemStack stack; + // for(i = 0; i < this.reactorSlot.size(); ++i) { + // stack = this.reactorSlot.get(i); + // if(stack != null && !this.isUsefulItem(stack, false)) { + // this.reactorSlot.put(i, null); + // this.eject(stack); + // } + // } + // + // for(i = this.reactorSlot.size(); i < this.reactorSlot.rawSize(); ++i) { + // stack = this.reactorSlot.get(i); + // this.reactorSlot.put(i, null); + // this.eject(stack); + // } + // + //} + + //public boolean isUsefulItem(ItemStack stack, boolean forInsertion) { + // Item item = stack.getItem(); + // return (item instanceof IReactorComponent || (item == Ic2Items.TritiumCell.getItem() || item == Ic2Items.reactorDepletedUraniumSimple.getItem() || item == Ic2Items.reactorDepletedUraniumDual.getItem() || item == Ic2Items.reactorDepletedUraniumQuad.getItem() || item == Ic2Items.reactorDepletedMOXSimple.getItem() || item == Ic2Items.reactorDepletedMOXDual.getItem() || item == Ic2Items.reactorDepletedMOXQuad.getItem())); + //} + + //public void eject(ItemStack drop) { + // if(IC2.platform.isSimulating() && drop != null) { + // float f = 0.7F; + // double d = (double)(this.worldObj.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + // double d1 = (double)(this.worldObj.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + // double d2 = (double)(this.worldObj.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + // EntityItem entityitem = new EntityItem(this.worldObj, (double)this.xCoord + d, (double)this.yCoord + d1, (double)this.zCoord + d2, drop); + // entityitem.delayBeforeCanPickup = 10; + // this.worldObj.spawnEntityInWorld(entityitem); + // } + //} + + @Override + public boolean calculateHeatEffects() { + if(this.heat >= 4000 && IC2.platform.isSimulating()) { + float power = (float)this.heat / (float)this.maxHeat; + if(power >= 1.0F) { + this.explode();//ding + return true; + } else { + //int[] coord; + //Block block; + //Material mat; + //if(power >= 0.85F && this.worldObj.rand.nextFloat() <= 0.2F * this.hem) { + // coord = this.getRandCoord(2); + // if(coord != null) { + // block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + // if(block.isAir(this.worldObj, coord[0], coord[1], coord[2])) { + // this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); + // } else if(block.getBlockHardness(this.worldObj, coord[0], coord[1], coord[2]) >= 0.0F && this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null) { + // mat = block.getMaterial(); + // if(mat != Material.rock && mat != Material.iron && mat != Material.lava && mat != Material.ground && mat != Material.clay) { + // this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); + // } else { + // this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.flowing_lava, 15, 7); + // } + // } + // } + //} + // + //if(power >= 0.7F) { + // List var5 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox((double)(this.xCoord - 3), (double)(this.yCoord - 3), (double)(this.zCoord - 3), (double)(this.xCoord + 4), (double)(this.yCoord + 4), (double)(this.zCoord + 4))); + // + // for(int var6 = 0; var6 < var5.size(); ++var6) { + // Entity var7 = (Entity)var5.get(var6); + // var7.attackEntityFrom(IC2DamageSource.radiation, (float)((int)((float)this.worldObj.rand.nextInt(4) * this.hem))); + // } + //} + // + //if(power >= 0.5F && this.worldObj.rand.nextFloat() <= this.hem) { + // coord = this.getRandCoord(2); + // if(coord != null) { + // block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + // if(block.getMaterial() == Material.water) { + // this.worldObj.setBlockToAir(coord[0], coord[1], coord[2]); + // } + // } + //} + // + //if(power >= 0.4F && this.worldObj.rand.nextFloat() <= this.hem) { + // coord = this.getRandCoord(2); + // if(coord != null && this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null) { + // block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + // mat = block.getMaterial(); + // if(mat == Material.wood || mat == Material.leaves || mat == Material.cloth) { + // this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); + // } + // } + //} + return false; + } + } + return false; + } + + //public int[] getRandCoord(int radius) { + // if(radius <= 0) { + // return null; + // } else { + // int[] c = new int[]{this.xCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius, this.yCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius, this.zCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius}; + // return c[0] == this.xCoord && c[1] == this.yCoord && c[2] == this.zCoord?null:c; + // } + //} + + //public void processChambers() { + // short size = this.getReactorSize(); + // + // for(int pass = 0; pass < 2; ++pass) { + // for(int y = 0; y < 6; ++y) { + // for(int x = 0; x < size; ++x) { + // ItemStack stack = this.reactorSlot.get(x, y); + // if(stack != null && stack.getItem() instanceof IReactorComponent) { + // IReactorComponent comp = (IReactorComponent)stack.getItem(); + // comp.processChamber(this, stack, x, y, pass == 0); + // } + // } + // } + // } + // + //} + + //public boolean produceEnergy() { + // return this.receiveredstone() && ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/generator") > 0.0F; + //} + + //NO need + //public boolean receiveredstone() { + // return this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord) || this.redstone; + //} + + //public short getReactorSize() { + // if(this.worldObj == null) { + // return 9; + // } else { + // short cols = 3; + // Direction[] arr$ = Direction.directions; + // int len$ = arr$.length; + // + // for(int i$ = 0; i$ < len$; ++i$) { + // Direction direction = arr$[i$]; + // TileEntity target = direction.applyToTileEntity(this); + // if(target instanceof TileEntityReactorChamberElectric) { + // ++cols; + // } + // } + // + // return cols; + // } + //} + + //public int getTickRate() { + // return 20; + //} + + //public ContainerBase<TileEntityNuclearReactorElectric> getGuiContainer(EntityPlayer entityPlayer) { + // return new ContainerNuclearReactor(entityPlayer, this); + //} + + //@SideOnly(Side.CLIENT) + //public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin) { + // return new GuiNuclearReactor(new ContainerNuclearReactor(entityPlayer, this)); + //} + + //public void onGuiClosed(EntityPlayer entityPlayer) {} + + //new method + private void doUpdates(){ + heat=0; + do{ + dropAllUnfittingStuff(); + output = 0.0F; + maxHeat = 10000; + hem = 1.0F; + processChambers(); + }while(!calculateHeatEffects() && output>0); + } + + //region no need to change + //public void onNetworkUpdate(String field) { + // if(field.equals("output")) { + // if(this.output > 0.0F) { + // if(this.lastOutput <= 0.0F) { + // if(this.audioSourceMain == null) { + // this.audioSourceMain = IC2.audioManager.createSource(this, PositionSpec.Center, "Generators/NuclearReactor/NuclearReactorLoop.ogg", true, false, IC2.audioManager.getDefaultVolume()); + // } + // + // if(this.audioSourceMain != null) { + // this.audioSourceMain.play(); + // } + // } + // + // if(this.output < 40.0F) { + // if(this.lastOutput <= 0.0F || this.lastOutput >= 40.0F) { + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.remove(); + // } + // + // this.audioSourceGeiger = IC2.audioManager.createSource(this, PositionSpec.Center, "Generators/NuclearReactor/GeigerLowEU.ogg", true, false, IC2.audioManager.getDefaultVolume()); + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.play(); + // } + // } + // } else if(this.output < 80.0F) { + // if(this.lastOutput < 40.0F || this.lastOutput >= 80.0F) { + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.remove(); + // } + // + // this.audioSourceGeiger = IC2.audioManager.createSource(this, PositionSpec.Center, "Generators/NuclearReactor/GeigerMedEU.ogg", true, false, IC2.audioManager.getDefaultVolume()); + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.play(); + // } + // } + // } else if(this.output >= 80.0F && this.lastOutput < 80.0F) { + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.remove(); + // } + // + // this.audioSourceGeiger = IC2.audioManager.createSource(this, PositionSpec.Center, "Generators/NuclearReactor/GeigerHighEU.ogg", true, false, IC2.audioManager.getDefaultVolume()); + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.play(); + // } + // } + // } else if(this.lastOutput > 0.0F) { + // if(this.audioSourceMain != null) { + // this.audioSourceMain.stop(); + // } + // + // if(this.audioSourceGeiger != null) { + // this.audioSourceGeiger.stop(); + // } + // } + // + // this.lastOutput = this.output; + // } + // + // super.onNetworkUpdate(field); + //} + + //public float getWrenchDropRate() { + // return 1F; + //} + + //public ChunkCoordinates getPosition() { + // return new ChunkCoordinates(this.xCoord, this.yCoord, this.zCoord); + //} + + //public World getWorld() { + // return this.worldObj; + //} + + //public int getHeat() { + // return this.heat; + //} + + //public void setHeat(int heat1) { + // this.heat = heat1; + //} + + //public int addHeat(int amount) { + // this.heat += amount; + // return this.heat; + //} + + //public ItemStack getItemAt(int x, int y) { + // return x >= 0 && x < this.getReactorSize() && y >= 0 && y < 6?this.reactorSlot.get(x, y):null; + //} + + //public void setItemAt(int x, int y, ItemStack item) { + // if(x >= 0 && x < this.getReactorSize() && y >= 0 && y < 6) { + // this.reactorSlot.put(x, y, item); + // } + //} + + @Override + public void explode() { + getWorld().playSoundEffect(xCoord,yCoord,zCoord, Reference.MODID+":microwave_ding", 1, 1); + } + + @Override + public void addEmitHeat(int heat) {} + + //region no need + //public int getMaxHeat() { + // return this.maxHeat; + //} + + //public void setMaxHeat(int newMaxHeat) { + // this.maxHeat = newMaxHeat; + //} + + //public float getHeatEffectModifier() { + // return this.hem; + //} + + //public void setHeatEffectModifier(float newHEM) { + // this.hem = newHEM; + //} + + //public float getReactorEnergyOutput() { + // return this.output; + //} + + //public float addOutput(float energy) { + // return this.output += energy; + //} + + //PRIVATE not used + //private RecipeOutput processInputSlot(boolean simulate) { + // if(!this.coolantinputSlot.isEmpty()) { + // MutableObject output = new MutableObject(); + // if(this.coolantinputSlot.transferToTank(this.inputTank, output, simulate) && (output.getValue() == null || this.coolantoutputSlot.canAdd((ItemStack)output.getValue()))) { + // if(output.getValue() == null) { + // return new RecipeOutput(null); + // } + // + // return new RecipeOutput(null, (ItemStack)output.getValue()); + // } + // } + // + // return null; + //} + + //private RecipeOutput processOutputSlot(boolean simulate) { + // if(!this.hotcoolinputSlot.isEmpty()) { + // MutableObject output = new MutableObject(); + // if(this.hotcoolinputSlot.transferFromTank(this.outputTank, output, simulate) && (output.getValue() == null || this.hotcoolantoutputSlot.canAdd((ItemStack)output.getValue()))) { + // if(output.getValue() == null) { + // return new RecipeOutput(null); + // } + // + // return new RecipeOutput(null, (ItemStack)output.getValue()); + // } + // } + // + // return null; + //} + + @Override + public boolean isFluidCooled() { + return false; + } + + //!!!Private - removed use cases + //private void movefluidinWorld(boolean out) { + // if(out) { + // if(this.inputTank.getFluidAmount() < 1000 && this.outputTank.getFluidAmount() < 1000) { + // this.inputTank.setFluid(null); + // this.outputTank.setFluid(null); + // } else { + // for(int coolantFluid = 1; coolantFluid < 4; ++coolantFluid) { + // for(int coolantBlock = 1; coolantBlock < 4; ++coolantBlock) { + // for(int hotCoolantFluid = 1; hotCoolantFluid < 4; ++hotCoolantFluid) { + // if(this.surroundings[coolantBlock][coolantFluid][hotCoolantFluid] instanceof BlockAir) { + // if(this.inputTank.getFluidAmount() >= 1000) { + // this.worldObj.setBlock(coolantBlock + this.xCoord - 2, coolantFluid + this.yCoord - 2, hotCoolantFluid + this.zCoord - 2, this.inputTank.getFluid().getFluid().getBlock()); + // this.inputTank.drain(1000, true); + // } else if(this.outputTank.getFluidAmount() >= 1000) { + // this.worldObj.setBlock(coolantBlock + this.xCoord - 2, coolantFluid + this.yCoord - 2, hotCoolantFluid + this.zCoord - 2, this.outputTank.getFluid().getFluid().getBlock()); + // this.outputTank.drain(1000, true); + // } + // } + // } + // } + // } + // + // if(this.inputTank.getFluidAmount() < 1000) { + // this.inputTank.setFluid(null); + // } + // + // if(this.outputTank.getFluidAmount() < 1000) { + // this.outputTank.setFluid(null); + // } + // } + // } else { + // Fluid var9 = BlocksItems.getFluid(InternalName.fluidCoolant); + // Block var10 = BlocksItems.getFluidBlock(InternalName.fluidCoolant); + // Fluid var11 = BlocksItems.getFluid(InternalName.fluidHotCoolant); + // Block hotCoolantBlock = BlocksItems.getFluidBlock(InternalName.fluidHotCoolant); + // + // for(int yoffset = 1; yoffset < 4; ++yoffset) { + // for(int xoffset = 1; xoffset < 4; ++xoffset) { + // for(int zoffset = 1; zoffset < 4; ++zoffset) { + // if(this.surroundings[xoffset][yoffset][zoffset] == var10) { + // this.worldObj.setBlock(xoffset + this.xCoord - 2, yoffset + this.yCoord - 2, zoffset + this.zCoord - 2, Blocks.air); + // this.inputTank.fill(new FluidStack(var9, 1000), true); + // } else if(this.surroundings[xoffset][yoffset][zoffset] == hotCoolantBlock) { + // this.worldObj.setBlock(xoffset + this.xCoord - 2, yoffset + this.yCoord - 2, zoffset + this.zCoord - 2, Blocks.air); + // this.outputTank.fill(new FluidStack(var11, 1000), true); + // } + // } + // } + // } + // } + // + //} + + //!!!! PRIVATE - removed use cases + //private boolean readyforpressurizedreactor() { + // Block coolantBlock = BlocksItems.getFluidBlock(InternalName.fluidCoolant); + // Block hotCoolantBlock = BlocksItems.getFluidBlock(InternalName.fluidHotCoolant); + // + // int xoffset; + // int yoffset; + // int zoffset; + // for(xoffset = -2; xoffset < 3; ++xoffset) { + // for(yoffset = -2; yoffset < 3; ++yoffset) { + // for(zoffset = -2; zoffset < 3; ++zoffset) { + // if(this.worldObj.isAirBlock(xoffset + this.xCoord, yoffset + this.yCoord, zoffset + this.zCoord)) { + // this.surroundings[xoffset + 2][yoffset + 2][zoffset + 2] = Blocks.air; + // } else { + // Block block = this.worldObj.getBlock(xoffset + this.xCoord, yoffset + this.yCoord, zoffset + this.zCoord); + // if((block == coolantBlock || block == hotCoolantBlock) && this.worldObj.getBlockMetadata(xoffset + this.xCoord, yoffset + this.yCoord, zoffset + this.zCoord) != 0) { + // this.surroundings[xoffset + 2][yoffset + 2][zoffset + 2] = Blocks.air; + // } else { + // this.surroundings[xoffset + 2][yoffset + 2][zoffset + 2] = block; + // } + // } + // } + // } + // } + // + // for(xoffset = 1; xoffset < 4; ++xoffset) { + // for(yoffset = 1; yoffset < 4; ++yoffset) { + // for(zoffset = 1; zoffset < 4; ++zoffset) { + // if(!(this.surroundings[xoffset][yoffset][zoffset] instanceof BlockGenerator) && !(this.surroundings[xoffset][yoffset][zoffset] instanceof BlockReactorChamber) && this.surroundings[xoffset][yoffset][zoffset] != coolantBlock && this.surroundings[xoffset][yoffset][zoffset] != hotCoolantBlock && !(this.surroundings[xoffset][yoffset][zoffset] instanceof BlockAir)) { + // return false; + // } + // } + // } + // } + // + // for(xoffset = 0; xoffset < 5; ++xoffset) { + // for(yoffset = 0; yoffset < 5; ++yoffset) { + // if(!(this.surroundings[xoffset][4][yoffset] instanceof BlockReactorVessel) && !(this.surroundings[xoffset][4][yoffset] instanceof BlockReactorAccessHatch) && !(this.surroundings[xoffset][4][yoffset] instanceof BlockReactorRedstonePort) && !(this.surroundings[xoffset][4][yoffset] instanceof BlockReactorFluidPort)) { + // return false; + // } + // + // if(!(this.surroundings[xoffset][0][yoffset] instanceof BlockReactorVessel) && !(this.surroundings[xoffset][0][yoffset] instanceof BlockReactorAccessHatch) && !(this.surroundings[xoffset][0][yoffset] instanceof BlockReactorRedstonePort) && !(this.surroundings[xoffset][0][yoffset] instanceof BlockReactorFluidPort)) { + // return false; + // } + // + // if(!(this.surroundings[0][xoffset][yoffset] instanceof BlockReactorVessel) && !(this.surroundings[0][xoffset][yoffset] instanceof BlockReactorAccessHatch) && !(this.surroundings[0][xoffset][yoffset] instanceof BlockReactorRedstonePort) && !(this.surroundings[0][xoffset][yoffset] instanceof BlockReactorFluidPort)) { + // return false; + // } + // + // if(!(this.surroundings[4][xoffset][yoffset] instanceof BlockReactorVessel) && !(this.surroundings[4][xoffset][yoffset] instanceof BlockReactorAccessHatch) && !(this.surroundings[4][xoffset][yoffset] instanceof BlockReactorRedstonePort) && !(this.surroundings[4][xoffset][yoffset] instanceof BlockReactorFluidPort)) { + // return false; + // } + // + // if(!(this.surroundings[yoffset][xoffset][0] instanceof BlockReactorVessel) && !(this.surroundings[yoffset][xoffset][0] instanceof BlockReactorAccessHatch) && !(this.surroundings[yoffset][xoffset][0] instanceof BlockReactorRedstonePort) && !(this.surroundings[yoffset][xoffset][0] instanceof BlockReactorFluidPort)) { + // return false; + // } + // + // if(!(this.surroundings[yoffset][xoffset][4] instanceof BlockReactorVessel) && !(this.surroundings[yoffset][xoffset][4] instanceof BlockReactorAccessHatch) && !(this.surroundings[yoffset][xoffset][4] instanceof BlockReactorRedstonePort) && !(this.surroundings[yoffset][xoffset][4] instanceof BlockReactorFluidPort)) { + // return false; + // } + // } + // } + // + // return true; + //} + + //public int gaugeLiquidScaled(int i, int tank) { + // switch(tank) { + // case 0: + // if(this.inputTank.getFluidAmount() <= 0) { + // return 0; + // } + // + // return this.inputTank.getFluidAmount() * i / this.inputTank.getCapacity(); + // case 1: + // if(this.outputTank.getFluidAmount() <= 0) { + // return 0; + // } + // + // return this.outputTank.getFluidAmount() * i / this.outputTank.getCapacity(); + // default: + // return 0; + // } + //} + + //public FluidTank getinputtank() { + // return this.inputTank; + //} + + //public FluidTank getoutputtank() { + // return this.outputTank; + //} + + //public FluidTankInfo[] getTankInfo(ForgeDirection from) { + // return new FluidTankInfo[]{this.inputTank.getInfo(), this.outputTank.getInfo()}; + //} + + @Override + public boolean canFill(ForgeDirection from, Fluid fluid) { + return false; + } + + @Override + public boolean canDrain(ForgeDirection from, Fluid fluid) { + return false; + } + + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { + return 0; + } + + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { + return null; + } + + @Override + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { + return null; + } + + @Override + public int getInventoryStackLimit() { + return 1; + } +} diff --git a/src/main/java/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java b/src/main/java/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java index 3b60922248..c7b3b547c0 100644 --- a/src/main/java/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java +++ b/src/main/java/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java @@ -19,7 +19,7 @@ public class TurretBaseItemEM extends ItemBlock { } public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) { - list.add(CommonValues.TEC_MARK); + list.add(CommonValues.TEC_MARK_EM); list.add(""); list.add(EnumChatFormatting.AQUA + "--" + StatCollector.translateToLocal("tooptip.energy.label") + "--"); list.add(StatCollector.translateToLocal("tooltip.rf.max") + ": " + EnumChatFormatting.WHITE + 1000000000); diff --git a/src/main/java/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java b/src/main/java/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java index c728f30db0..742e7b94fe 100644 --- a/src/main/java/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java +++ b/src/main/java/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java @@ -11,7 +11,7 @@ import openmodularturrets.handler.ConfigHandler; import java.text.DecimalFormat; import java.util.List; -import static com.github.technus.tectech.CommonValues.TEC_MARK; +import static com.github.technus.tectech.CommonValues.TEC_MARK_EM; /** * Created by Bass on 28/07/2017. @@ -24,7 +24,7 @@ public class TurretHeadItemEM extends ItemBlock { } public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) { - list.add(TEC_MARK); + list.add(TEC_MARK_EM); list.add(""); list.add(EnumChatFormatting.GOLD + "--" + StatCollector.translateToLocal("tooltip.info") + "--"); list.add(StatCollector.translateToLocal("tooltip.tier") + ": " + EnumChatFormatting.WHITE + "5"); diff --git a/src/main/java/openmodularturrets/entity/projectiles/projectileEM.java b/src/main/java/openmodularturrets/entity/projectiles/projectileEM.java index ba9eb00dd9..e857d748e7 100644 --- a/src/main/java/openmodularturrets/entity/projectiles/projectileEM.java +++ b/src/main/java/openmodularturrets/entity/projectiles/projectileEM.java @@ -1,10 +1,10 @@ package openmodularturrets.entity.projectiles; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; -import com.github.technus.tectech.elementalMatter.definitions.dHadronDefinition; -import com.github.technus.tectech.elementalMatter.definitions.eQuarkDefinition; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.elementalMatter.definitions.complex.hadron.dHadronDefinition; +import com.github.technus.tectech.elementalMatter.definitions.primitive.eQuarkDefinition; import gregtech.api.GregTech_API; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; diff --git a/src/main/java/openmodularturrets/tileentity/turret/TileTurretHeadEM.java b/src/main/java/openmodularturrets/tileentity/turret/TileTurretHeadEM.java index 277d692f47..343a1e5ebd 100644 --- a/src/main/java/openmodularturrets/tileentity/turret/TileTurretHeadEM.java +++ b/src/main/java/openmodularturrets/tileentity/turret/TileTurretHeadEM.java @@ -1,7 +1,7 @@ package openmodularturrets.tileentity.turret; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; -import com.github.technus.tectech.thing.item.DebugContainer_EM; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -54,7 +54,7 @@ public class TileTurretHeadEM extends TurretHead{ } public Item getAmmo() { - return DebugContainer_EM.INSTANCE;//Placeholder item that cannot be achieved, yet still usable for debug + return DebugElementalInstanceContainer_EM.INSTANCE;//Placeholder item that cannot be achieved, yet still usable for debug } public final TurretProjectile createProjectile(World world, Entity target, ItemStack ammo) { diff --git a/src/main/java/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java b/src/main/java/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java index f5d22be3ed..acecfb4a37 100644 --- a/src/main/java/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java +++ b/src/main/java/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java @@ -1,6 +1,6 @@ package openmodularturrets.tileentity.turretbase; -import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import cpw.mods.fml.common.Optional; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; |