diff options
author | Tec <daniel112092@gmail.com> | 2022-02-02 17:52:12 +0100 |
---|---|---|
committer | Tec <daniel112092@gmail.com> | 2022-02-02 17:55:11 +0100 |
commit | b4530cdb125cfdea042b1af9622bf554029c8800 (patch) | |
tree | 552858f821e46fc70f1c03010c9efcec63b65105 /src/main | |
parent | 091b97f7cc183f43fa03049f29e3bd985458e754 (diff) | |
parent | 719fdf6f550c0ab9c69eedefed55aefbf5a07187 (diff) | |
download | GT5-Unofficial-b4530cdb125cfdea042b1af9622bf554029c8800.tar.gz GT5-Unofficial-b4530cdb125cfdea042b1af9622bf554029c8800.tar.bz2 GT5-Unofficial-b4530cdb125cfdea042b1af9622bf554029c8800.zip |
Merge branch 'develop' into OrbitalAffinity
# Conflicts:
# src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java
Diffstat (limited to 'src/main')
286 files changed, 17077 insertions, 13732 deletions
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 79defc0a1a..1248437e30 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -2,6 +2,8 @@ package com.github.technus.tectech; import com.github.technus.tectech.loader.MainLoader; import com.github.technus.tectech.loader.TecTechConfig; +import com.github.technus.tectech.loader.gui.CreativeTabTecTech; +import com.github.technus.tectech.loader.gui.CreativeTabEM; import com.github.technus.tectech.mechanics.anomaly.AnomalyHandler; import com.github.technus.tectech.mechanics.anomaly.CancerCommand; import com.github.technus.tectech.mechanics.anomaly.ChargeCommand; @@ -9,9 +11,12 @@ import com.github.technus.tectech.mechanics.commands.ConvertFloat; import com.github.technus.tectech.mechanics.commands.ConvertInteger; import com.github.technus.tectech.mechanics.data.ChunkDataHandler; import com.github.technus.tectech.mechanics.data.PlayerPersistence; -import com.github.technus.tectech.mechanics.elementalMatter.core.commands.GiveEM; -import com.github.technus.tectech.mechanics.elementalMatter.core.commands.ListEM; +import com.github.technus.tectech.mechanics.elementalMatter.core.commands.EMGive; +import com.github.technus.tectech.mechanics.elementalMatter.core.commands.EMList; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.proxy.CommonProxy; +import com.github.technus.tectech.util.XSTR; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; @@ -30,8 +35,12 @@ import java.util.Iterator; import static com.github.technus.tectech.loader.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;") +@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:structurelib;" + + "after:ComputerCraft;" + "after:OpenComputers;" + + "required-after:gregtech;" + "after:dreamcraft;" + + "after:appliedenergistics2;" + "after:CoFHCore;" + "after:Thaumcraft;") public class TecTech { @SidedProxy(clientSide = Reference.CLIENTSIDE, serverSide = Reference.SERVERSIDE) public static CommonProxy proxy; @@ -39,22 +48,27 @@ public class TecTech { @Mod.Instance(Reference.MODID) public static TecTech instance; - public static final XSTR RANDOM = XSTR.XSTR_INSTANCE; - public static final LogHelper LOGGER = new LogHelper(Reference.MODID); + public static final XSTR RANDOM = XSTR.XSTR_INSTANCE; + public static final LogHelper LOGGER = new LogHelper(Reference.MODID); + public static CreativeTabTecTech creativeTabTecTech; + public static CreativeTabEM creativeTabEM; private static IngameErrorLog moduleAdminErrorLogs; - public static TecTechConfig configTecTech; + public static TecTechConfig configTecTech; - public static ChunkDataHandler chunkDataHandler; - public static AnomalyHandler anomalyHandler; + public static ChunkDataHandler chunkDataHandler; + public static AnomalyHandler anomalyHandler; public static PlayerPersistence playerPersistence; + public static final EMDefinitionsRegistry definitionsRegistry = new EMDefinitionsRegistry(); + public static final EMTransformationRegistry transformationInfo = new EMTransformationRegistry(); + /** * For Loader.isModLoaded checks during the runtime */ public static boolean hasCOFH = false; - public static final byte tectechTexturePage1=8; + public static final byte tectechTexturePage1 = 8; public static void AddLoginError(String pMessage) { if (moduleAdminErrorLogs != null) { @@ -77,17 +91,17 @@ public class TecTech { LOGGER.error(Reference.MODID + " could not load its config file. Things are going to be weird!"); } - if (configTecTech.modAdminErrorLogs) { + if (configTecTech.MOD_ADMIN_ERROR_LOGS) { LOGGER.setDebugOutput(DEBUG_MODE); LOGGER.debug("moduleAdminErrorLogs is enabled"); moduleAdminErrorLogs = new IngameErrorLog(); } - playerPersistence=new PlayerPersistence("tec"); + playerPersistence = new PlayerPersistence("tec"); FMLCommonHandler.instance().bus().register(playerPersistence); MinecraftForge.EVENT_BUS.register(playerPersistence); - chunkDataHandler=new ChunkDataHandler(); + chunkDataHandler = new ChunkDataHandler(); FMLCommonHandler.instance().bus().register(chunkDataHandler); MinecraftForge.EVENT_BUS.register(chunkDataHandler); @@ -98,15 +112,14 @@ public class TecTech { public void Load(FMLInitializationEvent event) { hasCOFH = Loader.isModLoaded(Reference.COFHCORE); - - if(configTecTech.DISABLE_MATERIAL_LOADING_FFS){ + if (configTecTech.DISABLE_MATERIAL_LOADING_FFS) { try { - Field modifiersField = Field.class.getDeclaredField( "modifiers" ); - modifiersField.setAccessible( true ); - Field field= GT_Proxy.class.getDeclaredField("mEvents"); + Field modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + Field field = GT_Proxy.class.getDeclaredField("mEvents"); field.setAccessible(true); - modifiersField.setInt( field, field.getModifiers() & ~Modifier.FINAL ); - field.set(GT_Mod.gregtechproxy, new Collection() { + modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); + field.set(GT_Mod.gregtechproxy, new Collection<Object>() { @Override public int size() { return 0; @@ -123,8 +136,8 @@ public class TecTech { } @Override - public Iterator iterator() { - return new Iterator() { + public Iterator<Object> iterator() { + return new Iterator<Object>() { @Override public boolean hasNext() { return false; @@ -188,24 +201,24 @@ public class TecTech { } - MainLoader.load(); + MainLoader.load(definitionsRegistry); MainLoader.addAfterGregTechPostLoadRunner(); } @Mod.EventHandler public void PostLoad(FMLPostInitializationEvent PostEvent) { - MainLoader.postLoad(); + MainLoader.postLoad(definitionsRegistry, transformationInfo); - chunkDataHandler.registerChunkMetaDataHandler(anomalyHandler=new AnomalyHandler()); + chunkDataHandler.registerChunkMetaDataHandler(anomalyHandler = new AnomalyHandler()); } @Mod.EventHandler public void serverLoad(FMLServerStartingEvent pEvent) { pEvent.registerServerCommand(new ConvertInteger()); pEvent.registerServerCommand(new ConvertFloat()); - pEvent.registerServerCommand(new ListEM()); - if(DEBUG_MODE) { - pEvent.registerServerCommand(new GiveEM()); + pEvent.registerServerCommand(new EMList()); + if (DEBUG_MODE) { + pEvent.registerServerCommand(new EMGive()); pEvent.registerServerCommand(new CancerCommand()); pEvent.registerServerCommand(new ChargeCommand()); } diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java deleted file mode 100644 index 5bd3ff59a9..0000000000 --- a/src/main/java/com/github/technus/tectech/Util.java +++ /dev/null @@ -1,1640 +0,0 @@ -package com.github.technus.tectech; - -import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.metaTileEntity.IFrontRotation; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.ObfuscationReflectionHelper; -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ICrafting; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.ChunkCoordIntPair; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.storage.IPlayerFileData; -import net.minecraft.world.storage.SaveHandler; -import net.minecraftforge.fluids.FluidStack; -import org.apache.commons.lang3.StringUtils; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.lang.reflect.Field; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static gregtech.api.enums.GT_Values.E; -import static java.nio.charset.Charset.forName; - -/** - * Created by Tec on 21.03.2017. - */ -public final class Util { - private Util() { - } - - @SuppressWarnings("ComparatorMethodParameterNotUsed") - public static <K, V extends Comparable<? super V>> SortedSet<Map.Entry<K, V>> entriesSortedByValues(Map<K, V> map) { - SortedSet<Map.Entry<K, V>> sortedEntries = new TreeSet<>( - (e1, e2) -> { - int res = e1.getValue().compareTo(e2.getValue()); - return res != 0 ? res : 1; // Special fix to preserve items with equal values - } - ); - sortedEntries.addAll(map.entrySet()); - return sortedEntries; - } - - public static int bitStringToInt(String bits){ - if(bits==null){ - return 0; - } - if(bits.length() > 32){ - throw new NumberFormatException("Too long!"); - } - return Integer.parseInt(bits,2); - } - - public static int hexStringToInt(String hex){ - if(hex==null){ - return 0; - } - if(hex.length()>8){ - throw new NumberFormatException("Too long!"); - } - return Integer.parseInt(hex,16); - } - - public static double stringToDouble(String str){ - if(str==null){ - return 0; - } - return Double.parseDouble(str); - } - - public static double getValue(String in1) { - String str = in1.toLowerCase(); - double val; - try { - if (str.contains("b")) { - String[] split = str.split("b"); - val = Util.bitStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_", "")); - } else if (str.contains("x")) { - String[] split = str.split("x"); - val = Util.hexStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_", "")); - } else { - val = Util.stringToDouble(str); - } - return val; - } catch (Exception e) { - return 0; - } - } - - - public static String intBitsToString(int number) { - StringBuilder result = new StringBuilder(16); - - for (int i = 31; i >= 0; i--) { - int mask = 1 << i; - result.append((number & mask) != 0 ? "1" : "0"); - - if (i % 8 == 0) { - result.append(' '); - } - } - result.replace(result.length() - 1, result.length(), ""); - - return result.toString(); - } - - public static String intBitsToShortString(int number) { - StringBuilder result = new StringBuilder(35); - - 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(); - } - - public static String longBitsToShortString(long number) { - StringBuilder result = new StringBuilder(71); - - for (int i = 63; i >= 0; i--) { - long mask = 1L << i; - result.append((number & mask) != 0 ? ":" : "."); - - if (i % 8 == 0) { - result.append('|'); - } - } - result.replace(result.length() - 1, result.length(), ""); - - return result.toString(); - } - - public static float map(float x, float in_min, float in_max, float out_min, float out_max) { - return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; - } - - //region junk - /* - //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 - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, - boolean forceCheck) { - World world = aBaseMetaTileEntity.getWorld(); - if (world.isRemote) { - return false; - } - //TE Rotation - byte facing = aBaseMetaTileEntity.getFrontFacing(); - - int x, y, z, a, b, c, pointer; - int - baseX=aBaseMetaTileEntity.getXCoord(), - baseZ=aBaseMetaTileEntity.getZCoord(), - baseY=aBaseMetaTileEntity.getYCoord(); - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - //yPos - absolute height of checked block - - //perform your duties - c = -depthOffset; - for (String[] _structure : structure) {//front to back - b = verticalOffset; - for (String __structure : _structure) {//top to bottom - a = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block < ' ') {//Control chars allow skipping - b -= block; - break; - } if (block > '@')//characters allow to skip check a-1 skip, b-2 skips etc. - { - a += block - '@'; - } else if (block < '+')//used to mark THINGS - { - a++; - } else if (block=='.') { - a++; - } else { - //get x y z from rotation - switch (facing) {//translation - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - default: - return false; - } - - //that must be here since in some cases other axis (b,c) controls y - if (y < 0 || y >= 256) { - return false; - } - - //Check block - if (world.blockExists(x, y, z)) {//this actually checks if the chunk is loaded at this pos - switch (block) { - case '-'://must be air - if (world.getBlock(x, y, z).getMaterial() != Material.air) { - return false; - } - break; - case '+'://must not be air - if (world.getBlock(x, y, z).getMaterial() == Material.air) { - return false; - } - break; - default: //check for block (countable) - pointer = block - '0'; - //countable air -> net.minecraft.block.BlockAir - if (world.getBlock(x, y, z) != blockType[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-block-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlock(x, y, z).getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); - } - return false; - } - if (world.getBlockMetadata(x, y, z) != blockMeta[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-meta-id-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlockMetadata(x, y, z) + ' ' + blockMeta[pointer]); - } - return false; - } - } - } else if (forceCheck) { - return false; - } - a++;//block in horizontal layer - } - } - b--;//horizontal layer - } - c++;//depth - } - return true; - } - - //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller - //This only checks for REGULAR BLOCKS! - public static boolean StructureCheckerAdvanced( - String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - Method adder, - String[] addingMethods, - short[] casingTextures, - Block[] blockTypeFallback,//use numbers 0-9 for casing types - byte[] blockMetaFallback,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, - boolean forceCheck) { - World world = aBaseMetaTileEntity.getWorld(); - if (world.isRemote) { - return false; - } - //TE Rotation - byte facing = aBaseMetaTileEntity.getFrontFacing(); - - IGregTechTileEntity igt; - IMetaTileEntity imt = aBaseMetaTileEntity.getMetaTileEntity(); - - int x, y, z, a, b, c, pointer; - int baseX=aBaseMetaTileEntity.getXCoord(), - baseZ=aBaseMetaTileEntity.getZCoord(), - baseY=aBaseMetaTileEntity.getYCoord(); - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - //yPos - absolute height of checked block - - //perform your duties - c = -depthOffset; - for (String[] _structure : structure) {//front to back - b = verticalOffset; - for (String __structure : _structure) {//top to bottom - a = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block < ' ') {//Control chars allow skipping - b -= block; - break; - } else if (block > '@') //characters allow to skip check A-1 skip, B-2 skips etc. - { - a += block - '@'; - }//else if (block < '+')//used to mark THINGS - // a++; - else if (block=='.') { - a++; - } else { - //get x y z from rotation - switch (facing) {//translation - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - default: - return false; - } - - //that must be here since in some cases other axis (b,c) controls y - if (y < 0 || y >= 256) { - return false; - } - - //Check block - if (world.blockExists(x, y, z)) {//this actually checks if the chunk is loaded at this pos - switch (block) { - case '-'://must be air - if (world.getBlock(x, y, z).getMaterial() != Material.air) { - return false; - } - break; - case '+'://must not be air - if (world.getBlock(x, y, z).getMaterial() == Material.air) { - return false; - } - break; - default://check for block (countable) - if ((pointer = block - '0') >= 0) { - //countable air -> net.minecraft.block.BlockAir - if (world.getBlock(x, y, z) != blockType[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-block-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlock(x, y, z).getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); - } - return false; - } - if (world.getBlockMetadata(x, y, z) != blockMeta[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-meta-id-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlockMetadata(x, y, z) + ' ' + blockMeta[pointer]); - } - return false; - } - } else if ((pointer = block - ' ') >= 0) { - igt = aBaseMetaTileEntity.getIGregTechTileEntity(x, y, z); - try { - if (igt == null || !(boolean) adder.invoke(imt, addingMethods[pointer], igt, casingTextures[pointer])) { - if (world.getBlock(x, y, z) != blockTypeFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-struct-block-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlock(x, y, z).getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); - } - return false; - } - if (world.getBlockMetadata(x, y, z) != blockMetaFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlockMetadata(x, y, z) + ' ' + blockMetaFallback[pointer]); - } - return false; - } - } - } catch (InvocationTargetException | IllegalAccessException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return false; - } - } - } - } else if (forceCheck) { - return false; - } - a++;//block in horizontal layer - } - } - b--;//horizontal layer - } - c++;//depth - } - return true; - } - */ - //endregion - - //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller - //This only checks for REGULAR BLOCKS! - public static boolean StructureCheckerExtreme( - String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - IHatchAdder[] addingMethods, - short[] casingTextures, - Block[] blockTypeFallback,//use numbers 0-9 for casing types - byte[] blockMetaFallback,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, - IFrontRotation frontRotation, - boolean forceCheck) { - World world = aBaseMetaTileEntity.getWorld(); - if (world.isRemote) { - return false; - } - //TE Rotation - int facingAndRotation = aBaseMetaTileEntity.getFrontFacing() + (frontRotation == null ? 0 : (frontRotation.getFrontRotation() << 3)); - - IGregTechTileEntity igt; - IMetaTileEntity imt = aBaseMetaTileEntity.getMetaTileEntity(); - - int x, y, z, a, b, c, pointer; - int baseX = aBaseMetaTileEntity.getXCoord(), - baseZ = aBaseMetaTileEntity.getZCoord(), - baseY = aBaseMetaTileEntity.getYCoord(); - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - //yPos - absolute height of checked block - - //perform your duties - c = -depthOffset; - for (String[] _structure : structure) {//front to back - b = verticalOffset; - for (String __structure : _structure) {//top to bottom - a = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block < ' ') {//Control chars allow skipping - b -= block; - break; - } else if (block > '@') {//characters allow to skip check A-1 skip, B-2 skips etc. - a += block - '@'; - }//else if (block < '+')//used to mark THINGS - // a++; - else if (block == '.') { - a++; - } else { - //get x y z from rotation - switch (facingAndRotation) {//translation - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 12: - x = baseX + c; - y = baseY - a; - z = baseZ + b; - break; - case 20: - x = baseX + c; - z = baseZ - a; - y = baseY - b; - break; - case 28: - x = baseX + c; - y = baseY + a; - z = baseZ - b; - break; - - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 11: - y = baseY - a; - z = baseZ - c; - x = baseX + b; - break; - case 19: - x = baseX - a; - z = baseZ - c; - y = baseY - b; - break; - case 27: - y = baseY + a; - z = baseZ - c; - x = baseX - b; - break; - - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 13: - x = baseX - c; - y = baseY - a; - z = baseZ - b; - break; - case 21: - x = baseX - c; - z = baseZ + a; - y = baseY - b; - break; - case 29: - x = baseX - c; - y = baseY + a; - z = baseZ + b; - break; - - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - case 10: - y = baseY - a; - z = baseZ + c; - x = baseX - b; - break; - case 18: - x = baseX + a; - z = baseZ + c; - y = baseY - b; - break; - case 26: - y = baseY + a; - z = baseZ + c; - x = baseX + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ - b; - y = baseY - c; - break;//similar to 3 - case 9: - z = baseZ + a; - x = baseX + b; - y = baseY - c; - break;//similar to 3 - case 17: - x = baseX - a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 25: - z = baseZ - a; - x = baseX - b; - y = baseY - c; - break;//similar to 3 - - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - case 8: - z = baseZ + a; - x = baseX - b; - y = baseY + c; - break; - case 16: - x = baseX + a; - z = baseZ + b; - y = baseY + c; - break; - case 24: - z = baseZ - a; - x = baseX + b; - y = baseY + c; - break; - default: - if (DEBUG_MODE) { - TecTech.LOGGER.info("facing = " + facingAndRotation); - } - return false; - } - - //that must be here since in some cases other axis (b,c) controls y - if (y < 0 || y >= 256) { - return false; - } - - //Check block - if (world.blockExists(x, y, z)) {//this actually checks if the chunk is loaded at this pos - switch (block) { - case '-'://must be air - if (world.getBlock(x, y, z).getMaterial() != Material.air) { - return false; - } - break; - case '+'://must not be air - if (world.getBlock(x, y, z).getMaterial() == Material.air) { - return false; - } - break; - default://check for block (countable) - if ((pointer = block - '0') >= 0) { - //countable air -> net.minecraft.block.BlockAir - if (world.getBlock(x, y, z) != blockType[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-block-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlock(x, y, z).getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); - } - return false; - } - if (world.getBlockMetadata(x, y, z) != blockMeta[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-meta-id-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlockMetadata(x, y, z) + ' ' + blockMeta[pointer]); - } - return false; - } - } else //noinspection ConstantConditions - if ((pointer = block - ' ') >= 0) { - igt = aBaseMetaTileEntity.getIGregTechTileEntity(x, y, z); - if (igt == null || !addingMethods[pointer].apply(igt, casingTextures[pointer])) { - if (world.getBlock(x, y, z) != blockTypeFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-struct-block-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlock(x, y, z).getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); - } - return false; - } - if (world.getBlockMetadata(x, y, z) != blockMetaFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + x + ' ' + y + ' ' + z + " / " + a + ' ' + b + ' ' + c + " / " + world.getBlockMetadata(x, y, z) + ' ' + blockMetaFallback[pointer]); - } - return false; - } - } - } - } - } else if (forceCheck) { - return false; - } - a++;//block in horizontal layer - } - } - b--;//horizontal layer - } - c++;//depth - } - return true; - } - - public static boolean StructureBuilder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, boolean hintsOnly) { - byte facing = aBaseMetaTileEntity.getFrontFacing(); - return StructureBuilderExtreme(structure, blockType, blockMeta, - horizontalOffset, verticalOffset, depthOffset, - aBaseMetaTileEntity.getWorld().getTileEntity(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()), null, - facing, hintsOnly); - } - - public static boolean StructureBuilderExtreme(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, IFrontRotation frontRotation, boolean hintsOnly) { - byte facing = aBaseMetaTileEntity.getFrontFacing(); - return StructureBuilderExtreme(structure, blockType, blockMeta, - horizontalOffset, verticalOffset, depthOffset, - aBaseMetaTileEntity.getWorld().getTileEntity(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()), frontRotation, - facing, hintsOnly); - } - - public static boolean StructureBuilder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - TileEntity tileEntity, int facing, boolean hintsOnly) { - return StructureBuilderExtreme(structure, blockType, blockMeta, horizontalOffset, verticalOffset, depthOffset, tileEntity, null, facing, hintsOnly); - } - - public static boolean StructureBuilderExtreme(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - TileEntity tileEntity, IFrontRotation frontRotation, int facing, boolean hintsOnly) { - if (!tileEntity.hasWorldObj()) { - return false; - } - World world = tileEntity.getWorldObj(); - if (!world.isRemote && hintsOnly) { - return false; - } - - //TE Rotation - - int x, y, z, a, b, c, pointer; - int - baseX = tileEntity.xCoord, - baseZ = tileEntity.zCoord, - baseY = tileEntity.yCoord; - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - if (frontRotation != null) { - facing += frontRotation.getFrontRotation() << 3; - } - - //perform your duties - c = -depthOffset; - for (String[] _structure : structure) {//front to back - b = verticalOffset; - for (String __structure : _structure) {//top to bottom - a = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block < ' ') {//Control chars allow skipping - b -= block; - break; - } - if (block > '@')//characters allow to skip check a-1 skip, b-2 skips etc. - { - a += block - '@'; - }//else if (block < '+')//used to mark THINGS - // a++; - else if (block == '.')// this TE - { - a++; - } else { - //get x y z from rotation - switch (facing) { - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 12: - x = baseX + c; - y = baseY - a; - z = baseZ + b; - break; - case 20: - x = baseX + c; - z = baseZ - a; - y = baseY - b; - break; - case 28: - x = baseX + c; - y = baseY + a; - z = baseZ - b; - break; - - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 11: - y = baseY - a; - z = baseZ - c; - x = baseX + b; - break; - case 19: - x = baseX - a; - z = baseZ - c; - y = baseY - b; - break; - case 27: - y = baseY + a; - z = baseZ - c; - x = baseX - b; - break; - - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 13: - x = baseX - c; - y = baseY - a; - z = baseZ - b; - break; - case 21: - x = baseX - c; - z = baseZ + a; - y = baseY - b; - break; - case 29: - x = baseX - c; - y = baseY + a; - z = baseZ + b; - break; - - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - case 10: - y = baseY - a; - z = baseZ + c; - x = baseX - b; - break; - case 18: - x = baseX + a; - z = baseZ + c; - y = baseY - b; - break; - case 26: - y = baseY + a; - z = baseZ + c; - x = baseX + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ - b; - y = baseY - c; - break;//similar to 3 - case 9: - z = baseZ + a; - x = baseX + b; - y = baseY - c; - break;//similar to 3 - case 17: - x = baseX - a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 25: - z = baseZ - a; - x = baseX - b; - y = baseY - c; - break;//similar to 3 - - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - case 8: - z = baseZ + a; - x = baseX - b; - y = baseY + c; - break; - case 16: - x = baseX + a; - z = baseZ + b; - y = baseY + c; - break; - case 24: - z = baseZ - a; - x = baseX + b; - y = baseY + c; - break; - default: - if (DEBUG_MODE) { - TecTech.LOGGER.info("facing = " + facing); - } - return false; - } - - //that must be here since in some cases other axis (b,c) controls y - if (y < 0 || y >= 256) { - return false; - } - - //Check block - if (world.blockExists(x, y, z)) {//this actually checks if the chunk is loaded - if (hintsOnly) { - switch (block) { - case '-'://must be air - TecTech.proxy.hint_particle(world, x, y, z, TT_Container_Casings.sHintCasingsTT, 13); - break; - case '+'://must not be air - TecTech.proxy.hint_particle(world, x, y, z, TT_Container_Casings.sHintCasingsTT, 14); - break; - default: //check for block - if ((pointer = block - '0') >= 0) { - 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) { - if (pointer >= 0 && pointer < 12) { - TecTech.proxy.hint_particle(world, x, y, z, TT_Container_Casings.sHintCasingsTT, pointer); - } else { - TecTech.proxy.hint_particle(world, x, y, z, TT_Container_Casings.sHintCasingsTT, 12); - } - } else { - TecTech.proxy.hint_particle(world, x, y, z, TT_Container_Casings.sHintCasingsTT, 15); - } - } - } else { - switch (block) { - case '-'://must be air - world.setBlock(x, y, z, Blocks.air, 0, 2); - break; - case '+'://must not be air - world.setBlock(x, y, z, TT_Container_Casings.sBlockCasingsTT, 14, 2); - break; - default: //check for block - if ((pointer = block - '0') >= 0) { - world.setBlock(x, y, z, blockType[pointer], blockMeta[pointer], 2); - } else if (block - ' ' < 0) { - world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, 15, 2); - } //else { - //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); - //} - //} - } - } - } - a++;//block in horizontal layer - } - } - b--;//horizontal layer - } - c++;//depth - } - return true; - } - - - public static String[] StructureWriter(IGregTechTileEntity aBaseMetaTileEntity, - int horizontalOffset, int verticalOffset, int depthOffset, - int horizontalSize, int verticalSize, int depthSize, boolean ignoreAir) { - //TE Rotation - byte facing = aBaseMetaTileEntity.getFrontFacing(); - World world = aBaseMetaTileEntity.getWorld(); - if (world.isRemote) { - return new String[]{"Not at Client m8"}; - } - - ItemStack[] array = new ItemStack[10]; - - int x, y, z, a, b, c; - int - baseX = aBaseMetaTileEntity.getXCoord(), - baseZ = aBaseMetaTileEntity.getZCoord(), - baseY = aBaseMetaTileEntity.getYCoord(); - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - //yPos - absolute height of checked block - - //perform your duties - #1 - count block types - c = -depthOffset; - for (int cz = 0; cz < depthSize; cz++) {//front to back - b = verticalOffset; - for (int by = 0; by < verticalSize; by++) {//top to bottom - a = -horizontalOffset; - for (int az = 0; az < horizontalSize; az++) {//left to right - //get x y z from rotation - switch (facing) {//translation - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - default: - return new String[]{"Invalid rotation"}; - } - - //that must be here since in some cases other axis (b,c) controls y - if (y < 0 || y >= 256) { - return new String[]{"Invalid position"}; - } - - //Check block - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - - if (!block.hasTileEntity(meta) && block.getMaterial() != Material.air) { - boolean err = true; - ItemStack is = new ItemStack(block, 1, meta); - for (int i = 0; i < array.length; i++) { - if (array[i] == null) { - array[i] = is; - err = false; - break; - } else if (is.getItem() == array[i].getItem() && is.getItemDamage() == array[i].getItemDamage()) { - err = false; - break; - } - } - if (err) { - return new String[]{"Too much different blocks"}; - } - } - - a++;//block in horizontal layer - } - b--;//horizontal layer - } - c++;//depth - } - - List<String> output = new ArrayList<>(); - - output.add("Offsets: " + horizontalOffset + ' ' + verticalOffset + ' ' + depthOffset); - output.add("Sizes: " + horizontalSize + ' ' + verticalSize + ' ' + depthSize); - output.add(""); - - output.add("ID[]: Name[]"); - output.add(""); - for (int i = 0; i < array.length; i++) { - if (array[i] != null) { - output.add(i + ": " + array[i].getDisplayName()); - } - } - output.add(""); - output.add("ID[]: Block[] BlockMetaID[]"); - output.add(""); - for (int i = 0; i < array.length; i++) { - if (array[i] != null) { - output.add(i + ": " + array[i].getItem().getUnlocalizedName() + ' ' + array[i].getItemDamage()); - } - } - output.add(""); - output.add("String[][]"); - //perform your duties - #2 - write strings - output.add("{"); - c = -depthOffset; - for (int cz = 0; cz < depthSize; cz++) {//front to back - b = verticalOffset; - StringBuilder addMe = new StringBuilder().append('{'); - for (int by = 0; by < verticalSize; by++) {//top to bottom - a = -horizontalOffset; - StringBuilder line = new StringBuilder(); - for (int az = 0; az < horizontalSize; az++) {//left to right - //get x y z from rotation - switch (facing) {//translation - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - default: - return new String[]{"Invalid rotation"}; - } - - //Check block - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - - if (a == 0 && b == 0 && c == 0) { - line.append('.'); - } else if (block.getMaterial() == Material.air) { - line.append('-'); - } else if (block.hasTileEntity(meta)) { - line.append('*'); - } else { - ItemStack stack = new ItemStack(block, 1, meta); - String str = "?";//OH YEAH NPEs - for (int i = 0; i < array.length; i++) { - if (array[i] != null && stack.getItem() == array[i].getItem() && stack.getItemDamage() == array[i].getItemDamage()) { - str = Integer.toString(i); - break; - } - } - line.append(str); - } - a++;//block in horizontal layer - } - if (ignoreAir) { - StringBuilder builder = new StringBuilder(); - char temp = '@'; - for (char ch : line.toString().toCharArray()) { - if (ch == '-') { - temp += 1; - if (temp == '~') { - builder.append('~'); - temp = '@'; - } - } else { - if (temp > '@') { - builder.append(temp); - temp = '@'; - } - builder.append(ch); - } - } - while (builder.length() > 0 && builder.charAt(builder.length() - 1) == '~') { - builder.deleteCharAt(builder.length() - 1); - } - if (builder.length() == 0) { - builder.append("E,"); - } else { - builder.insert(0, '"'); - builder.append('"').append(','); - } - addMe.append(builder); - } else { - if (line.length() == 0) { - line.append("E,"); - } else { - line.insert(0, '"'); - line.append('"').append(','); - } - addMe.append(line); - } - b--;//horizontal layer - } - //region less verbose - addMe.append('}').append(','); - String builtStr = addMe.toString().replaceAll("(E,)+(?=})", E/*Remove Empty strings at end*/); - Matcher matcher = matchE_.matcher(builtStr); - while (matcher.find()) { - byte lenEE = (byte) (matcher.group(1).length() >> 1); - builtStr = builtStr.replaceFirst("E,(E,)+", "\"\\\\u00" + String.format("%02X", lenEE - 1) + "\","); - //builtStr=builtStr.replaceFirst("E,(E,)+\"","\"\\\\u00"+String.format("%02X", lenEE)); - } - //endregion - output.add(builtStr); - c++;//depth - } - output.add("}"); - return output.toArray(new String[0]); - } - - private static final Pattern matchE_ = Pattern.compile("(E,(E,)+)"); - - public static boolean isInputEqual(boolean aDecreaseStacksizeBySuccess, boolean aDontCheckStackSizes, FluidStack[] requiredFluidInputs, ItemStack[] requiredInputs, FluidStack[] givenFluidInputs, ItemStack... givenInputs) { - if (!GregTech_API.sPostloadFinished) { - return false; - } - if (requiredFluidInputs.length > 0 && givenFluidInputs == null) { - return false; - } - int amt; - for (FluidStack tFluid : requiredFluidInputs) { - if (tFluid != null) { - boolean temp = true; - amt = tFluid.amount; - for (FluidStack aFluid : givenFluidInputs) { - if (aFluid != null && aFluid.isFluidEqual(tFluid)) { - if (aDontCheckStackSizes) { - temp = false; - break; - } - amt -= aFluid.amount; - if (amt < 1) { - temp = false; - break; - } - } - } - if (temp) { - return false; - } - } - } - - if (requiredInputs.length > 0 && givenInputs == null) { - return false; - } - for (ItemStack tStack : requiredInputs) { - if (tStack != null) { - amt = tStack.stackSize; - boolean temp = true; - for (ItemStack aStack : givenInputs) { - if (GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) { - if (aDontCheckStackSizes) { - temp = false; - break; - } - amt -= aStack.stackSize; - if (amt < 1) { - temp = false; - break; - } - } - } - if (temp) { - return false; - } - } - } - - if (aDecreaseStacksizeBySuccess) { - if (givenFluidInputs != null) { - for (FluidStack tFluid : requiredFluidInputs) { - if (tFluid != null) { - amt = tFluid.amount; - for (FluidStack aFluid : givenFluidInputs) { - if (aFluid != null && aFluid.isFluidEqual(tFluid)) { - if (aDontCheckStackSizes) { - aFluid.amount -= amt; - break; - } - if (aFluid.amount < amt) { - amt -= aFluid.amount; - aFluid.amount = 0; - } else { - aFluid.amount -= amt; - break; - } - } - } - } - } - } - - if (givenInputs != null) { - for (ItemStack tStack : requiredInputs) { - if (tStack != null) { - amt = tStack.stackSize; - for (ItemStack aStack : givenInputs) { - if (GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) { - if (aDontCheckStackSizes) { - aStack.stackSize -= amt; - break; - } - if (aStack.stackSize < amt) { - amt -= aStack.stackSize; - aStack.stackSize = 0; - } else { - aStack.stackSize -= amt; - break; - } - } - } - } - } - } - } - - return true; - } - - public static String getUniqueIdentifier(ItemStack is) { - return GameRegistry.findUniqueIdentifierFor(is.getItem()).modId + ':' + is.getUnlocalizedName(); - } - - public static byte getTier(long l) { - byte b = -1; - - do { - ++b; - if (b >= CommonValues.V.length) { - return b; - } - } while (l > CommonValues.V[b]); - - return b; - } - - 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) { - 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; - } - - public static class ItemStack_NoNBT implements Comparable<ItemStack_NoNBT> { - public final Item mItem; - public final int mStackSize; - public final int mMetaData; - - public ItemStack_NoNBT(Item aItem, long aStackSize, long aMetaData) { - this.mItem = aItem; - this.mStackSize = (byte) ((int) aStackSize); - this.mMetaData = (short) ((int) aMetaData); - } - - public ItemStack_NoNBT(ItemStack aStack) { - if (aStack == null) { - mItem = null; - mStackSize = mMetaData = 0; - } else { - mItem = aStack.getItem(); - mStackSize = aStack.stackSize; - mMetaData = Items.feather.getDamage(aStack); - } - } - - @Override - public int compareTo(ItemStack_NoNBT o) { - if (mMetaData > o.mMetaData) return 1; - if (mMetaData < o.mMetaData) return -1; - if (mStackSize > o.mStackSize) return 1; - if (mStackSize < o.mStackSize) return -1; - if (mItem != null && o.mItem != null) - return mItem.getUnlocalizedName().compareTo(o.mItem.getUnlocalizedName()); - if (mItem == null && o.mItem == null) return 0; - if (mItem != null) return 1; - return -1; - } - - @Override - public boolean equals(Object aStack) { - return aStack == this || - (aStack instanceof ItemStack_NoNBT && - ((mItem == ((ItemStack_NoNBT) aStack).mItem) || ((ItemStack_NoNBT) aStack).mItem.getUnlocalizedName().equals(this.mItem.getUnlocalizedName())) && - ((ItemStack_NoNBT) aStack).mStackSize == this.mStackSize && - ((ItemStack_NoNBT) aStack).mMetaData == this.mMetaData); - } - - @Override - public int hashCode() { - return (mItem != null ? mItem.getUnlocalizedName().hashCode() : 0) ^ (mMetaData << 16) ^ (mStackSize << 24); - } - - @Override - public String toString() { - return Integer.toString(hashCode()) + ' ' + (mItem == null ? "null" : mItem.getUnlocalizedName()) + ' ' + mMetaData + ' ' + mStackSize; - } - } - - public static void setTier(int tier,Object me){ - try{ - Field field=GT_MetaTileEntity_TieredMachineBlock.class.getField("mTier"); - field.setAccessible(true); - field.set(me,(byte)tier); - }catch (Exception e){ - //e.printStackTrace(); - } - } - - public static StringBuilder receiveString(StringBuilder previousValue, int startIndex, int index, int value){ - int sizeReq=index-startIndex; - if(value==0){ - previousValue.setLength(Math.min(previousValue.length(),sizeReq)); - }else { - previousValue.setLength(Math.max(previousValue.length(),sizeReq)); - previousValue.setCharAt(sizeReq,(char)value); - } - return previousValue; - } - - @Deprecated - public static double receiveDouble(double previousValue, int startIndex, int index, int value){ - return Double.longBitsToDouble(receiveLong(Double.doubleToLongBits(previousValue),startIndex,index,value)); - } - - public static long receiveLong(long previousValue, int startIndex, int index, int value){ - value &=0xFFFF; - switch (index-startIndex){ - case 0: - previousValue&= 0xFFFF_FFFF_FFFF_0000L; - previousValue|=value; - break; - case 1: - previousValue&=0xFFFF_FFFF_0000_FFFFL; - previousValue|=value<<16; - break; - case 2: - previousValue&=0xFFFF_0000_FFFF_FFFFL; - previousValue|=(long)value<<32; - break; - case 3: - previousValue&=0x0000_FFFF_FFFF_FFFFL; - previousValue|=(long)value<<48; - break; - } - return previousValue; - } - - public static void sendString(StringBuilder string,Container container, ICrafting crafter,int startIndex){ - for (int i = 0; i < string.length(); i++) { - crafter.sendProgressBarUpdate(container,startIndex++,string.charAt(i)); - } - crafter.sendProgressBarUpdate(container,startIndex,0); - } - - public static void sendDouble(double value,Container container, ICrafting crafter,int startIndex){ - sendLong(Double.doubleToLongBits(value),container,crafter,startIndex); - } - - public static void sendLong(long value,Container container, ICrafting crafter,int startIndex){ - crafter.sendProgressBarUpdate(container, startIndex++, (int)(value & 0xFFFFL)); - crafter.sendProgressBarUpdate(container, startIndex++, (int)((value & 0xFFFF0000L)>>>16)); - crafter.sendProgressBarUpdate(container, startIndex++, (int)((value & 0xFFFF00000000L)>>>32)); - crafter.sendProgressBarUpdate(container, startIndex, (int)((value & 0xFFFF000000000000L)>>>48)); - } - - @Deprecated - public static float receiveFloat(float previousValue, int startIndex, int index, int value){ - return Float.intBitsToFloat(receiveInteger(Float.floatToIntBits(previousValue),startIndex,index,value)); - } - - public static int receiveInteger(int previousValue, int startIndex, int index, int value){ - value &=0xFFFF; - switch (index-startIndex){ - case 0: - previousValue&= 0xFFFF_0000; - previousValue|=value; - break; - case 1: - previousValue&=0x0000_FFFF; - previousValue|=value<<16; - break; - } - return previousValue; - } - - public static void sendFloat(float value,Container container, ICrafting crafter,int startIndex){ - sendInteger(Float.floatToIntBits(value),container,crafter,startIndex); - } - - public static void sendInteger(int value,Container container, ICrafting crafter,int startIndex){ - crafter.sendProgressBarUpdate(container, startIndex++, (int)(value & 0xFFFFL)); - crafter.sendProgressBarUpdate(container, startIndex, (value & 0xFFFF0000)>>>16); - } - - public static String doubleToString(double value){ - if(value==(long)value){ - return Long.toString((long)value); - } - return Double.toString(value); - } - - public static boolean checkChunkExist(World world, ChunkCoordIntPair chunk){ - int x=chunk.getCenterXPos(); - int z=chunk.getCenterZPosition(); - return world.checkChunksExist(x, 0, z, x, 0, z); - } - - public static NBTTagCompound getPlayerData(UUID uuid1,UUID uuid2,String extension) { - try { - if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { - if (uuid1 != null && uuid2!=null) { - IPlayerFileData playerNBTManagerObj = MinecraftServer.getServer().worldServerForDimension(0).getSaveHandler().getSaveHandler(); - SaveHandler sh = (SaveHandler)playerNBTManagerObj; - File dir = ObfuscationReflectionHelper.getPrivateValue(SaveHandler.class, sh, new String[]{"playersDirectory", "field_75771_c"}); - String id1=uuid1.toString(); - NBTTagCompound tagCompound=read(new File(dir, id1 + "."+extension)); - if(tagCompound!=null){ - return tagCompound; - } - tagCompound=readBackup(new File(dir, id1 + "."+extension+"_bak")); - if(tagCompound!=null){ - return tagCompound; - } - String id2=uuid2.toString(); - tagCompound=read(new File(dir, id2 + "."+extension)); - if(tagCompound!=null){ - return tagCompound; - } - tagCompound=readBackup(new File(dir, id2 + "."+extension+"_bak")); - if(tagCompound!=null){ - return tagCompound; - } - } - } - } catch (Exception ignored) {} - return new NBTTagCompound(); - } - - public static void savePlayerFile(EntityPlayer player,String extension, NBTTagCompound data) { - try { - if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { - if (player != null) { - IPlayerFileData playerNBTManagerObj = MinecraftServer.getServer().worldServerForDimension(0).getSaveHandler().getSaveHandler(); - SaveHandler sh = (SaveHandler)playerNBTManagerObj; - File dir = ObfuscationReflectionHelper.getPrivateValue(SaveHandler.class, sh, new String[]{"playersDirectory", "field_75771_c"}); - String id1=player.getUniqueID().toString(); - write(new File(dir, id1 + "."+extension),data); - write(new File(dir, id1 + "."+extension+"_bak"),data); - String id2=UUID.nameUUIDFromBytes(player.getCommandSenderName().getBytes(forName("UTF-8"))).toString(); - write(new File(dir, id2 + "."+extension),data); - write(new File(dir, id2 + "."+extension+"_bak"),data); - } - } - } catch (Exception ignored) {} - } - - private static NBTTagCompound read(File file){ - if (file != null && file.exists()) { - try(FileInputStream fileInputStream= new FileInputStream(file)) { - return CompressedStreamTools.readCompressed(fileInputStream); - } catch (Exception var9) { - TecTech.LOGGER.error("Cannot read NBT File: "+file.getAbsolutePath()); - } - } - return null; - } - - private static NBTTagCompound readBackup(File file){ - if (file != null && file.exists()) { - try(FileInputStream fileInputStream= new FileInputStream(file)) { - return CompressedStreamTools.readCompressed(fileInputStream); - } catch (Exception var9) { - TecTech.LOGGER.error("Cannot read NBT File: "+file.getAbsolutePath()); - return new NBTTagCompound(); - } - } - return null; - } - - private static void write(File file,NBTTagCompound tagCompound){ - if (file != null) { - if(tagCompound==null){ - if(file.exists()) file.delete(); - }else { - try(FileOutputStream fileOutputStream= new FileOutputStream(file)) { - CompressedStreamTools.writeCompressed(tagCompound,fileOutputStream); - } catch (Exception var9) { - TecTech.LOGGER.error("Cannot write NBT File: "+file.getAbsolutePath()); - } - } - } - } - - public static AxisAlignedBB fromChunkCoordIntPair(ChunkCoordIntPair chunkCoordIntPair){ - int x=chunkCoordIntPair.chunkXPos<<4; - int z=chunkCoordIntPair.chunkZPos<<4; - return AxisAlignedBB.getBoundingBox(x,-128,z,x+16,512,z+16); - } - - public static AxisAlignedBB fromChunk(Chunk chunk){ - int x=chunk.xPosition<<4; - int z=chunk.zPosition<<4; - return AxisAlignedBB.getBoundingBox(x,-128,z,x+16,512,z+16); - } -} diff --git a/src/main/java/com/github/technus/tectech/Vec3pos.java b/src/main/java/com/github/technus/tectech/Vec3pos.java deleted file mode 100644 index eb694813da..0000000000 --- a/src/main/java/com/github/technus/tectech/Vec3pos.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.github.technus.tectech; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - -/** - * Created by Tec on 05.04.2017. - */ -public class Vec3pos implements Comparable<Vec3pos> { - public final int x, z; - public final short y; - - public Vec3pos(int x, short y, int z) { - this.x = x; - this.y = y; - this.z = z; - } - - public Vec3pos(IGregTechTileEntity te) { - x = te.getXCoord(); - y = te.getYCoord(); - z = te.getZCoord(); - } - - @Override - public int compareTo(Vec3pos o) { - int tmp=y-o.y; - if (tmp!=0) { - return tmp; - } - tmp=x-o.x; - if (tmp!=0) { - return tmp; - } - return z-o.z; - } - - @Override - public boolean equals(Object obj) { - if(obj instanceof Vec3pos){ - Vec3pos v=(Vec3pos) obj; - return x==v.x && z==v.z && y==v.y; - } - return false; - } - - @Override - public int hashCode() { - return x*524288+z*256+y; - } -} 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 605ce17509..f520885f9e 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.compatibility.dreamcraft; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.recipe.TT_recipeAdder; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -23,16 +24,18 @@ import net.minecraftforge.fluids.FluidStack; import java.lang.reflect.Method; -import static com.github.technus.tectech.loader.recipe.RecipeLoader.getOrDefault; +import static com.github.technus.tectech.loader.recipe.BaseRecipeLoader.getOrDefault; /** * Created by Tec on 06.08.2017. */ -public class DreamCraftRecipeLoader implements Runnable { +public class DreamCraftRecipeLoader { //region reflect a bit + @SuppressWarnings("rawtypes") private Class CUSTOM_ITEM_LIST; private Method ADD_ASSEMBLER_RECIPE; + @SuppressWarnings("unchecked") private IItemContainer getItemContainer(String name) { return (IItemContainer) Enum.valueOf(CUSTOM_ITEM_LIST, name); } @@ -41,13 +44,12 @@ public class DreamCraftRecipeLoader implements Runnable { try { ADD_ASSEMBLER_RECIPE.invoke(GT_Values.RA, items, fluid, output, time, eut, true); } catch (Exception e) { - throw new Error(e); + throw new RuntimeException("Failed to add clean room assembler recipe! " + output.getDisplayName(), e); } } //endregion - @Override - public void run() { + public void run(EMTransformationRegistry transformationInfo) { //region reflect a bit try { CUSTOM_ITEM_LIST = Class.forName("com.dreammaster.gthandler.CustomItemList"); @@ -168,6 +170,23 @@ public class DreamCraftRecipeLoader implements Runnable { getOrDefault("Trinium", Materials.Osmium).getMolten(1296), }, CustomItemList.eM_Coil.get(4), 800, 2000000); + //infinite oil rig + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.OilDrill3.get(1), + 16777216, 2048, 2000000, 4, new ItemStack[]{ + ItemList.OilDrill3.get(1), + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 4), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Infinite, 4), + ItemList.Electric_Motor_UHV.get(4), + ItemList.Electric_Pump_UHV.get(4), + GT_OreDictUnificator.get(OrePrefixes.gearGt, Materials.Neutronium, 4), + ItemList.Sensor_UHV.get(3), + ItemList.Field_Generator_UHV.get(3), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Neutronium, 12) + }, new FluidStack[]{ + Materials.SolderingAlloy.getMolten(1296), + Materials.Neutronium.getMolten(576) + }, ItemList.OilDrillInfinite.get(1), 6000, 2000000); + //Tesla Base GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.NickelZincFerrite, 6), @@ -222,7 +241,12 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorLuV, 8), getItemContainer("MicaInsulatorFoil").get(28) - }, Materials.Indium.getMolten(144), CustomItemList.tM_TeslaPrimary_5.get(1), 50, 30720); + }, Materials.Indium.getMolten(144), CustomItemList.tM_TeslaPrimary_5.get(1), 200, 30720); + //Tesla Primary Coils T6 + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorZPM, 8), + getItemContainer("MicaInsulatorFoil").get(32) + }, Materials.Naquadah.getMolten(144), CustomItemList.tM_TeslaPrimary_6.get(1), 200, 122880); //endregion @@ -253,27 +277,49 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UIV_UEV").get(1), CustomItemList.eM_dynamoMulti4_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(4608), CustomItemList.eM_dynamoMulti16_UEV.get(1), 200, 2000000); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UIV_UEV").get(1), CustomItemList.eM_dynamoMulti16_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(4608), CustomItemList.eM_dynamoMulti64_UEV.get(1), 400, 2000000); - //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Hatch_Dynamo_UIV.get(1), 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), 100, 8000000); - //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Transformer_UMV_UIV.get(1), CustomItemList.eM_dynamoMulti4_UIV.get(1), 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), 200, 8000000); - //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UMV_UIV.get(1), CustomItemList.eM_dynamoMulti16_UIV.get(1), 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), 400, 8000000); - - //Energy Hatches UV-UIV - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_UV.get(1), 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), 100, 122880); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_MAX_UV.get(1), CustomItemList.eM_energyMulti4_UV.get(1), 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), 200, 122880); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UHV_UV").get(1), CustomItemList.eM_energyMulti16_UV.get(1), 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), 400, 122880); - - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_MAX.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.SuperconductorUHV, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2)}, Materials.Silver.getMolten(2000), CustomItemList.eM_energyMulti4_UHV.get(1), 100, 500000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UEV_UHV").get(1), CustomItemList.eM_energyMulti4_UHV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.SuperconductorUHV, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 4)}, Materials.Electrum.getMolten(2000), CustomItemList.eM_energyMulti16_UHV.get(1), 200, 500000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UEV_UHV").get(1), CustomItemList.eM_energyMulti16_UHV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.SuperconductorUHV, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 6)}, Materials.Tungsten.getMolten(2000), CustomItemList.eM_energyMulti64_UHV.get(1), 400, 500000); - - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Hatch_Energy_UEV").get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 2)}, Materials.Silver.getMolten(4000), CustomItemList.eM_energyMulti4_UEV.get(1), 100, 2000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UIV_UEV").get(1), CustomItemList.eM_energyMulti4_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(4000), CustomItemList.eM_energyMulti16_UEV.get(1), 200, 2000000); - GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UIV_UEV").get(1), CustomItemList.eM_energyMulti16_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(4000), CustomItemList.eM_energyMulti64_UEV.get(1), 400, 2000000); - - //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Hatch_Energy_UIV.get(1), 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), 100, 8000000); - //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.Transformer_UMV_UIV.get(1), CustomItemList.eM_energyMulti4_UIV.get(1), 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), 200, 8000000); - //GT_Values.RA.ADD_ASSEMBLER_RECIPE(new ItemStack[]{com.dreammaster.gthandler.CustomItemList.WetTransformer_UMV_UIV.get(1), CustomItemList.eM_energyMulti16_UIV.get(1), 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), 400, 8000000); - + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Hatch_Dynamo_UIV").get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2)}, Materials.Silver.getMolten(9216), CustomItemList.eM_dynamoMulti4_UIV.get(1), 100, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UMV_UIV").get(1), CustomItemList.eM_dynamoMulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(9216), CustomItemList.eM_dynamoMulti16_UIV.get(1), 200, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UMV_UIV").get(1), CustomItemList.eM_dynamoMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(9216), CustomItemList.eM_dynamoMulti64_UIV.get(1), 400, 8000000); + + //Energy Hatches IV-UIV + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 2)}, Materials.Silver.getMolten(144), CustomItemList.eM_energyMulti4_IV.get(1), 100, 1920); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_LuV_IV.get(1), CustomItemList.eM_energyMulti4_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 4)}, Materials.Electrum.getMolten(144), CustomItemList.eM_energyMulti16_IV.get(1), 200, 1920); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_LuV_IV").get(1), CustomItemList.eM_energyMulti16_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Tungsten, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 6)}, Materials.Tungsten.getMolten(144), CustomItemList.eM_energyMulti64_IV.get(1), 400, 1920); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2)}, Materials.Silver.getMolten(288), CustomItemList.eM_energyMulti4_LuV.get(1), 100, 7680); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_ZPM_LuV.get(1), CustomItemList.eM_energyMulti4_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 4)}, Materials.Electrum.getMolten(288), CustomItemList.eM_energyMulti16_LuV.get(1), 200, 7680); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_ZPM_LuV").get(1), CustomItemList.eM_energyMulti16_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.VanadiumGallium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 6)}, Materials.Tungsten.getMolten(288), CustomItemList.eM_energyMulti64_LuV.get(1), 400, 7680); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_ZPM.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Naquadah, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 2)}, Materials.Silver.getMolten(576), CustomItemList.eM_energyMulti4_ZPM.get(1), 100, 30720); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_UV_ZPM.get(1), CustomItemList.eM_energyMulti4_ZPM.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Naquadah, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 4)}, Materials.Electrum.getMolten(576), CustomItemList.eM_energyMulti16_ZPM.get(1), 200, 30720); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UV_ZPM").get(1), CustomItemList.eM_energyMulti16_ZPM.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Naquadah, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 6)}, Materials.Tungsten.getMolten(576), CustomItemList.eM_energyMulti64_ZPM.get(1), 400, 30720); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_UV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2)}, Materials.Silver.getMolten(1152), CustomItemList.eM_energyMulti4_UV.get(1), 100, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_MAX_UV.get(1), CustomItemList.eM_energyMulti4_UV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 4)}, Materials.Electrum.getMolten(1152), CustomItemList.eM_energyMulti16_UV.get(1), 200, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UHV_UV").get(1), CustomItemList.eM_energyMulti16_UV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NaquadahAlloy, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 6)}, Materials.Tungsten.getMolten(1152), CustomItemList.eM_energyMulti64_UV.get(1), 400, 122880); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hatch_Energy_MAX.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.SuperconductorUHV, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2)}, Materials.Silver.getMolten(2304), CustomItemList.eM_energyMulti4_UHV.get(1), 100, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UEV_UHV").get(1), CustomItemList.eM_energyMulti4_UHV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.SuperconductorUHV, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 4)}, Materials.Electrum.getMolten(2304), CustomItemList.eM_energyMulti16_UHV.get(1), 200, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UEV_UHV").get(1), CustomItemList.eM_energyMulti16_UHV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.SuperconductorUHV, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 6)}, Materials.Tungsten.getMolten(2304), CustomItemList.eM_energyMulti64_UHV.get(1), 400, 500000); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Hatch_Energy_UEV").get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 2)}, Materials.Silver.getMolten(4608), CustomItemList.eM_energyMulti4_UEV.get(1), 100, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UIV_UEV").get(1), CustomItemList.eM_energyMulti4_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(4608), CustomItemList.eM_energyMulti16_UEV.get(1), 200, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UIV_UEV").get(1), CustomItemList.eM_energyMulti16_UEV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.Draconium, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(4608), CustomItemList.eM_energyMulti64_UEV.get(1), 400, 2000000); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Hatch_Energy_UIV").get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2)}, Materials.Silver.getMolten(9216), CustomItemList.eM_energyMulti4_UIV.get(1), 100, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UMV_UIV").get(1), CustomItemList.eM_energyMulti4_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 4)}, Materials.Electrum.getMolten(9216), CustomItemList.eM_energyMulti16_UIV.get(1), 200, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("WetTransformer_UMV_UIV").get(1), CustomItemList.eM_energyMulti16_UIV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt12, Materials.NetherStar, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 6)}, Materials.Tungsten.getMolten(9216), CustomItemList.eM_energyMulti64_UIV.get(1), 400, 8000000); + + //Buck Converter IV-UIV + if (Loader.isModLoaded("bartworks")) { + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_LuV_IV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.TungstenSteel, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 2)}, Materials.TungstenSteel.getMolten(288), CustomItemList.Machine_BuckConverter_IV.get(1), 100, 7680); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_ZPM_LuV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Rhodium-PlatedPalladium", Materials.Chrome), 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.NiobiumTitanium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 3)}, new FluidStack(FluidRegistry.getFluid("molten.rhodium-plated palladium"), 288), CustomItemList.Machine_BuckConverter_LuV.get(1), 100, 30720); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_UV_ZPM.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iridium, 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.TungstenSteel, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 4)}, Materials.Iridium.getMolten(288), CustomItemList.Machine_BuckConverter_ZPM.get(1), 100, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Transformer_MAX_UV.get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmium, 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Naquadah, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 2L, 5)}, Materials.Osmium.getMolten(288), CustomItemList.Machine_BuckConverter_UV.get(1), 100, 500000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UEV_UHV").get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Infinite, 2), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Neutronium, 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.ElectrumFlux, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 4L, 5)}, Materials.Neutronium.getMolten(288), CustomItemList.Machine_BuckConverter_UHV.get(1), 100, 2000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UIV_UEV").get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Bio, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("Bedrockium", Materials.Neutronium), 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Bedrockium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 8L, 5)}, getOrDefault("Bedrockium", Materials.Neutronium).getMolten(288), CustomItemList.Machine_BuckConverter_UEV.get(1), 100, 8000000); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{getItemContainer("Transformer_UMV_UIV").get(1), getItemContainer("Display").get(1), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Nano, 2), GT_OreDictUnificator.get(OrePrefixes.plate, getOrDefault("BlackPlutonium", Materials.Neutronium), 2), GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.Draconium, 4), GT_ModHandler.getModItem("bartworks", "BW_GlasBlocks", 16L, 5)}, getOrDefault("BlackPlutonium", Materials.Neutronium).getMolten(288), CustomItemList.Machine_BuckConverter_UIV.get(1), 200, 8000000); + } //Laser Dynamo IV-UEV 256/t GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hull_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.lens, Materials.Diamond, 1), ItemList.Emitter_IV.get(1), ItemList.Electric_Pump_IV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.TungstenSteel, 2), GT_Utility.getIntegratedCircuit(1)}, null, CustomItemList.eM_dynamoTunnel1_IV.get(1), 1000, 7680); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hull_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.lens, Materials.Diamond, 1), ItemList.Emitter_LuV.get(1), ItemList.Electric_Pump_LuV.get(1), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.VanadiumGallium, 2), GT_Utility.getIntegratedCircuit(1)}, null, CustomItemList.eM_dynamoTunnel1_LuV.get(1), 1000, 30720); @@ -416,13 +462,13 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Emitter_ZPM.get(8), ItemList.Robot_Arm_ZPM.get(1), ItemList.Electric_Motor_ZPM.get(2), - new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 1)}, + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 1}, new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Naquadah, 2)}, new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Naquadah, 16)}, CustomItemList.DATApipe.get(2), }, new FluidStack[]{ Materials.UUMatter.getFluid(500), - Materials.Iridium.getMolten(1000), + Materials.Iridium.getMolten(1296), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 1000) }, CustomItemList.holder_Hatch.get(1), 1200, 100000); @@ -433,7 +479,25 @@ public class DreamCraftRecipeLoader implements Runnable { CustomItemList.DATApipe.get(4), ItemList.Cover_Screen.get(1), new ItemStack(Blocks.stone_button, 16), + GT_Utility.getIntegratedCircuit(1), }, Materials.Iridium.getMolten(2592), CustomItemList.Parametrizer_Hatch.get(1), 800, 122880); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Computer_Casing.get(1), + ItemList.Circuit_Ultimatecrystalcomputer.get(1), + CustomItemList.DATApipe.get(6), + ItemList.Cover_Screen.get(1), + new ItemStack(Blocks.stone_button, 32), + GT_Utility.getIntegratedCircuit(2), + }, Materials.Iridium.getMolten(2592), CustomItemList.ParametrizerX_Hatch.get(1), 800, 122880); + + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.eM_Computer_Casing.get(1), + ItemList.Circuit_Biomainframe.get(1), + CustomItemList.DATApipe.get(8), + ItemList.Cover_Screen.get(2), + new ItemStack(Blocks.stone_button, 64), + GT_Utility.getIntegratedCircuit(3), + }, Materials.Iridium.getMolten(2592), CustomItemList.ParametrizerTXT_Hatch.get(1), 800, 122880); //Uncertainty addAssemblerRecipeWithCleanroom(new ItemStack[]{ CustomItemList.eM_Computer_Casing.get(1), @@ -441,8 +505,18 @@ public class DreamCraftRecipeLoader implements Runnable { CustomItemList.DATApipe.get(16), ItemList.Cover_Screen.get(1), new ItemStack(Blocks.stone_button, 16), + GT_Utility.getIntegratedCircuit(4), }, Materials.Iridium.getMolten(2592), CustomItemList.Uncertainty_Hatch.get(1), 1200, 122880); + addAssemblerRecipeWithCleanroom(new ItemStack[]{ + CustomItemList.eM_Computer_Casing.get(1), + ItemList.Circuit_Biomainframe.get(1), + CustomItemList.DATApipe.get(32), + ItemList.Cover_Screen.get(1), + new ItemStack(Blocks.stone_button, 16), + GT_Utility.getIntegratedCircuit(5), + }, Materials.Iridium.getMolten(2592), CustomItemList.UncertaintyX_Hatch.get(1), 1200, 122880); + //Elemental Input addAssemblerRecipeWithCleanroom(new ItemStack[]{ CustomItemList.eM_Containment.get(1), @@ -503,7 +577,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ getItemContainer("WetTransformer_ZPM_LuV").get(1), getItemContainer("HighEnergyFlowCircuit").get(1), - GT_OreDictUnificator.get(OrePrefixes.wireGt01, getOrDefault("SuperconductorLuV",Materials.Superconductor), 16), + GT_OreDictUnificator.get(OrePrefixes.wireGt01, getOrDefault("SuperconductorLuV", Materials.Superconductor), 16), ItemList.valueOf("Circuit_Chip_UHPIC").get(2), }, Materials.TungstenSteel.getMolten(576), CustomItemList.Machine_Multi_Transformer.get(1), 400, 30720); @@ -519,7 +593,7 @@ public class DreamCraftRecipeLoader implements Runnable { //Quantum Computer GT_Values.RA.addAssemblylineRecipe(ItemList.Tool_DataOrb.get(1), 20000, new Object[]{ CustomItemList.Machine_Multi_Switch.get(1), - new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 2)}, + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 2}, ItemList.Tool_DataOrb.get(1), ItemList.Cover_Screen.get(1), new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.SuperconductorUV, 8)}, @@ -535,7 +609,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_Values.RA.addAssemblylineRecipe(getItemContainer("ScannerZPM").get(1), 80000, new Object[]{ CustomItemList.Machine_Multi_Switch.get(1), ItemList.Sensor_ZPM.get(8), - new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Superconductor, 4)}, + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 4}, ItemList.Field_Generator_ZPM.get(1), ItemList.Electric_Motor_ZPM.get(2), new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Naquadah, 4)}, @@ -551,48 +625,48 @@ public class DreamCraftRecipeLoader implements Runnable { //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.SuperconductorUHV, 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); + 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.SuperconductorUHV, 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.SuperconductorUHV, 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); + 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.SuperconductorUHV, 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.SuperconductorUHV, 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); + 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.SuperconductorUHV, 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), @@ -654,7 +728,7 @@ public class DreamCraftRecipeLoader implements Runnable { new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), }, CustomItemList.Machine_Multi_Infuser.get(1), 8000, 2000000); - //Motor UV-UHV + //Motor UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Electric_Motor_UV.get(1L), 24000, 32, 100000, 4, new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.SamariumMagnetic, 4L), @@ -693,14 +767,14 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(5184), Materials.Lubricant.getFluid(8000)}, ItemList.Electric_Motor_UEV.get(1L), 2000, 800000); - //Pumps UV-UHV + //Pumps UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Electric_Pump_UV.get(1L), - 24000, 32, 100000, 4, new ItemStack[]{ + 24000, 32, 100000, 4, new Object[]{ ItemList.Electric_Motor_UHV.get(1L), GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.Neutronium, 2L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.CosmicNeutronium, 4L), GT_OreDictUnificator.get(OrePrefixes.screw, Materials.CosmicNeutronium, 16L), - GT_OreDictUnificator.get(OrePrefixes.ring, Materials.AnySyntheticRubber, 32L), + new Object[]{OrePrefixes.ring.get(Materials.AnySyntheticRubber), 32L}, GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.CosmicNeutronium, 4L), GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Bedrockium, 2L)}, new FluidStack[]{ Materials.Naquadria.getMolten(2592), @@ -708,44 +782,45 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.Lubricant.getFluid(4000)}, ItemList.Electric_Pump_UHV.get(1), 1000, 200000); TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Electric_Pump_UHV.get(1L), - 48000, 64, 200000, 8, new ItemStack[]{ + 48000, 64, 200000, 8, new Object[]{ ItemList.Electric_Motor_UEV.get(1L), GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.NetherStar, 2L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Infinity, 4L), GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Infinity, 16L), - GT_OreDictUnificator.get(OrePrefixes.ring, (Materials.AnySyntheticRubber), 64L), + new Object[]{OrePrefixes.ring.get(Materials.AnySyntheticRubber), 64L}, GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.Infinity, 4L), GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Draconium, 2L)}, new FluidStack[]{ Materials.Quantium.getMolten(2592), Materials.SolderingAlloy.getMolten(5184), Materials.Lubricant.getFluid(8000)}, ItemList.Electric_Pump_UEV.get(1), 2000, 800000); - //Conveyor Belt UV-UHV + //Conveyor Belt UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Conveyor_Module_UV.get(1L), - 24000, 32, 100000, 4, new ItemStack[]{ + 24000, 32, 100000, 4, new Object[]{ ItemList.Electric_Motor_UHV.get(2L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.CosmicNeutronium, 2L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.CosmicNeutronium, 8L), GT_OreDictUnificator.get(OrePrefixes.round, Materials.CosmicNeutronium, 64L), - GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Bedrockium, 2L)}, new FluidStack[]{ + GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Bedrockium, 2L), + new Object[]{OrePrefixes.plate.get(Materials.AnySyntheticRubber), 40L}}, new FluidStack[]{ Materials.Naquadria.getMolten(2592), Materials.SolderingAlloy.getMolten(2592), - Materials.Lubricant.getFluid(4000), - Materials.Silicone.getMolten(5760)}, ItemList.Conveyor_Module_UHV.get(1), 1000, 200000); + Materials.Lubricant.getFluid(4000)}, ItemList.Conveyor_Module_UHV.get(1), 1000, 200000); TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Conveyor_Module_UHV.get(1L), - 48000, 64, 200000, 8, new ItemStack[]{ + 48000, 64, 200000, 8, new Object[]{ ItemList.Electric_Motor_UEV.get(2L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Infinity, 2L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Infinity, 8L), GT_OreDictUnificator.get(OrePrefixes.round, Materials.Infinity, 64L), - GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Draconium, 2L)}, new FluidStack[]{ + GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.Draconium, 2L), + new Object[]{OrePrefixes.plate.get(Materials.AnySyntheticRubber), 64L}, + new Object[]{OrePrefixes.plate.get(Materials.AnySyntheticRubber), 16L}}, new FluidStack[]{ Materials.Quantium.getMolten(2592), Materials.SolderingAlloy.getMolten(5184), - Materials.Lubricant.getFluid(8000), - Materials.Silicone.getMolten(11520)}, ItemList.Conveyor_Module_UEV.get(1), 2000, 800000); + Materials.Lubricant.getFluid(8000)}, ItemList.Conveyor_Module_UEV.get(1), 2000, 800000); - //Piston UV-UHV + //Piston UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Electric_Piston_UV.get(1L), 24000, 32, 100000, 4, new ItemStack[]{ ItemList.Electric_Motor_UHV.get(1L), @@ -774,7 +849,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(5184), Materials.Lubricant.getFluid(8000)}, ItemList.Electric_Piston_UEV.get(1), 2000, 800000); - //Robot Arm UV-UHV + //Robot Arm UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Robot_Arm_UV.get(1L), 24000, 32, 100000, 4, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.CosmicNeutronium, 8L), @@ -805,7 +880,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(9216), Materials.Lubricant.getFluid(8000)}, ItemList.Robot_Arm_UEV.get(1L), 2000, 800000); - //Emitter UV-UHV + //Emitter UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Emitter_UV.get(1L), 24000, 32, 100000, 4, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 1L), @@ -838,7 +913,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(9216)}, ItemList.Emitter_UEV.get(1L), 2000, 800000); - //Sensor UV-UHV + //Sensor UHV-UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Sensor_UV.get(1L), 24000, 32, 100000, 4, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 1L), @@ -871,11 +946,13 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(9216)}, ItemList.Sensor_UEV.get(1L), 2000, 800000); - //Fieldgen UV and UHV + //Fieldgen UHV and UEV TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Field_Generator_UV.get(1), 48000, 64, 200000, 8, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.CosmicNeutronium, 6L), + ItemList.Gravistar.get(4L), + ItemList.Emitter_UHV.get(4L), new Object[]{OrePrefixes.circuit.get(Materials.Bio), 4L}, GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Neutronium, 64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Neutronium, 64L), @@ -895,7 +972,9 @@ public class DreamCraftRecipeLoader implements Runnable { 96000, 128, 400000, 16, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Infinity, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Infinity, 6L), - new Object[]{OrePrefixes.circuit.get(Materials.Bio), 8L}, + ItemList.Gravistar.get(8L), + ItemList.Emitter_UEV.get(4L), + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 4}, GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Tritanium, 64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Tritanium, 64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Tritanium, 64L), @@ -910,7 +989,7 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(9216)}, ItemList.Field_Generator_UEV.get(1L), 4000, 800000); - //UHV Energy Hatch + //UHV-UMV Energy Hatch & Dynamo TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Energy_UV.get(1L), 24000, 16, 50000, 2, new Object[]{ ItemList.Hull_MAX.get(1L), @@ -931,7 +1010,7 @@ public class DreamCraftRecipeLoader implements Runnable { new FluidStack(FluidRegistry.getFluid("ic2coolant"), 16000), Materials.SolderingAlloy.getMolten(5760), }, ItemList.Hatch_Energy_MAX.get(1L), 1000, 2000000); - + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Dynamo_UV.get(1L), 48000, 32, 100000, 4, new Object[]{ ItemList.Hull_MAX.get(1L), @@ -953,19 +1032,139 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(5760)}, ItemList.Hatch_Dynamo_MAX.get(1L), 1000, 2000000); + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Energy_MAX.get(1L), + 48000, 32, 100000, 4, new Object[]{ + getItemContainer("Hull_UEV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.SuperconductorUHV, 4L), + ItemList.Circuit_Chip_QPIC.get(4L), + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 2L}, + ItemList.UHV_Coil.get(4L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(1L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 32000), + Materials.SolderingAlloy.getMolten(11520), + Materials.UUMatter.getFluid(8000L)}, + getItemContainer("Hatch_Energy_UEV").get(1L), 1000, 8000000); + + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_Dynamo_MAX.get(1L), + 96000, 64, 200000, 8, new Object[]{ + getItemContainer("Hull_UEV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.spring, Materials.Longasssuperconductornameforuhvwire, 16L), + ItemList.Circuit_Chip_QPIC.get(4L), + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 2L}, + ItemList.UHV_Coil.get(4L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(1L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 32000), + Materials.SolderingAlloy.getMolten(11520), + Materials.UUMatter.getFluid(8000L)}, + getItemContainer("Hatch_Dynamo_UEV").get(1L), 1000, 8000000); + + TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Energy_UEV").get(1L), + 96000, 64, 200000, 8, new Object[]{ + getItemContainer("Hull_UIV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.SuperconductorUHV, 8L), + ItemList.Circuit_Chip_QPIC.get(4L), + getItemContainer("NanoCircuit").get(2), + ItemList.UHV_Coil.get(8L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(2L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 64000), + Materials.SolderingAlloy.getMolten(23040), + Materials.UUMatter.getFluid(16000L)}, + getItemContainer("Hatch_Energy_UIV").get(1L), 1000, 16000000); + + TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Dynamo_UEV").get(1L), + 192000, 128, 400000, 16, new Object[]{ + getItemContainer("Hull_UIV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.spring, Materials.Longasssuperconductornameforuhvwire, 32L), + ItemList.Circuit_Chip_QPIC.get(4L), + getItemContainer("NanoCircuit").get(2), + ItemList.UHV_Coil.get(8L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(2L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 64000), + Materials.SolderingAlloy.getMolten(23040), + Materials.UUMatter.getFluid(16000L)}, + getItemContainer("Hatch_Dynamo_UIV").get(1L), 1000, 16000000); + + TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Energy_UIV").get(1L), + 192000, 128, 400000, 16, new Object[]{ + getItemContainer("Hull_UMV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.wireGt16, Materials.SuperconductorUHV, 16L), + ItemList.Circuit_Chip_QPIC.get(4L), + getItemContainer("QuantumCircuit").get(2), + ItemList.UHV_Coil.get(16L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(4L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 128000), + Materials.SolderingAlloy.getMolten(46080), + Materials.UUMatter.getFluid(32000L)}, + getItemContainer("Hatch_Energy_UMV").get(1L), 1000, 32000000); + + TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("Hatch_Dynamo_UIV").get(1L), + 384000, 256, 800000, 32, new Object[]{ + getItemContainer("Hull_UMV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.spring, Materials.Longasssuperconductornameforuhvwire, 64L), + ItemList.Circuit_Chip_QPIC.get(4L), + getItemContainer("QuantumCircuit").get(2), + ItemList.UHV_Coil.get(16L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UEV.get(4L)}, + new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 128000), + Materials.SolderingAlloy.getMolten(46080), + Materials.UUMatter.getFluid(32000L)}, + getItemContainer("Hatch_Dynamo_UMV").get(1L), 1000, 32000000); + //UHV Circuit TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Circuit_Wetwaresupercomputer.get(1L), - 24000, 64, 50000, 4, new ItemStack[]{ + 24000, 64, 50000, 4, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Tritanium, 2), ItemList.Circuit_Wetwaresupercomputer.get(2L), ItemList.ZPM_Coil.get(16L), - ItemList.Circuit_Parts_CapacitorSMD.get(64L), - ItemList.Circuit_Parts_ResistorSMD.get(64L), - ItemList.Circuit_Parts_TransistorSMD.get(64L), - ItemList.Circuit_Parts_DiodeSMD.get(64L), + ItemList.Circuit_Parts_CapacitorASMD.get(16L), + ItemList.Circuit_Parts_ResistorASMD.get(16L), + ItemList.Circuit_Parts_TransistorASMD.get(16L), + ItemList.Circuit_Parts_DiodeASMD.get(16L), ItemList.Circuit_Chip_Ram.get(48L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorZPM, 64L), - GT_OreDictUnificator.get(OrePrefixes.foil, (Materials.AnySyntheticRubber), 64L), + new Object[]{OrePrefixes.foil.get(Materials.AnySyntheticRubber), 64L}, }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(2880L), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 10000), @@ -974,17 +1173,17 @@ public class DreamCraftRecipeLoader implements Runnable { //Bio Chips TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Circuit_Biowarecomputer.get(1L), - 48000, 128, 500000, 8, new ItemStack[]{ + 48000, 128, 500000, 8, new Object[]{ ItemList.Circuit_Board_Bio_Ultra.get(2L), ItemList.Circuit_Biowarecomputer.get(2L), - ItemList.Circuit_Parts_TransistorSMD.get(16L), - ItemList.Circuit_Parts_ResistorSMD.get(16L), - ItemList.Circuit_Parts_CapacitorSMD.get(16L), - ItemList.Circuit_Parts_DiodeSMD.get(48L), + ItemList.Circuit_Parts_TransistorASMD.get(16L), + ItemList.Circuit_Parts_ResistorASMD.get(16L), + ItemList.Circuit_Parts_CapacitorASMD.get(16L), + ItemList.Circuit_Parts_DiodeASMD.get(16L), ItemList.Circuit_Chip_NOR.get(32L), ItemList.Circuit_Chip_Ram.get(64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.NiobiumTitanium, 32L), - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 16L), + new Object[]{OrePrefixes.foil.get(Materials.AnySyntheticRubber), 64L}, }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(1440L), Materials.BioMediumSterilized.getFluid(1440L), @@ -993,17 +1192,17 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Circuit_Biowaresupercomputer.get(1L), 4000, 500000); TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Circuit_Biowaresupercomputer.get(1L), - 96000, 256, 1000000, 16, new ItemStack[]{ + 96000, 256, 1000000, 16, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Tritanium, 4L), ItemList.Circuit_Biowaresupercomputer.get(2L), ItemList.UV_Coil.get(16L), - ItemList.Circuit_Parts_CapacitorSMD.get(64L), - ItemList.Circuit_Parts_ResistorSMD.get(64L), - ItemList.Circuit_Parts_TransistorSMD.get(64L), - ItemList.Circuit_Parts_DiodeSMD.get(64L), + ItemList.Circuit_Parts_CapacitorASMD.get(24L), + ItemList.Circuit_Parts_ResistorASMD.get(24L), + ItemList.Circuit_Parts_TransistorASMD.get(24L), + ItemList.Circuit_Parts_DiodeASMD.get(24L), ItemList.Circuit_Chip_Ram.get(64L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorUHV, 64), - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 64), + new Object[]{OrePrefixes.foil.get(Materials.AnySyntheticRubber), 64L}, GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Polybenzimidazole, 64) }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(2880L), @@ -1011,23 +1210,23 @@ public class DreamCraftRecipeLoader implements Runnable { new FluidStack(FluidRegistry.getFluid("ic2coolant"), 20000) }, ItemList.Circuit_Biomainframe.get(1L), 6000, 2000000); - //GTNH Circuits + //GTNH UIV, UMV, UXV Circuits TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Circuit_Biomainframe.get(1L), - 192000, 512, 2000000, 32, new ItemStack[]{ + 192000, 512, 2000000, 32, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Tritanium, 8), ItemList.Circuit_Biomainframe.get(2L), - ItemList.Circuit_Parts_CapacitorSMD.get(64L), - ItemList.Circuit_Parts_ResistorSMD.get(64L), - ItemList.Circuit_Parts_TransistorSMD.get(64L), - ItemList.Circuit_Parts_DiodeSMD.get(64L), + ItemList.Circuit_Parts_CapacitorASMD.get(32L), + ItemList.Circuit_Parts_ResistorASMD.get(32L), + ItemList.Circuit_Parts_TransistorASMD.get(32L), + ItemList.Circuit_Parts_DiodeASMD.get(32L), ItemList.Circuit_Chip_Ram.get(64L), ItemList.Circuit_Chip_NPIC.get(64L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Draconium, 64), GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 64), - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 64), + new Object[]{OrePrefixes.foil.get(Materials.AnySyntheticRubber), 64L}, GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Polybenzimidazole, 64) }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(3760L), + Materials.SolderingAlloy.getMolten(3744L), Materials.Naquadria.getMolten(4032L), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 20000) }, getItemContainer("NanoCircuit").get(1L), 8000, 8000000); @@ -1038,17 +1237,17 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Circuit_Board_Bio_Ultra.get(1L), getItemContainer("PicoWafer").get(4L), getItemContainer("NanoCircuit").get(2L), - ItemList.Circuit_Parts_TransistorSMD.get(64L), - ItemList.Circuit_Parts_ResistorSMD.get(64L), - ItemList.Circuit_Parts_CapacitorSMD.get(64L), - ItemList.Circuit_Parts_DiodeSMD.get(64L), + ItemList.Circuit_Parts_TransistorASMD.get(484L), + ItemList.Circuit_Parts_ResistorASMD.get(48L), + ItemList.Circuit_Parts_CapacitorASMD.get(48L), + ItemList.Circuit_Parts_DiodeASMD.get(48L), ItemList.Circuit_Chip_PPIC.get(64L), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.NiobiumTitanium, 16), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Osmium, 32), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Neutronium, 16), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Lanthanum, 64) }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(3760L), + Materials.SolderingAlloy.getMolten(3744L), Materials.UUMatter.getFluid(8000L), Materials.Osmium.getMolten(1152L) }, getItemContainer("PikoCircuit").get(1L), 10000, 8000000); @@ -1056,47 +1255,47 @@ public class DreamCraftRecipeLoader implements Runnable { TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("PikoCircuit").get(1L), 720000, 2048, 8000000, 128, new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 16), - getItemContainer("PikoCircuit").get(8L), - ItemList.Circuit_Parts_CapacitorSMD.get(64L), - ItemList.Circuit_Parts_DiodeSMD.get(64L), - ItemList.Circuit_Parts_TransistorSMD.get(64L), - ItemList.Circuit_Parts_ResistorSMD.get(64L), + getItemContainer("PikoCircuit").get(2L), + ItemList.Circuit_Parts_CapacitorASMD.get(64L), + ItemList.Circuit_Parts_DiodeASMD.get(64L), + ItemList.Circuit_Parts_TransistorASMD.get(64L), + ItemList.Circuit_Parts_ResistorASMD.get(64L), ItemList.Circuit_Chip_QPIC.get(64L), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.NiobiumTitanium, 64), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Indium, 64), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Bedrockium, 8), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Lanthanum, 64) }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(3760L), + Materials.SolderingAlloy.getMolten(3744L), Materials.UUMatter.getFluid(24000L), Materials.Osmium.getMolten(2304L) }, getItemContainer("QuantumCircuit").get(1L), 20000, 32000000); - //Stargate Stuff + //Stargate Recipes if (Loader.isModLoaded("eternalsingularity") && Loader.isModLoaded("SGCraft")) { TT_recipeAdder.addResearchableAssemblylineRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Infinity, 1L), - 192000, 512, 2000000, 32, new ItemStack[]{ + 32000000, 8192, 128000000, 1, new ItemStack[]{ GT_ModHandler.getModItem("eternalsingularity", "eternal_singularity", 1L), - ItemList.Sensor_UV.get(16L), + ItemList.Sensor_UEV.get(16L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.Infinity, 16L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.CosmicNeutronium, 16L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.NaquadahAlloy, 64L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.NaquadahAlloy, 64L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.NaquadahAlloy, 64L), - getItemContainer("NanoCircuit").get(1L).splitStack(16) + getItemContainer("QuantumCircuit").get(1L).splitStack(16) }, new FluidStack[]{ Materials.Neutronium.getMolten(36864L), Materials.Tritanium.getMolten(36864L), - Materials.Tetranaquadahdiindiumhexaplatiumosminid.getMolten(36864L), + Materials.Longasssuperconductornameforuhvwire.getMolten(36864L), Materials.Silver.getPlasma(36864L) }, - getItemContainer("StargateShieldingFoil").get(1L), 72000, 2000000); + getItemContainer("StargateShieldingFoil").get(1L), 72000, 500000000); TT_recipeAdder.addResearchableAssemblylineRecipe(getItemContainer("StargateShieldingFoil").get(1L), - 192000, 512, 2000000, 32, new ItemStack[]{ - ItemList.Electric_Piston_UV.get(16L), - ItemList.Electric_Motor_UV.get(64L), + 32000000, 8192, 128000000, 1, new ItemStack[]{ + ItemList.Electric_Piston_UEV.get(16L), + ItemList.Electric_Motor_UEV.get(64L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.Infinity, 16L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.NaquadahAlloy, 64L), GT_OreDictUnificator.get(OrePrefixes.block, Materials.NetherStar, 64L), @@ -1105,18 +1304,18 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Ardite, 8L), GT_OreDictUnificator.get(OrePrefixes.gemExquisite, Materials.Ruby, 16L), GT_OreDictUnificator.get(OrePrefixes.gemExquisite, Materials.Jasper, 16L), - getItemContainer("NanoCircuit").get(1L).splitStack(32) + getItemContainer("QuantumCircuit").get(1L).splitStack(32) }, new FluidStack[]{ Materials.Neutronium.getMolten(9216L), Materials.Tritanium.getMolten(9216L), - Materials.Tetranaquadahdiindiumhexaplatiumosminid.getMolten(9216L), + Materials.Longasssuperconductornameforuhvwire.getMolten(9216L), Materials.Silver.getPlasma(9216L) }, - getItemContainer("StargateChevron").get(1L), 72000, 2000000); + getItemContainer("StargateChevron").get(1L), 72000, 500000000); TT_recipeAdder.addResearchableAssemblylineRecipe(GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 1L), - 192000, 512, 2000000, 32, new ItemStack[]{ + 32000000, 8192, 128000000, 1, new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Infinity, 64L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.NaquadahAlloy, 64L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.CosmicNeutronium, 64L), @@ -1128,42 +1327,87 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.Tritanium.getMolten(73728L), Materials.Concrete.getMolten(73728L) }, - getItemContainer("StargateFramePart").get(1L), 72000, 2000000); - - //Batteries - TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Energy_Cluster.get(1L), 12000, 16, 100000, 3, new Object[]{ - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Tritanium, 64L), - new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 4L}, - ItemList.Energy_Cluster.get(8L), - ItemList.Field_Generator_UV.get(2), - ItemList.Circuit_Wafer_HPIC.get(64), - ItemList.Circuit_Wafer_HPIC.get(64), - ItemList.Circuit_Parts_DiodeSMD.get(64), - GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorUHV, 32), - }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(2880), - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 16000) - }, ItemList.ZPM2.get(1), 3000, 400000); - - TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.ZPM2.get(1L), 24000, 64, 200000, 6, new Object[]{ - GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 32L), - GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 32L), - new Object[]{OrePrefixes.circuit.get(Materials.Bio), 4L}, - ItemList.ZPM2.get(8), - ItemList.Field_Generator_UHV.get(4), - ItemList.Circuit_Wafer_UHPIC.get(64), - ItemList.Circuit_Wafer_UHPIC.get(64), - ItemList.Circuit_Wafer_SoC2.get(32), - ItemList.Circuit_Parts_DiodeSMD.get(64), - GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.Neutronium, 64), - }, new FluidStack[]{ - Materials.SolderingAlloy.getMolten(3760), - Materials.Naquadria.getMolten(9000), - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 32000) - }, ItemList.ZPM3.get(1), 4000, 1600000); + getItemContainer("StargateFramePart").get(1L), 72000, 500000000); } //endregion + + //Deep Dark Portal + TT_recipeAdder.addResearchableAssemblylineRecipe(GT_ModHandler.getModItem("dreamcraft", "item.HeavyDutyPlateTier8", 1, 0), + 16777216, 2048, 2000000, 64, new Object[]{ + GT_ModHandler.getModItem("ExtraUtilities", "cobblestone_compressed", 1, 7), + GT_ModHandler.getModItem("IC2", "blockMachine2", 1, 0), + GT_OreDictUnificator.get(OrePrefixes.block, Materials.Infinity, 4L), + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Nano), 1}, + GT_ModHandler.getModItem("dreamcraft", "item.PicoWafer", 32, 0), + ItemList.Robot_Arm_UEV.get(4), + ItemList.Emitter_UEV.get(4), + ItemList.Sensor_UEV.get(4), + }, new FluidStack[]{ + new FluidStack(FluidRegistry.getFluid("oganesson"), 50000), + Materials.Infinity.getMolten(9216L), + Materials.Cheese.getMolten(232000L), + }, ItemList.Block_BedrockiumCompressed.get(1), 10000, 5000000); + + //Debug maintenance hatch + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Hatch_AutoMaintenance.get(1L), + 2764800, 128, 500000, 6, new Object[]{ + ItemList.Hatch_AutoMaintenance.get(1L), + ItemList.Robot_Arm_UV.get(1L), + ItemList.Electric_Pump_UV.get(1L), + ItemList.Conveyor_Module_UV.get(1L), + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 4L}, + ItemList.Energy_LapotronicOrb2.get(1L), + ItemList.Duct_Tape.get(64L), + ItemList.Duct_Tape.get(64L), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Americium, 64L), + }, new FluidStack[]{ + Materials.Lubricant.getFluid(256000), + Materials.SolderingAlloy.getMolten(1296L), + }, CustomItemList.hatch_CreativeMaintenance.get(1), 6000, 500000); + + //Batteries + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Energy_Cluster.get(1L), 12000, 16, 100000, 3, new Object[]{ + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Tritanium, 64L), + new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Infinite), 1L}, + ItemList.Energy_Cluster.get(8L), + ItemList.Field_Generator_UV.get(2), + ItemList.Circuit_Wafer_HPIC.get(64), + ItemList.Circuit_Wafer_HPIC.get(64), + ItemList.Circuit_Parts_DiodeASMD.get(32), + GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorUHV, 32), + }, new FluidStack[]{ + Materials.SolderingAlloy.getMolten(2880), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 16000) + }, ItemList.ZPM2.get(1), 3000, 400000); + + TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.ZPM2.get(1L), 24000, 64, 200000, 6, new Object[]{ + GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 32L), + GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 32L), + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, + new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1L}, + ItemList.ZPM2.get(8), + ItemList.Field_Generator_UHV.get(4), + ItemList.Circuit_Wafer_UHPIC.get(64), + ItemList.Circuit_Wafer_UHPIC.get(64), + ItemList.Circuit_Wafer_SoC2.get(32), + ItemList.Circuit_Parts_DiodeASMD.get(64), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 64), + }, new FluidStack[]{ + Materials.SolderingAlloy.getMolten(4608), + Materials.Naquadria.getMolten(9216), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 32000) + }, ItemList.ZPM3.get(1), 4000, 1600000); + + //region singleblocks //Tesla Transceiver LV 1A @@ -1541,6 +1785,20 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 24), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 24), }, Materials.Epoxid.getMolten(360), CustomItemList.teslaCapacitor.getWithDamage(1, 4), 320, 7680); + //LuV Tesla Capacitor + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.HSSG, 4), + GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 14), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 28), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 28), + }, Materials.Epoxid.getMolten(432), CustomItemList.teslaCapacitor.getWithDamage(1, 5), 320, 30720); + //ZPM Tesla Capacitor + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Naquadah, 4), + GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 16), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 32), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 32), + }, Materials.Epoxid.getMolten(504), CustomItemList.teslaCapacitor.getWithDamage(1, 6), 320, 122880); //Tesla Cover GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ CustomItemList.teslaComponent.getWithDamage(4, 0), @@ -1585,7 +1843,18 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.plate, Materials.NickelZincFerrite, 2), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 8), }, Materials.SolderingAlloy.getMolten(72), CustomItemList.teslaCover.getWithDamage(1, 1), 320, 7680); - + //Ender Fluid Link Cover + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Enderium, 4), + ItemList.Sensor_LuV.get(1), + ItemList.Emitter_LuV.get(1), + ItemList.Electric_Pump_LuV.get(1), + }, Materials.Chrome.getMolten(288), CustomItemList.enderLinkFluidCover.getWithDamage(1, 0), 320, 30720); + //Power Pass Upgrade Cover + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + CustomItemList.Machine_Multi_Transformer.get(1), + GT_Utility.getIntegratedCircuit(1) + }, null, CustomItemList.powerPassUpgradeCover.getWithDamage(1, 0), 320, 30720); //endregion //region recycling @@ -1605,6 +1874,12 @@ public class DreamCraftRecipeLoader implements Runnable { //IV Tesla Capacitor GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 4), GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 12), 300, 2); + //LuV Tesla Capacitor + GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 5), + GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 14), 300, 2); + //ZPM Tesla Capacitor + GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 6), + GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 16), 300, 2); //endregion diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/NoDreamCraftMachineLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/NoDreamCraftMachineLoader.java index adf5d37876..798ffec36c 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/NoDreamCraftMachineLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/NoDreamCraftMachineLoader.java @@ -2,7 +2,7 @@ package com.github.technus.tectech.compatibility.dreamcraft; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_TT_Transformer; import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_WetTransformer; 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 ad24f72cb0..65219271f9 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,16 +1,19 @@ package com.github.technus.tectech.compatibility.gtpp; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import gregtech.api.enums.OrePrefixes; import net.minecraftforge.fluids.FluidStack; import java.lang.reflect.Method; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.getBestUnstableIsotope; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.getFirstStableIsotope; -public class GtppAtomLoader implements Runnable{ +public class GtppAtomLoader { //region reflect a bit - private Class ELEMENT; + private Class<?> ELEMENT; private Object ELEMENT_INSTANCE; private Method getUnlocalizedName,getFluid,generate; @@ -39,16 +42,19 @@ public class GtppAtomLoader implements Runnable{ } //endregion - @Override - public void run() { + public void setTransformations(EMTransformationRegistry transformationInfo) { //region reflect a bit try{ ELEMENT=Class.forName("gtPlusPlus.core.material.ELEMENT"); ELEMENT_INSTANCE=ELEMENT.getMethod("getInstance").invoke(null); - Class clazz=Class.forName("gtPlusPlus.core.material.Material"); + Class<?> clazz=Class.forName("gtPlusPlus.core.material.Material"); getUnlocalizedName=clazz.getMethod("getUnlocalizedName"); - getFluid=clazz.getMethod("getFluid", int.class); + try{ + getFluid=clazz.getMethod("getFluidStack", int.class); + }catch (Exception e){ + getFluid=clazz.getMethod("getFluid", int.class); + } clazz=Class.forName("gtPlusPlus.core.material.MaterialGenerator"); generate=clazz.getMethod("generate", Class.forName("gtPlusPlus.core.material.Material"), boolean.class, boolean.class); @@ -57,34 +63,34 @@ public class GtppAtomLoader implements Runnable{ } //endregion - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), 144), getFluid("NEON",144)); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(10), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), getFluid("NEON",144)); generate("GERMANIUM",true,true); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), 144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), 144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(35), 144), getFluid("BROMINE",144)); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(36), 144), getFluid("KRYPTON",144)); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), 144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), 144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), 144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), 144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), 144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), 144),getFluid("XENON",144)); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), 144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), 144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), 144),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(32), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(34), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(35), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), getFluid("BROMINE",144)); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(36), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), getFluid("KRYPTON",144)); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(40), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(43), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(44), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(45), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(53), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(54), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),getFluid("XENON",144)); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(72), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(75), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(81), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("THALLIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(85),144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),144),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(84), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(85), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(87), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(88), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(89), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(91), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(93), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("NEPTUNIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(96),144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(97),144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(98),144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(99),144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); - transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(100),144),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(96), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(97), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(98), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(99), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(100), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED),OrePrefixes.dust, getUnlocalizedName("FERMIUM"),1); } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java b/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java index fcbb65d609..595d814fc5 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java @@ -8,7 +8,7 @@ import com.github.technus.avrClone.instructions.exceptions.DelayEvent; import com.github.technus.avrClone.memory.EepromMemory; import com.github.technus.avrClone.memory.RemovableMemory; import com.github.technus.avrClone.memory.program.ProgramMemory; -import com.github.technus.tectech.Converter; +import com.github.technus.tectech.util.Converter; import com.github.technus.tectech.TecTech; import li.cil.oc.Settings; import li.cil.oc.api.Driver; @@ -21,7 +21,7 @@ import li.cil.oc.api.machine.Signal; import li.cil.oc.common.SaveHandler; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import org.apache.commons.io.IOUtils; +import org.apache.commons.compress.utils.IOUtils; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java index 9da3b82b40..654b4e37a6 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseEM.java @@ -10,7 +10,7 @@ import net.minecraft.world.World; import openmodularturrets.blocks.turretbases.BlockAbstractTurretBase; import openmodularturrets.handler.ConfigHandler; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; /** * Created by Tec on 27/07/2017. diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java index 97fc8132a2..ed4b72f094 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.openmodularturrets.blocks.turretbases; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java index 7b7167b915..da212d4853 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadEM.java @@ -11,7 +11,7 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import openmodularturrets.tileentity.turretbase.TurretBase; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; /** * Created by Tec on 27/07/2017. diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java index 422b931df5..f4ad25f053 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java @@ -10,7 +10,7 @@ import openmodularturrets.handler.ConfigHandler; import java.text.DecimalFormat; import java.util.List; -import static com.github.technus.tectech.CommonValues.TEC_MARK_EM; +import static com.github.technus.tectech.util.CommonValues.TEC_MARK_EM; import static net.minecraft.util.StatCollector.translateToLocal; /** diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java index e8163833ee..54bd3aaea5 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/entity/projectiles/projectileEM.java @@ -1,10 +1,8 @@ package com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; import gregtech.api.GregTech_API; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; @@ -26,11 +24,12 @@ public class projectileEM extends LaserProjectile { public float gravity=0; private TurretBase turretBase; - private boolean exotic, antiMatter,isAmped; + private boolean strange, antiMatter,isAmped; private int ampLevel; private float massFactor; + private double mass,charge; public projectileEM(World par1World) { super(par1World); @@ -45,96 +44,91 @@ public class projectileEM extends LaserProjectile { } } - public projectileEM(World par1World, TurretBase turretBase, cElementalInstanceStackMap avalableEM) { + public projectileEM(World par1World, TurretBase turretBase, EMInstanceStack projectileContent) { super(par1World, turretBase); this.turretBase = turretBase; - boolean onlyQuarks=true; - if(avalableEM!=null && avalableEM.hasStacks()) { - for (cElementalInstanceStack stack : avalableEM.values()) { - if (!(stack.definition instanceof eQuarkDefinition)) { - onlyQuarks = false; - } - } - if (onlyQuarks) { - avalableEM.clear(); - } else { - cElementalInstanceStack consumeFromThis=avalableEM.get(TecTech.RANDOM.nextInt(avalableEM.size())); - massFactor =consumeFromThis.definition.getMass()/ dHadronDefinition.hadron_n_.getMass(); - - if(consumeFromThis.definition.getType()>1 || consumeFromThis.definition.getType()<-1) { - exotic = true; - } - if(consumeFromThis.definition.getType()<0) { - antiMatter = true; - } + if(projectileContent != null){ + mass=projectileContent.getMass(); + charge=projectileContent.getCharge(); + massFactor =(float) (projectileContent.getDefinition().getMass()/ EMHadronDefinition.hadron_n_.getMass()); - if (consumeFromThis.definition.getCharge() == 0) { - gravity = massFactor / 100f; - } else { - gravity = Math.min(0.0025F / Math.abs(consumeFromThis.definition.getCharge()), massFactor / 100f); - } + if(projectileContent.getDefinition().getGeneration()>1 || projectileContent.getDefinition().getGeneration()<-1) { + strange = true; + } + if(projectileContent.getDefinition().getGeneration()<0) { + antiMatter = true; + } - avalableEM.removeAmount(false,consumeFromThis.definition.getStackForm(1)); + if (projectileContent.getDefinition().getCharge() == 0) { + gravity = massFactor / 100f; + } else { + gravity = Math.min(0.0025F / Math.abs(projectileContent.getDefinition().getCharge()), massFactor / 100f); } } - //todo make the recipe require some overflow hatches - - //todo add more subspace pollution } @Override protected void onImpact(MovingObjectPosition movingobjectposition) { if(ticksExisted > 1) { - if(movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - Block hitBlock = worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); - if(hitBlock != null){ - if (hitBlock.getMaterial().isSolid() && TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter) { - worldObj.playSoundEffect(posX, posY, posZ, "openmodularturrets:laserHit", ConfigHandler.getTurretSoundVolume(), TecTech.RANDOM.nextFloat() + 0.5F); - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, - movingobjectposition.blockX, - movingobjectposition.blockY, - movingobjectposition.blockZ); - worldObj.createExplosion(null, - movingobjectposition.blockX + 0.5D, - movingobjectposition.blockY + 0.5D, - movingobjectposition.blockZ + 0.5D, (exotic?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); - } else { - return; - } - } - } - - if(movingobjectposition.entityHit != null && !worldObj.isRemote) { + if(!worldObj.isRemote){ worldObj.playSoundEffect(posX, posY, posZ, "openmodularturrets:laserHit", ConfigHandler.getTurretSoundVolume(), TecTech.RANDOM.nextFloat() + 0.5F); - if(movingobjectposition.entityHit != null && !worldObj.isRemote) { - float damage = (exotic?10:1) * TecTech.configTecTech.TURRET_DAMAGE_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1); - - if(movingobjectposition.entityHit instanceof EntityPlayer) { - if(canDamagePlayer((EntityPlayer)movingobjectposition.entityHit)) { - movingobjectposition.entityHit.setFire((exotic?10:1)*2); + switch (movingobjectposition.typeOfHit){ + case BLOCK: + Block hitBlock = worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); + if(hitBlock != null){ + if (TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter && hitBlock.getMaterial().isSolid()) { + GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, + movingobjectposition.blockX, + movingobjectposition.blockY, + movingobjectposition.blockZ); + worldObj.createExplosion(null, + movingobjectposition.blockX + 0.5D, + movingobjectposition.blockY + 0.5D, + movingobjectposition.blockZ + 0.5D, + TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * (strange ? 10 : 1) * massFactor * (isAmped ? ampLevel * .1f + 1 : 1) * (ticksExisted / 250f), true); + } else { + return; + } + } + break; + case ENTITY: + float damage = (strange ?10:1) * TecTech.configTecTech.TURRET_DAMAGE_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1); + + if(movingobjectposition.entityHit instanceof EntityPlayer) { + EntityPlayer player=(EntityPlayer)movingobjectposition.entityHit; + if(canDamagePlayer(player)) { + movingobjectposition.entityHit.setFire((strange ?10:1)*2); + movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); + if(antiMatter) { + movingobjectposition.entityHit.hurtResistantTime = 0; + } + if(strange){ + TecTech.anomalyHandler.addCancer(player,mass); + } + if(charge!=0) { + TecTech.anomalyHandler.addCharge(player,charge); + } + } + } else { + movingobjectposition.entityHit.setFire((strange ?10:1)*2); movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); if(antiMatter) { movingobjectposition.entityHit.hurtResistantTime = 0; } } - } else { - movingobjectposition.entityHit.setFire((exotic?10:1)*2); - movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); - if(antiMatter) { - movingobjectposition.entityHit.hurtResistantTime = 0; + + if (TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter) { + GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, + (int)movingobjectposition.entityHit.posX, + (int)movingobjectposition.entityHit.posY, + (int)movingobjectposition.entityHit.posZ); + worldObj.createExplosion(null, + movingobjectposition.entityHit.posX, + movingobjectposition.entityHit.posY, + movingobjectposition.entityHit.posZ, + (strange ?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); } - } - - if (TecTech.configTecTech.ENABLE_TURRET_EXPLOSIONS && antiMatter) { - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, - (int)movingobjectposition.entityHit.posX, - (int)movingobjectposition.entityHit.posY, - (int)movingobjectposition.entityHit.posZ); - worldObj.createExplosion(null, - movingobjectposition.entityHit.posX, - movingobjectposition.entityHit.posY, - movingobjectposition.entityHit.posZ, (exotic?10:1) * TecTech.configTecTech.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? ampLevel*.1f +1:1) * (ticksExisted/250f), true); - } + break; } } setDead(); diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java index 2de6b39c4c..742232d8c6 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turret/TileTurretHeadEM.java @@ -2,7 +2,8 @@ package com.github.technus.tectech.compatibility.openmodularturrets.tileentity.t import com.github.technus.tectech.compatibility.openmodularturrets.entity.projectiles.projectileEM; import com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase.TileTurretBaseEM; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import net.minecraft.entity.Entity; import net.minecraft.item.Item; @@ -13,11 +14,13 @@ import openmodularturrets.handler.ConfigHandler; import openmodularturrets.tileentity.turrets.TurretHead; import openmodularturrets.util.TurretHeadUtil; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; + /** * Created by Bass on 27/07/2017. */ public class TileTurretHeadEM extends TurretHead{ - private cElementalInstanceStackMap hatchContentPointer; + private EMInstanceStackMap hatchContentPointer; @Override public int getTurretRange() { @@ -49,7 +52,7 @@ public class TileTurretHeadEM extends TurretHead{ @Override public boolean requiresAmmo() { - return hatchContentPointer == null || !hatchContentPointer.hasStacks(); + return hatchContentPointer == null || hatchContentPointer.isEmpty(); } @Override @@ -64,7 +67,15 @@ public class TileTurretHeadEM extends TurretHead{ @Override public final TurretProjectile createProjectile(World world, Entity target, ItemStack ammo) { - return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), hatchContentPointer); + if (hatchContentPointer == null || hatchContentPointer.isEmpty()) { + return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), null); + } + EMInstanceStack stack = hatchContentPointer.getRandom(); + double amount = Math.min(EM_COUNT_PER_MATERIAL_AMOUNT, stack.getAmount()); + hatchContentPointer.removeAmount(stack.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT); + stack=stack.clone(); + stack.setAmount(amount); + return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), stack); } @Override diff --git a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java index a31ba4ef2c..0dbc33e007 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.openmodularturrets.tileentity.turretbase; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import cpw.mods.fml.common.Optional; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -25,7 +25,7 @@ public class TileTurretBaseEM extends TurretBaseTierFiveTileEntity { return "turretBaseEM"; } - public final cElementalInstanceStackMap getContainerHandler() { + public final EMInstanceStackMap getContainerHandler() { World worldIn = getWorldObj(); TileEntity te; if ((te = worldIn.getTileEntity(xCoord + 1, yCoord, zCoord)) instanceof IGregTechTileEntity && @@ -61,8 +61,8 @@ public class TileTurretBaseEM extends TurretBaseTierFiveTileEntity { return null; } - private cElementalInstanceStackMap getFromHatch(GT_MetaTileEntity_Hatch_InputElemental hatch) { + private EMInstanceStackMap getFromHatch(GT_MetaTileEntity_Hatch_InputElemental hatch) { hatch.updateTexture((byte) 8,(byte) 4); - return hatch.getContainerHandler(); + return hatch.getContentHandler(); } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java index 778fbad919..b2050bbac5 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/spartakcore/SpartakCoreRecipeLoader.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.compatibility.spartakcore; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.recipe.TT_recipeAdder; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -7,13 +8,10 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.Behaviou import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.Behaviour_ElectromagneticSeparator; import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.Behaviour_Recycler; import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; - -import cpw.mods.fml.common.Loader; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import gregtech.api.interfaces.IItemContainer; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; @@ -22,17 +20,13 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import java.lang.reflect.Method; - -import static com.github.technus.tectech.loader.recipe.RecipeLoader.getOrDefault; +import static com.github.technus.tectech.loader.recipe.BaseRecipeLoader.getOrDefault; /** * Created by Spartak1997 on 28.07.2019. */ -public class SpartakCoreRecipeLoader implements Runnable { - - @Override - public void run() { +public class SpartakCoreRecipeLoader { + public void run(EMTransformationRegistry transformationInfo) { //Quantum Glass GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompat.java deleted file mode 100644 index 2d531858d0..0000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompat.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - - -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; - -import java.util.HashMap; - -/** - * Created by Tec on 21.05.2017. - */ -public class AspectDefinitionCompat { - public static AspectDefinitionCompat aspectDefinitionCompat; - static final HashMap<cElementalDefinition,String> defToAspect = new HashMap<>(); - public static final HashMap<String,cElementalDefinition> aspectToDef = new HashMap<>(); - - public void run(){} - - Object getAspect(cElementalDefinition definition){ - return null; - } - - String getAspectTag(cElementalDefinition definition){ - return null; - } - - iElementalDefinition getDefinition(String aspect){ - return null; - } -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java deleted file mode 100644 index da930a1d79..0000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/AspectDefinitionCompatEnabled.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import thaumcraft.api.aspects.Aspect; - -import java.util.ArrayList; - -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition.*; - -/** - * Created by Tec on 21.05.2017. - */ -public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat { - @Override - public void run(){ - defToAspect.put(magic_air,"aer"); - defToAspect.put(magic_earth,"terra"); - defToAspect.put(magic_fire,"ignis"); - defToAspect.put(magic_water,"aqua"); - defToAspect.put(magic_order,"ordo"); - defToAspect.put(magic_entropy,"perditio"); - - aspectToDef.put("aer",magic_air); - aspectToDef.put("terra",magic_earth); - aspectToDef.put("ignis",magic_fire); - aspectToDef.put("aqua",magic_water); - aspectToDef.put("ordo",magic_order); - aspectToDef.put("perditio",magic_entropy); - - ArrayList<Aspect> list=Aspect.getCompoundAspects(); - Aspect[] array= list.toArray(new Aspect[0]); - while (!list.isEmpty()) { - for (Aspect aspect : array) { - if (list.contains(aspect)) { - Aspect[] content = aspect.getComponents(); - if (content.length != 2) { - list.remove(aspect); - }else if(aspectToDef.containsKey(content[0].getTag()) && aspectToDef.containsKey(content[1].getTag())){ - try { - dComplexAspectDefinition newAspect; - if(content[0].getTag().equals(content[1].getTag())){ - newAspect = new dComplexAspectDefinition(aspectToDef.get(content[0].getTag()).getStackForm(2) - ); - }else{ - newAspect = new dComplexAspectDefinition(aspectToDef.get(content[0].getTag()).getStackForm(1), aspectToDef.get(content[1].getTag()).getStackForm(1) - ); - } - aspectToDef.put(aspect.getTag(),newAspect); - defToAspect.put(newAspect,aspect.getTag()); - }catch (tElementalException e) { - /**/ - }finally { - list.remove(aspect); - } - } - } - } - } - } - - @Override - Aspect getAspect(cElementalDefinition definition) { - return Aspect.getAspect(defToAspect.get(definition)); - } - - @Override - String getAspectTag(cElementalDefinition definition) { - return defToAspect.get(definition); - } - - @Override - iElementalDefinition getDefinition(String aspect) { - return aspectToDef.get(aspect); - } - -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java new file mode 100644 index 0000000000..8c90dc939c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMComplexAspectDefinition.java @@ -0,0 +1,264 @@ +package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.util.Util; + +import java.util.ArrayList; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by Tec on 06.05.2017. + */ +public final class EMComplexAspectDefinition extends EMComplexTemplate { + private final int hash; + private final double mass; + + private static final String nbtType = "`"; + + private final EMConstantStackMap aspectStacks; + + public EMComplexAspectDefinition(EMDefinitionStack... aspects) throws EMException { + this(true, new EMConstantStackMap(aspects)); + } + + private EMComplexAspectDefinition(boolean check, EMDefinitionStack... aspects) throws EMException { + this(check, new EMConstantStackMap(aspects)); + } + + public EMComplexAspectDefinition(EMConstantStackMap aspects) throws EMException { + this(true, aspects); + } + + private EMComplexAspectDefinition(boolean check, EMConstantStackMap aspects) throws EMException { + if (check && !canTheyBeTogether(aspects)) { + throw new EMException("Complex Aspect Definition error"); + } + aspectStacks = aspects; + float mass = 0; + for (EMDefinitionStack stack : aspects.valuesToArray()) { + mass += stack.getMass(); + } + this.mass = mass; + hash = super.hashCode(); + } + + //public but u can just try{}catch(){} the constructor it still calls this method + private static boolean canTheyBeTogether(EMConstantStackMap stacks) { + long amount = 0; + for (EMDefinitionStack aspects : stacks.valuesToArray()) { + if (!(aspects.getDefinition() instanceof EMComplexAspectDefinition) && !(aspects.getDefinition() instanceof EMPrimalAspectDefinition)) { + return false; + } + if((int) aspects.getAmount() != aspects.getAmount()){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } + amount += aspects.getAmount(); + } + return amount == 2; + } + + @Override + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Aspect"); + } + + @Override + public String getShortLocalizedName() { + String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectLocalizedName(this); + if (name != null) { + return name.substring(0, 1).toUpperCase() + name.substring(1); + } else { + return getSymbol(); + } + } + + @Override + public String getSymbol() { + StringBuilder symbol = new StringBuilder(8); + for (EMDefinitionStack aspect : aspectStacks.valuesToArray()) { + if (aspect.getDefinition() instanceof EMPrimalAspectDefinition) { + for (int i = 0; i < aspect.getAmount(); i++) { + symbol.append(aspect.getDefinition().getSymbol()); + } + } else { + symbol.append('('); + for (int i = 0; i < aspect.getAmount(); i++) { + symbol.append(aspect.getDefinition().getSymbol()); + } + symbol.append(')'); + } + } + return symbol.toString(); + } + + @Override + public String getShortSymbol() { + StringBuilder symbol = new StringBuilder(8); + for (EMDefinitionStack aspect : aspectStacks.valuesToArray()) { + if (aspect.getDefinition() instanceof EMPrimalAspectDefinition) { + for (int i = 0; i < aspect.getAmount(); i++) { + symbol.append(aspect.getDefinition().getShortSymbol()); + } + } else { + symbol.append('('); + for (int i = 0; i < aspect.getAmount(); i++) { + symbol.append(aspect.getDefinition().getShortSymbol()); + } + symbol.append(')'); + } + } + return symbol.toString(); + } + + @Override + protected String getIndirectTagValue() { + return nbtType; + } + + @Override + public double getRawTimeSpan(long currentEnergy) { + return -1; + } + + @Override + public boolean isTimeSpanHalfLife() { + return false; + } + + @Override + public int getCharge() { + return 0; + } + + @Override + public int getGeneration() { + return 0; + } + + @Override + public int getMaxColors() { + return -1; + } + + @Override + public EMConstantStackMap getSubParticles() { + return aspectStacks; + } + + @Override + public EMDecay[] getEnergyInducedDecay(long energyLevel) { + return new EMDecay[]{new EMDecay(0.75F, aspectStacks), deadEnd}; + } + + @Override + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return false; + } + + @Override + public boolean usesMultipleDecayCalls(long energyLevel) { + return false; + } + + @Override + public boolean decayMakesEnergy(long energyLevel) { + return false; + } + + @Override + public boolean fusionMakesEnergy(long energyLevel) { + return false; + } + + @Override + public EMDecay[] getNaturalDecayInstant() { + return NO_DECAY; + } + + @Override + public EMDecay[] getDecayArray() { + return NO_DECAY; + } + + @Override + public double getMass() { + return mass; + } + + @Override + public IEMDefinition getAnti() { + return null; + } + + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(nbtType, new EMIndirectType((definitionsRegistry, nbt)-> + new EMComplexAspectDefinition(EMConstantStackMap.fromNBT(definitionsRegistry,nbt)), EMComplexAspectDefinition.class, "tt.keyword.Aspect")); + if (DEBUG_MODE) { + TecTech.LOGGER.info("Registered Elemental Matter Class: ComplexAspect " + nbtType + ' ' + getClassTypeStatic()); + } + } + + @Override + public int getMatterMassType() { + return getClassTypeStatic(); + } + + public static int getClassTypeStatic() { + return -96; + } + + @Override + public int hashCode() { + return hash; + } + + @Override + public void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel) { + if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS, capabilities)) { + lines.add(getShortSymbol()); + } + } + + @Override + public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { + if (Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { + lines.add(translateToLocal("tt.keyword.CLASS") + " = " + nbtType + ' ' + getMatterMassType()); + } + if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS, capabilities)) { + lines.add(translateToLocal("tt.keyword.NAME") + " = " + getLocalizedName()); + //lines.add("SYMBOL = "+getSymbol()); + } + if (Util.areBitsSet(SCAN_GET_CHARGE, capabilities)) { + lines.add(translateToLocal("tt.keyword.CHARGE") + " = " + getCharge() / 3f + " e"); + } + if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { + lines.add(hasColor() ? translateToLocal("tt.keyword.COLORLESS") : translateToLocal("tt.keyphrase.CARRIES_COLOR")); + } + if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) { + lines.add(translateToLocal("tt.keyword.MASS") + " = " + getMass() + " eV/c\u00b2"); + } + if (Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add(translateToLocal("tt.keyphrase.LIFE_TIME") + " = " + getRawTimeSpan(energyLevel) + " s"); + lines.add(" " + translateToLocal("tt.keyphrase.At_current_energy_level")); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java new file mode 100644 index 0000000000..6fa709ef3e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/EMPrimalAspectDefinition.java @@ -0,0 +1,52 @@ +package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; + +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by Tec on 06.05.2017. + */ +public final class EMPrimalAspectDefinition extends EMPrimitiveTemplate { + public static final EMPrimalAspectDefinition + magic_air = new EMPrimalAspectDefinition("tt.keyword.Air", "a`", 1e1D, 45,"a`"), + magic_earth = new EMPrimalAspectDefinition("tt.keyword.Earth", "e`", 1e9D, 44,"e`"), + magic_fire = new EMPrimalAspectDefinition("tt.keyword.Fire", "f`", 1e3D, 43,"f`"), + magic_water = new EMPrimalAspectDefinition("tt.keyword.Water", "w`", 1e7D, 42,"w`"), + magic_order = new EMPrimalAspectDefinition("tt.keyword.Order", "o`", 1e5D, 40,"o`"), + magic_entropy = new EMPrimalAspectDefinition("tt.keyword.Chaos", "c`", 1e5D, 41,"c`"); + + private EMPrimalAspectDefinition(String name, String symbol, double mass, int ID,String bind) { + super(name, symbol, 0, mass, 0, -1, ID,bind); + } + + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMPrimalAspectDefinition.class,"tt.keyword.Primal")); + magic_air.init(registry,null, -1F, -1, -1, NO_DECAY); + magic_earth.init(registry,null, -1F, -1, -1, NO_DECAY); + magic_fire.init(registry,null, -1F, -1, -1, NO_DECAY); + magic_water.init(registry,null, -1F, -1, -1, NO_DECAY); + magic_order.init(registry,null, -1F, -1, -1, NO_DECAY); + magic_entropy.init(registry,null, -1F, -1, -1, NO_DECAY); + } + + @Override + public String getShortLocalizedName() { + String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectLocalizedName(this); + return name != null ? super.getShortLocalizedName() + " (" + name + ")" : super.getShortLocalizedName(); + } + + @Override + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Primal"); + } + + @Override + public boolean isTimeSpanHalfLife() { + return false; + } +}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java deleted file mode 100644 index 8961215354..0000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java +++ /dev/null @@ -1,319 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.ArrayList; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay.noDecay; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; -import static net.minecraft.util.StatCollector.translateToLocal; - -/** - * Created by Tec on 06.05.2017. - */ -public final class dComplexAspectDefinition extends cElementalDefinition implements iElementalAspect { - private final int hash; - public final float mass; - - private static final byte nbtType = (byte) 'c'; - - private final cElementalDefinitionStackMap aspectStacks; - - @Deprecated - public dComplexAspectDefinition(cElementalDefinition... aspects) throws tElementalException { - this(true, new cElementalDefinitionStackMap(aspects)); - } - - @Deprecated - private dComplexAspectDefinition(boolean check, cElementalDefinition... aspects) throws tElementalException { - this(check, new cElementalDefinitionStackMap(aspects)); - } - - public dComplexAspectDefinition(cElementalDefinitionStack... aspects) throws tElementalException { - this(true, new cElementalDefinitionStackMap(aspects)); - } - - private dComplexAspectDefinition(boolean check, cElementalDefinitionStack... aspects) throws tElementalException { - this(check, new cElementalDefinitionStackMap(aspects)); - } - - public dComplexAspectDefinition(cElementalDefinitionStackMap aspects) throws tElementalException { - this(true, aspects); - } - - private dComplexAspectDefinition(boolean check, cElementalDefinitionStackMap aspects) throws tElementalException { - if (check && !canTheyBeTogether(aspects)) { - throw new tElementalException("Hadron Definition error"); - } - aspectStacks = aspects; - float mass = 0; - for (cElementalDefinitionStack stack : aspects.values()) { - mass += stack.getMass(); - } - this.mass = mass; - hash = super.hashCode(); - } - - //public but u can just try{}catch(){} the constructor it still calls this method - private static boolean canTheyBeTogether(cElementalDefinitionStackMap stacks) { - long amount = 0; - for (cElementalDefinitionStack aspects : stacks.values()) { - if (!(aspects.definition instanceof dComplexAspectDefinition) && !(aspects.definition instanceof ePrimalAspectDefinition)) { - return false; - } - amount += aspects.amount; - } - return amount == 2; - } - - @Override - public String getName() { - String name = AspectDefinitionCompat.aspectDefinitionCompat.getAspectTag(this); - if (name != null) { - name = name.substring(0, 1).toUpperCase() + name.substring(1); - } else { - name = getSymbol(); - } - return translateToLocal("tt.keyword.Aspect") + ": " + name; - } - - @Override - public String getSymbol() { - StringBuilder symbol = new StringBuilder(8); - for (cElementalDefinitionStack aspect : aspectStacks.values()) { - if (aspect.definition instanceof ePrimalAspectDefinition) { - for (int i = 0; i < aspect.amount; i++) { - symbol.append(aspect.definition.getSymbol()); - } - } else { - symbol.append('('); - for (int i = 0; i < aspect.amount; i++) { - symbol.append(aspect.definition.getSymbol()); - } - symbol.append(')'); - } - } - return symbol.toString(); - } - - @Override - public String getShortSymbol() { - StringBuilder symbol = new StringBuilder(8); - for (cElementalDefinitionStack aspect : aspectStacks.values()) { - if (aspect.definition instanceof ePrimalAspectDefinition) { - for (int i = 0; i < aspect.amount; i++) { - symbol.append(aspect.definition.getShortSymbol()); - } - } else { - symbol.append('('); - for (int i = 0; i < aspect.amount; i++) { - symbol.append(aspect.definition.getShortSymbol()); - } - symbol.append(')'); - } - } - return symbol.toString(); - } - - @Override - public NBTTagCompound toNBT() { - return getNbtTagCompound(nbtType, aspectStacks); - } - - public static NBTTagCompound getNbtTagCompound(byte nbtType, cElementalDefinitionStackMap aspectStacks) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setByte("t", nbtType); - cElementalDefinitionStack[] quarkStacksValues = aspectStacks.values(); - nbt.setInteger("i", quarkStacksValues.length); - for (int i = 0; i < quarkStacksValues.length; i++) { - nbt.setTag(Integer.toString(i), quarkStacksValues[i].toNBT()); - } - return nbt; - } - - public static dComplexAspectDefinition 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 dComplexAspectDefinition(stacks); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - @Override - public float getRawTimeSpan(long currentEnergy) { - return -1; - } - - @Override - public boolean isTimeSpanHalfLife() { - return false; - } - - @Override - public int getCharge() { - return 0; - } - - @Override - public byte getType() { - return 0; - } - - @Override - public byte getColor() { - return -1; - } - - @Override - public cElementalDefinitionStackMap getSubParticles() { - return aspectStacks; - } - - @Override - public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { - return new cElementalDecay[]{new cElementalDecay(0.75F, aspectStacks), eBosonDefinition.deadEnd}; - } - - @Override - public float getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return false; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return false; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return false; - } - - @Override - public cElementalDecay[] getNaturalDecayInstant() { - return noDecay; - } - - @Override - public cElementalDecay[] getDecayArray() { - return noDecay; - } - - @Override - public float getMass() { - return mass; - } - - @Override - public aFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public aItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public aOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - - @Override - public Object materializeIntoAspect() { - return AspectDefinitionCompat.aspectDefinitionCompat.getAspect(this); - } - - @Override - public iElementalDefinition getAnti() { - return null; - } - - public static void run() { - try { - cElementalDefinition.addCreatorFromNBT(nbtType, dComplexAspectDefinition.class.getMethod("fromNBT", NBTTagCompound.class), (byte) -96); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if (DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: ComplexAspect " + nbtType + ' ' + -96); - } - } - - @Override - public byte getClassType() { - return -96; - } - - public static byte getClassTypeStatic() { - return -96; - } - - @Override - public int hashCode() { - return hash; - } - - @Override - public void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel) { - if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS, capabilities)) { - lines.add(getShortSymbol()); - } - } - - @Override - public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { - if (Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add(translateToLocal("tt.keyword.CLASS") + " = " + nbtType + ' ' + getClassType()); - } - if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS, capabilities)) { - lines.add(translateToLocal("tt.keyword.NAME") + " = " + getName()); - //lines.add("SYMBOL = "+getSymbol()); - } - if (Util.areBitsSet(SCAN_GET_CHARGE, capabilities)) { - lines.add(translateToLocal("tt.keyword.CHARGE") + " = " + getCharge() / 3f + " e"); - } - if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { - lines.add(getColor() < 0 ? translateToLocal("tt.keyword.COLORLESS") : translateToLocal("tt.keyphrase.CARRIES_COLOR")); - } - if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) { - lines.add(translateToLocal("tt.keyword.MASS") + " = " + getMass() + " eV/c\u00b2"); - } - if (Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add(translateToLocal("tt.keyphrase.LIFE_TIME") + " = " + getRawTimeSpan(energyLevel) + " s"); - lines.add(" " + translateToLocal("tt.keyphrase.At_current_energy_level")); - } - } -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java deleted file mode 100644 index bcb6e3f6fc..0000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/ePrimalAspectDefinition.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay.noDecay; -import static net.minecraft.util.StatCollector.translateToLocal; - -/** - * Created by Tec on 06.05.2017. - */ -public final class ePrimalAspectDefinition extends cElementalPrimitive implements iElementalAspect { - public static final ePrimalAspectDefinition - magic_air = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1F, 35), - magic_earth = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9F, 34), - magic_fire = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3F, 33), - magic_water = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7F, 32), - magic_order = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5F, 30), - magic_entropy = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Entropy"), "e`", 1e5F, 31); - - private ePrimalAspectDefinition(String name, String symbol, float mass, int ID) { - super(name, symbol, 0, mass, 0, -1, ID); - } - - public static void run() { - magic_air.init(null, -1F, -1, -1, noDecay); - magic_earth.init(null, -1F, -1, -1, noDecay); - magic_fire.init(null, -1F, -1, -1, noDecay); - magic_water.init(null, -1F, -1, -1, noDecay); - magic_order.init(null, -1F, -1, -1, noDecay); - magic_entropy.init(null, -1F, -1, -1, noDecay); - } - - @Override - public String getName() { - return translateToLocal("tt.keyword.Primal") + ": " + name; - } - - @Override - public Object materializeIntoAspect() { - return AspectDefinitionCompat.aspectDefinitionCompat.getAspect(this); - } - - @Override - public boolean isTimeSpanHalfLife() { - return false; - } -}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/iElementalAspect.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/iElementalAspect.java deleted file mode 100644 index 3cb2d8e5e8..0000000000 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/iElementalAspect.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions; - -/** - * Created by Tec on 21.05.2017. - */ -public interface iElementalAspect { - Object materializeIntoAspect(); -} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java new file mode 100644 index 0000000000..c1c6c6dcb2 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompat.java @@ -0,0 +1,38 @@ +package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations; + + +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; + +import java.util.HashMap; + +/** + * Created by Tec on 21.05.2017. + */ +public class AspectDefinitionCompat { + public static AspectDefinitionCompat aspectDefinitionCompat; + private final HashMap<IEMDefinition,String> defToAspect = new HashMap<>(); + private final HashMap<String, IEMDefinition> aspectToDef = new HashMap<>(); + + public void run(EMDefinitionsRegistry registry){} + + public String getAspectTag(IEMDefinition definition){ + return null; + } + + public String getAspectLocalizedName(IEMDefinition definition){ + return null; + } + + public IEMDefinition getDefinition(String aspect){ + return null; + } + + public HashMap<IEMDefinition, String> getDefToAspect() { + return defToAspect; + } + + public HashMap<String, IEMDefinition> getAspectToDef() { + return aspectToDef; + } +} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java new file mode 100644 index 0000000000..ccccff7c3d --- /dev/null +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/transformations/AspectDefinitionCompatEnabled.java @@ -0,0 +1,80 @@ +package com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations; + +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import thaumcraft.api.aspects.Aspect; + +import java.util.ArrayList; + +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition.*; + +/** + * Created by Tec on 21.05.2017. + */ +public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat { + @Override + public void run(EMDefinitionsRegistry registry){ + getDefToAspect().put(magic_air,"aer"); + getDefToAspect().put(magic_earth,"terra"); + getDefToAspect().put(magic_fire,"ignis"); + getDefToAspect().put(magic_water,"aqua"); + getDefToAspect().put(magic_order,"ordo"); + getDefToAspect().put(magic_entropy,"perditio"); + + getAspectToDef().put("aer",magic_air); + getAspectToDef().put("terra",magic_earth); + getAspectToDef().put("ignis",magic_fire); + getAspectToDef().put("aqua",magic_water); + getAspectToDef().put("ordo",magic_order); + getAspectToDef().put("perditio",magic_entropy); + + ArrayList<Aspect> list=Aspect.getCompoundAspects(); + Aspect[] array= list.toArray(new Aspect[0]); + while (!list.isEmpty()) { + for (Aspect aspect : array) { + if (list.contains(aspect)) { + Aspect[] content = aspect.getComponents(); + if (content.length != 2) { + list.remove(aspect); + }else if(getAspectToDef().containsKey(content[0].getTag()) && getAspectToDef().containsKey(content[1].getTag())){ + try { + EMComplexAspectDefinition newAspect; + if(content[0].getTag().equals(content[1].getTag())){ + newAspect = new EMComplexAspectDefinition( + getAspectToDef().get(content[0].getTag()).getStackForm(2)); + }else{ + newAspect = new EMComplexAspectDefinition( + getAspectToDef().get(content[0].getTag()).getStackForm(1), + getAspectToDef().get(content[1].getTag()).getStackForm(1)); + } + getAspectToDef().put(aspect.getTag(),newAspect); + getDefToAspect().put(newAspect,aspect.getTag()); + registry.registerForDisplay(newAspect); + }catch (EMException e) { + /**/ + }finally { + list.remove(aspect); + } + } + } + } + } + } + + @Override + public String getAspectTag(IEMDefinition definition) { + return getDefToAspect().get(definition); + } + + public String getAspectLocalizedName(IEMDefinition definition){ + Aspect aspect = Aspect.aspects.get(getAspectTag(definition)); + return aspect != null ? aspect.getName() : null; + } + + @Override + public IEMDefinition getDefinition(String aspect) { + return getAspectToDef().get(aspect); + } +} diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java index e77cab2734..a335b81793 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompat.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; @@ -10,19 +10,23 @@ import net.minecraft.tileentity.TileEntity; public class EssentiaCompat { public static EssentiaCompat essentiaContainerCompat; - public boolean check(GT_MetaTileEntity_MultiblockBase_EM meta){ + public <T extends GT_MetaTileEntity_MultiblockBase_EM> boolean check(T meta,TileEntity te){ return false; } - public TileEntity getContainer(GT_MetaTileEntity_MultiblockBase_EM meta){ + public <T extends GT_MetaTileEntity_MultiblockBase_EM> TileEntity getContainer(T meta){ return null; } - public boolean putElementalInstanceStack(TileEntity conatainer, cElementalInstanceStack stack){ + public String getEssentiaName(IEMDefinition stack){ + return null; + } + + public boolean putInContainer(TileEntity container, String name){ return false; } - public cElementalInstanceStack getFromContainer(TileEntity container){ + public IEMDefinition getFromContainer(TileEntity container){ return null; } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java index 484377b179..bd20269944 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java @@ -1,8 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.iElementalAspect; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import net.minecraft.tileentity.TileEntity; import thaumcraft.api.aspects.Aspect; @@ -11,41 +9,46 @@ import thaumcraft.api.aspects.IAspectContainer; import thaumcraft.common.tiles.TileEssentiaReservoir; import thaumcraft.common.tiles.TileJarFillable; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompat.aspectToDef; +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat.aspectDefinitionCompat; /** * Created by Tec on 21.05.2017. */ public class EssentiaCompatEnabled extends EssentiaCompat { @Override - public boolean check(GT_MetaTileEntity_MultiblockBase_EM meta) { - TileEntity tile =meta.getBaseMetaTileEntity().getTileEntityAtSide(meta.getBaseMetaTileEntity().getBackFacing()); - return tile instanceof TileEssentiaReservoir || tile instanceof TileJarFillable; + public <T extends GT_MetaTileEntity_MultiblockBase_EM> boolean check(T meta,TileEntity te) { + return te instanceof TileEssentiaReservoir || te instanceof TileJarFillable; } @Override - public TileEntity getContainer(GT_MetaTileEntity_MultiblockBase_EM meta) { + public <T extends GT_MetaTileEntity_MultiblockBase_EM> TileEntity getContainer(T meta) { TileEntity tile =meta.getBaseMetaTileEntity().getTileEntityAtSide(meta.getBaseMetaTileEntity().getBackFacing()); return tile!=null && !tile.isInvalid() && tile instanceof TileEssentiaReservoir || tile instanceof TileJarFillable ?tile:null; } @Override - public boolean putElementalInstanceStack(TileEntity container,cElementalInstanceStack stack){ - if(container==null || container.isInvalid()) { + public String getEssentiaName(IEMDefinition stack) { + return aspectDefinitionCompat.getDefToAspect().get(stack); + } + + @Override + public boolean putInContainer(TileEntity container, String aspectName) { + if (container == null || container.isInvalid() || aspectName == null || aspectName.isEmpty()) { return false; } - if(container instanceof IAspectContainer && stack.definition instanceof iElementalAspect){ - Aspect aspect=(Aspect) ((iElementalAspect) stack.definition).materializeIntoAspect(); - if(aspect!=null){ - ((IAspectContainer) container).addToContainer(aspect,1); - return true; + if (container instanceof IAspectContainer) { + Aspect aspect = Aspect.getAspect(aspectName); + if(aspect==null){ + return false; } + int remaining=((IAspectContainer) container).addToContainer(aspect, 1); + return remaining==0; } return false; } @Override - public cElementalInstanceStack getFromContainer(TileEntity container){ + public IEMDefinition getFromContainer(TileEntity container){ if(container==null || container.isInvalid()) { return null; } @@ -55,10 +58,7 @@ public class EssentiaCompatEnabled extends EssentiaCompat { Aspect[] aspectsArr= aspects.getAspects(); if(aspectsArr!=null && aspectsArr[0]!=null){ if (((IAspectContainer) container).takeFromContainer(aspectsArr[0],1)){ - cElementalDefinition def=aspectToDef.get(aspectsArr[0].getTag()); - if(def!=null){ - return new cElementalInstanceStack(def,1); - } + return aspectDefinitionCompat.getAspectToDef().get(aspectsArr[0].getTag()); } } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index 4074f2d6db..e91dd2c4af 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 @@ -1,34 +1,35 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.thing.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_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.StructureLibAPI; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.util.ForgeDirection; +import thaumcraft.api.aspects.Aspect; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_ITEM_DIMINISHED; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; 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.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofTileAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -37,22 +38,6 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {"0A0", E, "0A0",}, - {"121", "232", "121",}, - {"\"\"\"", "\"2\"", "\"\"\"",}, - {"202", "0!0", "202",}, - }; - private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{0, 0, 4, 8}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{ - this::addClassicToMachineList, - this::addElementalInputToMachineList, - this::addElementalMufflerToMachineList}; - 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 + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.0"),//1 - Classic Hatches or High Power Casing @@ -60,6 +45,27 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.2"),//3 - Elemental Overflow Hatches or Elemental Casing translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.hint.3"),//General - Some sort of Essentia Storage }; + + private static final IStructureDefinition<GT_MetaTileEntity_EM_essentiaDequantizer> STRUCTURE_DEFINITION = + IStructureDefinition.<GT_MetaTileEntity_EM_essentiaDequantizer>builder() + .addShape("main", new String[][]{ + {"DDD", "D~D", "DDD"}, + {"E E", " * ", "E E"}, + {"ABA", "BCB", "ABA"}, + {"FFF", "FBF", "FFF"}, + {"BEB", "EGE", "BEB"} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 0)) + .addElement('B', ofBlock(sBlockCasingsTT, 4)) + .addElement('C', ofBlock(sBlockCasingsTT, 8)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaDequantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('E', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaDequantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) + .addElement('G', ofHatchAdder(GT_MetaTileEntity_EM_essentiaDequantizer::addElementalInputToMachineList, textureOffset + 4, 2)) + .addElement('*', ofTileAdder(essentiaContainerCompat::check, StructureLibAPI.getBlockHint(),12)) + .build(); + + private String outputEssentiaName; //endregion public GT_MetaTileEntity_EM_essentiaDequantizer(int aID, String aName, String aNameRegional) { @@ -77,7 +83,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return essentiaContainerCompat.check(this) && structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } @Override @@ -87,24 +93,49 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ stopMachine(); return false; } - cElementalInstanceStackMap inputHatchContainer = eInputHatches.get(0).getContainerHandler(); - if (inputHatchContainer.hasStacks()) { - cElementalInstanceStack stack = inputHatchContainer.getFirst(); - inputHatchContainer.removeAmount(false, new cElementalInstanceStack(stack.definition, 1)); - if (!essentiaContainerCompat.putElementalInstanceStack(container, stack)) { - cleanStackEM_EM(stack); - } - mMaxProgresstime = 20; - mEfficiencyIncrease = 10000; - eAmpereFlow = 1; - if (stack.definition instanceof ePrimalAspectDefinition) { - mEUt = (int) -V[8]; + + EMInstanceStackMap inputHatchContainer = eInputHatches.get(0).getContentHandler(); + if (inputHatchContainer == null || !inputHatchContainer.hasStacks()) { + return false; + } + + EMInstanceStack stack = inputHatchContainer.getRandom(); + if (stack.getAmount() < EM_COUNT_PER_ITEM_DIMINISHED) { + cleanStackEM_EM(inputHatchContainer.removeKey(stack.getDefinition())); + mEUt = (int) -V[6]; + } else { + outputEssentiaName = essentiaContainerCompat.getEssentiaName(stack.getDefinition()); + Aspect aspect = Aspect.getAspect(outputEssentiaName); + if (aspect == null) { + outputEssentiaName = null; + cleanStackEM_EM(inputHatchContainer.removeKey(stack.getDefinition())); + mEUt = (int) -V[7]; } else { - mEUt = (int) -V[10]; + inputHatchContainer.removeAmount(stack.getDefinition().getStackForm(EM_COUNT_PER_MATERIAL_AMOUNT)); + if (aspect.isPrimal()) { + mEUt = (int) -V[8]; + } else { + mEUt = (int) -V[10]; + } + } + } + mMaxProgresstime = 20; + mEfficiencyIncrease = 10000; + eAmpereFlow = 1; + return true; + } + + @Override + public void outputAfterRecipe_EM() { + TileEntity container = essentiaContainerCompat.getContainer(this); + if (container == null) { + stopMachine(); + }else{ + if(!essentiaContainerCompat.putInContainer(container,outputEssentiaName)){ + stopMachine(); } - return true; } - return false; + outputEssentiaName = null; } @Override @@ -123,27 +154,29 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ } @Override - public void construct(int stackSize, boolean hintsOnly) { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; - if (hintsOnly) { - TecTech.proxy.hint_particle(iGregTechTileEntity.getWorld(), - iGregTechTileEntity.getXCoord() + xDir, - iGregTechTileEntity.getYCoord() + yDir, - iGregTechTileEntity.getZCoord() + zDir, - TT_Container_Casings.sHintCasingsTT, 12); - } else { - if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir).getMaterial() == Material.air) { - iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); - } - } - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setString("eOutputEssentia",outputEssentiaName); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + outputEssentiaName = aNBT.getString("eOutputEssentia"); + } + + @Override + public IStructureDefinition<? extends GT_MetaTileEntity_MultiblockBase_EM> getStructure_EM() { + return STRUCTURE_DEFINITION; + } +} 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 0caf4be6d6..befc9ac77e 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -1,34 +1,33 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.thing.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_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.StructureLibAPI; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.util.ForgeDirection; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; 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.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofTileAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -37,22 +36,6 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {"0A0", E, "0A0",}, - {"121", "232", "121",}, - {"\"\"\"", "\"1\"", "\"\"\"",}, - {"010", "1!1", "010",}, - }; - private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{0, 4, 0, 8}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{ - this::addClassicToMachineList, - this::addElementalOutputToMachineList, - this::addElementalMufflerToMachineList}; - 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 + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.0"),//1 - Classic Hatches or High Power Casing @@ -60,6 +43,25 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.2"),//3 - Elemental Overflow Hatches or Elemental Casing translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.hint.3"),//General - Some sort of Essentia Storage }; + + private static final IStructureDefinition<GT_MetaTileEntity_EM_essentiaQuantizer> STRUCTURE_DEFINITION = + IStructureDefinition.<GT_MetaTileEntity_EM_essentiaQuantizer>builder() + .addShape("main", new String[][]{ + {"FFF", "F~F", "FFF"}, + {"E E", " * ", "E E"}, + {"BAB", "ACA", "BAB"}, + {"DDD", "DBD", "DDD"}, + {"EBE", "BGB", "EBE"} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 0)) + .addElement('B', ofBlock(sBlockCasingsTT, 4)) + .addElement('C', ofBlock(sBlockCasingsTT, 8)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaQuantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) + .addElement('E', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_essentiaQuantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('G', ofHatchAdder(GT_MetaTileEntity_EM_essentiaQuantizer::addElementalOutputToMachineList, textureOffset + 4, 2)) + .addElement('*', ofTileAdder(essentiaContainerCompat::check, StructureLibAPI.getBlockHint(),12)) + .build(); //endregion public GT_MetaTileEntity_EM_essentiaQuantizer(int aID, String aName, String aNameRegional) { @@ -77,21 +79,20 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return essentiaContainerCompat.check(this) && structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } @Override public boolean checkRecipe_EM(ItemStack itemStack) { - TileEntity container = essentiaContainerCompat.getContainer(this); - cElementalInstanceStack newStack = essentiaContainerCompat.getFromContainer(container); - if (newStack != null) { + IEMDefinition definition = essentiaContainerCompat.getFromContainer(essentiaContainerCompat.getContainer(this)); + if (definition != null) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; eAmpereFlow = 1; - outputEM = new cElementalInstanceStackMap[]{ - new cElementalInstanceStackMap(newStack) + outputEM = new EMInstanceStackMap[]{ + new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT)) }; - if (newStack.definition instanceof ePrimalAspectDefinition) { + if (definition instanceof EMPrimalAspectDefinition) { mEUt = (int) -V[8]; } else { mEUt = (int) -V[10]; @@ -107,7 +108,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu stopMachine(); return; } - eOutputHatches.get(0).getContainerHandler().putUnifyAll(outputEM[0]); + eOutputHatches.get(0).getContentHandler().putUnifyAll(outputEM[0]); outputEM = null; } @@ -127,27 +128,17 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu } @Override - public void construct(int stackSize, boolean hintsOnly) { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; - if (hintsOnly) { - TecTech.proxy.hint_particle(iGregTechTileEntity.getWorld(), - iGregTechTileEntity.getXCoord() + xDir, - iGregTechTileEntity.getYCoord() + yDir, - iGregTechTileEntity.getZCoord() + zDir, - TT_Container_Casings.sHintCasingsTT, 12); - } else { - if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir).getMaterial() == Material.air) { - iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); - } - } - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_essentiaQuantizer> getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} diff --git a/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java b/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java deleted file mode 100644 index ab075f7ffd..0000000000 --- a/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.github.technus.tectech.entity.fx; - -import com.github.technus.tectech.TecTech; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.client.particle.EntityFX; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.init.Blocks; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; -import org.lwjgl.opengl.GL11; - -@SideOnly(Side.CLIENT) -public class BlockHint extends EntityFX { - private IIcon[] icons = new IIcon[6]; - - public BlockHint(World world){ - this(world,0,0,0, Blocks.stone,0); - } - - public BlockHint(World world, int x, int y, int z, Block block, int meta) { - super(world, x+.25, y+.5, z+.25); - particleGravity = 0; - prevPosX = posX; - prevPosY = posY; - prevPosZ = posZ; - noClip = true; - particleMaxAge = 2000 + TecTech.RANDOM.nextInt(200); - for (int i = 0; i < 6; i++) { - icons[i] = block.getIcon(i, meta); - } - } - - @Override - public void renderParticle(Tessellator tes, float subTickTime, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_) { - float size = .5f; - float X = (float) (prevPosX + (posX - prevPosX) * (double) subTickTime - EntityFX.interpPosX); - float Y = (float) (prevPosY + (posY - prevPosY) * (double) subTickTime - EntityFX.interpPosY) - size / 2; - float Z = (float) (prevPosZ + (posZ - prevPosZ) * (double) subTickTime - EntityFX.interpPosZ); - GL11.glDisable(GL11.GL_CULL_FACE); - GL11.glDepthMask(false); - tes.setColorRGBA_F(.9F, .95F, 1F, .75f); - - //var8, var9 - X U - //var 10, var 11 - Y V - for(int i=0;i<6;i++){ - if(icons[i]==null) { - continue; - } - double u=icons[i].getMinU(); - double U=icons[i].getMaxU(); - double v=icons[i].getMinV(); - double V=icons[i].getMaxV(); - switch (i){//{DOWN, UP, NORTH, SOUTH, WEST, EAST} - case 0: - tes.addVertexWithUV(X, Y, Z + size, u, V); - tes.addVertexWithUV(X, Y, Z, u, v); - tes.addVertexWithUV(X + size, Y, Z, U, v); - tes.addVertexWithUV(X + size, Y, Z + size, U, V); - break; - case 1: - tes.addVertexWithUV(X, Y + size, Z, u, v); - tes.addVertexWithUV(X, Y + size, Z + size, u, V); - tes.addVertexWithUV(X + size, Y + size, Z + size, U, V); - tes.addVertexWithUV(X + size, Y + size, Z, U, v); - break; - case 2: - tes.addVertexWithUV(X, Y, Z, U, V); - tes.addVertexWithUV(X, Y + size, Z, U, v); - tes.addVertexWithUV(X + size, Y + size, Z, u, v); - tes.addVertexWithUV(X + size, Y, Z, u, V); - break; - case 3: - tes.addVertexWithUV(X + size, Y, Z + size, U, V); - tes.addVertexWithUV(X + size, Y + size, Z + size, U, v); - tes.addVertexWithUV(X, Y + size, Z + size, u, v); - tes.addVertexWithUV(X, Y, Z + size, u, V); - break; - case 4: - tes.addVertexWithUV(X, Y, Z + size, U, V); - tes.addVertexWithUV(X, Y + size, Z + size, U, v); - tes.addVertexWithUV(X, Y + size, Z, u, v); - tes.addVertexWithUV(X, Y, Z, u, V); - break; - case 5: - tes.addVertexWithUV(X + size, Y, Z, U, V); - tes.addVertexWithUV(X + size, Y + size, Z, U, v); - tes.addVertexWithUV(X + size, Y + size, Z + size, u, v); - tes.addVertexWithUV(X + size, Y, Z + size, u, V); - break; - } - } - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glDepthMask(true); - } - - @Override - public int getFXLayer() { - return 1; - } - - @Override - public boolean shouldRenderInPass(int pass) { - return pass==2; - } -} diff --git a/src/main/java/com/github/technus/tectech/entity/fx/WeightlessParticleFX.java b/src/main/java/com/github/technus/tectech/entity/fx/WeightlessParticleFX.java deleted file mode 100644 index d1d2ed611c..0000000000 --- a/src/main/java/com/github/technus/tectech/entity/fx/WeightlessParticleFX.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.github.technus.tectech.entity.fx; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.particle.EntityFX; -import net.minecraft.world.World; - -@SideOnly(Side.CLIENT) -public class WeightlessParticleFX extends EntityFX -{ - public WeightlessParticleFX(World p_i1205_1_, double p_i1205_2_, double p_i1205_4_, double p_i1205_6_, double p_i1205_8_, double p_i1205_10_, double p_i1205_12_) - { - super(p_i1205_1_, p_i1205_2_, p_i1205_4_, p_i1205_6_, p_i1205_8_, p_i1205_10_, p_i1205_12_); - this.motionX = p_i1205_8_ + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.05F); - this.motionY = p_i1205_10_ + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.05F); - this.motionZ = p_i1205_12_ + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.05F); - this.particleRed = this.particleGreen = this.particleBlue = this.rand.nextFloat() * 0.3F + 0.7F; - this.particleScale = this.rand.nextFloat() * this.rand.nextFloat() * 6.0F + 1.0F; - this.particleMaxAge = (int)(16.0D / ((double)this.rand.nextFloat() * 0.8D + 0.2D)) + 2; - this.noClip=true; - } - - /** - * Called to update the entity's position/logic. - */ - public void onUpdate() - { - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - - if (this.particleAge++ >= this.particleMaxAge) - { - this.setDead(); - } - - this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); - //this.motionY += 0.004D; - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.8999999761581421D; - this.motionY *= 0.8999999761581421D; - this.motionZ *= 0.8999999761581421D; - } -} diff --git a/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java b/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java index 4aea8bce92..826ed3af5d 100644 --- a/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java +++ b/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java @@ -1,85 +1,182 @@ package com.github.technus.tectech.font; +import com.ibm.icu.text.ArabicShaping; +import com.ibm.icu.text.ArabicShapingException; +import com.ibm.icu.text.Bidi; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.settings.GameSettings; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - @SideOnly(Side.CLIENT) public class TecTechFontRender extends FontRenderer { public static final TecTechFontRender INSTANCE = new TecTechFontRender(); - private static float DISTANCE_L = .125F; - private static float DISTANCE_L2 = DISTANCE_L *2F; + private static final float DISTANCE_L = .125F; + private static final float DISTANCE_L2 = DISTANCE_L * 2F; - private static float DISTANCE_M = 0.06F; - private static float DISTANCE_M2 = DISTANCE_M *2F; + private static final float DISTANCE_M = 0.06F; + private static final float DISTANCE_M2 = DISTANCE_M * 2F; - private static float DISTANCE_A = 0.06F; - private static float DISTANCE_A2 = DISTANCE_A *2F; + private static final float DISTANCE_A = 0.06F; + private static final float DISTANCE_A2 = DISTANCE_A * 2F; - private static final Method reset; - private static final Method render; - private final GameSettings gameSettings; + private TecTechFontRender() { + super(Minecraft.getMinecraft().gameSettings, new ResourceLocation("textures/font/ascii.png"), Minecraft.getMinecraft().renderEngine, false); + } - static { - Method resetMethod,renderMethod; - try { - resetMethod =FontRenderer.class.getDeclaredMethod("resetStyles"); - renderMethod=FontRenderer.class.getDeclaredMethod("renderString", String.class, int.class, int.class, int.class, boolean.class); - } catch (NoSuchMethodException e) { - try { - resetMethod =FontRenderer.class.getDeclaredMethod("func_78265_b"); - renderMethod=FontRenderer.class.getDeclaredMethod("func_78258_a", String.class, int.class, int.class, int.class, boolean.class); - } catch (NoSuchMethodException ex) { - throw new RuntimeException("Cannot get methods!",ex); - } - } - resetMethod.setAccessible(true); - renderMethod.setAccessible(true); - reset=resetMethod; - render=renderMethod; + private void resetStyles() { + this.randomStyle = false; + this.boldStyle = false; + this.italicStyle = false; + this.underlineStyle = false; + this.strikethroughStyle = false; } - private TecTechFontRender() { - super(Minecraft.getMinecraft().gameSettings, new ResourceLocation("textures/font/ascii.png"), Minecraft.getMinecraft().renderEngine, false); - gameSettings = Minecraft.getMinecraft().gameSettings; + private int renderString(String p_78258_1_, int p_78258_2_, int p_78258_3_, int p_78258_4_, boolean p_78258_5_) { + if (p_78258_1_ == null) { + return 0; + } else { + if (this.bidiFlag) { + p_78258_1_ = this.bidiReorder(p_78258_1_); + } + + if ((p_78258_4_ & -67108864) == 0) { + p_78258_4_ |= -16777216; + } + + if (p_78258_5_) { + p_78258_4_ = (p_78258_4_ & 16579836) >> 2 | p_78258_4_ & -16777216; + } + + this.red = (float)(p_78258_4_ >> 16 & 255) / 255.0F; + this.blue = (float)(p_78258_4_ >> 8 & 255) / 255.0F; + this.green = (float)(p_78258_4_ & 255) / 255.0F; + this.alpha = (float)(p_78258_4_ >> 24 & 255) / 255.0F; + this.setColor(this.red, this.blue, this.green, this.alpha); + this.posX = (float)p_78258_2_; + this.posY = (float)p_78258_3_; + this.renderStringAtPos(p_78258_1_, p_78258_5_); + return (int)this.posX; + } } - private void resetStyles2(){ + private String bidiReorder(String p_147647_1_) { try { - reset.invoke(this); - } catch (IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException("Cannot run method resetStyles!",e); + Bidi bidi = new Bidi((new ArabicShaping(8)).shape(p_147647_1_), 127); + bidi.setReorderingMode(0); + return bidi.writeReordered(2); + } catch (ArabicShapingException var3) { + return p_147647_1_; } } - private int renderString2(String str, int x, int y, int color, boolean dropShadow){ - try { - return (int)render.invoke(this,str,x,y,color,dropShadow); - } catch (IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException("Cannot run method renderString!",e); + private void renderStringAtPos(String p_78255_1_, boolean p_78255_2_) { + for(int i = 0; i < p_78255_1_.length(); ++i) { + char c0 = p_78255_1_.charAt(i); + int j; + int k; + if (c0 == 167 && i + 1 < p_78255_1_.length()) { + j = "0123456789abcdefklmnor".indexOf(p_78255_1_.toLowerCase().charAt(i + 1)); + if (j < 16) { + this.randomStyle = false; + this.boldStyle = false; + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; + if (j < 0 || j > 15) { + j = 15; + } + + if (p_78255_2_) { + j += 16; + } + + k = this.colorCode[j]; + this.textColor = k; + this.setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha); + } else if (j == 16) { + this.randomStyle = true; + } else if (j == 17) { + this.boldStyle = true; + } else if (j == 18) { + this.strikethroughStyle = true; + } else if (j == 19) { + this.underlineStyle = true; + } else if (j == 20) { + this.italicStyle = true; + } else if (j == 21) { + this.randomStyle = false; + this.boldStyle = false; + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; + this.setColor(this.red, this.blue, this.green, this.alpha); + } + + ++i; + } else { + j = "\u00C0\u00C1\u00C2\u00C8\u00CA\u00CB\u00CD\u00D3\u00D4\u00D5\u00DA\u00DF\u00E3\u00F5\u011F\u0130\u0131\u0152\u0153\u015E\u015F\u0174\u0175\u017E\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7\u00EA\u00EB\u00E8\u00EF\u00EE\u00EC\u00C4\u00C5\u00C9\u00E6\u00C6\u00F4\u00F6\u00F2\u00FB\u00F9\u00FF\u00D6\u00DC\u00F8\u00A3\u00D8\u00D7\u0192\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA\u00BF\u00AE\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\u03B2\u0393\u03C0\u03A3\u03C3\u03BC\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u2205\u2208\u2229\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u0000".indexOf(c0); + if (this.randomStyle && j != -1) { + do { + k = this.fontRandom.nextInt(this.charWidth.length); + } while(this.charWidth[j] != this.charWidth[k]); + + j = k; + } + + float f1 = this.unicodeFlag ? 0.5F : 1.0F; + boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_; + if (flag1) { + this.posX -= f1; + this.posY -= f1; + } + + float f = this.renderCharAtPos(j, c0, this.italicStyle); + if (flag1) { + this.posX += f1; + this.posY += f1; + } + + if (this.boldStyle) { + this.posX += f1; + if (flag1) { + this.posX -= f1; + this.posY -= f1; + } + + this.renderCharAtPos(j, c0, this.italicStyle); + this.posX -= f1; + if (flag1) { + this.posX += f1; + this.posY += f1; + } + + ++f; + } + + this.doDraw(f); + } } + } + private float renderCharAtPos(int p_78278_1_, char p_78278_2_, boolean p_78278_3_) { + return p_78278_2_ == ' ' ? 4.0F : ("\u00C0\u00C1\u00C2\u00C8\u00CA\u00CB\u00CD\u00D3\u00D4\u00D5\u00DA\u00DF\u00E3\u00F5\u011F\u0130\u0131\u0152\u0153\u015E\u015F\u0174\u0175\u017E\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7\u00EA\u00EB\u00E8\u00EF\u00EE\u00EC\u00C4\u00C5\u00C9\u00E6\u00C6\u00F4\u00F6\u00F2\u00FB\u00F9\u00FF\u00D6\u00DC\u00F8\u00A3\u00D8\u00D7\u0192\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA\u00BF\u00AE\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\u03B2\u0393\u03C0\u03A3\u03C3\u03BC\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u2205\u2208\u2229\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u0000".indexOf(p_78278_2_) != -1 && !this.unicodeFlag ? this.renderDefaultChar(p_78278_1_, p_78278_3_) : this.renderUnicodeChar(p_78278_2_, p_78278_3_)); + } @Override public int drawString(String str, int x, int y, int color, boolean dropShadow) { - switch (gameSettings.guiScale){ + switch (Minecraft.getMinecraft().gameSettings.guiScale) { case 0: setUnicodeFlag(true); y--; GL11.glPushMatrix(); - if (dropShadow) - { + if (dropShadow) { GL11.glTranslatef(DISTANCE_A, DISTANCE_A, 0F); drawStringBack(str, x, y, color); GL11.glTranslatef(-DISTANCE_A2, 0, 0F); @@ -106,8 +203,7 @@ public class TecTechFontRender extends FontRenderer { y--; GL11.glPushMatrix(); - if (dropShadow) - { + if (dropShadow) { GL11.glTranslatef(DISTANCE_M, DISTANCE_M, 0F); drawStringBack(str, x, y, color); GL11.glTranslatef(-DISTANCE_M2, 0, 0F); @@ -132,8 +228,7 @@ public class TecTechFontRender extends FontRenderer { y--; GL11.glPushMatrix(); - if (dropShadow) - { + if (dropShadow) { GL11.glTranslatef(DISTANCE_L, DISTANCE_L, 0F); drawStringBack(str, x, y, color); GL11.glTranslatef(-DISTANCE_L2, 0, 0F); @@ -159,7 +254,7 @@ public class TecTechFontRender extends FontRenderer { @Override public void drawSplitString(String str, int x, int y, int maxWidth, int color) { - switch (gameSettings.guiScale){ + switch (Minecraft.getMinecraft().gameSettings.guiScale) { case 0: setUnicodeFlag(true); y--; @@ -213,50 +308,40 @@ public class TecTechFontRender extends FontRenderer { private int drawStringFront(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_) { GL11.glEnable(3008); - resetStyles2(); - return renderString2(p_85187_1_, p_85187_2_, p_85187_3_, p_85187_4_, false); + resetStyles(); + return renderString(p_85187_1_, p_85187_2_, p_85187_3_, p_85187_4_, false); } private int drawStringBack(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_) { GL11.glEnable(3008); - resetStyles2(); - return renderString2(p_85187_1_, p_85187_2_ + 1, p_85187_3_ + 1, p_85187_4_, true); + resetStyles(); + return renderString(p_85187_1_, p_85187_2_ + 1, p_85187_3_ + 1, p_85187_4_, true); } @Override - public int getStringWidth(String p_78256_1_) - { - if(gameSettings.guiScale==1){ + public int getStringWidth(String p_78256_1_) { + if (Minecraft.getMinecraft().gameSettings.guiScale == 1) { return Minecraft.getMinecraft().fontRenderer.getStringWidth(p_78256_1_); } - if (p_78256_1_ == null) - { + if (p_78256_1_ == null) { return 0; - } - else - { - int i = 0; + } else { + int i = 0; boolean flag = false; - for (int j = 0; j < p_78256_1_.length(); ++j) - { + for (int j = 0; j < p_78256_1_.length(); ++j) { char c0 = p_78256_1_.charAt(j); - int k = this.getCharWidth(c0); + int k = this.getCharWidth(c0); - if (k < 0 && j < p_78256_1_.length() - 1) - { + if (k < 0 && j < p_78256_1_.length() - 1) { ++j; c0 = p_78256_1_.charAt(j); - if (c0 != 108 && c0 != 76) - { - if (c0 == 114 || c0 == 82) - { + if (c0 != 108 && c0 != 76) { + if (c0 == 114 || c0 == 82) { flag = false; } - } - else - { + } else { flag = true; } @@ -265,8 +350,7 @@ public class TecTechFontRender extends FontRenderer { i += k; - if (flag && k > 0) - { + if (flag && k > 0) { ++i; } } @@ -274,4 +358,6 @@ public class TecTechFontRender extends FontRenderer { return i; } } + + } 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 79ad5dc98c..773361bd0f 100644 --- a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java @@ -1,40 +1,34 @@ package com.github.technus.tectech.loader; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.iaeaNuclide; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.*; /** * Created by danie_000 on 16.11.2016. */ -public class ElementalLoader implements Runnable { - @Override - public void run() { +public class ElementalLoader { + public void run(EMDefinitionsRegistry registry) { // =================================================================================================== // Definition init // =================================================================================================== - cElementalPrimitive.run(); + EMPrimitiveDefinition.run(registry); - cPrimitiveDefinition.run(); + EMQuarkDefinition.run(registry); + EMLeptonDefinition.run(registry); + EMNeutrinoDefinition.run(registry); + EMGaugeBosonDefinition.run(registry); + EMScalarBosonDefinition.run(registry); - eQuarkDefinition.run(); - eLeptonDefinition.run(); - eNeutrinoDefinition.run(); - eBosonDefinition.run(); + EMHadronDefinition.run(registry); - dHadronDefinition.run(); + EMAtomDefinition.run(registry); - iaeaNuclide.run(); - - dAtomDefinition.run(); - - ePrimalAspectDefinition.run(); - - dComplexAspectDefinition.run(); + EMPrimalAspectDefinition.run(registry); + EMComplexAspectDefinition.run(registry); } } diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index d7d23d7461..3b99cd987b 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -2,20 +2,23 @@ package com.github.technus.tectech.loader; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompat; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompatEnabled; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompatEnabled; import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat; import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompatEnabled; import com.github.technus.tectech.loader.gui.CreativeTabTecTech; +import com.github.technus.tectech.loader.gui.CreativeTabEM; import com.github.technus.tectech.loader.gui.ModGuiHandler; -import com.github.technus.tectech.loader.recipe.RecipeLoader; +import com.github.technus.tectech.loader.recipe.BaseRecipeLoader; import com.github.technus.tectech.loader.thing.ComponentLoader; import com.github.technus.tectech.loader.thing.CoverLoader; import com.github.technus.tectech.loader.thing.MachineLoader; import com.github.technus.tectech.loader.thing.ThingsLoader; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.Textures; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_collider; +import com.github.technus.tectech.thing.metaTileEntity.multi.em_collider.GT_MetaTileEntity_EM_collider; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ProgressManager; import cpw.mods.fml.common.network.NetworkRegistry; @@ -38,12 +41,12 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; -import static com.github.technus.tectech.CommonValues.*; +import static com.github.technus.tectech.util.CommonValues.*; import static com.github.technus.tectech.TecTech.*; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompat.aspectDefinitionCompat; +import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.transformations.AspectDefinitionCompat.aspectDefinitionCompat; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static gregtech.api.enums.GT_Values.W; public final class MainLoader { @@ -62,20 +65,21 @@ public final class MainLoader { public static void preLoad(){ creativeTabTecTech =new CreativeTabTecTech("TecTech"); + creativeTabEM =new CreativeTabEM("EM"); //set expanded texture arrays for tiers try { - new Textures(); + Textures.run(); }catch (Throwable t){ LOGGER.error("Loading textures...",t); } } - public static void load() { + public static void load(EMDefinitionsRegistry definitionsRegistry) { ProgressManager.ProgressBar progressBarLoad = ProgressManager.push("TecTech Loader", 9); progressBarLoad.step("Elemental Things"); - new ElementalLoader().run(); + new ElementalLoader().run(definitionsRegistry); LOGGER.info("Elemental Init Done"); progressBarLoad.step("Thaumcraft Compatibility"); @@ -120,13 +124,13 @@ public final class MainLoader { ProgressManager.pop(progressBarLoad); } - public static void postLoad() { - ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 5); + public static void postLoad(EMDefinitionsRegistry definitionsRegistry, EMTransformationRegistry transformationInfo) { + ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 4); progressBarPostLoad.step("Dreamcraft Compatibility"); if(Loader.isModLoaded(Reference.DREAMCRAFT)){ try { - Class clazz = Class.forName("com.dreammaster.gthandler.casings.GT_Container_CasingsNH"); + Class<?> clazz = Class.forName("com.dreammaster.gthandler.casings.GT_Container_CasingsNH"); TT_Container_Casings.sBlockCasingsNH = (Block)clazz.getField("sBlockCasingsNH").get(null); if(TT_Container_Casings.sBlockCasingsNH==null){ @@ -140,22 +144,28 @@ public final class MainLoader { progressBarPostLoad.step("Thaumcraft Compatibility"); if (Loader.isModLoaded(Reference.THAUMCRAFT)) { aspectDefinitionCompat = new AspectDefinitionCompatEnabled(); - aspectDefinitionCompat.run(); + aspectDefinitionCompat.run(definitionsRegistry); } else { aspectDefinitionCompat = new AspectDefinitionCompat(); } progressBarPostLoad.step("Recipes"); - new RecipeLoader().run(); + new BaseRecipeLoader().run(transformationInfo); TecTech.LOGGER.info("Recipe Init Done"); - progressBarPostLoad.step("Register Extra Hazmat Suits"); - registerExtraHazmats(); - TecTech.LOGGER.info("Hazmat additions done"); + //Hazmat moved to GT5U + //progressBarPostLoad.step("Register Extra Hazmat Suits"); + //registerExtraHazmats(); + //TecTech.LOGGER.info("Hazmat additions done"); - progressBarPostLoad.step("Nerf blocks blast resistance"); - fixBlocks(); - TecTech.LOGGER.info("Blocks nerf done"); + if (!configTecTech.DISABLE_BLOCK_HARDNESS_NERF) { + progressBarPostLoad.step("Nerf blocks blast resistance"); + fixBlocks(); + TecTech.LOGGER.info("Blocks nerf done"); + } else { + progressBarPostLoad.step("Do not nerf blocks blast resistance"); + TecTech.LOGGER.info("Blocks were not nerfed"); + } ProgressManager.pop(progressBarPostLoad); } @@ -323,6 +333,7 @@ public final class MainLoader { "DraconicEvolution", "IC2NuclearControl", "IronChest", + "irontank", "opensecurity", "openmodularturrets", "Railcraft", @@ -338,23 +349,23 @@ public final class MainLoader { for(Block block : GameData.getBlockRegistry().typeSafeIterable()) { GameRegistry.UniqueIdentifier uniqueIdentifier=GameRegistry.findUniqueIdentifierFor(block); if (uniqueIdentifier != null) { - if (modIDs.contains(uniqueIdentifier.modId)) {//Full Whitelisted Mods + if (block.blockHardness < 0 || modIDs.contains(uniqueIdentifier.modId)) { continue; } else if ("OpenBlocks".equals(uniqueIdentifier.modId)) { if ("grave".equals(uniqueIdentifier.name)) { continue; } - } else if ("TwilightForest".equals(uniqueIdentifier.modId)){ - if ("tile.TFShield".equals(uniqueIdentifier.name)){ + } else if ("TwilightForest".equals(uniqueIdentifier.modId)) { + if ("tile.TFShield".equals(uniqueIdentifier.name)) { block.setResistance(30); continue; - }else if ("tile.TFThorns".equals(uniqueIdentifier.name)){ + } else if ("tile.TFThorns".equals(uniqueIdentifier.name)) { block.setResistance(10); continue; - }else if ("tile.TFTowerTranslucent".equals(uniqueIdentifier.name)){ + } else if ("tile.TFTowerTranslucent".equals(uniqueIdentifier.name)) { block.setResistance(30); continue; - }else if ("tile.TFDeadrock".equals(uniqueIdentifier.name)) { + } else if ("tile.TFDeadrock".equals(uniqueIdentifier.name)) { block.setResistance(5); continue; } else { diff --git a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java index 71478f3ad8..8401af51ca 100644 --- a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java +++ b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.loader; -import com.github.technus.tectech.thing.metaTileEntity.hatch.TextParametersMessage; -import com.github.technus.tectech.thing.metaTileEntity.pipe.PipeActivityMessage; -import com.github.technus.tectech.thing.metaTileEntity.RotationMessage; import com.github.technus.tectech.mechanics.data.ChunkDataMessage; import com.github.technus.tectech.mechanics.data.PlayerDataMessage; -import com.github.technus.tectech.mechanics.data.RendererMessage; +import com.github.technus.tectech.mechanics.enderStorage.EnderLinkCoverMessage; +import com.github.technus.tectech.mechanics.pipe.PipeActivityMessage; +import com.github.technus.tectech.mechanics.spark.RendererMessage; +import com.github.technus.tectech.thing.metaTileEntity.hatch.TextParametersMessage; import static com.github.technus.tectech.Reference.MODID; @@ -23,9 +23,6 @@ public class NetworkDispatcher extends eu.usrv.yamcore.network.PacketDispatcher registerMessage(PipeActivityMessage.ServerHandler.class, PipeActivityMessage.PipeActivityQuery.class); registerMessage(PipeActivityMessage.ClientHandler.class, PipeActivityMessage.PipeActivityData.class); - registerMessage(RotationMessage.ServerHandler.class, RotationMessage.RotationQuery.class); - registerMessage(RotationMessage.ClientHandler.class, RotationMessage.RotationData.class); - registerMessage(ChunkDataMessage.ServerHandler.class, ChunkDataMessage.ChunkDataQuery.class); registerMessage(ChunkDataMessage.ClientHandler.class, ChunkDataMessage.ChunkDataData.class); @@ -34,6 +31,10 @@ public class NetworkDispatcher extends eu.usrv.yamcore.network.PacketDispatcher registerMessage(RendererMessage.ClientHandler.class, RendererMessage.RendererData.class); + registerMessage(EnderLinkCoverMessage.ServerHandler.class, EnderLinkCoverMessage.EnderLinkCoverQuery.class); + registerMessage(EnderLinkCoverMessage.ServerUpdateHandler.class, EnderLinkCoverMessage.EnderLinkCoverUpdate.class); + registerMessage(EnderLinkCoverMessage.ClientHandler.class, EnderLinkCoverMessage.EnderLinkCoverData.class); + registerMessage(TextParametersMessage.ServerHandler.class, TextParametersMessage.ParametersTextQuery.class); registerMessage(TextParametersMessage.ServerUpdateHandler.class, TextParametersMessage.ParametersTextUpdate.class); registerMessage(TextParametersMessage.ClientHandler.class, TextParametersMessage.ParametersTextData.class); diff --git a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java index e16580befe..66e549ddb1 100644 --- a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java +++ b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java @@ -9,83 +9,132 @@ public class TecTechConfig extends ConfigManager { super(pConfigBaseDirectory, pModCollectionDirectory, pModID); } - public boolean modAdminErrorLogs; - //final static to allow compiler to remove the debug code when this is false public static boolean DEBUG_MODE = false; + public boolean DISABLE_MATERIAL_LOADING_FFS; + public boolean BOOM_ENABLE; + public boolean DISABLE_BLOCK_HARDNESS_NERF; public boolean EASY_SCAN; public boolean NERF_FUSION; public boolean ENABLE_TURRET_EXPLOSIONS; - public boolean DISABLE_MATERIAL_LOADING_FFS; public float TURRET_DAMAGE_FACTOR; public float TURRET_EXPLOSION_FACTOR; - public float TESLA_MULTI_MIN_EFFICIENCY; - public float TESLA_MULTI_MAX_EFFICIENCY; - public float TESLA_MULTI_OVERDRIVE_LOSS; - public float TESLA_SINGLE_MIN_EFFICIENCY; - public float TESLA_SINGLE_MAX_EFFICIENCY; - public float TESLA_SINGLE_OVERDRIVE_LOSS; + public boolean MOD_ADMIN_ERROR_LOGS; + public boolean TESLA_MULTI_GAS_OUTPUT; + public float TESLA_MULTI_LOSS_FACTOR_OVERDRIVE; + public int TESLA_MULTI_LOSS_PER_BLOCK_T0; + public int TESLA_MULTI_LOSS_PER_BLOCK_T1; + public int TESLA_MULTI_LOSS_PER_BLOCK_T2; + public int TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM; + public int TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN; + public int TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON; + public int TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1; + public int TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2; + public int TESLA_MULTI_RANGE_COVER; + public int TESLA_MULTI_RANGE_TOWER; + public int TESLA_MULTI_RANGE_TRANSCEIVER; + public float TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE; + public int TESLA_SINGLE_LOSS_PER_BLOCK; + public int TESLA_SINGLE_RANGE; /** * This loading phases do not correspond to mod loading phases! */ @Override protected void PreInit() { - modAdminErrorLogs = false; - EASY_SCAN = false; + DISABLE_MATERIAL_LOADING_FFS = false; + BOOM_ENABLE = true; + DISABLE_BLOCK_HARDNESS_NERF = false; + EASY_SCAN = false; NERF_FUSION = false; ENABLE_TURRET_EXPLOSIONS = true; - DISABLE_MATERIAL_LOADING_FFS=false; TURRET_DAMAGE_FACTOR = 10; TURRET_EXPLOSION_FACTOR = 1; - TESLA_MULTI_MIN_EFFICIENCY = 0.955F; - TESLA_MULTI_MAX_EFFICIENCY = 0.98F; - TESLA_MULTI_OVERDRIVE_LOSS = 0.005F; - TESLA_SINGLE_MIN_EFFICIENCY = 0.91F; - TESLA_SINGLE_MAX_EFFICIENCY = 0.95F; - TESLA_SINGLE_OVERDRIVE_LOSS = 0.010F; - } + MOD_ADMIN_ERROR_LOGS = false; + + TESLA_MULTI_GAS_OUTPUT = false; + TESLA_MULTI_LOSS_FACTOR_OVERDRIVE = 0.25F; + TESLA_MULTI_LOSS_PER_BLOCK_T0 = 1; + TESLA_MULTI_LOSS_PER_BLOCK_T1 = 1; + TESLA_MULTI_LOSS_PER_BLOCK_T2 = 1; + TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM = 100; + TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN = 50; + TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON = 50; + TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1 = 2; + TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2 = 4; + TESLA_MULTI_RANGE_COVER = 16; + TESLA_MULTI_RANGE_TOWER = 32; + TESLA_MULTI_RANGE_TRANSCEIVER = 16; + TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE = 0.25F; + TESLA_SINGLE_LOSS_PER_BLOCK = 1; + TESLA_SINGLE_RANGE = 20; + } /** * This loading phases do not correspond to mod loading phases! */ @Override protected void Init() { - modAdminErrorLogs = _mainConfig.getBoolean("AdminErrorLog", "Modules", modAdminErrorLogs, - "If set to true, every op/admin will receive all errors occurred during the startup phase as in game message on join"); - DEBUG_MODE = _mainConfig.getBoolean("DebugMode", "Debug", DEBUG_MODE, + DEBUG_MODE = _mainConfig.getBoolean("DebugMode", "debug", DEBUG_MODE, "Enables logging and other purely debug features"); - EASY_SCAN = _mainConfig.getBoolean("EasyScan", "Features", EASY_SCAN, - "Enables tricorder to scan EM i/o hatches directly, too CHEEKY"); - BOOM_ENABLE = _mainConfig.getBoolean("BoomEnable", "Features", BOOM_ENABLE, + DISABLE_MATERIAL_LOADING_FFS = _mainConfig.getBoolean("DisableMaterialLoading", "debug", + DISABLE_MATERIAL_LOADING_FFS, "Set to true to disable gregtech material processing"); + + BOOM_ENABLE = _mainConfig.getBoolean("BoomEnable", "features", BOOM_ENABLE, "Set to false to disable explosions on everything bad that you can do"); - NERF_FUSION = _mainConfig.getBoolean("NerfFusion", "Features", NERF_FUSION, + DISABLE_BLOCK_HARDNESS_NERF = _mainConfig.getBoolean("DisableBlockHardnessNerf", "features", + DISABLE_BLOCK_HARDNESS_NERF, "Set to true to disable the block hardness nerf"); + EASY_SCAN = _mainConfig.getBoolean("EasyScan", "features", EASY_SCAN, + "Enables tricorder to scan EM i/o hatches directly, too CHEEKY"); + NERF_FUSION = _mainConfig.getBoolean("NerfFusion", "features", NERF_FUSION, "Set to true to enable removal of plasmas heavier than Fe and other weird ones"); - ENABLE_TURRET_EXPLOSIONS = _mainConfig.getBoolean("TurretBoomEnable", "Features", ENABLE_TURRET_EXPLOSIONS, - "Set to false to disable explosions caused by EM turrets"); - TURRET_DAMAGE_FACTOR = _mainConfig.getFloat("TurretDamageFactor", "Features", TURRET_DAMAGE_FACTOR, 0, Short.MAX_VALUE, - "Damage is multiplied by this number"); - TURRET_EXPLOSION_FACTOR = _mainConfig.getFloat("TurretExplosionFactor", "Features", TURRET_EXPLOSION_FACTOR, 0, Short.MAX_VALUE, - "Explosion strength is multiplied by this number"); - DISABLE_MATERIAL_LOADING_FFS = _mainConfig.getBoolean("DisableMaterialLoading", "Debug", DISABLE_MATERIAL_LOADING_FFS, - "Set to true to disable gregtech material processing"); - TESLA_MULTI_MIN_EFFICIENCY = _mainConfig.getFloat("teslaMultiMinEfficency", "Features", TESLA_MULTI_MIN_EFFICIENCY, 0, 1, - "Worst possible power loss per block for the multi block tesla"); - TESLA_MULTI_MAX_EFFICIENCY = _mainConfig.getFloat("teslaMultiMaxEfficency", "Features", TESLA_MULTI_MAX_EFFICIENCY, 0, 1, - "Best possible power loss per block for the multi block tesla"); - TESLA_MULTI_OVERDRIVE_LOSS = _mainConfig.getFloat("teslaMultiOverdriveLoss", "Features", TESLA_MULTI_OVERDRIVE_LOSS, 0, 1, - "Additional losses for overdrive use on the multi block tesla"); - TESLA_SINGLE_MIN_EFFICIENCY = _mainConfig.getFloat("teslaSingleMinEfficency", "Features", TESLA_SINGLE_MIN_EFFICIENCY, 0, 1, - "Worst possible power loss per block for the single block tesla"); - TESLA_SINGLE_MAX_EFFICIENCY = _mainConfig.getFloat("teslaSingleMaxEfficency", "Features", TESLA_SINGLE_MAX_EFFICIENCY, 0, 1, - "Best possible power loss per block for the single block tesla"); - TESLA_SINGLE_OVERDRIVE_LOSS = _mainConfig.getFloat("teslaSingleOverdriveLoss", "Features", TESLA_SINGLE_OVERDRIVE_LOSS, 0, 1, - "Additional losses for overdrive use on the single block tesla"); + ENABLE_TURRET_EXPLOSIONS = _mainConfig.getBoolean("TurretBoomEnable", "features", + ENABLE_TURRET_EXPLOSIONS, "Set to false to disable explosions caused by EM turrets"); + TURRET_DAMAGE_FACTOR = _mainConfig.getFloat("TurretDamageFactor", "features", TURRET_DAMAGE_FACTOR, + 0, Short.MAX_VALUE, "Damage is multiplied by this number"); + TURRET_EXPLOSION_FACTOR = _mainConfig.getFloat("TurretExplosionFactor", "features", + TURRET_EXPLOSION_FACTOR, 0, Short.MAX_VALUE, "Explosion strength is multiplied by this number"); + + MOD_ADMIN_ERROR_LOGS = _mainConfig.getBoolean("AdminErrorLog", "modules", MOD_ADMIN_ERROR_LOGS, + "If set to true, every op/admin will receive all errors occurred during the startup phase as in game message on join"); + + TESLA_MULTI_GAS_OUTPUT = _mainConfig.getBoolean("TeslaMultiGasOutput", "tesla_tweaks", + TESLA_MULTI_GAS_OUTPUT, "Set to true to enable outputting plasmas as gasses from the tesla tower with a 1:1 ratio"); + TESLA_MULTI_LOSS_FACTOR_OVERDRIVE = _mainConfig.getFloat("TeslaMultiLossFactorOverdrive", "tesla_tweaks", + TESLA_MULTI_LOSS_FACTOR_OVERDRIVE, 0, 1, "Additional Tesla Tower power loss per amp as a factor of the tier voltage"); + TESLA_MULTI_LOSS_PER_BLOCK_T0 = _mainConfig.getInt("TeslaMultiLossPerBlockT0", "tesla_tweaks", + TESLA_MULTI_LOSS_PER_BLOCK_T0, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using no plasmas"); + TESLA_MULTI_LOSS_PER_BLOCK_T1 = _mainConfig.getInt("TeslaMultiLossPerBlockT1", "tesla_tweaks", + TESLA_MULTI_LOSS_PER_BLOCK_T1, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using helium or nitrogen plasma"); + TESLA_MULTI_LOSS_PER_BLOCK_T2 = _mainConfig.getInt("TeslaMultiLossPerBlockT2", "tesla_tweaks", + TESLA_MULTI_LOSS_PER_BLOCK_T2, 0, Integer.MAX_VALUE, "Tesla Tower power transmission loss per block per amp using radon plasma"); + TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM = _mainConfig.getInt("TeslaMultiPlasmaPerSecondT1Helium", + "tesla_tweaks", TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM, 0, Integer.MAX_VALUE, "Tesla Tower helium plasma consumed each second the tesla tower is active"); + TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN = _mainConfig.getInt("TeslaMultiPlasmaPerSecondT1Nitrogen", + "tesla_tweaks", TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN, 0, Integer.MAX_VALUE, "Tesla Tower nitrogen plasma consumed each second the tesla tower is active"); + TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON = _mainConfig.getInt("TeslaMultiPlasmaPerSecondT2Radon", + "tesla_tweaks", TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON, 0, Integer.MAX_VALUE, "Tesla Tower radon plasma consumed each second the tesla tower is active"); + TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1 = _mainConfig.getInt("TeslaMultiRangeCoefficientPlasmaT1", + "tesla_tweaks", TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1, 0, Integer.MAX_VALUE, "Tesla Tower T1 Plasmas Range Multiplier"); + TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2 = _mainConfig.getInt("TeslaMultiRangeCoefficientPlasmaT2", + "tesla_tweaks", TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2, 0, Integer.MAX_VALUE, "Tesla Tower T2 Plasmas Range Multiplier"); + TESLA_MULTI_RANGE_COVER = _mainConfig.getInt("TeslaMultiRangeCover", "tesla_tweaks", + TESLA_MULTI_RANGE_COVER, 0, Integer.MAX_VALUE, "Tesla Tower to Tesla Coil Rich Edition Cover max range"); + TESLA_MULTI_RANGE_TOWER = _mainConfig.getInt("TeslaMultiRangeTower", "tesla_tweaks", + TESLA_MULTI_RANGE_TOWER, 0, Integer.MAX_VALUE, "Tesla Tower to Tower max range"); + TESLA_MULTI_RANGE_TRANSCEIVER = _mainConfig.getInt("TeslaMultiRangeTransceiver", "tesla_tweaks", + TESLA_MULTI_RANGE_TRANSCEIVER, 0, Integer.MAX_VALUE, "Tesla Tower to Transceiver max range"); + TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE = _mainConfig.getFloat("TeslaSingleLossFactorOverdrive", "tesla_tweaks", + TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE, 0, 1, "Additional Tesla Transceiver power loss per amp as a factor of the tier voltage"); + TESLA_SINGLE_LOSS_PER_BLOCK = _mainConfig.getInt("TeslaSingleLossPerBlock", "tesla_tweaks", + TESLA_SINGLE_LOSS_PER_BLOCK, 0, Integer.MAX_VALUE, "Tesla Transceiver power transmission loss per block per amp"); + TESLA_SINGLE_RANGE = _mainConfig.getInt("TeslaSingleRange", "tesla_tweaks", + TESLA_SINGLE_RANGE, 0, Integer.MAX_VALUE, "Tesla Transceiver to max range"); } /** @@ -93,6 +142,5 @@ public class TecTechConfig extends ConfigManager { */ @Override protected void PostInit() { - } } diff --git a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java new file mode 100644 index 0000000000..cd73d1e420 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabEM.java @@ -0,0 +1,19 @@ +package com.github.technus.tectech.loader.gui; + +import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; + +public class CreativeTabEM extends CreativeTabs { + public CreativeTabEM(String name) { + super(name); + } + + @SideOnly(Side.CLIENT) + @Override + public Item getTabIconItem() { + return ElementalDefinitionContainer_EM.INSTANCE; + } +} diff --git a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java index d360162fb6..e5b9fea395 100644 --- a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java +++ b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java @@ -11,8 +11,6 @@ import net.minecraft.item.Item; import java.util.List; public class CreativeTabTecTech extends CreativeTabs { - public static CreativeTabTecTech creativeTabTecTech; - public CreativeTabTecTech(String name) { super(name); } diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java index 8165cd7fec..20f58b739b 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/RecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/BaseRecipeLoader.java @@ -2,14 +2,14 @@ package com.github.technus.tectech.loader.recipe; import com.github.technus.tectech.Reference; import com.github.technus.tectech.compatibility.dreamcraft.DreamCraftRecipeLoader; +import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; import com.github.technus.tectech.compatibility.spartakcore.SpartakCoreRecipeLoader; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; import com.github.technus.tectech.thing.CustomItemList; -import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.item.ConstructableTriggerItem; import com.github.technus.tectech.thing.item.EuMeterGT; -import com.github.technus.tectech.thing.item.FrontRotationTriggerItem; +import com.gtnewhorizon.structurelib.StructureLibAPI; import cpw.mods.fml.common.Loader; import gregtech.api.enums.Dyes; import gregtech.api.enums.ItemList; @@ -27,37 +27,43 @@ import static gregtech.api.enums.GT_Values.RA; /** * Created by danie_000 on 16.11.2016. */ -public class RecipeLoader implements Runnable { - public static Materials getOrDefault(String name,Materials def){ - Materials mat=Materials.get(name); +public class BaseRecipeLoader { + public static Materials getOrDefault(String name, Materials def) { + Materials mat = Materials.get(name); return mat == Materials._NULL || mat == null ? def : mat; } - @Override - public void run() { - dAtomDefinition.setTransformation(); - dHadronDefinition.setTransformations(); + public void run(EMTransformationRegistry transformationInfo) { + EMAtomDefinition.setTransformations(transformationInfo); + EMHadronDefinition.setTransformations(transformationInfo); + if (Loader.isModLoaded(Reference.GTPLUSPLUS)) { + new GtppAtomLoader().setTransformations(transformationInfo); + } // =================================================================================================== // Recipes init - common goes here rest goes into methods below // =================================================================================================== 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); + RA.addAssemblerRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(i), + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cobalt, 1)}, + Materials.Aluminium.getMolten(864), + new ItemStack(StructureLibAPI.getBlockHint(), 1, i), 32, 120); } //Scrench - GT_ModHandler.addCraftingRecipe(new ItemStack(FrontRotationTriggerItem.INSTANCE,1), - GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, - new Object[]{"fPR", " RP", "S h", - 'P', OrePrefixes.plate.get(Materials.Cobalt), - 'R', OrePrefixes.stick.get(Materials.Cobalt), - 'S', OrePrefixes.stick.get(Materials.Wood),}); +// GT_ModHandler.addCraftingRecipe(new ItemStack(FrontRotationTriggerItem.INSTANCE,1), +// GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, +// new Object[]{"fPR", " RP", "S h", +// 'P', OrePrefixes.plate.get(Materials.Cobalt), +// 'R', OrePrefixes.stick.get(Materials.Cobalt), +// 'S', OrePrefixes.stick.get(Materials.Wood),}); //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}); +// 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}); + //GT EU reader GT_ModHandler.addCraftingRecipe(new ItemStack(EuMeterGT.INSTANCE,1), @@ -91,16 +97,15 @@ public class RecipeLoader implements Runnable { 'E', ItemList.Hull_IV}); //Data Bank - RA.addAssemblylineRecipe(ItemList.Hatch_DataAccess_EV.get(1), 20000, new ItemStack[]{ + RA.addAssemblylineRecipe(ItemList.Hatch_DataAccess_EV.get(1), 20000, new Object[]{ CustomItemList.Machine_Multi_Switch.get(1), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 2), + new Object[]{OrePrefixes.circuit.get(Materials.Master), 2}, ItemList.Tool_DataOrb.get(1), ItemList.Cover_Screen.get(1), }, new FluidStack[]{ new FluidStack(FluidRegistry.getFluid("ic2coolant"), 2000), Materials.Hydrogen.getGas(1000), }, CustomItemList.Machine_Multi_DataBank.get(1), 12000, 14000); - //CustomItemList.Machine_Multi_DataBank //Bucks //RA.addAssemblerRecipe(CustomItemList.) @@ -110,11 +115,11 @@ public class RecipeLoader implements Runnable { RA.addAssemblerRecipe(ItemList.Hatch_DataAccess_EV.get(1), CustomItemList.dataOut_Hatch.get(1), CustomItemList.dataOutAss_Hatch.get(1), 2048, 12000); if (Loader.isModLoaded(Reference.DREAMCRAFT)) { - new DreamCraftRecipeLoader().run();//init recipes for GTNH version + new DreamCraftRecipeLoader().run(transformationInfo);//init recipes for GTNH version } else if (Loader.isModLoaded(Reference.SPARTAKCORE)) { - new SpartakCoreRecipeLoader().run();//init recipes for SpartakCore version + new SpartakCoreRecipeLoader().run(transformationInfo);//init recipes for SpartakCore version } else { - new BloodyRecipeLoader().run();//init recipes for NON-GTNH version + new BloodyRecipeLoader().run(transformationInfo);//init recipes for NON-GTNH version } } } diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java index a1d400ed54..a57f268d4e 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.loader.recipe; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.recipe.TT_recipeAdder; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; @@ -22,9 +23,8 @@ import net.minecraftforge.fluids.FluidStack; /** * Created by Tec on 06.08.2017. */ -public class BloodyRecipeLoader implements Runnable { - @Override - public void run() { +public class BloodyRecipeLoader { + public void run(EMTransformationRegistry transformationInfo) { //Quantum Glass GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ CustomItemList.eM_Containment.get(1), @@ -165,32 +165,33 @@ public class BloodyRecipeLoader implements Runnable { GT_ModHandler.addCraftingRecipe(CustomItemList.tM_TeslaPrimary_0.get(1), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", "WwW", "WWW", - 'W', OrePrefixes.wireGt02.get(Materials.RedstoneAlloy)}); + 'W', OrePrefixes.wireGt02.get(Materials.Tin)}); //Tesla Primary Coils T1 GT_ModHandler.addCraftingRecipe(CustomItemList.tM_TeslaPrimary_1.get(1), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", "WwW", "WWW", - 'W', OrePrefixes.wireGt02.get(Materials.SuperconductorMV)}); + 'W', OrePrefixes.wireGt02.get(Materials.Copper)}); //Tesla Primary Coils T2 GT_ModHandler.addCraftingRecipe(CustomItemList.tM_TeslaPrimary_2.get(1), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", "WwW", "WWW", - 'W', OrePrefixes.wireGt02.get(Materials.SuperconductorHV)}); + 'W', OrePrefixes.wireGt02.get(Materials.Silver)}); //Tesla Primary Coils T3 GT_ModHandler.addCraftingRecipe(CustomItemList.tM_TeslaPrimary_3.get(1), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", "WwW", "WWW", - 'W', OrePrefixes.wireGt02.get(Materials.SuperconductorEV)}); + 'W', OrePrefixes.wireGt02.get(Materials.Aluminium)}); //Tesla Primary Coils T4 GT_ModHandler.addCraftingRecipe(CustomItemList.tM_TeslaPrimary_4.get(1), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", "WwW", "WWW", - 'W', OrePrefixes.wireGt02.get(Materials.SuperconductorIV)}); + 'W', OrePrefixes.wireGt02.get(Materials.Platinum)}); //Tesla Primary Coils T5 GT_ModHandler.addCraftingRecipe(CustomItemList.tM_TeslaPrimary_5.get(1), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", "WwW", "WWW", - 'W', OrePrefixes.wireGt02.get(Materials.SuperconductorLuV)}); + 'W', OrePrefixes.wireGt02.get(Materials.Superconductor)}); + //TODO Add Tesla Primary Coils T6 //endregion @@ -1114,7 +1115,7 @@ public class BloodyRecipeLoader implements Runnable { }, Materials.Epoxid.getMolten(288), CustomItemList.teslaComponent.getWithDamage(1, 0), 320, 30); //Tesla Winding Components Ultimate GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ - GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorLuV, 16), + GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Superconductor, 16), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.NickelZincFerrite, 8), }, Materials.Epoxid.getMolten(576), CustomItemList.teslaComponent.getWithDamage(1, 1), 320, 7680); @@ -1125,38 +1126,53 @@ public class BloodyRecipeLoader implements Runnable { //LV Tesla Capacitor GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Tin, 4), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 4), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 4), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 8), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 8), }, Materials.Epoxid.getMolten(72), CustomItemList.teslaCapacitor.getWithDamage(1, 0), 320, 30); //MV Tesla Capacitor GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Copper, 4), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 6), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 6), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 12), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 12), }, Materials.Epoxid.getMolten(144), CustomItemList.teslaCapacitor.getWithDamage(1, 1), 320, 120); //HV Tesla Capacitor GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Gold, 4), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 8), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 8), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 16), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 16), }, Materials.Epoxid.getMolten(216), CustomItemList.teslaCapacitor.getWithDamage(1, 2), 320, 480); //EV Tesla Capacitor GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Aluminium, 4), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 10), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 10), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 20), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 20), }, Materials.Epoxid.getMolten(288), CustomItemList.teslaCapacitor.getWithDamage(1, 3), 320, 1920); //IV Tesla Capacitor GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Tungsten, 4), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 12), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 12), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 24), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 24), }, Materials.Epoxid.getMolten(360), CustomItemList.teslaCapacitor.getWithDamage(1, 4), 320, 7680); + //LuV Tesla Capacitor + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.HSSG, 4), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 14), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 28), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 28), + }, Materials.Epoxid.getMolten(432), CustomItemList.teslaCapacitor.getWithDamage(1, 5), 320, 30720); + //ZPM Tesla Capacitor + //GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ + // GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Naquadah, 4), + // GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 16), + // GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 32), + // GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 32), + //}, Materials.Epoxid.getMolten(504), CustomItemList.teslaCapacitor.getWithDamage(1, 6), 320, 122880); + //TODO Allow with the coils, useless alone and will only cause trouble //Tesla Cover GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ CustomItemList.teslaComponent.getWithDamage(4, 0), @@ -1208,19 +1224,25 @@ public class BloodyRecipeLoader implements Runnable { //LV Tesla Capacitor GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 0), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 4), 300, 2); + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 4), 300, 2); //MV Tesla Capacitor GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 1), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 6), 300, 2); + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 6), 300, 2); //HV Tesla Capacitor GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 2), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 8), 300, 2); + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 8), 300, 2); //EV Tesla Capacitor GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 3), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 10), 300, 2); + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 10), 300, 2); //IV Tesla Capacitor GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 4), - GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.BatteryAlloy, 12), 300, 2); + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 12), 300, 2); + //LuV Tesla Capacitor + GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 5), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 14), 300, 2); + //ZPM Tesla Capacitor + GT_Values.RA.addExtractorRecipe(CustomItemList.teslaCapacitor.getWithDamage(1, 6), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.BatteryAlloy, 16), 300, 2); //endregion diff --git a/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java index d7e9a21a67..880113073c 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java @@ -1,8 +1,12 @@ package com.github.technus.tectech.loader.thing; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.thing.cover.GT_Cover_TM_EnderFluidLink; +import com.github.technus.tectech.thing.cover.GT_Cover_TM_PowerPassUpgrade; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate; +import com.github.technus.tectech.thing.item.EnderFluidLinkCover; +import com.github.technus.tectech.thing.item.PowerPassUpgradeCover; import com.github.technus.tectech.thing.item.TeslaCoilCover; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; @@ -16,9 +20,13 @@ public class CoverLoader implements Runnable { public void run() { final IIconContainer TESLA_OVERLAY = new Textures.BlockIcons.CustomIcon("iconsets/TESLA_OVERLAY"); final IIconContainer TESLA_OVERLAY_ULTIMATE = new Textures.BlockIcons.CustomIcon("iconsets/TESLA_OVERLAY_ULTIMATE"); + final IIconContainer ENDERFLUIDLINK_OVERLAY = new Textures.BlockIcons.CustomIcon("iconsets/ENDERFLUIDLINK_OVERLAY"); + final IIconContainer POWERPASSUPGRADE_OVERLAY = new Textures.BlockIcons.CustomIcon("iconsets/POWERPASSUPGRADE_OVERLAY"); GregTech_API.registerCover(new ItemStack(TeslaCoilCover.INSTANCE, 1, 0), new GT_RenderedTexture(TESLA_OVERLAY), new GT_Cover_TM_TeslaCoil()); GregTech_API.registerCover(new ItemStack(TeslaCoilCover.INSTANCE, 1, 1), new GT_RenderedTexture(TESLA_OVERLAY_ULTIMATE), new GT_Cover_TM_TeslaCoil_Ultimate()); + GregTech_API.registerCover(new ItemStack(EnderFluidLinkCover.INSTANCE, 1, 0), new GT_RenderedTexture(ENDERFLUIDLINK_OVERLAY), new GT_Cover_TM_EnderFluidLink()); + GregTech_API.registerCover(new ItemStack(PowerPassUpgradeCover.INSTANCE, 1, 0), new GT_RenderedTexture(POWERPASSUPGRADE_OVERLAY), new GT_Cover_TM_PowerPassUpgrade()); TecTech.LOGGER.info("Cover functionality registered"); } } diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 0f127f9f6f..4dd9d3422d 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -6,6 +6,7 @@ import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity. import com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_essentiaQuantizer; import com.github.technus.tectech.thing.metaTileEntity.hatch.*; import com.github.technus.tectech.thing.metaTileEntity.multi.*; +import com.github.technus.tectech.thing.metaTileEntity.multi.em_collider.GT_MetaTileEntity_EM_collider; import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM; @@ -15,7 +16,8 @@ import cpw.mods.fml.common.Loader; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.CustomItemList.*; /** @@ -73,22 +75,22 @@ public class MachineLoader implements Runnable { // =================================================================================================== eM_muffler_UV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f).getStackForm(1L)); + 15020, "hatch.emmuffler.tier.08", "UV Overflow Output Hatch", 8, 1e10f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); eM_muffler_UHV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f).getStackForm(1L)); + 15021, "hatch.emmuffler.tier.09", "UHV Overflow Output Hatch", 9, 5e10f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); eM_muffler_UEV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f).getStackForm(1L)); + 15022, "hatch.emmuffler.tier.10", "UEV Overflow Output Hatch", 10, 25e10f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); eM_muffler_UIV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f).getStackForm(1L)); + 15023, "hatch.emmuffler.tier.11", "UIV Overflow Output Hatch", 11, 125e10f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); eM_muffler_UMV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f).getStackForm(1L)); + 15024, "hatch.emmuffler.tier.12", "UMV Overflow Output Hatch", 12, 125e11f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); eM_muffler_UXV.set(new GT_MetaTileEntity_Hatch_OverflowElemental( - 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f).getStackForm(1L)); + 15025, "hatch.emmuffler.tier.13", "UXV Overflow Output Hatch", 13, 125e12f* EM_COUNT_PER_MATERIAL_AMOUNT).getStackForm(1L)); // =================================================================================================== @@ -198,141 +200,141 @@ public class MachineLoader implements Runnable { // =================================================================================================== eM_energyTunnel1_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15130, "hatch.energytunnel1.tier.05", "IV 256/t Laser Target Hatch", 5, 256).getStackForm(1L)); + 15130, "hatch.energytunnel1.tier.05", "IV 256A/t Laser Target Hatch", 5, 256).getStackForm(1L)); eM_energyTunnel2_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15140, "hatch.energytunnel2.tier.05", "IV 1024/t Laser Target Hatch", 5, 1024).getStackForm(1L)); + 15140, "hatch.energytunnel2.tier.05", "IV 1024A/t Laser Target Hatch", 5, 1024).getStackForm(1L)); eM_energyTunnel3_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15150, "hatch.energytunnel3.tier.05", "IV 4096/t Laser Target Hatch", 5, 4096).getStackForm(1L)); + 15150, "hatch.energytunnel3.tier.05", "IV 4096A/t Laser Target Hatch", 5, 4096).getStackForm(1L)); eM_energyTunnel4_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15160, "hatch.energytunnel4.tier.05", "IV 16384/t Laser Target Hatch", 5, 16384).getStackForm(1L)); + 15160, "hatch.energytunnel4.tier.05", "IV 16384A/t Laser Target Hatch", 5, 16384).getStackForm(1L)); eM_energyTunnel5_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15170, "hatch.energytunnel5.tier.05", "IV 65536/t Laser Target Hatch", 5, 65536).getStackForm(1L)); + 15170, "hatch.energytunnel5.tier.05", "IV 65536A/t Laser Target Hatch", 5, 65536).getStackForm(1L)); eM_energyTunnel6_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15180, "hatch.energytunnel6.tier.05", "IV 262144/t Laser Target Hatch", 5, 262144).getStackForm(1L)); + 15180, "hatch.energytunnel6.tier.05", "IV 262144A/t Laser Target Hatch", 5, 262144).getStackForm(1L)); eM_energyTunnel7_IV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15190, "hatch.energytunnel7.tier.05", "IV 1048576/t Laser Target Hatch", 5, 1048576).getStackForm(1L)); + 15190, "hatch.energytunnel7.tier.05", "IV 1048576A/t Laser Target Hatch", 5, 1048576).getStackForm(1L)); eM_energyTunnel1_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15131, "hatch.energytunnel1.tier.06", "LuV 256/t Laser Target Hatch", 6, 256).getStackForm(1L)); + 15131, "hatch.energytunnel1.tier.06", "LuV 256A/t Laser Target Hatch", 6, 256).getStackForm(1L)); eM_energyTunnel2_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15141, "hatch.energytunnel2.tier.06", "LuV 1024/t Laser Target Hatch", 6, 1024).getStackForm(1L)); + 15141, "hatch.energytunnel2.tier.06", "LuV 1024A/t Laser Target Hatch", 6, 1024).getStackForm(1L)); eM_energyTunnel3_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15151, "hatch.energytunnel3.tier.06", "LuV 4096/t Laser Target Hatch", 6, 4096).getStackForm(1L)); + 15151, "hatch.energytunnel3.tier.06", "LuV 4096A/t Laser Target Hatch", 6, 4096).getStackForm(1L)); eM_energyTunnel4_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15161, "hatch.energytunnel4.tier.06", "LuV 16384/t Laser Target Hatch", 6, 16384).getStackForm(1L)); + 15161, "hatch.energytunnel4.tier.06", "LuV 16384A/t Laser Target Hatch", 6, 16384).getStackForm(1L)); eM_energyTunnel5_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15171, "hatch.energytunnel5.tier.06", "LuV 65536/t Laser Target Hatch", 6, 65536).getStackForm(1L)); + 15171, "hatch.energytunnel5.tier.06", "LuV 65536A/t Laser Target Hatch", 6, 65536).getStackForm(1L)); eM_energyTunnel6_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15181, "hatch.energytunnel6.tier.06", "LuV 262144/t Laser Target Hatch", 6, 262144).getStackForm(1L)); + 15181, "hatch.energytunnel6.tier.06", "LuV 262144A/t Laser Target Hatch", 6, 262144).getStackForm(1L)); eM_energyTunnel7_LuV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15191, "hatch.energytunnel7.tier.06", "LuV 1048576/t Laser Target Hatch", 6, 1048576).getStackForm(1L)); + 15191, "hatch.energytunnel7.tier.06", "LuV 1048576A/t Laser Target Hatch", 6, 1048576).getStackForm(1L)); eM_energyTunnel1_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15132, "hatch.energytunnel1.tier.07", "ZPM 256/t Laser Target Hatch", 7, 256).getStackForm(1L)); + 15132, "hatch.energytunnel1.tier.07", "ZPM 256A/t Laser Target Hatch", 7, 256).getStackForm(1L)); eM_energyTunnel2_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15142, "hatch.energytunnel2.tier.07", "ZPM 1024/t Laser Target Hatch", 7, 1024).getStackForm(1L)); + 15142, "hatch.energytunnel2.tier.07", "ZPM 1024A/t Laser Target Hatch", 7, 1024).getStackForm(1L)); eM_energyTunnel3_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15152, "hatch.energytunnel3.tier.07", "ZPM 4096/t Laser Target Hatch", 7, 4096).getStackForm(1L)); + 15152, "hatch.energytunnel3.tier.07", "ZPM 4096A/t Laser Target Hatch", 7, 4096).getStackForm(1L)); eM_energyTunnel4_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15162, "hatch.energytunnel4.tier.07", "ZPM 16384/t Laser Target Hatch", 7, 16384).getStackForm(1L)); + 15162, "hatch.energytunnel4.tier.07", "ZPM 16384A/t Laser Target Hatch", 7, 16384).getStackForm(1L)); eM_energyTunnel5_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15172, "hatch.energytunnel5.tier.07", "ZPM 65536/t Laser Target Hatch", 7, 65536).getStackForm(1L)); + 15172, "hatch.energytunnel5.tier.07", "ZPM 65536A/t Laser Target Hatch", 7, 65536).getStackForm(1L)); eM_energyTunnel6_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15182, "hatch.energytunnel6.tier.07", "ZPM 262144/t Laser Target Hatch", 7, 262144).getStackForm(1L)); + 15182, "hatch.energytunnel6.tier.07", "ZPM 262144A/t Laser Target Hatch", 7, 262144).getStackForm(1L)); eM_energyTunnel7_ZPM.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15192, "hatch.energytunnel7.tier.07", "ZPM 1048576/t Laser Target Hatch", 7, 1048576).getStackForm(1L)); + 15192, "hatch.energytunnel7.tier.07", "ZPM 1048576A/t Laser Target Hatch", 7, 1048576).getStackForm(1L)); eM_energyTunnel1_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15133, "hatch.energytunnel1.tier.08", "UV 256/t Laser Target Hatch", 8, 256).getStackForm(1L)); + 15133, "hatch.energytunnel1.tier.08", "UV 256A/t Laser Target Hatch", 8, 256).getStackForm(1L)); eM_energyTunnel2_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15143, "hatch.energytunnel2.tier.08", "UV 1024/t Laser Target Hatch", 8, 1024).getStackForm(1L)); + 15143, "hatch.energytunnel2.tier.08", "UV 1024A/t Laser Target Hatch", 8, 1024).getStackForm(1L)); eM_energyTunnel3_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15153, "hatch.energytunnel3.tier.08", "UV 4096/t Laser Target Hatch", 8, 4096).getStackForm(1L)); + 15153, "hatch.energytunnel3.tier.08", "UV 4096A/t Laser Target Hatch", 8, 4096).getStackForm(1L)); eM_energyTunnel4_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15163, "hatch.energytunnel4.tier.08", "UV 16384/t Laser Target Hatch", 8, 16384).getStackForm(1L)); + 15163, "hatch.energytunnel4.tier.08", "UV 16384A/t Laser Target Hatch", 8, 16384).getStackForm(1L)); eM_energyTunnel5_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15173, "hatch.energytunnel5.tier.08", "UV 65536/t Laser Target Hatch", 8, 65536).getStackForm(1L)); + 15173, "hatch.energytunnel5.tier.08", "UV 65536A/t Laser Target Hatch", 8, 65536).getStackForm(1L)); eM_energyTunnel6_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15183, "hatch.energytunnel6.tier.08", "UV 262144/t Laser Target Hatch", 8, 262144).getStackForm(1L)); + 15183, "hatch.energytunnel6.tier.08", "UV 262144A/t Laser Target Hatch", 8, 262144).getStackForm(1L)); eM_energyTunnel7_UV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15193, "hatch.energytunnel7.tier.08", "UV 1048576/t Laser Target Hatch", 8, 1048576).getStackForm(1L)); + 15193, "hatch.energytunnel7.tier.08", "UV 1048576A/t Laser Target Hatch", 8, 1048576).getStackForm(1L)); eM_energyTunnel1_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15134, "hatch.energytunnel1.tier.09", "UHV 256/t Laser Target Hatch", 9, 256).getStackForm(1L)); + 15134, "hatch.energytunnel1.tier.09", "UHV 256A/t Laser Target Hatch", 9, 256).getStackForm(1L)); eM_energyTunnel2_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15144, "hatch.energytunnel2.tier.09", "UHV 1024/t Laser Target Hatch", 9, 1024).getStackForm(1L)); + 15144, "hatch.energytunnel2.tier.09", "UHV 1024A/t Laser Target Hatch", 9, 1024).getStackForm(1L)); eM_energyTunnel3_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15154, "hatch.energytunnel3.tier.09", "UHV 4096/t Laser Target Hatch", 9, 4096).getStackForm(1L)); + 15154, "hatch.energytunnel3.tier.09", "UHV 4096A/t Laser Target Hatch", 9, 4096).getStackForm(1L)); eM_energyTunnel4_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15164, "hatch.energytunnel4.tier.09", "UHV 16384/t Laser Target Hatch", 9, 16384).getStackForm(1L)); + 15164, "hatch.energytunnel4.tier.09", "UHV 16384A/t Laser Target Hatch", 9, 16384).getStackForm(1L)); eM_energyTunnel5_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15174, "hatch.energytunnel5.tier.09", "UHV 65536/t Laser Target Hatch", 9, 65536).getStackForm(1L)); + 15174, "hatch.energytunnel5.tier.09", "UHV 65536A/t Laser Target Hatch", 9, 65536).getStackForm(1L)); eM_energyTunnel6_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15184, "hatch.energytunnel6.tier.09", "UHV 262144/t Laser Target Hatch", 9, 262144).getStackForm(1L)); + 15184, "hatch.energytunnel6.tier.09", "UHV 262144A/t Laser Target Hatch", 9, 262144).getStackForm(1L)); eM_energyTunnel7_UHV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15194, "hatch.energytunnel7.tier.09", "UHV 1048576/t Laser Target Hatch", 9, 1048576).getStackForm(1L)); + 15194, "hatch.energytunnel7.tier.09", "UHV 1048576A/t Laser Target Hatch", 9, 1048576).getStackForm(1L)); eM_energyTunnel1_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15135, "hatch.energytunnel1.tier.10", "UEV 256/t Laser Target Hatch", 10, 256).getStackForm(1L)); + 15135, "hatch.energytunnel1.tier.10", "UEV 256A/t Laser Target Hatch", 10, 256).getStackForm(1L)); eM_energyTunnel2_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15145, "hatch.energytunnel2.tier.10", "UEV 1024/t Laser Target Hatch", 10, 1024).getStackForm(1L)); + 15145, "hatch.energytunnel2.tier.10", "UEV 1024A/t Laser Target Hatch", 10, 1024).getStackForm(1L)); eM_energyTunnel3_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15155, "hatch.energytunnel3.tier.10", "UEV 4096/t Laser Target Hatch", 10, 4096).getStackForm(1L)); + 15155, "hatch.energytunnel3.tier.10", "UEV 4096A/t Laser Target Hatch", 10, 4096).getStackForm(1L)); eM_energyTunnel4_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15165, "hatch.energytunnel4.tier.10", "UEV 16384/t Laser Target Hatch", 10, 16384).getStackForm(1L)); + 15165, "hatch.energytunnel4.tier.10", "UEV 16384A/t Laser Target Hatch", 10, 16384).getStackForm(1L)); eM_energyTunnel5_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15175, "hatch.energytunnel5.tier.10", "UEV 65536/t Laser Target Hatch", 10, 65536).getStackForm(1L)); + 15175, "hatch.energytunnel5.tier.10", "UEV 65536A/t Laser Target Hatch", 10, 65536).getStackForm(1L)); eM_energyTunnel6_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15185, "hatch.energytunnel6.tier.10", "UEV 262144/t Laser Target Hatch", 10, 262144).getStackForm(1L)); + 15185, "hatch.energytunnel6.tier.10", "UEV 262144A/t Laser Target Hatch", 10, 262144).getStackForm(1L)); eM_energyTunnel7_UEV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15195, "hatch.energytunnel7.tier.10", "UEV 1048576/t Laser Target Hatch", 10, 1048576).getStackForm(1L)); + 15195, "hatch.energytunnel7.tier.10", "UEV 1048576A/t Laser Target Hatch", 10, 1048576).getStackForm(1L)); eM_energyTunnel1_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15136, "hatch.energytunnel1.tier.11", "UIV 256/t Laser Target Hatch", 11, 256).getStackForm(1L)); + 15136, "hatch.energytunnel1.tier.11", "UIV 256A/t Laser Target Hatch", 11, 256).getStackForm(1L)); eM_energyTunnel2_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15146, "hatch.energytunnel2.tier.11", "UIV 1024/t Laser Target Hatch", 11, 1024).getStackForm(1L)); + 15146, "hatch.energytunnel2.tier.11", "UIV 1024A/t Laser Target Hatch", 11, 1024).getStackForm(1L)); eM_energyTunnel3_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15156, "hatch.energytunnel3.tier.11", "UIV 4096/t Laser Target Hatch", 11, 4096).getStackForm(1L)); + 15156, "hatch.energytunnel3.tier.11", "UIV 4096A/t Laser Target Hatch", 11, 4096).getStackForm(1L)); eM_energyTunnel4_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15166, "hatch.energytunnel4.tier.11", "UIV 16384/t Laser Target Hatch", 11, 16384).getStackForm(1L)); + 15166, "hatch.energytunnel4.tier.11", "UIV 16384A/t Laser Target Hatch", 11, 16384).getStackForm(1L)); eM_energyTunnel5_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15176, "hatch.energytunnel5.tier.11", "UIV 65536/t Laser Target Hatch", 11, 65536).getStackForm(1L)); + 15176, "hatch.energytunnel5.tier.11", "UIV 65536A/t Laser Target Hatch", 11, 65536).getStackForm(1L)); eM_energyTunnel6_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15186, "hatch.energytunnel6.tier.11", "UIV 262144/t Laser Target Hatch", 11, 262144).getStackForm(1L)); + 15186, "hatch.energytunnel6.tier.11", "UIV 262144A/t Laser Target Hatch", 11, 262144).getStackForm(1L)); eM_energyTunnel7_UIV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15196, "hatch.energytunnel7.tier.11", "UIV 1048576/t Laser Target Hatch", 11, 1048576).getStackForm(1L)); + 15196, "hatch.energytunnel7.tier.11", "UIV 1048576A/t Laser Target Hatch", 11, 1048576).getStackForm(1L)); eM_energyTunnel1_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15137, "hatch.energytunnel1.tier.12", "UMV 256/t Laser Target Hatch", 12, 256).getStackForm(1L)); + 15137, "hatch.energytunnel1.tier.12", "UMV 256A/t Laser Target Hatch", 12, 256).getStackForm(1L)); eM_energyTunnel2_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15147, "hatch.energytunnel2.tier.12", "UMV 1024/t Laser Target Hatch", 12, 1024).getStackForm(1L)); + 15147, "hatch.energytunnel2.tier.12", "UMV 1024A/t Laser Target Hatch", 12, 1024).getStackForm(1L)); eM_energyTunnel3_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15157, "hatch.energytunnel3.tier.12", "UMV 4096/t Laser Target Hatch", 12, 4096).getStackForm(1L)); + 15157, "hatch.energytunnel3.tier.12", "UMV 4096A/t Laser Target Hatch", 12, 4096).getStackForm(1L)); eM_energyTunnel4_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15167, "hatch.energytunnel4.tier.12", "UMV 16384/t Laser Target Hatch", 12, 16384).getStackForm(1L)); + 15167, "hatch.energytunnel4.tier.12", "UMV 16384A/t Laser Target Hatch", 12, 16384).getStackForm(1L)); eM_energyTunnel5_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15177, "hatch.energytunnel5.tier.12", "UMV 65536/t Laser Target Hatch", 12, 65536).getStackForm(1L)); + 15177, "hatch.energytunnel5.tier.12", "UMV 65536A/t Laser Target Hatch", 12, 65536).getStackForm(1L)); eM_energyTunnel6_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15187, "hatch.energytunnel6.tier.12", "UMV 262144/t Laser Target Hatch", 12, 262144).getStackForm(1L)); + 15187, "hatch.energytunnel6.tier.12", "UMV 262144A/t Laser Target Hatch", 12, 262144).getStackForm(1L)); eM_energyTunnel7_UMV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15197, "hatch.energytunnel7.tier.12", "UMV 1048576/t Laser Target Hatch", 12, 1048576).getStackForm(1L)); + 15197, "hatch.energytunnel7.tier.12", "UMV 1048576A/t Laser Target Hatch", 12, 1048576).getStackForm(1L)); eM_energyTunnel1_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15138, "hatch.energytunnel1.tier.13", "UXV 256/t Laser Target Hatch", 13, 256).getStackForm(1L)); + 15138, "hatch.energytunnel1.tier.13", "UXV 256A/t Laser Target Hatch", 13, 256).getStackForm(1L)); eM_energyTunnel2_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15148, "hatch.energytunnel2.tier.13", "UXV 1024/t Laser Target Hatch", 13, 1024).getStackForm(1L)); + 15148, "hatch.energytunnel2.tier.13", "UXV 1024A/t Laser Target Hatch", 13, 1024).getStackForm(1L)); eM_energyTunnel3_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15158, "hatch.energytunnel3.tier.13", "UXV 4096/t Laser Target Hatch", 13, 4096).getStackForm(1L)); + 15158, "hatch.energytunnel3.tier.13", "UXV 4096A/t Laser Target Hatch", 13, 4096).getStackForm(1L)); eM_energyTunnel4_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15168, "hatch.energytunnel4.tier.13", "UXV 16384/t Laser Target Hatch", 13, 16384).getStackForm(1L)); + 15168, "hatch.energytunnel4.tier.13", "UXV 16384A/t Laser Target Hatch", 13, 16384).getStackForm(1L)); eM_energyTunnel5_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15178, "hatch.energytunnel5.tier.13", "UXV 65536/t Laser Target Hatch", 13, 65536).getStackForm(1L)); + 15178, "hatch.energytunnel5.tier.13", "UXV 65536A/t Laser Target Hatch", 13, 65536).getStackForm(1L)); eM_energyTunnel6_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15188, "hatch.energytunnel6.tier.13", "UXV 262144/t Laser Target Hatch", 13, 262144).getStackForm(1L)); + 15188, "hatch.energytunnel6.tier.13", "UXV 262144A/t Laser Target Hatch", 13, 262144).getStackForm(1L)); eM_energyTunnel7_UXV.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15198, "hatch.energytunnel7.tier.13", "UXV 1048576/t Laser Target Hatch", 13, 1048576).getStackForm(1L)); + 15198, "hatch.energytunnel7.tier.13", "UXV 1048576A/t Laser Target Hatch", 13, 1048576).getStackForm(1L)); eM_energyTunnel9001.set(new GT_MetaTileEntity_Hatch_EnergyTunnel( - 15199, "hatch.energytunnel.tier.14", "Legendary Laser Target Hatch", 14, (int) V[14]).getStackForm(1L)); + 15199, "hatch.energytunnel.tier.14", "Legendary Laser Target Hatch", 13, (int) V[13]).getStackForm(1L)); // =================================================================================================== // Multi AMP Power OUTPUTS @@ -406,141 +408,141 @@ public class MachineLoader implements Runnable { // =================================================================================================== eM_dynamoTunnel1_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15230, "hatch.dynamotunnel1.tier.05", "IV 256/t Laser Source Hatch", 5, 256).getStackForm(1L)); + 15230, "hatch.dynamotunnel1.tier.05", "IV 256A/t Laser Source Hatch", 5, 256).getStackForm(1L)); eM_dynamoTunnel2_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15240, "hatch.dynamotunnel2.tier.05", "IV 1024/t Laser Source Hatch", 5, 1024).getStackForm(1L)); + 15240, "hatch.dynamotunnel2.tier.05", "IV 1024A/t Laser Source Hatch", 5, 1024).getStackForm(1L)); eM_dynamoTunnel3_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15250, "hatch.dynamotunnel3.tier.05", "IV 4096/t Laser Source Hatch", 5, 4096).getStackForm(1L)); + 15250, "hatch.dynamotunnel3.tier.05", "IV 4096A/t Laser Source Hatch", 5, 4096).getStackForm(1L)); eM_dynamoTunnel4_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15260, "hatch.dynamotunnel4.tier.05", "IV 16384/t Laser Source Hatch", 5, 16384).getStackForm(1L)); + 15260, "hatch.dynamotunnel4.tier.05", "IV 16384A/t Laser Source Hatch", 5, 16384).getStackForm(1L)); eM_dynamoTunnel5_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15270, "hatch.dynamotunnel5.tier.05", "IV 65536/t Laser Source Hatch", 5, 65536).getStackForm(1L)); + 15270, "hatch.dynamotunnel5.tier.05", "IV 65536A/t Laser Source Hatch", 5, 65536).getStackForm(1L)); eM_dynamoTunnel6_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15280, "hatch.dynamotunnel6.tier.05", "IV 262144/t Laser Source Hatch", 5, 262144).getStackForm(1L)); + 15280, "hatch.dynamotunnel6.tier.05", "IV 262144A/t Laser Source Hatch", 5, 262144).getStackForm(1L)); eM_dynamoTunnel7_IV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15290, "hatch.dynamotunnel7.tier.05", "IV 1048576/t Laser Source Hatch", 5, 1048576).getStackForm(1L)); + 15290, "hatch.dynamotunnel7.tier.05", "IV 1048576A/t Laser Source Hatch", 5, 1048576).getStackForm(1L)); eM_dynamoTunnel1_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15231, "hatch.dynamotunnel1.tier.06", "LuV 256/t Laser Source Hatch", 6, 256).getStackForm(1L)); + 15231, "hatch.dynamotunnel1.tier.06", "LuV 256A/t Laser Source Hatch", 6, 256).getStackForm(1L)); eM_dynamoTunnel2_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15241, "hatch.dynamotunnel2.tier.06", "LuV 1024/t Laser Source Hatch", 6, 1024).getStackForm(1L)); + 15241, "hatch.dynamotunnel2.tier.06", "LuV 1024A/t Laser Source Hatch", 6, 1024).getStackForm(1L)); eM_dynamoTunnel3_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15251, "hatch.dynamotunnel3.tier.06", "LuV 4096/t Laser Source Hatch", 6, 4096).getStackForm(1L)); + 15251, "hatch.dynamotunnel3.tier.06", "LuV 4096A/t Laser Source Hatch", 6, 4096).getStackForm(1L)); eM_dynamoTunnel4_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15261, "hatch.dynamotunnel4.tier.06", "LuV 16384/t Laser Source Hatch", 6, 16384).getStackForm(1L)); + 15261, "hatch.dynamotunnel4.tier.06", "LuV 16384A/t Laser Source Hatch", 6, 16384).getStackForm(1L)); eM_dynamoTunnel5_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15271, "hatch.dynamotunnel5.tier.06", "LuV 65536/t Laser Source Hatch", 6, 65536).getStackForm(1L)); + 15271, "hatch.dynamotunnel5.tier.06", "LuV 65536A/t Laser Source Hatch", 6, 65536).getStackForm(1L)); eM_dynamoTunnel6_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15281, "hatch.dynamotunnel6.tier.06", "LuV 262144/t Laser Source Hatch", 6, 262144).getStackForm(1L)); + 15281, "hatch.dynamotunnel6.tier.06", "LuV 262144A/t Laser Source Hatch", 6, 262144).getStackForm(1L)); eM_dynamoTunnel7_LuV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15291, "hatch.dynamotunnel7.tier.06", "LuV 1048576/t Laser Source Hatch", 6, 1048576).getStackForm(1L)); + 15291, "hatch.dynamotunnel7.tier.06", "LuV 1048576A/t Laser Source Hatch", 6, 1048576).getStackForm(1L)); eM_dynamoTunnel1_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15232, "hatch.dynamotunnel1.tier.07", "ZPM 256/t Laser Source Hatch", 7, 256).getStackForm(1L)); + 15232, "hatch.dynamotunnel1.tier.07", "ZPM 256A/t Laser Source Hatch", 7, 256).getStackForm(1L)); eM_dynamoTunnel2_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15242, "hatch.dynamotunnel2.tier.07", "ZPM 1024/t Laser Source Hatch", 7, 1024).getStackForm(1L)); + 15242, "hatch.dynamotunnel2.tier.07", "ZPM 1024A/t Laser Source Hatch", 7, 1024).getStackForm(1L)); eM_dynamoTunnel3_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15252, "hatch.dynamotunnel3.tier.07", "ZPM 4096/t Laser Source Hatch", 7, 4096).getStackForm(1L)); + 15252, "hatch.dynamotunnel3.tier.07", "ZPM 4096A/t Laser Source Hatch", 7, 4096).getStackForm(1L)); eM_dynamoTunnel4_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15262, "hatch.dynamotunnel4.tier.07", "ZPM 16384/t Laser Source Hatch", 7, 16384).getStackForm(1L)); + 15262, "hatch.dynamotunnel4.tier.07", "ZPM 16384A/t Laser Source Hatch", 7, 16384).getStackForm(1L)); eM_dynamoTunnel5_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15272, "hatch.dynamotunnel5.tier.07", "ZPM 65536/t Laser Source Hatch", 7, 65536).getStackForm(1L)); + 15272, "hatch.dynamotunnel5.tier.07", "ZPM 65536A/t Laser Source Hatch", 7, 65536).getStackForm(1L)); eM_dynamoTunnel6_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15282, "hatch.dynamotunnel6.tier.07", "ZPM 262144/t Laser Source Hatch", 7, 262144).getStackForm(1L)); + 15282, "hatch.dynamotunnel6.tier.07", "ZPM 262144A/t Laser Source Hatch", 7, 262144).getStackForm(1L)); eM_dynamoTunnel7_ZPM.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15292, "hatch.dynamotunnel7.tier.07", "ZPM 1048576/t Laser Source Hatch", 7, 1048576).getStackForm(1L)); + 15292, "hatch.dynamotunnel7.tier.07", "ZPM 1048576A/t Laser Source Hatch", 7, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15233, "hatch.dynamotunnel1.tier.08", "UV 256/t Laser Source Hatch", 8, 256).getStackForm(1L)); + 15233, "hatch.dynamotunnel1.tier.08", "UV 256A/t Laser Source Hatch", 8, 256).getStackForm(1L)); eM_dynamoTunnel2_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15243, "hatch.dynamotunnel2.tier.08", "UV 1024/t Laser Source Hatch", 8, 1024).getStackForm(1L)); + 15243, "hatch.dynamotunnel2.tier.08", "UV 1024A/t Laser Source Hatch", 8, 1024).getStackForm(1L)); eM_dynamoTunnel3_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15253, "hatch.dynamotunnel3.tier.08", "UV 4096/t Laser Source Hatch", 8, 4096).getStackForm(1L)); + 15253, "hatch.dynamotunnel3.tier.08", "UV 4096A/t Laser Source Hatch", 8, 4096).getStackForm(1L)); eM_dynamoTunnel4_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15263, "hatch.dynamotunnel4.tier.08", "UV 16384/t Laser Source Hatch", 8, 16384).getStackForm(1L)); + 15263, "hatch.dynamotunnel4.tier.08", "UV 16384A/t Laser Source Hatch", 8, 16384).getStackForm(1L)); eM_dynamoTunnel5_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15273, "hatch.dynamotunnel5.tier.08", "UV 65536/t Laser Source Hatch", 8, 65536).getStackForm(1L)); + 15273, "hatch.dynamotunnel5.tier.08", "UV 65536A/t Laser Source Hatch", 8, 65536).getStackForm(1L)); eM_dynamoTunnel6_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15283, "hatch.dynamotunnel6.tier.08", "UV 262144/t Laser Source Hatch", 8, 262144).getStackForm(1L)); + 15283, "hatch.dynamotunnel6.tier.08", "UV 262144A/t Laser Source Hatch", 8, 262144).getStackForm(1L)); eM_dynamoTunnel7_UV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15293, "hatch.dynamotunnel7.tier.08", "UV 1048576/t Laser Source Hatch", 8, 1048576).getStackForm(1L)); + 15293, "hatch.dynamotunnel7.tier.08", "UV 1048576A/t Laser Source Hatch", 8, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15234, "hatch.dynamotunnel1.tier.09", "UHV 256/t Laser Source Hatch", 9, 256).getStackForm(1L)); + 15234, "hatch.dynamotunnel1.tier.09", "UHV 256A/t Laser Source Hatch", 9, 256).getStackForm(1L)); eM_dynamoTunnel2_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15244, "hatch.dynamotunnel2.tier.09", "UHV 1024/t Laser Source Hatch", 9, 1024).getStackForm(1L)); + 15244, "hatch.dynamotunnel2.tier.09", "UHV 1024A/t Laser Source Hatch", 9, 1024).getStackForm(1L)); eM_dynamoTunnel3_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15254, "hatch.dynamotunnel3.tier.09", "UHV 4096/t Laser Source Hatch", 9, 4096).getStackForm(1L)); + 15254, "hatch.dynamotunnel3.tier.09", "UHV 4096A/t Laser Source Hatch", 9, 4096).getStackForm(1L)); eM_dynamoTunnel4_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15264, "hatch.dynamotunnel4.tier.09", "UHV 16384/t Laser Source Hatch", 9, 16384).getStackForm(1L)); + 15264, "hatch.dynamotunnel4.tier.09", "UHV 16384A/t Laser Source Hatch", 9, 16384).getStackForm(1L)); eM_dynamoTunnel5_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15274, "hatch.dynamotunnel5.tier.09", "UHV 65536/t Laser Source Hatch", 9, 65536).getStackForm(1L)); + 15274, "hatch.dynamotunnel5.tier.09", "UHV 65536A/t Laser Source Hatch", 9, 65536).getStackForm(1L)); eM_dynamoTunnel6_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15284, "hatch.dynamotunnel6.tier.09", "UHV 262144/t Laser Source Hatch", 9, 262144).getStackForm(1L)); + 15284, "hatch.dynamotunnel6.tier.09", "UHV 262144A/t Laser Source Hatch", 9, 262144).getStackForm(1L)); eM_dynamoTunnel7_UHV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15294, "hatch.dynamotunnel7.tier.09", "UHV 1048576/t Laser Source Hatch", 9, 1048576).getStackForm(1L)); + 15294, "hatch.dynamotunnel7.tier.09", "UHV 1048576A/t Laser Source Hatch", 9, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15235, "hatch.dynamotunnel1.tier.10", "UEV 256/t Laser Source Hatch", 10, 256).getStackForm(1L)); + 15235, "hatch.dynamotunnel1.tier.10", "UEV 256A/t Laser Source Hatch", 10, 256).getStackForm(1L)); eM_dynamoTunnel2_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15245, "hatch.dynamotunnel2.tier.10", "UEV 1024/t Laser Source Hatch", 10, 1024).getStackForm(1L)); + 15245, "hatch.dynamotunnel2.tier.10", "UEV 1024A/t Laser Source Hatch", 10, 1024).getStackForm(1L)); eM_dynamoTunnel3_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15255, "hatch.dynamotunnel3.tier.10", "UEV 4096/t Laser Source Hatch", 10, 4096).getStackForm(1L)); + 15255, "hatch.dynamotunnel3.tier.10", "UEV 4096A/t Laser Source Hatch", 10, 4096).getStackForm(1L)); eM_dynamoTunnel4_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15265, "hatch.dynamotunnel4.tier.10", "UEV 16384/t Laser Source Hatch", 10, 16384).getStackForm(1L)); + 15265, "hatch.dynamotunnel4.tier.10", "UEV 16384A/t Laser Source Hatch", 10, 16384).getStackForm(1L)); eM_dynamoTunnel5_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15275, "hatch.dynamotunnel5.tier.10", "UEV 65536/t Laser Source Hatch", 10, 65536).getStackForm(1L)); + 15275, "hatch.dynamotunnel5.tier.10", "UEV 65536A/t Laser Source Hatch", 10, 65536).getStackForm(1L)); eM_dynamoTunnel6_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15285, "hatch.dynamotunnel6.tier.10", "UEV 262144/t Laser Source Hatch", 10, 262144).getStackForm(1L)); + 15285, "hatch.dynamotunnel6.tier.10", "UEV 262144A/t Laser Source Hatch", 10, 262144).getStackForm(1L)); eM_dynamoTunnel7_UEV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15295, "hatch.dynamotunnel7.tier.10", "UEV 1048576/t Laser Source Hatch", 10, 1048576).getStackForm(1L)); + 15295, "hatch.dynamotunnel7.tier.10", "UEV 1048576A/t Laser Source Hatch", 10, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15236, "hatch.dynamotunnel1.tier.11", "UIV 256/t Laser Source Hatch", 11, 256).getStackForm(1L)); + 15236, "hatch.dynamotunnel1.tier.11", "UIV 256A/t Laser Source Hatch", 11, 256).getStackForm(1L)); eM_dynamoTunnel2_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15246, "hatch.dynamotunnel2.tier.11", "UIV 1024/t Laser Source Hatch", 11, 1024).getStackForm(1L)); + 15246, "hatch.dynamotunnel2.tier.11", "UIV 1024A/t Laser Source Hatch", 11, 1024).getStackForm(1L)); eM_dynamoTunnel3_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15256, "hatch.dynamotunnel3.tier.11", "UIV 4096/t Laser Source Hatch", 11, 4096).getStackForm(1L)); + 15256, "hatch.dynamotunnel3.tier.11", "UIV 4096A/t Laser Source Hatch", 11, 4096).getStackForm(1L)); eM_dynamoTunnel4_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15266, "hatch.dynamotunnel4.tier.11", "UIV 16384/t Laser Source Hatch", 11, 16384).getStackForm(1L)); + 15266, "hatch.dynamotunnel4.tier.11", "UIV 16384A/t Laser Source Hatch", 11, 16384).getStackForm(1L)); eM_dynamoTunnel5_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15276, "hatch.dynamotunnel5.tier.11", "UIV 65536/t Laser Source Hatch", 11, 65536).getStackForm(1L)); + 15276, "hatch.dynamotunnel5.tier.11", "UIV 65536A/t Laser Source Hatch", 11, 65536).getStackForm(1L)); eM_dynamoTunnel6_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15286, "hatch.dynamotunnel6.tier.11", "UIV 262144/t Laser Source Hatch", 11, 262144).getStackForm(1L)); + 15286, "hatch.dynamotunnel6.tier.11", "UIV 262144A/t Laser Source Hatch", 11, 262144).getStackForm(1L)); eM_dynamoTunnel7_UIV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15296, "hatch.dynamotunnel7.tier.11", "UIV 1048576/t Laser Source Hatch", 11, 1048576).getStackForm(1L)); + 15296, "hatch.dynamotunnel7.tier.11", "UIV 1048576A/t Laser Source Hatch", 11, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15237, "hatch.dynamotunnel1.tier.12", "UMV 256/t Laser Source Hatch", 12, 256).getStackForm(1L)); + 15237, "hatch.dynamotunnel1.tier.12", "UMV 256A/t Laser Source Hatch", 12, 256).getStackForm(1L)); eM_dynamoTunnel2_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15247, "hatch.dynamotunnel2.tier.12", "UMV 1024/t Laser Source Hatch", 12, 1024).getStackForm(1L)); + 15247, "hatch.dynamotunnel2.tier.12", "UMV 1024A/t Laser Source Hatch", 12, 1024).getStackForm(1L)); eM_dynamoTunnel3_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15257, "hatch.dynamotunnel3.tier.12", "UMV 4096/t Laser Source Hatch", 12, 4096).getStackForm(1L)); + 15257, "hatch.dynamotunnel3.tier.12", "UMV 4096A/t Laser Source Hatch", 12, 4096).getStackForm(1L)); eM_dynamoTunnel4_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15267, "hatch.dynamotunnel4.tier.12", "UMV 16384/t Laser Source Hatch", 12, 16384).getStackForm(1L)); + 15267, "hatch.dynamotunnel4.tier.12", "UMV 16384A/t Laser Source Hatch", 12, 16384).getStackForm(1L)); eM_dynamoTunnel5_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15277, "hatch.dynamotunnel5.tier.12", "UMV 65536/t Laser Source Hatch", 12, 65536).getStackForm(1L)); + 15277, "hatch.dynamotunnel5.tier.12", "UMV 65536A/t Laser Source Hatch", 12, 65536).getStackForm(1L)); eM_dynamoTunnel6_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15287, "hatch.dynamotunnel6.tier.12", "UMV 262144/t Laser Source Hatch", 12, 262144).getStackForm(1L)); + 15287, "hatch.dynamotunnel6.tier.12", "UMV 262144A/t Laser Source Hatch", 12, 262144).getStackForm(1L)); eM_dynamoTunnel7_UMV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15297, "hatch.dynamotunnel7.tier.12", "UMV 1048576/t Laser Source Hatch", 12, 1048576).getStackForm(1L)); + 15297, "hatch.dynamotunnel7.tier.12", "UMV 1048576A/t Laser Source Hatch", 12, 1048576).getStackForm(1L)); eM_dynamoTunnel1_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15238, "hatch.dynamotunnel1.tier.13", "UXV 256/t Laser Source Hatch", 13, 256).getStackForm(1L)); + 15238, "hatch.dynamotunnel1.tier.13", "UXV 256A/t Laser Source Hatch", 13, 256).getStackForm(1L)); eM_dynamoTunnel2_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15248, "hatch.dynamotunnel2.tier.13", "UXV 1024/t Laser Source Hatch", 13, 1024).getStackForm(1L)); + 15248, "hatch.dynamotunnel2.tier.13", "UXV 1024A/t Laser Source Hatch", 13, 1024).getStackForm(1L)); eM_dynamoTunnel3_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15258, "hatch.dynamotunnel3.tier.13", "UXV 4096/t Laser Source Hatch", 13, 4096).getStackForm(1L)); + 15258, "hatch.dynamotunnel3.tier.13", "UXV 4096A/t Laser Source Hatch", 13, 4096).getStackForm(1L)); eM_dynamoTunnel4_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15268, "hatch.dynamotunnel4.tier.13", "UXV 16384/t Laser Source Hatch", 13, 16384).getStackForm(1L)); + 15268, "hatch.dynamotunnel4.tier.13", "UXV 16384A/t Laser Source Hatch", 13, 16384).getStackForm(1L)); eM_dynamoTunnel5_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15278, "hatch.dynamotunnel5.tier.13", "UXV 65536/t Laser Source Hatch", 13, 65536).getStackForm(1L)); + 15278, "hatch.dynamotunnel5.tier.13", "UXV 65536A/t Laser Source Hatch", 13, 65536).getStackForm(1L)); eM_dynamoTunnel6_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15288, "hatch.dynamotunnel6.tier.13", "UXV 262144/t Laser Source Hatch", 13, 262144).getStackForm(1L)); + 15288, "hatch.dynamotunnel6.tier.13", "UXV 262144A/t Laser Source Hatch", 13, 262144).getStackForm(1L)); eM_dynamoTunnel7_UXV.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15298, "hatch.dynamotunnel7.tier.13", "UXV 1048576/t Laser Source Hatch", 13, 1048576).getStackForm(1L)); + 15298, "hatch.dynamotunnel7.tier.13", "UXV 1048576A/t Laser Source Hatch", 13, 1048576).getStackForm(1L)); eM_dynamoTunnel9001.set(new GT_MetaTileEntity_Hatch_DynamoTunnel( - 15299, "hatch.dynamotunnel.tier.14", "Legendary Laser Source Hatch", 14, (int) V[14]).getStackForm(1L)); + 15299, "hatch.dynamotunnel.tier.14", "Legendary Laser Source Hatch", 13, (int) V[13]).getStackForm(1L)); // =================================================================================================== // MULTIBLOCKS @@ -585,9 +587,9 @@ public class MachineLoader implements Runnable { // Hatches // =================================================================================================== - Parametrizer_Hatch.set(new GT_MetaTileEntity_Hatch_Param(15420, "hatch.param.tier.05", "Parametrizer", 5).getStackForm(1L)); + Parametrizer_Hatch.set(new GT_MetaTileEntity_Hatch_Param(15420, "hatch.param.tier.05", "Parametrizer", 5).getStackForm(1L));//TODO refactor aName to hatch.param.tier.04 and aTier to 4, check recipe for NH ParametrizerX_Hatch.set(new GT_MetaTileEntity_Hatch_Param(15421, "hatch.param.tier.07", "Parametrizer X", 7).getStackForm(1L)); - ParametrizerTXT_Hatch.set(new GT_MetaTileEntity_Hatch_ParamText(15422, "hatch.param.tier.10", "Parametrizer tXt", 10).getStackForm(1L)); + ParametrizerTXT_Hatch.set(new GT_MetaTileEntity_Hatch_ParamText(15422, "hatch.param.tier.10", "Parametrizer tXt", 10).getStackForm(1L));//TODO check recipe for NH 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)); @@ -597,10 +599,10 @@ public class MachineLoader implements Runnable { dataInAss_Hatch.set(new GT_MetaTileEntity_Hatch_InputDataItems(15442, "hatch.datainass.tier.07", "Assembly line Slave Connector", 7).getStackForm(1L)); dataOutAss_Hatch.set(new GT_MetaTileEntity_Hatch_OutputDataItems(15443, "hatch.dataoutass.tier.07", "Data Bank Master Connector", 7).getStackForm(1L)); - rack_Hatch.set(new GT_MetaTileEntity_Hatch_Rack(15450, "hatch.rack.tier.08", "Computer Rack", 8, "4 Slot Rack").getStackForm(1L)); - holder_Hatch.set(new GT_MetaTileEntity_Hatch_Holder(15451, "hatch.holder.tier.09", "Object Holder", 8, "For Research Station").getStackForm(1L)); + rack_Hatch.set(new GT_MetaTileEntity_Hatch_Rack(15450, "hatch.rack.tier.08", "Computer Rack", 8).getStackForm(1L)); + holder_Hatch.set(new GT_MetaTileEntity_Hatch_Holder(15451, "hatch.holder.tier.09", "Object Holder", 8).getStackForm(1L)); - capacitor_Hatch.set(new GT_MetaTileEntity_Hatch_Capacitor(15452, "hatch.capacitor.tier.03", "Capacitor Hatch", 3, "For Tesla Tower").getStackForm(1L)); + capacitor_Hatch.set(new GT_MetaTileEntity_Hatch_Capacitor(15452, "hatch.capacitor.tier.03", "Capacitor Hatch", 3).getStackForm(1L)); // =================================================================================================== // Pipes @@ -664,7 +666,7 @@ public class MachineLoader implements Runnable { // =================================================================================================== Machine_DebugPollutor.set(new GT_MetaTileEntity_DebugPollutor(15495, "debug.tt.pollutor", "Debug Pollution Generator", 15).getStackForm(1)); hatch_CreativeData.set(new GT_MetaTileEntity_Hatch_CreativeData(15496, "debug.tt.data", "Debug Data Hatch", 15).getStackForm(1)); - hatch_CreativeMaintenance.set(new GT_MetaTileEntity_Hatch_CreativeMaintenance(15497, "debug.tt.maintenance", "Debug Maintenance Hatch", 15).getStackForm(1L)); + hatch_CreativeMaintenance.set(new GT_MetaTileEntity_Hatch_CreativeMaintenance(15497, "debug.tt.maintenance", "Auto-Taping Maintenance Hatch", 15).getStackForm(1L)); Machine_DebugGenny.set(new GT_MetaTileEntity_DebugPowerGenerator(15498, "debug.tt.genny", "Debug Power Generator", 15).getStackForm(1L)); Machine_DebugWriter.set(new GT_MetaTileEntity_DebugStructureWriter(15499, "debug.tt.writer", "Debug Structure Writer", 15).getStackForm(1L)); UnusedStuff.set(new ItemStack(Blocks.air)); diff --git a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java index 4596e8a2c8..d144d74618 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java @@ -24,17 +24,15 @@ public class ThingsLoader implements Runnable { if(Textures.BlockIcons.casingTexturePages[tectechTexturePage1]==null) { Textures.BlockIcons.casingTexturePages[tectechTexturePage1] = new ITexture[128]; } + TecTech.LOGGER.info("Added texture page if was null"); if(!Loader.isModLoaded(Reference.DREAMCRAFT)){ - TecTech.LOGGER.info("Adding basic casings"); TT_Container_Casings.sBlockCasingsNH = new GT_Block_CasingsNH(); + TecTech.LOGGER.info("Adding basic casings"); } - TecTech.LOGGER.info("Added texture page if was null"); TT_Container_Casings.sBlockCasingsTT = new GT_Block_CasingsTT(); TecTech.LOGGER.info("Elemental Casing registered"); TT_Container_Casings.sBlockCasingsBA0 = new GT_Block_CasingsBA0(); TecTech.LOGGER.info("Nikolai's Casing registered"); - TT_Container_Casings.sHintCasingsTT = new GT_Block_HintTT(); - TecTech.LOGGER.info("Hint Blocks registered"); QuantumGlassBlock.run(); TecTech.LOGGER.info("Quantum Glass registered"); @@ -52,14 +50,14 @@ public class ThingsLoader implements Runnable { ReactorSimBlock.run(); TecTech.LOGGER.info("Reactor Simulator registered"); - ConstructableTriggerItem.run(); - FrontRotationTriggerItem.run(); ParametrizerMemoryCard.run(); ElementalDefinitionScanStorage_EM.run(); EuMeterGT.run(); TeslaStaff.run(); TeslaCoilCover.run(); TeslaCoilCapacitor.run(); + EnderFluidLinkCover.run(); + PowerPassUpgradeCover.run(); TecTech.LOGGER.info("Useful Items registered"); TeslaCoilComponent.run(); diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java index ad80c40be2..2ca1349489 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java +++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java @@ -1,14 +1,14 @@ package com.github.technus.tectech.mechanics.anomaly; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; import com.github.technus.tectech.loader.MainLoader; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.data.ChunkDataHandler; import com.github.technus.tectech.mechanics.data.ChunkDataMessage; import com.github.technus.tectech.mechanics.data.IChunkMetaDataHandler; import com.github.technus.tectech.mechanics.data.PlayerDataMessage; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.gameevent.TickEvent; import gregtech.api.GregTech_API; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -20,6 +20,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; @@ -28,19 +29,21 @@ import net.minecraftforge.event.world.ChunkEvent; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; public class AnomalyHandler implements IChunkMetaDataHandler { - public static final double SWAP_THRESHOLD = dAtomDefinition.getSomethingHeavy().getMass() * 10000D; - public static final int COUNT_DIV=32; - public static final double PER_PARTICLE=SWAP_THRESHOLD/COUNT_DIV; - public static final String INTENSITY = "intensity"; - public static final String SPACE_CANCER="space_cancer"; - public static final String SPACE_CHARGE ="space_charge"; - public static final double GRAVITY_EFFECTIVENESS =1; - public static final String SPACE_MASS ="space_mass"; - public static final int MEAN_DELAY =50; - private static final float CHARGE_EFFECTIVENESS = 10; - private static final float CHARGE_EXPLOSIVENESS = 5; + private static final double SWAP_THRESHOLD = EMAtomDefinition.getSomethingHeavy().getMass() * 1000D * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED;//can be const as it is computed later... + private static final int COUNT_DIV=32; + private static final double PER_PARTICLE=SWAP_THRESHOLD/COUNT_DIV; + private static final String INTENSITY = "intensity",SPACE_CANCER="space_cancer", SPACE_CHARGE ="space_charge", SPACE_MASS="space_mass"; + private static final int MEAN_DELAY =50; + private static final double CANCER_EFFECTIVENESS = 1/ EM_COUNT_PER_MATERIAL_AMOUNT; + private static final double GRAVITY_EFFECTIVENESS =1; + private static final double CHARGE_EFFECTIVENESS = 10/ EM_COUNT_PER_MATERIAL_AMOUNT; + private static final double CHARGE_EXPLOSIVENESS = 5/ EM_COUNT_PER_MATERIAL_AMOUNT; private boolean fixMe=false; private final List<EntityPlayer> playersWithCharge = new ArrayList<>(); @@ -66,8 +69,9 @@ public class AnomalyHandler implements IChunkMetaDataHandler { public void tickWorld(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.WorldTickEvent aEvent) { if (TecTech.RANDOM.nextInt(MEAN_DELAY) == 0) { int dim = aEvent.world.provider.dimensionId; - data.get(dim).forEach((chunkCoordIntPair, compound) -> { - if (compound.getDouble(INTENSITY) >= SWAP_THRESHOLD) { + ChunkDataHandler.ChunkHashMap chunkHashMap = data.get(dim); + chunkHashMap.forEach((chunkCoordIntPair, compound) -> { + if (compound.getDouble(INTENSITY) > SWAP_THRESHOLD) { Chunk chunk = aEvent.world.getChunkFromChunkCoords(chunkCoordIntPair.chunkXPos, chunkCoordIntPair.chunkZPos); if (chunk.isChunkLoaded) { worldDataArrayList.add(chunk); @@ -76,21 +80,25 @@ public class AnomalyHandler implements IChunkMetaDataHandler { }); if (worldDataArrayList.size() >= 2) { Chunk a = worldDataArrayList.remove(TecTech.RANDOM.nextInt(worldDataArrayList.size())); - Chunk b = worldDataArrayList.remove(TecTech.RANDOM.nextInt(worldDataArrayList.size())); - double avg = .5 * (data.get(dim).get(a.getChunkCoordIntPair()).getDouble(INTENSITY) + - data.get(dim).get(b.getChunkCoordIntPair()).getDouble(INTENSITY)); - data.get(dim).get(a.getChunkCoordIntPair()).setDouble(INTENSITY, Math.min(SWAP_THRESHOLD, avg * (TecTech.RANDOM.nextFloat() + .5F) * 0.5F)); - data.get(dim).get(b.getChunkCoordIntPair()).setDouble(INTENSITY, Math.min(SWAP_THRESHOLD, avg * (TecTech.RANDOM.nextFloat() + .5F) * 0.5F)); - data.get(dim).markForTransmissionToClient(a.getChunkCoordIntPair()); - data.get(dim).markForTransmissionToClient(b.getChunkCoordIntPair()); - swapSomething(a, b, (float) Math.min(Math.log10(avg), 20)); + Chunk b = worldDataArrayList.get(TecTech.RANDOM.nextInt(worldDataArrayList.size())); + ChunkCoordIntPair aCoords = a.getChunkCoordIntPair(); + ChunkCoordIntPair bCoords = b.getChunkCoordIntPair(); + + double newValue = (chunkHashMap.get(aCoords).getDouble(INTENSITY) + + chunkHashMap.get(bCoords).getDouble(INTENSITY))/2-SWAP_THRESHOLD/8; + float split=TecTech.RANDOM.nextFloat(); + + chunkHashMap.get(aCoords).setDouble(INTENSITY, newValue * split); + chunkHashMap.get(bCoords).setDouble(INTENSITY, newValue * (1-split)); + chunkHashMap.markForTransmissionToClient(aCoords); + chunkHashMap.markForTransmissionToClient(bCoords); + swapSomething(a, b, newValue); } worldDataArrayList.clear(); } for (Object o : aEvent.world.playerEntities) { if (o instanceof EntityPlayer && !((EntityPlayer) o).capabilities.isCreativeMode) { - float charge = TecTech.playerPersistence.getDataOrSetToNewTag((EntityPlayer) o).getFloat(SPACE_CHARGE); - if (charge != 0) { + if (getCharge((EntityPlayer) o) != 0) { playersWithCharge.add((EntityPlayer) o); } } @@ -98,25 +106,25 @@ public class AnomalyHandler implements IChunkMetaDataHandler { if (playersWithCharge.size() > 0) { outer: for (EntityPlayer other : playersWithCharge) { - float chargeOther = TecTech.playerPersistence.getDataOrSetToNewTag(other).getFloat(SPACE_CHARGE); + double fieldOther = getCharge(other); for (EntityPlayer player : playersWithCharge) { if (other == player) { continue outer; } - float charge = TecTech.playerPersistence.getDataOrSetToNewTag(player).getFloat(SPACE_CHARGE); - float difference = Math.abs(charge - chargeOther); - if (difference != 0) { + double field = getCharge(player); + double absDifference = Math.abs(field - fieldOther); + if (absDifference != 0) { if (player.getDistanceSqToEntity(other) < 1) { - float avg = (chargeOther + charge) / 2; - addAnomaly(other.worldObj.provider.dimensionId, new ChunkCoordIntPair(other.chunkCoordX, other.chunkCoordZ), Math.min(SWAP_THRESHOLD, PER_PARTICLE * difference)); - other.worldObj.createExplosion(other, other.posX, other.posY, other.posZ, Math.min(CHARGE_EXPLOSIVENESS * difference, 25), true); - player.worldObj.createExplosion(player, player.posX, player.posY, player.posZ, Math.min(CHARGE_EXPLOSIVENESS * difference, 25), true); - TecTech.playerPersistence.getDataOrSetToNewTag(player).setFloat(SPACE_CHARGE, avg); - TecTech.playerPersistence.getDataOrSetToNewTag(other).setFloat(SPACE_CHARGE, avg); - TecTech.playerPersistence.saveData(player); - TecTech.playerPersistence.saveData(other); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(other)); + double avg = (fieldOther + field) / 2; + //addAnomaly(other.worldObj.provider.dimensionId, new ChunkCoordIntPair(other.chunkCoordX, other.chunkCoordZ), Math.min(SWAP_THRESHOLD, PER_PARTICLE * absDifference)); + if(TecTech.configTecTech.BOOM_ENABLE){ + other.worldObj.createExplosion(other, other.posX, other.posY, other.posZ,(float) Math.min(CHARGE_EXPLOSIVENESS * absDifference, 25), true); + player.worldObj.createExplosion(player, player.posX, player.posY, player.posZ, (float) Math.min(CHARGE_EXPLOSIVENESS * absDifference, 25), true); + } + GT_Utility.sendSoundToPlayers(other.worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1, (int)other.posX, (int)other.posY, (int)other.posZ); + GT_Utility.sendSoundToPlayers(player.worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1, (int)player.posX, (int)player.posY, (int)player.posZ); + setCharge(player,avg); + setCharge(other,avg); } } } @@ -125,8 +133,9 @@ public class AnomalyHandler implements IChunkMetaDataHandler { } } - private void swapSomething(Chunk a,Chunk b,float power) { - for (int i = 0; i < 64; i++) { + private void swapSomething(Chunk a,Chunk b,double mass) { + float explosionPower=(float) Math.log(mass/ EM_COUNT_PER_MATERIAL_AMOUNT); + for (int i = 0; i < Math.min((int)explosionPower,64); i++) { int x = TecTech.RANDOM.nextInt(16); int y = TecTech.RANDOM.nextInt(a.worldObj.getActualHeight()); int z = TecTech.RANDOM.nextInt(16); @@ -147,12 +156,14 @@ public class AnomalyHandler implements IChunkMetaDataHandler { a.worldObj.setBlockToAir((a.xPosition << 4) + x, y, (a.zPosition << 4) + z); b.worldObj.setBlockToAir((b.xPosition << 4) + x, y, (b.zPosition << 4) + z); } - if (TecTech.RANDOM.nextBoolean()) { - a.worldObj.createExplosion(null, (a.xPosition << 4) + x + .5, y + .5, (a.zPosition << 4) + z + .5, power, true); + if(TecTech.configTecTech.BOOM_ENABLE){ + if (TecTech.RANDOM.nextBoolean()) { + a.worldObj.createExplosion(null, (a.xPosition << 4) + x + .5, y + .5, (a.zPosition << 4) + z + .5, explosionPower*TecTech.RANDOM.nextFloat(), true); + } GT_Utility.sendSoundToPlayers(a.worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1, (a.xPosition << 4) + x, y, (a.zPosition << 4) + z); - } - if (TecTech.RANDOM.nextBoolean()) { - b.worldObj.createExplosion(null, (b.xPosition << 4) + x + .5, y + .5, (b.zPosition << 4) + z + .5, power, true); + if (TecTech.RANDOM.nextBoolean()) { + b.worldObj.createExplosion(null, (b.xPosition << 4) + x + .5, y + .5, (b.zPosition << 4) + z + .5, explosionPower*TecTech.RANDOM.nextFloat(), true); + } GT_Utility.sendSoundToPlayers(b.worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1, (b.xPosition << 4) + x, y, (b.zPosition << 4) + z); } } @@ -160,13 +171,13 @@ public class AnomalyHandler implements IChunkMetaDataHandler { int z = (b.xPosition - a.xPosition) << 4; List<EntityLivingBase> aE = a.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, Util.fromChunk(a)); List<EntityLivingBase> bE = b.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, Util.fromChunk(b)); - aE.forEach(o -> { + for (EntityLivingBase entityLivingBase : aE) { if (TecTech.RANDOM.nextBoolean()) { - o.setPositionAndUpdate(o.posX + x, o.posY, o.posZ + z); - o.attackEntityFrom(MainLoader.subspace,8+TecTech.RANDOM.nextInt(8)); - if(o instanceof EntityPlayer){ - EntityPlayer player=((EntityPlayer) o); - if(!player.capabilities.isCreativeMode) { + if (entityLivingBase instanceof EntityPlayer) { + EntityPlayer player = ((EntityPlayer) entityLivingBase); + if (!player.capabilities.isCreativeMode) { + player.setPositionAndUpdate(entityLivingBase.posX + x, entityLivingBase.posY, entityLivingBase.posZ + z); + player.attackEntityFrom(MainLoader.subspace, 8 + TecTech.RANDOM.nextInt((int) (explosionPower / 4))); player.addPotionEffect(new PotionEffect(Potion.hunger.id, 1200)); player.addPotionEffect(new PotionEffect(Potion.weakness.id, 1000)); player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 800)); @@ -175,36 +186,35 @@ public class AnomalyHandler implements IChunkMetaDataHandler { player.addPotionEffect(new PotionEffect(Potion.poison.id, 200)); player.addPotionEffect(new PotionEffect(Potion.blindness.id, 100)); player.addPotionEffect(new PotionEffect(Potion.wither.id, 60)); - TecTech.playerPersistence.getDataOrSetToNewTag(player).setFloat(SPACE_CHARGE, - TecTech.playerPersistence.getDataOrSetToNewTag(player).getFloat(SPACE_CHARGE)-(float)Math.abs(TecTech.RANDOM.nextGaussian())); - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + addCharge(player, -mass * TecTech.RANDOM.nextFloat()); } + } else { + entityLivingBase.setPositionAndUpdate(entityLivingBase.posX + x, entityLivingBase.posY, entityLivingBase.posZ + z); + entityLivingBase.attackEntityFrom(MainLoader.subspace, 8 + TecTech.RANDOM.nextInt((int) (explosionPower / 4))); } } - }); - bE.forEach(o -> { + } + for (EntityLivingBase o : bE) { if (TecTech.RANDOM.nextBoolean()) { - o.setPositionAndUpdate(o.posX - x, o.posY, o.posZ - z); - o.attackEntityFrom(MainLoader.subspace,8+TecTech.RANDOM.nextInt(8)); - if(o instanceof EntityPlayer){ - EntityPlayer player=((EntityPlayer) o); - if(!player.capabilities.isCreativeMode) { + if (o instanceof EntityPlayer) { + EntityPlayer player = ((EntityPlayer) o); + if (!player.capabilities.isCreativeMode) { + player.setPositionAndUpdate(o.posX - x, o.posY, o.posZ - z); + player.attackEntityFrom(MainLoader.subspace, 8 + TecTech.RANDOM.nextInt((int) -(explosionPower / 4))); player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 800)); player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 600)); player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 400)); player.addPotionEffect(new PotionEffect(Potion.jump.id, 200)); player.addPotionEffect(new PotionEffect(Potion.resistance.id, 100)); player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 60)); - TecTech.playerPersistence.getDataOrSetToNewTag(player).setFloat(SPACE_CHARGE, - TecTech.playerPersistence.getDataOrSetToNewTag(player).getFloat(SPACE_CHARGE)+(float)Math.abs(TecTech.RANDOM.nextGaussian())); - - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + addCharge(player, mass * TecTech.RANDOM.nextFloat()); } + } else { + o.setPositionAndUpdate(o.posX + x, o.posY, o.posZ + z); + o.attackEntityFrom(MainLoader.subspace, 8 + TecTech.RANDOM.nextInt((int) (explosionPower / 4))); } } - }); + } } @Override @@ -222,36 +232,45 @@ public class AnomalyHandler implements IChunkMetaDataHandler { } } - data.get(player.worldObj.provider.dimensionId).forEach((chunkCoordIntPair, dat) -> { + for (Map.Entry<ChunkCoordIntPair, NBTTagCompound> entry : data.get(player.worldObj.provider.dimensionId).entrySet()) { + ChunkCoordIntPair chunkCoordIntPair = entry.getKey(); + NBTTagCompound dat = entry.getValue(); if (Math.abs(chunkCoordIntPair.getCenterXPos() - player.posX) + Math.abs(chunkCoordIntPair.getCenterZPosition() - player.posZ) < 256) { - for (int i = 0, pow = (int) Math.min(32, dat.getDouble(INTENSITY) / PER_PARTICLE); i < pow; i++) { + for (int i = 0, pow = (int) Math.min(COUNT_DIV, dat.getDouble(INTENSITY) / PER_PARTICLE); i < pow; i++) { TecTech.proxy.em_particle(player.worldObj, chunkCoordIntPair.getCenterXPos() + TecTech.RANDOM.nextGaussian() * 32D, player.posY + TecTech.RANDOM.nextFloat() * 128D - 64D, chunkCoordIntPair.getCenterZPosition() + TecTech.RANDOM.nextGaussian() * 32D); } } - }); + } } else if (TecTech.RANDOM.nextInt(50) == 0) { EntityPlayer player = aEvent.player; ChunkCoordIntPair pair = new ChunkCoordIntPair(player.chunkCoordX, player.chunkCoordZ); NBTTagCompound compound = data.get(player.worldObj.provider.dimensionId).get(pair); NBTTagCompound playerTag = TecTech.playerPersistence.getDataOrSetToNewTag(player); - if(player.capabilities.isCreativeMode){ - playerTag.setDouble(SPACE_CANCER, 0); - }else { + boolean saveRequired = false; + if (!player.capabilities.isCreativeMode) { + double cancer=getCancer(player); if (compound != null) { int badness = (int) Math.min(COUNT_DIV, compound.getDouble(INTENSITY) / PER_PARTICLE); if (badness > 0) { - playerTag.setDouble(SPACE_CANCER, Math.min(2, playerTag.getDouble(SPACE_CANCER) + 9.765625E-4f * badness)); + playerTag.setDouble(SPACE_CANCER, Math.min(2, cancer + 9.765625E-4f * badness)); player.attackEntityFrom(MainLoader.subspace,Math.max(1,badness/8f)); + saveRequired = true; } } else if (playerTag.getDouble(SPACE_CANCER) > 0 && !player.isDead) { - playerTag.setDouble(SPACE_CANCER, Math.max(0, playerTag.getDouble(SPACE_CANCER) - 7.6293945E-6f)); + if (player.ticksExisted % 10 == 0) { + playerTag.setDouble(SPACE_CANCER, Math.max(0, cancer - 7.6293945E-5f)); + saveRequired = true; + } } } - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendTo(new PlayerDataMessage.PlayerDataData(player), (EntityPlayerMP) player); + + if (saveRequired) { + TecTech.playerPersistence.saveData(player); + NetworkDispatcher.INSTANCE.sendTo(new PlayerDataMessage.PlayerDataData(player), (EntityPlayerMP) player); + } } } @@ -260,29 +279,26 @@ public class AnomalyHandler implements IChunkMetaDataHandler { EntityPlayer player=TecTech.proxy.getPlayer(); if(player!=null) { if(!player.capabilities.isCreativeMode) { - NBTTagCompound tagCompound = TecTech.playerPersistence.getDataOrSetToNewTag(player); - if (tagCompound != null) { - float cancer = tagCompound.getFloat(SPACE_CANCER); - if (cancer > 0) { - player.setInvisible(fixMe = TecTech.RANDOM.nextFloat() * 2 < cancer); - player.setAngles((TecTech.RANDOM.nextFloat() - .5F) * 36 * cancer, (TecTech.RANDOM.nextFloat() - .5F) * 36 * cancer); - cancer*=cancer/2F; - if (cancer > 1.75f) { - player.setVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer); - } else { - player.addVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer); - } + double cancer = getCancer(player)*CANCER_EFFECTIVENESS; + if (cancer > 0) { + player.setInvisible(fixMe = TecTech.RANDOM.nextFloat() * 2 < cancer); + player.setAngles((TecTech.RANDOM.nextFloat() - .5F) * 36 * (float) cancer, (TecTech.RANDOM.nextFloat() - .5F) * 36 * (float) cancer); + cancer*=cancer/2F; + if (cancer > 1.75f) { + player.setVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer); + } else { + player.addVelocity((TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer, (TecTech.RANDOM.nextFloat() - .5F) * cancer); } } - float charge = TecTech.playerPersistence.getDataOrSetToNewTag(player).getFloat(SPACE_CHARGE); + double charge = getCharge(player); if(charge!=0) { for (Object o : player.worldObj.playerEntities) { if (o instanceof EntityPlayer && !((EntityPlayer) o).capabilities.isCreativeMode) { EntityPlayer otherPlayer=(EntityPlayer)o; - float chargeOther = TecTech.playerPersistence.getDataOrSetToNewTag(otherPlayer).getFloat(SPACE_CHARGE); + double chargeOther = getCharge(otherPlayer); if (chargeOther != 0 && player != o) { - float reaction = chargeOther * charge; + double reaction = chargeOther * charge; if (reaction !=0) { double distanceSq = otherPlayer.getDistanceSqToEntity(player); if (distanceSq >= 1) { @@ -348,19 +364,25 @@ public class AnomalyHandler implements IChunkMetaDataHandler { return 100; } - public void addAnomaly(IGregTechTileEntity iGregTechTileEntity, double amount) { - if (iGregTechTileEntity.isServerSide()) { - World w = iGregTechTileEntity.getWorld(); + public void addAnomaly(IGregTechTileEntity gtTile, double amount) { + addAnomaly(gtTile.getWorld(),gtTile.getXCoord(),gtTile.getZCoord(),amount); + } + + public void addAnomaly(TileEntity tileEntity, double amount) { + addAnomaly(tileEntity.getWorldObj(),tileEntity.xCoord,tileEntity.zCoord,amount); + } + + public void addAnomaly(World w,int x,int z, double amount) { + if (!w.isRemote) { addAnomaly(w.provider.dimensionId, new ChunkCoordIntPair( - iGregTechTileEntity.getXCoord() >> 4, - iGregTechTileEntity.getZCoord() >> 4), + x >> 4, + z >> 4), amount); } } public void addAnomaly(int world, ChunkCoordIntPair chunk, double amount) { - amount=Math.abs(amount); NBTTagCompound old = TecTech.chunkDataHandler.getChunkData(this, world, chunk); if (old == null) { NBTTagCompound data = new NBTTagCompound(); @@ -371,4 +393,45 @@ public class AnomalyHandler implements IChunkMetaDataHandler { } TecTech.chunkDataHandler.getChunkData(this, world).markForTransmissionToClient(chunk); } + + public double getCharge(EntityPlayer player){ + return getDouble(player,SPACE_CHARGE); + } + + public void setCharge(EntityPlayer player, double amount){ + setDouble(player,SPACE_CHARGE,amount); + } + + public void addCharge(EntityPlayer player, double amount){ + addDouble(player,SPACE_CHARGE,amount); + } + + public double getCancer(EntityPlayer player){ + return getDouble(player,SPACE_CANCER); + } + + public void setCancer(EntityPlayer player, double amount){ + setDouble(player,SPACE_CANCER,amount); + } + + public void addCancer(EntityPlayer player, double amount){ + addDouble(player,SPACE_CANCER,amount); + } + + public double getDouble(EntityPlayer player,String name){ + return TecTech.playerPersistence.getDataOrSetToNewTag(player).getDouble(name); + } + + public void setDouble(EntityPlayer player,String name, double amount){ + TecTech.playerPersistence.getDataOrSetToNewTag(player).setDouble(name, amount); + TecTech.playerPersistence.saveData(player); + NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + } + + public void addDouble(EntityPlayer player,String name, double amount){ + NBTTagCompound data = TecTech.playerPersistence.getDataOrSetToNewTag(player); + data.setDouble(name, amount+data.getDouble(name)); + TecTech.playerPersistence.saveData(player); + NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java index a153671a59..bb61f50aab 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java +++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/CancerCommand.java @@ -1,19 +1,14 @@ package com.github.technus.tectech.mechanics.anomaly; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.loader.NetworkDispatcher; -import com.github.technus.tectech.mechanics.data.PlayerDataMessage; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; import java.util.ArrayList; import java.util.List; -import static com.github.technus.tectech.mechanics.anomaly.AnomalyHandler.SPACE_CANCER; - public class CancerCommand implements ICommand { ArrayList<String> aliases=new ArrayList<>(); @@ -39,13 +34,10 @@ public class CancerCommand implements ICommand { return; } EntityPlayerMP player=(EntityPlayerMP)sender; - NBTTagCompound playerTag = TecTech.playerPersistence.getDataOrSetToNewTag(player); if(player.capabilities.isCreativeMode){ sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!")); }else { - playerTag.setDouble(SPACE_CANCER, amount); - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendTo(new PlayerDataMessage.PlayerDataData(player), player); + TecTech.anomalyHandler.setCancer(player,amount); sender.addChatMessage(new ChatComponentText("Cancer set to: "+amount)); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java index da365a92f8..4190cd0dba 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java +++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/ChargeCommand.java @@ -1,19 +1,14 @@ package com.github.technus.tectech.mechanics.anomaly; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.loader.NetworkDispatcher; -import com.github.technus.tectech.mechanics.data.PlayerDataMessage; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; import java.util.ArrayList; import java.util.List; -import static com.github.technus.tectech.mechanics.anomaly.AnomalyHandler.SPACE_CHARGE; - public class ChargeCommand implements ICommand { ArrayList<String> aliases=new ArrayList<>(); @@ -33,13 +28,10 @@ public class ChargeCommand implements ICommand { return; } EntityPlayerMP player=(EntityPlayerMP)sender; - NBTTagCompound playerTag = TecTech.playerPersistence.getDataOrSetToNewTag(player); if(player.capabilities.isCreativeMode){ sender.addChatMessage(new ChatComponentText("Doesn't really work in creative mode!")); }else { - playerTag.setDouble(SPACE_CHARGE, amount); - TecTech.playerPersistence.saveData(player); - NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(player)); + TecTech.anomalyHandler.setCharge(player,amount); sender.addChatMessage(new ChatComponentText("Charge set to: "+amount)); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java b/src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java index fd351631f3..715988d26f 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java +++ b/src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java @@ -1,10 +1,13 @@ package com.github.technus.tectech.mechanics.avr; import com.github.technus.avrClone.AvrCore; -import com.github.technus.avrClone.registerPackages.*; +import com.github.technus.avrClone.registerPackages.IInterrupt; +import com.github.technus.avrClone.registerPackages.IRegister; +import com.github.technus.avrClone.registerPackages.IRegisterBit; +import com.github.technus.avrClone.registerPackages.RegisterPackageSync; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -public class SidedRedstone extends RegisterPackageSync<IGregTechTileEntity> { +public class SidedRedstone extends RegisterPackageSync<IGregTechTileEntity,SidedRedstone> { public static final RSINT RSINT =new RSINT(); public SidedRedstone(int offset) { diff --git a/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertFloat.java b/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertFloat.java index 61fa56f93a..5885226f6f 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertFloat.java +++ b/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertFloat.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.commands; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; diff --git a/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertInteger.java b/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertInteger.java index c9767560c3..41edd66684 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertInteger.java +++ b/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertInteger.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.commands; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.util.ChatComponentText; diff --git a/src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataMessage.java b/src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataMessage.java index 0a086384bc..6094d08ba4 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataMessage.java +++ b/src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataMessage.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.mechanics.data; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.MessageContext; diff --git a/src/main/java/com/github/technus/tectech/mechanics/data/PlayerPersistence.java b/src/main/java/com/github/technus/tectech/mechanics/data/PlayerPersistence.java index 0a829de3e9..f69bccc871 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/data/PlayerPersistence.java +++ b/src/main/java/com/github/technus/tectech/mechanics/data/PlayerPersistence.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.data; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.loader.NetworkDispatcher; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; diff --git a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java index 82234e4c75..f30105f1ee 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java +++ b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.dataTransport; -import com.github.technus.tectech.Vec3pos; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import net.minecraft.nbt.NBTTagCompound; import java.util.Collections; @@ -12,7 +12,7 @@ import java.util.Set; */ public abstract class DataPacket<T>{ private static final byte MAX_HISTORY = 64; - private Set<Vec3pos> trace = new LinkedHashSet<>(); + private Set<Vec3Impl> trace = new LinkedHashSet<>(); protected T content; @@ -23,9 +23,9 @@ public abstract class DataPacket<T>{ protected DataPacket(NBTTagCompound nbt) { content = contentFromNBT(nbt.getCompoundTag("qContent")); for (int i = 0; i < nbt.getByte("qHistory"); i++) { - trace.add(new Vec3pos( + trace.add(new Vec3Impl( nbt.getInteger("qX" + i), - nbt.getShort("qY" + i), + nbt.getInteger("qY" + i), nbt.getInteger("qZ" + i) )); } @@ -39,10 +39,10 @@ public abstract class DataPacket<T>{ } nbt.setByte("qHistory", (byte) trace.size()); int i = 0; - for (Vec3pos v : trace) { - nbt.setInteger("qX" + i, v.x); - nbt.setShort("qY" + i, v.y); - nbt.setInteger("qZ" + i, v.z); + for (Vec3Impl v : trace) { + nbt.setInteger("qX" + i, v.get0()); + nbt.setInteger("qY" + i, v.get1()); + nbt.setInteger("qZ" + i, v.get2()); i++; } return nbt; @@ -54,7 +54,7 @@ public abstract class DataPacket<T>{ protected abstract T unifyContentWith(T content); - public final boolean contains(Vec3pos v) { + public final boolean contains(Vec3Impl v) { return trace.contains(v); } @@ -64,7 +64,7 @@ public abstract class DataPacket<T>{ public abstract boolean extraCheck(); - protected final DataPacket<T> unifyTrace(Vec3pos... positions) { + protected final DataPacket<T> unifyTrace(Vec3Impl... positions) { Collections.addAll(trace,positions); return (check() && extraCheck()) ? this : null; } @@ -85,7 +85,7 @@ public abstract class DataPacket<T>{ return null; } - public final T contentIfNotInTrace(Vec3pos pos) { + public final T contentIfNotInTrace(Vec3Impl pos) { if (trace.contains(pos)) { return null; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/QuantumDataPacket.java b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/QuantumDataPacket.java index 9661d8d315..0fddb53fe9 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/QuantumDataPacket.java +++ b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/QuantumDataPacket.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.dataTransport; -import com.github.technus.tectech.Vec3pos; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import net.minecraft.nbt.NBTTagCompound; public class QuantumDataPacket extends DataPacket<Long> { @@ -34,7 +34,7 @@ public class QuantumDataPacket extends DataPacket<Long> { return this.content+content; } - public QuantumDataPacket unifyTraceWith(Vec3pos... positions) { + public QuantumDataPacket unifyTraceWith(Vec3Impl... positions) { return (QuantumDataPacket) super.unifyTrace(positions); } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README index f6c0b35e5f..c774b126c8 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/README @@ -41,4 +41,7 @@ Trees: InstanceStack - inst stack |||||multiple to 1 - InstanceStackTree - inst container - real things go here
\ No newline at end of file + InstanceStackTree - inst container - real things go here + + Preset for world: + 2;7,16x22,16x35:11,16x35:3,16x35;0;
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java new file mode 100644 index 0000000000..d607dfad73 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/EMException.java @@ -0,0 +1,22 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core; + +/** + * Created by danie_000 on 19.11.2016. + */ +public final class EMException extends RuntimeException { + public EMException(String message) { + super(message); + } + + public EMException(String message, Throwable cause) { + super(message, cause); + } + + public EMException(Throwable cause) { + super(cause); + } + + public EMException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java new file mode 100644 index 0000000000..d731078988 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/IEMContainer.java @@ -0,0 +1,12 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; + +/** + * Created by danie_000 on 25.01.2017. + */ +public interface IEMContainer { + EMInstanceStackMap getContentHandler(); + + void purgeOverflow(); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java deleted file mode 100644 index 7d5e079876..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class cElementalDecay { - public static final cElementalDecay[] noDecay = null; - //DECAY IMPOSSIBLE!!! - //Do not use regular NULL java will not make it work with varargs!!! - //Or cast null into ARRAY type but this static is more convenient!!! - public static final cElementalDecay[] noProduct = new cElementalDecay[0]; - //this in turn can be used to tell that the thing should just vanish - public final cElementalDefinitionStackMap outputStacks; - public final float probability; - - public cElementalDecay(iElementalDefinition... outSafe) { - this(2F, outSafe); - } - - public cElementalDecay(float probability, iElementalDefinition... outSafe) { - cElementalDefinitionStack[] outArr = new cElementalDefinitionStack[outSafe.length]; - for (int i = 0; i < outArr.length; i++) { - outArr[i] = new cElementalDefinitionStack(outSafe[i], 1); - } - outputStacks = new cElementalDefinitionStackMap(outArr); - this.probability = probability; - } - - public cElementalDecay(cElementalDefinitionStack... outSafe) { - this(2F, outSafe); - } - - public cElementalDecay(float probability, cElementalDefinitionStack... out) { - outputStacks = new cElementalDefinitionStackMap(out); - this.probability = probability; - } - - public cElementalDecay(cElementalDefinitionStackMap tree) { - this(2F, tree); - } - - public cElementalDecay(float probability, cElementalDefinitionStackMap tree) { - outputStacks = tree; - this.probability = probability; - } - - public cElementalInstanceStackMap getResults(float lifeMult, long age, long energyTotalForProducts, long amountDecaying) { - cElementalInstanceStackMap decayResult = new cElementalInstanceStackMap(); - if (outputStacks == null) { - return decayResult;//This is to prevent null pointer exceptions. - } - //Deny decay code is in instance! - long qtty = 0; - for (cElementalDefinitionStack stack : outputStacks.values()) { - qtty += stack.amount; - } - if (qtty <= 0) { - return decayResult; - } - //energyTotalForProducts /= qtty; - //lifeMult /= (float) qtty; - for (cElementalDefinitionStack stack : outputStacks.values()) { - decayResult.putUnify(new cElementalInstanceStack(stack.definition, - amountDecaying * stack.amount, - lifeMult, age/*new products*/, energyTotalForProducts / Math.max(1, Math.abs(stack.amount))));//get instances from stack - } - return decayResult; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDefinitionStackMap.java deleted file mode 100644 index 294acfc479..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDefinitionStackMap.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.TreeMap; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; - -/** - * Created by Tec on 12.05.2017. - */ -public final class cElementalDefinitionStackMap/*IMMUTABLE*/ extends cElementalStackMap {//Target class for construction of definitions/recipes - //Constructors + Clone, all make a whole new OBJ. - public static final cElementalDefinitionStackMap empty = new cElementalDefinitionStackMap(); - - private cElementalDefinitionStackMap() { - map = new TreeMap<>(); - } - - @Deprecated - public cElementalDefinitionStackMap(iElementalDefinition... in) { - map=new cElementalMutableDefinitionStackMap(in).map; - } - - public cElementalDefinitionStackMap(cElementalDefinitionStack... in) { - map=new cElementalMutableDefinitionStackMap(in).map; - } - - public cElementalDefinitionStackMap(TreeMap<iElementalDefinition, cElementalDefinitionStack> in) { - map = new TreeMap<>(in); - } - - cElementalDefinitionStackMap(cElementalMutableDefinitionStackMap unsafeMap){ - map=unsafeMap.map; - } - - //IMMUTABLE DON'T NEED IT - @Override - public cElementalDefinitionStackMap clone() { - return this; - } - - public cElementalMutableDefinitionStackMap toMutable() { - return new cElementalMutableDefinitionStackMap(map); - } - - @Override - @Deprecated//BETTER TO JUST MAKE A MUTABLE VERSION AND DO SHIT ON IT - public TreeMap<iElementalDefinition, cElementalDefinitionStack> getRawMap() { - return toMutable().getRawMap(); - } - - public static cElementalDefinitionStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < defStacks.length; i++) { - defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - if (defStacks[i].definition.equals(nbtE__)) { - throw new tElementalException("Something went Wrong"); - } - } - return new cElementalDefinitionStackMap(defStacks); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java deleted file mode 100644 index 5893ac1a1f..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalInstanceStackMap.java +++ /dev/null @@ -1,558 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; - -import java.util.*; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; - -/** - * Created by danie_000 on 22.01.2017. - */ -public final class cElementalInstanceStackMap implements Comparable<cElementalInstanceStackMap> { - TreeMap<iElementalDefinition, cElementalInstanceStack> map; - - //Constructors - public cElementalInstanceStackMap() { - map = new TreeMap<>(); - } - - public cElementalInstanceStackMap(cElementalInstanceStack... inSafe) { - this(true, inSafe); - } - - public cElementalInstanceStackMap(boolean clone, cElementalInstanceStack... in) { - map = new TreeMap<>(); - if (clone) { - cElementalInstanceStack[] stacks=new cElementalInstanceStack[in.length]; - for(int i=0;i<stacks.length;i++) { - stacks[i] = in[i].clone(); - } - putUnifyAll(stacks); - } else { - putUnifyAll(in); - } - } - - @Deprecated - private cElementalInstanceStackMap(TreeMap<iElementalDefinition, cElementalInstanceStack> inSafe) { - this(true, inSafe); - } - - @Deprecated - private cElementalInstanceStackMap(boolean clone, TreeMap<iElementalDefinition, cElementalInstanceStack> in) { - if (clone) { - map = new TreeMap<>(); - for(cElementalInstanceStack stack:in.values()) { - putUnify(stack.clone()); - } - } else { - map = in; - } - } - - public cElementalInstanceStackMap(cElementalInstanceStackMap inSafe) { - this(true, inSafe.map); - } - - public cElementalInstanceStackMap(boolean copy, cElementalInstanceStackMap in) { - this(copy, in.map); - } - - @Override - public cElementalInstanceStackMap clone() { - return new cElementalInstanceStackMap(map); - } - - public cElementalMutableDefinitionStackMap toDefinitionMapForComparison() { - cElementalDefinitionStack[] list = new cElementalDefinitionStack[map.size()]; - int i = 0; - for (cElementalInstanceStack stack : map.values()) { - list[i++] = new cElementalDefinitionStack(stack.definition, stack.amount); - } - return new cElementalMutableDefinitionStackMap(list); - } - - //@Deprecated - //public cElementalStackMap toDefinitionMap(boolean mutable) { - // TreeMap<iElementalDefinition, cElementalDefinitionStack> newMap = new TreeMap<>(); - // for (cElementalInstanceStack stack : map.values()) { - // newMap.put(stack.definition, new cElementalDefinitionStack(stack.definition, stack.amount)); - // } - // if (mutable) { - // return new cElementalMutableDefinitionStackMap(newMap); - // } - // return new cElementalDefinitionStackMap(newMap); - //} - - @Deprecated - public Map<iElementalDefinition, cElementalInstanceStack> getRawMap() { - return map; - } - - //Removers - public void clear() { - map.clear(); - } - - public cElementalInstanceStack remove(iElementalDefinition def) { - return map.remove(def); - } - - @Deprecated - public cElementalInstanceStack remove(iHasElementalDefinition has) { - return map.remove(has.getDefinition()); - } - - public void removeAll(iElementalDefinition... definitions) { - for (iElementalDefinition def : definitions) { - map.remove(def); - } - } - - @Deprecated - private void removeAll(iHasElementalDefinition... hasElementalDefinition) { - for (iHasElementalDefinition has : hasElementalDefinition) { - map.remove(has.getDefinition()); - } - } - - //Remove amounts - public boolean removeAmount(boolean testOnly, cElementalInstanceStack instance) { - cElementalInstanceStack target = map.get(instance.definition); - if (target == null) { - return false; - } - if (testOnly) { - return target.amount >= instance.amount; - } else { - long diff = target.amount - instance.amount; - if (diff > 0) { - target.amount = diff; - return true; - } else if (diff == 0) { - map.remove(instance.definition); - return true; - } - } - return false; - } - - public boolean removeAmount(boolean testOnly, iHasElementalDefinition stack) { - cElementalInstanceStack target = map.get(stack.getDefinition()); - if (target == null) { - return false; - } - if (testOnly) { - return target.amount >= stack.getAmount(); - } else { - long diff = target.amount - stack.getAmount(); - if (diff > 0) { - target.amount = diff; - return true; - } else if (diff == 0) { - map.remove(stack.getDefinition()); - return true; - } - } - return false; - } - - @Deprecated - public boolean removeAmount(boolean testOnly, iElementalDefinition def) { - return removeAmount(testOnly, new cElementalDefinitionStack(def, 1)); - } - - public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStack... instances) { - boolean test = true; - for (cElementalInstanceStack stack : instances) { - test &= removeAmount(true, stack); - } - if (testOnly || !test) { - return test; - } - for (cElementalInstanceStack stack : instances) { - removeAmount(false, stack); - } - return true; - } - - public boolean removeAllAmounts(boolean testOnly, iHasElementalDefinition... stacks) { - boolean test = true; - for (iHasElementalDefinition stack : stacks) { - test &= removeAmount(true, stack); - } - if (testOnly || !test) { - return test; - } - for (iHasElementalDefinition stack : stacks) { - removeAmount(false, stack); - } - return true; - } - - @Deprecated - public boolean removeAllAmounts(boolean testOnly, iElementalDefinition... definitions) { - cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[definitions.length]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = new cElementalDefinitionStack(definitions[i], 1); - } - return removeAllAmounts(testOnly, stacks); - } - - public boolean removeAllAmounts(boolean testOnly, cElementalStackMap container) { - boolean test=true; - for (Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry : container.map.entrySet()) { - test &= removeAmount(true, entry.getValue()); - } - if (testOnly || !test) { - return test; - } - for (Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry : container.map.entrySet()) { - removeAmount(false, entry.getValue()); - } - return true; - } - - public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStackMap container) { - boolean test=true; - for (Map.Entry<iElementalDefinition, cElementalInstanceStack> entry : container.map.entrySet()) { - test &= removeAmount(true, entry.getValue()); - } - if (testOnly || !test) { - return test; - } - for (Map.Entry<iElementalDefinition, cElementalInstanceStack> entry : container.map.entrySet()) { - test &= removeAmount(false, entry.getValue()); - } - return true; - } - - //Remove overflow - public float removeOverflow(int stacksCount, long stackCapacity) { - float massRemoved = 0; - - if (map.size() > stacksCount) { - iElementalDefinition[] keys = keys(); - for (int i = stacksCount; i < keys.length; i++) { - massRemoved += map.get(keys[i]).getDefinitionStack().getMass(); - map.remove(keys[i]); - } - } - - for (cElementalInstanceStack instance : values()) { - if (instance.amount > stackCapacity) { - massRemoved += instance.definition.getMass() * (instance.amount - stackCapacity); - instance.amount = stackCapacity; - } - } - return massRemoved; - } - - //Put replace - public cElementalInstanceStack putReplace(cElementalInstanceStack instanceUnsafe) { - return map.put(instanceUnsafe.definition, instanceUnsafe); - } - - public void putReplaceAll(cElementalInstanceStack... instances) { - for (cElementalInstanceStack instance : instances) { - map.put(instance.definition, instance); - } - } - - private void putReplaceAll(Map<iElementalDefinition, cElementalInstanceStack> inTreeUnsafe) { - map.putAll(inTreeUnsafe); - } - - public void putReplaceAll(cElementalInstanceStackMap inContainerUnsafe) { - putReplaceAll(inContainerUnsafe.map); - } - - //Put unify - public cElementalInstanceStack putUnify(cElementalInstanceStack instance) { - cElementalInstanceStack stack=map.get(instance.definition); - if(stack==null) { - return map.put(instance.definition, instance); - } - return map.put(instance.definition, stack.unifyIntoThis(instance)); - } - - public void putUnifyAll(cElementalInstanceStack... instances) { - for (cElementalInstanceStack instance : instances) { - putUnify(instance); - } - } - - private void putUnifyAll(Map<iElementalDefinition, cElementalInstanceStack> inTreeUnsafe) { - for (cElementalInstanceStack in : inTreeUnsafe.values()) { - putUnify(in); - } - } - - public void putUnifyAll(cElementalInstanceStackMap containerUnsafe) { - putUnifyAll(containerUnsafe.map); - } - - //Getters - public cElementalInstanceStack getFirst(){ - return map.firstEntry().getValue(); - } - - public cElementalInstanceStack getLast(){ - return map.lastEntry().getValue(); - } - - public cElementalInstanceStack getInstance(iElementalDefinition def) { - return map.get(def); - } - - public cElementalInstanceStack get(int i){ - Collection<cElementalInstanceStack> var = map.values(); - return var.toArray(new cElementalInstanceStack[0])[i]; - } - - public String[] getShortSymbolsInfo() { - String[] info = new String[map.size()]; - int i = 0; - for (cElementalInstanceStack instance : map.values()) { - info[i++] = instance.definition.getShortSymbol(); - } - return info; - } - - public String[] getElementalInfo() { - String[] info = new String[map.size() * 4]; - int i = 0; - for (cElementalInstanceStack instance : map.values()) { - info[i] = EnumChatFormatting.BLUE + instance.definition.getName(); - info[i + 1] = EnumChatFormatting.AQUA + instance.definition.getSymbol(); - info[i + 2] = "Amount " + EnumChatFormatting.GREEN + instance.amount; - info[i + 3] = "LifeTime " + EnumChatFormatting.GREEN + instance.getLifeTime(); - i += 4; - } - return info; - } - - public ArrayList<String> getScanShortSymbols(int[] capabilities) { - ArrayList<String> list=new ArrayList<>(16); - for(Map.Entry<iElementalDefinition,cElementalInstanceStack> e:map.entrySet()){ - e.getValue().addScanShortSymbols(list,capabilities); - } - return list; - } - - public ArrayList<String> getScanInfo(int[] capabilities) { - ArrayList<String> list=new ArrayList<>(16); - for(Map.Entry<iElementalDefinition,cElementalInstanceStack> e:map.entrySet()){ - e.getValue().addScanResults(list,capabilities); - } - return list; - } - - public cElementalInstanceStack[] values() { - Collection<cElementalInstanceStack> var = map.values(); - return var.toArray(new cElementalInstanceStack[0]); - } - - public iElementalDefinition[] keys() { - Set<iElementalDefinition> var = map.keySet(); - return var.toArray(new iElementalDefinition[0]); - } - - public float getMass() { - float mass = 0; - for (cElementalInstanceStack stack : map.values()) { - mass += stack.getMass(); - } - return mass; - } - - public long getCharge() { - long charge = 0; - for (cElementalInstanceStack stack : map.values()) { - charge += stack.getCharge(); - } - return charge; - } - - public long getCountOfAllAmounts(){ - long sum=0; - for(cElementalInstanceStack stack:map.values()){ - sum+=stack.amount; - } - return sum; - } - - //Tests - public boolean containsDefinition(iElementalDefinition def) { - return map.containsKey(def); - } - - public boolean containsInstance(cElementalInstanceStack inst) { - return map.containsValue(inst); - } - - public int size() { - return map.size(); - } - - public boolean hasStacks() { - return !map.isEmpty(); - } - - public boolean isEmpty(){ - return map.isEmpty(); - } - - //Tick Content - public void tickContentByOneSecond(float lifeTimeMult, int postEnergize) { - tickContent(lifeTimeMult,postEnergize,1); - } - - public void tickContent(float lifeTimeMult, int postEnergize, int seconds){ - for (cElementalInstanceStack instance : values()) { - cElementalInstanceStackMap newInstances = instance.decay(lifeTimeMult, instance.age += seconds, postEnergize); - if (newInstances == null) { - instance.nextColor(); - } else { - removeAmount(false,instance); - for (cElementalInstanceStack newInstance : newInstances.values()) { - putUnify(newInstance); - } - } - } - } - - //NBT - public NBTTagCompound getShortSymbolsNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getShortSymbolsInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - public NBTTagCompound getInfoNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getElementalInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - public NBTTagCompound getScanShortSymbolsNBT(int[] capabilities) { - NBTTagCompound nbt = new NBTTagCompound(); - ArrayList<String> info = getScanShortSymbols(capabilities); - nbt.setInteger("i", info.size()); - for (int i = 0; i < info.size(); i++) { - nbt.setString(Integer.toString(i), info.get(i)); - } - return nbt; - } - - public NBTTagCompound getScanInfoNBT(int[] capabilities) { - NBTTagCompound nbt = new NBTTagCompound(); - ArrayList<String> info = getScanInfo(capabilities); - nbt.setInteger("i", info.size()); - for (int i = 0; i < info.size(); i++) { - nbt.setString(Integer.toString(i), info.get(i)); - } - return nbt; - } - - public NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setInteger("i", map.size()); - int i = 0; - for (cElementalInstanceStack instance : map.values()) { - nbt.setTag(Integer.toString(i++), instance.toNBT()); - } - return nbt; - } - - public static cElementalInstanceStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - cElementalInstanceStack[] instances = new cElementalInstanceStack[nbt.getInteger("i")]; - for (int i = 0; i < instances.length; i++) { - instances[i] = cElementalInstanceStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - if (instances[i].definition.equals(nbtE__)) { - throw new tElementalException("Something went Wrong"); - } - } - return new cElementalInstanceStackMap(false, instances); - } - - //stackUp - public static cElementalInstanceStack[] stackUp(cElementalInstanceStack... in) { - cElementalInstanceStackMap inTree = new cElementalInstanceStackMap(); - inTree.putUnifyAll(in); - return inTree.values(); - } - - @Override - public int compareTo(cElementalInstanceStackMap o) { - int sizeDiff = map.size() - o.map.size(); - if (sizeDiff != 0) { - return sizeDiff; - } - cElementalInstanceStack[] ofThis = values(), ofThat = o.values(); - for (int i = 0; i < ofThat.length; i++) { - int result = ofThis[i].compareTo(ofThat[i]); - if (result != 0) { - return result; - } - } - return 0; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof cElementalInstanceStackMap) { - return compareTo((cElementalInstanceStackMap) obj) == 0; - } - if (obj instanceof cElementalStackMap) { - return toDefinitionMapForComparison().compareTo((cElementalStackMap) obj) == 0; - } - return false; - } - - @Override - public int hashCode() {//Hash only definitions to compare contents not amounts or data - int hash = -(map.size() << 4); - for (cElementalInstanceStack stack : map.values()) { - hash += stack.definition.hashCode(); - } - return hash; - } - - @Override - public String toString() { - StringBuilder build=new StringBuilder("Instance Stack Map\n"); - for(cElementalInstanceStack stack:map.values()){ - build.append(stack.toString()).append('\n'); - } - return build.toString(); - } - - public cElementalInstanceStackMap takeAllToNewMap(){ - TreeMap<iElementalDefinition, cElementalInstanceStack> map=this.map; - this.map=new TreeMap<>(); - return new cElementalInstanceStackMap(map); - } - - 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/mechanics/elementalMatter/core/cElementalMutableDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalMutableDefinitionStackMap.java deleted file mode 100644 index 829af20ca6..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalMutableDefinitionStackMap.java +++ /dev/null @@ -1,277 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.Map; -import java.util.TreeMap; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; - -/** - * Created by danie_000 on 22.01.2017. - */ -public final class cElementalMutableDefinitionStackMap extends cElementalStackMap {//Transient class for construction of definitions/recipes - //Constructors + Clone, all make a whole new OBJ. - public cElementalMutableDefinitionStackMap() { - map = new TreeMap<>(); - } - - @Deprecated - public cElementalMutableDefinitionStackMap(iElementalDefinition... in) { - map=new TreeMap<>(); - for (iElementalDefinition def : in) { - putUnify(new cElementalDefinitionStack(def, 1)); - } - } - - public cElementalMutableDefinitionStackMap(cElementalDefinitionStack... in) { - map=new TreeMap<>(); - putUnifyAll(in); - } - - public cElementalMutableDefinitionStackMap(TreeMap<iElementalDefinition, cElementalDefinitionStack> in) { - this(true, in); - } - - public cElementalMutableDefinitionStackMap(boolean clone, TreeMap<iElementalDefinition, cElementalDefinitionStack> in) { - if (clone) { - map = new TreeMap<>(in); - } else { - map = in; - } - } - - @Override - public cElementalMutableDefinitionStackMap clone() { - return new cElementalMutableDefinitionStackMap(map); - } - - public cElementalDefinitionStackMap toImmutable() { - return new cElementalDefinitionStackMap(map); - } - public cElementalDefinitionStackMap toImmutable_optimized_unsafeLeavesExposedElementalTree() { - return new cElementalDefinitionStackMap(this); - } - - @Override - @Deprecated - public TreeMap<iElementalDefinition, cElementalDefinitionStack> getRawMap() { - return map; - } - - - //Removers - public void clear() { - map.clear(); - } - - public cElementalDefinitionStack remove(iElementalDefinition def) { - return map.remove(def); - } - - @Deprecated - public cElementalDefinitionStack remove(iHasElementalDefinition has) { - return map.remove(has.getDefinition()); - } - - public void removeAll(iElementalDefinition... definitions) { - for (iElementalDefinition def : definitions) { - map.remove(def); - } - } - - @Deprecated - public void removeAll(iHasElementalDefinition... hasElementalDefinition) { - for (iHasElementalDefinition has : hasElementalDefinition) { - map.remove(has.getDefinition()); - } - } - - //Remove amounts - public boolean removeAmount(boolean testOnly, cElementalInstanceStack instance) { - cElementalDefinitionStack target = map.get(instance.definition); - if (target == null) { - return false; - } - if (testOnly) { - return target.amount >= instance.amount; - } else { - long diff = target.amount - instance.amount; - if (diff > 0) { - map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); - return true; - } else if (diff == 0) { - map.remove(instance.definition); - return true; - } - } - return false; - } - - public boolean removeAmount(boolean testOnly, iHasElementalDefinition stack) { - cElementalDefinitionStack target = map.get(stack.getDefinition()); - if (target == null) { - return false; - } - if (testOnly) { - return target.amount >= stack.getAmount(); - } else { - long diff = target.amount - stack.getAmount(); - if (diff > 0) { - map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); - return true; - } else if (diff == 0) { - map.remove(stack.getDefinition()); - return true; - } - } - return false; - } - - @Deprecated - public boolean removeAmount(boolean testOnly, iElementalDefinition def) { - return removeAmount(testOnly, new cElementalDefinitionStack(def, 1)); - } - - public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStack... instances) { - boolean test = true; - for (cElementalInstanceStack stack : instances) { - test &= removeAmount(true, stack); - } - if (testOnly || !test) { - return test; - } - for (cElementalInstanceStack stack : instances) { - removeAmount(false, stack); - } - return true; - } - - public boolean removeAllAmounts(boolean testOnly, iHasElementalDefinition... stacks) { - boolean test = true; - for (iHasElementalDefinition stack : stacks) { - test &= removeAmount(true, stack); - } - if (testOnly || !test) { - return test; - } - for (iHasElementalDefinition stack : stacks) { - removeAmount(false, stack); - } - return true; - } - - @Deprecated - public boolean removeAllAmounts(boolean testOnly, iElementalDefinition... definitions) { - cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[definitions.length]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = new cElementalDefinitionStack(definitions[i], 1); - } - return removeAllAmounts(testOnly, stacks); - } - - public boolean removeAllAmounts(boolean testOnly, cElementalStackMap container) { - boolean test=true; - for (Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry : container.map.entrySet()) { - test &= removeAmount(true, entry.getValue()); - } - if (testOnly || !test) { - return test; - } - for (Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry : container.map.entrySet()) { - removeAmount(false, entry.getValue()); - } - return true; - } - - public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStackMap container) { - boolean test=true; - for (Map.Entry<iElementalDefinition, cElementalInstanceStack> entry : container.map.entrySet()) { - test &= removeAmount(true, entry.getValue()); - } - if (testOnly || !test) { - return test; - } - for (Map.Entry<iElementalDefinition, cElementalInstanceStack> entry : container.map.entrySet()) { - test &= removeAmount(false, entry.getValue()); - } - return true; - } - - //Put replace - public cElementalDefinitionStack putReplace(cElementalDefinitionStack defStackUnsafe) { - return map.put(defStackUnsafe.definition, defStackUnsafe); - } - - public void putReplaceAll(cElementalDefinitionStack... defStacks) { - for (cElementalDefinitionStack defStack : defStacks) { - map.put(defStack.definition, defStack); - } - } - - public void putReplaceAll(cElementalStackMap inContainerUnsafe) { - map.putAll(inContainerUnsafe.map); - } - - //Put unify - public cElementalDefinitionStack putUnify(cElementalDefinitionStack def) { - cElementalDefinitionStack stack=map.get(def.definition); - if(stack==null) { - return map.put(def.definition, def); - } - return map.put(def.definition, stack.addAmountIntoNewInstance(def.amount)); - } - - @Deprecated - public cElementalDefinitionStack putUnify(iElementalDefinition def) { - return putUnify(new cElementalDefinitionStack(def, 1)); - } - - public void putUnifyAll(cElementalDefinitionStack... defs) { - for (cElementalDefinitionStack def : defs) { - putUnify(def); - } - } - - @Deprecated - public void putUnifyAll(iElementalDefinition... defs) { - for (iElementalDefinition def : defs) { - putUnify(def); - } - } - - private void putUnifyAll(Map<iElementalDefinition, cElementalDefinitionStack> inTreeUnsafe) { - for (cElementalDefinitionStack in : inTreeUnsafe.values()) { - putUnify(in); - } - } - - public void putUnifyAll(cElementalStackMap containerUnsafe) { - for (cElementalDefinitionStack in : containerUnsafe.map.values()) { - putUnify(in); - } - } - - public static cElementalMutableDefinitionStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < defStacks.length; i++) { - defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - if (defStacks[i].definition.equals(nbtE__)) { - throw new tElementalException("Something went Wrong"); - } - } - return new 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/mechanics/elementalMatter/core/cElementalStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java deleted file mode 100644 index dbbfa7bf66..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalStackMap.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; - -import java.util.Collection; -import java.util.Set; -import java.util.TreeMap; - -/** - * Created by Tec on 12.05.2017. - */ -abstract class cElementalStackMap implements Comparable<cElementalStackMap> { - protected TreeMap<iElementalDefinition, cElementalDefinitionStack> map; - - @Override - public abstract cElementalStackMap clone(); - - @Deprecated - public abstract TreeMap<iElementalDefinition, cElementalDefinitionStack> getRawMap(); - - //Getters - public final cElementalDefinitionStack getFirst(){ - return map.firstEntry().getValue(); - } - - public final cElementalDefinitionStack getLast(){ - return map.lastEntry().getValue(); - } - - public final cElementalDefinitionStack getDefinitionStack(iElementalDefinition def) { - return map.get(def); - } - - public String[] getShortSymbolsInfo() { - String[] info = new String[map.size()]; - int i = 0; - for (cElementalDefinitionStack instance : map.values()) { - info[i++] = instance.definition.getShortSymbol(); - } - return info; - } - - public final String[] getElementalInfo() { - String[] info = new String[map.size() * 3]; - int i = 0; - for (cElementalDefinitionStack defStack : map.values()) { - info[i] = EnumChatFormatting.BLUE + defStack.definition.getName(); - info[i + 1] = EnumChatFormatting.AQUA + defStack.definition.getSymbol(); - info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.amount; - i += 3; - } - return info; - } - - public final cElementalDefinitionStack[] values() { - Collection<cElementalDefinitionStack> var = map.values(); - return var.toArray(new cElementalDefinitionStack[0]); - } - - public final iElementalDefinition[] keys() { - Set<iElementalDefinition> var = map.keySet(); - return var.toArray(new iElementalDefinition[0]); - } - - public long getCountOfAllAmounts(){ - long sum=0; - for(cElementalDefinitionStack stack:map.values()){ - sum+=stack.amount; - } - return sum; - } - - //Tests - public final boolean containsDefinition(iElementalDefinition def) { - return map.containsKey(def); - } - - public final boolean containsDefinitionStack(cElementalDefinitionStack inst) { - return map.containsValue(inst); - } - - public final int size() { - return map.size(); - } - - public final boolean hasStacks() { - return !map.isEmpty(); - } - - public final boolean isEmpty(){ - return map.isEmpty(); - } - - //NBT - public final NBTTagCompound getShortSymbolsNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getShortSymbolsInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - public final NBTTagCompound getInfoNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - String[] info = getElementalInfo(); - nbt.setInteger("i", info.length); - for (int i = 0; i < info.length; i++) { - nbt.setString(Integer.toString(i), info[i]); - } - return nbt; - } - - public final NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setInteger("i", map.size()); - int i = 0; - for (cElementalDefinitionStack defStack : map.values()) { - nbt.setTag(Integer.toString(i++), defStack.toNBT()); - } - return nbt; - } - - @Override - public final int compareTo(cElementalStackMap o) {//this actually compares rest - int sizeDiff = map.size() - o.map.size(); - if (sizeDiff != 0) { - return sizeDiff; - } - cElementalDefinitionStack[] ofThis = values(), ofO = o.values(); - for (int i = 0; i < ofO.length; i++) { - int result = ofThis[i].compareTo(ofO[i]); - if (result != 0) { - return result; - } - } - return 0; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof cElementalStackMap) { - return compareTo((cElementalStackMap) obj) == 0; - } - if (obj instanceof cElementalInstanceStackMap) { - return compareTo(((cElementalInstanceStackMap) obj).toDefinitionMapForComparison()) == 0; - } - return false; - } - - @Override - public final int hashCode() {//Hash only definitions to compare contents not amounts or data - int hash = -(map.size() << 4); - for (cElementalDefinitionStack stack : map.values()) { - hash += stack.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/mechanics/elementalMatter/core/commands/EMGive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java new file mode 100644 index 0000000000..4824053668 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMGive.java @@ -0,0 +1,143 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.commands; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * Created by danie_000 on 30.12.2017. + */ +public class EMGive implements ICommand { + ArrayList<String> aliases = new ArrayList<>(); + + public EMGive() { + aliases.add("em_give"); + aliases.add("give_em"); + aliases.add("gib_em"); + } + + @Override + public void processCommand(ICommandSender sender, String[] args) { + if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) { + if (args.length < 3) { + sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); + } else { + TecTech.LOGGER.info("Spawninig EM for " + ((EntityPlayerMP) sender).getDisplayName() + " - " + Arrays.toString(args)); + + ArrayList<String> list = new ArrayList<>(Arrays.asList(args)); + String energy = list.remove(0); + + EMDefinitionStack def = getDefinitionStack(TecTech.definitionsRegistry, list); + if (def != null) { + EMInstanceStack instanceStack = new EMInstanceStack(def, 1, 0, Long.parseLong(energy)); + + sender.addChatMessage(new ChatComponentText(instanceStack.getDefinition().getSymbol() + " - " + instanceStack.getDefinition().getLocalizedName())); + + EMInstanceStackMap instanceMap = new EMInstanceStackMap(instanceStack); + + ItemStack itemStack = new ItemStack(DebugElementalInstanceContainer_EM.INSTANCE); + DebugElementalInstanceContainer_EM.INSTANCE.setContent(itemStack, instanceMap); + + ((EntityPlayerMP) sender).inventory.addItemStackToInventory(itemStack); + } + } + } + } + + private EMDefinitionStack getDefinitionStack(EMDefinitionsRegistry registry, ArrayList<String> args) { + double amount; + if (args.size() == 0) { + return null; + } + String defTag = args.remove(0); + if ("<".equals(defTag)) { + return null; + } + try { + amount = Double.parseDouble(defTag); + if (args.size() == 0) { + return null; + } + defTag = args.remove(0); + if ("<".equals(defTag)) { + return null; + } + } catch (Exception e) { + amount = 1; + } + IEMDefinition definition = registry.getDirectBinds().get(defTag); + if (definition != null) { + return definition.getStackForm(amount); + } + EMIndirectType emIndirectType = registry.getIndirectBinds().get(defTag); + if (emIndirectType != null) { + EMDefinitionStackMap stacks = new EMDefinitionStackMap(); + while (args.size() > 0) { + EMDefinitionStack definitionStack = getDefinitionStack(registry, args); + if (definitionStack == null) { + break; + } else { + stacks.putUnifyExact(definitionStack); + } + } + return emIndirectType.create(registry, stacks.toNBT(registry)).getStackForm(amount); + } + return null; + } + + @Override + public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) { + return false; + } + + @Override + public List<String> getCommandAliases() { + return aliases; + } + + @Override + public String getCommandName() { + return aliases.get(0); + } + + @Override + public List<String> addTabCompletionOptions(ICommandSender sender, String[] args) { + if (args.length > 2 && args.length % 2 == 1) { + return new ArrayList<>(TecTech.definitionsRegistry.getBinds().keySet()); + } + return null; + } + + @Override + public String getCommandUsage(ICommandSender p_71518_1_) { + return "em_give Energy Count ClassOrId ( (Count ClassOrId ... <) ...<)"; + } + + @Override + public int compareTo(Object o) { + if (o instanceof ICommand) { + return getCommandName().compareTo(((ICommand) o).getCommandName()); + } + return 0; + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender sender) { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java new file mode 100644 index 0000000000..fe542abbde --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/EMList.java @@ -0,0 +1,96 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.commands; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; +import com.github.technus.tectech.util.Util; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.ChatComponentText; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Created by danie_000 on 30.12.2017. + */ +public class EMList implements ICommand { + ArrayList<String> aliases=new ArrayList<>(); + + public EMList(){ + aliases.add("em_list"); + aliases.add("list_em"); + } + + @Override + public void processCommand(ICommandSender sender, String[] args) { + if (!sender.getEntityWorld().isRemote) { + if(args.length == 0) { + listClasses(sender); + }else { + String concated = Util.getConcated(args, " "); + listDefinitions(sender,concated, concated.replaceAll(" ","_"),concated.replaceAll("_"," ")); + } + } + } + + private void listDefinitions(ICommandSender sender,String raw, String unlocalized,String localized) { + sender.addChatMessage(new ChatComponentText(" Available Direct: tag - name symbol")); + for (EMType directType : TecTech.definitionsRegistry.getDirectTypes().values()) { + if ("*".equals(raw) || localized.equalsIgnoreCase(directType.getLocalizedName()) || unlocalized.equalsIgnoreCase(directType.getUnlocalizedName())) { + directType.getDefinitions().forEach((bind, definition) -> + sender.addChatMessage(new ChatComponentText(bind + " - " + definition.getLocalizedName() + " " + definition.getSymbol()))); + } + } + } + + private void listClasses(ICommandSender sender) { + sender.addChatMessage(new ChatComponentText(" Available Direct: name (use as parameter to learn more")); + TecTech.definitionsRegistry.getDirectTypes().forEach((aClass, emDirectType) -> + sender.addChatMessage(new ChatComponentText(emDirectType.getLocalizedName()))); + sender.addChatMessage(new ChatComponentText(" Available Indirect: tag - name")); + TecTech.definitionsRegistry.getIndirectBinds().forEach((bind, emIndirectType) -> + sender.addChatMessage(new ChatComponentText(bind+" - "+emIndirectType.getLocalizedName()))); + } + + @Override + public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) { + return false; + } + + @Override + public List<String> getCommandAliases() { + return aliases; + } + + @Override + public String getCommandName() { + return aliases.get(0); + } + + @Override + public List<String> addTabCompletionOptions(ICommandSender sender, String[] args) { + if(args.length==1){ + return TecTech.definitionsRegistry.getDirectTypes().values().stream().map(EMType::getLocalizedName).map(s->s.replaceAll(" ","_")).collect(Collectors.toList()); + } + return null; + } + + @Override + public String getCommandUsage(ICommandSender p_71518_1_) { + return "em_list (optional Direct Name or *)"; + } + + @Override + public int compareTo(Object o) { + if(o instanceof ICommand){ + return getCommandName().compareTo(((ICommand) o).getCommandName()); + } + return 0; + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender sender) { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java deleted file mode 100644 index de1934fed7..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.commands; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalMutableDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentText; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; - -/** - * Created by danie_000 on 30.12.2017. - */ -public class GiveEM implements ICommand { - ArrayList<String> aliases=new ArrayList<>(); - - public GiveEM(){ - aliases.add("em_give"); - aliases.add("give_em"); - aliases.add("gib_em"); - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (sender instanceof EntityPlayerMP && !sender.getEntityWorld().isRemote) { - if(args.length < 3) { - sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); - }else{ - TecTech.LOGGER.info("Spawninig EM for "+((EntityPlayerMP) sender).getDisplayName()+" - "+Arrays.toString(args)); - - ArrayList<String> list = new ArrayList<>(Arrays.asList(args)); - String energy=list.remove(0); - - cElementalDefinitionStack def= getDefinitionStack(list); - if(def!=null) { - cElementalInstanceStack instanceStack = new cElementalInstanceStack(def, 1, 0, Long.parseLong(energy)); - - sender.addChatMessage(new ChatComponentText(instanceStack.definition.getSymbol() + " - " + instanceStack.definition.getName())); - - cElementalInstanceStackMap instanceMap = new cElementalInstanceStackMap(instanceStack); - - ItemStack itemStack = new ItemStack(DebugElementalInstanceContainer_EM.INSTANCE); - NBTTagCompound contents = new NBTTagCompound(); - contents.setTag("info", instanceMap.getInfoNBT()); - contents.setTag("content", instanceMap.toNBT()); - itemStack.setTagCompound(contents); - - ((EntityPlayerMP) sender).inventory.addItemStackToInventory(itemStack); - } - } - } - } - - private cElementalDefinitionStack getDefinitionStack(ArrayList<String> args){ - if(args.get(0).equals("<")){ - args.remove(0); - return null; - } - long amount=Long.parseLong(args.remove(0)); - try{ - int id=Integer.parseInt(args.get(0)); - args.remove(0); - iElementalDefinition primitive=cElementalPrimitive.getBindsPrimitive().get(id); - return new cElementalDefinitionStack(primitive,amount); - }catch (NumberFormatException e){ - byte clazz = (byte) args.remove(0).charAt(0); - Method constructor = cElementalDefinition.getBindsComplex().get(clazz); - - cElementalMutableDefinitionStackMap stacks=new cElementalMutableDefinitionStackMap(); - while(args.size()>0){ - cElementalDefinitionStack tempStack=getDefinitionStack(args); - if(tempStack==null) { - break; - }else { - stacks.putUnify(tempStack); - } - } - - try { - return ((iElementalDefinition) constructor.invoke(null, stacks.toNBT())).getStackForm(amount); - } catch (Exception e1) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return nbtE__.getStackForm(amount); - } - } - } - - @Override - public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) { - return false; - } - - @Override - public List<String> getCommandAliases() { - return aliases; - } - - @Override - public String getCommandName() { - return aliases.get(0); - } - - @Override - public List<String> addTabCompletionOptions(ICommandSender sender, String[] args) { - if(args.length==2){ - return completionsForClassOrID(); - } - return null; - } - - private List<String> completionsForClassOrID(){ - ArrayList<String> strings=new ArrayList<>(8); - Map<Byte,Method> binds= cElementalDefinition.getBindsComplex(); - for (Map.Entry<Byte,Method> e:binds.entrySet()) { - strings.add(String.valueOf((char)e.getKey().byteValue())); - } - Map<Integer, cElementalPrimitive> bindsBO = cElementalPrimitive.getBindsPrimitive(); - for (Map.Entry<Integer,cElementalPrimitive> e:bindsBO.entrySet()) { - strings.add(String.valueOf(e.getKey().byteValue())); - } - return strings; - } - - @Override - public String getCommandUsage(ICommandSender p_71518_1_) { - return "em_give Energy Count ClassOrId (Count ClassOrId ... <)"; - } - - @Override - public int compareTo(Object o) { - if(o instanceof ICommand){ - return getCommandName().compareTo(((ICommand) o).getCommandName()); - } - return 0; - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/ListEM.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/ListEM.java deleted file mode 100644 index 20110c0b0d..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/ListEM.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.commands; - -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.util.ChatComponentText; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * Created by danie_000 on 30.12.2017. - */ -public class ListEM implements ICommand { - ArrayList<String> aliases=new ArrayList<>(); - - public ListEM(){ - aliases.add("em_list"); - aliases.add("list_em"); - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (!sender.getEntityWorld().isRemote) { - if(args.length == 0) { - sender.addChatMessage(new ChatComponentText(" Available Classes: tag - name")); - Map<Byte,Method> binds= cElementalDefinition.getBindsComplex(); - for (Map.Entry<Byte,Method> e:binds.entrySet()) { - sender.addChatMessage(new ChatComponentText((char) e.getKey().byteValue() +" - "+e.getValue().getReturnType().getSimpleName())); - } - }else if(args.length==1){ - sender.addChatMessage(new ChatComponentText(" Available Primitives: symbol - name")); - if(args[0].equals(String.valueOf((char)cElementalPrimitive.nbtType))){ - Map<Integer, cElementalPrimitive> bindsBO = cElementalPrimitive.getBindsPrimitive(); - for (Map.Entry<Integer,cElementalPrimitive> e:bindsBO.entrySet()) { - sender.addChatMessage(new ChatComponentText(e.getKey() + " - "+e.getValue().getName())); - } - }else{ - sender.addChatMessage(new ChatComponentText("Complex definition - needs contents")); - } - }else{ - sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); - } - } - } - - @Override - public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) { - return false; - } - - @Override - public List<String> getCommandAliases() { - return aliases; - } - - @Override - public String getCommandName() { - return aliases.get(0); - } - - @Override - public List<String> addTabCompletionOptions(ICommandSender sender, String[] args) { - if(args.length==0){ - Map<Byte,Method> binds= cElementalDefinition.getBindsComplex(); - ArrayList<String> strings=new ArrayList<>(binds.size()); - for (Map.Entry<Byte,Method> e:binds.entrySet()) { - strings.add(String.valueOf((char)e.getKey().byteValue())+' '+e.getValue().getReturnType().getSimpleName()); - } - return strings; - } - return null; - } - - @Override - public String getCommandUsage(ICommandSender p_71518_1_) { - return "em_list (optional class tag)"; - } - - @Override - public int compareTo(Object o) { - if(o instanceof ICommand){ - return getCommandName().compareTo(((ICommand) o).getCommandName()); - } - return 0; - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java new file mode 100644 index 0000000000..a6bd623414 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecay.java @@ -0,0 +1,90 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.decay; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; + +import static com.github.technus.tectech.util.DoubleCount.mul; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class EMDecay { + public static final EMDecay[] NO_DECAY = null; + //DECAY IMPOSSIBLE!!! + //Do not use regular NULL java will not make it work with varargs!!! + //Or cast null into ARRAY type but this static is more convenient!!! + public static final EMDecay[] NO_PRODUCT = new EMDecay[0]; + //this in turn can be used to tell that the thing should just vanish + private final EMConstantStackMap outputStacks; + private final double probability; + + public EMDecay(IEMDefinition... outSafe) { + this(1D, outSafe); + } + + public EMDecay(double probability, IEMDefinition... outSafe) { + EMDefinitionStack[] outArr = new EMDefinitionStack[outSafe.length]; + for (int i = 0; i < outArr.length; i++) { + outArr[i] = new EMDefinitionStack(outSafe[i], 1D); + } + outputStacks = new EMConstantStackMap(outArr); + this.probability = probability; + } + + public EMDecay(EMDefinitionStack... outSafe) { + this(1D, outSafe); + } + + public EMDecay(double probability, EMDefinitionStack... out) { + outputStacks = new EMConstantStackMap(out); + this.probability = probability; + } + + public EMDecay(EMConstantStackMap tree) { + this(1D, tree); + } + + public EMDecay(double probability, EMConstantStackMap tree) { + outputStacks = tree; + this.probability = probability; + } + + public EMInstanceStackMap getResults(double lifeMult, double age, long newEnergyLevel, double amountDecaying) { + EMInstanceStackMap decayResult = new EMInstanceStackMap(); + if (getOutputStacks() == null) { + return decayResult;//This is to prevent null pointer exceptions. + } + //Deny decay code is in instance! + boolean empty=true; + for (EMDefinitionStack stack : getOutputStacks().valuesToArray()) { + if(stack.getAmount() >0){ + empty=false; + break; + } + } + if (empty) { + return decayResult; + } + //newEnergyLevel /= qtty; + //lifeMult /= (float) qtty; + for (EMDefinitionStack stack : getOutputStacks().valuesToArray()) { + decayResult.putUnify(new EMInstanceStack(stack.getDefinition(), + mul(amountDecaying, stack.getAmount()), + lifeMult, + age/*new products*/, + (long)(newEnergyLevel / Math.max(1D, Math.abs(stack.getAmount())))));//get instances from stack + } + return decayResult; + } + + public EMConstantStackMap getOutputStacks() { + return outputStacks; + } + + public double getProbability() { + return probability; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java new file mode 100644 index 0000000000..0a00a519f9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/decay/EMDecayResult.java @@ -0,0 +1,45 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.decay; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; + +public class EMDecayResult { + private final EMInstanceStackMap output; + private double massAffected; + private double massDiff; + + public EMDecayResult(EMInstanceStackMap output, double massAffected, double massDiff) { + this.output = output; + this.massAffected = massAffected; + this.massDiff = massDiff; + } + + public EMInstanceStackMap getOutput() { + return output; + } + + /** + * How much was lost in the process (decayed or removed) + * + * @return + */ + public double getMassAffected() { + return massAffected; + } + + /** + * Difference of mass of actually decayed elements + * + * @return + */ + public double getMassDiff() { + return massDiff; + } + + public void setMassAffected(double massAffected) { + this.massAffected = massAffected; + } + + public void setMassDiff(double massDiff) { + this.massDiff = massDiff; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java new file mode 100644 index 0000000000..13838cf443 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMComplexTemplate.java @@ -0,0 +1,67 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; + +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import net.minecraft.nbt.NBTTagCompound; + +/** + * Created by danie_000 on 23.01.2017. + */ +public abstract class EMComplexTemplate implements IEMDefinition { + /** + * Just empty array? + */ + public static final IEMDefinition[] nothing = new EMPrimitiveTemplate[0]; + + @Override + public final EMComplexTemplate clone() { + return this;//IMMUTABLE + } + + @Override + public int compareTo(IEMDefinition o) { + int classCompare = compareClassID(o); + if (classCompare != 0) { + return classCompare; + } + //that allows neat check if the same thing and + //top hierarchy amount can be used to store amount info + return getSubParticles().compareWithAmountsInternal(o.getSubParticles()); + } + + @Override + public final boolean equals(Object obj) { + if(this==obj) { + return true; + } + if (obj instanceof IEMDefinition) { + return compareTo((IEMDefinition) obj) == 0; + } + if (obj instanceof IEMStack) { + return compareTo(((IEMStack) obj).getDefinition()) == 0; + } + return false; + } + + @Override + public int hashCode() {//Internal amounts should be also hashed + int hash = -(getSubParticles().size() << 16); + for (EMDefinitionStack stack : getSubParticles().valuesToArray()) { + int amount=(int) stack.getAmount(); + hash += ((amount & 0x1) == 0 ? -amount : amount) * (stack.getDefinition().hashCode()<<4); + } + return hash; + } + + @Override + public String toString() { + return getLocalizedName()+ " " + getSymbol(); + } + + public NBTTagCompound toNBT(EMDefinitionsRegistry registry) { + return registry.indirectToNBT(getIndirectTagValue(),getSubParticles()); + } + + protected abstract String getIndirectTagValue(); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java new file mode 100644 index 0000000000..a1f606c3c2 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/EMPrimitiveTemplate.java @@ -0,0 +1,233 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; + +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.ArrayList; + +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static com.github.technus.tectech.util.Util.areBitsSet; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 22.10.2016. + * EXTEND THIS TO ADD NEW PRIMITIVES, WATCH OUT FOR ID'S!!! + */ +public abstract class EMPrimitiveTemplate extends EMComplexTemplate { + private final String name; + private final String symbol; + //float-mass in eV/c^2 + private final double mass; + //int -electric charge in 1/3rds of electron charge for optimization + private final int charge; + //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) + private final int color; + //-1/-2/-3 anti matter generations, +1/+2/+3 matter generations, 0 self anti + private final int generation; + + private IEMDefinition anti;//IMMUTABLE + private EMDecay[] elementalDecays; + private byte naturalDecayInstant; + private byte energeticDecayInstant; + private double rawLifeTime; + + private final int ID; + private final String bind; + + //no _ at end - normal particle + // _ at end - anti particle + // __ at end - self is antiparticle + + protected EMPrimitiveTemplate(String name, String symbol, int generation, double mass, int charge, int color, int ID, String bind) { + this.name = name; + this.symbol = symbol; + this.generation = generation; + this.mass = mass; + this.charge = charge; + this.color = color; + this.ID = ID; + this.bind=bind; + } + + // + protected void init(EMDefinitionsRegistry registry,IEMDefinition antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, EMDecay... elementalDecaysArray) { + anti = antiParticle; + this.rawLifeTime = rawLifeTime; + naturalDecayInstant = (byte) naturalInstant; + energeticDecayInstant = (byte) energeticInstant; + elementalDecays =elementalDecaysArray; + registry.registerForDisplay(this); + registry.registerDirectDefinition(bind,this); + } + + @Override + public String getSymbol() { + return symbol; + } + + @Override + public String getShortSymbol() { + return getSymbol(); + } + + @Override + public String getShortLocalizedName() { + return translateToLocal(getUnlocalizedName()); + } + + @Override + public IEMDefinition getAnti() { + return anti;//no need for copy + } + + @Override + public int getCharge() { + return charge; + } + + @Override + public int getMaxColors() { + return color; + } + + @Override + public double getMass() { + return mass; + } + + @Override + public EMDecay[] getNaturalDecayInstant() { + if (naturalDecayInstant < 0) { + return elementalDecays; + }else if (naturalDecayInstant>=elementalDecays.length){ + return EMDecay.NO_PRODUCT; + } + return new EMDecay[]{elementalDecays[naturalDecayInstant]}; + } + + @Override + public EMDecay[] getEnergyInducedDecay(long energyLevel) { + if (energeticDecayInstant < 0) { + return elementalDecays; + }else if (energeticDecayInstant>=elementalDecays.length){ + return EMDecay.NO_PRODUCT; + } + return new EMDecay[]{elementalDecays[energeticDecayInstant]}; + } + + @Override + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return false; + } + + @Override + public boolean usesMultipleDecayCalls(long energyLevel) { + return false; + } + + @Override + public boolean decayMakesEnergy(long energyLevel) { + return false; + } + + @Override + public boolean fusionMakesEnergy(long energyLevel) { + return false; + } + + @Override + public EMDecay[] getDecayArray() { + return elementalDecays; + } + + @Override + public double getRawTimeSpan(long currentEnergy) { + return rawLifeTime; + } + + @Override + public final EMConstantStackMap getSubParticles() { + return null; + } + + @Override + public int getGeneration() { + return generation; + } + + @Override + public final NBTTagCompound toNBT(EMDefinitionsRegistry registry) { + return registry.directToNBT(bind); + } + + @Override + protected final String getIndirectTagValue() { + throw new EMException("This class should only be used directly!"); + } + + @Override + public final int getMatterMassType() { + return getClassTypeStatic(); + } + + public static int getClassTypeStatic(){ + return Short.MIN_VALUE; + } + + @Override + public void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel) { + if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add(getShortSymbol()); + } + } + + @Override + public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { + if(areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { + lines.add("DIRECT = " + bind + ' ' + getMatterMassType()); + } + if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("NAME = "+ getLocalizedName()); + lines.add("SYMBOL = "+getSymbol()); + } + if(areBitsSet(SCAN_GET_CHARGE,capabilities)) { + lines.add("CHARGE = " + getCharge() / 3D + " e"); + } + if(areBitsSet(SCAN_GET_COLOR,capabilities)) { + lines.add(hasColor() ? "COLORLESS" : "CARRIES COLOR"); + } + if(areBitsSet(SCAN_GET_MASS,capabilities)) { + lines.add("MASS = " + getMass() + " eV/c\u00b2"); + } + if(areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ + lines.add((isTimeSpanHalfLife()?"HALF LIFE = ":"LIFE TIME = ")+getRawTimeSpan(energyLevel)+ " s"); + lines.add(" "+"At current energy level"); + } + } + + @Override + public final int compareTo(IEMDefinition o) { + if (getMatterMassType() == o.getMatterMassType()) { + int oID = ((EMPrimitiveTemplate) o).ID; + return Integer.compare(ID, oID); + } + return compareClassID(o); + } + + @Override + public final int hashCode() { + return ID; + } + + public String getUnlocalizedName() { + return name; + } +}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java new file mode 100644 index 0000000000..aae5a8caca --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/IEMDefinition.java @@ -0,0 +1,91 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.ArrayList; + +/** + * Created by danie_000 on 11.11.2016. + */ +public interface IEMDefinition extends Comparable<IEMDefinition>,Cloneable {//IMMUTABLE + double STABLE_RAW_LIFE_TIME =1.5e36D; + double NO_DECAY_RAW_LIFE_TIME =-1D; + long DEFAULT_ENERGY_LEVEL =0; + double DEFAULT_ENERGY_REQUIREMENT =25000D;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels + //add text based creators for recipe formula input? + + //Nomenclature + String getLocalizedTypeName(); + + String getShortLocalizedName(); + + default String getLocalizedName(){ + return getLocalizedTypeName()+": "+getShortLocalizedName(); + } + + String getShortSymbol(); + + String getSymbol(); + + void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel); + + void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel); + + int getMatterMassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED + + int getGeneration(); + + //Not dynamically changing stuff + IEMDefinition getAnti();//gives new anti particle def + + EMDecay[] getDecayArray();//possible decays + + EMDecay[] getNaturalDecayInstant();//natural decay if lifespan <1tick + + EMDecay[] getEnergyInducedDecay(long energyLevel);//energetic decay + + boolean usesSpecialEnergeticDecayHandling(); + + boolean usesMultipleDecayCalls(long energyLevel); + + boolean decayMakesEnergy(long energyLevel); + + boolean fusionMakesEnergy(long energyLevel); + + double getEnergyDiffBetweenStates(long currentEnergy, long newEnergyLevel);//positive or negative + + double getMass();//mass... MeV/c^2 + + int getCharge();//charge 1/3 electron charge + + //dynamically changing stuff + int getMaxColors(); + + default boolean hasColor(){ + return getMaxColors()>0; + } + + double getRawTimeSpan(long currentEnergy);//defined in static fields or generated + + boolean isTimeSpanHalfLife(); + + EMConstantStackMap getSubParticles();//contents... null if none + + NBTTagCompound toNBT(EMDefinitionsRegistry registry); + + default EMDefinitionStack getStackForm(double amount){ + return new EMDefinitionStack(this,amount); + } + + default IEMDefinition clone(){ + return this; + } + + default int compareClassID(IEMDefinition obj) { + return getMatterMassType() - obj.getMatterMassType(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java new file mode 100644 index 0000000000..458965da66 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMDefinitionsRegistry.java @@ -0,0 +1,189 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry; + +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.IEMMapRead; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.*; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; + +public class EMDefinitionsRegistry { + private static final String TAG_NAME = "EM"; + + private final NavigableSet<IEMDefinition> stacksRegistered = new TreeSet<>(); + + private final Map<Integer, IEMDefinition> hashMap = new HashMap<>(); + private final Map<Integer, IEMDefinition> hashMapR = Collections.unmodifiableMap(hashMap); + + private final Map<Class<? extends IEMDefinition>, EMType> types = new HashMap<>(); + private final Map<Class<? extends IEMDefinition>, EMType> typesR = Collections.unmodifiableMap(types); + private final Map<Class<? extends IEMDefinition>, EMType> directTypes = new HashMap<>(); + private final Map<Class<? extends IEMDefinition>, EMType> directTypesR = Collections.unmodifiableMap(directTypes); + private final Map<Class<? extends IEMDefinition>, EMIndirectType> indirectTypes = new HashMap<>(); + private final Map<Class<? extends IEMDefinition>, EMIndirectType> indirectTypesR = Collections.unmodifiableMap(indirectTypes); + + private final Map<String, EMType> binds = new HashMap<>(); + private final Map<String, EMType> bindsR = Collections.unmodifiableMap(binds); + private final Map<String, IEMDefinition> directBinds = new HashMap<>(); + private final Map<String, IEMDefinition> directBindsR = Collections.unmodifiableMap(directBinds); + private final Map<String, EMIndirectType> indirectBinds = new HashMap<>(); + private final Map<String, EMIndirectType> indirectBindsR = Collections.unmodifiableMap(indirectBinds); + + public NBTTagCompound directToNBT(String bind) { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setString(TAG_NAME, bind); + return nbt; + } + + public NBTTagCompound indirectToNBT(String bind, IEMMapRead<EMDefinitionStack> content) { + NBTTagCompound nbt = content.toNBT(this); + nbt.setString(TAG_NAME, bind); + return nbt; + } + + public IEMDefinition fromNBT(NBTTagCompound nbt) { + IEMDefinition definition; + try { + String bind = nbt.getString(TAG_NAME); + definition = directBinds.get(bind); + if (definition == null) { + definition = indirectBinds.get(bind).create(this, nbt); + } + } catch (Exception e) { + EMException emException = new EMException("Failed to create from: " + nbt.toString(), e); + if (DEBUG_MODE) { + emException.printStackTrace(); + return nbtE__; + } else { + throw emException; + } + } + if (!DEBUG_MODE) { + if (definition == nbtE__) { + throw new EMException("Deserialized to NBT ERROR!"); + } else if (definition == null) { + throw new EMException("Deserialized to NULL POINTER!"); + } else if (definition == null__) { + throw new EMException("Deserialized to NULL!"); + } + } + if (definition == null) { + return null__; + } + return definition; + } + + public boolean isOccupied(String bind) { + return binds.containsKey(bind); + } + + protected void addType(EMType emType) { + if (types.put(emType.getClazz(), emType) != null) { + EMException e = new EMException("Class collision! " + emType.getClazz().getName()); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + } + + protected void bindType(String bind, EMType emType) { + if (binds.put(bind, emType) != null) { + EMException e = new EMException("NBT Bind collision! " + bind); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + } + + public void registerDefinitionClass(String bind, EMIndirectType emIndirectType) { + addType(emIndirectType); + indirectTypes.put(emIndirectType.getClazz(), emIndirectType); + bindType(bind, emIndirectType); + indirectBinds.put(bind, emIndirectType); + } + + public void registerDefinitionClass(EMType emDirectType) { + addType(emDirectType); + } + + public void registerDirectDefinition(String bind, IEMDefinition definition) { + if (hashMap.put(definition.hashCode(), definition) != null) { + EMException e = new EMException("Hash collision! " + definition.hashCode()); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + EMType emType = directTypes.get(definition.getClass()); + if (emType == null) { + emType = types.get(definition.getClass()); + if (emType != null) { + directTypes.put(definition.getClass(), emType); + } else { + EMException e = new EMException("Direct Type bind missing! " + definition.getClass().getName()); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + } + if (emType != null) { + directTypes.put(definition.getClass(), emType); + bindType(bind, emType); + emType.addDefinition(bind, definition); + directBinds.put(bind, definition); + } + } + + public void registerForDisplay(IEMDefinition definition) { + stacksRegistered.add(definition); + IEMDefinition anti = definition.getAnti(); + if (anti != null) { + stacksRegistered.add(anti); + } + } + + @Deprecated + public Map<Integer, IEMDefinition> getHashMapping() { + return hashMapR; + } + + public NavigableSet<IEMDefinition> getStacksRegisteredForDisplay() { + return stacksRegistered; + } + + public Map<String, EMType> getBinds() { + return bindsR; + } + + public Map<String, IEMDefinition> getDirectBinds() { + return directBindsR; + } + + public Map<String, EMIndirectType> getIndirectBinds() { + return indirectBindsR; + } + + public Map<Class<? extends IEMDefinition>, EMType> getTypes() { + return typesR; + } + + public Map<Class<? extends IEMDefinition>, EMType> getDirectTypes() { + return directTypesR; + } + + public Map<Class<? extends IEMDefinition>, EMIndirectType> getIndirectTypes() { + return indirectTypesR; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java new file mode 100644 index 0000000000..680dd029a4 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMIndirectType.java @@ -0,0 +1,37 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry; + +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.function.BiFunction; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; + +public class EMIndirectType extends EMType { + private final BiFunction<EMDefinitionsRegistry, NBTTagCompound, IEMDefinition> creator; + + public EMIndirectType(BiFunction<EMDefinitionsRegistry, NBTTagCompound, IEMDefinition> creator, Class<? extends IEMDefinition> clazz, String unlocalizedName) { + super(clazz, unlocalizedName); + this.creator = creator; + } + + protected BiFunction<EMDefinitionsRegistry,NBTTagCompound, IEMDefinition> getCreator() { + return creator; + } + + public IEMDefinition create(EMDefinitionsRegistry registry,NBTTagCompound nbt){ + try { + return creator.apply(registry, nbt); + }catch (Exception e){ + EMException emException = new EMException("Failed to create from: " + nbt.toString(), e); + if (DEBUG_MODE) { + emException.printStackTrace(); + return nbtE__; + } else { + throw emException; + } + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java new file mode 100644 index 0000000000..73097db663 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/definitions/registry/EMType.java @@ -0,0 +1,63 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry; + +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static net.minecraft.util.StatCollector.translateToLocal; + +public class EMType { + private final Map<String, IEMDefinition> definitions = new HashMap<>(); + private final Map<String, IEMDefinition> definitionsR = Collections.unmodifiableMap(definitions); + private final Class<? extends IEMDefinition> clazz; + private final String unlocalizedName; + + public EMType(Class<? extends IEMDefinition> clazz, String unlocalizedName) { + this.clazz = clazz; + this.unlocalizedName = unlocalizedName; + } + + public Class<? extends IEMDefinition> getClazz() { + return clazz; + } + + public String getUnlocalizedName() { + return unlocalizedName; + } + + public String getLocalizedName() { + return translateToLocal(getUnlocalizedName()); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + return clazz==((EMType) o).clazz; + } + + @Override + public int hashCode() { + return clazz.hashCode(); + } + + public void addDefinition(String bind, IEMDefinition definition) { + if (definitions.put(bind, definition) != null) { + EMException e = new EMException("NBT Bind collision on Direct bind!"); + if (DEBUG_MODE) { + e.printStackTrace(); + } else { + throw e; + } + } + } + + public Map<String, IEMDefinition> getDefinitions() { + return definitionsR; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java deleted file mode 100644 index 20fe1ffc5b..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -/** - * Created by danie_000 on 25.01.2017. - */ -public interface iElementalInstanceContainer extends Cloneable { - cElementalInstanceStackMap getContainerHandler(); - - void purgeOverflow(); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java new file mode 100644 index 0000000000..f6bef9910e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMConstantStackMap.java @@ -0,0 +1,59 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.Collections; +import java.util.NavigableMap; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; + +/** + * Created by Tec on 12.05.2017. + */ +public final class EMConstantStackMap/*IMMUTABLE*/ extends EMStackMap<EMDefinitionStack> {//Target class for construction of definitions/recipes + //Constructors + Clone, all make a whole new OBJ. + public static final EMConstantStackMap EMPTY = new EMConstantStackMap(); + + private EMConstantStackMap() { + super(Collections.emptyNavigableMap()); + } + + public EMConstantStackMap(EMDefinitionStack... in) { + this(new EMDefinitionStackMap(in).getBackingMap()); + } + + public EMConstantStackMap(NavigableMap<IEMDefinition, EMDefinitionStack> in) { + super(Collections.unmodifiableNavigableMap(in)); + } + + @Override + public Class<EMDefinitionStack> getType() { + return EMDefinitionStack.class; + } + + //IMMUTABLE DON'T NEED IT + @Override + public EMConstantStackMap clone() { + return this; + } + + public EMDefinitionStackMap toMutable() { + return new EMDefinitionStackMap(new TreeMap<>(getBackingMap())); + } + + public static EMConstantStackMap fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) throws EMException { + EMDefinitionStack[] defStacks = new EMDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < defStacks.length; i++) { + defStacks[i] = EMDefinitionStack.fromNBT(registry,nbt.getCompoundTag(Integer.toString(i))); + if (defStacks[i].getDefinition().equals(nbtE__)) { + throw new EMException("Something went Wrong"); + } + } + return new EMConstantStackMap(defStacks); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java new file mode 100644 index 0000000000..57b8f7bf1c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMDefinitionStackMap.java @@ -0,0 +1,57 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.NavigableMap; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; + +/** + * Created by danie_000 on 22.01.2017. + */ +public final class EMDefinitionStackMap extends EMStackMap<EMDefinitionStack> implements IEMMapWriteExact<EMDefinitionStack> {//Transient class for construction of definitions/recipes + //Constructors + Clone, all make a whole new OBJ. + public EMDefinitionStackMap() {} + + public EMDefinitionStackMap(EMDefinitionStack... in) { + putUnifyAllExact(in); + } + + public EMDefinitionStackMap(NavigableMap<IEMDefinition, EMDefinitionStack> in) { + super(in); + } + + @Override + public Class<EMDefinitionStack> getType() { + return EMDefinitionStack.class; + } + + @Override + public EMDefinitionStackMap clone() { + return new EMDefinitionStackMap(new TreeMap<>(getBackingMap())); + } + + public EMConstantStackMap toImmutable() { + return new EMConstantStackMap(new TreeMap<>(getBackingMap())); + } + + public EMConstantStackMap toImmutable_optimized_unsafe_LeavesExposedElementalTree() { + return new EMConstantStackMap(getBackingMap()); + } + + public static EMDefinitionStackMap fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) throws EMException { + EMDefinitionStack[] defStacks = new EMDefinitionStack[nbt.getInteger("i")]; + for (int i = 0; i < defStacks.length; i++) { + defStacks[i] = EMDefinitionStack.fromNBT(registry,nbt.getCompoundTag(Integer.toString(i))); + if (defStacks[i].getDefinition().equals(nbtE__)) { + throw new EMException("Something went Wrong"); + } + } + return new EMDefinitionStackMap(defStacks); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java new file mode 100644 index 0000000000..265d219168 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMInstanceStackMap.java @@ -0,0 +1,245 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + +import java.util.ArrayList; +import java.util.Map; +import java.util.NavigableMap; +import java.util.TreeMap; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.util.DoubleCount.add; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 22.01.2017. + */ +public final class EMInstanceStackMap extends EMStackMap<EMInstanceStack> implements IEMMapWrite<EMInstanceStack> { + //Constructors + public EMInstanceStackMap() {} + + public EMInstanceStackMap(EMInstanceStack... inSafe) { + this(true, inSafe); + } + + public EMInstanceStackMap(boolean clone, EMInstanceStack... in) { + if (clone) { + EMInstanceStack[] stacks =new EMInstanceStack[in.length]; + for(int i=0;i<stacks.length;i++) { + stacks[i] = in[i].clone(); + } + putUnifyAll(stacks); + } else { + putUnifyAll(in); + } + } + + private EMInstanceStackMap(NavigableMap<IEMDefinition, EMInstanceStack> inSafe) { + this(true, inSafe); + } + + private EMInstanceStackMap(boolean clone, NavigableMap<IEMDefinition, EMInstanceStack> in) { + super(clone?new TreeMap<>():in); + if (clone) { + for(EMInstanceStack stack:in.values()) { + putUnify(stack.clone()); + } + } + } + + @Override + public Class<EMInstanceStack> getType() { + return EMInstanceStack.class; + } + + @Override + public EMInstanceStackMap clone() { + return new EMInstanceStackMap(getBackingMap()); + } + + //Remove overflow + public double removeOverflow(int stacksCount, double stackCapacity) { + double massRemoved = 0; + + if (getBackingMap().size() > stacksCount) { + IEMDefinition[] keys = keySetToArray(); + for (int i = stacksCount; i < keys.length; i++) { + massRemoved += getBackingMap().get(keys[i]).getDefinitionStack().getMass(); + getBackingMap().remove(keys[i]); + } + } + + for (EMInstanceStack instance : valuesToArray()) { + if (instance.getAmount() > stackCapacity) { + massRemoved += instance.getDefinition().getMass() * (instance.getAmount() - stackCapacity); + instance.setAmount(stackCapacity); + } + } + return massRemoved; + } + + //Getters + public String[] getElementalInfo() { + String[] info = new String[getBackingMap().size()]; + int i = 0; + for (EMInstanceStack instance : getBackingMap().values()) { + info[i++] = EnumChatFormatting.BLUE + instance.getDefinition().getLocalizedName()+ + " "+ EnumChatFormatting.AQUA + instance.getDefinition().getSymbol()+ EnumChatFormatting.RESET+ + " #: " + EnumChatFormatting.GREEN + String.format("%.3E", instance.getAmount() /AVOGADRO_CONSTANT) +" "+translateToLocal("tt.keyword.mol")+ EnumChatFormatting.RESET+ + " E: " + EnumChatFormatting.GREEN + instance.getEnergy() + EnumChatFormatting.RESET+ + " T: " + EnumChatFormatting.GREEN + (instance.getLifeTime()<0?"STABLE":String.format("%.3E",instance.getLifeTime())); + } + return info; + } + + public ArrayList<String> getScanShortSymbols(int[] capabilities) { + ArrayList<String> list=new ArrayList<>(16); + for(Map.Entry<IEMDefinition, EMInstanceStack> e: getBackingMap().entrySet()){ + e.getValue().addScanShortSymbols(list,capabilities); + } + return list; + } + + public ArrayList<String> getScanInfo(int[] capabilities) { + ArrayList<String> list=new ArrayList<>(16); + for(Map.Entry<IEMDefinition, EMInstanceStack> e: getBackingMap().entrySet()){ + e.getValue().addScanResults(list,capabilities); + } + return list; + } + + public double tickContent(double lifeTimeMult, int postEnergize, double seconds){ + //cleanUp(); + double diff=0; + for (EMInstanceStack instance : takeAllToArray()) { + instance.setAge(instance.getAge() + seconds); + EMDecayResult newInstances = instance.decay(lifeTimeMult, instance.getAge(), postEnergize); + if (newInstances == null) { + putUnify(instance); + } else { + diff=add(diff,newInstances.getMassDiff()); + putUnifyAll(newInstances.getOutput()); + } + } + return diff; + } + + //NBT + public NBTTagCompound getScanShortSymbolsNBT(int[] capabilities) { + NBTTagCompound nbt = new NBTTagCompound(); + ArrayList<String> info = getScanShortSymbols(capabilities); + nbt.setInteger("i", info.size()); + for (int i = 0; i < info.size(); i++) { + nbt.setString(Integer.toString(i), info.get(i)); + } + return nbt; + } + + public NBTTagCompound getScanInfoNBT(int[] capabilities) { + NBTTagCompound nbt = new NBTTagCompound(); + ArrayList<String> info = getScanInfo(capabilities); + nbt.setInteger("i", info.size()); + for (int i = 0; i < info.size(); i++) { + nbt.setString(Integer.toString(i), info.get(i)); + } + return nbt; + } + + public static EMInstanceStackMap fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) throws EMException { + EMInstanceStack[] instances = new EMInstanceStack[nbt.getInteger("i")]; + for (int i = 0; i < instances.length; i++) { + instances[i] = EMInstanceStack.fromNBT(registry,nbt.getCompoundTag(Integer.toString(i))); + if (instances[i].getDefinition().equals(nbtE__)) { + throw new EMException("Something went Wrong"); + } + } + return new EMInstanceStackMap(false, instances); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof EMInstanceStackMap) { + return compareTo((EMInstanceStackMap) obj) == 0; + } + if (obj instanceof EMStackMap) { + return toDefinitionMapForComparison().compareTo((EMStackMap<?>) obj) == 0; + } + return false; + } + + @Override + public String toString() { + StringBuilder build=new StringBuilder("Instance Stack Map\n"); + for(EMInstanceStack stack: getBackingMap().values()){ + build.append(stack.toString()).append('\n'); + } + return build.toString(); + } + + public EMInstanceStack[] takeAllToArray(){ + EMInstanceStack[] newStack = valuesToArray();//just in case to uncouple The map + this.getBackingMap().clear(); + return newStack; + } + + public EMInstanceStackMap takeAll(){ + EMInstanceStackMap newStack =new EMInstanceStackMap(false,new TreeMap<>(this.getBackingMap()));//just in case to uncouple The map + this.getBackingMap().clear(); + return newStack; + } + + public EMDefinitionStackMap toDefinitionMapForComparison() { + EMDefinitionStack[] list = new EMDefinitionStack[size()]; + int i = 0; + for (Map.Entry<IEMDefinition, EMInstanceStack> entry : entrySet()) { + EMInstanceStack value = entry.getValue(); + list[i++] = new EMDefinitionStack(value.getDefinition(), value.getAmount()); + } + return new EMDefinitionStackMap(list); + } + + @Override + public EMInstanceStack putUnify(EMInstanceStack stack) { + EMInstanceStack target =get(stack.getDefinition()); + if(target==null) { + putReplace(stack); + return stack; + } + double newAmount = add(target.getAmount(), stack.getAmount()); + if (IEMStack.isValidAmount(newAmount)) { + stack=target.unifyIntoThis(stack); + putReplace(stack); + return stack; + }else { + removeKey(stack); + return null; + } + } + + @Override + public EMInstanceStack putUnifyExact(EMInstanceStack stack) { + EMInstanceStack target =get(stack.getDefinition()); + if(target==null) { + putReplace(stack); + return stack; + } + double newAmount = target.getAmount()+stack.getAmount(); + if (IEMStack.isValidAmount(newAmount)) { + stack=target.unifyIntoThis(stack); + putReplace(stack); + return stack; + }else { + removeKey(stack); + return null; + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java new file mode 100644 index 0000000000..795ac3d3bf --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/EMStackMap.java @@ -0,0 +1,50 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; + +import java.util.NavigableMap; +import java.util.TreeMap; + +/** + * Created by Tec on 12.05.2017. + */ +abstract class EMStackMap<T extends IEMStack> implements IEMMapRead<T> { + private final NavigableMap<IEMDefinition, T> backingMap; + + protected EMStackMap() { + this(new TreeMap<>()); + } + + protected EMStackMap(NavigableMap<IEMDefinition, T> map) { + this.backingMap =map; + } + + @Override + public NavigableMap<IEMDefinition, T> getBackingMap() { + return backingMap; + } + + @Override + public abstract EMStackMap<T> clone(); + + @Override + public boolean equals(Object obj) { + if (obj instanceof EMInstanceStackMap) { + return compareTo(((EMInstanceStackMap) obj).toDefinitionMapForComparison()) == 0; + } + if (obj instanceof EMStackMap) { + return compareTo((EMStackMap) obj) == 0; + } + return false; + } + + @Override + public int hashCode() {//Hash only definitions to compare contents not amounts or data + int hash = -(getBackingMap().size() << 4); + for (T stack : getBackingMap().values()) { + hash += stack.getDefinition().hashCode(); + } + return hash; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java new file mode 100644 index 0000000000..c0420fa2b2 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapRead.java @@ -0,0 +1,302 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + +import java.lang.reflect.Array; +import java.util.*; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.*; +import static com.github.technus.tectech.util.DoubleCount.ulpSigned; +import static net.minecraft.util.StatCollector.translateToLocal; + +public interface IEMMapRead<T extends IEMStack> extends Comparable<IEMMapRead<?>>, Cloneable { + NavigableMap<IEMDefinition,T> getBackingMap(); + + IEMMapRead<T> clone(); + + default Set<Map.Entry<IEMDefinition, T>> entrySet(){ + return getBackingMap().entrySet(); + } + + default Set<IEMDefinition> keySet(){ + return getBackingMap().keySet(); + } + + default IEMDefinition[] keySetToArray() { + return keySetToArray(new IEMDefinition[size()]); + } + + default IEMDefinition[] keySetToArray(IEMDefinition[] array) { + return keySet().toArray(array); + } + + default Collection<T> values(){ + return getBackingMap().values(); + } + + @SuppressWarnings("unchecked") + default T[] valuesToArray(){ + return valuesToArray((T[]) Array.newInstance(getType(),size())); + } + + default T[] valuesToArray(T[] array){ + return values().toArray(array); + } + + Class<T> getType(); + + //Getters + default T getFirst(){ + return getBackingMap().firstEntry().getValue(); + } + + default T getLast(){ + return getBackingMap().lastEntry().getValue(); + } + + default T get(IEMStack stack) { + return get(stack.getDefinition()); + } + + default T get(IEMDefinition def) { + return getBackingMap().get(def); + } + + default T getNaturallySorted(int pos) { + if(pos<0 || pos>=size()){ + throw new IndexOutOfBoundsException("Index was: "+pos+" size was: "+size()); + } + for (Map.Entry<IEMDefinition, T> entry : entrySet()) { + if(pos==0){ + return entry.getValue(); + } + pos--; + } + return null; + } + + default T getRandom() { + return getNaturallySorted(TecTech.RANDOM.nextInt(size())); + } + + default String[] getShortSymbolsInfo() { + String[] info = new String[size()]; + int i = 0; + for (T instance : values()) { + info[i++] = instance.getDefinition().getShortSymbol(); + } + return info; + } + + default String[] getElementalInfo() { + String[] info = new String[size() * 3]; + int i = 0; + for (T defStack : values()) { + info[i] = EnumChatFormatting.BLUE + defStack.getDefinition().getLocalizedName(); + info[i + 1] = EnumChatFormatting.AQUA + defStack.getDefinition().getSymbol(); + info[i + 2] = "Amount " + EnumChatFormatting.GREEN + defStack.getAmount()/AVOGADRO_CONSTANT+" "+translateToLocal("tt.keyword.mol"); + i += 3; + } + return info; + } + + //NBT + default NBTTagCompound getShortSymbolsNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + String[] info = getShortSymbolsInfo(); + nbt.setInteger("i", info.length); + for (int i = 0; i < info.length; i++) { + nbt.setString(Integer.toString(i), info[i]); + } + return nbt; + } + + default NBTTagCompound getInfoNBT() { + NBTTagCompound nbt = new NBTTagCompound(); + String[] info = getElementalInfo(); + nbt.setInteger("i", info.length); + for (int i = 0; i < info.length; i++) { + nbt.setString(Integer.toString(i), info[i]); + } + return nbt; + } + + default NBTTagCompound toNBT(EMDefinitionsRegistry registry) { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setInteger("i", size()); + int i = 0; + for (Map.Entry<IEMDefinition, T> entry : entrySet()) { + nbt.setTag(Integer.toString(i++), entry.getValue().toNBT(registry)); + } + return nbt; + } + + @Override + default int compareTo(IEMMapRead<? extends IEMStack> o) {//this actually compares rest + int sizeDiff = size() - o.size(); + if (sizeDiff != 0) { + return sizeDiff; + } + + Iterator<T> iterator = values().iterator(); + Iterator<? extends IEMStack> iteratorO = o.values().iterator(); + + while (iterator.hasNext()) { + int result = iterator.next().compareTo(iteratorO.next()); + if (result != 0) { + return result; + } + } + return 0; + } + + /** + * use only for nested operations! + * @param o + * @return + */ + default int compareWithAmountsInternal(IEMMapRead<? extends IEMStack> o) { + if (o == null) { + return 1; + } + + int lenDiff = size() - o.size(); + if (lenDiff != 0) { + return lenDiff; + } + + Iterator<Map.Entry<IEMDefinition, T>> iterator = entrySet().iterator(); + Iterator<? extends Map.Entry<IEMDefinition, ? extends IEMStack>> iteratorO = o.entrySet().iterator(); + + while (iterator.hasNext()) { + T first = iterator.next().getValue(); + IEMStack second = iteratorO.next().getValue(); + int result = first.compareTo(second); + if (result != 0) { + return result; + } + result=Double.compare(first.getAmount(),second.getAmount()); + if (result != 0) { + return result; + } + } + return 0; + } + + default double getMass(){ + double mass=0; + for (Map.Entry<IEMDefinition, T> entry : entrySet()) { + mass+=entry.getValue().getMass(); + } + return mass; + } + + default long getCharge(){ + long charge=0; + for (Map.Entry<IEMDefinition, T> entry : entrySet()) { + charge+=entry.getValue().getCharge(); + } + return charge; + } + + //Tests + default boolean containsKey(IEMDefinition def) { + return getBackingMap().containsKey(def); + } + + default boolean containsKey(IEMStack def) { + return containsKey(def.getDefinition()); + } + + default boolean containsAllKeys(IEMDefinition... definitions) { + for (IEMDefinition def : definitions) { + if (!containsKey(def)) { + return false; + } + } + return true; + } + + default boolean containsAllKeys(IEMStack... hasElementalDefinition) { + for (IEMStack has : hasElementalDefinition) { + if (!containsKey(has)) { + return false; + } + } + return true; + } + + default boolean containsAmountExact(IEMDefinition def, double amount) { + T target = getBackingMap().get(def); + return target != null && target.getAmount() >= amount; + } + + default boolean containsAmountExact(IEMStack stack) { + return containsAmountExact(stack.getDefinition(),stack.getAmount()); + } + + default boolean containsAllAmountsExact(IEMStack... stacks) { + for (IEMStack stack : stacks) { + if(!containsAmountExact(stack)){ + return false; + } + } + return true; + } + + default boolean containsAllAmountsExact(IEMMapRead<? extends IEMStack> container) { + for (Map.Entry<IEMDefinition, ? extends IEMStack> entry : container.entrySet()) { + if(!containsAmountExact(entry.getValue())){ + return false; + } + } + return true; + } + + default boolean containsAmount(IEMDefinition def, double amountToConsume) { + double amountRequired=amountToConsume- EM_COUNT_EPSILON; + if(amountRequired==amountToConsume){ + amountRequired-=ulpSigned(amountRequired); + } + return containsAmountExact(def,amountRequired); + } + + default boolean containsAmount(IEMStack stack) { + return containsAmount(stack.getDefinition(),stack.getAmount()); + } + + default boolean containsAllAmounts(IEMStack... stacks) { + for (IEMStack stack : stacks) { + if(!containsAmount(stack)){ + return false; + } + } + return true; + } + + default boolean containsAllAmounts(IEMMapRead<? extends IEMStack> container) { + for (Map.Entry<IEMDefinition, ? extends IEMStack> entry : container.entrySet()) { + if(!containsAmount(entry.getValue())){ + return false; + } + } + return true; + } + + default int size() { + return getBackingMap().size(); + } + + default boolean hasStacks() { + return !isEmpty(); + } + + default boolean isEmpty(){ + return getBackingMap().isEmpty(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java new file mode 100644 index 0000000000..15815f2ee0 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWrite.java @@ -0,0 +1,112 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; + +import java.util.Map; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_EPSILON; +import static com.github.technus.tectech.util.DoubleCount.*; + +public interface IEMMapWrite<T extends IEMStack> extends IEMMapWriteExact<T> { + IEMMapWrite<T> clone(); + + /** + * Consumes amount from map + * @param def def to consume + * @param amountToConsume should be comparable to {@link EMTransformationRegistry#EM_COUNT_PER_MATERIAL_AMOUNT} + * @return consumed successfully + */ + default boolean removeAmount(IEMDefinition def, double amountToConsume){ + double amountRequired=amountToConsume- EM_COUNT_EPSILON; + if(amountRequired==amountToConsume){ + amountRequired-=ulpSigned(amountRequired); + } + return removeAmount(def,amountToConsume,amountRequired); + } + + default boolean removeAmount(IEMDefinition def, double amountToConsume, double amountRequired){ + T current=getBackingMap().get(def); + if(current!=null){ + if(current.getAmount()>=amountRequired){ + double newAmount=sub(current.getAmount(),amountToConsume); + if(IEMStack.isValidAmount(newAmount)){ + current=(T)current.mutateAmount(newAmount); + getBackingMap().put(current.getDefinition(),current); + }else { + getBackingMap().remove(current.getDefinition()); + } + return true; + } + } + return false; + } + + default boolean removeAmount(IEMStack stack) { + return removeAmount(stack.getDefinition(),stack.getAmount()); + } + + default boolean removeAllAmounts(IEMStack... stacks) { + boolean test = true; + for (IEMStack stack : stacks) { + test &= containsAmount(stack); + } + if (!test) { + return test; + } + for (IEMStack stack : stacks) { + removeAmount(stack); + } + return true; + } + + default boolean removeAllAmounts(IEMMapRead<? extends IEMStack> map) { + boolean test=true; + for (Map.Entry<IEMDefinition, ? extends IEMStack> entry : map.entrySet()) { + test &= containsAmount(entry.getValue()); + } + if (!test) { + return test; + } + for (Map.Entry<IEMDefinition, ? extends IEMStack> entry : map.entrySet()) { + removeAmount(entry.getValue()); + } + return true; + } + + //Put unify + /** + * + * @param stack thing to put + * @return new mapping or null if merging actually removed stuff + */ + default T putUnify(T stack) { + T target=getBackingMap().get(stack.getDefinition()); + if(target==null) { + putReplace(stack); + return stack; + } + double newAmount = add(target.getAmount(), stack.getAmount()); + if (IEMStack.isValidAmount(newAmount)) { + stack=(T) target.mutateAmount(newAmount); + putReplace(stack); + return stack; + }else { + removeKey(stack); + return null; + } + } + + default void putUnifyAll(T... defs) { + for (T def : defs) { + putUnify(def); + } + } + + default void putUnifyAll(IEMMapRead<T> inTreeUnsafe) { + for (T in : inTreeUnsafe.values()) { + putUnify(in); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java new file mode 100644 index 0000000000..9da971944c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/maps/IEMMapWriteExact.java @@ -0,0 +1,166 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.maps; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; + +import java.util.Map; + +public interface IEMMapWriteExact<T extends IEMStack> extends IEMMapRead<T> { + default void cleanUp(){ + entrySet().removeIf(entry -> entry.getValue().isInvalidAmount()); + } + + default void clear() { + getBackingMap().clear(); + } + + IEMMapWriteExact<T> clone(); + + //Remove + default T removeKey(IEMDefinition def) { + return getBackingMap().remove(def); + } + + default T removeKey(IEMStack has) { + return removeKey(has.getDefinition()); + } + + default boolean removeKeys(IEMDefinition... definitions) { + boolean hadAll=true; + for (IEMDefinition def : definitions) { + hadAll&=removeKey(def)!=null; + } + return hadAll; + } + + default boolean removeKeys(IEMStack... hasElementalDefinition) { + boolean hadAll=true; + for (IEMStack has : hasElementalDefinition) { + hadAll&=removeKey(has)!=null; + } + return hadAll; + } + + default boolean removeAllKeys(IEMDefinition... definitions) { + boolean hadAll=containsAllKeys(definitions); + if(hadAll){ + for (IEMDefinition def : definitions) { + removeKey(def); + } + } + return hadAll; + } + + default boolean removeAllKeys(IEMStack... hasElementalDefinition) { + boolean hadAll=containsAllKeys(hasElementalDefinition); + if(hadAll){ + for (IEMStack stack : hasElementalDefinition) { + removeKey(stack); + } + } + return hadAll; + } + + default void putReplace(T defStackUnsafe) { + getBackingMap().put(defStackUnsafe.getDefinition(), defStackUnsafe); + } + + default void putReplaceAll(T... defStacksUnsafe) { + for (T defStack : defStacksUnsafe) { + putReplace(defStack); + } + } + + default void putReplaceAll(IEMMapRead<T> inContainerUnsafe) { + getBackingMap().putAll(inContainerUnsafe.getBackingMap()); + } + + /** + * Should only be used when modifying definitions to alter the integer count correctly + * @param def + * @return + */ + default boolean removeAmountExact(IEMStack def){ + return removeAmountExact(def.getDefinition(),def.getAmount()); + } + + /** + * Should only be used when modifying definitions to alter the integer count correctly + * @param def + * @param amountToConsume + * @return + */ + default boolean removeAmountExact(IEMDefinition def, double amountToConsume){ + T current=getBackingMap().get(def); + if(current!=null){ + double newAmount=current.getAmount()-amountToConsume; + if(newAmount>=0){ + if(current.isValidAmount()){ + current=(T)current.mutateAmount(newAmount); + getBackingMap().put(current.getDefinition(),current); + } else { + getBackingMap().remove(current.getDefinition()); + } + return true; + } + } + return false; + } + + default boolean removeAllAmountsExact(IEMStack... stacks) { + boolean test = true; + for (IEMStack stack : stacks) { + test &= containsAmountExact(stack); + } + if (!test) { + return test; + } + for (IEMStack stack : stacks) { + removeAmountExact(stack); + } + return true; + } + + default boolean removeAllAmountsExact(IEMMapRead<? extends IEMStack> map) { + boolean test=true; + for (Map.Entry<IEMDefinition, ? extends IEMStack> entry : map.entrySet()) { + test &= containsAmountExact(entry.getValue()); + } + if (!test) { + return test; + } + for (Map.Entry<IEMDefinition, ? extends IEMStack> entry : map.entrySet()) { + removeAmountExact(entry.getValue()); + } + return true; + } + + default T putUnifyExact(T stack) { + T target=getBackingMap().get(stack.getDefinition()); + if(target==null) { + putReplace(stack); + return stack; + } + double newAmount = target.getAmount()+stack.getAmount(); + if (IEMStack.isValidAmount(newAmount)) { + stack=(T) target.mutateAmount(newAmount); + putReplace(stack); + return stack; + }else { + removeKey(stack); + return null; + } + } + + default void putUnifyAllExact(T... defs) { + for (T def : defs) { + putUnifyExact(def); + } + } + + default void putUnifyAllExact(IEMMapRead<T> inTreeUnsafe) { + for (T in : inTreeUnsafe.values()) { + putUnifyExact(in); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipe.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipe.java deleted file mode 100644 index e191cc0e0a..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipe.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -/** - * Created by Tec on 02.03.2017. - */ -public class rElementalRecipe implements Comparable<rElementalRecipe> { - public final short ID; - public final cElementalDefinitionStackMap inEM; - public final cElementalDefinitionStackMap outEM; - public final ItemStack[] outItems; - public final FluidStack[] outFluids; - public Object[] extension; - - public rElementalRecipe( - cElementalDefinitionStackMap inEM,//not null plz - short id, - cElementalDefinitionStackMap outEM, - ItemStack[] outItems, - FluidStack[] outFluids) { - this.inEM = inEM; - this.outEM = outEM; - this.outItems = outItems; - this.outFluids = outFluids; - ID = id;//allows multiple recipes with the same input EM,so u can actually extend... - } - - public rElementalRecipe extend(Object... data) { - extension = data; - return this; - } - - @Override - public int compareTo(rElementalRecipe o) { - int compare = inEM.compareTo(o.inEM); - if(compare!=0) { - return compare; - } - return Short.compare(ID, o.ID); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof rElementalRecipe) { - return compareTo((rElementalRecipe) obj) == 0; - } - return false; - } - - @Override - public int hashCode() { - return inEM.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipeMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipeMap.java deleted file mode 100644 index ed5e46f43f..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/rElementalRecipeMap.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -import java.util.HashMap; -import java.util.Map; - -/** - * Created by Tec on 02.03.2017. - */ -public class rElementalRecipeMap {//TODO FIX - //Multimap for multiple recipes from the same thing - you know parameters might differ the output - private final HashMap<cElementalDefinitionStackMap, HashMap<Short, rElementalRecipe>> recipes; - - public rElementalRecipeMap() { - recipes = new HashMap<>(); - } - - public rElementalRecipe put(rElementalRecipe in) { - HashMap<Short, rElementalRecipe> r = recipes.computeIfAbsent(in.inEM, k -> new HashMap<>()); - return r.put(in.ID, in);//IF THIS RETURN SHIT, it means that inputs are using the exact same types of matter as input - (non amount wise collision) - //It is either bad, or unimportant if you use different id's - } - - public void putAll(rElementalRecipe... contents) { - for (rElementalRecipe recipe : contents) { - put(recipe); - } - } - - public rElementalRecipe remove(cElementalStackMap map, short id) { - return recipes.get(map).remove(id);//suspicious but ok, equals and hashcode methods are adjusted for that - } - - public HashMap<Short, rElementalRecipe> remove(cElementalStackMap map) { - return recipes.remove(map);//suspicious but ok, equals and hashcode methods are adjusted for that - } - - public HashMap<Short, rElementalRecipe> findExact(cElementalInstanceStackMap in) { - return recipes.get(in.toDefinitionMapForComparison());//suspicious but ok, equals and hashcode methods are adjusted for that - } - - //Recipe founding should not check amounts - this checks if the types of matter in map are equal to any recipe! - //Return a recipeShortMap when the content of input is equal (ignoring amounts and instance data) - @Deprecated - public HashMap<Short, rElementalRecipe> findExact(cElementalStackMap in) { - return recipes.get(in);//suspicious but ok, equals and hashcode methods are adjusted for that - } - - //this does check if the map contains all the requirements for any recipe, and the required amounts - //Return a recipeShortMap when the content of input matches the recipe input - does not ignore amounts but ignores instance data! - @Deprecated - public HashMap<Short, rElementalRecipe> findMatch(cElementalMutableDefinitionStackMap in, boolean testOnlyTruePreferred) { - for (Map.Entry<cElementalDefinitionStackMap, HashMap<Short, rElementalRecipe>> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) { - if (in.removeAllAmounts(testOnlyTruePreferred, cElementalDefinitionStackMapHashMapEntry.getKey())) { - return cElementalDefinitionStackMapHashMapEntry.getValue(); - } - } - return null; - } - - public HashMap<Short, rElementalRecipe> findMatch(cElementalInstanceStackMap in, boolean testOnly) { - for (Map.Entry<cElementalDefinitionStackMap, HashMap<Short, rElementalRecipe>> cElementalDefinitionStackMapHashMapEntry : recipes.entrySet()) { - if (in.removeAllAmounts(testOnly, cElementalDefinitionStackMapHashMapEntry.getKey())) { - return cElementalDefinitionStackMapHashMapEntry.getValue(); - } - } - return null; - } - - //To check for instance data and other things use recipe extensions! -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java new file mode 100644 index 0000000000..4b0792eac9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipe.java @@ -0,0 +1,87 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.recipes; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.IEMMapRead; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by Tec on 02.03.2017. + */ +public class EMRecipe<T> implements Comparable<EMRecipe<T>> { + private final int ID; + private final EMConstantStackMap inEM; + private final IEMMapRead<? extends IEMStack> outEM; + private final ItemStack[] outItems; + private final FluidStack[] outFluids; + private T extension; + + public EMRecipe( + EMConstantStackMap inEM,//not null plz + int id, + IEMMapRead<? extends IEMStack> outEM, + ItemStack[] outItems, + FluidStack[] outFluids) { + this.inEM = inEM; + this.outEM = outEM; + this.outItems = outItems; + this.outFluids = outFluids; + ID = id;//allows multiple recipes with the same input EM,so u can actually extend... + } + + public EMRecipe<T> extend(T data) { + setExtension(data); + return this; + } + + @Override + public int compareTo(EMRecipe<T> o) { + int compare = getInEM().compareTo(o.getInEM()); + if(compare!=0) { + return compare; + } + return Integer.compare(getID(), o.getID()); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof EMRecipe) { + return compareTo((EMRecipe) obj) == 0; + } + return false; + } + + @Override + public int hashCode() { + return getInEM().hashCode(); + } + + public int getID() { + return ID; + } + + public EMConstantStackMap getInEM() { + return inEM; + } + + public IEMMapRead<? extends IEMStack> getOutEM() { + return outEM; + } + + public ItemStack[] getOutItems() { + return outItems; + } + + public FluidStack[] getOutFluids() { + return outFluids; + } + + public T getExtension() { + return extension; + } + + public void setExtension(T extension) { + this.extension = extension; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java new file mode 100644 index 0000000000..811a9bc370 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java @@ -0,0 +1,65 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.recipes; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.*; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by Tec on 02.03.2017. + */ +public class EMRecipeMap<T> {//TODO FIX + //Multimap for multiple recipes from the same thing - you know parameters might differ the output + private final Map<EMConstantStackMap, Map<Integer, EMRecipe<T>>> recipes; + + public EMRecipeMap() { + recipes = new HashMap<>(); + } + + public EMRecipe<T> put(EMRecipe<T> in) { + Map<Integer, EMRecipe<T>> r = getRecipes().computeIfAbsent(in.getInEM(), k -> new HashMap<>()); + return r.put(in.getID(), in);//IF THIS RETURN SHIT, it means that inputs are using the exact same types of matter as input - (non amount wise collision) + //It is either bad, or unimportant if you use different id's + } + + public void putAll(EMRecipe<T>... contents) { + for (EMRecipe<T> recipe : contents) { + put(recipe); + } + } + + public EMRecipe<T> remove(IEMMapRead<EMDefinitionStack> map, int id) { + Map<Integer, EMRecipe<T>> recipesMap = getRecipes().get(map); + return recipesMap != null ? recipesMap.remove(id) : null;//todo check, suspicious but ok, equals and hashcode methods are adjusted for that + } + + public Map<Integer, EMRecipe<T>> remove(IEMMapRead<EMDefinitionStack> map) { + return getRecipes().remove(map);//todo check, suspicious but ok, equals and hashcode methods are adjusted for that + } + + //Recipe founding should not check amounts - this checks if the types of matter in map are equal to any recipe! + //Return a recipeShortMap when the content of input is equal (ignoring amounts and instance data) + @Deprecated + public Map<Integer, EMRecipe<T>> findExact(IEMMapRead<? extends IEMStack> in) { + return getRecipes().get(in);//suspicious but ok, equals and hashcode methods are adjusted for that + } + + //this does check if the map contains all the requirements for any recipe, and the required amounts + //Return a recipeShortMap when the content of input matches the recipe input - does not ignore amounts but ignores instance data! + public Map<Integer, EMRecipe<T>> findMatch(IEMMapRead<? extends IEMStack> in) { + for (Map.Entry<EMConstantStackMap, Map<Integer, EMRecipe<T>>> cElementalDefinitionStackMapHashMapEntry : getRecipes().entrySet()) { + if (in.containsAllAmounts(cElementalDefinitionStackMapHashMapEntry.getKey())) { + return cElementalDefinitionStackMapHashMapEntry.getValue(); + } + } + return null; + } + + public Map<EMConstantStackMap, Map<Integer, EMRecipe<T>>> getRecipes() { + return recipes; + } + + //To check for instance data and other things use recipe extensions! +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java new file mode 100644 index 0000000000..c1e6a729f8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMDefinitionStack.java @@ -0,0 +1,73 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; + +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import net.minecraft.nbt.NBTTagCompound; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; + +/** + * Created by danie_000 on 20.11.2016. + */ +public final class EMDefinitionStack implements IEMStack { + private final IEMDefinition definition; + private final double amount; + + public EMDefinitionStack(IEMDefinition def, double amount) { + definition = def == null ? null__ : def; + this.amount = amount; + } + + @Override + public EMDefinitionStack clone() { + return this;//IMMUTABLE + } + + @Override + public EMDefinitionStack mutateAmount(double newAmount) { + if(getAmount() == newAmount){ + return this; + } + return new EMDefinitionStack(getDefinition(), newAmount);//IMMUTABLE + } + + @Override + public IEMDefinition getDefinition() { + return definition;//IMMUTABLE + } + + @Override + public double getAmount() { + return amount; + } + + public NBTTagCompound toNBT(EMDefinitionsRegistry registry) { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setTag("d", getDefinition().toNBT(registry)); + nbt.setDouble("Q", getAmount()); + return nbt; + } + + public static EMDefinitionStack fromNBT(EMDefinitionsRegistry registry,NBTTagCompound nbt) { + return new EMDefinitionStack( + registry.fromNBT(nbt.getCompoundTag("d")), + nbt.getLong("q")+nbt.getDouble("Q")); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof IEMDefinition) { + return getDefinition().compareTo((IEMDefinition) obj) == 0; + } + if (obj instanceof IEMStack) { + return getDefinition().compareTo(((IEMStack) obj).getDefinition()) == 0; + } + return false; + } + + //Amount shouldn't be hashed if this is just indicating amount and not structure + @Override + public int hashCode() { + return getDefinition().hashCode(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java new file mode 100644 index 0000000000..b67d2ce121 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/EMInstanceStack.java @@ -0,0 +1,605 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.util.Util; +import net.minecraft.client.Minecraft; +import net.minecraft.crash.CrashReport; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.ArrayList; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition.null__; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static com.github.technus.tectech.util.DoubleCount.*; +import static java.lang.Math.max; +import static java.lang.Math.min; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 22.10.2016. + */ +public final class EMInstanceStack implements IEMStack { + public static int MIN_MULTIPLE_DECAY_CALLS = 4, MAX_MULTIPLE_DECAY_CALLS = 16; + public static double DECAY_CALL_PER = EM_COUNT_PER_MATERIAL_AMOUNT;//todo + + private final IEMDefinition definition; + private double amount; + + private double age; + //energy - if positive then particle should try to decay + private long energy; + //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) + private int color; + private double lifeTime; + private double lifeTimeMult; + + public EMInstanceStack(IEMStack stackSafe) { + this(stackSafe.getDefinition(), stackSafe.getAmount(), 1D, 0D, 0); + } + + public EMInstanceStack(IEMStack stackSafe, double lifeTimeMult, double age, long energy) { + this(stackSafe.getDefinition(), stackSafe.getAmount(), lifeTimeMult, age, energy); + } + + public EMInstanceStack(IEMDefinition defSafe, double amount) { + this(defSafe, amount, 1D, 0D, 0); + } + + public EMInstanceStack(IEMDefinition defSafe, double amount, double lifeTimeMult, double age, long energy) { + definition = defSafe == null ? null__ : defSafe; + if (getDefinition().hasColor()) { + this.color = (byte) TecTech.RANDOM.nextInt(getDefinition().getMaxColors()); + } else {//transforms colorable??? into proper color + this.color = getDefinition().getMaxColors(); + } + this.lifeTimeMult = lifeTimeMult; + lifeTime = getDefinition().getRawTimeSpan(energy) * this.lifeTimeMult; + setEnergy(energy); + this.setAge(age); + this.setAmount(amount); + } + + //Clone proxy + private EMInstanceStack(EMInstanceStack stack) { + definition = stack.getDefinition(); + color = stack.color; + setAge(stack.getAge()); + setAmount(stack.getAmount()); + lifeTime = stack.lifeTime; + lifeTimeMult = stack.lifeTimeMult; + energy = stack.energy; + } + + @Override + public EMInstanceStack clone() { + return new EMInstanceStack(this); + } + + @Override + public EMInstanceStack mutateAmount(double newAmount) { + this.setAmount(newAmount); + return this; + } + + @Override + public double getAmount() { + return amount; + } + + public long getEnergy() { + return energy; + } + + public void setEnergy(long newEnergyLevel) { + energy = newEnergyLevel; + setLifeTimeMultiplier(getLifeTimeMultiplier()); + } + + public double getEnergySettingCost(long currentEnergyLevel, long newEnergyLevel) { + return getDefinition().getEnergyDiffBetweenStates(currentEnergyLevel, newEnergyLevel) * getAmount(); + } + + public double getEnergySettingCost(long newEnergyLevel) { + return getEnergySettingCost(energy, newEnergyLevel) * getAmount(); + } + + public EMDefinitionStack getDefinitionStack() { + return new EMDefinitionStack(getDefinition(), getAmount()); + } + + @Override + public IEMDefinition getDefinition() { + return definition; + } + + public int getColor() { + return color; + } + + public void setColor(int color) {//does not allow changing magic element + if (this.color < 0 || this.color > 2 || color < 0 || color >= 3) { + return; + } + this.color = color; + } + + public void nextColor() {//does not allow changing magic element + if (definition.hasColor()) { + color = (byte) TecTech.RANDOM.nextInt(definition.getMaxColors()); + } + } + + public double getLifeTime() { + return lifeTime; + } + + public void setLifeTimeMultiplier(double mult) { + if (mult <= 0) //since infinity*0=nan + { + throw new IllegalArgumentException("multiplier must be >0"); + } + lifeTimeMult = mult; + if (getDefinition().getRawTimeSpan(energy) <= 0) { + return; + } + lifeTime = getDefinition().getRawTimeSpan(energy) * lifeTimeMult; + } + + public double getLifeTimeMultiplier() { + return lifeTimeMult; + } + + public EMDecayResult tickStackByOneSecond(double lifeTimeMult, int postEnergize) { + return tickStack(lifeTimeMult, postEnergize, 1D); + } + + public EMDecayResult tickStack(double lifeTimeMult, int postEnergize, double seconds) { + setAge(getAge() + seconds); + EMDecayResult newInstances = decay(lifeTimeMult, getAge(), postEnergize); + if (newInstances == null) { + nextColor(); + } else { + for (EMInstanceStack newInstance : newInstances.getOutput().valuesToArray()) { + newInstance.nextColor(); + } + } + return newInstances; + } + + public EMDecayResult decay() { + return decay(1D, getAge(), 0);//try to decay without changes + } + + public EMDecayResult decay(double apparentAge, long postEnergize) { + return decay(1D, apparentAge, postEnergize); + } + + public EMDecayResult decay(double lifeTimeMult, double apparentAge, long postEnergize) { + long newEnergyLevel = postEnergize + energy; + if (newEnergyLevel > 0) { + newEnergyLevel -= 1; + } else if (newEnergyLevel < 0) { + newEnergyLevel += 1; + } + EMDecayResult output; + if (getDefinition().usesMultipleDecayCalls(energy)) { + double amountTemp = getAmount(); + int decayCnt = (int) min(MAX_MULTIPLE_DECAY_CALLS, max(getAmount() / DECAY_CALL_PER, MIN_MULTIPLE_DECAY_CALLS)); + setAmount(div(getAmount(), decayCnt)); + decayCnt--; + + output = decayMechanics(lifeTimeMult, apparentAge, newEnergyLevel); + if (output == null) { + setAmount(amountTemp); + return null; + } + + for (int i = 0; i < decayCnt; i++) { + EMDecayResult map = decayMechanics(lifeTimeMult, apparentAge, newEnergyLevel); + if (map != null) { + output.getOutput().putUnifyAll(map.getOutput()); + output.setMassDiff(add(output.getMassDiff(), map.getMassDiff())); + output.setMassAffected(output.getMassDiff() + map.getMassDiff()); + } + } + setAmount(amountTemp); + } else { + output = decayMechanics(lifeTimeMult, apparentAge, newEnergyLevel); + } + if (output != null) { + output.getOutput().cleanUp(); + } + return output; + } + + private EMDecayResult decayMechanics(double lifeTimeMult, double apparentAge, long newEnergyLevel) { + if (energy > 0 && !getDefinition().usesSpecialEnergeticDecayHandling()) { + setLifeTimeMultiplier(getLifeTimeMultiplier()); + return decayCompute(getDefinition().getEnergyInducedDecay(energy), lifeTimeMult, -1D, newEnergyLevel); + } else if (getDefinition().getRawTimeSpan(energy) < 0) { + return null;//return null, decay cannot be achieved + } else if (getDefinition().isTimeSpanHalfLife()) { + return exponentialDecayCompute(energy > 0 ? getDefinition().getEnergyInducedDecay(energy) : getDefinition().getDecayArray(), lifeTimeMult, -1D, newEnergyLevel); + } else { + if (1 > lifeTime) { + return decayCompute(energy > 0 ? getDefinition().getEnergyInducedDecay(energy) : getDefinition().getNaturalDecayInstant(), lifeTimeMult, 0D, newEnergyLevel); + } else if (apparentAge > lifeTime) { + return decayCompute(energy > 0 ? getDefinition().getEnergyInducedDecay(energy) : getDefinition().getDecayArray(), lifeTimeMult, 0D, newEnergyLevel); + } + } + return null;//return null since decay cannot be achieved + } + + //Use to get direct decay output providing correct decay array + private EMDecayResult exponentialDecayCompute(EMDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { + double newAmount = div(getAmount(), Math.pow(2D, 1D/* 1 second */ / lifeTime)); + + //if(definition.getSymbol().startsWith("U ")) { + // System.out.println("newAmount = " + newAmount); + // System.out.println("amountRemaining = " + amountRemaining); + // for(cElementalDecay decay:decays){ + // System.out.println("prob = "+decay.probability); + // for(cElementalDefinitionStack stack:decay.outputStacks.values()){ + // System.out.println("stack = " + stack.getDefinition().getSymbol() + " " + stack.amount); + // } + // } + //} + if (newAmount == getAmount()) { + newAmount -= ulpSigned(newAmount); + } else if (newAmount < 1) { + return decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel); + } + + //split to non decaying and decaying part + double amount = this.getAmount(); + this.setAmount(this.getAmount() - newAmount); + EMDecayResult products = decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel); + this.setAmount(newAmount); + if (products != null) { + products.getOutput().putUnify(clone()); + } + this.setAmount(amount); + return products; + } + + //Use to get direct decay output providing correct decay array + private EMDecayResult decayCompute(EMDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { + if (decays == null) { + return null;//Can not decay so it won't + } + boolean makesEnergy = getDefinition().decayMakesEnergy(energy); + double mass = getMass(); + if (decays.length == 0) { + return makesEnergy ? null : new EMDecayResult(new EMInstanceStackMap(), mass, 0); + //provide non null 0 length array for annihilation + } else if (decays.length == 1) {//only one type of decay :D, doesn't need dead end + if (decays[0] == deadEnd) { + return makesEnergy ? null : new EMDecayResult(decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, getAmount()), mass, 0); + } + EMInstanceStackMap output = decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, getAmount()); + if (newProductsAge < 0) { + if (output.size() == 1) { + if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) { + output.getFirst().setEnergy(energy); + output.getFirst().setAge(getAge()); + } + } else { + for (EMInstanceStack stack : output.valuesToArray()) { + if (stack.getDefinition().equals(getDefinition())) { + stack.setAge(getAge()); + } + } + } + } else { + if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) { + output.getFirst().setEnergy(energy); + } + } + if (energy <= 0 && output.getMass() > mass) { + return null;//no energy usage to decay + } + return new EMDecayResult(new EMInstanceStackMap(), mass, makesEnergy ? output.getMass() - mass : 0); + } else { + EMDecayResult totalOutput = new EMDecayResult(new EMInstanceStackMap(), getMass(), 0); + EMInstanceStackMap output = totalOutput.getOutput(), results; + int differentDecays = decays.length; + double[] probabilities = new double[differentDecays]; + for (int i = 0; i < probabilities.length; i++) { + probabilities[i] = decays[i].getProbability(); + } + double[] qttyOfDecay; + try { + qttyOfDecay = distribute(getAmount(), probabilities); + } catch (ArithmeticException e) { + Minecraft.getMinecraft().crashed(new CrashReport("Decay failed for: " + this, e)); + return null; + } + //long amountRemaining = this.amount, amount = this.amount; + //float remainingProbability = 1D; +// + //for (int i = 0; i < differentDecays; i++) { + // if (decays[i].probability >= 1D) { + // long thisDecayAmount = (long) Math.floor(remainingProbability * (double) amount); + // if (thisDecayAmount > 0) { + // if (thisDecayAmount <= amountRemaining) { + // amountRemaining -= thisDecayAmount; + // qttyOfDecay[i] += thisDecayAmount; + // }else {//in case too much was made + // qttyOfDecay[i] += amountRemaining; + // amountRemaining = 0; + // //remainingProbability=0; + // } + // } + // break; + // } + // long thisDecayAmount = (long) Math.floor(decays[i].probability * (double) amount); + // if (thisDecayAmount <= amountRemaining && thisDecayAmount > 0) {//some was made + // amountRemaining -= thisDecayAmount; + // qttyOfDecay[i] += thisDecayAmount; + // } else if (thisDecayAmount > amountRemaining) {//too much was made + // qttyOfDecay[i] += amountRemaining; + // amountRemaining = 0; + // //remainingProbability=0; + // break; + // } + // remainingProbability -= decays[i].probability; + // if(remainingProbability<=0) { + // break; + // } + //} + + //for (int i = 0; i < amountRemaining; i++) { + // double rand = TecTech.RANDOM.nextDouble(); + // for (int j = 0; j < differentDecays; j++) {//looking for the thing it decayed into + // rand -= decays[j].probability; + // if (rand <= 0D) { + // qttyOfDecay[j]++; + // break; + // } + // } + //} + + if (getDefinition().decayMakesEnergy(energy)) { + for (int i = differentDecays - 1; i >= 0; i--) { + if (decays[i] == deadEnd) { + EMInstanceStack clone = clone(); + clone.setAmount(qttyOfDecay[i]); + output.putUnify(clone); + } else { + results = decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]); + output.putUnifyAll(results); + totalOutput.setMassDiff(add(totalOutput.getMassDiff(), results.getMass() - mass)); + } + } + } else { + for (int i = differentDecays - 1; i >= 0; i--) { + results = decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]); + output.putUnifyAll(results); + } + } + + if (newProductsAge < 0) { + if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) { + output.getFirst().setEnergy(energy); + output.getFirst().setAge(getAge()); + } else { + for (EMInstanceStack stack : output.valuesToArray()) { + if (stack.getDefinition().equals(getDefinition())) { + stack.setAge(getAge()); + } + } + } + } else { + if (output.size() == 1 && output.getFirst().getDefinition().equals(getDefinition())) { + output.getFirst().setEnergy(energy); + output.getFirst().setAge(getAge()); + } + } + if (energy <= 0 && output.getMass() > getMass()) { + return null;//no energy usage to decay + } + return totalOutput; + } + } + + public EMInstanceStack unifyIntoThis(EMInstanceStack... instances) { + if (instances == null) { + return this; + } + //returns with the definition from the first object passed + double energyTotal = getEnergySettingCost(0, energy); + long maxEnergy = energy; + long minEnergy = energy; + + for (EMInstanceStack instance : instances) { + //if (instance != null && compareTo(instance) == 0) { + setAmount(add(getAmount(), instance.getAmount())); + energyTotal += instance.getEnergySettingCost(0, instance.energy); + maxEnergy = max(instance.energy, maxEnergy); + minEnergy = min(instance.energy, maxEnergy); + lifeTimeMult = min(lifeTimeMult, instance.lifeTimeMult); + setAge(max(getAge(), instance.getAge())); + //} + } + + if (energyTotal >= 0) { + for (; maxEnergy > 0; maxEnergy--) { + if (getEnergySettingCost(0, maxEnergy) < energyTotal) { + break; + } + } + setEnergy(maxEnergy); + } else { + for (; minEnergy < 0; minEnergy++) { + if (getEnergySettingCost(minEnergy, 0) < energyTotal) { + break; + } + } + setEnergy(minEnergy); + } + return this; + } + + public EMInstanceStack unifyIntoThisExact(EMInstanceStack... instances) { + if (instances == null) { + return this; + } + //returns with the definition from the first object passed + double energyTotal = getEnergySettingCost(0, energy); + long maxEnergy = energy; + long minEnergy = energy; + + for (EMInstanceStack instance : instances) { + //if (instance != null && compareTo(instance) == 0) { + setAmount(getAmount() + instance.getAmount()); + energyTotal += instance.getEnergySettingCost(0, instance.energy); + maxEnergy = max(instance.energy, maxEnergy); + minEnergy = min(instance.energy, maxEnergy); + lifeTimeMult = min(lifeTimeMult, instance.lifeTimeMult); + setAge(max(getAge(), instance.getAge())); + //} + } + + if (energyTotal >= 0) { + for (; maxEnergy > 0; maxEnergy--) { + if (getEnergySettingCost(0, maxEnergy) < energyTotal) { + break; + } + } + setEnergy(maxEnergy); + } else { + for (; minEnergy < 0; minEnergy++) { + if (getEnergySettingCost(minEnergy, 0) < energyTotal) { + break; + } + } + setEnergy(minEnergy); + } + return this; + } + + public void addScanShortSymbols(ArrayList<String> lines, int[] detailsOnDepthLevels) { + int capabilities = detailsOnDepthLevels[0]; + getDefinition().addScanShortSymbols(lines, capabilities, energy); + //scanShortSymbolsContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); + } + + //private void scanShortSymbolsContents(ArrayList<String> lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){ + // if(definitions!=null && depth<detailsOnDepthLevels.length){ + // int deeper=depth+1; + // for(cElementalDefinitionStack definitionStack:definitions.values()) { + // definition.addScanShortSymbols(lines,detailsOnDepthLevels[depth],energy); + // scanSymbolsContents(lines,definitionStack.definition.getSubParticles(),deeper,detailsOnDepthLevels); + // } + // } + //} + + public void addScanResults(ArrayList<String> lines, int[] detailsOnDepthLevels) { + int capabilities = detailsOnDepthLevels[0]; + if (Util.areBitsSet(SCAN_GET_DEPTH_LEVEL, capabilities)) { + lines.add("DEPTH = " + 0); + } + getDefinition().addScanResults(lines, capabilities, energy); + if (Util.areBitsSet(SCAN_GET_TIMESPAN_MULT, capabilities)) { + lines.add("TIME MULT = " + lifeTimeMult); + if (Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("TIME SPAN = " + lifeTime + " s"); + } + } + if (Util.areBitsSet(SCAN_GET_AGE, capabilities)) { + lines.add("AGE = " + getAge() + " s"); + } + if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { + lines.add("COLOR = " + color + " RGB or CMY"); + } + if (Util.areBitsSet(SCAN_GET_ENERGY_LEVEL, capabilities)) { + lines.add("ENERGY = " + energy); + } + if (Util.areBitsSet(SCAN_GET_AMOUNT, capabilities)) { + lines.add("AMOUNT = " + getAmount() /AVOGADRO_CONSTANT + " "+translateToLocal("tt.keyword.mol")); + } + scanContents(lines, getDefinition().getSubParticles(), 1, detailsOnDepthLevels); + } + + private void scanContents(ArrayList<String> lines, EMConstantStackMap definitions, int depth, int[] detailsOnDepthLevels) { + if (definitions != null && depth < detailsOnDepthLevels.length) { + int deeper = depth + 1; + for (EMDefinitionStack definitionStack : definitions.valuesToArray()) { + lines.add("");//def separator + if (Util.areBitsSet(SCAN_GET_DEPTH_LEVEL, detailsOnDepthLevels[depth])) { + lines.add("DEPTH = " + depth); + } + getDefinition().addScanResults(lines, detailsOnDepthLevels[depth], energy); + if (Util.areBitsSet(SCAN_GET_AMOUNT, detailsOnDepthLevels[depth])) { + lines.add("AMOUNT = " + definitionStack.getAmount()); + } + scanContents(lines, definitionStack.getDefinition().getSubParticles(), deeper, detailsOnDepthLevels); + } + } + } + + public NBTTagCompound toNBT(EMDefinitionsRegistry registry) { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setTag("d", getDefinition().toNBT(registry)); + nbt.setDouble("Q", getAmount()); + nbt.setDouble("M", lifeTimeMult); + nbt.setDouble("A", getAge()); + nbt.setLong("e", energy); + nbt.setInteger("c", color); + return nbt; + } + + public static EMInstanceStack fromNBT(EMDefinitionsRegistry registry, NBTTagCompound nbt) { + EMInstanceStack instance = new EMInstanceStack( + registry.fromNBT(nbt.getCompoundTag("d")), + nbt.getDouble("Q"), + nbt.getDouble("M"), + nbt.getDouble("A"), + nbt.getLong("e")); + instance.setColor(nbt.getInteger("c")); + return instance; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof IEMDefinition) { + return getDefinition().compareTo((IEMDefinition) obj) == 0; + } + if (obj instanceof IEMStack) { + return getDefinition().compareTo(((IEMStack) obj).getDefinition()) == 0; + } + return false; + } + + //Amount shouldn't be hashed if this is just indicating amount and not structure, DOES NOT CARE ABOUT creativeTabTecTech INFO + @Override + public int hashCode() { + return getDefinition().hashCode(); + } + + @Override + public String toString() { + return getDefinition().toString() + ' ' + getAmount() /AVOGADRO_CONSTANT + " "+translateToLocal("tt.keyword.mol")+" " + getMass()+" eV/c^2"; + } + + public void setAmount(double amount) { + this.amount = amount; + } + + public double getAge() { + return age; + } + + public void setAge(double age) { + this.age = age; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java new file mode 100644 index 0000000000..e5cfab9752 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/IEMStack.java @@ -0,0 +1,56 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; + +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import net.minecraft.nbt.NBTTagCompound; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_MINIMUM; + +/** + * Created by danie_000 on 30.01.2017. + */ +public interface IEMStack extends Comparable<IEMStack>, Cloneable { + static boolean isValidAmount(double amount) { + return amount >= EM_COUNT_MINIMUM; + } + + static boolean isInvalidAmount(double amount) { + return amount < EM_COUNT_MINIMUM; + } + default boolean isValidAmount() { + return isValidAmount(getAmount()); + } + + default boolean isInvalidAmount() { + return isInvalidAmount(getAmount()); + } + + IEMDefinition getDefinition(); + + double getAmount(); + + default double getCharge() { + return getDefinition().getCharge() * getAmount(); + } + + default double getMass() { + return getDefinition().getMass() * getAmount(); + } + + IEMStack clone(); + + /** + * Will return stack with mutated amount, it might be a new object! + * + * @param newAmount new amount + * @return new stack (or previous one if was mutable) + */ + IEMStack mutateAmount(double newAmount); + + NBTTagCompound toNBT(EMDefinitionsRegistry registry); + + @Override + default int compareTo(IEMStack o) { + return getDefinition().compareTo(o.getDefinition()); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java deleted file mode 100644 index 6b6fe35b41..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalDefinitionStack.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; - -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; - -/** - * Created by danie_000 on 20.11.2016. - */ -public final class cElementalDefinitionStack implements iHasElementalDefinition { - public final iElementalDefinition definition; - public final long amount; - - public cElementalDefinitionStack(iElementalDefinition def, long amount) { - definition = def == null ? null__ : def; - this.amount = amount; - } - - @Override - public cElementalDefinitionStack clone() { - return this;//IMMUTABLE - } - - @Override - public iElementalDefinition getDefinition() { - return definition;//IMMUTABLE - } - - @Override - public long getAmount() { - return amount; - } - - @Override - public long getCharge() { - return definition.getCharge() * amount; - } - - @Override - public float getMass() { - return definition.getMass() * amount; - } - - public NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setTag("d", definition.toNBT()); - nbt.setLong("q", amount); - return nbt; - } - - public static cElementalDefinitionStack fromNBT(NBTTagCompound nbt) { - return new cElementalDefinitionStack( - cElementalDefinition.fromNBT(nbt.getCompoundTag("d")), - nbt.getLong("q")); - } - - 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; - } - long l = 0; - for (cElementalDefinitionStack stack : other) { - l += stack.amount; - } - return addAmountIntoNewInstance(l); - } - - @Override - public int compareTo(iHasElementalDefinition o) { - return definition.compareTo(o.getDefinition()); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof iElementalDefinition) { - return definition.compareTo((iElementalDefinition) obj) == 0; - } - if (obj instanceof iHasElementalDefinition) { - return definition.compareTo(((iHasElementalDefinition) obj).getDefinition()) == 0; - } - return false; - } - - //Amount shouldn't be hashed if this is just indicating amount and not structure - @Override - public int hashCode() { - return definition.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java deleted file mode 100644 index ba3c8f909c..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/cElementalInstanceStack.java +++ /dev/null @@ -1,532 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.ArrayList; - -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class cElementalInstanceStack implements iHasElementalDefinition { - public static int MIN_MULTIPLE_DECAY_CALLS=4,MAX_MULTIPLE_DECAY_CALLS=16,DECAY_CALL_PER=144; - - 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) { - definition = defSafe == null ? null__ : defSafe; - byte bColor = definition.getColor(); - if (bColor < 0 || bColor > 2) {//transforms colorable??? into proper color - this.color = bColor; - } else { - this.color = (byte) TecTech.RANDOM.nextInt(3); - } - this.lifeTimeMult = lifeTimeMult; - lifeTime = definition.getRawTimeSpan(energy) * this.lifeTimeMult; - setEnergy(energy); - this.age = age; - this.amount = amount; - } - - //Clone proxy - private cElementalInstanceStack(cElementalInstanceStack stack) { - definition = stack.definition; - color = stack.color; - age = stack.age; - amount = stack.amount; - lifeTime = stack.lifeTime; - lifeTimeMult = stack.lifeTimeMult; - energy = stack.energy; - } - - @Override - public cElementalInstanceStack clone() { - return new cElementalInstanceStack(this); - } - - @Override - public long getAmount() { - return amount; - } - - @Override - public long getCharge() { - return definition.getCharge() * amount; - } - - @Override - public float getMass() { - return definition.getMass() * amount; - } - - public long getEnergy() { - return energy; - } - - public void setEnergy(long newEnergyLevel){ - energy=newEnergyLevel; - setLifeTimeMultiplier(getLifeTimeMultiplier()); - } - - public float getEnergySettingCost(long currentEnergyLevel, long newEnergyLevel){ - return definition.getEnergyDiffBetweenStates(currentEnergyLevel,newEnergyLevel)*amount; - } - - public float getEnergySettingCost(long newEnergyLevel){ - return definition.getEnergyDiffBetweenStates(energy,newEnergyLevel)*amount; - } - - public cElementalDefinitionStack getDefinitionStack() { - return new cElementalDefinitionStack(definition, amount); - } - - @Override - public iElementalDefinition getDefinition() { - return definition; - } - - public byte getColor() { - return color; - } - - public byte setColor(byte color) {//does not allow changing magic element - if (this.color < 0 || this.color > 2 || color < 0 || color >= 3) { - return this.color; - } - return this.color = color; - } - - public byte nextColor() {//does not allow changing magic element - if (color < 0 || color > 2) { - return color; - } - return color = (byte) TecTech.RANDOM.nextInt(3); - } - - public float getLifeTime() { - return lifeTime; - } - - public float setLifeTimeMultiplier(float mult) { - if(mult<=0) //since infinity*0=nan - { - throw new IllegalArgumentException("multiplier must be >0"); - } - lifeTimeMult = mult; - if (definition.getRawTimeSpan(energy) <= 0) { - return lifeTime; - } - lifeTime = definition.getRawTimeSpan(energy) * lifeTimeMult; - return lifeTime; - } - - public float getLifeTimeMultiplier() { - return lifeTimeMult; - } - - public cElementalInstanceStackMap tickStackByOneSecond(float lifeTimeMult, int postEnergize){ - return tickStack(lifeTimeMult,postEnergize,1); - } - - public cElementalInstanceStackMap tickStack(float lifeTimeMult, int postEnergize, int seconds){ - cElementalInstanceStackMap newInstances = decay(lifeTimeMult, age += seconds, postEnergize); - if (newInstances == null) { - nextColor(); - } else { - for (cElementalInstanceStack newInstance : newInstances.values()) { - newInstance.nextColor(); - } - } - return newInstances; - } - - 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 + energy; - if (newEnergyLevel > 0) { - newEnergyLevel -= 1; - } else if (newEnergyLevel < 0) { - newEnergyLevel += 1; - } - if(definition.usesMultipleDecayCalls(energy)){ - long amountTemp=amount; - long decayCnt=Math.min(Math.max(amount/DECAY_CALL_PER,MIN_MULTIPLE_DECAY_CALLS),MAX_MULTIPLE_DECAY_CALLS); - long amountPer=amount/decayCnt; - amount-=amountPer*(--decayCnt); - cElementalInstanceStackMap output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); - if(output==null){ - amount=amountTemp; - return null; - } - if(amountPer>0){ - amount=amountPer; - for(int i=0;i<decayCnt;i++){ - cElementalInstanceStackMap map=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); - if(map!=null){ - output.putUnifyAll(map); - } - } - } - amount=amountTemp; - return output; - }else{ - return decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); - } - } - - private cElementalInstanceStackMap decayMechanics(float lifeTimeMult, long apparentAge, long newEnergyLevel) { - if (energy > 0 && !definition.usesSpecialEnergeticDecayHandling()) { - setLifeTimeMultiplier(getLifeTimeMultiplier()); - return decayCompute(definition.getEnergyInducedDecay(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(energy) : definition.getDecayArray(), lifeTimeMult, -1, newEnergyLevel); - } else { - if (1F > lifeTime) { - return decayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getNaturalDecayInstant(), lifeTimeMult, 0, newEnergyLevel); - } else if ((float) apparentAge > lifeTime) { - return decayCompute(energy > 0 ? definition.getEnergyInducedDecay(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 newEnergyLevel) { - double decayInverseRatio=Math.pow(2d,1d/* 1 second *//(double)lifeTime); - double newAmount=(double)amount/decayInverseRatio; - long amountRemaining= (long)Math.floor(newAmount) +(TecTech.RANDOM.nextDouble()<=newAmount-Math.floor(newAmount)?1:0); - //if(definition.getSymbol().startsWith("U ")) { - // System.out.println("newAmount = " + newAmount); - // System.out.println("amountRemaining = " + amountRemaining); - // for(cElementalDecay decay:decays){ - // System.out.println("prob = "+decay.probability); - // for(cElementalDefinitionStack stack:decay.outputStacks.values()){ - // System.out.println("stack = " + stack.getDefinition().getSymbol() + " " + stack.amount); - // } - // } - //} - if(amountRemaining==amount) { - return null;//nothing decayed - } else if(amountRemaining<=0) { - return decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel); - } - //split to non decaying and decaying part - long amount=this.amount; - this.amount-=amountRemaining; - cElementalInstanceStackMap products=decayCompute(decays,lifeTimeMult,newProductsAge,newEnergyLevel); - this.amount=amountRemaining; - products.putUnify(clone()); - this.amount=amount; - return products; - } - - //Use to get direct decay output providing correct decay array - private cElementalInstanceStackMap decayCompute(cElementalDecay[] decays, float lifeTimeMult, long newProductsAge, long newEnergyLevel) { - if (decays == null) { - return null;//Can not decay so it wont - } - if (decays.length == 0) { - if(definition.decayMakesEnergy(this.energy)) { - return null; - } - 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 - if(decays[0]==deadEnd && definition.decayMakesEnergy(this.energy)) { - return null;//no extra photons - } - cElementalInstanceStackMap products=decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, amount); - if(newProductsAge<0){ - if(products.size()==1) { - if(products.size()==1 && products.get(0).definition.equals(definition)) { - products.get(0).setEnergy(energy); - products.get(0).age=age; - } - }else { - for (cElementalInstanceStack stack : products.values()) { - if (stack.definition.equals(definition)) { - stack.age = age; - } - } - } - }else{ - if(products.size()==1 && products.get(0).definition.equals(definition)) { - products.get(0).setEnergy(energy); - } - } - if(this.energy <= 0 && products.getMass() > getMass()){ - return null;//no energy usage to decay - } - return products; - } else { - cElementalInstanceStackMap output = new cElementalInstanceStackMap(); - 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) { - if (thisDecayAmount <= amountRemaining) { - amountRemaining -= thisDecayAmount; - qttyOfDecay[i] += thisDecayAmount; - }else {//in case too much was made - qttyOfDecay[i] += amountRemaining; - amountRemaining = 0; - //remainingProbability=0; - } - } - break; - } - long thisDecayAmount = (long) Math.floor(decays[i].probability * (double) amount); - if (thisDecayAmount <= amountRemaining && thisDecayAmount > 0) {//some was made - amountRemaining -= thisDecayAmount; - qttyOfDecay[i] += thisDecayAmount; - } else if (thisDecayAmount > amountRemaining) {//too much was made - qttyOfDecay[i] += amountRemaining; - amountRemaining = 0; - //remainingProbability=0; - break; - } - remainingProbability -= decays[i].probability; - if(remainingProbability<=0) { - break; - } - } - - for (int i = 0; i < amountRemaining; i++) { - double rand = TecTech.RANDOM.nextDouble(); - for (int j = 0; j < differentDecays; j++) {//looking for the thing it decayed into - rand -= decays[j].probability; - if (rand <= 0D) { - qttyOfDecay[j]++; - break; - } - } - } - - if(definition.decayMakesEnergy(this.energy)){ - for (int i = 0; i < differentDecays; i++) { - if (qttyOfDecay[i] > 0) { - if(decays[i]==deadEnd){ - cElementalInstanceStack clone=this.clone(); - clone.amount=qttyOfDecay[i]; - output.putUnify(clone); - }else { - output.putUnifyAll(decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i])); - } - } - } - }else{ - for (int i = 0; i < differentDecays; i++) { - if (qttyOfDecay[i] > 0) { - output.putUnifyAll(decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i])); - } - } - } - - if(newProductsAge<0) { - if (output.size() == 1 && output.get(0).definition.equals(definition)) { - output.get(0).setEnergy(energy); - output.get(0).age = age; - } else { - for (cElementalInstanceStack stack : output.values()) { - if (stack.definition.equals(definition)) { - stack.age = age; - } - } - } - }else{ - if(output.size()==1 && output.get(0).definition.equals(definition)) { - output.get(0).setEnergy(energy); - output.get(0).age=age; - } - } - if(this.energy <= 0 && output.getMass() > getMass()){ - return null;//no energy usage to decay - } - return output; - } - } - - public cElementalInstanceStack unifyIntoThis(cElementalInstanceStack... instances) { - if (instances == null) { - return this; - } - //returns with the definition from the first object passed - double energy = this.energy * amount; - long maxEnergy=this.energy; - float lifeTimeMul = lifeTimeMult; - - for (cElementalInstanceStack instance : instances) { - if (instance != null && compareTo(instance) == 0) { - amount += instance.amount; - energy += instance.energy * instance.amount; - if(instance.energy>maxEnergy){ - maxEnergy=instance.energy; - } - lifeTimeMul = Math.min(lifeTimeMul, instance.lifeTimeMult); - age = Math.max(age, instance.age); - } - } - - if (amount != 0) { - energy /= Math.abs(amount); - } - - double wholeParts=Math.floor(energy); - energy=Math.min(energy-wholeParts,1)+(wholeParts>=0?-0.11709966304863834:0.11709966304863834); - setEnergy(Math.min(maxEnergy,(long)wholeParts+(energy>TecTech.RANDOM.nextDouble()?1:0))); - return this; - } - - public void addScanShortSymbols(ArrayList<String> lines, int[] detailsOnDepthLevels){ - int capabilities=detailsOnDepthLevels[0]; - definition.addScanShortSymbols(lines,capabilities,energy); - //scanShortSymbolsContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); - } - - //private void scanShortSymbolsContents(ArrayList<String> lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){ - // if(definitions!=null && depth<detailsOnDepthLevels.length){ - // int deeper=depth+1; - // for(cElementalDefinitionStack definitionStack:definitions.values()) { - // definition.addScanShortSymbols(lines,detailsOnDepthLevels[depth],energy); - // scanSymbolsContents(lines,definitionStack.definition.getSubParticles(),deeper,detailsOnDepthLevels); - // } - // } - //} - - public void addScanResults(ArrayList<String> lines, int[] detailsOnDepthLevels){ - int capabilities=detailsOnDepthLevels[0]; - if(Util.areBitsSet(SCAN_GET_DEPTH_LEVEL,capabilities)) { - lines.add("DEPTH = " + 0); - } - definition.addScanResults(lines,capabilities,energy); - if(Util.areBitsSet(SCAN_GET_TIMESPAN_MULT,capabilities)) { - lines.add("TIME MULT = " + lifeTimeMult); - if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO,capabilities)) { - lines.add("TIME SPAN = " + lifeTime + " s"); - } - } - if(Util.areBitsSet(SCAN_GET_AGE,capabilities)) { - lines.add("AGE = " + age + " s"); - } - if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add("COLOR = " + color + " RGB or CMY"); - } - if(Util.areBitsSet(SCAN_GET_ENERGY_LEVEL,capabilities)) { - lines.add("ENERGY = " + energy); - } - if(Util.areBitsSet(SCAN_GET_AMOUNT,capabilities)) { - lines.add("AMOUNT = " + amount); - } - scanContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); - } - - private void scanContents(ArrayList<String> lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){ - if(definitions!=null && depth<detailsOnDepthLevels.length){ - int deeper=depth+1; - for(cElementalDefinitionStack definitionStack:definitions.values()) { - lines.add("");//def separator - if(Util.areBitsSet(SCAN_GET_DEPTH_LEVEL,detailsOnDepthLevels[depth])) { - lines.add("DEPTH = " + depth); - } - definition.addScanResults(lines,detailsOnDepthLevels[depth],energy); - if(Util.areBitsSet(SCAN_GET_AMOUNT,detailsOnDepthLevels[depth])) { - lines.add("AMOUNT = " + definitionStack.amount); - } - scanContents(lines,definitionStack.definition.getSubParticles(),deeper,detailsOnDepthLevels); - } - } - } - - public NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setTag("d", definition.toNBT()); - nbt.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 creativeTabTecTech 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/mechanics/elementalMatter/core/stacks/iHasElementalDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iHasElementalDefinition.java deleted file mode 100644 index 480707d570..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/stacks/iHasElementalDefinition.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.stacks; - -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; - -/** - * Created by danie_000 on 30.01.2017. - */ -public interface iHasElementalDefinition extends Comparable<iHasElementalDefinition>,Cloneable { - iElementalDefinition getDefinition(); - - long getAmount(); - - long getCharge(); - - float getMass(); - - iHasElementalDefinition clone(); -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/tElementalException.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/tElementalException.java deleted file mode 100644 index 2adadfd062..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/tElementalException.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core; - -/** - * Created by danie_000 on 19.11.2016. - */ -public final class tElementalException extends Exception { - public tElementalException(String message) { - super(message); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java deleted file mode 100644 index de8ccb7b2b..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.templates; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; -import net.minecraft.nbt.NBTTagCompound; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; - -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; - -/** - * Created by danie_000 on 23.01.2017. - */ -public abstract class cElementalDefinition extends iElementalDefinition { - //Nothing array - public static final iElementalDefinition[] nothing = new cElementalPrimitive[0]; - - //add text based creators for recipe formula input? - private static final Map<Byte, Method> nbtCreationBind = new HashMap<>();//creator methods in subclasses - private static final HashSet<Byte> classSet = new HashSet<>(); - - protected static void addCreatorFromNBT(byte shortcutNBT, Method constructorFromNBT,byte classID) { - if(nbtCreationBind.put(shortcutNBT, constructorFromNBT)!=null) { - throw new Error("Duplicate NBT shortcut! " + shortcutNBT + " used for NBT based creation"); - } - if(!classSet.add(classID)) { - throw new Error("Duplicate Class ID! " + classID + " used for class comparison"); - } - } - - public static Map<Byte, Method> getBindsComplex(){ - return nbtCreationBind; - } - - @Override - public final cElementalDefinition clone() { - return this;//IMMUTABLE - } - - public static iElementalDefinition fromNBT(NBTTagCompound nbt) { - try { - return (iElementalDefinition) nbtCreationBind.get(nbt.getByte("t")).invoke(null, nbt); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return nbtE__; - } - } - - @Override - public int compareTo(iElementalDefinition o) { - int classCompare = compareClassID(o); - if (classCompare != 0) { - return classCompare; - } - - //only of the internal def stacks!!! - //that allows neat check if the same thing and - //top hierarchy amount can be used to store amount info - return compareInnerContentsWithAmounts(getSubParticles().values(), o.getSubParticles().values()); - } - - //use only for nested operations! - private static int compareInnerContentsWithAmounts(cElementalDefinitionStack[] tc, cElementalDefinitionStack[] sc) { - if (tc == null) { - if (sc == null) { - return 0; - } else { - return -1; - } - } - if (sc == null) { - return 1; - } - - int lenDiff = tc.length - sc.length; - if (lenDiff != 0) { - return lenDiff; - } - - for (int i = 0; i < tc.length; i++) { - int cn = tc[i].definition.compareTo(sc[i].definition); - if (cn != 0) { - return cn; - } - - if (tc[i].amount > sc[i].amount) { - return 1; - } - if (tc[i].amount < sc[i].amount) { - return -1; - } - } - return 0; - } - - @Override - public final cElementalDefinitionStack getStackForm(long i) { - return new cElementalDefinitionStack(this,i); - } - - @Override - public final boolean equals(Object obj) { - if(this==obj) { - return true; - } - if (obj instanceof iElementalDefinition) { - return compareTo((iElementalDefinition) obj) == 0; - } - if (obj instanceof iHasElementalDefinition) { - return compareTo(((iHasElementalDefinition) obj).getDefinition()) == 0; - } - return false; - } - - @Override - public int hashCode() {//Internal amounts should be also hashed - int hash = -(getSubParticles().size() << 4); - for (cElementalDefinitionStack stack : getSubParticles().values()) { - hash += ((stack.amount & 0x1) == 0 ? -stack.amount : stack.amount) + stack.definition.hashCode(); - } - return hash; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java deleted file mode 100644 index 24033ba945..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java +++ /dev/null @@ -1,277 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.templates; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; -import 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.Util.areBitsSet; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; -import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; - -/** - * Created by danie_000 on 22.10.2016. - * EXTEND THIS TO ADD NEW PRIMITIVES, WATCH OUT FOR ID'S!!! (-1 to 32 can be assumed as used) - */ -public abstract class cElementalPrimitive extends cElementalDefinition { - public static final byte nbtType = (byte) 'p'; - - private static final Map<Integer, cElementalPrimitive> bindsBO = new HashMap<>(); - - public static Map<Integer, cElementalPrimitive> getBindsPrimitive() { - return bindsBO; - } - - public final String name; - public final String symbol; - //float-mass in eV/c^2 - public final float mass; - //int -electric charge in 1/3rds of electron charge for optimization - public final byte charge; - //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) - public final byte color; - //-1/-2/-3 anti matter generations, +1/+2/+3 matter generations, 0 self anti - public final byte type; - - private cElementalPrimitive anti;//IMMUTABLE - private cElementalDecay[] elementalDecays; - private byte naturalDecayInstant; - private byte energeticDecayInstant; - private float rawLifeTime; - - public final int ID; - - //no _ at end - normal particle - // _ at end - anti particle - // __ at end - self is antiparticle - - protected cElementalPrimitive(String name, String symbol, int type, float mass, int charge, int color, int ID) { - this.name = name; - this.symbol = symbol; - this.type = (byte) type; - this.mass = mass; - this.charge = (byte) charge; - this.color = (byte) color; - this.ID = ID; - if (bindsBO.put(ID, this) != null) { - Minecraft.getMinecraft().crashed(new CrashReport("Primitive definition", new tElementalException("Duplicate ID"))); - } - STACKS_REGISTERED.add(this); - } - - // - protected void init(cElementalPrimitive antiParticle, float rawLifeTime, int naturalInstant, int energeticInstant, cElementalDecay... elementalDecaysArray) { - anti = antiParticle; - this.rawLifeTime = rawLifeTime; - naturalDecayInstant = (byte) naturalInstant; - energeticDecayInstant = (byte) energeticInstant; - elementalDecays = elementalDecaysArray; - } - - @Override - public String getName() { - return "Undefined: " + name; - } - - @Override - public String getSymbol() { - return symbol; - } - - @Override - public String getShortSymbol() { - return symbol; - } - - @Override - public iElementalDefinition getAnti() { - return anti;//no need for copy - } - - @Override - public int getCharge() { - return charge; - } - - @Override - public byte getColor() { - return color; - } - - @Override - public float getMass() { - return mass; - } - - @Override - public cElementalDecay[] getNaturalDecayInstant() { - if (naturalDecayInstant < 0) { - return elementalDecays; - }else if (naturalDecayInstant>=elementalDecays.length){ - return cElementalDecay.noProduct; - } - return new cElementalDecay[]{elementalDecays[naturalDecayInstant]}; - } - - @Override - public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { - if (energeticDecayInstant < 0) { - return elementalDecays; - }else if (energeticDecayInstant>=elementalDecays.length){ - return cElementalDecay.noProduct; - } - return new cElementalDecay[]{elementalDecays[energeticDecayInstant]}; - } - - @Override - public float getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return false; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return false; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return false; - } - - @Override - public cElementalDecay[] getDecayArray() { - return elementalDecays; - } - - @Override - public float getRawTimeSpan(long currentEnergy) { - return rawLifeTime; - } - - @Override - public final cElementalDefinitionStackMap getSubParticles() { - return null; - } - - @Override - public aFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public aItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public aOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - - @Override - public byte getType() { - return type; - } - - @Override - public final NBTTagCompound toNBT() { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setByte("t", nbtType); - nbt.setInteger("c", ID); - return nbt; - } - - public static cElementalPrimitive fromNBT(NBTTagCompound content) { - cElementalPrimitive primitive = bindsBO.get(content.getInteger("c")); - return primitive == null ? null__ : primitive; - } - - @Override - public final byte getClassType() { - return -128; - } - - public static byte getClassTypeStatic(){ - return -128; - } - - @Override - public void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel) { - if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add(getShortSymbol()); - } - } - - @Override - public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { - if(areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + nbtType + ' ' + getClassType()); - } - if(areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("NAME = "+getName()); - lines.add("SYMBOL = "+getSymbol()); - } - if(areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3f + " e"); - } - if(areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); - } - if(areBitsSet(SCAN_GET_MASS,capabilities)) { - lines.add("MASS = " + getMass() + " eV/c\u00b2"); - } - if(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); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if(DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Primitive " + nbtType + ' ' + -128); - } - } - - @Override - public final int compareTo(iElementalDefinition o) { - if (getClassType() == o.getClassType()) { - int oID = ((cElementalPrimitive) o).ID; - return Integer.compare(ID, oID); - } - return compareClassID(o); - } - - @Override - public final int hashCode() { - return ID; - } -}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java deleted file mode 100644 index 08be835cdf..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/iElementalDefinition.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.templates; - -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.ArrayList; - -/** - * Created by danie_000 on 11.11.2016. - */ -public abstract class iElementalDefinition implements Comparable<iElementalDefinition>,Cloneable {//IMMUTABLE - public static final 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=25000;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels - - //Nomenclature - public abstract String getName(); - - public abstract String getSymbol(); - - public abstract String getShortSymbol(); - - public abstract void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel); - - public abstract void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel); - - public abstract byte getType(); - - public abstract byte getClassType();//bigger number means bigger things usually, but it is just used to differentiate between classes of iED - - //Not dynamically changing stuff - public abstract iElementalDefinition getAnti();//gives new anti particle def - - public abstract cElementalDecay[] getDecayArray();//possible decays - - public abstract cElementalDecay[] getNaturalDecayInstant();//natural decay if lifespan <1tick - - public abstract cElementalDecay[] getEnergyInducedDecay(long energyLevel);//energetic decay - - public abstract boolean usesSpecialEnergeticDecayHandling(); - - public abstract boolean usesMultipleDecayCalls(long energyLevel); - - public abstract boolean decayMakesEnergy(long energyLevel); - - public abstract boolean fusionMakesEnergy(long energyLevel); - - public abstract 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(long i); - - @Override - public abstract iElementalDefinition clone(); - - final int compareClassID(iElementalDefinition obj) { - return (int) getClassType() - obj.getClassType(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java new file mode 100644 index 0000000000..855be96797 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMDequantizationInfo.java @@ -0,0 +1,56 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +public class EMDequantizationInfo { + private final IEMStack definition; + private Object stack; + + public EMDequantizationInfo(IEMStack definition) { + this.definition = definition; + } + + public IEMStack getInput() { + return definition; + } + + public FluidStack getFluid() { + return ((FluidStack) stack).copy(); + } + + public void setFluid(FluidStack fluid) { + this.stack = fluid; + } + + public ItemStack getItem() { + return ((ItemStack) stack).copy(); + } + + public void setItem(ItemStack item) { + this.stack = item; + } + + public OreDictionaryStack getOre() { + return (OreDictionaryStack) stack; + } + + public void setOre(OreDictionaryStack ore) { + this.stack = ore; + } + + public Object getStack() { + return stack; + } + + @Override + public boolean equals(Object o) { + return o instanceof EMDequantizationInfo && definition.equals(((EMDequantizationInfo) o).definition); + } + + @Override + public int hashCode() { + return definition.hashCode(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java index 57ce67bf6d..cf0cc6218c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidQuantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMFluidQuantizationInfo.java @@ -1,39 +1,31 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; /** * Created by Tec on 23.05.2017. */ -public class aFluidQuantizationInfo implements iExchangeInfo { +public class EMFluidQuantizationInfo { private final FluidStack in; - private final iHasElementalDefinition out; + private final IEMStack out; - public aFluidQuantizationInfo(FluidStack fluidStackIn, iHasElementalDefinition emOut){ + public EMFluidQuantizationInfo(FluidStack fluidStackIn, IEMStack emOut){ in=fluidStackIn; out=emOut; } - @Deprecated - public aFluidQuantizationInfo(int fluidID,int fluidAmount, iHasElementalDefinition emOut){ - in=new FluidStack(fluidID,fluidAmount); - out=emOut; - } - - public aFluidQuantizationInfo(Fluid fluid, int fluidAmount, iHasElementalDefinition emOut){ + public EMFluidQuantizationInfo(Fluid fluid, int fluidAmount, IEMStack emOut){ in=new FluidStack(fluid,fluidAmount); out=emOut; } - @Override public FluidStack input() { return in.copy(); } - @Override - public iHasElementalDefinition output() { + public IEMStack output() { return out.clone(); } @@ -44,6 +36,6 @@ public class aFluidQuantizationInfo implements iExchangeInfo { @Override public boolean equals(Object obj) { - return obj instanceof aFluidQuantizationInfo && hashCode() == obj.hashCode(); + return obj instanceof EMFluidQuantizationInfo && hashCode() == obj.hashCode(); } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java index 80179e1eb8..c5db63b3ad 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemQuantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMItemQuantizationInfo.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -11,30 +11,28 @@ import net.minecraftforge.oredict.OreDictionary; /** * Created by Tec on 23.05.2017. */ -public class aItemQuantizationInfo implements iExchangeInfo { +public class EMItemQuantizationInfo { private final ItemStack in; - private final boolean skipNBT; - private final iHasElementalDefinition out; + private final boolean skipNBT; + private final IEMStack out; - public aItemQuantizationInfo(ItemStack itemStackIn, boolean skipNBT, iHasElementalDefinition emOut) { + public EMItemQuantizationInfo(ItemStack itemStackIn, boolean skipNBT, IEMStack emOut) { in = itemStackIn; out = emOut; this.skipNBT = skipNBT; } - public aItemQuantizationInfo(OrePrefixes prefix, Materials material, int amount, boolean skipNBT, iHasElementalDefinition emOut) { + public EMItemQuantizationInfo(OrePrefixes prefix, Materials material, int amount, boolean skipNBT, IEMStack emOut) { in = GT_OreDictUnificator.get(prefix, material, amount); out = emOut; this.skipNBT = skipNBT; } - @Override public ItemStack input() { return in.copy(); } - @Override - public iHasElementalDefinition output() { + public IEMStack output() { return out.clone(); } @@ -45,15 +43,15 @@ public class aItemQuantizationInfo implements iExchangeInfo { @Override public boolean equals(Object obj) { - if(obj instanceof aItemQuantizationInfo){ + if(obj instanceof EMItemQuantizationInfo){ //alias - ItemStack stack=((aItemQuantizationInfo) obj).in; - if(!in.getUnlocalizedName().equals(((aItemQuantizationInfo) obj).in.getUnlocalizedName())) { + ItemStack stack=((EMItemQuantizationInfo) obj).in; + if(!in.getUnlocalizedName().equals(((EMItemQuantizationInfo) obj).in.getUnlocalizedName())) { return false; } if(!GameRegistry.findUniqueIdentifierFor(in.getItem()).equals( - GameRegistry.findUniqueIdentifierFor(((aItemQuantizationInfo) obj).in.getItem()))) { + GameRegistry.findUniqueIdentifierFor(((EMItemQuantizationInfo) obj).in.getItem()))) { return false; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java new file mode 100644 index 0000000000..3c54dd86ac --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMOredictQuantizationInfo.java @@ -0,0 +1,55 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import net.minecraftforge.oredict.OreDictionary; + +/** + * Created by Tec on 23.05.2017. + */ +public class EMOredictQuantizationInfo { + private final int id; + private final int amount; + private final IEMStack out; + + public EMOredictQuantizationInfo(int id, int amount, IEMStack out) { + this.id = id; + this.amount = amount; + this.out = out; + } + + public EMOredictQuantizationInfo(String name, int qty, IEMStack emOut) { + this(OreDictionary.getOreID(name),qty,emOut); + } + + public EMOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, IEMStack emOut) { + this(prefix, material.mName, qty,emOut); + } + + public EMOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, IEMStack emOut) { + this(OreDictionary.getOreID(prefix.name() + materialName),qty,emOut); + } + + public IEMStack getOut() { + return out; + } + + @Override + public int hashCode() { + return getId(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof EMOredictQuantizationInfo && hashCode() == obj.hashCode(); + } + + public int getId() { + return id; + } + + public int getAmount() { + return amount; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java new file mode 100644 index 0000000000..5e41beb9fd --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/EMTransformationRegistry.java @@ -0,0 +1,134 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_OreDictUnificator; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; + +import static java.lang.Math.pow; + +/** + * Created by Tec on 26.05.2017. + */ +public class EMTransformationRegistry { + /** + * Atom count per Mol + */ + public static final double AVOGADRO_CONSTANT = 6.02214076e23D; + /** + * Scale to 1m^3 of C-12 + */ + public static final double EM_COUNT_PER_CUBE = AVOGADRO_CONSTANT * 1650_000D / 0.012; + public static final double EM_COUNT_PER_MATERIAL_AMOUNT = EM_COUNT_PER_CUBE / 144 / 9; + public static final double EM_COUNT_PER_ITEM = EM_COUNT_PER_CUBE * 9; + public static final double EM_COUNT_PER_1k = EM_COUNT_PER_MATERIAL_AMOUNT * 1000; + + public static final double EM_COUNT_MINIMUM = 1 / EM_COUNT_PER_CUBE; + /** + * Quantity considered to be indifferent when computing stuff + */ + public static final double EM_COUNT_EPSILON = EM_COUNT_PER_CUBE / pow(2, 40); + + public static final double EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT - EM_COUNT_EPSILON; + public static final double EM_COUNT_PER_CUBE_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * 144 * 9; + public static final double EM_COUNT_PER_ITEM_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * 144; + public static final double EM_COUNT_PER_1k_DIMINISHED = EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * 1000; + + private final Map<Integer, EMFluidQuantizationInfo> fluidQuantization; + private final Map<EMItemQuantizationInfo, EMItemQuantizationInfo> itemQuantization; + private final Map<Integer, EMOredictQuantizationInfo> oredictQuantization; + + private final Map<IEMDefinition, EMDequantizationInfo> infoMap; + private final Function<IEMStack, EMDequantizationInfo> creator; + + public EMTransformationRegistry() { + this(EMDequantizationInfo::new); + } + + public EMTransformationRegistry(Function<IEMStack, EMDequantizationInfo> creator) { + this(creator, + new HashMap<>(16), new HashMap<>(16), new HashMap<>(64), + new HashMap<>(256) + ); + } + + public EMTransformationRegistry(Function<IEMStack, EMDequantizationInfo> creator, + Map<Integer, EMFluidQuantizationInfo> fluidQuantization, + Map<EMItemQuantizationInfo, EMItemQuantizationInfo> itemQuantization, + Map<Integer, EMOredictQuantizationInfo> oredictQuantization, + Map<IEMDefinition, EMDequantizationInfo> infoMap) { + this.creator = creator; + this.fluidQuantization = fluidQuantization; + this.itemQuantization = itemQuantization; + this.oredictQuantization = oredictQuantization; + this.infoMap = infoMap; + } + + protected EMDequantizationInfo compute(IEMStack em) { + return infoMap.computeIfAbsent(em.getDefinition(), stack -> creator.apply(em)); + } + + public void addFluid(IEMStack em, FluidStack fluidStack) { + getFluidQuantization().put(fluidStack.getFluidID(), new EMFluidQuantizationInfo(fluidStack, em)); + compute(em).setFluid(fluidStack); + } + + public void addFluid(IEMStack em, Fluid fluid, int fluidAmount) { + addFluid(em, new FluidStack(fluid, fluidAmount)); + } + + protected void addItemQuantization(EMItemQuantizationInfo aIQI) { + getItemQuantization().put(aIQI, aIQI); + } + + public void addItem(IEMStack em, ItemStack itemStack, boolean skipNBT) { + addItemQuantization(new EMItemQuantizationInfo(itemStack, skipNBT, em)); + compute(em).setItem(itemStack); + } + + public void addItem(IEMStack em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT) { + addItem(em, GT_OreDictUnificator.get(prefix, material, amount), skipNBT); + } + + public void addOredict(IEMStack em, int id, int qty) { + getOredictQuantization().put(id, new EMOredictQuantizationInfo(id, qty, em)); + compute(em).setOre(new OreDictionaryStack(qty, id)); + } + + public void addOredict(IEMStack em, String name, int qty) { + addOredict(em, OreDictionary.getOreID(name), qty); + } + + public void addOredict(IEMStack em, OrePrefixes prefix, Materials material, int qty) { + addOredict(em, prefix, material.mName, qty); + } + + public void addOredict(IEMStack em, OrePrefixes prefix, String materialName, int qty) { + addOredict(em, OreDictionary.getOreID(prefix.name() + materialName), qty); + } + + public Map<Integer, EMFluidQuantizationInfo> getFluidQuantization() { + return fluidQuantization; + } + + public Map<EMItemQuantizationInfo, EMItemQuantizationInfo> getItemQuantization() { + return itemQuantization; + } + + public Map<Integer, EMOredictQuantizationInfo> getOredictQuantization() { + return oredictQuantization; + } + + public Map<IEMDefinition, EMDequantizationInfo> getInfoMap() { + return infoMap; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java new file mode 100644 index 0000000000..f5d8d42061 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/OreDictionaryStack.java @@ -0,0 +1,19 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; + +public class OreDictionaryStack { + private final int amount; + private final int id; + + public OreDictionaryStack(int amount, int id) { + this.amount = amount; + this.id = id; + } + + public int getAmount() { + return amount; + } + + public int getOreId() { + return id; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java deleted file mode 100644 index 057d9cdb36..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -/** - * Created by Tec on 23.05.2017. - */ -public class aFluidDequantizationInfo implements iExchangeInfo { - private final iHasElementalDefinition in; - private final FluidStack out; - - public aFluidDequantizationInfo(iHasElementalDefinition emIn, FluidStack fluidStackOut){ - in=emIn; - out=fluidStackOut; - } - - @Deprecated - public aFluidDequantizationInfo(iHasElementalDefinition emIn ,int fluidID,int fluidAmount) { - in = emIn; - out = new FluidStack(fluidID, fluidAmount); - } - - public aFluidDequantizationInfo(iHasElementalDefinition emIn, Fluid fluid, int fluidAmount){ - in=emIn; - out=new FluidStack(fluid,fluidAmount); - } - - @Override - public iHasElementalDefinition input() { - return in.clone();//MEH! - } - - @Override - public FluidStack output() { - return out.copy(); - } - - @Override - public int hashCode() { - return in.getDefinition().hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof aFluidDequantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java deleted file mode 100644 index b764f59863..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; -import net.minecraft.item.ItemStack; - -/** - * Created by Tec on 23.05.2017. - */ -public class aItemDequantizationInfo implements iExchangeInfo { - private final iHasElementalDefinition in; - private final ItemStack out; - - public aItemDequantizationInfo(iHasElementalDefinition emIn, ItemStack itemStackOut){ - in=emIn; - out=itemStackOut; - } - - public aItemDequantizationInfo(iHasElementalDefinition emIn, OrePrefixes prefix, Materials material, int amount) { - in = emIn; - out = GT_OreDictUnificator.get(prefix, material, amount); - } - - @Override - public iHasElementalDefinition input() { - return in.clone(); - } - - @Override - public ItemStack output() { - return out.copy(); - } - - @Override - public int hashCode() { - return in.getDefinition().hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof aItemDequantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java deleted file mode 100644 index 51b1a6806d..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import net.minecraftforge.oredict.OreDictionary; - -/** - * Created by Tec on 23.05.2017. - */ -public class aOredictDequantizationInfo implements iExchangeInfo { - private final iHasElementalDefinition in; - public final int out; - public final int amount; - - public aOredictDequantizationInfo(iHasElementalDefinition emIn, int id, int qty) { - in = emIn; - out = id; - amount = qty; - } - - public aOredictDequantizationInfo(iHasElementalDefinition emIn, String name, int qty) { - in = emIn; - out = OreDictionary.getOreID(name); - amount = qty; - } - - public aOredictDequantizationInfo(iHasElementalDefinition emIn, OrePrefixes prefix, Materials material, int qty) { - in = emIn; - out = OreDictionary.getOreID(prefix.name() + material.mName); - amount = qty; - } - - public aOredictDequantizationInfo(iHasElementalDefinition emIn, OrePrefixes prefix, String materialName, int qty) { - in = emIn; - out = OreDictionary.getOreID(prefix.name() + materialName); - amount = qty; - } - - @Override - public iHasElementalDefinition input() { - return in.clone();//MEH! - } - - @Override - public Integer output() { - return out; - } - - @Override - public int hashCode() { - return in.getDefinition().hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof aOredictDequantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java deleted file mode 100644 index 99e8589060..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictQuantizationInfo.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import net.minecraftforge.oredict.OreDictionary; - -/** - * Created by Tec on 23.05.2017. - */ -public class aOredictQuantizationInfo implements iExchangeInfo { - public final int in; - public final int amount; - private final iHasElementalDefinition out; - - public aOredictQuantizationInfo(int id, int qty, iHasElementalDefinition emOut){ - in=id; - amount=qty; - out=emOut; - } - - public aOredictQuantizationInfo(String name, int qty, iHasElementalDefinition emOut){ - in=OreDictionary.getOreID(name); - amount=qty; - out=emOut; - } - - public aOredictQuantizationInfo( OrePrefixes prefix, Materials material, int qty, iHasElementalDefinition emOut){ - in=OreDictionary.getOreID(prefix.name() + material.mName); - amount=qty; - out=emOut; - } - - public aOredictQuantizationInfo( OrePrefixes prefix, String materialName, int qty, iHasElementalDefinition emOut){ - in=OreDictionary.getOreID(prefix.name() + materialName); - amount=qty; - out=emOut; - } - - @Override - public Integer input() { - return in; - } - - @Override - public iHasElementalDefinition output() { - return out.clone(); - } - - @Override - public int hashCode() { - return in; - } - - @Override - public boolean equals(Object obj) { - return obj instanceof aOredictQuantizationInfo && hashCode() == obj.hashCode(); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java deleted file mode 100644 index c23894d6b1..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/bTransformationInfo.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.HashMap; - -import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; - -/** - * Created by Tec on 26.05.2017. - */ -public class bTransformationInfo { - public static final HashMap<Integer,aFluidQuantizationInfo> fluidQuantization=new HashMap<>(32); - public HashMap<iElementalDefinition,aFluidDequantizationInfo> fluidDequantization; - - public static final HashMap<aItemQuantizationInfo,aItemQuantizationInfo> itemQuantization=new HashMap<>(32); - public HashMap<iElementalDefinition,aItemDequantizationInfo> itemDequantization; - - public static final HashMap<Integer,aOredictQuantizationInfo> oredictQuantization=new HashMap<>(32); - public HashMap<iElementalDefinition,aOredictDequantizationInfo> oredictDequantization; - - public bTransformationInfo(int fluidCap,int itemCap, int oreCap){ - if(fluidCap>0) { - fluidDequantization = new HashMap<>(fluidCap); - } - if(itemCap>0) { - itemDequantization = new HashMap<>(itemCap); - } - if(oreCap>0) { - oredictDequantization = new HashMap<>(oreCap); - } - } - - public void addFluid(iHasElementalDefinition em, FluidStack fluidStack){ - fluidQuantization.put(fluidStack.getFluidID(),new aFluidQuantizationInfo(fluidStack,em)); - fluidDequantization.put(em.getDefinition(),new aFluidDequantizationInfo(em,fluidStack)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addFluid(iHasElementalDefinition em ,int fluidID,int fluidAmount) { - fluidQuantization.put(fluidID,new aFluidQuantizationInfo(fluidID,fluidAmount,em)); - fluidDequantization.put(em.getDefinition(),new aFluidDequantizationInfo(em,fluidID,fluidAmount)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addFluid(iHasElementalDefinition em, Fluid fluid, int fluidAmount){ - fluidQuantization.put(fluid.getID(),new aFluidQuantizationInfo(fluid,fluidAmount,em)); - fluidDequantization.put(em.getDefinition(),new aFluidDequantizationInfo(em,fluid,fluidAmount)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - private void addItemQuantization(aItemQuantizationInfo aIQI){ - itemQuantization.put(aIQI,aIQI); - } - - public void addItem(iHasElementalDefinition em, ItemStack itemStack, boolean skipNBT){ - addItemQuantization(new aItemQuantizationInfo(itemStack,skipNBT,em)); - itemDequantization.put(em.getDefinition(),new aItemDequantizationInfo(em,itemStack)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addItem(iHasElementalDefinition em, OrePrefixes prefix, Materials material, int amount, boolean skipNBT){ - addItemQuantization(new aItemQuantizationInfo(prefix,material,amount,skipNBT,em)); - itemDequantization.put(em.getDefinition(),new aItemDequantizationInfo(em,prefix,material,amount)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addOredict(iHasElementalDefinition em, int id, int qty){ - oredictQuantization.put(id,new aOredictQuantizationInfo(id,qty,em)); - oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,id,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addOredict(iHasElementalDefinition em, String name, int qty){ - oredictQuantization.put(OreDictionary.getOreID(name),new aOredictQuantizationInfo(name,qty,em)); - oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,name,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addOredict(iHasElementalDefinition em, OrePrefixes prefix, Materials material, int qty){ - oredictQuantization.put(OreDictionary.getOreID(prefix.name() + material.mName),new aOredictQuantizationInfo(prefix,material,qty,em)); - oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,prefix,material,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } - - public void addOredict(iHasElementalDefinition em, OrePrefixes prefix, String materialName, int qty){ - oredictQuantization.put(OreDictionary.getOreID(prefix.name() + materialName),new aOredictQuantizationInfo(prefix,materialName,qty,em)); - oredictDequantization.put(em.getDefinition(),new aOredictDequantizationInfo(em,prefix,materialName,qty)); - STACKS_REGISTERED.add(em.getDefinition()); - STACKS_REGISTERED.add(em.getDefinition().getAnti()); - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java deleted file mode 100644 index f4e77bfe2b..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.core.transformations; - -/** - * Created by Tec on 23.05.2017. - */ -public interface iExchangeInfo { - Object output();//what should be given - ItemStack,FluidStack,AspectStack, (EM definitionStack->)EM instance stack - etc. - //This must return new Object! - if obj is immutable don't care that much (applies to defStacks) - - Object input();//same as above but for input -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java new file mode 100644 index 0000000000..0eced7bd3c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMAtomDefinition.java @@ -0,0 +1,1712 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition; +import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.XSTR; + +import java.util.*; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; +import static gregtech.api.enums.Materials.*; +import static gregtech.api.enums.OrePrefixes.dust; +import static java.lang.Math.abs; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 18.11.2016. + */ +public class EMAtomDefinition extends EMComplexTemplate { + private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; + private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; + private static final String[] SYMBOL_IUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; + + public static final long ATOM_COMPLEXITY_LIMIT = 65536L; + private static final byte BYTE_OFFSET = 32; + + private final int hash; + public static double refMass, refUnstableMass; + + private static final String nbtType = "a"; + private static final Random xstr = new XSTR();//NEEDS SEPARATE! + private static Map<Integer, TreeSet<Integer>> stableIsotopes = new HashMap<>(); + private static final Map<Integer, EMAtomDefinition> stableAtoms = new HashMap<>(); + private static Map<Integer, TreeMap<Double, Integer>> mostStableUnstableIsotopes = new HashMap<>(); + private static final Map<Integer, EMAtomDefinition> unstableAtoms = new HashMap<>(); + private static EMDefinitionStack alpha, deuterium, tritium, helium_3, beryllium_8, carbon_14, neon_24, silicon_34, uranium_238, uranium_235, plutonium_239, plutonium_241; + private static final HashMap<EMAtomDefinition, Double> lifetimeOverrides = new HashMap<>(); + + private final EMNuclideIAEA iaea; + + private static EMAtomDefinition somethingHeavy; + + public static EMAtomDefinition getSomethingHeavy() { + return somethingHeavy; + } + + private static final ArrayList<Runnable> overrides = new ArrayList<>(); + + public static void addOverride(EMAtomDefinition atom, double rawLifeTime) { + lifetimeOverrides.put(atom, rawLifeTime); + } + + //float-mass in eV/c^2 + private final double mass; + //public final int charge; + private final int charge; + //int -electric charge in 1/3rds of electron charge for optimization + private final int chargeLeptons; + private final double rawLifeTime; + //generation max present inside - minus if contains any anti quark + private final byte type; + + private final byte decayMode;//t neutron to proton+,0,f proton to neutron + //public final boolean stable; + + private final int neutralCount; + private final int element; + + private final boolean iaeaDefinitionExistsAndHasEnergyLevels; + + private final EMConstantStackMap elementalStacks; + + //stable is rawLifeTime>=10^9 + + public EMAtomDefinition(EMDefinitionStack... things) throws EMException { + this(true, new EMConstantStackMap(things)); + } + + private EMAtomDefinition(boolean check, EMDefinitionStack... things) throws EMException { + this(check, new EMConstantStackMap(things)); + } + + public EMAtomDefinition(EMConstantStackMap things) throws EMException { + this(true, things); + } + + private EMAtomDefinition(boolean check, EMConstantStackMap things) throws EMException { + if (check && !canTheyBeTogether(things)) { + throw new EMException("Atom Definition error"); + } + elementalStacks = things; + + double mass = 0; + int cLeptons = 0; + int cNucleus = 0; + int neutralCount = 0, element = 0; + int type = 0; + boolean containsAnti = false; + for (EMDefinitionStack stack : elementalStacks.valuesToArray()) { + IEMDefinition def = stack.getDefinition(); + int amount = (int) stack.getAmount(); + if ((int) stack.getAmount() != stack.getAmount()) { + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } + mass += stack.getMass(); + if (def.getGeneration() < 0) { + containsAnti = true; + } + type = Math.max(type, abs(def.getGeneration())); + + if (def instanceof EMLeptonDefinition) { + cLeptons += stack.getCharge(); + } else { + cNucleus += stack.getCharge(); + if (def.getCharge() == 3) { + element += amount; + } else if (def.getCharge() == -3) { + element -= amount; + } else if (def.getCharge() == 0) { + neutralCount += amount; + } + } + } + this.type = containsAnti ? (byte) -type : (byte) type; + //this.mass = mass; + chargeLeptons = cLeptons; + charge = cNucleus + cLeptons; + this.neutralCount = neutralCount; + this.element = element; + + element = abs(element); + + //stability curve + int StableIsotope = stableIzoCurve(element); + int izoDiff = neutralCount - StableIsotope; + int izoDiffAbs = abs(izoDiff); + + xstr.setSeed((element + 1L) * (neutralCount + 100L)); + iaea = EMNuclideIAEA.get(element, neutralCount); + if (getIaea() != null) { + if (Double.isNaN(getIaea().getMass())) { + this.mass = mass; + } else { + this.mass = getIaea().getMass(); + } + + if (Double.isNaN(getIaea().getHalfTime())) { + Double overriddenLifeTime = lifetimeOverrides.get(this); + double rawLifeTimeTemp; + if (overriddenLifeTime != null) { + rawLifeTimeTemp = overriddenLifeTime; + } else { + rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); + } + rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); + } else { + rawLifeTime = containsAnti ? getIaea().getHalfTime() * 1.5514433E-21d * (1d + xstr.nextDouble() * 9d) : getIaea().getHalfTime(); + } + iaeaDefinitionExistsAndHasEnergyLevels = getIaea().getEnergeticStatesArray().length > 1; + } else { + this.mass = mass; + + Double overriddenLifeTime = lifetimeOverrides.get(this); + double rawLifeTimeTemp; + if (overriddenLifeTime != null) { + rawLifeTimeTemp = overriddenLifeTime; + } else { + rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); + } + rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); + + iaeaDefinitionExistsAndHasEnergyLevels = false; + } + + if (getIaea() == null || getIaea().getEnergeticStatesArray()[0].energy != 0) { + if (izoDiff == 0) { + decayMode = 0; + } else { + decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) : (byte) -Math.min(2, 1 + izoDiffAbs / 4); + } + } else { + decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET); + } + //this.stable = this.rawLifeTime >= STABLE_RAW_LIFE_TIME; + hash = super.hashCode(); + } + + private static int stableIzoCurve(int element) { + return (int) Math.round(-1.19561E-06D * Math.pow(element, 4D) + + 1.60885E-04D * Math.pow(element, 3D) + + 3.76604E-04D * Math.pow(element, 2D) + + 1.08418E+00D * (double) element); + } + + private static double calculateLifeTime(int izoDiff, int izoDiffAbs, int element, int isotope, boolean containsAnti) { + double rawLifeTime; + + if (element <= 83 && isotope < 127 && (izoDiffAbs == 0 || element == 1 && isotope == 0 || element == 2 && isotope == 1 || izoDiffAbs == 1 && element > 2 && element % 2 == 1 || izoDiffAbs == 3 && element > 30 && element % 2 == 0 || izoDiffAbs == 5 && element > 30 && element % 2 == 0 || izoDiffAbs == 2 && element > 20 && element % 2 == 1)) { + rawLifeTime = (1D + xstr.nextDouble() * 9D) * (containsAnti ? 2.381e4D : 1.5347e25D); + } else { + //Y = (X-A)/(B-A) * (D-C) + C + double unstabilityEXP; + if (element == 0) { + return 1e-35D; + } else if (element == 1) { + unstabilityEXP = 1.743D - abs(izoDiff - 1) * 9.743D; + } else if (element == 2) { + switch (isotope) { + case 4: + unstabilityEXP = 1.61D; + break; + case 5: + unstabilityEXP = -7.523D; + break; + case 6: + unstabilityEXP = -1.51D; + break; + default: + unstabilityEXP = -(izoDiffAbs * 6.165D); + break; + } + } else if (element <= 83 || isotope <= 127 && element <= 120) { + double elementPow4 = Math.pow(element, 4); + + unstabilityEXP = Math.min(element / 2.4D, 6 + ((element + 1) % 2) * 3e6D / elementPow4) + -izoDiff * elementPow4 / 1e8D - abs(izoDiff - 1 + element / 60D) * (3D - element / 12.5D + element * element / 1500D); + } else if (element < 180) { + unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5D - (element - 85) / 3D) - abs(izoDiff) * (3D - element / 13D + element * element / 1600D); + } else { + return -1; + } + if ((isotope == 127 || isotope == 128) && element < 120 && element > 83) { + unstabilityEXP -= 1.8D; + } + if (element > 83 && element < 93 && isotope % 2 == 0 && izoDiff == 3) { + unstabilityEXP += 6; + } + if (element > 93 && element < 103 && isotope % 2 == 0 && izoDiff == 4) { + unstabilityEXP += 6; + } + rawLifeTime = (containsAnti ? 1e-8D : 1) * Math.pow(10D, unstabilityEXP) * (1D + xstr.nextDouble() * 9D); + } + + if (rawLifeTime < 8e-15D) { + return 1e-35D; + } + if (rawLifeTime > 8e28D) { + return 8e30D; + } + return rawLifeTime; + } + + private static boolean canTheyBeTogether(EMConstantStackMap stacks) { + boolean nuclei = false; + long qty = 0; + for (EMDefinitionStack stack : stacks.valuesToArray()) { + if (stack.getDefinition() instanceof EMHadronDefinition) { + if (((EMHadronDefinition) stack.getDefinition()).getAmount() != 3) { + return false; + } + nuclei = true; + } else if (!(stack.getDefinition() instanceof EMLeptonDefinition)) { + return false; + } + if ((int) stack.getAmount() != stack.getAmount()) { + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } + qty += stack.getAmount(); + } + return nuclei && qty < ATOM_COMPLEXITY_LIMIT; + } + + @Override + public int getCharge() { + return charge; + } + + public int getChargeLeptons() { + return chargeLeptons; + } + + public int getChargeHadrons() { + return getCharge() - getChargeLeptons(); + } + + public int getIonizationElementWise() { + return getElement() * 3 + getChargeLeptons(); + } + + @Override + public double getMass() { + return mass; + } + + @Override + public int getGeneration() { + return type; + } + + @Override + public double getRawTimeSpan(long currentEnergy) { + if (currentEnergy <= 0) { + return rawLifeTime; + } + if (iaeaDefinitionExistsAndHasEnergyLevels) { + if (currentEnergy >= getIaea().getEnergeticStatesArray().length) { + return getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1].Thalf / (currentEnergy - getIaea().getEnergeticStatesArray().length + 1); + } + return getIaea().getEnergeticStatesArray()[(int) currentEnergy].Thalf; + } + return rawLifeTime / (currentEnergy + 1); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } + + @Override + public int getMaxColors() { + return -10; + } + + @Override + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Element"); + } + + @Override + public String getShortLocalizedName() { + int element = abs(getElement()); + boolean anti = getElement() < 0; + boolean weird = abs(getGeneration()) != 1; + if(element>=NAME.length){ + StringBuilder s = new StringBuilder(); + if(anti){ + s.append(translateToLocal("tt.IUPAC.Anti")); + do { + s.append(translateToLocal("tt.IUPAC."+SYMBOL_IUPAC[element % 10])); + element = element / 10; + } while (element > 0); + }else { + while (element >= 10) { + s.append(translateToLocal("tt.IUPAC."+SYMBOL_IUPAC[element % 10])); + element = element / 10; + } + s.append(translateToLocal("tt.IUPAC."+SYMBOL_IUPAC[element + 10])); + } + if(weird){ + s.append(translateToLocal("tt.keyword.Weird")); + } + return s.toString(); + } + return translateToLocal("tt.element."+(anti?"Anti":"")+NAME[element])+(weird?translateToLocal("tt.keyword.Weird"):""); + } + + @Override + public String getSymbol() { + return getShortSymbol() + " N:" + getNeutralCount() + " I:" + (getNeutralCount() + getElement()) + " C:" + getCharge(); + } + + @Override + public String getShortSymbol() { + int element = abs(getElement()); + boolean anti = getElement() < 0; + boolean weird = abs(getGeneration()) != 1; + if(element>=SYMBOL.length){ + StringBuilder s = new StringBuilder(anti?"~":""); + while (element >= 10) { + s.append(SYMBOL_IUPAC[element % 10]); + element = element / 10; + } + s.append(SYMBOL_IUPAC[element + 10]); + if(weird){ + s.append(translateToLocal("tt.keyword.Weird")); + } + return s.toString(); + } + return (anti?"~":"")+SYMBOL[element]+(weird?translateToLocal("tt.keyword.Weird"):""); + } + + @Override + public EMConstantStackMap getSubParticles() { + return elementalStacks.clone(); + } + + @Override + public EMDecay[] getDecayArray() { + ArrayList<EMDecay> decaysList = new ArrayList<>(4); + return getDecayArray(decaysList, getDecayMode(), true); + } + + private EMDecay[] getDecayArray(ArrayList<EMDecay> decaysList, int decayMode, boolean tryAnti) {//todo? + if (getGeneration() == 1) { + switch (decayMode) { + case -2: + if (TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } else if (PbetaDecay(decaysList)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + break; + case -1: + if (Emmision(decaysList, EMHadronDefinition.hadron_p1)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + break; + case 0: + if (alphaDecay(decaysList)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + break; + case 1: + if (Emmision(decaysList, EMHadronDefinition.hadron_n1)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + break; + case 2: + if (MbetaDecay(decaysList)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + break; + default: + if (decayMode > 8) { + if (iaeaDecay(decaysList, 0)) { + return decaysList.toArray(EMDecay.NO_PRODUCT); + } + return getDecayArray(decaysList, decayMode - BYTE_OFFSET, false); + } + } + return EMDecay.NO_DECAY; + } else if (getGeneration() == -1) { + EMAtomDefinition anti = getAnti(); + if (anti != null) { + return anti.getDecayArray(decaysList, decayMode, false); + } + } + return getNaturalDecayInstant(); + } + + private boolean iaeaDecay(ArrayList<EMDecay> decaysList, long energy) { + EMNuclideIAEA.energeticState state; + if (energy > getIaea().getEnergeticStatesArray().length) { + state = getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1]; + } else if (energy <= 0) { + state = getIaea().getEnergeticStatesArray()[0]; + } else { + state = getIaea().getEnergeticStatesArray()[(int) energy]; + } + for (int i = 0; i < state.decaymodes.length; i++) { + if (!getDecayFromIaea(decaysList, state.decaymodes[i], energy)) { + decaysList.clear(); + return false; + } + } + return !decaysList.isEmpty(); + } + + private boolean getDecayFromIaea(ArrayList<EMDecay> decaysList, EMNuclideIAEA.iaeaDecay decay, long energy) { + EMDefinitionStackMap withThis = elementalStacks.toMutable(), newStuff = new EMDefinitionStackMap(); + switch (decay.decayName) { + case "D": { + if (withThis.removeAllAmountsExact(deuterium.getDefinition().getSubParticles())) { + withThis.putReplace(deuterium); + decaysList.add(new EMDecay(decay.chance, withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } + } + break; + case "3H": { + if (withThis.removeAllAmountsExact(tritium.getDefinition().getSubParticles())) { + withThis.putReplace(tritium); + decaysList.add(new EMDecay(decay.chance, withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } + } + break; + case "3HE": { + if (withThis.removeAllAmountsExact(helium_3.getDefinition().getSubParticles())) { + withThis.putReplace(helium_3); + decaysList.add(new EMDecay(decay.chance, withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } + } + break; + case "8BE": { + if (withThis.removeAllAmountsExact(beryllium_8.getDefinition().getSubParticles())) { + withThis.putReplace(beryllium_8); + decaysList.add(new EMDecay(decay.chance, withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } + } + break; + case "14C": { + if (withThis.removeAllAmountsExact(carbon_14.getDefinition().getSubParticles())) { + newStuff.putReplace(carbon_14); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "24NE": { + if (withThis.removeAllAmountsExact(neon_24.getDefinition().getSubParticles())) { + newStuff.putReplace(neon_24); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "34SI": { + if (withThis.removeAllAmountsExact(silicon_34.getDefinition().getSubParticles())) { + newStuff.putReplace(silicon_34); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "A": + case "A?": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2, EMHadronDefinition.hadron_p2)) { + newStuff.putReplace(alpha); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "2B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_n2); + newStuff.putReplace(EMLeptonDefinition.lepton_e_2); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "B-": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_p1); + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "2B-": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_p2); + newStuff.putReplace(EMLeptonDefinition.lepton_e2); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_2); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "EC": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "2EC": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e2)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_n2); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "B++EC": + case "EC+B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_n2); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "B+A": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3, EMHadronDefinition.hadron_n1)) { + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(alpha); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "B+P": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(EMHadronDefinition.hadron_p1); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "B+2P": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p3)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(EMHadronDefinition.hadron_p2); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "B-A": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3, EMHadronDefinition.hadron_p1)) { + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + newStuff.putReplace(alpha); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "B-N": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_p1); + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + newStuff.putReplace(EMHadronDefinition.hadron_n1); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "B-2N": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n3)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_p1); + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + newStuff.putReplace(EMHadronDefinition.hadron_n2); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "B-P": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) { + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + newStuff.putReplace(EMHadronDefinition.hadron_p1); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "ECA": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1, EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)) { + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(alpha); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "ECP": { + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p2)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(EMHadronDefinition.hadron_p1); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "EC2P": { + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1, EMHadronDefinition.hadron_p3)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(EMHadronDefinition.hadron_p2); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "ECP+EC2P": {//todo look at branching ratios + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e2, EMHadronDefinition.hadron_p5)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + newStuff.putReplace(EMHadronDefinition.hadron_p3); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "N": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) { + newStuff.putReplace(EMHadronDefinition.hadron_n1); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "2N": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n2)) { + newStuff.putReplace(EMHadronDefinition.hadron_n2); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "P": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1)) { + newStuff.putReplace(EMHadronDefinition.hadron_p1); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "2P": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2)) { + newStuff.putReplace(EMHadronDefinition.hadron_p2); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "SF": { + if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { + return true; + } + } + break; + case "B-F": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_n1)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_p1); + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + try { + if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { + return true; + } + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "ECF": + case "ECSF": + case "EC(+SF)": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_n1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + try { + if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { + return true; + } + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "SF(+EC+B+)": + case "SF+EC+B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_n2); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + try { + if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { + return true; + } + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "SF+EC+B-": { + if (withThis.removeAllAmountsExact(EMLeptonDefinition.lepton_e1)) { + newStuff.putReplace(EMLeptonDefinition.lepton_e1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve_1); + try { + if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { + return true; + } + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "IT": + case "IT?": + case "G": { + if (energy > 0) { + decaysList.add(new EMDecay(decay.chance, this, boson_Y__)); + } else { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Tried to emit Gamma from ground state"); + } + decaysList.add(new EMDecay(decay.chance, this)); + } + return true; + } //break; + case "IT+EC+B+": { + if (withThis.removeAllAmountsExact(EMHadronDefinition.hadron_p2, EMLeptonDefinition.lepton_e1)) { + withThis.putUnifyExact(EMHadronDefinition.hadron_n2); + newStuff.putReplace(EMLeptonDefinition.lepton_e_1); + newStuff.putReplace(EMNeutrinoDefinition.lepton_Ve2); + newStuff.putReplace(EMGaugeBosonDefinition.boson_Y__1); + try { + newStuff.putReplace(new EMAtomDefinition(withThis.toImmutable_optimized_unsafe_LeavesExposedElementalTree()).getStackForm(1)); + decaysList.add(new EMDecay(decay.chance, newStuff.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + } + break; + case "DEAD_END": + decaysList.add(deadEnd); + return true; + default: + throw new Error("Unsupported decay mode: " + decay.decayName + ' ' + getNeutralCount() + ' ' + getElement()); + } + if (DEBUG_MODE) { + TecTech.LOGGER.info("Failed to decay " + getElement() + ' ' + getNeutralCount() + ' ' + decay.decayName); + } + return false; + } + + private boolean Emmision(ArrayList<EMDecay> decaysList, EMDefinitionStack emit) { + EMDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAmountExact(emit)) { + try { + decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), emit)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + return false; + } + + private boolean alphaDecay(ArrayList<EMDecay> decaysList) { + EMDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAllAmountsExact(alpha.getDefinition().getSubParticles())) { + try { + decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), alpha)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + return false; + } + + private boolean MbetaDecay(ArrayList<EMDecay> decaysList) { + EMDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAmountExact(EMHadronDefinition.hadron_n1)) { + try { + tree.putUnifyExact(EMHadronDefinition.hadron_p1); + decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), EMLeptonDefinition.lepton_e1, EMNeutrinoDefinition.lepton_Ve_1)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + return false; + } + + private boolean PbetaDecay(ArrayList<EMDecay> decaysList) { + EMDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAmountExact(EMHadronDefinition.hadron_p1)) { + try { + tree.putUnifyExact(EMHadronDefinition.hadron_n1); + decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), EMLeptonDefinition.lepton_e_1, EMNeutrinoDefinition.lepton_Ve1)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + return false; + } + + private boolean ElectronCapture(ArrayList<EMDecay> decaysList) { + EMDefinitionStackMap tree = elementalStacks.toMutable(); + if (tree.removeAllAmountsExact(EMHadronDefinition.hadron_p1, EMLeptonDefinition.lepton_e1)) { + try { + tree.putUnifyExact(EMHadronDefinition.hadron_n1); + decaysList.add(new EMDecay(1, new EMDefinitionStack(new EMAtomDefinition(tree.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1), EMNeutrinoDefinition.lepton_Ve1)); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } + return false; + } + + private boolean Fission(ArrayList<EMDecay> decaysList, EMDefinitionStackMap fissile, EMDefinitionStackMap particles, double probability, boolean spontaneousCheck) { + EMDefinitionStackMap heavy = new EMDefinitionStackMap(); + double[] liquidDrop = liquidDropFunction(abs(getElement()) <= 97); + + for (EMDefinitionStack stack : fissile.valuesToArray()) { + if (spontaneousCheck && stack.getDefinition() instanceof EMHadronDefinition && + (stack.getAmount() <= 80 || stack.getAmount() < 90 && XSTR_INSTANCE.nextInt(10) < stack.getAmount() - 80)) { + return false; + } + if (stack.getDefinition().getCharge() == 0) { + //if(stack.definition instanceof dHadronDefinition){ + double neutrals = stack.getAmount() * liquidDrop[2]; + int neutrals_cnt = (int) Math.floor(neutrals); + neutrals_cnt += neutrals - neutrals_cnt > XSTR_INSTANCE.nextDouble() ? 1 : 0; + particles.putUnifyExact(new EMDefinitionStack(stack.getDefinition(), neutrals_cnt)); + + int heavy_cnt = (int) Math.ceil(stack.getAmount() * liquidDrop[1]); + while (heavy_cnt + neutrals_cnt > stack.getAmount()) { + heavy_cnt--; + } + fissile.removeAmountExact(new EMDefinitionStack(stack.getDefinition(), heavy_cnt + neutrals_cnt)); + heavy.putReplace(new EMDefinitionStack(stack.getDefinition(), heavy_cnt)); + //}else{ + // particles.add(stack); + // light.remove(stack.definition); + //} + } else { + int heavy_cnt = (int) Math.ceil(stack.getAmount() * liquidDrop[0]); + if (heavy_cnt % 2 == 1 && XSTR_INSTANCE.nextDouble() > 0.05D) { + heavy_cnt--; + } + EMDefinitionStack new_stack = new EMDefinitionStack(stack.getDefinition(), heavy_cnt); + fissile.removeAmountExact(new_stack); + heavy.putReplace(new_stack); + } + } + + try { + particles.putReplace(new EMDefinitionStack(new EMAtomDefinition(fissile.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1)); + particles.putReplace(new EMDefinitionStack(new EMAtomDefinition(heavy.toImmutable_optimized_unsafe_LeavesExposedElementalTree()), 1)); + decaysList.add(new EMDecay(probability, particles.toImmutable_optimized_unsafe_LeavesExposedElementalTree())); + return true; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + return false; + } + + private static double[] liquidDropFunction(boolean asymmetric) { + double[] out = new double[3]; + + out[0] = XSTR_INSTANCE.nextGaussian(); + + if (out[0] < 1 && out[0] >= -1) { + if (XSTR_INSTANCE.nextBoolean()) { + out[0] = XSTR_INSTANCE.nextDouble() * 2d - 1d; + } + } + + if (asymmetric && out[0] > XSTR_INSTANCE.nextDouble() && XSTR_INSTANCE.nextInt(4) == 0) { + out[0] = -out[0]; + } + + //scale to splitting ratio + out[0] = out[0] * 0.05d + .6d; + + if (out[0] < 0 || out[0] > 1) { + return liquidDropFunction(asymmetric); + } + if (out[0] < .5d) { + out[0] = 1d - out[0]; + } + + //extra neutrals + out[2] = 0.012d + XSTR_INSTANCE.nextDouble() * 0.01d; + + if (asymmetric) { + out[1] = out[0]; + } else { + out[1] = out[0] - out[2] * .5d; + } + + return out; + } + + @Override + public EMDecay[] getEnergyInducedDecay(long energyLevel) { + if (iaeaDefinitionExistsAndHasEnergyLevels) { + ArrayList<EMDecay> decays = new ArrayList<>(4); + if (iaeaDecay(decays, energyLevel)) { + return decays.toArray(EMDecay.NO_PRODUCT); + } + } + if (energyLevel < abs(getCharge()) / 3 + getNeutralCount()) { + return new EMDecay[]{new EMDecay(1, this, boson_Y__)}; + } + return getNaturalDecayInstant(); + } + + @Override + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + if (iaeaDefinitionExistsAndHasEnergyLevels) { + double result = 0; + boolean backwards = newEnergyLevel < currentEnergyLevel; + if (backwards) { + long temp = currentEnergyLevel; + currentEnergyLevel = newEnergyLevel; + newEnergyLevel = temp; + } + + if (currentEnergyLevel <= 0) { + if (newEnergyLevel <= 0) { + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); + } else { + result += IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * -currentEnergyLevel; + } + } else { + result -= getIaea().getEnergeticStatesArray()[(int) Math.min(getIaea().getEnergeticStatesArray().length - 1, currentEnergyLevel)].energy; + } + if (newEnergyLevel >= getIaea().getEnergeticStatesArray().length) { + if (currentEnergyLevel >= getIaea().getEnergeticStatesArray().length) { + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); + } else { + result += IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - getIaea().getEnergeticStatesArray().length + 1); + } + result += getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1].energy; + } else { + result += getIaea().getEnergeticStatesArray()[(int) newEnergyLevel].energy; + } + + return backwards ? -result : result; + } + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return iaeaDefinitionExistsAndHasEnergyLevels; + } + + @Override + public boolean usesMultipleDecayCalls(long energyLevel) { + if (!iaeaDefinitionExistsAndHasEnergyLevels) return false; + EMNuclideIAEA.energeticState state; + if (energyLevel > getIaea().getEnergeticStatesArray().length) { + state = getIaea().getEnergeticStatesArray()[getIaea().getEnergeticStatesArray().length - 1]; + } else if (energyLevel <= 0) { + state = getIaea().getEnergeticStatesArray()[0]; + } else { + state = getIaea().getEnergeticStatesArray()[(int) energyLevel]; + } + for (EMNuclideIAEA.iaeaDecay decay : state.decaymodes) { + if (decay.decayName.contains("F")) return true;//if is fissile + } + return false; + } + + @Override + public boolean decayMakesEnergy(long energyLevel) { + return iaeaDefinitionExistsAndHasEnergyLevels; + } + + @Override + public boolean fusionMakesEnergy(long energyLevel) { + return getIaea() != null || iaeaDefinitionExistsAndHasEnergyLevels; + } + + @Override + public EMDecay[] getNaturalDecayInstant() { + //disembody + ArrayList<EMDefinitionStack> decaysInto = new ArrayList<>(); + for (EMDefinitionStack elementalStack : elementalStacks.valuesToArray()) { + if (elementalStack.getDefinition().getGeneration() == 1 || elementalStack.getDefinition().getGeneration() == -1) { + //covers both quarks and antiquarks + decaysInto.add(elementalStack); + } else { + //covers both quarks and antiquarks + decaysInto.add(new EMDefinitionStack(boson_Y__, 2)); + } + } + return new EMDecay[]{new EMDecay(0.75D, decaysInto.toArray(new EMDefinitionStack[0])), deadEnd}; + } + + //@Override + //public iElementalDefinition getAnti() { + // EMDefinitionStack[] stacks = this.elementalStacks.values(); + // EMDefinitionStack[] antiElements = new EMDefinitionStack[stacks.length]; + // for (int i = 0; i < antiElements.length; i++) { + // antiElements[i] = new EMDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); + // } + // try { + // return new dAtomDefinition(false, antiElements); + // } catch (tElementalException e) { + // if (DEBUG_MODE) e.printStackTrace(); + // return null; + // } + //} + + @Override + public EMAtomDefinition getAnti() { + EMDefinitionStackMap anti = new EMDefinitionStackMap(); + for (EMDefinitionStack stack : elementalStacks.valuesToArray()) { + anti.putReplace(new EMDefinitionStack(stack.getDefinition().getAnti(), stack.getAmount())); + } + try { + return new EMAtomDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return null; + } + } + + public EMNuclideIAEA getIaea() { + return iaea; + } + + public byte getDecayMode() { + return decayMode; + } + + public int getNeutralCount() { + return neutralCount; + } + + public int getElement() { + return element; + } + + @Override + protected String getIndirectTagValue() { + return nbtType; + } + + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(nbtType, new EMIndirectType((definitionsRegistry, nbt) -> + new EMAtomDefinition(EMConstantStackMap.fromNBT(definitionsRegistry, nbt)), EMAtomDefinition.class, "tt.keyword.Element")); + EMNuclideIAEA.run(); + + for (Runnable r : overrides) { + r.run(); + } + + for (Map.Entry<EMAtomDefinition, Double> entry : lifetimeOverrides.entrySet()) { + try { + lifetimeOverrides.put(new EMAtomDefinition(entry.getKey().elementalStacks), entry.getValue()); + } catch (EMException e) { + e.printStackTrace(); //Impossible + } + } + + //populate stable isotopes + for (int element = 1; element < 83; element++) {//Up to Bismuth exclusive + for (int isotope = 0; isotope < 130; isotope++) { + xstr.setSeed((long) (element + 1) * (isotope + 100)); + //stability curve + int StableIsotope = stableIzoCurve(element); + int izoDiff = isotope - StableIsotope; + int izoDiffAbs = abs(izoDiff); + double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + EMNuclideIAEA nuclide = EMNuclideIAEA.get(element, isotope); + if (rawLifeTime >= STABLE_RAW_LIFE_TIME || nuclide != null && nuclide.getHalfTime() >= STABLE_RAW_LIFE_TIME) { + TreeSet<Integer> isotopes = stableIsotopes.computeIfAbsent(element, k -> new TreeSet<>()); + isotopes.add(isotope); + } + } + } + + //populate unstable isotopes + for (int element = 1; element < 150; element++) { + for (int isotope = 100; isotope < 180; isotope++) { + xstr.setSeed((long) (element + 1) * (isotope + 100)); + //stability curve + int Isotope = stableIzoCurve(element); + int izoDiff = isotope - Isotope; + int izoDiffAbs = abs(izoDiff); + double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + TreeMap<Double, Integer> isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>()); + isotopes.put(rawLifeTime, isotope);//todo dont add stable ones + } + } + + try { + for (Map.Entry<Integer, TreeSet<Integer>> integerTreeSetEntry : stableIsotopes.entrySet()) { + stableAtoms.put(integerTreeSetEntry.getKey(), new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, integerTreeSetEntry.getKey()), + new EMDefinitionStack(EMHadronDefinition.hadron_n, integerTreeSetEntry.getValue().first()), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, integerTreeSetEntry.getKey()))); + if (DEBUG_MODE) { + TecTech.LOGGER.info("Added Stable Atom:" + integerTreeSetEntry.getKey() + ' ' + integerTreeSetEntry.getValue().first() + ' ' + stableAtoms.get(integerTreeSetEntry.getKey()).getMass()); + } + } + for (Map.Entry<Integer, TreeMap<Double, Integer>> integerTreeMapEntry : mostStableUnstableIsotopes.entrySet()) { + unstableAtoms.put(integerTreeMapEntry.getKey(), new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, integerTreeMapEntry.getKey()), + new EMDefinitionStack(EMHadronDefinition.hadron_n, integerTreeMapEntry.getValue().lastEntry().getValue()), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, integerTreeMapEntry.getKey()))); + if (DEBUG_MODE) { + TecTech.LOGGER.info("Added Unstable Atom:" + integerTreeMapEntry.getKey() + ' ' + integerTreeMapEntry.getValue().lastEntry().getValue() + ' ' + unstableAtoms.get(integerTreeMapEntry.getKey()).getMass()); + } + } + + deuterium = new EMAtomDefinition( + EMHadronDefinition.hadron_p1, + EMHadronDefinition.hadron_n1, + EMLeptonDefinition.lepton_e1).getStackForm(1); + registry.registerForDisplay(deuterium.getDefinition()); + + tritium = new EMAtomDefinition( + EMHadronDefinition.hadron_p1, + EMHadronDefinition.hadron_n2, + EMLeptonDefinition.lepton_e1).getStackForm(1); + registry.registerForDisplay(tritium.getDefinition()); + + helium_3 = new EMAtomDefinition( + EMHadronDefinition.hadron_p2, + EMHadronDefinition.hadron_n1, + EMLeptonDefinition.lepton_e2).getStackForm(1); + registry.registerForDisplay(helium_3.getDefinition()); + + alpha = new EMAtomDefinition( + EMHadronDefinition.hadron_p2, + EMHadronDefinition.hadron_n2).getStackForm(1); + registry.registerForDisplay(alpha.getDefinition()); + + beryllium_8 = new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, 4), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 4), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 4)).getStackForm(1); + registry.registerForDisplay(beryllium_8.getDefinition()); + + carbon_14 = new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, 6), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 8), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 6)).getStackForm(1); + registry.registerForDisplay(carbon_14.getDefinition()); + + neon_24 = new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, 10), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 14), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 10)).getStackForm(1); + registry.registerForDisplay(neon_24.getDefinition()); + + silicon_34 = new EMAtomDefinition( + new EMDefinitionStack(EMHadronDefinition.hadron_p, 14), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 20), + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 14)).getStackForm(1); + registry.registerForDisplay(silicon_34.getDefinition()); + + uranium_238 = new EMAtomDefinition( + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 92), + new EMDefinitionStack(EMHadronDefinition.hadron_p, 92), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 146)).getStackForm(1); + registry.registerForDisplay(uranium_238.getDefinition()); + + uranium_235 = new EMAtomDefinition( + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 92), + new EMDefinitionStack(EMHadronDefinition.hadron_p, 92), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 143)).getStackForm(1); + registry.registerForDisplay(uranium_235.getDefinition()); + + TecTech.LOGGER.info("Diff Mass U : " + (uranium_238.getDefinition().getMass() - uranium_235.getDefinition().getMass())); + + plutonium_239 = new EMAtomDefinition( + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 94), + new EMDefinitionStack(EMHadronDefinition.hadron_p, 94), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 145)).getStackForm(1); + registry.registerForDisplay(plutonium_239.getDefinition()); + + plutonium_241 = new EMAtomDefinition( + new EMDefinitionStack(EMLeptonDefinition.lepton_e, 94), + new EMDefinitionStack(EMHadronDefinition.hadron_p, 94), + new EMDefinitionStack(EMHadronDefinition.hadron_n, 147)).getStackForm(1); + registry.registerForDisplay(plutonium_241.getDefinition()); + + TecTech.LOGGER.info("Diff Mass Pu: " + (plutonium_241.getDefinition().getMass() - plutonium_239.getDefinition().getMass())); + + somethingHeavy=(EMAtomDefinition) plutonium_241.getDefinition(); + + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + + if (DEBUG_MODE) { + TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + getClassTypeStatic()); + } + + for (int i = 1; i <= 118; i++) { + EMAtomDefinition firstStableIsotope = getFirstStableIsotope(i); + if(firstStableIsotope==null){ + firstStableIsotope = getBestUnstableIsotope(i); + if(firstStableIsotope==null){ + continue; + } + } + registry.registerForDisplay(firstStableIsotope); + } + } + + public static void setTransformations(EMTransformationRegistry transformationInfo) { + /*----STABLE ATOMS----**/ + refMass = getFirstStableIsotope(1).getMass() * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; + + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(1), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Hydrogen.mGas, 144); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(2), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Helium.mGas, 144); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(3), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Lithium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(4), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Beryllium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(5), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Boron, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(6), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Carbon, 1); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(7), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Nitrogen.mGas, 144); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(8), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Oxygen.mGas, 144); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(9), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Fluorine.mGas, 144); + //transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Neon.mGas.getID(), 144); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(11), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Sodium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(12), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Magnesium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(13), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Aluminium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(14), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Silicon, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(15), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Phosphorus, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(16), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Sulfur, 1); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(17), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Argon.mGas, 144); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(19), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Potassium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(20), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Calcium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(21), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Scandium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(22), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Titanium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(23), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Vanadium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(24), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Chrome, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(25), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Manganese, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(26), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Iron, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(27), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Cobalt, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(28), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Nickel, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(29), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Copper, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(30), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Zinc, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(31), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Gallium, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),dust, Germanium,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(33), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Arsenic, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),dust, Selenium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),dust, Bromine,1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),dust, Krypton,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(37), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Rubidium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(38), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Strontium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(39), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Yttrium, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),dust, Zirconium,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(41), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Niobium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(42), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Molybdenum, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),dust, Technetium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),dust, Ruthenium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),dust, Rhodium,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(46), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Palladium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(47), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Silver, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(48), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Cadmium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(49), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Indium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(50), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Tin, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(51), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Antimony, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(52), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Tellurium, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),dust, Iodine,1); + //transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Xenon.mGas.getID(), 144); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(55), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Caesium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(56), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Barium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(57), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Lanthanum, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(58), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Cerium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(59), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Praseodymium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(60), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Neodymium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(62), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Samarium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(63), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Europium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(64), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Gadolinium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(65), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Terbium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(66), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Dysprosium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(67), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Holmium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(68), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Erbium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(69), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Thulium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(70), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Ytterbium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(71), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Lutetium, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),dust, Hafnum,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(73), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Tantalum, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(74), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Tungsten, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),dust, Rhenium,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(76), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Osmium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(77), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Iridium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(78), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Platinum, 1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(79), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Gold, 1); + transformationInfo.addFluid(new EMDefinitionStack(getFirstStableIsotope(80), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Mercury.mFluid, 144); + //transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),dust, Thallium,1); + transformationInfo.addOredict(new EMDefinitionStack(getFirstStableIsotope(82), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Lead, 1); + + /*----UNSTABLE ATOMS----**/ + refUnstableMass = getFirstStableIsotope(82).getMass() * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; + + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(61), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Promethium, 1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(83), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Bismuth, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),dust, Polonium,1); + //transformationInfo.addFluid(new EMDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Astatine.mPlasma.getID(), 144); + transformationInfo.addFluid(new EMDefinitionStack(getBestUnstableIsotope(86), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Radon.mGas, 144); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),dust, Francium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),dust, Radium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),dust, Actinium,1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(90), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Thorium, 1); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),dust, Protactinium,1); + ////transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Uranium,1); + //transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),dust, Neptunium,1); + ////transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Plutonium,1); + transformationInfo.addOredict(new EMDefinitionStack(getBestUnstableIsotope(95), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Americium, 1); + + + transformationInfo.addFluid(new EMDefinitionStack(deuterium.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Deuterium.mGas, 144); + transformationInfo.addFluid(new EMDefinitionStack(tritium.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Tritium.mGas, 144); + transformationInfo.addFluid(new EMDefinitionStack(helium_3.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), Helium_3.mGas, 144); + + transformationInfo.addOredict(new EMDefinitionStack(uranium_238.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Uranium/*238*/, 1); + transformationInfo.addOredict(new EMDefinitionStack(uranium_235.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Uranium235, 1); + + transformationInfo.addOredict(new EMDefinitionStack(plutonium_239.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Plutonium/*239*/, 1); + transformationInfo.addOredict(new EMDefinitionStack(plutonium_241.getDefinition(), EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED), dust, Plutonium241, 1); + } + + public static EMAtomDefinition getFirstStableIsotope(int element) { + return stableAtoms.get(element); + } + + public static EMAtomDefinition getBestUnstableIsotope(int element) { + return unstableAtoms.get(element); + } + + @Override + public int getMatterMassType() { + return getClassTypeStatic(); + } + + public static int getClassTypeStatic() { + return 64; + } + + @Override + public int hashCode() { + return hash; + } + + @Override + public void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel) { + if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add(getShortSymbol()); + } + } + + @Override + public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { + if (Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { + lines.add("CLASS = " + getIndirectTagValue() + ' ' + getMatterMassType()); + } + if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("NAME = " + getLocalizedName()); + lines.add("SYMBOL = " + getSymbol()); + } + if (Util.areBitsSet(SCAN_GET_CHARGE, capabilities)) { + lines.add("CHARGE = " + getCharge() / 3D + " e"); + } + if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { + lines.add(hasColor() ? "COLORLESS" : "CARRIES COLOR"); + } + if (Util.areBitsSet(SCAN_GET_MASS, capabilities)) { + lines.add("MASS = " + getMass() + " eV/c\u00b2"); + } + if (iaeaDefinitionExistsAndHasEnergyLevels && Util.areBitsSet(SCAN_GET_ENERGY_STATES, capabilities)) { + for (int i = 1; i < getIaea().getEnergeticStatesArray().length; i++) { + lines.add("E LEVEL " + i + " = " + getIaea().getEnergeticStatesArray()[i].energy + " eV"); + } + } + if (Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("HALF LIFE = " + getRawTimeSpan(energyLevel) + " s"); + lines.add(" At current energy level"); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java new file mode 100644 index 0000000000..19208fbf4a --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMHadronDefinition.java @@ -0,0 +1,500 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMComplexTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMIndirectType; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictQuantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.OreDictionaryStack; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; +import com.github.technus.tectech.util.Util; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 17.11.2016. + */ +public class EMHadronDefinition extends EMComplexTemplate {//TODO Optimize map i/o + private final int hash; + + private static final String nbtType = "h"; + //Helpers + public static final Map<EMHadronDefinition, String> SYMBOL_MAP = new HashMap<>(); + public static final Map<EMHadronDefinition, String> UNLOCALIZED_NAME_MAP = new HashMap<>(); + public static EMHadronDefinition hadron_p, hadron_n, hadron_p_, hadron_n_; + public static EMDefinitionStack hadron_p1, hadron_n1, hadron_p2, hadron_n2, hadron_p3, hadron_n3, hadron_p5; + private static double protonMass = 0D; + private static double neutronMass = 0D; + private static final double actualProtonMass = 938272081.3D; + private static final double actualNeutronMass = 939565413.3D; + + //float-mass in eV/c^2 + private final double mass; + //int -electric charge in 1/3rds of electron charge for optimization + private final int charge; + private final double rawLifeTime; + private final int amount; + //generation max present inside - minus if contains any antiquark + private final byte type; + //private final FluidStack fluidThing; + //private final ItemStack itemThing; + + private final EMConstantStackMap quarkStacks; + + public EMHadronDefinition(EMDefinitionStack... quarks) throws EMException { + this(true, new EMConstantStackMap(quarks)); + } + + private EMHadronDefinition(boolean check, EMDefinitionStack... quarks) throws EMException { + this(check, new EMConstantStackMap(quarks)); + } + + public EMHadronDefinition(EMConstantStackMap quarks) throws EMException { + this(true, quarks); + } + + private EMHadronDefinition(boolean check, EMConstantStackMap quarks) throws EMException { + if (check && !canTheyBeTogether(quarks)) { + throw new EMException("Hadron Definition error"); + } + quarkStacks = quarks; + + int amount = 0; + int charge = 0; + int type = 0; + boolean containsAnti = false; + double mass = 0; + for (EMDefinitionStack quarkStack : quarkStacks.valuesToArray()) { + amount += quarkStack.getAmount(); + if ((int) quarkStack.getAmount() != quarkStack.getAmount()) { + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } + mass += quarkStack.getMass(); + charge += quarkStack.getCharge(); + type = Math.max(Math.abs(quarkStack.getDefinition().getGeneration()), type); + if (quarkStack.getDefinition().getGeneration() < 0) { + containsAnti = true; + } + } + this.amount = amount; + this.charge = charge; + this.type = containsAnti ? (byte) -type : (byte) type; + long mult = (long) this.getAmount() * this.getAmount() * (this.getAmount() - 1); + mass = mass * 5.543D * mult;//yes it becomes heavier + + if (mass == protonMass && this.getAmount() == 3) { + rawLifeTime = IEMDefinition.STABLE_RAW_LIFE_TIME; + mass = actualProtonMass; + } else if (mass == neutronMass && this.getAmount() == 3) { + rawLifeTime = 882D; + mass = actualNeutronMass; + } else { + if (this.getAmount() == 3) { + rawLifeTime = 1.34D / mass * Math.pow(9.81, charge); + } else if (this.getAmount() == 2) { + rawLifeTime = 1.21D / mass / Math.pow(19.80, charge); + } else { + rawLifeTime = 1.21D / mass / Math.pow(9.80, charge); + } + } + this.mass = mass; + hash = super.hashCode(); + } + + //public but u can just try{}catch(){} the constructor it still calls this method + private static boolean canTheyBeTogether(EMConstantStackMap stacks) { + long amount = 0; + for (EMDefinitionStack quarks : stacks.valuesToArray()) { + if (!(quarks.getDefinition() instanceof EMQuarkDefinition)) { + return false; + } + if ((int) quarks.getAmount() != quarks.getAmount()) { + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } + amount += quarks.getAmount(); + } + return amount >= 2 && amount <= 12; + } + + @Override + public String getShortLocalizedName() { + StringBuilder name = new StringBuilder(); + String sym = translateToLocal(UNLOCALIZED_NAME_MAP.get(this)); + if (sym != null) { + name.append(' ').append(sym); + } else { + for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { + name.append(' ').append(quark.getDefinition().getSymbol()).append((int) quark.getAmount()); + } + } + return name.toString(); + } + + @Override + public String getLocalizedTypeName() { + switch (getAmount()) { + case 2: + return translateToLocal("tt.keyword.Meson"); + case 3: + return translateToLocal("tt.keyword.Baryon"); + case 4: + return translateToLocal("tt.keyword.Tetraquark"); + case 5: + return translateToLocal("tt.keyword.Pentaquark"); + case 6: + return translateToLocal("tt.keyword.Hexaquark"); + default: + return translateToLocal("tt.keyword.Hadron"); + } + } + + @Override + public String getSymbol() { + String sym = SYMBOL_MAP.get(this); + if (sym != null) { + return sym; + } else { + StringBuilder symbol = new StringBuilder(8); + for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { + for (int i = 0; i < quark.getAmount(); i++) { + symbol.append(quark.getDefinition().getSymbol()); + } + } + return symbol.toString(); + } + } + + @Override + public String getShortSymbol() { + String sym = SYMBOL_MAP.get(this); + if (sym != null) { + return sym; + } else { + StringBuilder symbol = new StringBuilder(8); + for (EMDefinitionStack quark : quarkStacks.valuesToArray()) { + for (int i = 0; i < quark.getAmount(); i++) { + symbol.append(quark.getDefinition().getShortSymbol()); + } + } + return symbol.toString(); + } + } + + @Override + public int getMaxColors() { + return -7; + } + + @Override + public EMConstantStackMap getSubParticles() { + return quarkStacks; + } + + @Override + public EMDecay[] getNaturalDecayInstant() { + EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); + if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getGeneration() == -quarkStacks[1].getDefinition().getGeneration()) { + return EMDecay.NO_PRODUCT; + } + ArrayList<EMDefinitionStack> decaysInto = new ArrayList<>(); + for (EMDefinitionStack quarks : quarkStacks) { + if (quarks.getDefinition().getGeneration() == 1 || quarks.getDefinition().getGeneration() == -1) { + //covers both quarks and antiquarks + decaysInto.add(quarks); + } else { + //covers both quarks and antiquarks + decaysInto.add(new EMDefinitionStack(boson_Y__, 2)); + } + } + return new EMDecay[]{ + new EMDecay(0.75D, decaysInto.toArray(new EMDefinitionStack[0])), + deadEnd + }; + } + + @Override + public EMDecay[] getEnergyInducedDecay(long energyLevel) { + EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); + if (getAmount() == 2 && quarkStacks.length == 2 && quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && quarkStacks[0].getDefinition().getGeneration() == -quarkStacks[1].getDefinition().getGeneration()) { + return EMDecay.NO_PRODUCT; + } + return new EMDecay[]{new EMDecay(0.75D, quarkStacks), deadEnd}; //decay into quarks + } + + @Override + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + return IEMDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); + } + + @Override + public boolean usesSpecialEnergeticDecayHandling() { + return false; + } + + @Override + public boolean usesMultipleDecayCalls(long energyLevel) { + return false; + } + + @Override + public boolean decayMakesEnergy(long energyLevel) { + return false; + } + + @Override + public boolean fusionMakesEnergy(long energyLevel) { + return false; + } + + @Override + public EMDecay[] getDecayArray() { + EMDefinitionStack[] quarkStacks = this.quarkStacks.valuesToArray(); + if (getAmount() == 2 && quarkStacks.length == 2 && + quarkStacks[0].getDefinition().getMass() == quarkStacks[1].getDefinition().getMass() && + quarkStacks[0].getDefinition().getGeneration() == -quarkStacks[1].getDefinition().getGeneration()) { + return EMDecay.NO_PRODUCT; + } else if (getAmount() != 3) { + return new EMDecay[]{new EMDecay(0.95D, quarkStacks), deadEnd}; //decay into quarks + } else { + ArrayList<EMQuarkDefinition> newBaryon = new ArrayList<>(); + IEMDefinition[] Particles = new IEMDefinition[2]; + for (EMDefinitionStack quarks : quarkStacks) { + for (int i = 0; i < quarks.getAmount(); i++) { + newBaryon.add((EMQuarkDefinition) quarks.getDefinition()); + } + } + //remove last + EMQuarkDefinition lastQuark = newBaryon.remove(2); + + EMDefinitionStack[] decay; + if (Math.abs(lastQuark.getGeneration()) > 1) { + decay = lastQuark.getDecayArray()[1].getOutputStacks().valuesToArray(); + } else { + decay = lastQuark.getDecayArray()[2].getOutputStacks().valuesToArray(); + } + newBaryon.add((EMQuarkDefinition) decay[0].getDefinition()); + Particles[0] = decay[1].getDefinition(); + Particles[1] = decay[2].getDefinition(); + + EMDefinitionStack[] contentOfBaryon = newBaryon.stream() + .map(eQuarkDefinition -> new EMDefinitionStack(eQuarkDefinition, 1)) + .toArray(EMDefinitionStack[]::new); + + try { + return new EMDecay[]{ + new EMDecay(0.001D, new EMHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1], boson_Y__), + new EMDecay(0.99D, new EMHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), + deadEnd}; + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return new EMDecay[]{deadEnd}; + } + } + } + + @Override + public double getMass() { + return mass; + } + + @Override + public int getCharge() { + return charge; + } + + @Override + public double getRawTimeSpan(long currentEnergy) { + return getRawLifeTime(); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } + + @Override + public int getGeneration() { + return type; + } + + //@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; + // } + //} + + @Override + public IEMDefinition getAnti() { + EMDefinitionStackMap anti = new EMDefinitionStackMap(); + for (EMDefinitionStack stack : quarkStacks.valuesToArray()) { + anti.putReplace(new EMDefinitionStack(stack.getDefinition().getAnti(), stack.getAmount())); + } + try { + return new EMHadronDefinition(anti.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + return null; + } + } + + @Override + protected String getIndirectTagValue() { + return nbtType; + } + + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(nbtType, new EMIndirectType((definitionsRegistry, nbt) -> + new EMHadronDefinition(EMConstantStackMap.fromNBT(definitionsRegistry, nbt)), EMHadronDefinition.class, "tt.keyword.Hadron")); + try { + hadron_p = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1))); + protonMass = hadron_p.getMass(); + //redefine the proton with proper lifetime (the lifetime is based on mass comparison) + hadron_p = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(2), EMQuarkDefinition.quark_d.getStackForm(1))); + SYMBOL_MAP.put(hadron_p, "p"); + UNLOCALIZED_NAME_MAP.put(hadron_p, "tt.keyword.Proton"); + registry.registerForDisplay(hadron_p); + registry.registerDirectDefinition("p",hadron_p); + + hadron_p_ = (EMHadronDefinition) hadron_p.getAnti(); + SYMBOL_MAP.put(hadron_p_, "~p"); + UNLOCALIZED_NAME_MAP.put(hadron_p_, "tt.keyword.AntiProton"); + registry.registerForDisplay(hadron_p_); + registry.registerDirectDefinition("~p",hadron_p_); + + hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); + neutronMass = hadron_n.getMass(); + //redefine the neutron with proper lifetime (the lifetime is based on mass comparison) + hadron_n = new EMHadronDefinition(new EMConstantStackMap(EMQuarkDefinition.quark_u.getStackForm(1), EMQuarkDefinition.quark_d.getStackForm(2))); + SYMBOL_MAP.put(hadron_n, "n"); + UNLOCALIZED_NAME_MAP.put(hadron_n, "tt.keyword.Neutron"); + registry.registerForDisplay(hadron_n); + registry.registerDirectDefinition("n",hadron_n); + + hadron_n_ = (EMHadronDefinition) hadron_n.getAnti(); + SYMBOL_MAP.put(hadron_n_, "~n"); + UNLOCALIZED_NAME_MAP.put(hadron_n_, "tt.keyword.AntiNeutron"); + registry.registerForDisplay(hadron_n_); + registry.registerDirectDefinition("~n",hadron_n_); + + TecTech.LOGGER.info("Old Neutron Mass: " + neutronMass); + TecTech.LOGGER.info("Old Proton Mass: " + protonMass); + TecTech.LOGGER.info("New Neutron Mass: " + EMHadronDefinition.hadron_n.getMass()); + TecTech.LOGGER.info("New Proton Mass: " + EMHadronDefinition.hadron_p.getMass()); + } catch (EMException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + protonMass = -1; + neutronMass = -1; + } + hadron_p1 = new EMDefinitionStack(hadron_p, 1D); + hadron_n1 = new EMDefinitionStack(hadron_n, 1D); + hadron_p2 = new EMDefinitionStack(hadron_p, 2D); + hadron_n2 = new EMDefinitionStack(hadron_n, 2D); + hadron_p3 = new EMDefinitionStack(hadron_p, 3D); + hadron_n3 = new EMDefinitionStack(hadron_n, 3D); + hadron_p5 = new EMDefinitionStack(hadron_p, 5D); + + if (DEBUG_MODE) { + TecTech.LOGGER.info("Registered Elemental Matter Class: Hadron " + nbtType + ' ' + getClassTypeStatic()); + } + } + + public static void setTransformations(EMTransformationRegistry transformationInfo) {//Todo use Neutronium atom? + //Added to atom map, but should be in its own + EMDefinitionStack neutrons = new EMDefinitionStack(hadron_n, 1000 * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED); + EMDequantizationInfo emDequantizationInfo = new EMDequantizationInfo(neutrons); + emDequantizationInfo.setOre(new OreDictionaryStack(1,OreDictionary.getOreID(OrePrefixes.dust.name() + Materials.Neutronium.mName)));//todo shitty looking, but works... + transformationInfo.getInfoMap().put(neutrons.getDefinition(), emDequantizationInfo); + transformationInfo.getOredictQuantization().put( + OreDictionary.getOreID(OrePrefixes.ingotHot.name() + Materials.Neutronium.mName), + new EMOredictQuantizationInfo(OrePrefixes.ingotHot, Materials.Neutronium, 1, neutrons) + ); + } + + @Override + public int getMatterMassType() { + return getClassTypeStatic(); + } + + public static int getClassTypeStatic() { + return -64; + } + + @Override + public int hashCode() { + return hash; + } + + @Override + public void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel) { + if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add(getShortSymbol()); + } + } + + @Override + public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { + if (Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { + lines.add("CLASS = " + getIndirectTagValue() + ' ' + getMatterMassType()); + } + if (Util.areBitsSet(SCAN_GET_NOMENCLATURE | SCAN_GET_CHARGE | SCAN_GET_MASS | SCAN_GET_TIMESPAN_INFO, capabilities)) { + lines.add("NAME = " + getLocalizedTypeName()); + //lines.add("SYMBOL = "+getSymbol()); + } + if (Util.areBitsSet(SCAN_GET_CHARGE, capabilities)) { + lines.add("CHARGE = " + getCharge() / 3D + " e"); + } + if (Util.areBitsSet(SCAN_GET_COLOR, capabilities)) { + lines.add(hasColor() ? "COLORLESS" : "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"); + } + } + + public double getRawLifeTime() { + return rawLifeTime; + } + + public int getAmount() { + return amount; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMNuclideIAEA.java index 8b54bdd306..bd34733cb6 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/iaeaNuclide.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/EMNuclideIAEA.java @@ -1,7 +1,5 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; -import com.github.technus.tectech.Util; - import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; @@ -9,9 +7,10 @@ import java.util.HashMap; import java.util.HashSet; import java.util.TreeMap; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.util.Util.splitButDifferent; -public final class iaeaNuclide { +public final class EMNuclideIAEA { public static final double AMU_TO_EV_DIV_C_C=9.31494061E08D,MICRO_AMU_TO_EV_DIV_C_C=9.31494061E02D; //Nuclide T1/2 T1/2 [s] Decay Modes ? Q Q?- Q? QEC Q?- n Sn Sp Binding/A Atomic Mass Mass Excess Discovery @@ -19,27 +18,27 @@ public final class iaeaNuclide { //Z,N,symb,radius, unc, energy, unc, jp, half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quad , unc,Qb-,unc,Qb- n,unc,Qa, unc, Qec, unc,Sn,unc, Sp,unc,Binding/A,unc,atomic mass, unc, mass excess,unc, //Z,N,symbol,energy , unc, jp,half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quadrupole , unc, - private static final HashMap<Integer,iaeaNuclide> NUCLIDES=new HashMap<>(); + private static final HashMap<Integer, EMNuclideIAEA> NUCLIDES =new HashMap<>(); public static void run(){ String line=""; try { - BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("nuclides.csv"))); + BufferedReader reader = new BufferedReader(new InputStreamReader(EMNuclideIAEA.class.getResourceAsStream("nuclides.csv"))); ArrayList<String[]> blockOfData=new ArrayList<>(4); while((line=reader.readLine())!=null) { - String[] split= Util.splitButDifferent(line,","); + String[] split= splitButDifferent(line,","); if(split.length!=19) { throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuclides database " + line); } if(!split[1].isEmpty() && !blockOfData.isEmpty()) { - new iaeaNuclide(blockOfData.toArray(new String[blockOfData.size()][])); + new EMNuclideIAEA(blockOfData.toArray(new String[blockOfData.size()][])); blockOfData.clear(); } blockOfData.add(split); } if(!blockOfData.isEmpty()) { - new iaeaNuclide(blockOfData.toArray(new String[blockOfData.size()][])); + new EMNuclideIAEA(blockOfData.toArray(new String[blockOfData.size()][])); blockOfData.clear(); } reader.close(); @@ -49,11 +48,11 @@ public final class iaeaNuclide { } try { - BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("nuclidesTable.csv"))); + BufferedReader reader = new BufferedReader(new InputStreamReader(EMNuclideIAEA.class.getResourceAsStream("nuclidesTable.csv"))); while((line=reader.readLine())!=null) { - String[] split= Util.splitButDifferent(line,","); + String[] split= splitButDifferent(line,","); if(split.length!=47) { - throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuvlidesTable database " + line); + throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuclidesTable database " + line); } get(Integer.parseInt(split[0]),Integer.parseInt(split[1])).getMoreData(split); } @@ -64,9 +63,9 @@ public final class iaeaNuclide { } try { - BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("energyLevels.csv"))); + BufferedReader reader = new BufferedReader(new InputStreamReader(EMNuclideIAEA.class.getResourceAsStream("energyLevels.csv"))); while((line=reader.readLine())!=null) { - String[] split= Util.splitButDifferent(line,","); + String[] split= splitButDifferent(line,","); if(split.length!=27) { throw new Error("Invalid count (" + split.length + ") of separators in IAEA energyLevels database " + line); } @@ -78,36 +77,37 @@ public final class iaeaNuclide { e.printStackTrace(); } - for(iaeaNuclide nuclide:NUCLIDES.values()) { + for(EMNuclideIAEA nuclide:NUCLIDES.values()) { nuclide.makeArrayOfEnergyStates(); } } - public static iaeaNuclide get(int protons, int neutrons){ + public static EMNuclideIAEA get(int protons, int neutrons){ return NUCLIDES.get((protons<<16)+neutrons); } - public final short N,Z; - public final float halfTime;//sec - public final float mass;//eV/c^2 - public final short discovery;//year - private TreeMap<Float,energeticState> energeticStates; - public energeticState[] energeticStatesArray; + private final short N; + private final short Z; + private final double halfTime;//sec + private final double mass;//eV/c^2 + private final short discovery;//year + private TreeMap<Double,energeticState> energeticStates; + private energeticState[] energeticStatesArray; - private iaeaNuclide(String[][] rows){ + private EMNuclideIAEA(String[][] rows){ N=Short.parseShort(rows[1][2]); Z=Short.parseShort(rows[1][0]); - NUCLIDES.put(((int)Z <<16)+N,this); + NUCLIDES.put(((int) getZ() <<16)+ getN(),this); - String[] parts = Util.splitButDifferent(rows[0][16], "|"); + String[] parts = splitButDifferent(rows[0][16], "|"); double Mass=doubleOrNaN(parts[0],"mass"); if(!Double.isNaN(Mass)) { //System.out.println("Mass =\t" + Mass+"\t"+(N+Z)+"\t"+N+"\t"+Z+"\t"+(Mass/(N+Z))); - mass = (float)(Mass* MICRO_AMU_TO_EV_DIV_C_C); + mass = Mass* MICRO_AMU_TO_EV_DIV_C_C; } else { - mass = Float.NaN; + mass = Double.NaN; } discovery=(short)doubleOrNaN(rows[0][18],"discovery"); @@ -115,8 +115,8 @@ public final class iaeaNuclide { 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"); + parts = splitButDifferent(rows[0][4], "|"); + halfTime = doubleOrNaN(parts[0],"half life"); } } @@ -126,15 +126,29 @@ public final class iaeaNuclide { // if (add(cells[17])) System.out.println(N + " " + Z); // if (add(cells[20])) System.out.println(N + " " + Z); //} - new energeticState(this, halfTime, getDecaysFixed(cells[14],doubleOrNaN(cells[15],"chance1"),cells[17],doubleOrNaN(cells[18],"chance1"),cells[20],doubleOrNaN(cells[21],"chance1"))); + new energeticState(this, getHalfTime(), 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.isEmpty()) { - energeticStatesArray = empty; + setEnergeticStatesArray(empty); } else { - energeticStatesArray = energeticStates.values().toArray(new energeticState[0]); + setEnergeticStatesArray(energeticStates.values().toArray(new energeticState[0])); + double life= getHalfTime(); + for (energeticState energeticState : getEnergeticStatesArray()) { + if(Double.isNaN(energeticState.Thalf)){ + energeticState.Thalf=life; + }else { + life=energeticState.Thalf; + } + } } } @@ -148,19 +162,47 @@ public final class iaeaNuclide { } return value != 0 ?value:Double.NaN; } catch (Exception e) { - System.out.println("Invalid Value " + name + ' ' + N + ' ' + Z + ' ' + s); + System.out.println("Invalid Value " + name + ' ' + getN() + ' ' + getZ() + ' ' + s); e.printStackTrace(); } } return Double.NaN; } + public short getN() { + return N; + } + + public short getZ() { + return Z; + } + + public double getHalfTime() { + return halfTime; + } + + public double getMass() { + return mass; + } + + public short getDiscovery() { + return discovery; + } + + public energeticState[] getEnergeticStatesArray() { + return energeticStatesArray; + } + + public void setEnergeticStatesArray(energeticState[] energeticStatesArray) { + this.energeticStatesArray = energeticStatesArray; + } + public static final class energeticState{ - public final float energy; - public final float Thalf; + public final double energy; + public double Thalf; public final iaeaDecay[] decaymodes; - private energeticState(iaeaNuclide nuclide,float Thalf,iaeaDecay[] decaymodes){ + private energeticState(EMNuclideIAEA nuclide, double Thalf, iaeaDecay[] decaymodes){ energy=0; this.Thalf=Thalf; this.decaymodes=decaymodes; @@ -171,17 +213,17 @@ public final class iaeaNuclide { } private energeticState(String[] cells){ - iaeaNuclide nuclide= get((int)doubleOrNaN(cells[0],"protons"),(int)doubleOrNaN(cells[1],"neutrons")); + EMNuclideIAEA nuclide = get((int)doubleOrNaN(cells[0],"protons"),(int)doubleOrNaN(cells[1],"neutrons")); if(nuclide==null) { throw new Error("Missing nuclide " + (int) doubleOrNaN(cells[0], "protons") + ' ' + (int) doubleOrNaN(cells[1], "neutrons")); } - energy =(float) (doubleOrNaN(cells[3],"energy level",nuclide)*1000f);//to eV + energy =doubleOrNaN(cells[3],"energy level",nuclide)*1000D;//to eV if(energy<0) { - throw new Error("Invalid energy " + nuclide.N + ' ' + nuclide.Z + ' ' + cells[3]); + throw new Error("Invalid energy " + nuclide.getN() + ' ' + nuclide.getZ() + ' ' + cells[3]); } - Thalf =(float) doubleOrNaN(cells[10],"half life",nuclide); + Thalf =doubleOrNaN(cells[10],"half life",nuclide); if(nuclide.energeticStates==null) { - new Exception("Should be initialized before doing this... "+ nuclide.N + ' ' +nuclide.Z).printStackTrace(); + new Exception("Should be initialized before doing this... "+ nuclide.getN() + ' ' + nuclide.getZ()).printStackTrace(); nuclide.energeticStates = new TreeMap<>(); } nuclide.energeticStates.put(energy,this); @@ -190,14 +232,20 @@ public final class iaeaNuclide { // if (add(cells[15])) System.out.println(nuclide.N + " " + nuclide.Z); // if (add(cells[18])) System.out.println(nuclide.N + " " + nuclide.Z); //} - 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)); + 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){ + private double doubleOrNaN(String s, String name, EMNuclideIAEA nuclide){ s = s.replaceAll("#", ""); if (!s.isEmpty()) { try { @@ -206,7 +254,7 @@ public final class iaeaNuclide { if(nuclide==null){ System.out.println("Invalid Value " + name + ' ' + s); }else { - System.out.println("Invalid Value " + name + ' ' + nuclide.N + ' ' + nuclide.Z + ' ' + s); + System.out.println("Invalid Value " + name + ' ' + nuclide.getN() + ' ' + nuclide.getZ() + ' ' + s); } e.printStackTrace(); } @@ -231,40 +279,40 @@ public final class iaeaNuclide { do3= !decay3.isEmpty() && !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)); + decays.put(1D, new iaeaDecay(1D, decay1)); if(do3) { chance3/=100d; - decays.put(chance3, new iaeaDecay((float) chance3, decay2)); + decays.put(chance3, new iaeaDecay(chance3, decay2)); chance2=1d-chance3; } chance2/=2d; - decays.put(chance2, new iaeaDecay((float) chance2, decay2)); + decays.put(chance2, new iaeaDecay(chance2, decay2)); }else if(do1 && chance1==100){ - decays.put(1D, new iaeaDecay(1f, decay1)); + decays.put(1D, new iaeaDecay(1D, decay1)); if(do2) { chance2/=100d; - decays.put(chance2, new iaeaDecay((float) chance2, decay2)); + decays.put(chance2, new iaeaDecay(chance2, decay2)); } if(do3) { chance3 /= 100d; if(do2) { chance3 *= chance2; } - decays.put(chance3, new iaeaDecay((float) chance3, decay3)); + decays.put(chance3, new iaeaDecay(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)); + decays.put(chance1, new iaeaDecay(chance1, decay1)); } if(do2) { chance2/=normalization; - decays.put(chance2, new iaeaDecay((float) chance2, decay2)); + decays.put(chance2, new iaeaDecay(chance2, decay2)); } if(do3) { chance3/=normalization; - decays.put(chance3, new iaeaDecay((float) chance3, decay3)); + decays.put(chance3, new iaeaDecay(chance3, decay3)); } if(do1||do2||do3) { decays.put(1D, iaeaDecay.DEAD_END); @@ -277,10 +325,10 @@ public final class iaeaNuclide { } public static final class iaeaDecay{ - public final float chance; + public final double chance; public final String decayName; - public static final iaeaDecay DEAD_END=new iaeaDecay(1f,"DEAD_END"); - private iaeaDecay(float chance,String decayName){ + public static final iaeaDecay DEAD_END=new iaeaDecay(1D,"DEAD_END"); + private iaeaDecay(double chance,String decayName){ this.chance=chance; this.decayName=decayName; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java deleted file mode 100644 index ea8f6bc201..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dAtomDefinition.java +++ /dev/null @@ -1,1685 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; - -import com.github.technus.tectech.Reference; -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; -import com.github.technus.tectech.XSTR; -import com.github.technus.tectech.compatibility.gtpp.GtppAtomLoader; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalMutableDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition; -import cpw.mods.fml.common.Loader; -import gregtech.api.enums.Materials; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.*; - -import static com.github.technus.tectech.XSTR.XSTR_INSTANCE; -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition.getNbtTagCompound; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; -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 final iaeaNuclide iaea; - - private static dAtomDefinition somethingHeavy; - public static dAtomDefinition getSomethingHeavy() { - return somethingHeavy; - } - - private static final ArrayList<Runnable> overrides = new ArrayList<>(); - public static void addOverride(dAtomDefinition atom, 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"); - } - 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; - chargeLeptons = cLeptons; - charge = cNucleus + cLeptons; - this.neutralCount = neutralCount; - this.element = element; - - element = Math.abs(element); - - //stability curve - int StableIsotope = stableIzoCurve(element); - int izoDiff = neutralCount - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); - - xstr.setSeed((element + 1L) * (neutralCount + 100L)); - iaea =iaeaNuclide.get(element,neutralCount); - if(iaea!=null){ - if(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); - } - rawLifeTime =rawLifeTimeTemp> iElementalDefinition.STABLE_RAW_LIFE_TIME ? iElementalDefinition.STABLE_RAW_LIFE_TIME :rawLifeTimeTemp; - }else { - rawLifeTime = containsAnti ? iaea.halfTime * 1.5514433E-21f * (1f + xstr.nextFloat() * 9f) : iaea.halfTime; - } - 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); - } - rawLifeTime =rawLifeTimeTemp> iElementalDefinition.STABLE_RAW_LIFE_TIME ? iElementalDefinition.STABLE_RAW_LIFE_TIME :rawLifeTimeTemp; - - iaeaDefinitionExistsAndHasEnergyLevels =false; - } - - if(iaea==null || iaea.energeticStatesArray[0].energy!=0) { - if (izoDiff == 0) { - decayMode = 0; - } else { - decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) : (byte) -Math.min(2, 1 + izoDiffAbs / 4); - } - }else{ - decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4)+ BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET); - } - //this.stable = this.rawLifeTime >= STABLE_RAW_LIFE_TIME; - - hash=super.hashCode(); - } - - private static int stableIzoCurve(int element) { - return (int) Math.round(-1.19561E-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; - 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() { - int element = Math.abs(this.element); - boolean negative = this.element < 0; - try { - if (Math.abs(type) != 1) { - return (negative ? "~? " : "? ") + nomenclature.Name[element]; - } - return negative ? '~' + nomenclature.Name[element] : nomenclature.Name[element]; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return (negative ? "Element: ~" : "Element: ") + element; - } - } - - @Override - public String getSymbol() { - int element = Math.abs(this.element); - boolean negative = this.element < 0; - try { - return (negative ? "~" : "") + nomenclature.Symbol[element] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C:" + getCharge(); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - try { - int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; - return (negative ? "~" : "") + nomenclature.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 String getShortSymbol() { - int element = Math.abs(this.element); - boolean negative = this.element < 0; - try { - return (negative ? "~" : "") + nomenclature.Symbol[element]; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - try { - int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; - return (negative ? "~" : "") + nomenclature.SymbolIUPAC[10 + s100] + nomenclature.SymbolIUPAC[s10] + nomenclature.SymbolIUPAC[s1]; - } catch (Exception E) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return (negative ? "~" : "") + "?"; - } - } - } - - @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 (type == 1) { - switch (decayMode) { - case -2: - if(TecTech.RANDOM.nextBoolean() && ElectronCapture(decaysList)) { - return decaysList.toArray(cElementalDecay.noProduct); - } else if(PbetaDecay(decaysList)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - break; - case -1: - if(Emmision(decaysList, dHadronDefinition.hadron_p1)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - break; - case 0: - if(alphaDecay(decaysList)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - break; - case 1: - if(Emmision(decaysList, dHadronDefinition.hadron_n1)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - break; - case 2: - if(MbetaDecay(decaysList)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - break; - default: - if(decayMode>8){ - if(iaeaDecay(decaysList,0)) { - return decaysList.toArray(cElementalDecay.noProduct); - } - return getDecayArray(decaysList,decayMode- BYTE_OFFSET,false); - } - } - return cElementalDecay.noDecay; - }else if(type ==-1){ - dAtomDefinition anti=getAnti(); - if(anti!=null) { - return anti.getDecayArray(decaysList, decayMode, false); - } - } - return getNaturalDecayInstant(); - } - - private boolean iaeaDecay(ArrayList<cElementalDecay> decaysList,long energy){ - iaeaNuclide.energeticState state; - if(energy>iaea.energeticStatesArray.length) { - state = iaea.energeticStatesArray[iaea.energeticStatesArray.length - 1]; - } else if(energy<=0) { - state = iaea.energeticStatesArray[0]; - } else { - state = iaea.energeticStatesArray[(int) energy]; - } - for (int i=0;i<state.decaymodes.length;i++){ - if(!getDecayFromIaea(decaysList,state.decaymodes[i],energy)) { - decaysList.clear(); - return false; - } - } - return !decaysList.isEmpty(); - } - - private boolean getDecayFromIaea(ArrayList<cElementalDecay> decaysList, iaeaNuclide.iaeaDecay decay, long energy){ - 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_optimized_unsafeLeavesExposedElementalTree())); - return true; - } - } break; - case "3H": { - if (withThis.removeAllAmounts(false, tritium.definition.getSubParticles())){ - withThis.putReplace(tritium); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - } - } break; - case "3HE": { - if (withThis.removeAllAmounts(false, helium_3.definition.getSubParticles())){ - withThis.putReplace(helium_3); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - } - } break; - case "8BE": { - if (withThis.removeAllAmounts(false, beryllium_8.definition.getSubParticles())){ - withThis.putReplace(beryllium_8); - decaysList.add(new cElementalDecay(decay.chance,withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - } - } break; - case "14C": { - if (withThis.removeAllAmounts(false, carbon_14.definition.getSubParticles())){ - newStuff.putReplace(carbon_14); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "24NE": { - if (withThis.removeAllAmounts(false, neon_24.definition.getSubParticles())){ - newStuff.putReplace(neon_24); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "34SI": { - if (withThis.removeAllAmounts(false, silicon_34.definition.getSubParticles())){ - newStuff.putReplace(silicon_34); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "A": case "A?": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2,dHadronDefinition.hadron_p2)){ - newStuff.putReplace(alpha); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B+": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "2B+": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){ - withThis.putUnify(dHadronDefinition.hadron_n2); - newStuff.putReplace(eLeptonDefinition.lepton_e_2); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B-": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ - withThis.putUnify(dHadronDefinition.hadron_p1); - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "2B-": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){ - withThis.putUnify(dHadronDefinition.hadron_p2); - newStuff.putReplace(eLeptonDefinition.lepton_e2); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "EC": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "2EC": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e2)){ - withThis.putUnify(dHadronDefinition.hadron_n2); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B++EC": case "EC+B+": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){ - withThis.putUnify(dHadronDefinition.hadron_n2); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B+A": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p3, dHadronDefinition.hadron_n1)){ - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(alpha); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B+P": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(dHadronDefinition.hadron_p1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B+2P": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p3)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(dHadronDefinition.hadron_p2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B-A": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n3, dHadronDefinition.hadron_p1)){ - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - newStuff.putReplace(alpha); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B-N": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){ - withThis.putUnify(dHadronDefinition.hadron_p1); - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - newStuff.putReplace(dHadronDefinition.hadron_n1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B-2N": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n3)){ - withThis.putUnify(dHadronDefinition.hadron_p1); - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - newStuff.putReplace(dHadronDefinition.hadron_n2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "B-P": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - newStuff.putReplace(dHadronDefinition.hadron_p1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "ECA": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1,eLeptonDefinition.lepton_e1,dHadronDefinition.hadron_p3)){ - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(alpha); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "ECP": { - if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e1,dHadronDefinition.hadron_p2)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(dHadronDefinition.hadron_p1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "EC2P": { - if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e1,dHadronDefinition.hadron_p3)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(dHadronDefinition.hadron_p2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "ECP+EC2P": {//todo look at branching ratios - if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e2,dHadronDefinition.hadron_p5)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - newStuff.putReplace(dHadronDefinition.hadron_p3); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "N": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ - newStuff.putReplace(dHadronDefinition.hadron_n1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "2N": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n2)){ - newStuff.putReplace(dHadronDefinition.hadron_n2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "P": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1)){ - newStuff.putReplace(dHadronDefinition.hadron_p1); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "2P": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2)){ - newStuff.putReplace(dHadronDefinition.hadron_p2); - try{ - newStuff.putReplace(new dAtomDefinition(withThis.toImmutable_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "SF": { - if (Fission(decaysList, withThis, newStuff, decay.chance, false)) { - return true; - } - } break; - case "B-F": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_n1)){ - withThis.putUnify(dHadronDefinition.hadron_p1); - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { - return true; - } - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "ECF": case "ECSF": case "EC(+SF)": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)){ - withThis.putUnify(dHadronDefinition.hadron_n1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { - return true; - } - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "SF(+EC+B+)": case "SF+EC+B+": { - if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){ - withThis.putUnify(dHadronDefinition.hadron_n2); - newStuff.putReplace(eLeptonDefinition.lepton_e_1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve2); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { - return true; - } - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "SF+EC+B-": { - if (withThis.removeAllAmounts(false, eLeptonDefinition.lepton_e1)){ - newStuff.putReplace(eLeptonDefinition.lepton_e1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve1); - newStuff.putReplace(eNeutrinoDefinition.lepton_Ve_1); - try{ - if(Fission(decaysList,withThis,newStuff,decay.chance,false)) { - return true; - } - }catch (Exception e){ - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - } - } break; - case "IT": case "IT?": case "G": { - if(energy>0){ - decaysList.add(new cElementalDecay(decay.chance, this, boson_Y__)); - 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_optimized_unsafeLeavesExposedElementalTree()).getStackForm(1)); - decaysList.add(new cElementalDecay(decay.chance,newStuff.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - 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) { - cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAmount(false, emit)) { - try { - decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), emit)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean alphaDecay(ArrayList<cElementalDecay> decaysList) { - cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); - if (tree.removeAllAmounts(false, alpha.definition.getSubParticles())) { - try { - decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), alpha)); - return true; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - } - return false; - } - - private boolean MbetaDecay(ArrayList<cElementalDecay> decaysList) { - 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_optimized_unsafeLeavesExposedElementalTree()), 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) { - 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_optimized_unsafeLeavesExposedElementalTree()), 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) { - 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_optimized_unsafeLeavesExposedElementalTree()), 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) { - cElementalMutableDefinitionStackMap heavy = new cElementalMutableDefinitionStackMap(); - 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_optimized_unsafeLeavesExposedElementalTree()),1)); - particles.putReplace(new cElementalDefinitionStack(new dAtomDefinition(heavy.toImmutable_optimized_unsafeLeavesExposedElementalTree()),1)); - decaysList.add(new cElementalDecay(probability, particles.toImmutable_optimized_unsafeLeavesExposedElementalTree())); - return true; - } catch (Exception e) { - if(DEBUG_MODE) { - e.printStackTrace(); - } - } - return false; - } - - private static double[] liquidDropFunction(boolean asymmetric) { - double[] out = new double[3]; - - out[0] = XSTR_INSTANCE.nextGaussian(); - - if (out[0] < 1 && out[0] >= -1) { - if (XSTR_INSTANCE.nextBoolean()) { - out[0] = XSTR_INSTANCE.nextDouble() * 2d - 1d; - } - } - - if (asymmetric && out[0] > XSTR_INSTANCE.nextDouble() && XSTR_INSTANCE.nextInt(4) == 0) { - out[0] = -out[0]; - } - - //scale to splitting ratio - out[0] = out[0] * 0.05d + .6d; - - if (out[0] < 0 || out[0] > 1) { - return liquidDropFunction(asymmetric); - } - if (out[0] < .5d) { - out[0] = 1d - out[0]; - } - - //extra neutrals - out[2] = 0.012d + XSTR_INSTANCE.nextDouble() * 0.01d; - - if (asymmetric) { - out[1] = out[0]; - } else { - out[1] = out[0] - out[2] * .5d; - } - - return out; - } - - @Override - public cElementalDecay[] getEnergyInducedDecay(long energyLevel) { - if (iaeaDefinitionExistsAndHasEnergyLevels) { - ArrayList<cElementalDecay> decays=new ArrayList<>(4); - if(iaeaDecay(decays,energyLevel)){ - return decays.toArray(cElementalDecay.noProduct); - } - } - if(energyLevel< Math.abs(charge)/3+neutralCount) { - return new cElementalDecay[]{new cElementalDecay(1, this, boson_Y__)}; - } - return getNaturalDecayInstant(); - } - - @Override - public 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 iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); - } else { - result += iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * -currentEnergyLevel; - } - }else { - result -= iaea.energeticStatesArray[(int) Math.min(iaea.energeticStatesArray.length - 1, currentEnergyLevel)].energy; - } - if(newEnergyLevel>=iaea.energeticStatesArray.length){ - if(currentEnergyLevel>=iaea.energeticStatesArray.length) { - return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); - } else { - result += iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - iaea.energeticStatesArray.length + 1); - } - result+=iaea.energeticStatesArray[iaea.energeticStatesArray.length-1].energy; - }else { - result += iaea.energeticStatesArray[(int) Math.max(0, newEnergyLevel)].energy; - } - - return backwards?-result:result; - } - return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return iaeaDefinitionExistsAndHasEnergyLevels; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - if(!iaeaDefinitionExistsAndHasEnergyLevels) return false; - iaeaNuclide.energeticState state; - if(energyLevel>iaea.energeticStatesArray.length) { - state = iaea.energeticStatesArray[iaea.energeticStatesArray.length - 1]; - } else if(energyLevel<=0) { - state = iaea.energeticStatesArray[0]; - } else { - state = iaea.energeticStatesArray[(int) energyLevel]; - } - for (iaeaNuclide.iaeaDecay decay:state.decaymodes){ - if(decay.decayName.contains("F")) return true;//if is fissile - } - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return iaeaDefinitionExistsAndHasEnergyLevels; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - return iaea!=null || iaeaDefinitionExistsAndHasEnergyLevels; - } - - @Override - public cElementalDecay[] getNaturalDecayInstant() { - //disembody - ArrayList<cElementalDefinitionStack> decaysInto = new ArrayList<>(); - for (cElementalDefinitionStack elementalStack : elementalStacks.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[0])), deadEnd}; - } - - //@Override - //public iElementalDefinition getAnti() { - // cElementalDefinitionStack[] stacks = this.elementalStacks.values(); - // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length]; - // for (int i = 0; i < antiElements.length; i++) { - // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount); - // } - // try { - // return new dAtomDefinition(false, antiElements); - // } catch (tElementalException e) { - // if (DEBUG_MODE) e.printStackTrace(); - // return null; - // } - //} - - @Override - public dAtomDefinition getAnti() { - cElementalMutableDefinitionStackMap anti = new cElementalMutableDefinitionStackMap(); - for (cElementalDefinitionStack stack : elementalStacks.values()) { - anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount)); - } - try { - return new dAtomDefinition(anti.toImmutable_optimized_unsafeLeavesExposedElementalTree()); - } 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 static final class nomenclature { - private static final String[] Symbol = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; - private static final String[] Name = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; - private static final String[] 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() { - return getNbtTagCompound(nbtType, elementalStacks); - } - - public static dAtomDefinition fromNBT(NBTTagCompound nbt) { - cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[nbt.getInteger("i")]; - for (int i = 0; i < stacks.length; i++) { - stacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); - } - try { - return new dAtomDefinition(stacks); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - public static void run() { - for (Runnable r : overrides) { - r.run(); - } - - for(Map.Entry<dAtomDefinition,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 - int StableIsotope = stableIzoCurve(element); - int izoDiff = isotope - StableIsotope; - int izoDiffAbs = Math.abs(izoDiff); - 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.computeIfAbsent(element, k -> new TreeSet<>()); - isotopes.add(isotope); - } - } - } - - //populate unstable isotopes - for (int element = 83; element < 150; element++) { - for (int isotope = 100; isotope < 180; isotope++) { - xstr.setSeed((long) (element + 1) * (isotope + 100)); - //stability curve - int Isotope = stableIzoCurve(element); - int izoDiff = isotope - Isotope; - int izoDiffAbs = Math.abs(izoDiff); - float rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); - TreeMap<Float, Integer> isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>()); - isotopes.put(rawLifeTime, isotope); - } - } - - try { - for (Map.Entry<Integer, TreeSet<Integer>> integerTreeSetEntry : stableIsotopes.entrySet()) { - stableAtoms.put(integerTreeSetEntry.getKey(), new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, integerTreeSetEntry.getKey()), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, integerTreeSetEntry.getValue().first()), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, integerTreeSetEntry.getKey()))); - if (DEBUG_MODE) { - TecTech.LOGGER.info("Added Stable Atom:" + integerTreeSetEntry.getKey() + ' ' + integerTreeSetEntry.getValue().first() + ' ' + stableAtoms.get(integerTreeSetEntry.getKey()).getMass()); - } - } - for (Map.Entry<Integer, TreeMap<Float, Integer>> integerTreeMapEntry : mostStableUnstableIsotopes.entrySet()) { - unstableAtoms.put(integerTreeMapEntry.getKey(), new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, integerTreeMapEntry.getKey()), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, integerTreeMapEntry.getValue().lastEntry().getValue()), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, integerTreeMapEntry.getKey()))); - if (DEBUG_MODE) { - TecTech.LOGGER.info("Added Unstable Atom:" + integerTreeMapEntry.getKey() + ' ' + integerTreeMapEntry.getValue().lastEntry().getValue() + ' ' + unstableAtoms.get(integerTreeMapEntry.getKey()).getMass()); - } - } - deuterium=new dAtomDefinition( - dHadronDefinition.hadron_p1, - dHadronDefinition.hadron_n1, - eLeptonDefinition.lepton_e1).getStackForm(1); - tritium=new dAtomDefinition( - dHadronDefinition.hadron_p1, - dHadronDefinition.hadron_n2, - eLeptonDefinition.lepton_e1).getStackForm(1); - helium_3=new dAtomDefinition( - dHadronDefinition.hadron_p2, - dHadronDefinition.hadron_n1, - eLeptonDefinition.lepton_e2).getStackForm(1); - alpha = new dAtomDefinition( - dHadronDefinition.hadron_p2, - dHadronDefinition.hadron_n2).getStackForm(1); - beryllium_8=new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 4), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 4), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 4)).getStackForm(1); - carbon_14=new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 6), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 8), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 6)).getStackForm(1); - neon_24=new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 10), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 14), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 10)).getStackForm(1); - silicon_34=new dAtomDefinition( - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 14), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 20), - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 14)).getStackForm(1); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - - try { - cElementalDefinition.addCreatorFromNBT(nbtType, dAtomDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)64); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if(DEBUG_MODE) { - TecTech.LOGGER.info("Registered Elemental Matter Class: Atom " + nbtType + ' ' + 64); - } - } - - public static void setTransformation(){ - /*----STABLE ATOMS----**/ - refMass = getFirstStableIsotope(1).getMass() * 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), dust, Materials.Uranium/*238*/,1); - - float tempMass=temp.getMass(); - - 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), dust, Materials.Uranium235,1); - - TecTech.LOGGER.info("Diff Mass U : "+(tempMass-temp.getMass())); - - temp=new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 145) - ); - transformation.addOredict(new cElementalDefinitionStack(temp, 144), dust, Materials.Plutonium/*239*/,1); - - somethingHeavy=new dAtomDefinition( - new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), - new cElementalDefinitionStack(dHadronDefinition.hadron_n, 147) - ); - transformation.addOredict(new cElementalDefinitionStack(somethingHeavy, 144), dust, Materials.Plutonium241,1); - - TecTech.LOGGER.info("Diff Mass Pu: "+(somethingHeavy.getMass()-temp.getMass())); - - TecTech.LOGGER.info("Neutron Mass: "+dHadronDefinition.hadron_n.getMass()); - - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - - if(Loader.isModLoaded(Reference.GTPLUSPLUS)) { - new GtppAtomLoader().run(); - } - } - - public static dAtomDefinition getFirstStableIsotope(int element) { - return stableAtoms.get(element); - } - - public static dAtomDefinition getBestUnstableIsotope(int element) { - return unstableAtoms.get(element); - } - - @Override - public byte getClassType() { - return 64; - } - - public static byte getClassTypeStatic(){ - return 64; - } - - @Override - public int hashCode() { - return hash; - } - - @Override - public void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel) { - if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add(getShortSymbol()); - } - } - - @Override - public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { - if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + nbtType + ' ' + getClassType()); - } - if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("NAME = "+getName()); - lines.add("SYMBOL = "+getSymbol()); - } - if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3f + " e"); - } - if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); - } - if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) { - lines.add("MASS = " + getMass() + " eV/c\u00b2"); - } - if(iaeaDefinitionExistsAndHasEnergyLevels && Util.areBitsSet(SCAN_GET_ENERGY_STATES,capabilities)){ - for(int i=1;i<iaea.energeticStatesArray.length;i++){ - lines.add("E LEVEL "+i+" = "+iaea.energeticStatesArray[i].energy+" eV"); - } - } - if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ - lines.add("HALF LIFE = "+getRawTimeSpan(energyLevel)+ " s"); - lines.add(" At current energy level"); - } - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java deleted file mode 100644 index 404f116adf..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java +++ /dev/null @@ -1,514 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.complex; - -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalMutableDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.*; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; -import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; -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 java.util.HashMap; -import java.util.Map; -import java.util.TreeMap; - -import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition.getNbtTagCompound; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.transformation; -import static com.github.technus.tectech.mechanics.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. - */ -public final class dHadronDefinition extends cElementalDefinition {//TODO Optimize map i/o - private final int hash; - - private static final byte nbtType = (byte) 'h'; - //Helpers - public static final Map<dHadronDefinition,String> SYMBOL_MAP =new HashMap<>(); - public static final Map<dHadronDefinition,String> NAME_MAP =new HashMap<>(); - public static dHadronDefinition hadron_p, hadron_n, hadron_p_, hadron_n_; - public static cElementalDefinitionStack hadron_p1, hadron_n1, hadron_p2, hadron_n2, hadron_p3, hadron_n3, hadron_p5; - private static float protonMass = 0F; - private static float neutronMass = 0F; - private static final float actualProtonMass=938272081.3f; - private static final float actualNeutronMass=939565413.3f; - - //float-mass in eV/c^2 - public final float mass; - //int -electric charge in 1/3rds of electron charge for optimization - public final int charge; - public final float rawLifeTime; - public final byte amount; - //generation max present inside - minus if contains any antiquark - public final byte type; - //private final FluidStack fluidThing; - //private final ItemStack itemThing; - - private final cElementalDefinitionStackMap quarkStacks; - - @Deprecated - public dHadronDefinition(eQuarkDefinition... quarks) throws tElementalException { - this(true, new cElementalDefinitionStackMap(quarks)); - } - - @Deprecated - private dHadronDefinition(boolean check, eQuarkDefinition... quarks) throws tElementalException { - this(check, new cElementalDefinitionStackMap(quarks)); - } - - public dHadronDefinition(cElementalDefinitionStack... quarks) throws tElementalException { - this(true, new cElementalDefinitionStackMap(quarks)); - } - - private dHadronDefinition(boolean check, cElementalDefinitionStack... quarks) throws tElementalException { - this(check, new cElementalDefinitionStackMap(quarks)); - } - - public dHadronDefinition(cElementalDefinitionStackMap quarks) throws tElementalException { - this(true, quarks); - } - - private dHadronDefinition(boolean check, cElementalDefinitionStackMap quarks) throws tElementalException { - if (check && !canTheyBeTogether(quarks)) { - throw new tElementalException("Hadron Definition error"); - } - quarkStacks = quarks; - - byte amount = 0; - int charge = 0; - int type = 0; - boolean containsAnti = false; - float mass = 0; - for (cElementalDefinitionStack quarkStack : quarkStacks.values()) { - amount += quarkStack.amount; - mass += quarkStack.getMass(); - charge += quarkStack.getCharge(); - type = Math.max(Math.abs(quarkStack.definition.getType()), type); - if (quarkStack.definition.getType() < 0) { - containsAnti = true; - } - } - this.amount = amount; - this.charge = charge; - this.type = containsAnti ? (byte) -type : (byte) type; - int mult = this.amount * this.amount * (this.amount - 1); - mass = mass * 5.543F * (float) mult;//yes it becomes heavier - - if (mass == protonMass && this.amount == 3) { - rawLifeTime = iElementalDefinition.STABLE_RAW_LIFE_TIME; - mass=actualProtonMass; - } else if (mass == neutronMass && this.amount == 3) { - rawLifeTime = 882F; - mass=actualNeutronMass; - } else { - if (this.amount == 3) { - rawLifeTime = 1.34F / mass * (float) Math.pow(9.81, charge); - } else if (this.amount == 2) { - rawLifeTime = 1.21F / mass / (float) Math.pow(19.80, charge); - } else { - rawLifeTime = 1.21F / mass / (float) Math.pow(9.80, charge); - } - } - this.mass=mass; - hash=super.hashCode(); - } - - //public but u can just try{}catch(){} the constructor it still calls this method - private static boolean canTheyBeTogether(cElementalDefinitionStackMap stacks) { - long amount = 0; - for (cElementalDefinitionStack quarks : stacks.values()) { - if (!(quarks.definition instanceof eQuarkDefinition)) { - return false; - } - amount += quarks.amount; - } - return amount >= 2 && amount <= 12; - } - - @Override - public String getName() { - StringBuilder name= new StringBuilder(getSimpleName()); - name.append(':'); - String sym= NAME_MAP.get(this); - if(sym!=null){ - name.append(' ').append(sym); - }else { - for (cElementalDefinitionStack quark : quarkStacks.values()) { - name.append(' ').append(quark.definition.getSymbol()).append(quark.amount); - } - } - return name.toString(); - } - - private String getSimpleName() { - switch (amount) { - case 2: - return "Meson"; - case 3: - return "Baryon"; - case 4: - return "Tetraquark"; - case 5: - return "Pentaquark"; - case 6: - return "Hexaquark"; - default: - return "Hadron"; - } - } - - @Override - public String getSymbol() { - String sym=SYMBOL_MAP.get(this); - if(sym!=null){ - return sym; - }else { - StringBuilder symbol = new StringBuilder(8); - for (cElementalDefinitionStack quark : quarkStacks.values()) { - for (int i = 0; i < quark.amount; i++) { - symbol.append(quark.definition.getSymbol()); - } - } - return symbol.toString(); - } - } - - @Override - public String getShortSymbol() { - String sym=SYMBOL_MAP.get(this); - if(sym!=null){ - return sym; - }else { - StringBuilder symbol = new StringBuilder(8); - for (cElementalDefinitionStack quark : quarkStacks.values()) { - for (int i = 0; i < quark.amount; i++) { - symbol.append(quark.definition.getShortSymbol()); - } - } - return symbol.toString(); - } - } - - @Override - public byte getColor() { - return -7; - } - - @Override - public cElementalDefinitionStackMap getSubParticles() { - return quarkStacks; - } - - @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 quarks : quarkStacks) { - if (quarks.definition.getType() == 1 || quarks.definition.getType() == -1) { - //covers both quarks and antiquarks - decaysInto.add(quarks); - } else { - //covers both quarks and antiquarks - decaysInto.add(new cElementalDefinitionStack(boson_Y__, 2)); - } - } - return new cElementalDecay[]{ - new cElementalDecay(0.75F, decaysInto.toArray(new cElementalDefinitionStack[0])), - eBosonDefinition.deadEnd - }; - } - - @Override - 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 cElementalDecay.noProduct; - } - return new cElementalDecay[]{new cElementalDecay(0.75F, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks - } - - @Override - public float getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); - } - - @Override - public boolean usesSpecialEnergeticDecayHandling() { - return false; - } - - @Override - public boolean usesMultipleDecayCalls(long energyLevel) { - return false; - } - - @Override - public boolean decayMakesEnergy(long energyLevel) { - return false; - } - - @Override - public boolean fusionMakesEnergy(long energyLevel) { - 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 cElementalDecay.noProduct; - } else if (amount != 3) { - return new cElementalDecay[]{new cElementalDecay(0.95F, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks - } else { - ArrayList<eQuarkDefinition> newBaryon = new ArrayList<>(); - iElementalDefinition[] Particles = new iElementalDefinition[2]; - for (cElementalDefinitionStack quarks : quarkStacks) { - for (int i = 0; i < quarks.amount; i++) { - newBaryon.add((eQuarkDefinition) quarks.definition); - } - } - //remove last - eQuarkDefinition lastQuark = newBaryon.remove(2); - - if (Math.abs(lastQuark.getType()) > 1) { - cElementalDefinitionStack[] decay = lastQuark.getDecayArray()[1].outputStacks.values(); - newBaryon.add((eQuarkDefinition) decay[0].definition); - Particles[0] = decay[1].definition; - Particles[1] = decay[2].definition; - } else { - cElementalDefinitionStack[] decay = lastQuark.getDecayArray()[0].outputStacks.values(); - newBaryon.add((eQuarkDefinition) decay[0].definition); - Particles[0] = decay[1].definition; - Particles[1] = decay[2].definition; - } - - eQuarkDefinition[] contentOfBaryon = newBaryon.toArray(new eQuarkDefinition[3]); - - try { - return new cElementalDecay[]{ - 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}; - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return new cElementalDecay[]{eBosonDefinition.deadEnd}; - } - } - } - - @Override - public float getMass() { - return mass; - } - - @Override - public int getCharge() { - return charge; - } - - @Override - public float getRawTimeSpan(long currentEnergy) { - return rawLifeTime; - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } - - @Override - public byte getType() { - return type; - } - - //@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; - // } - //} - - @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_optimized_unsafeLeavesExposedElementalTree()); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - @Override - public aFluidDequantizationInfo someAmountIntoFluidStack() { - return null; - } - - @Override - public aItemDequantizationInfo someAmountIntoItemsStack() { - return null; - } - - @Override - public aOredictDequantizationInfo someAmountIntoOredictStack() { - return null; - } - - @Override - public NBTTagCompound toNBT() { - return getNbtTagCompound(nbtType, quarkStacks); - } - - public static dHadronDefinition 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 dHadronDefinition(stacks); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - - public static void run() { - try { - hadron_p = new dHadronDefinition(new cElementalDefinitionStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1))); - protonMass = hadron_p.mass; - //redefine the proton with proper lifetime (the lifetime is based on mass comparison) - hadron_p = new dHadronDefinition(new cElementalDefinitionStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1))); - SYMBOL_MAP.put(hadron_p,"p"); - NAME_MAP.put(hadron_p,"Proton"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p); - hadron_p_ = (dHadronDefinition) hadron_p.getAnti(); - SYMBOL_MAP.put(hadron_p_,"~p"); - NAME_MAP.put(hadron_p_,"Anti Proton"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_p_); - hadron_n = new dHadronDefinition(new cElementalDefinitionStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2))); - neutronMass = hadron_n.mass; - //redefine the neutron with proper lifetime (the lifetime is based on mass comparison) - hadron_n = new dHadronDefinition(new cElementalDefinitionStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2))); - SYMBOL_MAP.put(hadron_n, "n"); - NAME_MAP.put(hadron_n, "Neutron"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n); - hadron_n_ = (dHadronDefinition) hadron_n.getAnti(); - SYMBOL_MAP.put(hadron_n_,"~n"); - NAME_MAP.put(hadron_n_,"Anti Neutron"); - DebugElementalInstanceContainer_EM.STACKS_REGISTERED.add(hadron_n_); - } catch (tElementalException e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - protonMass = -1; - neutronMass = -1; - } - hadron_p1 = new cElementalDefinitionStack(hadron_p, 1); - 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); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - if(DEBUG_MODE) { - 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(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; - } - - public static byte getClassTypeStatic(){ - return -64; - } - - @Override - public int hashCode() { - return hash; - } - - @Override - public void addScanShortSymbols(ArrayList<String> lines, int capabilities, long energyLevel) { - if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add(getShortSymbol()); - } - } - - @Override - public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { - if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) { - lines.add("CLASS = " + nbtType + ' ' + getClassType()); - } - if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { - lines.add("NAME = "+getSimpleName()); - //lines.add("SYMBOL = "+getSymbol()); - } - if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3f + " e"); - } - if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { - lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); - } - if(Util.areBitsSet(SCAN_GET_MASS,capabilities)) { - lines.add("MASS = " + getMass() + " eV/c\u00b2"); - } - if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)){ - lines.add("HALF LIFE = "+getRawTimeSpan(energyLevel)+ " s"); - lines.add(" "+"At current energy level"); - } - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java new file mode 100644 index 0000000000..affebf91a2 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMBosonDefinition.java @@ -0,0 +1,16 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; + +import static net.minecraft.util.StatCollector.translateToLocal; + +public abstract class EMBosonDefinition extends EMPrimitiveTemplate { + protected EMBosonDefinition(String name, String symbol, int generation, double mass, int charge, int color, int ID, String bind) { + super(name, symbol, generation, mass, charge, color, ID, bind); + } + + @Override + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Boson"); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java new file mode 100644 index 0000000000..4c0e1d28bc --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMFermionDefinition.java @@ -0,0 +1,16 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; + +import static net.minecraft.util.StatCollector.translateToLocal; + +public abstract class EMFermionDefinition extends EMPrimitiveTemplate { + protected EMFermionDefinition(String name, String symbol, int generation, double mass, int charge, int color, int ID, String bind) { + super(name, symbol, generation, mass, charge, color, ID, bind); + } + + @Override + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Fermion"); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java new file mode 100644 index 0000000000..cf59c1fffd --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMGaugeBosonDefinition.java @@ -0,0 +1,83 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.*; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 22.10.2016. + */ +public class EMGaugeBosonDefinition extends EMBosonDefinition { + public static final EMGaugeBosonDefinition + boson_g__ = new EMGaugeBosonDefinition("tt.keyword.Gluon", "g", 0, 0, 8, 27, "g"), + boson_Y__ = new EMGaugeBosonDefinition("tt.keyword.Photon", "\u03b3", 1e-18D, 0, -1, 28, "Y"), + boson_Z = new EMGaugeBosonDefinition("tt.keyword.Weak0", "Z0", 91.1876e9, 0, -1, 29, "Z0"), + boson_W_ = new EMGaugeBosonDefinition("tt.keyword.WeakPlus", "W+", 80.379e9, 3, -1, 30, "W+"), + boson_W = new EMGaugeBosonDefinition("tt.keyword.WeakMinus", "W-", 80.379e9, -3, -1, 31, "W-"); + //deadEnd + public static final EMDecay deadEnd = new EMDecay(boson_Y__, boson_Y__); + public static final EMDefinitionStack boson_Y__1 = new EMDefinitionStack(boson_Y__, 1); + public static final EMDecay deadEndHalf = new EMDecay(boson_Y__1); + + protected EMGaugeBosonDefinition(String name, String symbol, double mass, int charge, int color, int ID, String bind) { + super(name, symbol, 0, mass, charge, color, ID, bind); + } + + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMGaugeBosonDefinition.class, "tt.keyword.GaugeBoson")); + boson_g__.init(registry, boson_g__, 3e-50, 0, 0, deadEndHalf); + boson_Y__.init(registry, boson_Y__, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + boson_Z.init(registry, boson_Z, 3e-25, 11, 11, + new EMDecay(0.03363, lepton_e, lepton_e_), + new EMDecay(0.03366, lepton_m, lepton_m_), + new EMDecay(0.03367, lepton_t, lepton_t_), + new EMDecay(0.068333, lepton_Ve, lepton_Ve_), + new EMDecay(0.068333, lepton_Vm, lepton_Vm_), + new EMDecay(0.068333, lepton_Vt, lepton_Vt_), + new EMDecay(0.118, quark_u, quark_u_), + new EMDecay(0.118, quark_c, quark_c_), + new EMDecay(0.152, quark_d, quark_d_), + new EMDecay(0.152, quark_s, quark_s_), + new EMDecay(0.152, quark_b, quark_b_), + deadEnd); + boson_W.init(registry, boson_W_, 3e-25, 9, 9, + new EMDecay(0.108, lepton_e, lepton_Ve_), + new EMDecay(0.108, lepton_m, lepton_Vm_), + new EMDecay(0.108, lepton_t, lepton_Vt_), + new EMDecay(0.112666, quark_u_, quark_d), + new EMDecay(0.112666, quark_u_, quark_s), + new EMDecay(0.112666, quark_u_, quark_b), + new EMDecay(0.112666, quark_c_, quark_d), + new EMDecay(0.112666, quark_c_, quark_s), + new EMDecay(0.112666, quark_c_, quark_b), + deadEnd); + boson_W_.init(registry, boson_W, 3e-25, 9, 9, + new EMDecay(0.108, lepton_e_, lepton_Ve), + new EMDecay(0.108, lepton_m_, lepton_Vm), + new EMDecay(0.108, lepton_t_, lepton_Vt), + new EMDecay(0.112666, quark_u, quark_d_), + new EMDecay(0.112666, quark_u, quark_s_), + new EMDecay(0.112666, quark_u, quark_b_), + new EMDecay(0.112666, quark_c, quark_d_), + new EMDecay(0.112666, quark_c, quark_s_), + new EMDecay(0.112666, quark_c, quark_b_), + deadEnd); + } + + @Override + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.GaugeBoson"); + } + + @Override + public boolean isTimeSpanHalfLife() { + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java new file mode 100644 index 0000000000..324d790de6 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMLeptonDefinition.java @@ -0,0 +1,73 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMScalarBosonDefinition.boson_H__; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 22.10.2016. + */ +public class EMLeptonDefinition extends EMFermionDefinition { + public static final EMLeptonDefinition + lepton_e = new EMLeptonDefinition("tt.keyword.Electron", "\u03b2-", 1, 0.511e6D, -3, 15,"e-"), + lepton_m = new EMLeptonDefinition("tt.keyword.Muon", "\u03bc-", 2, 105.658e6D, -3, 17,"m-"), + lepton_t = new EMLeptonDefinition("tt.keyword.Tauon", "\u03c4-", 3, 1776.83e6D, -3, 19,"t-"), + lepton_e_ = new EMLeptonDefinition("tt.keyword.Positron", "\u03b2+", -1, 0.511e6D, 3, 16,"e+"), + lepton_m_ = new EMLeptonDefinition("tt.keyword.Antimuon", "\u03bc+", -2, 105.658e6D, 3, 18,"m+"), + lepton_t_ = new EMLeptonDefinition("tt.keyword.Antitauon", "\u03c4+", -3, 1776.83e6D, 3, 20,"t+"); + + public static final EMDefinitionStack lepton_e1 = new EMDefinitionStack(lepton_e, 1); + public static final EMDefinitionStack lepton_e2 = new EMDefinitionStack(lepton_e, 2); + public static final EMDefinitionStack lepton_e_1 = new EMDefinitionStack(lepton_e_, 1); + public static final EMDefinitionStack lepton_e_2 = new EMDefinitionStack(lepton_e_, 2); + + protected EMLeptonDefinition(String name, String symbol, int type, double mass, int charge, int ID,String bind) { + super(name, symbol, type, mass, charge, -1, ID,bind); + //this.itemThing=null; + //this.fluidThing=null; + } + + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMLeptonDefinition.class,"tt.keyword.Lepton")); + lepton_e.init(registry,lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1, + deadEnd, + new EMDecay(lepton_e,boson_Y__)); + lepton_m.init(registry,lepton_m_, 2.197019e-6D, 0, 1, + new EMDecay(0.9D, lepton_e, lepton_Ve_, lepton_Vm), + deadEnd);//makes photons and don't care + lepton_t.init(registry,lepton_t_, 2.903e-13D, 1, 3, + new EMDecay(0.05F, lepton_m, lepton_Vm_, lepton_Vt, boson_H__), + new EMDecay(0.1D, lepton_e, lepton_Ve_, lepton_Vm), + new EMDecay(0.8D, lepton_m, lepton_Vm_, lepton_Vt, boson_Y__), + deadEnd);//makes photons and don't care + + lepton_e_.init(registry,lepton_e, STABLE_RAW_LIFE_TIME, 0, 1, + deadEnd, + new EMDecay(lepton_e,boson_Y__)); + lepton_m_.init(registry,lepton_m, 2.197019e-6F, 0, 1, + new EMDecay(0.9F, lepton_e_, lepton_Ve, lepton_Vm_), + deadEnd);//makes photons and don't care + lepton_t_.init(registry,lepton_t, 2.903e-13F, 1, 3, + new EMDecay(0.05F, lepton_m_, lepton_Vm, lepton_Vt_, boson_H__), + new EMDecay(0.1F, lepton_e_, lepton_Ve, lepton_Vm_), + new EMDecay(0.8F, lepton_m_, lepton_Vm, lepton_Vt_, boson_Y__), + deadEnd);//makes photons and don't care + } + + @Override + public String getLocalizedName() { + return translateToLocal("tt.keyword.Lepton")+": " + getShortLocalizedName(); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java new file mode 100644 index 0000000000..9bb05d2cbf --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMNeutrinoDefinition.java @@ -0,0 +1,63 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEndHalf; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 22.10.2016. + */ +public class EMNeutrinoDefinition extends EMLeptonDefinition { + public static final EMNeutrinoDefinition + lepton_Ve = new EMNeutrinoDefinition("tt.keyword.ElectronNeutrino", "\u03bd\u03b2", 1, 2e0D, 21,"Ve-"), + lepton_Vm = new EMNeutrinoDefinition("tt.keyword.MuonNeutrino", "\u03bd\u03bc", 2, 0.15e6D, 23,"Vm-"), + lepton_Vt = new EMNeutrinoDefinition("tt.keyword.TauonNeutrino", "\u03bd\u03c4", 3, 15e6D, 25,"Vt-"), + lepton_Ve_ = new EMNeutrinoDefinition("tt.keyword.PositronNeutrino", "~\u03bd\u03b2", -1, 2e0D, 22,"Ve+"), + lepton_Vm_ = new EMNeutrinoDefinition("tt.keyword.AntimuonNeutrino", "~\u03bd\u03bc", -2, 0.15e6D, 24,"Vm+"), + lepton_Vt_ = new EMNeutrinoDefinition("tt.keyword.AntitauonNeutrino", "~\u03bd\u03c4", -3, 15e6D, 26,"Vt+"); + + public static final EMDefinitionStack lepton_Ve1 = new EMDefinitionStack(lepton_Ve, 1); + public static final EMDefinitionStack lepton_Ve2 = new EMDefinitionStack(lepton_Ve, 2); + public static final EMDefinitionStack lepton_Ve_1 = new EMDefinitionStack(lepton_Ve_, 1); + public static final EMDefinitionStack lepton_Ve_2 = new EMDefinitionStack(lepton_Ve_, 2); + + protected EMNeutrinoDefinition(String name, String symbol, int type, double mass, int ID,String bind) { + super(name, symbol, type, mass, 0, ID,bind); + } + + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMNeutrinoDefinition.class,"tt.keyword.Neutrino")); + lepton_Ve.init(registry,lepton_Ve_, 1D, -1, -1, + EMDecay.NO_PRODUCT); + lepton_Vm.init(registry,lepton_Vm_, 1D, 1, 0, + new EMDecay(0.825D, nothing), + deadEndHalf); + lepton_Vt.init(registry,lepton_Vt_, 1, 1, 0, + new EMDecay(0.75F, nothing), + deadEnd); + + lepton_Ve_.init(registry,lepton_Ve, 1, -1, -1, + EMDecay.NO_PRODUCT); + lepton_Vm_.init(registry,lepton_Vm, 1, 1, 0, + new EMDecay(0.825F, nothing), + deadEndHalf); + lepton_Vt_.init(registry,lepton_Vt, 1, 1, 0, + new EMDecay(0.75F, nothing), + deadEnd); + } + + @Override + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Neutrino"); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java new file mode 100644 index 0000000000..785d426a0b --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMPrimitiveDefinition.java @@ -0,0 +1,58 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; + +import static com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay.NO_DECAY; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 22.10.2016. + */ +public class EMPrimitiveDefinition extends EMPrimitiveTemplate { + public static final EMPrimitiveDefinition + nbtE__ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveNBTERROR" , "!" , 0 , 0D , -1 , Integer.MIN_VALUE , "!" ), + null__ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveNULLPOINTER" , "." , 0 , 0D , -3 , Integer.MIN_VALUE+1 , "." ), + space = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveSpace" , "_" , 0 , 0D , -4 , Integer.MIN_VALUE + 2 , "_" ), + space_ = new EMPrimitiveDefinition ( "tt.keyword.PrimitivePresence" , "~_" , 0 , 0D , -4 , Integer.MIN_VALUE + 3 , "~_" ), + mass = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveMass" , "#" , 0 , 1 , -4 , Integer.MIN_VALUE + 4 , "#" ), + mass_ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveDarkMass" , "~#" , 0 , 1 , -4 , Integer.MIN_VALUE + 5 , "~#" ), + energy = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveEnergy" , "E" , 4 , 0D , -4 , Integer.MIN_VALUE + 6 , "E" ), + energy_ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveDarkEnergy" , "~E" , -4 , 0 , -4 , Integer.MIN_VALUE + 7 , "~E" ), + magic = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveMagic" , "Ma" , 5 , 1e5D , 0 , Integer.MIN_VALUE + 8 , "Ma" ), + magic_ = new EMPrimitiveDefinition ( "tt.keyword.PrimitiveAntimagic" , "~Ma" , -5 , 1e5D , 0 , Integer.MIN_VALUE + 9 , "~Ma" ); + + + protected EMPrimitiveDefinition(String name, String symbol, int type, double mass, int color, int ID, String bind) { + super(name, symbol, type, mass, 0, color, ID, bind); + } + + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMPrimitiveDefinition.class, "tt.keyword.Primitive")); + nbtE__.init(registry, null, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + null__.init(registry, null, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + + space.init(registry, space_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + space_.init(registry, space, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + + mass.init(registry, mass_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + mass_.init(registry, mass, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + + energy.init(registry, energy_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + energy_.init(registry, energy, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + + magic.init(registry, magic_, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + magic_.init(registry, magic, NO_DECAY_RAW_LIFE_TIME, -1, -1, NO_DECAY); + } + + @Override + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Primitive"); + } + + @Override + public boolean isTimeSpanHalfLife() { + return false; + } +}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java new file mode 100644 index 0000000000..a93b16ca0d --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMQuarkDefinition.java @@ -0,0 +1,110 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.deadEnd; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMNeutrinoDefinition.*; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 22.10.2016. + */ +public class EMQuarkDefinition extends EMFermionDefinition { + public static final EMQuarkDefinition + quark_u = new EMQuarkDefinition("tt.keyword.QuarkUp", "u", 1, 2.3e6D, 2, 3,"u"), + quark_c = new EMQuarkDefinition("tt.keyword.QuarkCharm", "c", 2, 1.29e9D, 2, 9,"c"), + quark_t = new EMQuarkDefinition("tt.keyword.QuarkTop", "t", 3, 172.44e9D, 2, 13,"t"), + quark_d = new EMQuarkDefinition("tt.keyword.QuarkDown", "d", 1, 4.8e6D, -1, 5,"d"), + quark_s = new EMQuarkDefinition("tt.keyword.QuarkStrange", "s", 2, 95e6D, -1, 7,"s"), + quark_b = new EMQuarkDefinition("tt.keyword.QuarkBottom", "b", 3, 4.65e9D, -1, 11,"b"), + quark_u_ = new EMQuarkDefinition("tt.keyword.QuarkAntiUp", "~u", -1, 2.3e6D, -2, 4,"~u"), + quark_c_ = new EMQuarkDefinition("tt.keyword.QuarkAntiCharm", "~c", -2, 1.29e9D, -2, 10,"~c"), + quark_t_ = new EMQuarkDefinition("tt.keyword.QuarkAntiTop", "~t", -3, 172.44e9D, -2, 14,"~t"), + quark_d_ = new EMQuarkDefinition("tt.keyword.QuarkAntiDown", "~d", -1, 4.8e6D, 1, 6,"~d"), + quark_s_ = new EMQuarkDefinition("tt.keyword.QuarkAntiStrange", "~s", -2, 95e6D, 1, 8,"~s"), + quark_b_ = new EMQuarkDefinition("tt.keyword.QuarkAntiBottom", "~b", -3, 4.65e9D, 1, 12,"~b"); + + protected EMQuarkDefinition(String name, String symbol, int type, double mass, int charge, int ID,String bind) { + super(name, symbol, type, mass, charge, 0, ID,bind); + } + + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMQuarkDefinition.class,"tt.keyword.Quark")); + quark_u.init(registry,quark_u_, STABLE_RAW_LIFE_TIME, 3, -1, + new EMDecay(1.23201e-5D, quark_b/*,lepton_t_,lepton_Vt*/), + new EMDecay(0.050778116D, quark_s/*,lepton_m_,lepton_Vm*/), + new EMDecay(0.9D, quark_d, lepton_e_, lepton_Ve), + deadEnd);//makes photons and don't care + quark_c.init(registry,quark_c_, 0.5e-13D, 1, -1, + new EMDecay(0.00169744D, quark_b/*,lepton_t_,lepton_Vt*/), + new EMDecay(0.05071504D, quark_d, lepton_m_, lepton_Vm), + new EMDecay(0.9D, quark_s, lepton_e_, lepton_Ve), + deadEnd);//makes photons and don't care + quark_t.init(registry,quark_t_, 2.5e-26D, 0, -1, + new EMDecay(7.51689e-5D, quark_d, lepton_t_, lepton_Vt), + new EMDecay(0.00163216D, quark_s, lepton_m_, lepton_Vm), + new EMDecay(0.9D, quark_b, lepton_e_, lepton_Ve), + deadEnd);//makes photons and don't care + + quark_d.init(registry,quark_d_, STABLE_RAW_LIFE_TIME, 3, -1, + new EMDecay(7.51689e-5D, quark_t/*,lepton_t,lepton_Vt_*/), + new EMDecay(0.05071504D, quark_c/*,lepton_m,lepton_Vm_*/), + new EMDecay(0.9D, quark_u, lepton_e, lepton_Ve_), + deadEnd);//makes photons and don't care + quark_s.init(registry,quark_s_, 0.6e-9D, 1, -1, + new EMDecay(0.00163216D, quark_t/*,lepton_t,lepton_Vt_*/), + new EMDecay(0.050778116D, quark_u, lepton_m, lepton_Vm_), + new EMDecay(0.9D, quark_c, lepton_e, lepton_Ve_), + deadEnd);//makes photons and don't care + quark_b.init(registry,quark_b_, 0.7e-13D, 0, -1, + new EMDecay(1.23201e-5D, quark_u, lepton_t, lepton_Vt_), + new EMDecay(0.00169744D, quark_c, lepton_m, lepton_Vm_), + new EMDecay(0.9D, quark_t, lepton_e, lepton_Ve_), + deadEnd);//makes photons and don't care + + quark_u_.init(registry,quark_u, STABLE_RAW_LIFE_TIME, 3, -1, + new EMDecay(1.23201e-5D, quark_b_/*,lepton_t,lepton_Vt_*/), + new EMDecay(0.050778116D, quark_s_/*,lepton_m,lepton_Vm_*/), + new EMDecay(0.9D, quark_d_, lepton_e, lepton_Ve_), + deadEnd);//makes photons and don't care + quark_c_.init(registry,quark_c, 0.5e-13D, 1, -1, + new EMDecay(0.00169744F, quark_b_/*,lepton_t,lepton_Vt_*/), + new EMDecay(0.05071504F, quark_d_, lepton_m, lepton_Vm_), + new EMDecay(0.9F, quark_s_, lepton_e, lepton_Ve_), + deadEnd);//makes photons and don't care + quark_t_.init(registry,quark_t, 2.5e-26F, 0, -1, + new EMDecay(7.51689e-5F, quark_d_, lepton_t, lepton_Vt_), + new EMDecay(0.00163216F, quark_s_, lepton_m, lepton_Vm_), + new EMDecay(0.9F, quark_b_, lepton_e, lepton_Ve_), + deadEnd);//makes photons and don't care + + quark_d_.init(registry,quark_d, STABLE_RAW_LIFE_TIME, 3, -1, + new EMDecay(7.51689e-5F, quark_t_/*,lepton_t_,lepton_Vt*/), + new EMDecay(0.05071504F, quark_c_/*,lepton_m_,lepton_Vm*/), + new EMDecay(0.9F, quark_u_, lepton_e_, lepton_Ve), + deadEnd);//makes photons and don't care + quark_s_.init(registry,quark_s, 0.6e-9F, 1, -1, + new EMDecay(0.00163216F, quark_t_/*,lepton_t_,lepton_Vt*/), + new EMDecay(0.050778116F, quark_u_, lepton_m_, lepton_Vm), + new EMDecay(0.9F, quark_c_, lepton_e_, lepton_Ve), + deadEnd);//makes photons and don't care + quark_b_.init(registry,quark_b, 0.7e-13F, 0, -1, + new EMDecay(1.23201e-5F, quark_u_, lepton_t_, lepton_Vt), + new EMDecay(0.00169744F, quark_c_, lepton_m_, lepton_Vm), + new EMDecay(0.9F, quark_t_, lepton_e_, lepton_Ve), + deadEnd);//makes photons and don't care + } + + @Override + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.Quark"); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java new file mode 100644 index 0000000000..760ce48068 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/EMScalarBosonDefinition.java @@ -0,0 +1,46 @@ +package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; + +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecay; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMType; + +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMGaugeBosonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition.*; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 22.10.2016. + */ +public class EMScalarBosonDefinition extends EMBosonDefinition { + public static final EMScalarBosonDefinition + boson_H__ = new EMScalarBosonDefinition("tt.keyword.Higgs", "H0", 125.09e9D, -2, 32,"H0"); + + private EMScalarBosonDefinition(String name, String symbol, double mass, int color, int ID,String bind) { + super(name, symbol, 0, mass, 0, color, ID,bind); + } + + public static void run(EMDefinitionsRegistry registry) { + registry.registerDefinitionClass(new EMType(EMScalarBosonDefinition.class,"tt.keyword.ScalarBoson")); + boson_H__.init(registry,boson_H__, 1.56e-22D, 8, 8, + new EMDecay ( 0.0002171 , lepton_m , lepton_m_ ), + new EMDecay ( 0.001541 , boson_Z, boson_Y__ ), + new EMDecay ( 0.02641 , boson_Z, boson_Z), + new EMDecay ( 0.02884 , quark_c , quark_c_ ), + new EMDecay ( 0.06256 , lepton_t , lepton_t_ ), + new EMDecay ( 0.0818 , boson_g__ , boson_g__ ), + new EMDecay ( 0.2152 , boson_W_, boson_W), + new EMDecay ( 0.5809 , quark_b , quark_b_ ), + deadEnd); + } + + @Override + public String getLocalizedTypeName() { + return translateToLocal("tt.keyword.ScalarBoson"); + } + + @Override + public boolean isTimeSpanHalfLife() { + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java deleted file mode 100644 index a09fc60835..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -import static com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay.noDecay; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class cPrimitiveDefinition extends cElementalPrimitive { - public static final cPrimitiveDefinition - nbtE__ = new cPrimitiveDefinition("NBT ERROR", "!", 0, 0f, Integer.MIN_VALUE, Integer.MIN_VALUE+10_000), - null__ = new cPrimitiveDefinition("NULL POINTER", ".", 0, 0F, -3, Integer.MAX_VALUE-10_000), - space__ = new cPrimitiveDefinition("Space", "_", 0, 0F, -4, 0), - magic = new cPrimitiveDefinition("Magic", "Ma", 4, 1e5F, 0, 1), - magic_ = new cPrimitiveDefinition("Antimagic", "~Ma", -4, 1e5F, 0, 2); - - private cPrimitiveDefinition(String name, String symbol, int type, float mass, int color, int ID) { - super(name, symbol, type, mass, 0, color, ID); - } - - public static void run() { - nbtE__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - null__.init(null__, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - space__.init(space__, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - magic.init(magic_, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - magic_.init(magic, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); - } - - @Override - public String getName() { - return "Primitive: " + name; - } - - @Override - public boolean isTimeSpanHalfLife() { - return false; - } -}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java deleted file mode 100644 index 3f314151f3..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eBosonDefinition.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class eBosonDefinition extends cElementalPrimitive { - public static final eBosonDefinition - boson_Y__ = new eBosonDefinition("Photon", "\u03b3", 1e-18F, -1, 27), - boson_H__ = new eBosonDefinition("Higgs", "\u0397", 126.09e9F, -2, 28); - //deadEnd - public static final cElementalDecay deadEnd = new cElementalDecay(boson_Y__, boson_Y__); - public static final cElementalDecay deadEndHalf = new cElementalDecay(boson_Y__); - public static final cElementalDefinitionStack boson_Y__1=new cElementalDefinitionStack(boson_Y__,1); - - private eBosonDefinition(String name, String symbol, float mass, int color, int ID) { - super(name, symbol, 0, mass, 0, color, ID); - } - - public static void run() { - boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, 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_), - new cElementalDecay(0.01F, eQuarkDefinition.quark_b, eQuarkDefinition.quark_b_), - deadEnd); - } - - @Override - public String getName() { - return "Boson: " + name; - } - - @Override - public boolean isTimeSpanHalfLife() { - return this==boson_H__; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java deleted file mode 100644 index 20132e2095..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eLeptonDefinition.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class eLeptonDefinition extends cElementalPrimitive { - public static final eLeptonDefinition - lepton_e = new eLeptonDefinition("Electron", "\u03b2-", 1, 0.511e6F, -3, 15), - lepton_m = new eLeptonDefinition("Muon", "\u03bc-", 2, 105.658e6F, -3, 17), - lepton_t = new eLeptonDefinition("Tauon", "\u03c4-", 3, 1776.83e6F, -3, 19), - lepton_e_ = new eLeptonDefinition("Positron", "\u03b2+", -1, 0.511e6F, 3, 16), - lepton_m_ = new eLeptonDefinition("Antimuon", "\u03bc+", -2, 105.658e6F, 3, 18), - lepton_t_ = new eLeptonDefinition("Antitauon", "\u03c4+", -3, 1776.83e6F, 3, 20); - - public static final cElementalDefinitionStack lepton_e1 = new cElementalDefinitionStack(lepton_e, 1); - public static final cElementalDefinitionStack lepton_e2 = new cElementalDefinitionStack(lepton_e, 2); - public static final cElementalDefinitionStack lepton_e_1 = new cElementalDefinitionStack(lepton_e_, 1); - public static final cElementalDefinitionStack lepton_e_2 = new cElementalDefinitionStack(lepton_e_, 2); - - private eLeptonDefinition(String name, String symbol, int type, float mass, int charge, int ID) { - super(name, symbol, type, mass, charge, -1, ID); - //this.itemThing=null; - //this.fluidThing=null; - } - - public static void run() { - lepton_e.init(lepton_e_, STABLE_RAW_LIFE_TIME, 0, 1, - 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, 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, 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, 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_, 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_, 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 - } - - @Override - public String getName() { - return "Lepton: " + name; - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java deleted file mode 100644 index 5f6a4a7b5e..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eNeutrinoDefinition.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class eNeutrinoDefinition extends cElementalPrimitive { - public static final eNeutrinoDefinition - lepton_Ve = new eNeutrinoDefinition("Electron neutrino", "\u03bd\u03b2", 1, 2e0F, 21), - lepton_Vm = new eNeutrinoDefinition("Muon neutrino", "\u03bd\u03bc", 2, 0.15e6F, 23), - lepton_Vt = new eNeutrinoDefinition("Tauon neutrino", "\u03bd\u03c4", 3, 15e6F, 25), - lepton_Ve_ = new eNeutrinoDefinition("Positron neutrino", "~\u03bd\u03b2", -1, 2e0F, 22), - lepton_Vm_ = new eNeutrinoDefinition("Antimuon neutrino", "~\u03bd\u03bc", -2, 0.15e6F, 24), - lepton_Vt_ = new eNeutrinoDefinition("Antitauon neutrino", "~\u03bd\u03c4", -3, 15e6F, 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 ID) { - super(name, symbol, type, mass, 0, -1, ID); - } - - public static void run() { - lepton_Ve.init(lepton_Ve_, 1F, -1, -1, - cElementalDecay.noProduct); - lepton_Vm.init(lepton_Vm_, 1F, 1, 0, - new cElementalDecay(0.825F, nothing), - eBosonDefinition.deadEndHalf); - lepton_Vt.init(lepton_Vt_, 1F, 1, 0, - new cElementalDecay(0.75F, nothing), - eBosonDefinition.deadEnd); - - lepton_Ve_.init(lepton_Ve, 1F, -1, -1, - cElementalDecay.noProduct); - lepton_Vm_.init(lepton_Vm, 1F, 1, 0, - new cElementalDecay(0.825F, nothing), - eBosonDefinition.deadEndHalf); - lepton_Vt_.init(lepton_Vt, 1F, 1, 0, - 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/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java deleted file mode 100644 index be6879d435..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/eQuarkDefinition.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive; - -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; - -/** - * Created by danie_000 on 22.10.2016. - */ -public final class eQuarkDefinition extends cElementalPrimitive { - public static final eQuarkDefinition - quark_u = new eQuarkDefinition("Up", "u", 1, 2.3e6F, 2, 3), - quark_c = new eQuarkDefinition("Charm", "c", 2, 1.29e9F, 2, 9), - quark_t = new eQuarkDefinition("Top", "t", 3, 172.44e9F, 2, 13), - quark_d = new eQuarkDefinition("Down", "d", 1, 4.8e6F, -1, 5), - quark_s = new eQuarkDefinition("Strange", "s", 2, 95e6F, -1, 7), - quark_b = new eQuarkDefinition("Bottom", "b", 3, 4.65e9F, -1, 11), - quark_u_ = new eQuarkDefinition("AntiUp", "~u", -1, 2.3e6F, -2, 4), - quark_c_ = new eQuarkDefinition("AntiCharm", "~c", -2, 1.29e9F, -2, 10), - quark_t_ = new eQuarkDefinition("AntiTop", "~t", -3, 172.44e9F, -2, 14), - quark_d_ = new eQuarkDefinition("AntiDown", "~d", -1, 4.8e6F, 1, 6), - quark_s_ = new eQuarkDefinition("AntiStrange", "~s", -2, 95e6F, 1, 8), - quark_b_ = new eQuarkDefinition("AntiBottom", "~b", -3, 4.65e9F, 1, 12); - - private eQuarkDefinition(String name, String symbol, int type, float mass, int charge, int ID) { - super(name, symbol, type, mass, charge, 0, ID); - } - - public static void run() { - quark_u.init(quark_u_, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(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*/), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_c.init(quark_c_, 0.5e-13F, 1, -1, - new cElementalDecay(0.9F, quark_s, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.05071504F, quark_d, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), - new cElementalDecay(0.00169744F, quark_b/*,lepton_t_,lepton_Vt*/), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_t.init(quark_t_, 2.5e-26F, 2, -1, - new cElementalDecay(0.9F, quark_b, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.00163216F, quark_s, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), - 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_, 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_*/), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_s.init(quark_s_, 0.6e-9F, 1, -1, - new cElementalDecay(0.9F, quark_c, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.050778116F, quark_u, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), - new cElementalDecay(0.00163216F, quark_t/*,lepton_t,lepton_Vt_*/), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_b.init(quark_b_, 0.7e-13F, 2, -1, - new cElementalDecay(0.9F, quark_t, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.00169744F, quark_c, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), - 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, 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_*/), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_c_.init(quark_c, 0.5e-13F, 1, -1, - new cElementalDecay(0.9F, quark_s_, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.05071504F, quark_d_, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), - new cElementalDecay(0.00169744F, quark_b_/*,lepton_t,lepton_Vt_*/), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_t_.init(quark_t, 2.5e-26F, 2, -1, - new cElementalDecay(0.9F, quark_b_, eLeptonDefinition.lepton_e, eNeutrinoDefinition.lepton_Ve_), - new cElementalDecay(0.00163216F, quark_s_, eLeptonDefinition.lepton_m, eNeutrinoDefinition.lepton_Vm_), - 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, 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*/), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_s_.init(quark_s, 0.6e-9F, 1, -1, - new cElementalDecay(0.9F, quark_c_, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.050778116F, quark_u_, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), - new cElementalDecay(0.00163216F, quark_t_/*,lepton_t_,lepton_Vt*/), - eBosonDefinition.deadEnd);//makes photons and don't care - quark_b_.init(quark_b, 0.7e-13F, 2, -1, - new cElementalDecay(0.9F, quark_t_, eLeptonDefinition.lepton_e_, eNeutrinoDefinition.lepton_Ve), - new cElementalDecay(0.00169744F, quark_c_, eLeptonDefinition.lepton_m_, eNeutrinoDefinition.lepton_Vm), - new cElementalDecay(1.23201e-5F, quark_u_, eLeptonDefinition.lepton_t_, eNeutrinoDefinition.lepton_Vt), - eBosonDefinition.deadEnd);//makes photons and don't care - } - - @Override - public String getName() { - return "Quark: " + name; - } - - @Override - public boolean isTimeSpanHalfLife() { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderFluidContainer.java b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderFluidContainer.java new file mode 100644 index 0000000000..1a5ad6a69c --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderFluidContainer.java @@ -0,0 +1,100 @@ +package com.github.technus.tectech.mechanics.enderStorage; + +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidHandler; + +import java.io.Serializable; + +public class EnderFluidContainer implements IFluidHandler, Serializable { + private static final int CAPACITY = 64000; + private int fluidID = -1; + private int fluidQuantity = 0; + + public EnderFluidContainer() { + } + + private FluidStack getFluidStack() { + FluidStack fluidStack = null; + if (fluidID >= 0) { + fluidStack = new FluidStack(fluidID, fluidQuantity); + } + return fluidStack; + } + + private void setFluidStack(FluidStack fluidStack) { + if (fluidStack != null && fluidStack.amount != 0) { + fluidID = fluidStack.getFluidID(); + fluidQuantity = fluidStack.amount; + } else { + fluidID = -1; + fluidQuantity = 0; + } + } + + + @Override + public int fill(ForgeDirection side, FluidStack fluidStackIn, boolean doFill) { + int filledFluid = 0; + FluidStack fluidStackStored = getFluidStack(); + if (fluidStackIn != null) { + if (fluidStackStored == null) { + fluidStackStored = fluidStackIn.copy(); + fluidStackStored.amount = 0; + } + if (fluidStackStored.amount < CAPACITY && fluidStackIn.isFluidEqual(fluidStackStored)) { + filledFluid = Math.min(CAPACITY - fluidStackStored.amount, fluidStackIn.amount); + if (doFill) { + fluidStackStored.amount += filledFluid; + setFluidStack(fluidStackStored); + } + } + } + return filledFluid; + } + + @Override + public FluidStack drain(ForgeDirection side, FluidStack fluidStack, boolean doDrain) { + FluidStack fluidStackOutput = null; + if (fluidStack != null && fluidStack.isFluidEqual(getFluidStack())) { + fluidStackOutput = drain(side, fluidStack.amount, doDrain); + } + return fluidStackOutput; + } + + @Override + public FluidStack drain(ForgeDirection side, int amount, boolean doDrain) { + FluidStack fluidStackOutput = null; + FluidStack fluidStackStored = getFluidStack(); + if (fluidStackStored != null && fluidStackStored.amount > 0) { + int drainedFluid = Math.min(fluidStackStored.amount, amount); + fluidStackOutput = fluidStackStored.copy(); + fluidStackOutput.amount = drainedFluid; + if (doDrain) { + fluidStackStored.amount -= drainedFluid; + if (fluidStackStored.amount == 0) { + fluidStackStored = null; + } + setFluidStack(fluidStackStored); + } + } + return fluidStackOutput; + } + + @Override + public boolean canFill(ForgeDirection forgeDirection, Fluid fluid) { + return true; + } + + @Override + public boolean canDrain(ForgeDirection forgeDirection, Fluid fluid) { + return true; + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection forgeDirection) { + return new FluidTankInfo[]{new FluidTankInfo(getFluidStack(), CAPACITY)}; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkCoverMessage.java b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkCoverMessage.java new file mode 100644 index 0000000000..081ce3b309 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkCoverMessage.java @@ -0,0 +1,132 @@ +package com.github.technus.tectech.mechanics.enderStorage; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import eu.usrv.yamcore.network.client.AbstractClientMessageHandler; +import eu.usrv.yamcore.network.server.AbstractServerMessageHandler; +import gregtech.api.metatileentity.BaseMetaTileEntity; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.fluids.IFluidHandler; + +import java.io.*; +import java.util.Arrays; + +import static com.github.technus.tectech.mechanics.enderStorage.EnderWorldSavedData.bindEnderLinkTag; +import static com.github.technus.tectech.mechanics.enderStorage.EnderWorldSavedData.getEnderLinkTag; +import static com.github.technus.tectech.thing.cover.GT_Cover_TM_EnderFluidLink.setEnderLinkTag; + +public class EnderLinkCoverMessage implements IMessage { + EnderLinkTankWithTag messageData; + + public EnderLinkCoverMessage() { + } + + @Override + public void fromBytes(ByteBuf pBuffer) { + try { + //I'd love to know why I need to offset by one byte for this to work + byte[] boop = pBuffer.array(); + boop = Arrays.copyOfRange(boop, 1, boop.length); + InputStream is = new ByteArrayInputStream(boop); + ObjectInputStream ois = new ObjectInputStream(is); + Object data = ois.readObject(); + messageData = (EnderLinkTankWithTag) data; + } catch (Exception ignore) { + } + } + + @Override + public void toBytes(ByteBuf pBuffer) { + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos); + oos.writeObject(messageData); + oos.flush(); + InputStream is = new ByteArrayInputStream(baos.toByteArray()); + pBuffer.writeBytes(is, baos.toByteArray().length); + } catch (Exception ignore) { + } + } + + public static class EnderLinkCoverQuery extends EnderLinkCoverMessage { + public EnderLinkCoverQuery() { + } + + public EnderLinkCoverQuery(EnderLinkTag tag, IFluidHandler fluidHandler) { + messageData = new EnderLinkTankWithTag(tag, fluidHandler); + } + } + + public static class EnderLinkCoverUpdate extends EnderLinkCoverMessage { + public EnderLinkCoverUpdate() { + } + + public EnderLinkCoverUpdate(EnderLinkTag tag, IFluidHandler fluidHandler) { + messageData = new EnderLinkTankWithTag(tag, fluidHandler); + } + } + + public static class EnderLinkCoverData extends EnderLinkCoverMessage { + public EnderLinkCoverData() { + } + + public EnderLinkCoverData(EnderLinkTag tag, IFluidHandler fluidHandler) { + messageData = new EnderLinkTankWithTag(tag, fluidHandler); + } + } + + public static class ServerHandler extends AbstractServerMessageHandler<EnderLinkCoverQuery> { + @Override + public IMessage handleServerMessage(EntityPlayer pPlayer, EnderLinkCoverQuery pMessage, MessageContext pCtx) { + IMessage reply = null; + if (pMessage.messageData != null) { + reply = new EnderLinkCoverData(getEnderLinkTag(pMessage.messageData.getFluidHandler()), + pMessage.messageData.getFluidHandler()); + } + return reply; + } + } + + public static class ServerUpdateHandler extends AbstractServerMessageHandler<EnderLinkCoverUpdate> { + @Override + public IMessage handleServerMessage(EntityPlayer pPlayer, EnderLinkCoverUpdate pMessage, MessageContext pCtx) { + if (pMessage.messageData != null) { + EnderLinkTag tag = pMessage.messageData.getTag(); + IFluidHandler handler = pMessage.messageData.getFluidHandler(); + if (tag.getUUID() == null){ + bindEnderLinkTag(handler, tag); + } else if (handler instanceof BaseMetaTileEntity) { + BaseMetaTileEntity baseTile = (BaseMetaTileEntity) handler; + if (tag.getUUID() == baseTile.getOwnerUuid()){ + bindEnderLinkTag(handler, tag); + } + } + } + return null; + } + } + + public static class ClientHandler extends AbstractClientMessageHandler<EnderLinkCoverData> { + @Override + public IMessage handleClientMessage(EntityPlayer pPlayer, EnderLinkCoverData pMessage, MessageContext pCtx) { + if (pMessage.messageData != null) { + setEnderLinkTag(pMessage.messageData.getTag()); + } + return null; + } + } + + private static class EnderLinkTankWithTag extends EnderLinkTank { + private final EnderLinkTag tag; + + public EnderLinkTankWithTag(EnderLinkTag tag, IFluidHandler fluidHandler) { + super(fluidHandler); + this.tag = tag; + } + + public EnderLinkTag getTag() { + return tag; + } + } +}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkTag.java b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkTag.java new file mode 100644 index 0000000000..3d7b7a20b8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkTag.java @@ -0,0 +1,39 @@ +package com.github.technus.tectech.mechanics.enderStorage; + +import com.google.common.base.Objects; + +import java.awt.*; +import java.io.Serializable; +import java.util.UUID; + +public class EnderLinkTag implements Serializable { + private final Color color; + private final UUID player; + + public EnderLinkTag(Color color, UUID player) { + this.color = color; + this.player = player; + } + + public int getColorInt() { + return color.getRGB(); + } + + public UUID getUUID() { + return player; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + EnderLinkTag that = (EnderLinkTag) o; + return Objects.equal(color, that.color) && + Objects.equal(player, that.player); + } + + @Override + public int hashCode() { + return Objects.hashCode(color, player); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkTank.java b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkTank.java new file mode 100644 index 0000000000..a64a629161 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderLinkTank.java @@ -0,0 +1,46 @@ +package com.github.technus.tectech.mechanics.enderStorage; + +import com.google.common.base.Objects; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.fluids.IFluidHandler; + +import java.io.Serializable; + +public class EnderLinkTank implements Serializable { + private final int X; + private final int Y; + private final int Z; + private final int D; + + public EnderLinkTank(IFluidHandler fluidHandler) { + TileEntity tile = (TileEntity)fluidHandler; + X = tile.xCoord; + Y = tile.yCoord; + Z = tile.zCoord; + D = tile.getWorldObj().provider.dimensionId; + } + + public IFluidHandler getFluidHandler() { + IFluidHandler fluidHandler = null; + TileEntity tile = DimensionManager.getWorld(D).getTileEntity(X, Y, Z); + if (tile instanceof IFluidHandler) fluidHandler = (IFluidHandler) tile; + return fluidHandler; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + EnderLinkTank that = (EnderLinkTank) o; + return X == that.X && + Y == that.Y && + Z == that.Z && + D == that.D; + } + + @Override + public int hashCode() { + return Objects.hashCode(X, Y, Z, D); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderWorldSavedData.java b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderWorldSavedData.java new file mode 100644 index 0000000000..6afa3a494f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/enderStorage/EnderWorldSavedData.java @@ -0,0 +1,129 @@ +package com.github.technus.tectech.mechanics.enderStorage; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.WorldSavedData; +import net.minecraft.world.storage.MapStorage; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.fluids.IFluidHandler; + +import java.awt.*; +import java.io.*; +import java.util.HashMap; +import java.util.Map; + +import static com.github.technus.tectech.Reference.MODID; + +public class EnderWorldSavedData extends WorldSavedData { + private static EnderWorldSavedData INSTANCE; + + private static final String DATA_NAME = MODID + "_EnderWorldSavedData"; + private static final String ENDER_LIQUID_TAG_LINK = DATA_NAME + "_EnderLiquidTagLink"; + private static final String ENDER_LIQUID_TANK_LINK = DATA_NAME + "_EnderLiquidTankLink"; + private static final EnderLinkTag DEFAULT_LINK_TAG = new EnderLinkTag(Color.WHITE, null); + + private Map<EnderLinkTag, EnderFluidContainer> EnderLiquidTagLink = new HashMap<>(); + private Map<EnderLinkTank, EnderLinkTag> EnderLiquidTankLink = new HashMap<>(); + + public EnderWorldSavedData() { + super(DATA_NAME); + } + + public EnderWorldSavedData(String s) { + super(s); + } + + @Override + public void readFromNBT(NBTTagCompound nbtTagCompound) { + try { + byte[] ba = nbtTagCompound.getByteArray(ENDER_LIQUID_TAG_LINK); + InputStream is = new ByteArrayInputStream(ba); + ObjectInputStream ois = new ObjectInputStream(is); + Object data = ois.readObject(); + EnderLiquidTagLink = (Map<EnderLinkTag, EnderFluidContainer>) data; + } catch (IOException | ClassNotFoundException ignored) { + System.out.println("ENDER_LIQUID_TAG_LINK LOAD FAILED"); + System.out.println(ignored); + } + + try { + byte[] ba = nbtTagCompound.getByteArray(ENDER_LIQUID_TANK_LINK); + InputStream is = new ByteArrayInputStream(ba); + ObjectInputStream ois = new ObjectInputStream(is); + Object data = ois.readObject(); + EnderLiquidTankLink = (Map<EnderLinkTank, EnderLinkTag>) data; + } catch (IOException | ClassNotFoundException ignored) { + System.out.println("ENDER_LIQUID_TANK_LINK LOAD FAILED"); + System.out.println(ignored); + } + } + + @Override + public void writeToNBT(NBTTagCompound nbtTagCompound) { + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(EnderLiquidTagLink); + oos.flush(); + byte[] data = bos.toByteArray(); + nbtTagCompound.setByteArray(ENDER_LIQUID_TAG_LINK, data); + } catch (IOException ignored) { + System.out.println("ENDER_LIQUID_TAG_LINK SAVE FAILED"); + System.out.println(ignored); + } + + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(EnderLiquidTankLink); + oos.flush(); + byte[] data = bos.toByteArray(); + nbtTagCompound.setByteArray(ENDER_LIQUID_TANK_LINK, data); + } catch (IOException ignored) { + System.out.println("ENDER_LIQUID_TANK_LINK SAVE FAILED"); + System.out.println(ignored); + } + } + + private static void loadInstance() { + if (INSTANCE == null) { + MapStorage storage = DimensionManager.getWorld(0).mapStorage; + INSTANCE = (EnderWorldSavedData) storage.loadData(EnderWorldSavedData.class, DATA_NAME); + if (INSTANCE == null) { + INSTANCE = new EnderWorldSavedData(); + storage.setData(DATA_NAME, INSTANCE); + } + } + INSTANCE.markDirty(); + } + + private static Map<EnderLinkTag, EnderFluidContainer> getEnderLiquidLink() { + loadInstance(); + return INSTANCE.EnderLiquidTagLink; + } + + private static Map<EnderLinkTank, EnderLinkTag> getEnderLiquidTankLink() { + loadInstance(); + return INSTANCE.EnderLiquidTankLink; + } + + public static EnderFluidContainer getEnderFluidContainer(EnderLinkTag tag) { + if (!getEnderLiquidLink().containsKey(tag)) { + getEnderLiquidLink().put(tag, new EnderFluidContainer()); + } + return getEnderLiquidLink().get(tag); + } + + public static EnderLinkTag getEnderLinkTag(IFluidHandler handler) { + EnderLinkTank tank = new EnderLinkTank(handler); + if (!getEnderLiquidTankLink().containsKey(tank)) { + getEnderLiquidTankLink().put(tank, DEFAULT_LINK_TAG); + } + return getEnderLiquidTankLink().get(tank); + } + + public static void bindEnderLinkTag(IFluidHandler handler, EnderLinkTag tag) { + EnderLinkTank tank = new EnderLinkTank(handler); + getEnderLiquidTankLink().remove(tank); + getEnderLiquidTankLink().put(tank, tag); + } +}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IActivePipe.java b/src/main/java/com/github/technus/tectech/mechanics/pipe/IActivePipe.java index 5552992e56..4f244c804b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IActivePipe.java +++ b/src/main/java/com/github/technus/tectech/mechanics/pipe/IActivePipe.java @@ -1,4 +1,4 @@ -package com.github.technus.tectech.thing.metaTileEntity.pipe; +package com.github.technus.tectech.mechanics.pipe; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToDataPipe.java b/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToDataPipe.java index def0795ba3..a775321df2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToDataPipe.java +++ b/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToDataPipe.java @@ -1,4 +1,4 @@ -package com.github.technus.tectech.thing.metaTileEntity.pipe; +package com.github.technus.tectech.mechanics.pipe; /** * Created by Tec on 26.02.2017. diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToElementalPipe.java b/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToElementalPipe.java index 5841d3d010..ea444a0678 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToElementalPipe.java +++ b/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToElementalPipe.java @@ -1,4 +1,4 @@ -package com.github.technus.tectech.thing.metaTileEntity.pipe; +package com.github.technus.tectech.mechanics.pipe; /** * Created by Tec on 26.02.2017. diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToEnergyTunnel.java b/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToEnergyTunnel.java index 4a720d067e..3a1d24305e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/IConnectsToEnergyTunnel.java +++ b/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToEnergyTunnel.java @@ -1,4 +1,4 @@ -package com.github.technus.tectech.thing.metaTileEntity.pipe; +package com.github.technus.tectech.mechanics.pipe; /** * Created by Tec on 26.02.2017. diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/PipeActivityMessage.java b/src/main/java/com/github/technus/tectech/mechanics/pipe/PipeActivityMessage.java index e7183b8838..abde23f33e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/PipeActivityMessage.java +++ b/src/main/java/com/github/technus/tectech/mechanics/pipe/PipeActivityMessage.java @@ -1,4 +1,4 @@ -package com.github.technus.tectech.thing.metaTileEntity.pipe; +package com.github.technus.tectech.mechanics.pipe; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; @@ -105,7 +105,7 @@ public class PipeActivityMessage implements IMessage { if(te instanceof IGregTechTileEntity){ IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); if(meta instanceof IActivePipe){ - ((IActivePipe) meta).setActive((byte)pMessage.mActive==1); + ((IActivePipe) meta).setActive(pMessage.mActive==1); } } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/data/RendererMessage.java b/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java index 514b8b88ad..7fdce41ef9 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/data/RendererMessage.java +++ b/src/main/java/com/github/technus/tectech/mechanics/spark/RendererMessage.java @@ -1,10 +1,13 @@ -package com.github.technus.tectech.mechanics.data; +package com.github.technus.tectech.mechanics.spark; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import eu.usrv.yamcore.network.client.AbstractClientMessageHandler; import io.netty.buffer.ByteBuf; +import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; @@ -13,9 +16,11 @@ import thaumcraft.client.fx.bolt.FXLightningBolt; import java.io.*; import java.util.Arrays; import java.util.HashSet; +import java.util.Random; +//TODO Re-work how sparks are distributed public class RendererMessage implements IMessage { - HashSet<ThaumSpark> sparkList = new HashSet<ThaumSpark>(); + HashSet<ThaumSpark> sparkList; public RendererMessage() { } @@ -30,7 +35,7 @@ public class RendererMessage implements IMessage { ObjectInputStream ois = new ObjectInputStream(is); Object data = ois.readObject(); sparkList = (HashSet<ThaumSpark>) data; - } catch (IOException | ClassNotFoundException ex) { + } catch (IOException | ClassNotFoundException ignored) { } } @@ -43,7 +48,7 @@ public class RendererMessage implements IMessage { oos.flush(); InputStream is = new ByteArrayInputStream(baos.toByteArray()); pBuffer.writeBytes(is, baos.toByteArray().length); - } catch (IOException ex) { + } catch (IOException ignore) { } } @@ -60,23 +65,38 @@ public class RendererMessage implements IMessage { public static class ClientHandler extends AbstractClientMessageHandler<RendererData> { @Override public IMessage handleClientMessage(EntityPlayer pPlayer, RendererData pMessage, MessageContext pCtx) { + //disgusting + Random localRand = Minecraft.getMinecraft().theWorld.rand; + int[] zapsToUse = new int[4]; + for (int i = 0; i < 3; i++) { + zapsToUse[i] = localRand.nextInt(pMessage.sparkList.size()); + } + int i = 0; for (ThaumSpark sp : pMessage.sparkList) { - thaumLightning(sp.x, sp.y, sp.z, sp.xR, sp.yR, sp.zR, sp.wID); + for (int j : zapsToUse) { + if(i == j){ + thaumLightning(sp.x, sp.y, sp.z, sp.xR, sp.yR, sp.zR, sp.wID); + } + } + i++; } pMessage.sparkList.clear(); return null; } } + @SideOnly(Side.CLIENT) private static void thaumLightning(int tX, int tY, int tZ, int tXN, int tYN, int tZN, int wID) { //This is enough to check for thaum, since it only ever matters for client side effects (Tested not to crash) if (Loader.isModLoaded("Thaumcraft")) { - World world = DimensionManager.getWorld(wID); - FXLightningBolt bolt = new FXLightningBolt(world, tX + 0.5F, tY + 0.5F, tZ + 0.5F, tX + tXN + 0.5F, tY + tYN + 0.5F, tZ + tZN + 0.5F, world.rand.nextLong(), 6, 0.5F, 8); - bolt.defaultFractal(); - bolt.setType(2); - bolt.setWidth(0.125F); - bolt.finalizeBolt(); + World world = Minecraft.getMinecraft().theWorld; + if (world.provider.dimensionId == wID){ + FXLightningBolt bolt = new FXLightningBolt(world, tX + 0.5F, tY + 0.5F, tZ + 0.5F, tX + tXN + 0.5F, tY + tYN + 0.5F, tZ + tZN + 0.5F, world.rand.nextLong(), 6, 0.5F, 8); + bolt.defaultFractal(); + bolt.setType(2); + bolt.setWidth(0.125F); + bolt.finalizeBolt(); + } } } }
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/data/ThaumSpark.java b/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java index 99f3696aa9..0480cfffd2 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/data/ThaumSpark.java +++ b/src/main/java/com/github/technus/tectech/mechanics/spark/ThaumSpark.java @@ -1,54 +1,58 @@ -package com.github.technus.tectech.mechanics.data;
-
-import java.io.Serializable;
-import java.util.Objects;
-
-public class ThaumSpark implements Serializable {
- //This works regardless of if TC is loaded
- private static final long serialVersionUID = -7037856938316679566L;
- public int x, y, z, wID;
- public byte xR, yR, zR;
-
- public ThaumSpark(){
- this.x = 0;
- this.z = 0;
- this.y = 0;
-
- this.xR = 0;
- this.yR = 0;
- this.zR = 0;
-
- this.wID = 0;
- }
-
- public ThaumSpark(int x, int y, int z, byte xR, byte yR, byte zR, int wID) {
- this.x = x;
- this.z = z;
- this.y = y;
-
- this.xR = xR;
- this.yR = yR;
- this.zR = zR;
-
- this.wID = wID;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- ThaumSpark that = (ThaumSpark) o;
- return x == that.x &&
- y == that.y &&
- z == that.z &&
- wID == that.wID &&
- xR == that.xR &&
- yR == that.yR &&
- zR == that.zR;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(x, y, z, wID, xR, yR, zR);
- }
-}
+package com.github.technus.tectech.mechanics.spark; + + +import com.gtnewhorizon.structurelib.util.Vec3Impl; + +import java.io.Serializable; +import java.util.Objects; + +public class ThaumSpark implements Serializable { + //This works regardless of if TC is loaded + private static final long serialVersionUID = -7037856938316679566L; + public int x, y, z, wID; + public byte xR, yR, zR; + + public ThaumSpark(int x, int y, int z, byte xR, byte yR, byte zR, int wID) { + this.x = x; + this.y = y; + this.z = z; + + this.xR = xR; + this.yR = yR; + this.zR = zR; + + this.wID = wID; + } + + public ThaumSpark(Vec3Impl origin, Vec3Impl target, int wID) { + this.x = origin.get0(); + this.y = origin.get1(); + this.z = origin.get2(); + + Vec3Impl offset = target.sub(origin); + this.xR = (byte) offset.get0(); + this.yR = (byte) offset.get1(); + this.zR = (byte) offset.get2(); + + this.wID = wID; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ThaumSpark that = (ThaumSpark) o; + return x == that.x && + y == that.y && + z == that.z && + wID == that.wID && + xR == that.xR && + yR == that.yR && + zR == that.zR; + } + + @Override + public int hashCode() { + return Objects.hash(x, y, z, wID, xR, yR, zR); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java new file mode 100644 index 0000000000..de8d828cf4 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java @@ -0,0 +1,148 @@ +package com.github.technus.tectech.mechanics.tesla; + +import com.github.technus.tectech.mechanics.spark.ThaumSpark; +import com.google.common.collect.Multimap; + +import java.util.HashSet; +import java.util.Map; + +import static java.lang.Math.sqrt; + +public interface ITeslaConnectable extends ITeslaConnectableSimple { + //Map with all Teslas in the same dimension and the distance to them //TODO Range + Multimap<Integer, ITeslaConnectableSimple> getTeslaNodeMap(); + + //ThaumCraft lighting coordinate pairs, so we can send them in bursts and save on lag + HashSet<ThaumSpark> getSparkList(); + + //-128 to -1 disables capability + //0 means any source or target + //1 to 127 must match on source and target or source/target must be 0 + byte getTeslaTransmissionCapability(); + + //Transmission Range is typically 16+ in blocks + int getTeslaTransmissionRange(); + boolean isOverdriveEnabled(); + + int getTeslaEnergyLossPerBlock(); + float getTeslaOverdriveLossCoefficient(); + + long getTeslaOutputVoltage(); + long getTeslaOutputCurrent(); + + boolean teslaDrainEnergy(long teslaVoltageDrained); + + class TeslaUtil { + private static final HashSet<ITeslaConnectableSimple> teslaSimpleNodeSet = new HashSet<>();//Targets for power transmission + private static final HashSet<ITeslaConnectable> teslaNodeSet = new HashSet<>();//Sources of power transmission + + public static void teslaSimpleNodeSetAdd(ITeslaConnectableSimple target) { + if (!teslaSimpleNodeSet.contains(target)) { + teslaSimpleNodeSet.add(target); + teslaNodeSet.forEach(origin -> addTargetToTeslaOrigin(target, origin)); + } + } + + public static void teslaSimpleNodeSetRemove(ITeslaConnectableSimple target){ + teslaSimpleNodeSet.remove(target); + if (target instanceof ITeslaConnectable)teslaNodeSet.remove(target); + teslaNodeSet.forEach(origin -> removeTargetFromTeslaOrigin(target, origin)); + } + + private static void addTargetToTeslaOrigin(ITeslaConnectableSimple target, ITeslaConnectable origin){ + if (origin.equals(target) || !origin.getTeslaDimension().equals(target.getTeslaDimension())) { + //Skip if looking at myself and skip if not in the same dimension + //TODO, INTERDIM? + return; + } else if (origin.getTeslaTransmissionCapability() != 0 && origin.getTeslaReceptionCapability() != 0 && + origin.getTeslaTransmissionCapability() != origin.getTeslaReceptionCapability()) { + //Skip if incompatible + return; + } + //Range calc + int distance = (int) sqrt(origin.getTeslaPosition().distanceSq(target.getTeslaPosition())); + if (distance > origin.getTeslaTransmissionRange() * target.getTeslaReceptionCoefficient()) { + //Skip if the range is too vast + return; + } + origin.getTeslaNodeMap().put(distance, target); + } + + private static void removeTargetFromTeslaOrigin(ITeslaConnectableSimple target, ITeslaConnectable origin){ + //Range calc TODO Remove duplicate? + int distance = (int) sqrt(origin.getTeslaPosition().distanceSq(target.getTeslaPosition())); + origin.getTeslaNodeMap().remove(distance, target); + } + + public static void generateTeslaNodeMap(ITeslaConnectable origin) { + origin.getTeslaNodeMap().clear(); + for (ITeslaConnectableSimple target : teslaSimpleNodeSet) { + //Sanity checks + if (target == null) { + //The Tesla Covers do not remove themselves from the list and this is the code that does + teslaSimpleNodeSet.remove(null); + continue; + } + addTargetToTeslaOrigin(target, origin); + } + teslaNodeSet.add(origin); + } + + public static long powerTeslaNodeMap(ITeslaConnectable origin) { + long remainingAmperes = origin.getTeslaOutputCurrent(); + boolean canSendPower = !origin.isTeslaReadyToReceive() && remainingAmperes > 0; + + if (canSendPower) { + for (Map.Entry<Integer, ITeslaConnectableSimple> Rx : origin.getTeslaNodeMap().entries()) { + //Do we still have power left to send kind of check + if (origin.getTeslaStoredEnergy() < (origin.isOverdriveEnabled() ? origin.getTeslaOutputVoltage() * + 2 : origin.getTeslaOutputVoltage())) break; + //Explicit words for the important fields + ITeslaConnectableSimple target = Rx.getValue(); + int distance = Rx.getKey(); + //Can our target receive energy? + if(!target.isTeslaReadyToReceive()) continue; + + //Calculate the voltage output + long outputVoltageInjectable; + long outputVoltageConsumption; + if (origin.isOverdriveEnabled()) { + outputVoltageInjectable = origin.getTeslaOutputVoltage(); + outputVoltageConsumption = origin.getTeslaOutputVoltage() + + (distance * origin.getTeslaEnergyLossPerBlock()) + + (long) Math.round(origin.getTeslaOutputVoltage() * + origin.getTeslaOverdriveLossCoefficient()); + } else { + outputVoltageInjectable = origin.getTeslaOutputVoltage() - (distance * + origin.getTeslaEnergyLossPerBlock()); + outputVoltageConsumption = origin.getTeslaOutputVoltage(); + } + + //Break out of the loop if the cost is too high + //Since the next target will have an even higher cost, just quit now. + if (origin.getTeslaStoredEnergy() < outputVoltageConsumption) break; + + //Now shove in as many packets as will fit~ + while(canSendPower){ + if (target.teslaInjectEnergy(outputVoltageInjectable)) { + origin.teslaDrainEnergy(outputVoltageConsumption); + origin.getSparkList().add(new ThaumSpark(origin.getTeslaPosition(), + target.getTeslaPosition(), origin.getTeslaDimension())); + remainingAmperes--; + //Update the can send power flag each time we send power + canSendPower = (origin.getTeslaStoredEnergy() < outputVoltageConsumption || + remainingAmperes > 0); + } else { + //Breaks out when I can't send anymore power + break; + } + } + + //Break out if we can't send power anymore + if (!canSendPower)break; + } + } + return origin.getTeslaOutputCurrent() - remainingAmperes; + } + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java new file mode 100644 index 0000000000..2adc25bbed --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectableSimple.java @@ -0,0 +1,22 @@ +package com.github.technus.tectech.mechanics.tesla; + +import com.gtnewhorizon.structurelib.util.Vec3Impl; + +public interface ITeslaConnectableSimple { + //-128 to -1 disables capability + //0 means any source or target + //1 to 127 must match on source and target or source/target must be 0 + byte getTeslaReceptionCapability(); + + //Reception Coefficient is a range extension, typical is 1 + float getTeslaReceptionCoefficient(); + + boolean isTeslaReadyToReceive(); + + long getTeslaStoredEnergy(); + + boolean teslaInjectEnergy(long teslaVoltageInjected); + + Vec3Impl getTeslaPosition(); + Integer getTeslaDimension(); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java new file mode 100644 index 0000000000..0b84236709 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/TeslaCoverConnection.java @@ -0,0 +1,80 @@ +package com.github.technus.tectech.mechanics.tesla; + +import com.google.common.base.Objects; +import com.gtnewhorizon.structurelib.util.Vec3Impl; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + +import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.teslaSimpleNodeSetAdd; +import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.teslaSimpleNodeSetRemove; + +public class TeslaCoverConnection implements ITeslaConnectableSimple { + private final IGregTechTileEntity IGT; + private final Vec3Impl pos; + private final byte teslaReceptionCapability; + + public TeslaCoverConnection(IGregTechTileEntity IGT, byte teslaReceptionCapability) { + this.IGT = IGT; + this.pos = new Vec3Impl(IGT.getXCoord(), + IGT.getYCoord(), + IGT.getZCoord()); + + this.teslaReceptionCapability = teslaReceptionCapability; + } + + @Override + public byte getTeslaReceptionCapability() { + return teslaReceptionCapability; + } + + @Override + public float getTeslaReceptionCoefficient() { + return 1; + } + + @Override + public boolean isTeslaReadyToReceive() { + return true; + } + + @Override + public long getTeslaStoredEnergy() { + return IGT.getStoredEU(); + } + + @Override + public Vec3Impl getTeslaPosition() { + return pos; + } + + @Override + public Integer getTeslaDimension() { + return IGT.getWorld().provider.dimensionId; + } + + @Override + public boolean teslaInjectEnergy(long teslaVoltageInjected) { + //Same as in the microwave transmitters, this does not account for amp limits + boolean output = false; + + if (!IGT.isDead()){ + output = IGT.injectEnergyUnits((byte) 1, teslaVoltageInjected, 1L) > 0L; + } else { + teslaSimpleNodeSetRemove(this); + } + + return output; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + TeslaCoverConnection that = (TeslaCoverConnection) o; + return Objects.equal(IGT, that.IGT); + } + + @Override + public int hashCode() { + return Objects.hashCode(IGT); + } +} 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 358d55be0e..114dc7399f 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 @@ -215,18 +215,18 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { int tSpecial = ((CachedDefaultRecipe) 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); + drawText(10, 73, trans("152","Max Total: ") + GT_Utility.formatNumbers((1+ (computation-minComputationPerSec) /minComputationPerSec) * (long)tEUt * ampere * 20) + " EU", -16777216); + drawText(10, 83, trans("153","Usage: ") + GT_Utility.formatNumbers((long)tEUt*ampere) + " EU/t", -16777216); if (mRecipeMap.mShowVoltageAmperageInNEI) { - drawText(10, 93, trans("154","Voltage: ") + tEUt + " EU", -16777216); - drawText(10, 103, trans("155","Amperage: ") + ampere, -16777216); + drawText(10, 93, trans("154","Voltage: ") + GT_Utility.formatNumbers(tEUt) + " EU", -16777216); + drawText(10, 103, trans("155","Amperage: ") + GT_Utility.formatNumbers(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); + drawText(10, 113, "Computation: " + GT_Utility.formatNumbers(computation), -16777216); + drawText(10, 123, "Min Computation: " + GT_Utility.formatNumbers(minComputationPerSec) + " /s", -16777216); } else { int i = 0; for (String descLine : recipeDesc) { 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 index 0c7651977e..2dc4604fd5 100644 --- 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 @@ -215,18 +215,18 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { int tSpecial = ((CachedDefaultRecipe) 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); + drawText(10, 73, trans("152","Max Total: ") + GT_Utility.formatNumbers((1+ (computation-minComputationPerSec) /minComputationPerSec) * (long)tEUt * ampere * 20) + " EU", -16777216); + drawText(10, 83, trans("153","Usage: ") + GT_Utility.formatNumbers((long)tEUt*ampere) + " EU/t", -16777216); if (mRecipeMap.mShowVoltageAmperageInNEI) { - drawText(10, 93, trans("154","Voltage: ") + tEUt + " EU", -16777216); - drawText(10, 103, trans("155","Amperage: ") + ampere, -16777216); + drawText(10, 93, trans("154","Voltage: ") + GT_Utility.formatNumbers(tEUt) + " EU", -16777216); + drawText(10, 103, trans("155","Amperage: ") + GT_Utility.formatNumbers(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); + drawText(10, 113, "Computation: " + GT_Utility.formatNumbers(computation), -16777216); + drawText(10, 123, "Min Computation: " + GT_Utility.formatNumbers(minComputationPerSec) + " /s", -16777216); } else { int i = 0; for (String descLine : recipeDesc) { diff --git a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java index 720460d56b..d7baec4ef5 100644 --- a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java @@ -1,10 +1,7 @@ package com.github.technus.tectech.proxy; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.openmodularturrets.TT_turret_loader; -import com.github.technus.tectech.entity.fx.BlockHint; -import com.github.technus.tectech.entity.fx.WeightlessParticleFX; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumGlassRender; import com.github.technus.tectech.thing.block.QuantumStuffBlock; @@ -12,11 +9,11 @@ import com.github.technus.tectech.thing.block.QuantumStuffRender; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; import com.github.technus.tectech.thing.item.renderElemental.RenderElementalName; +import com.gtnewhorizon.structurelib.entity.fx.WeightlessParticleFX; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.Loader; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.gui.GuiNewChat; @@ -28,6 +25,8 @@ import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.util.ForgeDirection; +import static com.github.technus.tectech.TecTech.RANDOM; + public class ClientProxy extends CommonProxy { @Override public void registerRenderInfo() { @@ -46,23 +45,14 @@ public class ClientProxy extends CommonProxy { } @Override - public void hint_particle(World w,int x, int y, int z, Block block, int meta) { - Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,block,meta)); - - EntityFX particle = new WeightlessParticleFX(w, x + TecTech.RANDOM.nextFloat() * 0.5F, y + TecTech.RANDOM.nextFloat() * 0.5F, z + TecTech.RANDOM.nextFloat() * 0.5F, 0, 0, 0); - particle.setRBGColorF(0, 0.6F * TecTech.RANDOM.nextFloat(), 0.8f); - Minecraft.getMinecraft().effectRenderer.addEffect(particle); - } - - @Override public void em_particle(IGregTechTileEntity aMuffler, byte facing) {//CUTE! ForgeDirection aDir = ForgeDirection.getOrientation(facing); float xPos = aDir.offsetX * 0.76F + aMuffler.getXCoord() + 0.25F; float yPos = aDir.offsetY * 0.76F + aMuffler.getYCoord() + 0.25F; float zPos = aDir.offsetZ * 0.76F + aMuffler.getZCoord() + 0.25F; - EntityFX particle = new WeightlessParticleFX(aMuffler.getWorld(), xPos + TecTech.RANDOM.nextFloat() * 0.5F, yPos + TecTech.RANDOM.nextFloat() * 0.5F, zPos + TecTech.RANDOM.nextFloat() * 0.5F, 0, 0, 0); - particle.setRBGColorF(0, 0.6F * TecTech.RANDOM.nextFloat(), 0.8f); + EntityFX particle = new WeightlessParticleFX(aMuffler.getWorld(), xPos + RANDOM.nextFloat() * 0.5F, yPos + RANDOM.nextFloat() * 0.5F, zPos + RANDOM.nextFloat() * 0.5F, 0, 0, 0); + particle.setRBGColorF(0, 0.6F * RANDOM.nextFloat(), 0.8f); Minecraft.getMinecraft().effectRenderer.addEffect(particle); } @@ -73,42 +63,42 @@ public class ClientProxy extends CommonProxy { float yPos = aDir.offsetY * 0.76F + aMuffler.getYCoord() + 0.25F; float zPos = aDir.offsetZ * 0.76F + aMuffler.getZCoord() + 0.25F; - float ySpd = aDir.offsetY * 0.1F + 0.2F + 0.1F * (float)TecTech.RANDOM.nextGaussian(); + float ySpd = aDir.offsetY * 0.1F + 0.2F + 0.1F * (float) RANDOM.nextGaussian(); float xSpd; float zSpd; if (aDir.offsetY == -1) { - float temp = TecTech.RANDOM.nextFloat() * 2 * (float) Math.PI; - xSpd = (float) Math.sin(temp) * 0.1F*(float)TecTech.RANDOM.nextGaussian(); - zSpd = (float) Math.cos(temp) * 0.1F*(float)TecTech.RANDOM.nextGaussian(); + float temp = RANDOM.nextFloat() * 2 * (float) Math.PI; + xSpd = (float) Math.sin(temp) * 0.1F*(float) RANDOM.nextGaussian(); + zSpd = (float) Math.cos(temp) * 0.1F*(float) RANDOM.nextGaussian(); } else { - xSpd = aDir.offsetX * (0.1F + 0.2F *(float)TecTech.RANDOM.nextGaussian()); - zSpd = aDir.offsetZ * (0.1F + 0.2F *(float)TecTech.RANDOM.nextGaussian()); + xSpd = aDir.offsetX * (0.1F + 0.2F *(float) RANDOM.nextGaussian()); + zSpd = aDir.offsetZ * (0.1F + 0.2F *(float) RANDOM.nextGaussian()); } - aMuffler.getWorld().spawnParticle("largesmoke", xPos + TecTech.RANDOM.nextFloat() * 0.5F, yPos + TecTech.RANDOM.nextFloat() * 0.5F, zPos + TecTech.RANDOM.nextFloat() * 0.5F, xSpd, ySpd, zSpd); - aMuffler.getWorld().spawnParticle("largesmoke", xPos + TecTech.RANDOM.nextFloat() * 0.5F, yPos + TecTech.RANDOM.nextFloat() * 0.5F, zPos + TecTech.RANDOM.nextFloat() * 0.5F, xSpd, ySpd, zSpd); - aMuffler.getWorld().spawnParticle("largesmoke", xPos + TecTech.RANDOM.nextFloat() * 0.5F, yPos + TecTech.RANDOM.nextFloat() * 0.5F, zPos + TecTech.RANDOM.nextFloat() * 0.5F, xSpd, ySpd, zSpd); + aMuffler.getWorld().spawnParticle("largesmoke", xPos + RANDOM.nextFloat() * 0.5F, yPos + RANDOM.nextFloat() * 0.5F, zPos + RANDOM.nextFloat() * 0.5F, xSpd, ySpd, zSpd); + aMuffler.getWorld().spawnParticle("largesmoke", xPos + RANDOM.nextFloat() * 0.5F, yPos + RANDOM.nextFloat() * 0.5F, zPos + RANDOM.nextFloat() * 0.5F, xSpd, ySpd, zSpd); + aMuffler.getWorld().spawnParticle("largesmoke", xPos + RANDOM.nextFloat() * 0.5F, yPos + RANDOM.nextFloat() * 0.5F, zPos + RANDOM.nextFloat() * 0.5F, xSpd, ySpd, zSpd); } @Override public void em_particle(World w,double x, double y, double z) {//CUTE! EntityFX particle = new WeightlessParticleFX(w, - x + TecTech.RANDOM.nextFloat() * 0.5F, - y + TecTech.RANDOM.nextFloat() * 0.5F, - z + TecTech.RANDOM.nextFloat() * 0.5F, + x + RANDOM.nextFloat() * 0.5F, + y + RANDOM.nextFloat() * 0.5F, + z + RANDOM.nextFloat() * 0.5F, 0, 0, 0); - particle.setRBGColorF(0, 0.6F * TecTech.RANDOM.nextFloat(), 0.8f); + particle.setRBGColorF(0, 0.6F * RANDOM.nextFloat(), 0.8f); Minecraft.getMinecraft().effectRenderer.addEffect(particle); } @Override public void pollutor_particle(World w,double x, double y, double z) { w.spawnParticle("largesmoke", - x + TecTech.RANDOM.nextFloat() * 0.5F, - y + TecTech.RANDOM.nextFloat() * 0.5F, - z + TecTech.RANDOM.nextFloat() * 0.5F, + x + RANDOM.nextFloat() * 0.5F, + y + RANDOM.nextFloat() * 0.5F, + z + RANDOM.nextFloat() * 0.5F, 0, 0, 0); diff --git a/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java b/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java index 955b664bd1..0fbe8d890e 100644 --- a/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java @@ -2,7 +2,6 @@ package com.github.technus.tectech.proxy; import cpw.mods.fml.common.network.IGuiHandler; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; import net.minecraft.util.AxisAlignedBB; @@ -13,7 +12,6 @@ import net.minecraft.world.WorldServer; public class CommonProxy implements IGuiHandler { public void registerRenderInfo() {} - public void hint_particle(World w,int x, int y, int z, Block block, int meta){} public void em_particle(IGregTechTileEntity aMuffler, byte facing) {}//CUTE! public void pollutor_particle(IGregTechTileEntity aPollutor, byte facing) {}//CUTE! public void em_particle(World w,double x, double y, double z){} 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 b0b349a268..68607ae737 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java @@ -1,9 +1,10 @@ package com.github.technus.tectech.recipe; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.IEMMapRead; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_Recipe; import net.minecraft.item.ItemStack; @@ -14,19 +15,17 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; -import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; - public class TT_recipe extends GT_Recipe { - public static final String E_RECIPE_ID = "eRecipeID"; - public final cElementalDefinitionStackMap[] input; - public final cElementalDefinitionStackMap[] output; - public final cElementalDefinitionStackMap[] eCatalyst; - public final IAdditionalCheck additionalCheck; + public static final String E_RECIPE_ID = "eRecipeID"; + public final EMConstantStackMap[] input; + public final IEMMapRead<? extends IEMStack>[] output; + public final EMConstantStackMap[] eCatalyst; + public final IAdditionalCheck additionalCheck; public TT_recipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue, - cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, IAdditionalCheck check){ + EMConstantStackMap[] in, IEMMapRead<? extends IEMStack>[] out, EMConstantStackMap[] catalyst, IAdditionalCheck check){ super(aOptimize,aInputs,aOutputs,aSpecialItems,aChances,aFluidInputs,aFluidOutputs,aDuration,aEUt,aSpecialValue); input=in; output=out; @@ -38,11 +37,11 @@ public class TT_recipe extends GT_Recipe { return EMisRecipeInputEqual(consume,doNotCheckStackSizes,itemStacks,fluidStacks,null,null); } - public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in){ + public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap[] in){ return EMisRecipeInputEqual(consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,null); } - public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in, cElementalInstanceStackMap[] catalyst) { + public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap[] in, EMInstanceStackMap[] catalyst) { if(additionalCheck !=null && !additionalCheck.check(this,consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,catalyst)) { return false; } @@ -51,7 +50,7 @@ public class TT_recipe extends GT_Recipe { for (int i = 0; i < eCatalyst.length; i++) { if (eCatalyst[i] != null && eCatalyst[i].hasStacks()) { if (catalyst[i] != null && catalyst[i].hasStacks()) { - if (!catalyst[i].removeAllAmounts(true, eCatalyst[i])) { + if (!catalyst[i].containsAllAmounts(eCatalyst[i])) { return false; } } else { @@ -68,8 +67,14 @@ public class TT_recipe extends GT_Recipe { for (int i = 0; i < input.length; i++) { if (input[i] != null && input[i].hasStacks()) { if (in[i] != null && in[i].hasStacks()) { - if (!in[i].removeAllAmounts(consume, input[i])) { - return false; + if(consume){ + if (!in[i].removeAllAmounts(input[i])) { + return false; + } + }else { + if (!in[i].containsAllAmounts(input[i])) { + return false; + } } } else { return false; @@ -83,11 +88,13 @@ public class TT_recipe extends GT_Recipe { return super.isRecipeInputEqual(consume, doNotCheckStackSizes, fluidStacks, itemStacks); } - public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in){ + @Deprecated + public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap in){ return EMisRecipeInputEqualConsumeFromOne(consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,null); } - public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in, cElementalInstanceStackMap[] catalyst) { + @Deprecated + public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap in, EMInstanceStackMap[] catalyst) { if(additionalCheck !=null && !additionalCheck.check(this,consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,catalyst)) { return false; } @@ -96,7 +103,7 @@ public class TT_recipe extends GT_Recipe { for (int i = 0; i < eCatalyst.length; i++) { if (eCatalyst[i] != null && eCatalyst[i].hasStacks()) { if (catalyst[i] != null && catalyst[i].hasStacks()) { - if (!catalyst[i].removeAllAmounts(true, eCatalyst[i])) { + if (!catalyst[i].containsAllAmounts(eCatalyst[i])) { return false; } } else { @@ -110,11 +117,17 @@ public class TT_recipe extends GT_Recipe { } if (input != null) { if (in != null) { - for (cElementalDefinitionStackMap anInput : input) { + for (EMConstantStackMap anInput : input) { if (anInput != null && anInput.hasStacks()) { if (in.hasStacks()) { - if (!in.removeAllAmounts(consume, anInput)) { - return false; + if(consume){ + if (!in.removeAllAmounts(anInput)) { + return false; + } + }else { + if (!in.containsAllAmounts(anInput)) { + return false; + } } } else { return false; @@ -129,8 +142,8 @@ public class TT_recipe extends GT_Recipe { } public interface IAdditionalCheck { - boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in, cElementalInstanceStackMap[] e); - boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in, cElementalInstanceStackMap[] e); + boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap[] in, EMInstanceStackMap[] e); + boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, EMInstanceStackMap in, EMInstanceStackMap[] e); } public static class TT_Recipe_Map<T extends TT_recipe> { @@ -166,12 +179,20 @@ public class TT_recipe extends GT_Recipe { } public static class GT_Recipe_MapTT extends GT_Recipe.GT_Recipe_Map { - public static GT_Recipe_MapTT sResearchableFakeRecipes =new GT_Recipe_MapTT(new HashSet<>(32), "gt.recipe.researchStation", "Research station", null, "gregtech:textures/gui/multimachines/ResearchFake", 1, 1,1,0,1,"", 1, "", true, false);//nei to false - using custom handler - public static GT_Recipe_MapTT sScannableFakeRecipes = new GT_Recipe_MapTT(new HashSet<>(32),"gt.recipe.em_scanner","EM Scanner Research", null,"gregtech:textures/gui/multimachines/ResearchFake",1,1,1,0,1,"",1,"",true,false); - public static ArrayList<GT_Recipe_AssemblyLine> sAssemblylineRecipes=new ArrayList<>(); + public static GT_Recipe_MapTT sResearchableFakeRecipes = new GT_Recipe_MapTT(new HashSet<>(32), "gt.recipe.researchStation", "Research station", null, "gregtech:textures/gui/multimachines/ResearchFake", 1, 1, 1, 0, 1, "", 1, "", true, false);//nei to false - using custom handler + public static GT_Recipe_MapTT sScannableFakeRecipes = new GT_Recipe_MapTT(new HashSet<>(32), "gt.recipe.em_scanner", "EM Scanner Research", null, "gregtech:textures/gui/multimachines/ResearchFake", 1, 1, 1, 0, 1, "", 1, "", true, false); + public static ArrayList<GT_Recipe_AssemblyLine> sAssemblylineRecipes = new ArrayList<>(); - public GT_Recipe_MapTT(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + public GT_Recipe_MapTT(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, + int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, + int aAmperage, + String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, + boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { + super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, + aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, + aAmperage, + aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, + aShowVoltageAmperageInNEI, aNEIAllowed); } } @@ -181,7 +202,7 @@ public class TT_recipe extends GT_Recipe { public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, IAdditionalCheck check) { + EMConstantStackMap[] in, EMConstantStackMap[] out, EMConstantStackMap[] catalyst, IAdditionalCheck check) { super(aOptimize, aInputs, aOutputs, aSpecialItems, null, aFluidInputs, null, aDuration, aEUt, aSpecialValue, in, out, catalyst, check); mResearchItem=researchItem; } @@ -189,28 +210,28 @@ public class TT_recipe extends GT_Recipe { public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalDefinitionStackMap[] in) { + EMConstantStackMap[] in) { this(aOptimize, researchItem, aInputs, aOutputs, aSpecialItems, aFluidInputs, aDuration, aEUt, aSpecialValue, in, null, null,null); } } public static class TT_EMRecipe extends TT_recipe{ - public final iElementalDefinition mResearchEM; - public final GT_Recipe scannerRecipe; + public final IEMDefinition mResearchEM; + public final GT_Recipe scannerRecipe; - public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, iElementalDefinition researchEM, - ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, - FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, IAdditionalCheck check) { + public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, IEMDefinition researchEM, + ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, + FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, + EMConstantStackMap[] in, EMConstantStackMap[] out, EMConstantStackMap[] catalyst, IAdditionalCheck check) { super(aOptimize, aInputs, aOutputs, aSpecialItems, null, aFluidInputs, null, aDuration, aEUt, aSpecialValue, in, out, catalyst, check); mResearchEM=researchEM; this.scannerRecipe=scannerRecipe; } - public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, iElementalDefinition researchEM, + public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, IEMDefinition researchEM, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue, - cElementalDefinitionStackMap[] in) { + EMConstantStackMap[] in) { this(aOptimize, scannerRecipe, researchEM, aInputs, aOutputs, aSpecialItems, aFluidInputs, aDuration, aEUt, aSpecialValue, in, null, null,null); } } @@ -219,8 +240,8 @@ public class TT_recipe extends GT_Recipe { public static TT_Recipe_Map_EM<TT_EMRecipe> sCrafterRecipesEM = new TT_Recipe_Map_EM<>("EM Crafter Recipes","gt.recipe.em_crafter",null); public static TT_Recipe_Map_EM<TT_EMRecipe> sMachineRecipesEM = new TT_Recipe_Map_EM<>("EM Machinert Recipe","gt.recipe.em_machinery",null); - private final HashMap<iElementalDefinition,T> mRecipeMap; - public final String mNEIName,mUnlocalizedName,mNEIGUIPath; + private final HashMap<IEMDefinition,T> mRecipeMap; + public final String mNEIName,mUnlocalizedName,mNEIGUIPath; public TT_Recipe_Map_EM(String mNEIName,String mUnlocalizedName,String mNEIGUIPath){ mRecipeMap =new HashMap<>(16); @@ -229,24 +250,10 @@ public class TT_recipe extends GT_Recipe { this.mNEIGUIPath=mNEIGUIPath; } - public T findRecipe(iElementalDefinition stack){ + public T findRecipe(IEMDefinition stack){ return mRecipeMap.get(stack); } - public T findRecipe(ItemStack dataHandler){ - if(dataHandler==null || dataHandler.stackTagCompound==null) { - return null; - } - try { - return mRecipeMap.get(cElementalDefinition.fromNBT(dataHandler.stackTagCompound.getCompoundTag(E_RECIPE_ID))); - }catch (Exception e){ - if (DEBUG_MODE) { - e.printStackTrace(); - } - return null; - } - } - public void add(T recipe){ mRecipeMap.put(recipe.mResearchEM,recipe); } diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index b08265d2c5..5f6fe08b5b 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,23 +1,27 @@ package com.github.technus.tectech.recipe; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting; import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine; +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_AssemblyLine; import gregtech.api.util.GT_Utility; import gregtech.common.GT_RecipeAdder; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import java.util.Arrays; +import java.util.Comparator; import java.util.List; public class TT_recipeAdder extends GT_RecipeAdder { @@ -31,7 +35,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { if(aFluidInputs==null) { aFluidInputs = nullFluid; } - if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null || aInputs.length>15) { + if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null || aInputs.length>16) { return false; } for(ItemStack tItem : aInputs){ @@ -39,16 +43,8 @@ public class TT_recipeAdder extends GT_RecipeAdder { TecTech.LOGGER.error("addResearchableAssemblingLineRecipe "+aResearchItem.getDisplayName()+" --> "+aOutput.getUnlocalizedName()+" there is some null item in that recipe"); } } - if(researchAmperage<=0) { - researchAmperage = 1; - } 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; - } + researchAmperage = GT_Utility.clamp(researchAmperage, 1, Short.MAX_VALUE); + computationRequiredPerSec = GT_Utility.clamp(computationRequiredPerSec, 1, Short.MAX_VALUE); TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Writes Research result")}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); GT_Recipe.GT_Recipe_Map.sAssemblylineVisualRecipes.addFakeRecipe(false, aInputs, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Reads Research result")}, aFluidInputs, null, assDuration, assEUt, 0,true); GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(new GT_Recipe.GT_Recipe_AssemblyLine(CustomItemList.UnusedStuff.get(1), totalComputationRequired/computationRequiredPerSec, aInputs, aFluidInputs, aOutput, assDuration, assEUt)); @@ -63,23 +59,29 @@ public class TT_recipeAdder extends GT_RecipeAdder { if(aFluidInputs==null) { aFluidInputs = nullFluid; } - if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null || aInputs.length>15 || aFluidInputs.length>4 || assDuration<=0 || assEUt<=0) { + if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null || aInputs.length>16 || aFluidInputs.length>4 || assDuration<=0 || assEUt<=0) { return false; } ItemStack[] tInputs = new ItemStack[aInputs.length]; ItemStack[][] tAlts = new ItemStack[aInputs.length][]; + int tPersistentHash = 1; for(int i = 0; i < aInputs.length; i++){ Object obj = aInputs[i]; if (obj instanceof ItemStack) { tInputs[i] = (ItemStack) obj; tAlts[i] = null; + tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(tInputs[i], true, false); continue; } else if (obj instanceof ItemStack[]) { ItemStack[] aStacks = (ItemStack[]) obj; if (aStacks.length > 0) { tInputs[i] = aStacks[0]; - tAlts[i] = Arrays.copyOf(aStacks, aStacks.length); + tAlts[i] = (ItemStack[]) Arrays.copyOf(aStacks, aStacks.length); + for (ItemStack tAlt : tAlts[i]) { + tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(tAlt, true, false); + } + tPersistentHash *= 31; continue; } } else if (obj instanceof Object[]) { @@ -87,16 +89,24 @@ public class TT_recipeAdder extends GT_RecipeAdder { List<ItemStack> tList; if (objs.length >= 2 && !(tList = GT_OreDictUnificator.getOres(objs[0])).isEmpty()) { try { + // sort the output, so the hash code is stable across launches + tList.sort(Comparator.<ItemStack, String>comparing(s -> GameRegistry.findUniqueIdentifierFor(s.getItem()).modId) + .thenComparing(s -> GameRegistry.findUniqueIdentifierFor(s.getItem()).modId) + .thenComparingInt(Items.feather::getDamage) + .thenComparingInt(s -> s.stackSize)); int tAmount = ((Number) objs[1]).intValue(); List<ItemStack> uList = new ArrayList<>(); for (ItemStack tStack : tList) { ItemStack uStack = GT_Utility.copyAmount(tAmount, tStack); if (GT_Utility.isStackValid(uStack)) { uList.add(uStack); - if (tInputs[i] == null) tInputs[i] = uStack; + if (tInputs[i] == null) + tInputs[i] = uStack; } } - tAlts[i] = uList.toArray(nullItem); + tAlts[i] = uList.toArray(new ItemStack[0]); + tPersistentHash = tPersistentHash * 31 + (objs[0] == null ? "" : objs[0].toString()).hashCode(); + tPersistentHash = tPersistentHash * 31 + tAmount; continue; } catch (Exception t) { TecTech.LOGGER.error("addAssemblingLineRecipe "+aResearchItem.getDisplayName()+" --> there is some ... in that recipe"); @@ -105,20 +115,29 @@ public class TT_recipeAdder extends GT_RecipeAdder { } TecTech.LOGGER.error("addAssemblingLineRecipe "+aResearchItem.getDisplayName()+" --> "+aOutput.getUnlocalizedName()+" there is some null item in that recipe"); } - if(researchAmperage<=0) { - researchAmperage = 1; - } 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; + tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(aResearchItem, true, false); + tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(aOutput, true, false); + for (FluidStack tFluidInput : aFluidInputs) { + if (tFluidInput == null) + continue; + tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(tFluidInput, true, false); } + researchAmperage = GT_Utility.clamp(researchAmperage, 1, Short.MAX_VALUE); + computationRequiredPerSec = GT_Utility.clamp(computationRequiredPerSec, 1, Short.MAX_VALUE); + tPersistentHash = tPersistentHash * 31 + totalComputationRequired; + tPersistentHash = tPersistentHash * 31 + computationRequiredPerSec; + tPersistentHash = tPersistentHash * 31 + researchAmperage; + tPersistentHash = tPersistentHash * 31 + researchEUt; + tPersistentHash = tPersistentHash * 31 + assDuration; + tPersistentHash = tPersistentHash * 31 + assEUt; TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Writes Research result")}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); GT_Recipe.GT_Recipe_Map.sAssemblylineVisualRecipes.addFakeRecipe(false,tInputs,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Reads Research result")},aFluidInputs,null,assDuration,assEUt,0,tAlts,true); - GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(new GT_Recipe.GT_Recipe_AssemblyLine( CustomItemList.UnusedStuff.get(1), totalComputationRequired/computationRequiredPerSec, tInputs, aFluidInputs, aOutput, assDuration, assEUt, tAlts)); - TT_recipe.GT_Recipe_MapTT.sAssemblylineRecipes.add(new GT_Recipe.GT_Recipe_AssemblyLine( aResearchItem, totalComputationRequired/computationRequiredPerSec, tInputs, aFluidInputs, aOutput, assDuration, assEUt, tAlts)); + GT_Recipe_AssemblyLine recipeGT = new GT_Recipe_AssemblyLine(CustomItemList.UnusedStuff.get(1), totalComputationRequired / computationRequiredPerSec, tInputs, aFluidInputs, aOutput, assDuration, assEUt, tAlts); + recipeGT.setPersistentHash(tPersistentHash); + GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(recipeGT); + GT_Recipe_AssemblyLine recipeTT = new GT_Recipe_AssemblyLine(aResearchItem, totalComputationRequired / computationRequiredPerSec, tInputs, aFluidInputs, aOutput, assDuration, assEUt, tAlts); + recipeTT.setPersistentHash(tPersistentHash); + TT_recipe.GT_Recipe_MapTT.sAssemblylineRecipes.add(recipeTT); return true; } @@ -131,7 +150,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { public static boolean addResearchableEMmachineRecipe( ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalDefinitionStackMap[] eInputs, + ItemStack[] aInputs, FluidStack[] aFluidInputs, EMConstantStackMap[] eInputs, ItemStack aOutput, int machineDuration, int machineEUt, int machineAmperage) { if(aInputs==null) { aInputs = nullItem; @@ -165,7 +184,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { public static boolean addResearchableEMcrafterRecipe( ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - cElementalDefinitionStackMap[] eInputs, cElementalDefinitionStackMap[] catalyst, TT_recipe.IAdditionalCheck check, + EMConstantStackMap[] eInputs, EMConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check, ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) { if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null) { return false; @@ -187,8 +206,8 @@ public class TT_recipeAdder extends GT_RecipeAdder { } public static boolean addScannableEMmachineRecipe( - iElementalDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - ItemStack[] aInputs, FluidStack[] aFluidInputs, cElementalDefinitionStackMap[] eInputs, + IEMDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, + ItemStack[] aInputs, FluidStack[] aFluidInputs, EMConstantStackMap[] eInputs, ItemStack aOutput, int machineDuration, int machineEUt, int machineAmperage) { if(aInputs==null) { aInputs = nullItem; @@ -215,7 +234,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { computationRequiredPerSec = Short.MAX_VALUE; } ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); - ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(aResearchEM,1))); + ElementalDefinitionContainer_EM.setContent(placeholder,new EMConstantStackMap(new EMDefinitionStack(aResearchEM,1))); GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_machine.machine)}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,aInputs,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, aFluidInputs,machineDuration,machineEUt,machineAmperage,eInputs)); @@ -223,8 +242,8 @@ public class TT_recipeAdder extends GT_RecipeAdder { } public static boolean addScannableEMcrafterRecipe( - iElementalDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, - cElementalDefinitionStackMap[] eInputs, cElementalDefinitionStackMap[] catalyst, TT_recipe.IAdditionalCheck check, + IEMDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, + EMConstantStackMap[] eInputs, EMConstantStackMap[] catalyst, TT_recipe.IAdditionalCheck check, ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) { if (aResearchEM==null || totalComputationRequired<=0 || aOutput == null) { return false; @@ -240,7 +259,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { computationRequiredPerSec = Short.MAX_VALUE; } ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); - ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(aResearchEM,1))); + ElementalDefinitionContainer_EM.setContent(placeholder,new EMConstantStackMap(new EMDefinitionStack(aResearchEM,1))); GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafting.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,null,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, null,crafterDuration,crafterEUt,crafterAmperage,eInputs,null,catalyst,check)); diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java index 5265ad25c6..9e555e3961 100644 --- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java +++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java @@ -78,7 +78,7 @@ public enum CustomItemList implements IItemContainer { 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, - tM_TeslaBase, tM_TeslaToroid, tM_TeslaSecondary, tM_TeslaPrimary_0, tM_TeslaPrimary_1, tM_TeslaPrimary_2, tM_TeslaPrimary_3, tM_TeslaPrimary_4, tM_TeslaPrimary_5, + tM_TeslaBase, tM_TeslaToroid, tM_TeslaSecondary, tM_TeslaPrimary_0, tM_TeslaPrimary_1, tM_TeslaPrimary_2, tM_TeslaPrimary_3, tM_TeslaPrimary_4, tM_TeslaPrimary_5, tM_TeslaPrimary_6, Machine_Multi_Microwave, Machine_Multi_TeslaCoil, Machine_Multi_Transformer, @@ -94,7 +94,7 @@ public enum CustomItemList implements IItemContainer { eM_avr_HV, eM_avr_EV, eM_avr_IV, eM_avr_LuV, eM_avr_ZPM, eM_avr_UV, eM_avr_UHV, eM_avr_UEV, eM_avr_UIV, eM_avr_UMV, - scanContainer, parametrizerMemory, teslaCapacitor, teslaCover, teslaComponent, teslaStaff, + scanContainer, parametrizerMemory, teslaCapacitor, teslaCover, teslaComponent, teslaStaff, enderLinkFluidCover, powerPassUpgradeCover, Machine_TeslaCoil_1by1_LV, Machine_TeslaCoil_1by1_MV, Machine_TeslaCoil_1by1_HV, Machine_TeslaCoil_1by1_EV, Machine_TeslaCoil_1by1_IV, Machine_TeslaCoil_2by2_LV, Machine_TeslaCoil_2by2_MV, Machine_TeslaCoil_2by2_HV, Machine_TeslaCoil_2by2_EV, Machine_TeslaCoil_2by2_IV, diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java index d34d12c754..42fb14f55d 100644 --- a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java +++ b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java @@ -13,7 +13,7 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; /** * Created by danie_000 on 17.12.2016. diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassItem.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassItem.java index aff5f8bbb7..3f42bdbbc4 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,8 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; -import static com.github.technus.tectech.CommonValues.TEC_MARK_EM; +import static com.github.technus.tectech.util.CommonValues.TEC_MARK_EM; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 11.04.2017. @@ -23,7 +24,7 @@ public class QuantumGlassItem extends ItemBlock { @Override public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { aList.add(TEC_MARK_EM); - aList.add("Dense yet transparent"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Glassy & Classy"); + aList.add(translateToLocal("tile.quantumGlass.desc.0"));//Dense yet transparent + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("tile.quantumGlass.desc.1"));//Glassy & Classy } } 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 index 4625dca434..d659a05005 100644 --- a/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java +++ b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimItem.java @@ -8,7 +8,8 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; -import static com.github.technus.tectech.CommonValues.TEC_MARK_GENERAL; +import static com.github.technus.tectech.util.CommonValues.TEC_MARK_GENERAL; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 30.09.2017. @@ -23,7 +24,7 @@ public class ReactorSimItem extends ItemBlock { @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..."); + aList.add(translateToLocal("tile.reactorSim.desc.0"));//Fission Reaction Uncertainty Resolver 9001 + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("tile.reactorSim.desc.1"));//Explodes, but not as much... } } diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java index 6d5bcd2b04..d2c34941ef 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java @@ -18,14 +18,12 @@ import net.minecraft.world.IBlockAccess; import java.util.List; import static com.github.technus.tectech.TecTech.tectechTexturePage1; +import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; /** * Created by danie_000 on 03.10.2016. */ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { - public static final byte texturePage=tectechTexturePage1; - public static final short textureOffset = (texturePage << 7)+16;//Start of PAGE 8 (which is the 9th page) (8*128)+16 - private static IIcon[] tM0 = new IIcon[2]; private static IIcon[] tM1 = new IIcon[2]; private static IIcon[] tM2 = new IIcon[2]; @@ -35,11 +33,14 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { private static IIcon[] tM6 = new IIcon[2]; private static IIcon tM7; private static IIcon[] tM8 = new IIcon[2]; + private static IIcon[] tM9 = new IIcon[2]; + + private static final byte START_INDEX = 16; public GT_Block_CasingsBA0() { super(GT_Item_CasingsBA0.class, "gt.blockcasingsBA0", GT_Material_Casings.INSTANCE); for (byte b = 0; b < 16; b = (byte) (b + 1)) { - Textures.BlockIcons.casingTexturePages[texturePage][b+16] = new GT_CopiedBlockTexture(this, 6, b); + Textures.BlockIcons.casingTexturePages[texturePage][b + START_INDEX] = new GT_CopiedBlockTexture(this, 6, b); /*IMPORTANT for block recoloring**/ } @@ -49,6 +50,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "EV Superconductor Primary Tesla Windings"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "IV Superconductor Primary Tesla Windings"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "LuV Superconductor Primary Tesla Windings"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "ZPM Superconductor Primary Tesla Windings"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Tesla Base Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Tesla Toroid Casing"); @@ -60,6 +62,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { CustomItemList.tM_TeslaPrimary_3.set(new ItemStack(this, 1, 3)); CustomItemList.tM_TeslaPrimary_4.set(new ItemStack(this, 1, 4)); CustomItemList.tM_TeslaPrimary_5.set(new ItemStack(this, 1, 5)); + CustomItemList.tM_TeslaPrimary_6.set(new ItemStack(this, 1, 9)); CustomItemList.tM_TeslaBase.set(new ItemStack(this, 1, 6)); CustomItemList.tM_TeslaToroid.set(new ItemStack(this, 1, 7)); @@ -80,6 +83,8 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { tM4[1] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_4"); tM5[0] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_5"); tM5[1] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_5"); + tM9[0] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_6"); + tM9[1] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_6"); tM6[0] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_BASE_TOP_BOTTOM"); tM6[1] = aIconRegister.registerIcon("gregtech:iconsets/TM_TESLA_BASE_SIDES"); @@ -92,7 +97,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { public IIcon getIcon(int aSide, int aMeta) { switch (aMeta) { case 0: - switch (aSide){ + switch (aSide) { case 0: case 1: return tM0[0]; @@ -100,7 +105,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { return tM0[1]; } case 1: - switch (aSide){ + switch (aSide) { case 0: case 1: return tM1[0]; @@ -108,7 +113,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { return tM1[1]; } case 2: - switch (aSide){ + switch (aSide) { case 0: case 1: return tM2[0]; @@ -116,7 +121,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { return tM2[1]; } case 3: - switch (aSide){ + switch (aSide) { case 0: case 1: return tM3[0]; @@ -124,7 +129,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { return tM3[1]; } case 4: - switch (aSide){ + switch (aSide) { case 0: case 1: return tM4[0]; @@ -132,7 +137,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { return tM4[1]; } case 5: - switch (aSide){ + switch (aSide) { case 0: case 1: return tM5[0]; @@ -140,7 +145,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { return tM5[1]; } case 6: - switch (aSide){ + switch (aSide) { case 0: case 1: return tM6[0]; @@ -150,13 +155,21 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { case 7: return tM7; case 8: - switch (aSide){ + switch (aSide) { case 0: case 1: return tM8[0]; default: return tM8[1]; } + case 9: + switch (aSide) { + case 0: + case 1: + return tM9[0]; + default: + return tM9[1]; + } default: return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); } @@ -171,7 +184,7 @@ public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract { @Override public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) { - for (int i = 0; i <= 8; i++) { + for (int i = 0; i <= 9; i++) { aList.add(new ItemStack(aItem, 1, i)); } } diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java index bac2dfb9ac..2a8bb37a0b 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsNH.java @@ -10,7 +10,7 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static com.github.technus.tectech.thing.metaTileEntity.Textures.*; /** diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java index eb590ab2e2..f3574007f2 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java @@ -18,7 +18,7 @@ import net.minecraft.world.IBlockAccess; import java.util.List; import static com.github.technus.tectech.TecTech.tectechTexturePage1; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; /** * Created by danie_000 on 03.10.2016. diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java deleted file mode 100644 index c65870eeb7..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.github.technus.tectech.thing.casing; - -import com.github.technus.tectech.Reference; -import com.github.technus.tectech.thing.CustomItemList; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.blocks.GT_Block_Casings_Abstract; -import gregtech.common.blocks.GT_Material_Casings; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; - -import java.util.List; - -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; - -/** - * Created by danie_000 on 03.10.2016. - */ -public class GT_Block_HintTT extends GT_Block_Casings_Abstract { - private static IIcon[] hint = new IIcon[16]; - - public GT_Block_HintTT() { - super(GT_Item_HintTT.class, "gt.blockhintTT", GT_Material_Casings.INSTANCE); - setCreativeTab(creativeTabTecTech); - - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Hint 1 dot");//id is -1 - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Hint 2 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Hint 3 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Hint 4 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Hint 5 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Hint 6 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Hint 7 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Hint 8 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Hint 9 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Hint 10 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Hint 11 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".11.name", "Hint 12 dots"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".12.name", "Hint general"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".13.name", "Hint air"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".14.name", "Hint no air"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".15.name", "Hint error"); - - - CustomItemList.hint_0.set(new ItemStack(this, 1, 0)); - CustomItemList.hint_1.set(new ItemStack(this, 1, 1)); - CustomItemList.hint_2.set(new ItemStack(this, 1, 2)); - CustomItemList.hint_3.set(new ItemStack(this, 1, 3)); - CustomItemList.hint_4.set(new ItemStack(this, 1, 4)); - CustomItemList.hint_5.set(new ItemStack(this, 1, 5)); - CustomItemList.hint_6.set(new ItemStack(this, 1, 6)); - CustomItemList.hint_7.set(new ItemStack(this, 1, 7)); - CustomItemList.hint_8.set(new ItemStack(this, 1, 8)); - CustomItemList.hint_9.set(new ItemStack(this, 1, 9)); - CustomItemList.hint_10.set(new ItemStack(this, 1, 10)); - CustomItemList.hint_11.set(new ItemStack(this, 1, 11)); - CustomItemList.hint_general.set(new ItemStack(this, 1, 12)); - CustomItemList.hint_air.set(new ItemStack(this, 1, 13)); - CustomItemList.hint_noAir.set(new ItemStack(this, 1, 14)); - CustomItemList.hint_error.set(new ItemStack(this, 1, 15)); - } - - @Override - public void registerBlockIcons(IIconRegister aIconRegister) { - //super.registerBlockIcons(aIconRegister); - hint[0] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_0"); - hint[1] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_1"); - hint[2] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_2"); - hint[3] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_3"); - hint[4] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_4"); - hint[5] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_5"); - hint[6] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_6"); - hint[7] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_7"); - hint[8] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_8"); - hint[9] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_9"); - hint[10] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_10"); - hint[11] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_11"); - hint[12] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_DEFAULT"); - hint[13] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_AIR"); - hint[14] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_NOAIR"); - hint[15] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_ERROR"); - } - - @Override - public IIcon getIcon(int aSide, int aMeta) { - return hint[aMeta]; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) { - int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); - return getIcon(aSide, tMeta); - } - - @Override - public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) { - for (int i = 0; i <= 15; i++) { - aList.add(new ItemStack(aItem, 1, i)); - } - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java index 7decce34ae..50630820df 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java @@ -8,7 +8,8 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; -import static com.github.technus.tectech.CommonValues.*; +import static com.github.technus.tectech.util.CommonValues.*; +import static net.minecraft.util.StatCollector.translateToLocal; public class GT_Item_CasingsBA0 extends GT_Item_Casings_Abstract { public GT_Item_CasingsBA0(Block par1) { @@ -17,47 +18,36 @@ public class GT_Item_CasingsBA0 extends GT_Item_Casings_Abstract { @Override public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - if(aStack.getItemDamage() < 15) { + if (aStack.getItemDamage() < 15) { aList.add(BASS_MARK); } else { aList.add(COSMIC_MARK); } switch (aStack.getItemDamage()) { case 0://"Redstone Alloy Primary Tesla Windings" - aList.add("Handles up to 32 EU/t"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "What one man calls God, another calls the laws of physics."); - break; case 1://"MV Superconductor Primary Tesla Windings" - aList.add("Handles up to 128 EU/t"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "What one man calls God, another calls the laws of physics."); - break; case 2://"HV Superconductor Primary Tesla Windings" - aList.add("Handles up to 512 EU/t"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "What one man calls God, another calls the laws of physics."); - break; case 3://"EV Superconductor Primary Tesla Windings" - aList.add("Handles up to 2048 EU/t"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "What one man calls God, another calls the laws of physics."); - break; case 4://"IV Superconductor Primary Tesla Windings" - aList.add("Handles up to 8192 EU/t"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "What one man calls God, another calls the laws of physics."); - break; case 5://"LuV Superconductor Primary Tesla Windings" - aList.add("Handles up to 32768 EU/t"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "What one man calls God, another calls the laws of physics."); + aList.add(translateToLocal("gt.blockcasingsBA0.0.desc.0") + " " + V[aStack.getItemDamage() + 1] + " EU/t");//Handles up to + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsBA0.0.desc.1"));//What one man calls God, another calls the laws of physics. break; case 6://"Tesla Base Casing" - aList.add("The base of a wondrous contraption"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "it's alive, IT'S ALIVE!"); + aList.add(translateToLocal("gt.blockcasingsBA0.6.desc.0"));//The base of a wondrous contraption + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsBA0.6.desc.1"));//it's alive, IT'S ALIVE! break; case 7://"Tesla Toroid Casing" - aList.add("Made out of the finest tin foil!"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Faraday suits might come later"); + aList.add(translateToLocal("gt.blockcasingsBA0.7.desc.0"));//Made out of the finest tin foil! + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsBA0.7.desc.1"));//Faraday suits might come later break; case 8://"Tesla Secondary Windings" - aList.add("Picks up power from a primary coil"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Who wouldn't want a 32k epoxy multi?"); + aList.add(translateToLocal("gt.blockcasingsBA0.8.desc.0"));//Picks up power from a primary coil + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsBA0.8.desc.1"));//Who wouldn't want a 32k epoxy multi? + break; + case 9://"ZPM Superconductor Primary Tesla Windings" + aList.add(translateToLocal("gt.blockcasingsBA0.0.desc.0") + " " + V[7] + " EU/t");//Handles up to + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsBA0.0.desc.1"));//What one man calls God, another calls the laws of physics. break; default://WTF? aList.add("Damn son where did you get that!?"); 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 2fd58c408f..5c93841d9a 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,9 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; -import static com.github.technus.tectech.CommonValues.*; +import static com.github.technus.tectech.util.CommonValues.COSMIC_MARK; +import static com.github.technus.tectech.util.CommonValues.TEC_MARK_EM; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 03.10.2016. @@ -27,68 +29,68 @@ public class GT_Item_CasingsTT extends GT_Item_Casings_Abstract { } switch (aStack.getItemDamage()) { case 0://"High Power Casing" - aList.add("Well suited for high power applications."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "The power levels are rising!"); + aList.add(translateToLocal("gt.blockcasingsTT.0.desc.0"));//Well suited for high power applications. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.0.desc.1"));//The power levels are rising! break; case 1://"Computer Casing" - aList.add("Nice and clean casing."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Dust can break it!?"); + aList.add(translateToLocal("gt.blockcasingsTT.1.desc.0"));//Nice and clean casing. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.1.desc.1"));//Dust can break it!? break; case 2://"Computer Heat Vent" - aList.add("Air vent with a filter."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Perfectly muffled sound!"); + aList.add(translateToLocal("gt.blockcasingsTT.2.desc.0"));//Air vent with a filter. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.2.desc.1"));//Perfectly muffled sound! break; case 3://"Advanced Computer Casing" - aList.add("Contains high bandwidth bus"); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "couple thousand qubits wide."); + aList.add(translateToLocal("gt.blockcasingsTT.3.desc.0"));//Contains high bandwidth bus + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.3.desc.1"));//couple thousand qubits wide. break; case 4://"Molecular Casing" - aList.add("Stops elemental things."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Radiation and emotions too..."); + aList.add(translateToLocal("gt.blockcasingsTT.4.desc.0"));//Stops elemental things. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.4.desc.1"));//Radiation and emotions too... break; case 5://"Advanced Molecular Casing" - aList.add("Cooling and stabilization."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "A comfortable machine bed."); + aList.add(translateToLocal("gt.blockcasingsTT.5.desc.0"));//Cooling and stabilization. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.5.desc.1"));//A comfortable machine bed. break; case 6://"Containment Field Generator" - aList.add("Creates a field that..."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "can stop even force carriers."); + aList.add(translateToLocal("gt.blockcasingsTT.6.desc.0"));//Creates a field that... + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.6.desc.1"));//can stop even force carriers. break; case 7://"Molecular Coil" - aList.add("Well it does things too..."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "[Use this coil!]"); + aList.add(translateToLocal("gt.blockcasingsTT.7.desc.0"));//Well it does things too... + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.7.desc.1"));//[Use this coil!] break; case 8://"Collider Hollow Casing" - aList.add("Reinforced accelerator tunnel."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Most advanced pipe ever."); + aList.add(translateToLocal("gt.blockcasingsTT.8.desc.0"));//Reinforced accelerator tunnel. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.8.desc.1"));//Most advanced pipe ever. break; case 9://"Spacetime Altering Casing" - aList.add("C is no longer the limit."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Wibbly wobbly timey wimey stuff."); + aList.add(translateToLocal("gt.blockcasingsTT.9.desc.0"));//c is no longer the limit. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.9.desc.1"));//Wibbly wobbly timey wimey stuff. break; case 10://"Teleportation Casing" - aList.add("Remote connection."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Better touch with a stick."); + aList.add(translateToLocal("gt.blockcasingsTT.10.desc.0"));//Remote connection. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.10.desc.1"));//Better touch with a stick. break; case 11://"Dimensional Bridge Generator" - aList.add("Interdimensional Operations."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Around the universe and other places too."); + aList.add(translateToLocal("gt.blockcasingsTT.11.desc.0"));//Interdimensional Operations. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.11.desc.1"));//Around the universe and other places too. break; case 12://"Ultimate Molecular Casing" - aList.add("Ultimate in every way."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "I don't know what it can't do."); + aList.add(translateToLocal("gt.blockcasingsTT.12.desc.0"));//Ultimate in every way. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.12.desc.1"));//I don't know what it can't do. break; case 13://"Ultimate Advanced Molecular Casing" - aList.add("More Ultimate in every way."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "I don't know what I am doing!"); + aList.add(translateToLocal("gt.blockcasingsTT.13.desc.0"));//More Ultimate in every way. + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.13.desc.1"));//I don't know what I am doing! break; case 14://"Ultimate Containment Field Generator" - aList.add("Black Hole..."); - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Meh..."); + aList.add(translateToLocal("gt.blockcasingsTT.14.desc.0"));//Black Hole... + aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockcasingsTT.14.desc.1"));//Meh... break; case 15://"Debug Sides" - aList.add("Lazy man way of determining sides."); - aList.add(EnumChatFormatting.BLUE.toString() + "0, 1, 2, 3, 4, 5, 6?!"); + aList.add(translateToLocal("gt.blockcasingsTT.15.desc.0"));//Lazy man way of determining sides. + aList.add(EnumChatFormatting.BLUE.toString() + translateToLocal("gt.blockcasingsTT.15.desc.1"));//0, 1, 2, 3, 4, 5, 6?! break; default://WTF? aList.add("Damn son where did you get that!?"); 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 deleted file mode 100644 index 77e0a4172e..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_HintTT.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.github.technus.tectech.thing.casing; - -import gregtech.common.blocks.GT_Item_Casings_Abstract; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -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 03.10.2016. - */ -public class GT_Item_HintTT extends GT_Item_Casings_Abstract { - public GT_Item_HintTT(Block par1) { - super(par1); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - 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: - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Placeholder for a certain group."); - break; - case 12: - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "General placeholder."); - break; - case 13: - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Make sure it contains Air material."); - break; - case 14: - aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Make sure it does not contain Air material."); - break; - case 15: - aList.add(EnumChatFormatting.BLUE.toString() + "ERROR, what did u expect?"); - break; - default://WTF? - aList.add("Damn son where did you get that!?"); - aList.add(EnumChatFormatting.BLUE.toString() + "From outer space... I guess..."); - } - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/casing/TT_Container_Casings.java b/src/main/java/com/github/technus/tectech/thing/casing/TT_Container_Casings.java index 071a4ae28f..40bb20d545 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/TT_Container_Casings.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/TT_Container_Casings.java @@ -7,7 +7,7 @@ import net.minecraft.block.Block; */ public final class TT_Container_Casings { public static Block sBlockCasingsTT; - public static Block sHintCasingsTT; + public static Block sBlockCasingsBA0; public static Block sBlockCasingsNH; diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_EnderFluidLink.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_EnderFluidLink.java new file mode 100644 index 0000000000..d6b5e28b18 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_EnderFluidLink.java @@ -0,0 +1,354 @@ +package com.github.technus.tectech.thing.cover; + +import com.github.technus.tectech.loader.NetworkDispatcher; +import com.github.technus.tectech.mechanics.enderStorage.EnderLinkCoverMessage; +import com.github.technus.tectech.mechanics.enderStorage.EnderLinkTag; +import eu.usrv.yamcore.auxiliary.PlayerChatHelper; +import gregtech.api.enums.GT_Values; +import gregtech.api.gui.GT_GUICover; +import gregtech.api.gui.widgets.GT_GuiIcon; +import gregtech.api.gui.widgets.GT_GuiIconButton; +import gregtech.api.gui.widgets.GT_GuiIntegerTextBox; +import gregtech.api.interfaces.IGuiScreen; +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.metatileentity.BaseMetaTileEntity; +import gregtech.api.net.GT_Packet_TileEntityCover; +import gregtech.api.util.GT_CoverBehavior; +import gregtech.api.util.GT_Utility; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidHandler; + +import java.awt.*; +import java.util.UUID; + +import static com.github.technus.tectech.mechanics.enderStorage.EnderWorldSavedData.*; + +public class GT_Cover_TM_EnderFluidLink extends GT_CoverBehavior { + private static final int L_PER_TICK = 8000; + private final static int IMPORT_EXPORT_MASK = 0b0001; + private final static int PUBLIC_PRIVATE_MASK = 0b0010; + private static EnderLinkTag tag = new EnderLinkTag(Color.WHITE, null);//Client-Sided + + public GT_Cover_TM_EnderFluidLink() { + } + + public static void setEnderLinkTag(EnderLinkTag inputTag) { + if(inputTag != null) { + tag = inputTag; + //Hacky Way to update the gui + GUI_INSTANCE.resetColorField(); + } + } + + private void transferFluid(IFluidHandler source, byte sSide, IFluidHandler target, byte tSide, int amount) { + FluidStack fluidStack = source.drain(ForgeDirection.getOrientation(sSide), amount, false); + + if (fluidStack != null) { + int fluidTransferred = target.fill(ForgeDirection.getOrientation(tSide), fluidStack, true); + source.drain(ForgeDirection.getOrientation(sSide), fluidTransferred, true); + } + } + + private boolean testBit(int aCoverVariable, int bitMask) { + return (aCoverVariable & bitMask) != 0; + } + + private int toggleBit(int aCoverVariable, int bitMask) { + return (aCoverVariable ^ bitMask); + } + + @Override + public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { + if ((aTileEntity instanceof IFluidHandler)) { + IFluidHandler fluidHandlerSelf = (IFluidHandler) aTileEntity; + IFluidHandler fluidHandlerEnder = getEnderFluidContainer(getEnderLinkTag((IFluidHandler) aTileEntity)); + + if (testBit(aCoverVariable, IMPORT_EXPORT_MASK)) { + transferFluid(fluidHandlerEnder, (byte) 6, fluidHandlerSelf, aSide, L_PER_TICK); + } else { + transferFluid(fluidHandlerSelf, aSide, fluidHandlerEnder, (byte) 6, L_PER_TICK); + } + } + return aCoverVariable; + } + + @Override + public String getDescription(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return ""; + } + + @Override + public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + return true; + } + + @Override + public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + return true; + } + + @Override + public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + int newCoverVariable = toggleBit(aCoverVariable, IMPORT_EXPORT_MASK); + + if (testBit(aCoverVariable, IMPORT_EXPORT_MASK)) { + PlayerChatHelper.SendInfo(aPlayer, "Ender Suction Engaged!");//TODO Translation support + } else { + PlayerChatHelper.SendInfo(aPlayer, "Ender Filling Engaged!"); + } + return newCoverVariable; + } + + @Override + public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + //Runs each tick + return 1; + } + + //region GUI + @Override + public boolean hasCoverGUI() { + return true; + } + + @Override + public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) { + //Only open gui if we're placed on a fluid tank + Object gui = null; + if (aTileEntity instanceof IFluidHandler) { + gui = new TM_EnderFluidLinkCover(aSide, aCoverID, coverData, aTileEntity); + } + return gui; + } + + private static TM_EnderFluidLinkCover GUI_INSTANCE; + + private class TM_EnderFluidLinkCover extends GT_GUICover { + private final byte side; + private final int coverID; + private int coverVariable; + private GT_GuiIntegerHexTextBox colorField; + + private final static int START_X = 10; + private final static int START_Y = 25; + private final static int SPACE_X = 18; + private final static int SPACE_Y = 18; + + private final static int SIZE_X = 176; + private final static int SIZE_Y = 107; + + private final static int BOX_SIZE_X = 34; + private final static int BOX_SIZE_Y = 34; + + private final static int TEXT_FIELD_SIZE_X = 72; + private final static int TEXT_FIELD_SIZE_Y = 12; + private final static int TEXT_STRING_LENGTH = 9; + + private final static int FONT_COLOR = 0xFF555555; + private final static int BOX_BORDER_COLOR = 0xFF000000; + + private final static int COLOR_FIELD_ID = 0; + private final static int PUBLIC_BUTTON_ID = 1; + private final static int PRIVATE_BUTTON_ID = 2; + private final static int IMPORT_BUTTON_ID = 3; + private final static int EXPORT_BUTTON_ID = 4; + + private GT_GuiIconButton newButtonWithSpacing(int id, int x, int y, GT_GuiIcon icon) { + return new GT_GuiIconButton(this, id, START_X + SPACE_X * x, START_Y + SPACE_Y * y, icon); + } + + private GT_GuiIntegerHexTextBox newTextField(int id, int x, int y) { + GT_GuiIntegerHexTextBox field = new GT_GuiIntegerHexTextBox(this, id, START_X + SPACE_X * x, + START_Y + SPACE_Y * y, TEXT_FIELD_SIZE_X, TEXT_FIELD_SIZE_Y); + field.setMaxStringLength(TEXT_STRING_LENGTH); + return field; + } + + private int drawNewString(String text, int x, int y) { + int align = 4; + return fontRendererObj.drawString(text, START_X + SPACE_X * x, align + START_Y + SPACE_Y * y, FONT_COLOR); + } + + private void drawColorSquare(int x, int y) { + //Draw the border square + int borderX1 = START_X + SPACE_X * x; + int borderY1 = START_Y + SPACE_Y * y; + int borderX2 = borderX1 + BOX_SIZE_X; + int borderY2 = borderY1 + BOX_SIZE_Y; + drawRect(borderX1, borderY1, borderX2, borderY2, BOX_BORDER_COLOR); + + //Draw Checkerboard Pattern + int white = 0xFFFFFFFF; + int grey = 0xFFBFBFBF; + boolean whiteOrGrey = true; + int cGridXStart = borderX1 + 1; + int cGridYStart = borderY1 + 1; + int cGridXToDraw = 4; + int cGridYToDraw = 4; + int cSquareWidth = 8; + int cSquareHeight = 8; + for (int i = 0; i < cGridXToDraw; i++) { + for (int j = 0; j < cGridYToDraw; j++) { + int cBoxX1 = cGridXStart + (cSquareWidth * i); + int cBoxY1 = cGridYStart + (cSquareHeight * j); + int cBoxX2 = cBoxX1 + cSquareWidth; + int cBoxY2 = cBoxY1 + cSquareHeight; + int cBoxColor = whiteOrGrey ? white : grey; + drawRect(cBoxX1, cBoxY1, cBoxX2, cBoxY2, cBoxColor); + whiteOrGrey = !whiteOrGrey; + } + whiteOrGrey = !whiteOrGrey; + } + + //Draw the actual color + int insideX1 = borderX1 + 1; + int insideY1 = borderY1 + 1; + int insideX2 = borderX2 - 1; + int insideY2 = borderY2 - 1; + drawRect(insideX1, insideY1, insideX2, insideY2, tag.getColorInt()); + } + + public TM_EnderFluidLinkCover(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + super(aTileEntity, SIZE_X, SIZE_Y, GT_Utility.intToStack(aCoverID)); + side = aSide; + coverID = aCoverID; + coverVariable = aCoverVariable; + NetworkDispatcher.INSTANCE.sendToServer(new EnderLinkCoverMessage.EnderLinkCoverQuery(tag, (IFluidHandler) tile)); + //Color Value Field + colorField = newTextField(COLOR_FIELD_ID, 2, 1); + GUI_INSTANCE = this; + resetColorField(); + //Public/Private Buttons + newButtonWithSpacing(PUBLIC_BUTTON_ID, 0, 2, GT_GuiIcon.WHITELIST) + .setTooltipText(trans("326", "Public")); + newButtonWithSpacing(PRIVATE_BUTTON_ID, 1, 2, GT_GuiIcon.BLACKLIST) + .setTooltipText(trans("327", "Private")); + //Import/Export Buttons + newButtonWithSpacing(IMPORT_BUTTON_ID, 0, 3, GT_GuiIcon.IMPORT) + .setTooltipText(trans("007", "Import")); + newButtonWithSpacing(EXPORT_BUTTON_ID, 1, 3, GT_GuiIcon.EXPORT) + .setTooltipText(trans("006", "Export")); + } + + @Override + public void drawExtras(int mouseX, int mouseY, float parTicks) { + super.drawExtras(mouseX, mouseY, parTicks); + drawColorSquare(0, 0); + drawNewString(trans("328", "Color Value"), 2, 0); + drawNewString(trans("329", "Public/Private"), 2, 2); + drawNewString(trans("229", "Import/Export"), 2, 3); + } + + @Override + protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) { + updateButtons(); + } + + @Override + public void buttonClicked(GuiButton btn){ + if (getClickable(btn.id)){ + coverVariable = getNewCoverVariable(btn.id); + GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile)); + } + updateButtons(); + } + + private void updateButtons(){ + GuiButton b; + for (Object o : buttonList) { + b = (GuiButton) o; + b.enabled = getClickable(b.id); + } + } + + private void switchPrivatePublic(int coverVar) { + UUID ownerUUID = tag.getUUID(); + if (testBit(coverVar, PUBLIC_PRIVATE_MASK)){ + if (tile instanceof BaseMetaTileEntity){ + BaseMetaTileEntity mte = (BaseMetaTileEntity) tile; + ownerUUID = mte.getOwnerUuid(); + } + } else { + ownerUUID = null; + } + EnderLinkTag newTag = new EnderLinkTag(new Color(tag.getColorInt(), true), ownerUUID); + NetworkDispatcher.INSTANCE.sendToServer(new EnderLinkCoverMessage.EnderLinkCoverUpdate(newTag, (IFluidHandler) tile)); + } + + private int getNewCoverVariable(int id) { + int tempCoverVariable = coverVariable; + switch (id) { + case PUBLIC_BUTTON_ID: case PRIVATE_BUTTON_ID: + tempCoverVariable = toggleBit(tempCoverVariable, PUBLIC_PRIVATE_MASK); + switchPrivatePublic(tempCoverVariable); + break; + case IMPORT_BUTTON_ID: case EXPORT_BUTTON_ID: + tempCoverVariable = toggleBit(tempCoverVariable, IMPORT_EXPORT_MASK); + } + return tempCoverVariable; + } + + private boolean getClickable(int id) { + boolean canBeClicked = false; + switch (id) { + case PUBLIC_BUTTON_ID: + canBeClicked = testBit(coverVariable, PUBLIC_PRIVATE_MASK); + break; + case PRIVATE_BUTTON_ID: + canBeClicked = !testBit(coverVariable, PUBLIC_PRIVATE_MASK); + break; + case IMPORT_BUTTON_ID: + canBeClicked = testBit(coverVariable, IMPORT_EXPORT_MASK); + break; + case EXPORT_BUTTON_ID: + canBeClicked = !testBit(coverVariable, IMPORT_EXPORT_MASK); + } + return canBeClicked; + } + + @Override + public void applyTextBox(GT_GuiIntegerTextBox box) { + try { + String string = box.getText(); + int colorValue = (int) Long.parseLong(string.replaceFirst("#", ""), 16); + tag = new EnderLinkTag(new Color(colorValue, true), tag.getUUID()); + NetworkDispatcher.INSTANCE.sendToServer(new EnderLinkCoverMessage.EnderLinkCoverUpdate(tag, (IFluidHandler) tile)); + } catch (NumberFormatException ignored) { + } + resetColorField(); + } + + @Override + public void resetTextBox(GT_GuiIntegerTextBox box) { + //Solid White becomes: #FFFFFFFF + box.setText("#" + String.format("%08X", tag.getColorInt())); + } + + public void resetColorField() { + resetTextBox(colorField); + } + + private class GT_GuiIntegerHexTextBox extends GT_GuiIntegerTextBox { + public GT_GuiIntegerHexTextBox(IGuiScreen gui, int id, int x, int y, int width, int height) { + super(gui, id, x, y, width, height); + } + + @Override + public boolean validChar(char c, int key) { + boolean isValid; + if (getCursorPosition() == 0) { + isValid = c == '#'; + } else { + isValid = super.validChar(c, key) + || c == 'A' || c == 'B' || c == 'C' || c == 'D' || c == 'E' || c == 'F' + || c == 'a' || c == 'b' || c == 'c' || c == 'd' || c == 'e' || c == 'f'; + } + return isValid; + } + } + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java new file mode 100644 index 0000000000..c9bb6da14f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java @@ -0,0 +1,49 @@ +package com.github.technus.tectech.thing.cover; + +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.util.GT_CoverBehavior; +import net.minecraft.item.ItemStack; + +public class GT_Cover_TM_PowerPassUpgrade extends GT_CoverBehavior { + public GT_Cover_TM_PowerPassUpgrade() { + } + + public boolean isCoverPlaceable(byte aSide, GT_ItemStack aStack, ICoverable aTileEntity) { + IGregTechTileEntity iGregTechTileEntityOffset = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); + if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM) { + GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) iGregTechTileEntityOffset; + return !multi.ePowerPassCover; + } + return false; + } + + @Override + public void placeCover(byte aSide, ItemStack aCover, ICoverable aTileEntity) { + IGregTechTileEntity iGregTechTileEntityOffset = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); + if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM) { + GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) iGregTechTileEntityOffset; + multi.ePowerPassCover = true; + multi.ePowerPass = true; + } + super.placeCover(aSide, aCover, aTileEntity); + } + + @Override + public boolean onCoverRemoval(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, boolean aForced) { + IGregTechTileEntity iGregTechTileEntityOffset = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); + if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM) { + GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) iGregTechTileEntityOffset; + multi.ePowerPassCover = false; + multi.ePowerPass = false; + } + return true; + } + + @Deprecated + public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return 0; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java index 721f730960..a573ed740b 100644 --- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil.java @@ -1,28 +1,55 @@ package com.github.technus.tectech.thing.cover; +import com.github.technus.tectech.mechanics.tesla.TeslaCoverConnection; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; +import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.*; import static ic2.api.info.Info.DMG_ELECTRIC; public class GT_Cover_TM_TeslaCoil extends GT_CoverBehavior { public GT_Cover_TM_TeslaCoil() { } + @Override + public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { + //Only do stuff if we're on top and have power + if (aSide == 1 || aTileEntity.getEUCapacity() > 0) { + //Makes sure we're on the list + teslaSimpleNodeSetAdd(new TeslaCoverConnection(aTileEntity.getIGregTechTileEntityOffset(0, 0, 0), + getTeslaReceptionCapability())); + } + return super.doCoverThings(aSide, aInputRedstone, aCoverID, aCoverVariable, aTileEntity, aTimer); + } + + @Override public String getDescription(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return "Do not attempt to use screwdriver!"; + return "Do not attempt to use screwdriver!";//TODO Translation support } + @Override public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } + @Override public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if(aTileEntity.getStoredEU() > 0 && !GT_Utility.isWearingFullElectroHazmat(aPlayer)){ + //Shock a non-hazmat player if they dare stuff a screwdriver into one of these + if (aTileEntity.getStoredEU() > 0 && !GT_Utility.isWearingFullElectroHazmat(aPlayer)) { aPlayer.attackEntityFrom(DMG_ELECTRIC, 20); } return aCoverVariable; } -}
\ No newline at end of file + + @Override + public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + //It updates once every 200 ticks, so once every 10 seconds + return 200; + } + + public byte getTeslaReceptionCapability() { + return 2; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java index db7c751fc6..3417d7ae20 100644 --- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_TeslaCoil_Ultimate.java @@ -7,23 +7,32 @@ public class GT_Cover_TM_TeslaCoil_Ultimate extends GT_Cover_TM_TeslaCoil { public GT_Cover_TM_TeslaCoil_Ultimate() { } + @Override public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { return true; } + @Override public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { return true; } + @Override public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { return true; } + @Override public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return true; } + @Override public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { return true; } -}
\ No newline at end of file + + public byte getTeslaReceptionCapability() { + return 1; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java b/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java index 277c2de355..cc071d2326 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java +++ b/src/main/java/com/github/technus/tectech/thing/item/AvrProgrammer.java @@ -28,7 +28,8 @@ import java.io.OutputStream; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; +import static net.minecraft.util.StatCollector.translateToLocal; @Optional.InterfaceList( {@Optional.Interface(iface="dan200.computercraft.api.media.IMedia",modid = "ComputerCraft"), @@ -111,13 +112,13 @@ public class AvrProgrammer extends Item implements IMedia { @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { - if(aStack.stackTagCompound.hasKey("avr")) { - NBTTagCompound avr=aStack.stackTagCompound.getCompoundTag("avr"); - aList.add("Current PC: " +avr.getInteger("programCounter")); - aList.add("Awoken: " +avr.getBoolean("awoken")); - aList.add("Active: " +avr.getBoolean("active")); - aList.add("Debug: " +avr.getBoolean("debugRun")); - aList.add("Delay: " +avr.getBoolean("delay")); + if (aStack.stackTagCompound.hasKey("avr")) { + NBTTagCompound avr = aStack.stackTagCompound.getCompoundTag("avr"); + aList.add(translateToLocal("item.em.programmer.desc.0") + ": " + avr.getInteger("programCounter"));//Current PC + aList.add(translateToLocal("item.em.programmer.desc.1") + ": " + avr.getBoolean("awoken"));//Awoken + aList.add(translateToLocal("item.em.programmer.desc.2") + ": " + avr.getBoolean("active"));//Active + aList.add(translateToLocal("item.em.programmer.desc.3") + ": " + avr.getBoolean("debugRun"));//Debug + aList.add(translateToLocal("item.em.programmer.desc.4") + ": " + avr.getBoolean("delay"));//Delay } } 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 deleted file mode 100644 index 57f3bbade1..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.github.technus.tectech.thing.item; - -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ElectricBlastFurnace; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.util.FakePlayer; - -import java.util.HashMap; -import java.util.List; - -import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.Util.StructureBuilder; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; -import static gregtech.api.GregTech_API.sBlockCasings1; - -/** - * Created by Tec on 15.03.2017. - */ -public final class ConstructableTriggerItem extends Item { - public static ConstructableTriggerItem INSTANCE; - - private static HashMap<String, IMultiblockInfoContainer> multiblockMap= new HashMap<>(); - - private ConstructableTriggerItem() { - setUnlocalizedName("em.constructable"); - setTextureName(MODID + ":itemConstructable"); - setCreativeTab(creativeTabTecTech); - } - - @Override - public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if(tTileEntity==null || aPlayer instanceof FakePlayer) { - return aPlayer instanceof EntityPlayerMP; - } - if (aPlayer instanceof EntityPlayerMP) { - //struct gen - if (aPlayer.isSneaking() && aPlayer.capabilities.isCreativeMode) { - if (tTileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof IConstructable) { - ((IConstructable) metaTE).construct(aStack.stackSize, false); - } else if (multiblockMap.containsKey(metaTE.getClass().getCanonicalName())) { - multiblockMap.get(metaTE.getClass().getCanonicalName()).construct(aStack.stackSize, false, tTileEntity, ((IGregTechTileEntity) tTileEntity).getFrontFacing()); - } - } else if (tTileEntity instanceof IConstructable) { - ((IConstructable) tTileEntity).construct(aStack.stackSize, false); - } else if (multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())) { - multiblockMap.get(tTileEntity.getClass().getCanonicalName()).construct(aStack.stackSize, false, tTileEntity, aSide); - } - } - return true; - }else if (TecTech.proxy.isThePlayer(aPlayer)){//particles and text client side - //if ((!aPlayer.isSneaking() || !aPlayer.capabilities.isCreativeMode)) { - if(tTileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof IConstructable) { - ((IConstructable) metaTE).construct(aStack.stackSize, true); - TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack.stackSize)); - return false; - } else if(multiblockMap.containsKey(metaTE.getClass().getCanonicalName())){ - multiblockMap.get(metaTE.getClass().getCanonicalName()).construct(aStack.stackSize,true,tTileEntity,((IGregTechTileEntity) tTileEntity).getFrontFacing()); - TecTech.proxy.printInchat(multiblockMap.get(metaTE.getClass().getCanonicalName()).getDescription(aStack.stackSize)); - return false; - } - } else if(tTileEntity instanceof IConstructable){ - ((IConstructable) tTileEntity).construct(aStack.stackSize,true); - TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack.stackSize)); - return false; - } else if(multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())){ - multiblockMap.get(tTileEntity.getClass().getCanonicalName()).construct(aStack.stackSize,true,tTileEntity, aSide); - 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_GENERAL); - aList.add("Triggers Constructable Interface"); - aList.add(EnumChatFormatting.BLUE + "Shows multiblock construction details,"); - aList.add(EnumChatFormatting.BLUE + "just Use on a multiblock controller."); - aList.add(EnumChatFormatting.BLUE + "(Sneak Use in creative to build)"); - aList.add(EnumChatFormatting.BLUE + "Quantity affects tier/mode/type"); - } - - public static void run() { - INSTANCE = new ConstructableTriggerItem(); - GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); - - registerMetaClass(GT_MetaTileEntity_ElectricBlastFurnace.class, new IMultiblockInfoContainer() { - //region Structure - private final String[][] shape = new String[][]{ - {"000","\"\"\"","\"\"\""," . ",}, - {"0!0","\"A\"","\"A\""," ",}, - {"000","\"\"\"","\"\"\""," ",}, - }; - private final Block[] blockType = new Block[]{sBlockCasings1}; - private final byte[] blockMeta = new byte[]{11}; - private final String[] desc=new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", - "1 - Classic Hatches or Heat Proof Casing", - "2 - Muffler Hatch", - "3 - Coil blocks" - }; - //endregion - - @Override - public void construct(int stackSize, boolean hintsOnly, TileEntity tileEntity, int aSide) { - StructureBuilder(shape, blockType, blockMeta, 1, 3, 0, tileEntity, aSide, hintsOnly); - } - - @Override - public String[] getDescription(int stackSize) { - return desc; - } - }); - } - - public interface IMultiblockInfoContainer { - void construct(int stackSize, boolean hintsOnly, TileEntity tileEntity, int aSide); - @SideOnly(Side.CLIENT) - String[] getDescription(int stackSize); - } - - public static void registerTileClass(Class<? extends TileEntity> clazz, IMultiblockInfoContainer info){ - multiblockMap.put(clazz.getCanonicalName(),info); - } - - public static void registerMetaClass(Class<? extends IMetaTileEntity> clazz, IMultiblockInfoContainer info){ - multiblockMap.put(clazz.getCanonicalName(),info); - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java index 4d88f321ed..b8ce40b180 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java @@ -1,14 +1,15 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.font.TecTechFontRender; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalInstanceContainer; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.IEMContainer; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -26,18 +27,18 @@ import net.minecraft.world.World; import java.util.Collections; import java.util.List; -import java.util.TreeSet; import static com.github.technus.tectech.Reference.MODID; +import static com.github.technus.tectech.TecTech.creativeTabEM; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.*; import static cpw.mods.fml.relauncher.Side.CLIENT; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 15.03.2017. */ public final class DebugElementalInstanceContainer_EM extends Item implements IElementalItem { - public static final TreeSet<iElementalDefinition> STACKS_REGISTERED =new TreeSet<>(); public static DebugElementalInstanceContainer_EM INSTANCE; @@ -45,7 +46,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE setMaxStackSize(1); setUnlocalizedName("em.debugContainer"); setTextureName(MODID + ":itemDebugContainer"); - setCreativeTab(creativeTabTecTech); + setCreativeTab(creativeTabEM); } @Override @@ -56,25 +57,25 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE aStack.stackSize = 1; if (tTileEntity instanceof IGregTechTileEntity) { IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof iElementalInstanceContainer) { - cElementalInstanceStackMap content = ((iElementalInstanceContainer) metaTE).getContainerHandler(); + if (metaTE instanceof IEMContainer) { + EMInstanceStackMap content = ((IEMContainer) metaTE).getContentHandler(); if (tNBT.hasKey("content")) { try { - content.putUnifyAll(cElementalInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); - } catch (tElementalException e) { + content.putUnifyAll(EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content"))); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } return true; } - ((iElementalInstanceContainer) metaTE).purgeOverflow(); + ((IEMContainer) metaTE).purgeOverflow(); tNBT.removeTag("content"); tNBT.removeTag("symbols"); tNBT.removeTag("info"); } else if (content.hasStacks()) { - ((iElementalInstanceContainer) metaTE).purgeOverflow(); + ((IEMContainer) metaTE).purgeOverflow(); tNBT.setTag("info", content.getInfoNBT()); - tNBT.setTag("content", content.toNBT()); + tNBT.setTag("content", content.toNBT(TecTech.definitionsRegistry)); tNBT.setTag("symbols", content.getShortSymbolsNBT()); content.clear(); } @@ -85,7 +86,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE return aPlayer instanceof EntityPlayerMP; } - public ItemStack setContent(ItemStack aStack,cElementalInstanceStackMap content){ + public ItemStack setContent(ItemStack aStack, EMInstanceStackMap content){ NBTTagCompound tNBT = aStack.getTagCompound(); if(tNBT==null){ tNBT=new NBTTagCompound(); @@ -93,8 +94,8 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE } if (tNBT.hasKey("content")) { try { - content.putUnifyAll(cElementalInstanceStackMap.fromNBT(tNBT.getCompoundTag("content"))); - } catch (tElementalException e) { + content.putUnifyAll(EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content"))); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } @@ -105,7 +106,7 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE tNBT.removeTag("symbols"); } else if (content.hasStacks()) { tNBT.setTag("info", content.getInfoNBT()); - tNBT.setTag("content", content.toNBT()); + tNBT.setTag("content", content.toNBT(TecTech.definitionsRegistry)); tNBT.setTag("symbols", content.getShortSymbolsNBT()); content.clear(); } @@ -118,14 +119,14 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE try { NBTTagCompound tNBT = aStack.getTagCompound(); if (tNBT != null && tNBT.hasKey("info")) { - aList.add("Contains:"); + aList.add(translateToLocal("item.em.debugContainer.desc.0") + ": ");//Contains Collections.addAll(aList, Util.infoFromNBT(tNBT.getCompoundTag("info"))); } else { - aList.add("Container for elemental matter"); - aList.add(EnumChatFormatting.BLUE + "Right click on elemental hatches"); + aList.add(translateToLocal("item.em.debugContainer.desc.1"));//Container for elemental matter + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.debugContainer.desc.2"));//Right click on elemental hatches } } catch (Exception e) { - aList.add("---Unexpected Termination---"); + aList.add(translateToLocal("item.em.debugContainer.desc.3"));//---Unexpected Termination--- } } @@ -139,10 +140,13 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE ItemStack that = new ItemStack(this, 1); that.setTagCompound(new NBTTagCompound()); list.add(that); - for(iElementalDefinition defintion: STACKS_REGISTERED){ - list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+1),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,1)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+144),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,144)))); - list.add(setContent(new ItemStack(this).setStackDisplayName(defintion.getName()+" x"+1000),new cElementalInstanceStackMap(new cElementalInstanceStack(defintion,1000)))); + for(IEMDefinition definition: TecTech.definitionsRegistry.getStacksRegisteredForDisplay()){ + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.mbMols")), + new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_MATERIAL_AMOUNT)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1+" "+translateToLocal("tt.keyword.itemMols")), + new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_ITEM)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getLocalizedName()+" "+1000+" "+translateToLocal("tt.keyword.mbMols")), + new EMInstanceStackMap(new EMInstanceStack(definition, EM_COUNT_PER_1k)))); } } diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java index c14e231fc9..0de8bb007a 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java @@ -1,11 +1,12 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.TecTech; import com.github.technus.tectech.font.TecTechFontRender; -import com.github.technus.tectech.Util; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.gui.FontRenderer; @@ -19,9 +20,10 @@ import java.util.Collections; import java.util.List; import static com.github.technus.tectech.Reference.MODID; +import static com.github.technus.tectech.TecTech.creativeTabEM; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; import static cpw.mods.fml.relauncher.Side.CLIENT; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 15.03.2017. @@ -33,36 +35,36 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem setMaxStackSize(1); setUnlocalizedName("em.definitionContainer"); setTextureName(MODID + ":itemDefinitionContainer"); - setCreativeTab(creativeTabTecTech); + setCreativeTab(creativeTabEM); } //return previous thing - public static cElementalDefinitionStackMap setContent(ItemStack containerItem, cElementalDefinitionStackMap definitions){ + public static EMConstantStackMap setContent(ItemStack containerItem, EMConstantStackMap definitions){ if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM) { NBTTagCompound tNBT = containerItem.stackTagCompound; if (tNBT == null) { tNBT = containerItem.stackTagCompound = new NBTTagCompound(); } - cElementalDefinitionStackMap oldMap=null; + EMConstantStackMap oldMap =null; if (tNBT.hasKey("content")) { try { - oldMap=cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); - } catch (tElementalException e) { + oldMap= EMConstantStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content")); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } } } tNBT.setTag("info", definitions.getInfoNBT()); - tNBT.setTag("content", definitions.toNBT()); + tNBT.setTag("content", definitions.toNBT(TecTech.definitionsRegistry)); tNBT.setTag("symbols",definitions.getShortSymbolsNBT()); return oldMap; } return null; } - public static cElementalDefinitionStackMap getContent(ItemStack containerItem){ + public static EMConstantStackMap getContent(ItemStack containerItem){ if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM){ NBTTagCompound tNBT = containerItem.stackTagCompound; @@ -70,8 +72,8 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem return null; } try { - return cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); - } catch (tElementalException e) { + return EMConstantStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content")); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } @@ -80,18 +82,18 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem return null; } - public static cElementalDefinitionStackMap clearContent(ItemStack containerItem){ + public static EMConstantStackMap clearContent(ItemStack containerItem){ if(containerItem.getItem() instanceof ElementalDefinitionContainer_EM){ NBTTagCompound tNBT = containerItem.stackTagCompound; if (tNBT == null) { return null; } - cElementalDefinitionStackMap oldMap=null; + EMConstantStackMap oldMap =null; if (tNBT.hasKey("content")) { try { - oldMap=cElementalDefinitionStackMap.fromNBT(tNBT.getCompoundTag("content")); - } catch (tElementalException e) { + oldMap= EMConstantStackMap.fromNBT(TecTech.definitionsRegistry,tNBT.getCompoundTag("content")); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } @@ -111,13 +113,13 @@ public final class ElementalDefinitionContainer_EM extends Item implements IElem try { NBTTagCompound tNBT = aStack.getTagCompound(); if (tNBT != null && tNBT.hasKey("info")) { - aList.add("Should Contain:"); + aList.add(translateToLocal("item.em.definitionContainer.desc.0") + ": ");//Should Contain Collections.addAll(aList, Util.infoFromNBT(tNBT.getCompoundTag("info"))); } else { - aList.add("Recipe Hint"); + aList.add(translateToLocal("item.em.definitionContainer.desc.1"));//Recipe Hint } } catch (Exception e) { - aList.add("---Unexpected Termination---"); + aList.add(translateToLocal("item.em.definitionContainer.desc.2"));//---Unexpected Termination--- } } diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java index a8f8a083a5..1cb6de1df6 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java @@ -1,13 +1,13 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.font.TecTechFontRender; -import com.github.technus.tectech.Util; import com.github.technus.tectech.loader.gui.ModGuiHandler; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.item.renderElemental.IElementalItem; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -25,8 +25,9 @@ import net.minecraft.world.World; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static cpw.mods.fml.relauncher.Side.CLIENT; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 15.03.2017. @@ -43,7 +44,7 @@ public final class ElementalDefinitionScanStorage_EM extends Item implements IEl } //return previous thing - public static void setContent(ItemStack containerItem, cElementalInstanceStackMap definitions, int[] detailsOnDepthLevels){ + public static void setContent(ItemStack containerItem, EMInstanceStackMap definitions, int[] detailsOnDepthLevels){ if(containerItem.getItem() instanceof ElementalDefinitionScanStorage_EM) { if (containerItem.stackTagCompound == null) { containerItem.stackTagCompound = new NBTTagCompound(); @@ -73,18 +74,18 @@ public final class ElementalDefinitionScanStorage_EM extends Item implements IEl 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(EnumChatFormatting.BLUE+"Contains scan result"); - aList.add("Use to read"); + if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("elementalInfo")) { + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.definitionScanStorage.desc.0"));//Contains scan result + aList.add(translateToLocal("item.em.definitionScanStorage.desc.1"));//Use to read //if(DEBUG_MODE) { // aList.add("DEBUG MODE INFO - U CHEATER"); // Collections.addAll(aList, Util.infoFromNBT(aStack.stackTagCompound.getCompoundTag("elementalInfo"))); //} } else { - aList.add("Storage for matter scan data"); + aList.add(translateToLocal("item.em.definitionScanStorage.desc.2"));//Storage for matter scan data } } catch (Exception e) { - aList.add("---Unexpected Termination---"); + aList.add(translateToLocal("item.em.definitionScanStorage.desc.3"));//---Unexpected Termination--- } } diff --git a/src/main/java/com/github/technus/tectech/thing/item/EnderFluidLinkCover.java b/src/main/java/com/github/technus/tectech/thing/item/EnderFluidLinkCover.java new file mode 100644 index 0000000000..57a882ec26 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/item/EnderFluidLinkCover.java @@ -0,0 +1,47 @@ +package com.github.technus.tectech.thing.item; + +import com.github.technus.tectech.util.CommonValues; +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.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import java.util.List; + +import static com.github.technus.tectech.Reference.MODID; +import static com.github.technus.tectech.thing.CustomItemList.enderLinkFluidCover; +import static net.minecraft.util.StatCollector.translateToLocal; + +public final class EnderFluidLinkCover extends Item { + public static EnderFluidLinkCover INSTANCE; + + private EnderFluidLinkCover() { + setHasSubtypes(true); + setUnlocalizedName("tm.enderfluidlinkcover"); + setTextureName(MODID + ":itemEnderFluidLinkCover"); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { + aList.add(CommonValues.BASS_MARK); + aList.add(translateToLocal("item.tm.enderfluidlinkcover.desc.0"));//Ender-Fluid-Enables Machines! + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.enderfluidlinkcover.desc.1"));//Use on any side of a fluid tank to link it to the Ender + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.enderfluidlinkcover.desc.2"));//Ender Tanks so are laggy -Bot from the Chads of NH + } + + public static void run() { + INSTANCE = new EnderFluidLinkCover(); + GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); + enderLinkFluidCover.set(INSTANCE); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { + itemIcon = iconRegister.registerIcon(getIconString()); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java b/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java index 4ff7c6991b..4fca682268 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java +++ b/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -16,12 +16,15 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.FakePlayer; +import org.apache.commons.lang3.reflect.FieldUtils; import java.util.ArrayList; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; +import static net.minecraft.util.StatCollector.translateToLocal; +import static net.minecraft.util.StatCollector.translateToLocalFormatted; public class EuMeterGT extends Item { public static EuMeterGT INSTANCE; @@ -40,15 +43,23 @@ public class EuMeterGT extends Item { return aPlayer instanceof EntityPlayerMP; } if (aPlayer instanceof EntityPlayerMP && !aPlayer.isSneaking() && tTileEntity instanceof IGregTechTileEntity) { + String clientLocale = "en_US"; + try { + EntityPlayerMP player = (EntityPlayerMP) aPlayer; + clientLocale = (String) FieldUtils.readField(player, "translator", true); + } catch (Exception e) { + clientLocale = "en_US"; + } + if (tTileEntity instanceof BaseMetaTileEntity) { GT_Utility.sendChatToPlayer(aPlayer, EnumChatFormatting.AQUA + "----- X:" + aX + " Y:" + aY + " Z:" + aZ + " D:" + aWorld.provider.dimensionId + " S:" + aSide + " -----"); - GT_Utility.sendChatToPlayer(aPlayer, "Stored energy: " + EnumChatFormatting.YELLOW + (((BaseMetaTileEntity) tTileEntity).getUniversalEnergyStored()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.GREEN + (((BaseMetaTileEntity) tTileEntity).getUniversalEnergyCapacity())); - GT_Utility.sendChatToPlayer(aPlayer, "Stored EU: " + EnumChatFormatting.YELLOW + (((BaseMetaTileEntity) tTileEntity).getStoredEU()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.GREEN + (((BaseMetaTileEntity) tTileEntity).getEUCapacity())); - GT_Utility.sendChatToPlayer(aPlayer, "Average I/O: " + EnumChatFormatting.YELLOW + (((BaseMetaTileEntity) tTileEntity).getAverageElectricInput()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.YELLOW + (((BaseMetaTileEntity) tTileEntity).getAverageElectricOutput())); - GT_Utility.sendChatToPlayer(aPlayer, "Voltage I/O (max): " + EnumChatFormatting.GOLD + (((BaseMetaTileEntity) tTileEntity).getInputVoltage()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.GOLD + (((BaseMetaTileEntity) tTileEntity).getOutputVoltage())); - GT_Utility.sendChatToPlayer(aPlayer, "Voltage I/O max: " + EnumChatFormatting.RED + (((BaseMetaTileEntity) tTileEntity).getMaxSafeInput()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.RED + (((BaseMetaTileEntity) tTileEntity).getMaxEnergyOutput())); - GT_Utility.sendChatToPlayer(aPlayer, "Amperage I/O (max): " + EnumChatFormatting.GOLD + (((BaseMetaTileEntity) tTileEntity).getInputAmperage()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.GOLD + (((BaseMetaTileEntity) tTileEntity).getOutputAmperage())); - GT_Utility.sendChatToPlayer(aPlayer, "Side capabilities: " + (((BaseMetaTileEntity) tTileEntity).inputEnergyFrom((byte) aSide) ? "input " : "") + (((BaseMetaTileEntity) tTileEntity).outputsEnergyTo((byte) aSide) ? "output " : "")); + GT_Utility.sendChatToPlayer(aPlayer, translateToLocalFormatted("tt.keyphrase.Stored_energy", clientLocale) + ": " + EnumChatFormatting.YELLOW + (((BaseMetaTileEntity) tTileEntity).getUniversalEnergyStored()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.GREEN + (((BaseMetaTileEntity) tTileEntity).getUniversalEnergyCapacity())); + GT_Utility.sendChatToPlayer(aPlayer, translateToLocalFormatted("tt.keyphrase.Stored_EU", clientLocale) + ": " + EnumChatFormatting.YELLOW + (((BaseMetaTileEntity) tTileEntity).getStoredEU()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.GREEN + (((BaseMetaTileEntity) tTileEntity).getEUCapacity())); + GT_Utility.sendChatToPlayer(aPlayer, translateToLocalFormatted("tt.keyphrase.Average_IO", clientLocale) + ": " + EnumChatFormatting.YELLOW + (((BaseMetaTileEntity) tTileEntity).getAverageElectricInput()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.YELLOW + (((BaseMetaTileEntity) tTileEntity).getAverageElectricOutput())); + GT_Utility.sendChatToPlayer(aPlayer, translateToLocalFormatted("tt.keyphrase.Average_IO_(max)", clientLocale) + ": " + EnumChatFormatting.GOLD + (((BaseMetaTileEntity) tTileEntity).getInputVoltage()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.GOLD + (((BaseMetaTileEntity) tTileEntity).getOutputVoltage())); + GT_Utility.sendChatToPlayer(aPlayer, translateToLocalFormatted("tt.keyphrase.Average_IO_max", clientLocale) + ": " + EnumChatFormatting.RED + (((BaseMetaTileEntity) tTileEntity).getMaxSafeInput()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.RED + (((BaseMetaTileEntity) tTileEntity).getMaxEnergyOutput())); + GT_Utility.sendChatToPlayer(aPlayer, translateToLocalFormatted("tt.keyphrase.Amperage_IO_(max)", clientLocale) + ": " + EnumChatFormatting.GOLD + (((BaseMetaTileEntity) tTileEntity).getInputAmperage()) + EnumChatFormatting.RESET + '/' + EnumChatFormatting.GOLD + (((BaseMetaTileEntity) tTileEntity).getOutputAmperage())); + GT_Utility.sendChatToPlayer(aPlayer, translateToLocalFormatted("tt.keyphrase.Side_capabilities", clientLocale) + ": " + (((BaseMetaTileEntity) tTileEntity).inputEnergyFrom((byte) aSide) ? translateToLocalFormatted("tt.keyword.input", clientLocale) + " " : "") + (((BaseMetaTileEntity) tTileEntity).outputsEnergyTo((byte) aSide) ? translateToLocalFormatted("tt.keyword.output", clientLocale) : "")); return true; } else if (tTileEntity instanceof BaseMetaPipeEntity) { if (((BaseMetaPipeEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable) { @@ -62,7 +73,7 @@ public class EuMeterGT extends Item { } } if (!(aPlayer instanceof EntityPlayerMP)) { - GT_Utility.doSoundAtClient(Reference.MODID + ":fx_scan", 1, 1.0F, (double) aX, (double) aY, (double) aZ); + GT_Utility.doSoundAtClient(Reference.MODID + ":fx_scan", 1, 1.0F, aX, aY, aZ); } return false; } @@ -70,8 +81,8 @@ public class EuMeterGT extends Item { @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { aList.add(CommonValues.TEC_MARK_GENERAL); - aList.add("Measures basic EU related stuff"); - aList.add(EnumChatFormatting.BLUE + "Just right click on blocks."); + aList.add(translateToLocal("item.em.EuMeterGT.desc.0"));//Measures basic EU related stuff + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.EuMeterGT.desc.1"));//Just right click on blocks. } public static void run() { diff --git a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java deleted file mode 100644 index 014c8b6721..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.github.technus.tectech.thing.item; - -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.thing.metaTileEntity.IFrontRotation; -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.util.FakePlayer; - -import java.util.List; - -import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; - -/** - * Created by Tec on 15.03.2017. - */ -public final class FrontRotationTriggerItem extends Item { - public static FrontRotationTriggerItem INSTANCE; - - private FrontRotationTriggerItem() { - setMaxStackSize(1); - setUnlocalizedName("em.frontRotate"); - setTextureName(MODID + ":itemFrontRotate"); - setCreativeTab(creativeTabTecTech); - } - - @Override - public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if(tTileEntity==null || aPlayer instanceof FakePlayer) { - return aPlayer instanceof EntityPlayerMP; - } - if (aPlayer instanceof EntityPlayerMP) { - if (tTileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (metaTE instanceof IFrontRotation) { - ((IFrontRotation) metaTE).rotateAroundFrontPlane(!aPlayer.isSneaking()); - return true; - } - } else if (tTileEntity instanceof IFrontRotation) { - ((IFrontRotation) tTileEntity).rotateAroundFrontPlane(!aPlayer.isSneaking()); - return true; - } - } - return false; - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { - aList.add(CommonValues.TEC_MARK_GENERAL); - aList.add("Triggers Front Rotation Interface"); - aList.add(EnumChatFormatting.BLUE + "Rotates only the front panel,"); - aList.add(EnumChatFormatting.BLUE + "which allows structure rotation."); - } - - public static void run() { - INSTANCE = new FrontRotationTriggerItem(); - GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); - } -} 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 92215af921..7f9e0f0a4a 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java @@ -1,7 +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.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_ParamText; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -25,8 +25,9 @@ import net.minecraft.world.World; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; import static com.github.technus.tectech.thing.CustomItemList.parametrizerMemory; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 15.03.2017. @@ -131,14 +132,14 @@ public final class ParametrizerMemoryCard extends Item { public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { NBTTagCompound tNBT = aStack.getTagCompound(); aList.add(CommonValues.BASS_MARK); - aList.add("Stores Parameters"); + aList.add(translateToLocal("item.em.parametrizerMemoryCard.desc.0"));//Stores Parameters if (aStack.getItemDamage() == 1) { - aList.add(EnumChatFormatting.BLUE + "Use on Parametrizer/Controller to configure it"); + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.parametrizerMemoryCard.desc.1"));//Use on Parametrizer/Controller to configure it } else { - aList.add(EnumChatFormatting.BLUE + "Use on Parametrizer to store parameters"); + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.parametrizerMemoryCard.desc.2"));//Use on Parametrizer to store parameters } - aList.add(EnumChatFormatting.BLUE + "Sneak right click to lock/unlock"); + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.em.parametrizerMemoryCard.desc.3"));//Sneak right click to lock/unlock double temp; if(tNBT!=null && tNBT.hasKey("param")) { diff --git a/src/main/java/com/github/technus/tectech/thing/item/PowerPassUpgradeCover.java b/src/main/java/com/github/technus/tectech/thing/item/PowerPassUpgradeCover.java new file mode 100644 index 0000000000..06c05e5b9d --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/item/PowerPassUpgradeCover.java @@ -0,0 +1,47 @@ +package com.github.technus.tectech.thing.item; + +import com.github.technus.tectech.util.CommonValues; +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.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import java.util.List; + +import static com.github.technus.tectech.Reference.MODID; +import static com.github.technus.tectech.thing.CustomItemList.powerPassUpgradeCover; +import static net.minecraft.util.StatCollector.translateToLocal; + +public final class PowerPassUpgradeCover extends Item { + public static PowerPassUpgradeCover INSTANCE; + + private PowerPassUpgradeCover() { + setHasSubtypes(true); + setUnlocalizedName("tm.powerpassupgradecover"); + setTextureName(MODID + ":itemPowerPassUpgradeCover"); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { + aList.add(CommonValues.BASS_MARK); + aList.add(translateToLocal("item.tm.powerpassupgradecover.desc.0"));//Add power pass functionality to TecTech Multiblocks + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.powerpassupgradecover.desc.1"));//Active transformer in a can?? + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.powerpassupgradecover.desc.2"));//Chain them up like Christmas lights! + } + + public static void run() { + INSTANCE = new PowerPassUpgradeCover(); + GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); + powerPassUpgradeCover.set(INSTANCE); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { + itemIcon = iconRegister.registerIcon(getIconString()); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java index 557b356d52..86982e7c09 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java +++ b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -14,14 +14,15 @@ import net.minecraft.util.IIcon; import java.util.List; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.thing.CustomItemList.teslaCapacitor; +import static net.minecraft.util.StatCollector.translateToLocal; public final class TeslaCoilCapacitor extends Item { public static TeslaCoilCapacitor INSTANCE; - private static IIcon LVicon, MVicon, HVicon, EVicon, IVicon; + private static IIcon LVicon, MVicon, HVicon, EVicon, IVicon, LuVicon, ZPMicon; private TeslaCoilCapacitor() { setHasSubtypes(true); @@ -32,13 +33,13 @@ public final class TeslaCoilCapacitor extends Item { @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { aList.add(CommonValues.BASS_MARK); - if (aStack.getItemDamage() >= 0 && aStack.getItemDamage() <= 4) { - aList.add("Stores " + V[aStack.getItemDamage() + 1] * 512 + " EU in a tesla tower at " + V[aStack.getItemDamage() + 1] + " EU/t"); + if (aStack.getItemDamage() >= 0 && aStack.getItemDamage() <= 6) { + aList.add(translateToLocal("item.tm.teslaCoilCapacitor.desc.0") + " " + V[aStack.getItemDamage() + 1] * 512 + " " + translateToLocal("item.tm.teslaCoilCapacitor.desc.1") + " " + V[aStack.getItemDamage() + 1] + " EU/t");//Stores 16384 EU in a tesla tower at 32 EU/t } else { - aList.add("Yeet this broken item into some spicy water!"); + aList.add(translateToLocal("item.tm.teslaCoilCapacitor.desc.2"));//Yeet this broken item into some spicy water! } - aList.add(EnumChatFormatting.BLUE + "Insert into a Capacitor hatch of a Tesla Tower"); - aList.add(EnumChatFormatting.BLUE + "Capacitors are the same thing as batteries, right?"); + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.teslaCoilCapacitor.desc.3"));//Insert into a Capacitor hatch of a Tesla Tower + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.teslaCoilCapacitor.desc.4"));//Capacitors are the same thing as batteries, right? } @Override @@ -60,6 +61,8 @@ public final class TeslaCoilCapacitor extends Item { HVicon = iconRegister.registerIcon(MODID + ":itemCapacitorHV"); EVicon = iconRegister.registerIcon(MODID + ":itemCapacitorEV"); IVicon = iconRegister.registerIcon(MODID + ":itemCapacitorIV"); + LuVicon = iconRegister.registerIcon(MODID + ":itemCapacitorLuV"); + ZPMicon = iconRegister.registerIcon(MODID + ":itemCapacitorZPM"); } @Override @@ -73,6 +76,10 @@ public final class TeslaCoilCapacitor extends Item { return EVicon; case 4: return IVicon; + case 5: + return LuVicon; + case 6: + return ZPMicon; default: return LVicon; } @@ -80,7 +87,7 @@ public final class TeslaCoilCapacitor extends Item { @Override public void getSubItems(Item aItem, CreativeTabs par2CreativeTabs, List aList) { - for (int i = 0; i <= 4; i++) { + for (int i = 0; i <= 6; i++) { aList.add(new ItemStack(aItem, 1, i)); } } diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilComponent.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilComponent.java index cfd6b3b653..cc77b7a26c 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilComponent.java +++ b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilComponent.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -16,6 +16,7 @@ import java.util.List; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.thing.CustomItemList.teslaComponent; +import static net.minecraft.util.StatCollector.translateToLocal; public final class TeslaCoilComponent extends Item { @@ -31,7 +32,7 @@ public final class TeslaCoilComponent extends Item { @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { aList.add(CommonValues.BASS_MARK); - aList.add(EnumChatFormatting.BLUE + "Tesla bois need these!"); + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.itemTeslaComponent.desc"));//Tesla bois need these! } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java index 2a1fff39a3..20417ebe71 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java +++ b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -16,6 +16,7 @@ import java.util.List; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.thing.CustomItemList.teslaCover; +import static net.minecraft.util.StatCollector.translateToLocal; public final class TeslaCoilCover extends Item { @@ -33,17 +34,17 @@ public final class TeslaCoilCover extends Item { aList.add(CommonValues.BASS_MARK); switch (aStack.getItemDamage()) { case 0: - aList.add("Tesla-Enables Machines!"); + aList.add(translateToLocal("item.tm.teslaCover.desc.0"));//Tesla-Enables Machines! break; case 1: - aList.add("Tesla-Enables Machines! (BUT LOUDER!!)"); + aList.add(translateToLocal("item.tm.teslaCover.desc.1"));//Tesla-Enables Machines! (BUT LOUDER!!) break; default: - aList.add("Yeet this broken item into some spicy water!"); + aList.add(translateToLocal("item.tm.teslaCover.desc.2"));//Yeet this broken item into some spicy water! break; } - aList.add(EnumChatFormatting.BLUE + "Use on top of a machine to enable Tesla capabilities"); - aList.add(EnumChatFormatting.BLUE + "Who the hell uses cables anyway?"); + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.teslaCover.desc.3"));//Use on top of a machine to enable Tesla capabilities + aList.add(EnumChatFormatting.BLUE + translateToLocal("item.tm.teslaCover.desc.4"));//Who the hell uses cables anyway? } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaStaff.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaStaff.java index 0102d367c3..9d998953e8 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/TeslaStaff.java +++ b/src/main/java/com/github/technus/tectech/thing/item/TeslaStaff.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_Utility; @@ -14,6 +14,7 @@ import java.util.List; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.thing.CustomItemList.teslaStaff; +import static net.minecraft.util.StatCollector.translateToLocal; public final class TeslaStaff extends Item { @@ -27,7 +28,7 @@ public final class TeslaStaff extends Item { @Override public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { aList.add(CommonValues.BASS_MARK); - aList.add("Power of the gods, at the whim of a mortal!"); + aList.add(translateToLocal("item.tm.teslaStaff.desc")); } @Override @@ -47,4 +48,4 @@ public final class TeslaStaff extends Item { GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); teslaStaff.set(INSTANCE); } -}
\ No newline at end of file +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/IConstructable.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/IConstructable.java deleted file mode 100644 index 096eab8f58..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/IConstructable.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -/** - * Created by Tec on 24.03.2017. - */ -public interface IConstructable { - void construct(int stackSize, boolean hintsOnly); - - @SideOnly(Side.CLIENT) - String[] getStructureDescription(int stackSize); -} - diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/IFrontRotation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/IFrontRotation.java deleted file mode 100644 index 7ac296e41f..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/IFrontRotation.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity; - -public interface IFrontRotation { - boolean isFrontRotationValid(byte frontRotation, byte frontFacing); - - void rotateAroundFrontPlane(boolean direction); - - void forceSetRotationDoRender(byte frontRotation); - - byte getFrontRotation(); -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/RotationMessage.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/RotationMessage.java deleted file mode 100644 index 92b38e68ea..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/RotationMessage.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity; - -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import cpw.mods.fml.common.network.ByteBufUtils; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import eu.usrv.yamcore.network.client.AbstractClientMessageHandler; -import eu.usrv.yamcore.network.server.AbstractServerMessageHandler; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import io.netty.buffer.ByteBuf; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.DimensionManager; - -public class RotationMessage implements IMessage { - int mPosX; - int mPosY; - int mPosZ; - int mPosD; - int mRotF; - - public RotationMessage() { - } - - private RotationMessage(GT_MetaTileEntity_MultiblockBase_EM metaTile) { - IGregTechTileEntity base=metaTile.getBaseMetaTileEntity(); - mPosX=base.getXCoord(); - mPosY=base.getYCoord(); - mPosZ=base.getZCoord(); - mPosD=base.getWorld().provider.dimensionId; - mRotF=metaTile.getFrontRotation(); - } - - private RotationMessage(World world, int x,int y,int z, IFrontRotation front) { - mPosX=x; - mPosY=y; - mPosZ=z; - mPosD=world.provider.dimensionId; - mRotF=front.getFrontRotation(); - } - - @Override - public void fromBytes(ByteBuf pBuffer) { - NBTTagCompound tTag = ByteBufUtils.readTag(pBuffer); - mPosX = tTag.getInteger("posx"); - mPosY = tTag.getInteger("posy"); - mPosZ = tTag.getInteger("posz"); - mPosD = tTag.getInteger("posd"); - mRotF = tTag.getInteger("rotf"); - } - - @Override - public void toBytes(ByteBuf pBuffer) { - NBTTagCompound tFXTag = new NBTTagCompound(); - tFXTag.setInteger("posx", mPosX); - tFXTag.setInteger("posy", mPosY); - tFXTag.setInteger("posz", mPosZ); - tFXTag.setInteger("posd", mPosD); - tFXTag.setInteger("rotf", mRotF); - - ByteBufUtils.writeTag(pBuffer, tFXTag); - } - - public static class RotationQuery extends RotationMessage{ - public RotationQuery() { - } - - public RotationQuery(GT_MetaTileEntity_MultiblockBase_EM metaTile) { - super(metaTile); - } - - public RotationQuery(World world, int x,int y,int z, IFrontRotation front) { - super(world,x,y,z,front); - } - } - - public static class RotationData extends RotationMessage{ - public RotationData() { - } - - private RotationData(RotationQuery query){ - mPosX=query.mPosX; - mPosY=query.mPosY; - mPosZ=query.mPosZ; - mPosD=query.mPosD; - mRotF=query.mRotF; - } - - public RotationData(GT_MetaTileEntity_MultiblockBase_EM metaTile) { - super(metaTile); - } - - public RotationData(World world, int x,int y,int z, IFrontRotation front) { - super(world,x,y,z,front); - } - } - - public static class ClientHandler extends AbstractClientMessageHandler<RotationData> { - @Override - public IMessage handleClientMessage(EntityPlayer pPlayer, RotationData pMessage, MessageContext pCtx) { - if(pPlayer.worldObj.provider.dimensionId==pMessage.mPosD){ - TileEntity te=pPlayer.worldObj.getTileEntity(pMessage.mPosX,pMessage.mPosY,pMessage.mPosZ); - if(te instanceof IGregTechTileEntity){ - IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); - if(meta instanceof IFrontRotation){ - ((IFrontRotation) meta).forceSetRotationDoRender((byte)pMessage.mRotF); - } - }else if (te instanceof IFrontRotation){ - ((IFrontRotation) te).forceSetRotationDoRender((byte)pMessage.mRotF); - } - } - return null; - } - } - - public static class ServerHandler extends AbstractServerMessageHandler<RotationQuery> { - @Override - public IMessage handleServerMessage(EntityPlayer pPlayer, RotationQuery pMessage, MessageContext pCtx) { - World world= DimensionManager.getWorld(pMessage.mPosD); - if(world!=null) { - TileEntity te = world.getTileEntity(pMessage.mPosX, pMessage.mPosY, pMessage.mPosZ); - if (te instanceof IGregTechTileEntity) { - IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); - if (meta instanceof IFrontRotation) { - pMessage.mRotF=((IFrontRotation) meta).getFrontRotation(); - return new RotationData(pMessage); - } - } else if (te instanceof IFrontRotation) { - pMessage.mRotF=((IFrontRotation) te).getFrontRotation(); - return new RotationData(pMessage); - } - } - return null; - } - } -}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java index 69ff06e9e7..bc853334d2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java @@ -193,7 +193,7 @@ public class Textures { public static ITexture TESLA_TRANSCEIVER_TOP_BA = new GT_RenderedTexture(TESLA_TRANSCEIVER_TOP); - public Textures(){ + public static void run(){ for (byte i = 0; i < MACHINE_CASINGS_TT.length; i++) { for (byte j = 0; j < MACHINE_CASINGS_TT[i].length; j++) { MACHINE_CASINGS_TT[i][j] = new GT_SidedTexture(MACHINECASINGS_BOTTOM_TT[i], MACHINECASINGS_TOP_TT[i], MACHINECASINGS_SIDE_TT[i], Dyes.getModulation(j - 1, MACHINE_METAL.mRGBa)); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java index 44612f0c9b..4e07622c25 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Capacitor; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Capacitor; import cpw.mods.fml.relauncher.Side; @@ -23,9 +23,10 @@ import net.minecraft.util.EnumChatFormatting; import java.util.HashMap; import java.util.Map; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.getUniqueIdentifier; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.Util.getUniqueIdentifier; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 03.04.2017. @@ -35,9 +36,9 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { private static Textures.BlockIcons.CustomIcon TM_H_ACTIVE; private static Map<String, GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent> componentBinds = new HashMap<>(); - public GT_MetaTileEntity_Hatch_Capacitor(int aID, String aName, String aNameRegional, int aTier, String descr) { - super(aID, aName, aNameRegional, aTier, 16, descr); - Util.setTier(aTier,this); + public GT_MetaTileEntity_Hatch_Capacitor(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 16, ""); + Util.setTier(aTier, this); } public GT_MetaTileEntity_Hatch_Capacitor(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -109,7 +110,7 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_Capacitor(aPlayerInventory, aBaseMetaTileEntity, "Capacitor Hatch"); + return new GT_GUIContainer_Capacitor(aPlayerInventory, aBaseMetaTileEntity, translateToLocal("gt.blockmachines.hatch.capacitor.tier.03.name"));//Capacitor Hatch } @Override @@ -130,8 +131,8 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { public String[] getDescription() { return new String[]{ CommonValues.BASS_MARK, - mDescription, - EnumChatFormatting.AQUA + "Stores 'nergy! (for a while)" + translateToLocal("gt.blockmachines.hatch.capacitor.desc.0"),//For Tesla Tower + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.hatch.capacitor.desc.1")//Stores 'nergy! (for a while) }; } @@ -172,11 +173,13 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { } public static void run() { - new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":item.tm.teslaCoilCapacitor.0", 0, 1, V[1]*512);//LV Capacitor - new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":item.tm.teslaCoilCapacitor.1", 1, 1, V[2]*512);//MV Capacitor - new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":item.tm.teslaCoilCapacitor.2", 2, 1, V[3]*512);//HV Capacitor - new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":item.tm.teslaCoilCapacitor.3", 3, 1, V[4]*512);//EV Capacitor - new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":item.tm.teslaCoilCapacitor.4", 4, 1, V[5]*512);//IV Capacitor + new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.0", 0, 1, V[1] * 512);//LV Capacitor + new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.1", 1, 1, V[2] * 512);//MV Capacitor + new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.2", 2, 1, V[3] * 512);//HV Capacitor + new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.3", 3, 1, V[4] * 512);//EV Capacitor + new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.4", 4, 1, V[5] * 512);//IV Capacitor + new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.5", 5, 1, V[6] * 512);//LuV Capacitor + new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID + ":item.tm.teslaCoilCapacitor.6", 6, 1, V[7] * 512);//ZPM Capacitor } public static class CapacitorComponent implements Comparable<GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent> { @@ -205,12 +208,10 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { @Override public boolean equals(Object obj) { - if(obj instanceof CapacitorComponent) { + if (obj instanceof CapacitorComponent) { return compareTo((CapacitorComponent) obj) == 0; } return false; } } } - - diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeData.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeData.java index d12b0d42d8..815f8006c4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeData.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeData.java @@ -1,24 +1,27 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; -import com.github.technus.tectech.thing.metaTileEntity.pipe.IConnectsToDataPipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GT_Utility; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.CommonValues.MOVE_AT; +import static com.github.technus.tectech.util.CommonValues.MOVE_AT; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 27.10.2016. */ public class GT_MetaTileEntity_Hatch_CreativeData extends GT_MetaTileEntity_Hatch_DataConnector<QuantumDataPacket> { public GT_MetaTileEntity_Hatch_CreativeData(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Quantum Data Output"); + super(aID, aName, aNameRegional, aTier, ""); Util.setTier(aTier,this); } @@ -114,4 +117,15 @@ public class GT_MetaTileEntity_Hatch_CreativeData extends GT_MetaTileEntity_Hatc } } } + + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + translateToLocal("gt.blockmachines.debug.tt.data.desc.0"),//Quantum Data Output + translateToLocal("gt.blockmachines.debug.tt.data.desc.1"),//High speed fibre optics connector. + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.debug.tt.data.desc.2")//Must be painted to work + }; + } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeMaintenance.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeMaintenance.java index fe963c4d51..42817f473e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeMaintenance.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeMaintenance.java @@ -1,16 +1,25 @@ 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.util.CommonValues; +import com.github.technus.tectech.util.Util; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import static net.minecraft.util.StatCollector.translateToLocal; + public class GT_MetaTileEntity_Hatch_CreativeMaintenance extends GT_MetaTileEntity_Hatch_Maintenance { + private static Textures.BlockIcons.CustomIcon face; + public GT_MetaTileEntity_Hatch_CreativeMaintenance(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier); Util.setTier(aTier,this); @@ -24,13 +33,30 @@ public class GT_MetaTileEntity_Hatch_CreativeMaintenance extends GT_MetaTileEnti public String[] getDescription() { return new String[]{ CommonValues.BASS_MARK, - mDescription, - "Does fix everything but itself.", - EnumChatFormatting.AQUA + "Fixing is for plebs!" + translateToLocal("gt.blockmachines.debug.tt.maintenance.desc.0"),//For automatically maintaining Multiblocks + translateToLocal("gt.blockmachines.debug.tt.maintenance.desc.1"),//Does fix everything but itself. + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.debug.tt.maintenance.desc.2")//Fixing is for plebs! }; } @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + super.registerIcons(aBlockIconRegister); + face = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_FULLAUTOMAINTENANCE"); + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(face)}; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(face)}; + } + + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Hatch_CreativeMaintenance(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); } 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 cb88d9861d..4aa90339cc 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 @@ -1,9 +1,9 @@ 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.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.dataTransport.DataPacket; -import com.github.technus.tectech.thing.metaTileEntity.pipe.IConnectsToDataPipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Dyes; @@ -14,13 +14,16 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; +import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.CommonValues.MOVE_AT; +import static com.github.technus.tectech.util.CommonValues.MOVE_AT; import static gregtech.api.enums.Dyes.MACHINE_METAL; +import static net.minecraft.util.StatCollector.translateToLocalFormatted; /** * Created by danie_000 on 11.12.2016. @@ -30,6 +33,8 @@ public abstract class GT_MetaTileEntity_Hatch_DataConnector<T extends DataPacket public static Textures.BlockIcons.CustomIcon EM_D_ACTIVE; public static Textures.BlockIcons.CustomIcon EM_D_CONN; + private String clientLocale = "en_US"; + public T q; public short id = -1; @@ -100,6 +105,15 @@ public abstract class GT_MetaTileEntity_Hatch_DataConnector<T extends DataPacket @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + try { + EntityPlayerMP player = (EntityPlayerMP) aPlayer; + clientLocale = (String) FieldUtils.readField(player, "translator", true); + } catch (Exception e) { + clientLocale = "en_US"; + } return true; } @@ -146,11 +160,14 @@ public abstract class GT_MetaTileEntity_Hatch_DataConnector<T extends DataPacket @Override public String[] getInfoData() { if (id > 0) { - return new String[]{"ID: " + EnumChatFormatting.AQUA + id, "Content: " + EnumChatFormatting.AQUA + (q != null ? q.getContentString() : 0), "PacketHistory: " + EnumChatFormatting.RED + (q != null ? q.getTraceSize() : 0),}; + return new String[]{ + translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " + EnumChatFormatting.AQUA + id, + translateToLocalFormatted("tt.keyword.Content", clientLocale) + ": " + EnumChatFormatting.AQUA + (q != null ? q.getContentString() : 0), + translateToLocalFormatted("tt.keyword.PacketHistory", clientLocale) + ": " + EnumChatFormatting.RED + (q != null ? q.getTraceSize() : 0),}; } return new String[]{ - "Content: " + EnumChatFormatting.AQUA + (q != null ? q.getContentString() : 0), - "PacketHistory: " + EnumChatFormatting.RED + (q != null ? q.getTraceSize() : 0), + translateToLocalFormatted("tt.keyword.Content", clientLocale) + ": " + EnumChatFormatting.AQUA + (q != null ? q.getContentString() : 0), + translateToLocalFormatted("tt.keyword.PacketHistory", clientLocale) + ": " + EnumChatFormatting.RED + (q != null ? q.getTraceSize() : 0), }; } @@ -158,7 +175,7 @@ public abstract class GT_MetaTileEntity_Hatch_DataConnector<T extends DataPacket public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - mDescription, + "Text description shouldn't be seen, report to Tec", "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 aeaa54d241..bbc11f10fe 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 @@ -1,7 +1,7 @@ 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.util.CommonValues; +import com.github.technus.tectech.util.Util; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -9,7 +9,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_IN_POWER_TT; import static net.minecraft.util.StatCollector.translateToLocal; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java index 60a663e0c7..b015d71b60 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_DynamoTunnel.java @@ -1,9 +1,9 @@ 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.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Energy; -import com.github.technus.tectech.thing.metaTileEntity.pipe.IConnectsToEnergyTunnel; +import com.github.technus.tectech.mechanics.pipe.IConnectsToEnergyTunnel; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -13,8 +13,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.CommonValues.TRANSFER_AT; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.TRANSFER_AT; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_OUT_LASER_TT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -78,12 +78,17 @@ public class GT_MetaTileEntity_Hatch_DynamoTunnel extends GT_MetaTileEntity_Hatc @Override public long maxEUStore() { - return 512L + V[mTier] * 4L * Amperes; + return V[mTier] * 24L * Amperes; } @Override - public long maxAmperesOut() { - return 0; + public boolean isEnetOutput() { + return false; + } + + @Override + public boolean isEnetInput() { + return false; } @Override @@ -106,7 +111,8 @@ public class GT_MetaTileEntity_Hatch_DynamoTunnel extends GT_MetaTileEntity_Hatc return new String[]{ CommonValues.TEC_MARK_GENERAL, mDescription,//TODO NOT PASS DESCRIPTION - translateToLocal("gt.blockmachines.hatch.dynamotunnel.desc.1") + ": " + EnumChatFormatting.YELLOW + (Amperes * maxEUOutput()) + EnumChatFormatting.RESET + " EU/t"//Throughput + translateToLocal("gt.blockmachines.hatch.dynamotunnel.desc.1") + ": " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(Amperes * maxEUOutput()) + EnumChatFormatting.RESET + " EU/t"//Throughput }; } @@ -148,13 +154,12 @@ public class GT_MetaTileEntity_Hatch_DynamoTunnel extends GT_MetaTileEntity_Hatc return; } else if (maxEUOutput() == ((GT_MetaTileEntity_Hatch_EnergyTunnel) aMetaTileEntity).maxEUInput()) { long diff = Math.min( - Amperes * 20, + Amperes * 20L * maxEUOutput(), Math.min( ((GT_MetaTileEntity_Hatch_EnergyTunnel) aMetaTileEntity).maxEUStore() - aMetaTileEntity.getBaseMetaTileEntity().getStoredEU(), - maxEUStore() - aBaseMetaTileEntity.getStoredEU() - ) / maxEUOutput() - ) * maxEUOutput(); + aBaseMetaTileEntity.getStoredEU() + )); setEUVar(aBaseMetaTileEntity.getStoredEU() - diff); 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 1498dafecc..6cb83f5d46 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalInstanceContainer; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.thing.metaTileEntity.pipe.IConnectsToElementalPipe; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.IEMContainer; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.pipe.IConnectsToElementalPipe; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Dyes; @@ -23,8 +23,9 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.CommonValues.*; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; +import static com.github.technus.tectech.util.CommonValues.*; import static gregtech.api.enums.Dyes.MACHINE_METAL; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; import static net.minecraft.util.StatCollector.translateToLocal; @@ -33,17 +34,17 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; /** * Created by danie_000 on 11.12.2016. */ -public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch implements iElementalInstanceContainer, IConnectsToElementalPipe { +public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_MetaTileEntity_Hatch implements IEMContainer, IConnectsToElementalPipe { private static Textures.BlockIcons.CustomIcon EM_T_SIDES; private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; private static Textures.BlockIcons.CustomIcon EM_T_CONN; private String clientLocale = "en_US"; - protected cElementalInstanceStackMap content = new cElementalInstanceStackMap(); + protected EMInstanceStackMap content = new EMInstanceStackMap(); //float lifeTimeMult=1f; - public int postEnergize = 0; - public float overflowMatter = 0f; + public int postEnergize = 0; + public double overflowMatter = 0f; public short id = -1; private byte deathDelay = 2; @@ -80,8 +81,9 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta super.saveNBTData(aNBT); aNBT.setInteger("postEnergize", postEnergize); //aNBT.setFloat("lifeTimeMult",lifeTimeMult); - aNBT.setFloat("overflowMatter", overflowMatter); - aNBT.setTag("eM_Stacks", content.toNBT()); + aNBT.setDouble("OverflowMatter", overflowMatter); + content.cleanUp(); + aNBT.setTag("eM_Stacks", content.toNBT(TecTech.definitionsRegistry)); aNBT.setShort("eID", id); } @@ -90,16 +92,16 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta super.loadNBTData(aNBT); postEnergize = aNBT.getInteger("postEnergize"); //lifeTimeMult=aNBT.getFloat("lifeTimeMult"); - overflowMatter = aNBT.getFloat("overflowMatter"); + overflowMatter = aNBT.getFloat("overflowMatter")+aNBT.getDouble("OverflowMatter"); id = aNBT.getShort("eID"); try { - content = cElementalInstanceStackMap.fromNBT(aNBT.getCompoundTag("eM_Stacks")); - } catch (tElementalException e) { + content = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,aNBT.getCompoundTag("eM_Stacks")); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } if (content == null) { - content = new cElementalInstanceStackMap(); + content = new EMInstanceStackMap(); } } } @@ -110,7 +112,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta byte Tick = (byte) (aTick % 20); if (DECAY_AT == Tick) { purgeOverflow(); - content.tickContentByOneSecond(1, postEnergize);//Hatches don't life time mult things + content.tickContent(1, postEnergize,1);//Hatches don't life time mult things purgeOverflow(); } else if (OVERFLOW_AT == Tick) { if (overflowMatter <= 0) { @@ -151,6 +153,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } } else if (MOVE_AT == Tick) { if (content.hasStacks()) { + content.cleanUp(); moveAround(aBaseMetaTileEntity); } getBaseMetaTileEntity().setActive(content.hasStacks()); @@ -162,7 +165,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } @Override - public cElementalInstanceStackMap getContainerHandler() { + public EMInstanceStackMap getContentHandler() { return content; } @@ -203,11 +206,11 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } public int getMaxStacksCount() { - return mTier * 2; + return mTier * mTier >> 4; } - public int getMaxStackSize() { - return mTier * (mTier - 7) * 1000; + public double getMaxStackSize() { + return mTier * (mTier - 7) * 64D * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; } @Override @@ -229,7 +232,6 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } else { return true; } - System.out.println(clientLocale); return true; } @@ -240,7 +242,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta @Override public String[] getInfoData() { - if (TecTech.configTecTech.EASY_SCAN) { + if (TecTech.configTecTech.EASY_SCAN || DEBUG_MODE) { if (id > 0) { if (content == null || content.size() == 0) { return new String[]{translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " + EnumChatFormatting.AQUA + id, translateToLocalFormatted("tt.keyphrase.No_Stacks", clientLocale)}; 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 9a16aa1339..0acb9849a7 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 @@ -1,16 +1,17 @@ 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.util.CommonValues; +import com.github.technus.tectech.util.Util; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_IN_POWER_TT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -116,7 +117,8 @@ public class GT_MetaTileEntity_Hatch_EnergyMulti extends GT_MetaTileEntity_Hatch return new String[]{ CommonValues.TEC_MARK_GENERAL, mDescription, - translateToLocal("gt.blockmachines.hatch.energymulti.desc.1") + ": " + EnumChatFormatting.AQUA + maxAmperesIn() + " A"//Amperes In + translateToLocal("gt.blockmachines.hatch.energymulti.desc.1") + ": " + + EnumChatFormatting.AQUA + GT_Utility.formatNumbers(maxAmperesIn()) + " A"//Amperes In }; } }
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java index 6034e51a98..d44119e1ab 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_EnergyTunnel.java @@ -1,18 +1,18 @@ 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.pipe.IConnectsToEnergyTunnel; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.mechanics.pipe.IConnectsToEnergyTunnel; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.CommonValues.TRANSFER_AT; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.TRANSFER_AT; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_IN_LASER_TT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -40,16 +40,6 @@ public class GT_MetaTileEntity_Hatch_EnergyTunnel extends GT_MetaTileEntity_Hatc } @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - } - - @Override public boolean isSimpleMachine() { return true; } @@ -86,12 +76,17 @@ public class GT_MetaTileEntity_Hatch_EnergyTunnel extends GT_MetaTileEntity_Hatc @Override public long maxEUStore() { - return 512L + V[mTier] * 4L * Amperes; + return V[mTier] * 24L * Amperes; } @Override - public long maxAmperesIn() { - return 0; + public boolean isEnetOutput() { + return false; + } + + @Override + public boolean isEnetInput() { + return false; } @Override @@ -114,7 +109,8 @@ public class GT_MetaTileEntity_Hatch_EnergyTunnel extends GT_MetaTileEntity_Hatc return new String[]{ CommonValues.TEC_MARK_GENERAL, mDescription, - translateToLocal("gt.blockmachines.hatch.energytunnel.desc.1") + ": " + EnumChatFormatting.YELLOW + (Amperes * maxEUInput()) + EnumChatFormatting.RESET + " EU/t"//Throughput + translateToLocal("gt.blockmachines.hatch.energytunnel.desc.1") + ": " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(Amperes * maxEUInput()) + EnumChatFormatting.RESET + " EU/t"//Throughput }; } 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 409f8195e2..3bbd6b9d54 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 @@ -1,7 +1,7 @@ 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.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Holder; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Holder; import cpw.mods.fml.relauncher.Side; @@ -18,6 +18,8 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import static net.minecraft.util.StatCollector.translateToLocal; + /** * Created by Tec on 03.04.2017. */ @@ -25,8 +27,8 @@ public class GT_MetaTileEntity_Hatch_Holder extends GT_MetaTileEntity_Hatch { private static Textures.BlockIcons.CustomIcon EM_H; private static Textures.BlockIcons.CustomIcon EM_H_ACTIVE; - public GT_MetaTileEntity_Hatch_Holder(int aID, String aName, String aNameRegional, int aTier, String descr) { - super(aID, aName, aNameRegional, aTier, 1, descr); + public GT_MetaTileEntity_Hatch_Holder(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 1, ""); Util.setTier(aTier,this); } @@ -94,7 +96,7 @@ public class GT_MetaTileEntity_Hatch_Holder extends GT_MetaTileEntity_Hatch { @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_Holder(aPlayerInventory, aBaseMetaTileEntity, "Holder Hatch"); + return new GT_GUIContainer_Holder(aPlayerInventory, aBaseMetaTileEntity, translateToLocal("gt.blockmachines.hatch.holder.tier.09.name"));//Object Holder } @Override @@ -120,10 +122,8 @@ public class GT_MetaTileEntity_Hatch_Holder extends GT_MetaTileEntity_Hatch { public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - mDescription, - EnumChatFormatting.AQUA + "Advanced Holding Mechanism!" + translateToLocal("gt.blockmachines.hatch.holder.desc.0"),//For Research Station + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.hatch.holder.desc.1")//Advanced Holding Mechanism! }; } } - - diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputData.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputData.java index 8ea024d6dd..386a08b790 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputData.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputData.java @@ -1,12 +1,16 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; -import com.github.technus.tectech.thing.metaTileEntity.pipe.IConnectsToDataPipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 27.10.2016. @@ -15,7 +19,7 @@ public class GT_MetaTileEntity_Hatch_InputData extends GT_MetaTileEntity_Hatch_D private boolean delDelay = true; public GT_MetaTileEntity_Hatch_InputData(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Quantum Data Input for Multiblocks"); + super(aID, aName, aNameRegional, aTier, ""); Util.setTier(aTier,this); } @@ -77,6 +81,16 @@ public class GT_MetaTileEntity_Hatch_InputData extends GT_MetaTileEntity_Hatch_D } @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + translateToLocal("gt.blockmachines.hatch.datain.desc.0"),//Quantum Data Input for Multiblocks + translateToLocal("gt.blockmachines.hatch.datain.desc.1"),//High speed fibre optics connector. + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.hatch.datain.desc.2")//Must be painted to work + }; + } + + @Override public void moveAround(IGregTechTileEntity aBaseMetaTileEntity) { if (delDelay) { delDelay = false; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputDataItems.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputDataItems.java index df7f5e07d6..f270971f4d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputDataItems.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputDataItems.java @@ -1,9 +1,9 @@ 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.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; -import com.github.technus.tectech.thing.metaTileEntity.pipe.IConnectsToDataPipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; import gregtech.api.enums.Dyes; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -11,32 +11,35 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess; import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import org.apache.commons.lang3.reflect.FieldUtils; import java.util.ArrayList; -import static com.github.technus.tectech.CommonValues.MOVE_AT; +import static com.github.technus.tectech.util.CommonValues.MOVE_AT; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DataConnector.*; import static gregtech.api.enums.Dyes.MACHINE_METAL; +import static net.minecraft.util.StatCollector.translateToLocal; +import static net.minecraft.util.StatCollector.translateToLocalFormatted; public class GT_MetaTileEntity_Hatch_InputDataItems extends GT_MetaTileEntity_Hatch_DataAccess implements IConnectsToDataPipe { - private final String mDescription; public boolean delDelay = true; private ItemStack[] stacks; + private String clientLocale = "en_US"; + public GT_MetaTileEntity_Hatch_InputDataItems(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier); Util.setTier(aTier,this); - mDescription="ItemStack Data Input for Multiblocks"; } public GT_MetaTileEntity_Hatch_InputDataItems(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); - mDescription=aDescription; } @Override @@ -68,10 +71,15 @@ public class GT_MetaTileEntity_Hatch_InputDataItems extends GT_MetaTileEntity_Ha public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()) { return true; - } else { - aBaseMetaTileEntity.openGUI(aPlayer); - return true; } + try { + EntityPlayerMP player = (EntityPlayerMP) aPlayer; + clientLocale = (String) FieldUtils.readField(player, "translator", true); + } catch (Exception e) { + clientLocale = "en_US"; + } + aBaseMetaTileEntity.openGUI(aPlayer); + return true; } @Override @@ -158,7 +166,7 @@ public class GT_MetaTileEntity_Hatch_InputDataItems extends GT_MetaTileEntity_Ha @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - NBTTagCompound stacksTag=new NBTTagCompound(); + NBTTagCompound stacksTag= aNBT.getCompoundTag("data_stacks"); int count=stacksTag.getInteger("count"); if(count>0){ ArrayList<ItemStack> stacks=new ArrayList<>(); @@ -205,9 +213,9 @@ public class GT_MetaTileEntity_Hatch_InputDataItems extends GT_MetaTileEntity_Ha public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - mDescription, - "High speed fibre optics connector.", - EnumChatFormatting.AQUA + "Must be painted to work" + translateToLocal("gt.blockmachines.hatch.datainass.desc.0"),//ItemStack Data Input for Multiblocks + translateToLocal("gt.blockmachines.hatch.datainass.desc.1"),//High speed fibre optics connector. + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.hatch.datainass.desc.2")//Must be painted to work }; } @@ -219,7 +227,7 @@ public class GT_MetaTileEntity_Hatch_InputDataItems extends GT_MetaTileEntity_Ha @Override public String[] getInfoData() { return new String[]{ - "Content: Stack Count: "+(stacks==null?0:stacks.length) + translateToLocalFormatted("tt.keyphrase.Content_Stack_Count", clientLocale) + ": "+(stacks==null?0:stacks.length) }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java index cfa15b4cf3..b0f71aab24 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_InputElemental.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputData.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputData.java index 7c9f8fba5c..87a9c93785 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputData.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputData.java @@ -1,22 +1,26 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; -import com.github.technus.tectech.thing.metaTileEntity.pipe.IConnectsToDataPipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GT_Utility; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 27.10.2016. */ public class GT_MetaTileEntity_Hatch_OutputData extends GT_MetaTileEntity_Hatch_DataConnector<QuantumDataPacket> { public GT_MetaTileEntity_Hatch_OutputData(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Quantum Data Output for Multiblocks"); + super(aID, aName, aNameRegional, aTier, ""); Util.setTier(aTier,this); } @@ -75,6 +79,16 @@ public class GT_MetaTileEntity_Hatch_OutputData extends GT_MetaTileEntity_Hatch_ } @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + translateToLocal("gt.blockmachines.hatch.dataout.desc.0"),//Quantum Data Output for Multiblocks + translateToLocal("gt.blockmachines.hatch.dataout.desc.1"),//High speed fibre optics connector. + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.hatch.dataout.desc.2")//Must be painted to work + }; + } + + @Override public IConnectsToDataPipe getNext(IConnectsToDataPipe source/*==this*/) { IGregTechTileEntity base = getBaseMetaTileEntity(); byte color = base.getColorization(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputDataItems.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputDataItems.java index 472f998d89..385de4343c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputDataItems.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputDataItems.java @@ -1,9 +1,10 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; -import com.github.technus.tectech.thing.metaTileEntity.pipe.IConnectsToDataPipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -13,10 +14,13 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + +import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_Hatch_OutputDataItems extends GT_MetaTileEntity_Hatch_DataConnector<InventoryDataPacket> { public GT_MetaTileEntity_Hatch_OutputDataItems(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "ItemStack Data Output for Multiblocks"); + super(aID, aName, aNameRegional, aTier, ""); Util.setTier(aTier,this); } @@ -44,6 +48,7 @@ public class GT_MetaTileEntity_Hatch_OutputDataItems extends GT_MetaTileEntity_H if (aBaseMetaTileEntity.isClientSide()) { return true; } else { + super.onRightclick(aBaseMetaTileEntity, aPlayer); aBaseMetaTileEntity.openGUI(aPlayer); return true; } @@ -136,4 +141,14 @@ public class GT_MetaTileEntity_Hatch_OutputDataItems extends GT_MetaTileEntity_H } return null; } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + translateToLocal("gt.blockmachines.hatch.dataoutass.desc.0"),//ItemStack Data Output for Multiblocks + translateToLocal("gt.blockmachines.hatch.dataoutass.desc.1"),//High speed fibre optics connector. + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.hatch.dataoutass.desc.2")//Must be painted to work + }; + } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java index d826daf355..1426e8a702 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OutputElemental.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -62,7 +62,7 @@ public class GT_MetaTileEntity_Hatch_OutputElemental extends GT_MetaTileEntity_H if (aMetaTileEntity != null) { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputElemental && opposite == tGTTileEntity.getFrontFacing()) { - ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).getContainerHandler().putUnifyAll(content); + ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).getContentHandler().putUnifyAll(content); ((GT_MetaTileEntity_Hatch_InputElemental) aMetaTileEntity).updateSlots(); content.clear(); return; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java index 8000298443..2a04af23d1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java @@ -1,8 +1,8 @@ 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.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Dyes; @@ -12,6 +12,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Utility; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -28,9 +29,9 @@ import org.apache.commons.lang3.reflect.FieldUtils; import java.util.Locale; -import static com.github.technus.tectech.CommonValues.DISPERSE_AT; -import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.loader.MainLoader.elementalPollution; +import static com.github.technus.tectech.util.CommonValues.DISPERSE_AT; +import static com.github.technus.tectech.util.CommonValues.V; import static gregtech.api.enums.Dyes.MACHINE_METAL; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; import static net.minecraft.util.StatCollector.translateToLocal; @@ -44,13 +45,13 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE; public static Textures.BlockIcons.CustomIcon MufflerEM; public static Textures.BlockIcons.CustomIcon MufflerEMidle; - private float overflowMatter; - public final float overflowMax; - private final float overflowDisperse; + private double overflowMatter; + public final double overflowMax; + private final double overflowDisperse; private String clientLocale = "en_US"; - public GT_MetaTileEntity_Hatch_OverflowElemental(int aID, String aName, String aNameRegional, int aTier, float max) { + public GT_MetaTileEntity_Hatch_OverflowElemental(int aID, String aName, String aNameRegional, int aTier, double max) { super(aID, aName, aNameRegional, aTier, 0, translateToLocal("gt.blockmachines.hatch.emmuffler.desc.0"));//Disposes excess elemental Matter overflowMatter = max / 2; overflowMax = max; @@ -58,7 +59,7 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity Util.setTier(aTier, this); } - public GT_MetaTileEntity_Hatch_OverflowElemental(String aName, int aTier, float max, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_OverflowElemental(String aName, int aTier, double max, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, 0, aDescription, aTextures); overflowMatter = max / 2; overflowMax = max; @@ -90,8 +91,8 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity return new String[]{ CommonValues.TEC_MARK_EM, mDescription, - translateToLocal("gt.blockmachines.hatch.emmuffler.desc.1") + ": " + EnumChatFormatting.AQUA + String.format(Locale.ENGLISH, "%+.2E", overflowMax) + " eV/c\u00b2", - translateToLocal("gt.blockmachines.hatch.emmuffler.desc.2") + ": " + EnumChatFormatting.AQUA + String.format(Locale.ENGLISH, "%+.2E", overflowDisperse) + " (eV/c\u00b2)/s", + translateToLocal("gt.blockmachines.hatch.emmuffler.desc.1") + ": " + EnumChatFormatting.AQUA + GT_Utility.formatNumbers(overflowMax) + " eV/c\u00b2", + translateToLocal("gt.blockmachines.hatch.emmuffler.desc.2") + ": " + EnumChatFormatting.AQUA + GT_Utility.formatNumbers(overflowDisperse) + " (eV/c\u00b2)/s", translateToLocal("gt.blockmachines.hatch.emmuffler.desc.3") }; } @@ -124,13 +125,13 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - aNBT.setFloat("overflowMatter", overflowMatter); + aNBT.setDouble("OverflowMatter", overflowMatter); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - overflowMatter = aNBT.getFloat("overflowMatter"); + overflowMatter = aNBT.getFloat("overflowMatter")+aNBT.getDouble("OverflowMatter"); } @Override @@ -148,10 +149,10 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity if (aBaseMetaTileEntity.isServerSide() && aTick % 20 == DISPERSE_AT) { if (aBaseMetaTileEntity.isActive()) { if (overflowMatter > overflowDisperse) { - TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowDisperse); + TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowDisperse/(Math.pow(2,mTier))); overflowMatter -= overflowDisperse; } else { - TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowMatter); + TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity, overflowMatter/(Math.pow(2,mTier))); overflowMatter = 0; aBaseMetaTileEntity.setActive(false); aBaseMetaTileEntity.setLightValue((byte) 0); @@ -204,7 +205,6 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity } else { return true; } - System.out.println(clientLocale); return true; } @@ -217,16 +217,17 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity public String[] getInfoData() { return new String[]{ translateToLocalFormatted("tt.keyphrase.Contained_mass", clientLocale) + ":", - EnumChatFormatting.RED + Double.toString(overflowMatter) + EnumChatFormatting.RESET + " eV/c\u00b2 /", - EnumChatFormatting.GREEN + Double.toString(overflowMax) + EnumChatFormatting.RESET + " eV/c\u00b2", - translateToLocalFormatted("tt.keyphrase.Mass_Disposal_speed", clientLocale) + ": " + EnumChatFormatting.BLUE + overflowDisperse + EnumChatFormatting.RESET + " (eV/c\u00b2)/s" + EnumChatFormatting.RED + GT_Utility.formatNumbers(overflowMatter) + EnumChatFormatting.RESET + " eV/c\u00b2 /", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(overflowMax) + EnumChatFormatting.RESET + " eV/c\u00b2", + translateToLocalFormatted("tt.keyphrase.Mass_Disposal_speed", clientLocale) + ": " + + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(overflowDisperse) + EnumChatFormatting.RESET + " (eV/c\u00b2)/s" }; } @Override public void onRemoval() { if (isValidMetaTileEntity(this) && getBaseMetaTileEntity().isActive()) { - TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(), overflowMatter * 8D); + TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(), overflowMatter); if (TecTech.configTecTech.BOOM_ENABLE) { getBaseMetaTileEntity().doExplosion(V[15]); } else { @@ -236,17 +237,17 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity } //Return - Should Explode - public boolean addOverflowMatter(float matter) { + public boolean addOverflowMatter(double matter) { overflowMatter += matter; return overflowMatter > overflowMax; } - public float getOverflowMatter() { + public double getOverflowMatter() { return overflowMatter; } //Return - Should Explode - public boolean setOverflowMatter(float overflowMatter) { + public boolean setOverflowMatter(double overflowMatter) { this.overflowMatter = overflowMatter; return overflowMatter > overflowMax; } 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 e1c99e4080..7b8a488e57 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.*; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.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; @@ -13,11 +16,16 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; +import org.apache.commons.lang3.reflect.FieldUtils; + +import static net.minecraft.util.StatCollector.translateToLocal; +import static net.minecraft.util.StatCollector.translateToLocalFormatted; /** * Created by danie_000 on 15.12.2016. @@ -32,8 +40,10 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { private static Textures.BlockIcons.CustomIcon ScreenON; private static Textures.BlockIcons.CustomIcon ScreenOFF; + private String clientLocale = "en_US"; + public GT_MetaTileEntity_Hatch_Param(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "For parametrization of Multiblocks"); + super(aID, aName, aNameRegional, aTier, 0, ""); Util.setTier(aTier,this); } @@ -51,7 +61,7 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - if (mTier > 5) { + if (mTier > 5) {//TODO update mTier to 4 after recipe check return new GT_Container_ParamAdv(aPlayerInventory, aBaseMetaTileEntity); } return new GT_Container_Param(aPlayerInventory, aBaseMetaTileEntity); @@ -59,7 +69,7 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - if (mTier > 5) { + if (mTier > 5) {//TODO update mTier to 4 after recipe check return new GT_GUIContainer_ParamAdv(aPlayerInventory, aBaseMetaTileEntity); } return new GT_GUIContainer_Param(aPlayerInventory, aBaseMetaTileEntity); @@ -102,11 +112,11 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { @Override public String[] getInfoData() { return new String[]{ - "Parametrizer ID: " + EnumChatFormatting.GREEN + param, - "Value 0D: " + EnumChatFormatting.AQUA + value0D, - "Value 1D: " + EnumChatFormatting.BLUE + value1D, - "Input 0D: " + EnumChatFormatting.GOLD + input0D, - "Input 1D: " + EnumChatFormatting.YELLOW + input1D, + translateToLocalFormatted("tt.keyword.Parametrizer", clientLocale)+ " " + translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " + EnumChatFormatting.GREEN + param, + translateToLocalFormatted("tt.keyword.Value", clientLocale) + " 0D: " + EnumChatFormatting.AQUA + value0D, + translateToLocalFormatted("tt.keyword.Value", clientLocale) + " 1D: " + EnumChatFormatting.BLUE + value1D, + translateToLocalFormatted("tt.keyword.Input", clientLocale) + " 0D: " + EnumChatFormatting.GOLD + input0D, + translateToLocalFormatted("tt.keyword.Input", clientLocale) + " 1D: " + EnumChatFormatting.YELLOW + input1D, }; } @@ -196,6 +206,12 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { if (aBaseMetaTileEntity.isClientSide()) { return true; } + try { + EntityPlayerMP player = (EntityPlayerMP) aPlayer; + clientLocale = (String) FieldUtils.readField(player, "translator", true); + } catch (Exception e) { + clientLocale = "en_US"; + } aBaseMetaTileEntity.openGUI(aPlayer); return true; } @@ -204,8 +220,8 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_GENERAL, - mDescription, - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "E=mine*craft\u00b2" + translateToLocal("gt.blockmachines.hatch.param.desc.0"),//For parametrization of Multiblocks + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.hatch.param.desc.1") +"\u00b2"//E=mine*craft }; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java index c9c84cfbc0..bc4562307b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_ParamText; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_ParamText; @@ -14,6 +14,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; +import org.apache.commons.lang3.reflect.FieldUtils; + +import static net.minecraft.util.StatCollector.translateToLocal; +import static net.minecraft.util.StatCollector.translateToLocalFormatted; /** * Created by danie_000 on 15.12.2016. @@ -22,6 +26,8 @@ public class GT_MetaTileEntity_Hatch_ParamText extends GT_MetaTileEntity_Hatch_P public String value0s=""; public String value1s=""; + private String clientLocale = "en_US"; + public GT_MetaTileEntity_Hatch_ParamText(int aID, String aName, String aNameRegional, int aTier) { super(aID,aName,aNameRegional,aTier); } @@ -70,13 +76,13 @@ public class GT_MetaTileEntity_Hatch_ParamText extends GT_MetaTileEntity_Hatch_P @Override public String[] getInfoData() { return new String[]{ - "Parametrizer ID: " + EnumChatFormatting.GREEN + param, - "Value 0S: " + EnumChatFormatting.DARK_AQUA + value0s, - "Value 1S: " + EnumChatFormatting.DARK_BLUE + value1s, - "Value 0D: " + EnumChatFormatting.AQUA + value0D, - "Value 1D: " + EnumChatFormatting.BLUE + value1D, - "Input 0D: " + EnumChatFormatting.GOLD + input0D, - "Input 1D: " + EnumChatFormatting.YELLOW + input1D, + translateToLocalFormatted("tt.keyword.Parametrizer", clientLocale)+ " " + translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " + EnumChatFormatting.GREEN + param, + translateToLocalFormatted("tt.keyword.Value", clientLocale) + " 0S: " + EnumChatFormatting.DARK_AQUA + value0s, + translateToLocalFormatted("tt.keyword.Value", clientLocale) + " 1S: " + EnumChatFormatting.DARK_BLUE + value1s, + translateToLocalFormatted("tt.keyword.Value", clientLocale) + " 0D: " + EnumChatFormatting.AQUA + value0D, + translateToLocalFormatted("tt.keyword.Value", clientLocale) + " 1D: " + EnumChatFormatting.BLUE + value1D, + translateToLocalFormatted("tt.keyword.Input", clientLocale) + " 0D: " + EnumChatFormatting.GOLD + input0D, + translateToLocalFormatted("tt.keyword.Input", clientLocale) + " 1D: " + EnumChatFormatting.YELLOW + input1D, }; } @@ -146,6 +152,12 @@ public class GT_MetaTileEntity_Hatch_ParamText extends GT_MetaTileEntity_Hatch_P if (aBaseMetaTileEntity.isClientSide()) { return true; } + try { + EntityPlayerMP player = (EntityPlayerMP) aPlayer; + clientLocale = (String) FieldUtils.readField(player, "translator", true); + } catch (Exception e) { + clientLocale = "en_US"; + } aBaseMetaTileEntity.openGUI(aPlayer); return true; } @@ -154,8 +166,8 @@ public class GT_MetaTileEntity_Hatch_ParamText extends GT_MetaTileEntity_Hatch_P public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_GENERAL, - mDescription, - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "E=mine*craft\u00b2" + translateToLocal("gt.blockmachines.hatch.param.desc.0"),//For parametrization of Multiblocks + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.hatch.param.desc.1") +"\u00b2"//E=mine*craft }; } } 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 db5920184e..53fea9ef7c 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 @@ -1,9 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Rack; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Rack; import cpw.mods.fml.common.Loader; @@ -18,17 +18,21 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import org.apache.commons.lang3.reflect.FieldUtils; import java.util.HashMap; import java.util.Map; -import static com.github.technus.tectech.CommonValues.MULTI_CHECK_AT; -import static com.github.technus.tectech.Util.getUniqueIdentifier; +import static com.github.technus.tectech.util.CommonValues.MULTI_CHECK_AT; +import static com.github.technus.tectech.util.Util.getUniqueIdentifier; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static net.minecraft.util.StatCollector.translateToLocal; +import static net.minecraft.util.StatCollector.translateToLocalFormatted; /** * Created by Tec on 03.04.2017. @@ -40,8 +44,10 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { private float overClock = 1, overVolt = 1; private static Map<String, RackComponent> componentBinds = new HashMap<>(); - public GT_MetaTileEntity_Hatch_Rack(int aID, String aName, String aNameRegional, int aTier, String descr) { - super(aID, aName, aNameRegional, aTier, 4, descr); + private String clientLocale = "en_US"; + + public GT_MetaTileEntity_Hatch_Rack(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 4, ""); Util.setTier(aTier,this); } @@ -131,7 +137,7 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_Rack(aPlayerInventory, aBaseMetaTileEntity, "Computer Rack"); + return new GT_GUIContainer_Rack(aPlayerInventory, aBaseMetaTileEntity, translateToLocal("gt.blockmachines.hatch.rack.tier.08.name"));//Computer Rack } @Override @@ -139,6 +145,12 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { if (aBaseMetaTileEntity.isClientSide()) { return true; } + try { + EntityPlayerMP player = (EntityPlayerMP) aPlayer; + clientLocale = (String) FieldUtils.readField(player, "translator", true); + } catch (Exception e) { + clientLocale = "en_US"; + } //if(aBaseMetaTileEntity.isActive()) // aPlayer.addChatComponentMessage(new ChatComponentText("It is still active...")); //else if(heat>0) @@ -249,8 +261,8 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - mDescription, - EnumChatFormatting.AQUA + "Holds Computer Components" + translateToLocal("gt.blockmachines.hatch.rack.desc.0"),//4 Slot Rack + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.hatch.rack.desc.1")//Holds Computer Components }; } @@ -262,9 +274,10 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { @Override public String[] getInfoData() { return new String[]{ - "Base computation: " + EnumChatFormatting.AQUA + getComputationPower(1, 0, false), - "After overclocking: " + EnumChatFormatting.AQUA + getComputationPower(overClock, 0, false), - "Heat Accumulated: " + EnumChatFormatting.RED + (heat + 99) / 100 + EnumChatFormatting.RESET + " %"}; + translateToLocalFormatted("tt.keyphrase.Base_computation", clientLocale) + ": " + EnumChatFormatting.AQUA + getComputationPower(1, 0, false), + translateToLocalFormatted("tt.keyphrase.After_overclocking", clientLocale) + ": " + EnumChatFormatting.AQUA + getComputationPower(overClock, 0, false), + translateToLocalFormatted("tt.keyphrase.Heat_Accumulated", clientLocale) + ": " + EnumChatFormatting.RED + (heat + 99) / 100 + EnumChatFormatting.RESET + " %" + }; //heat==0? --> ((heat+9)/10) = 0 //Heat==1-10? --> 1 } @@ -329,28 +342,28 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { } if (Loader.isModLoaded("OpenComputers")) { - new RackComponent("OpenComputers:item.23", 0, 1, 0f, 100, true);//Transistor - new RackComponent("OpenComputers:item.24", 7, 12, -.05f, 1500, true);//chip t1 - new RackComponent("OpenComputers:item.25", 18, 20, -.1f, 3000, true);//chip t2 - new RackComponent("OpenComputers:item.26", 25, 22, -.15f, 4500, true);//chip t3 - new RackComponent("OpenComputers:item.27", 10, 15, -.05f, 3000, true);//alu - new RackComponent("OpenComputers:item.28", 25, 18, -.05f, 1500, true);//cu - - new RackComponent("OpenComputers:item.70", 42, 30, -.05f, 1500, true);//bus t1 - new RackComponent("OpenComputers:item.71", 70, 50, -.1f, 3000, true);//bus t2 - new RackComponent("OpenComputers:item.72", 105, 72, -.15f, 4500, true);//bus t3 - - new RackComponent("OpenComputers:item.29", 106, 73, -.1f, 1500, true);//cpu t1 - new RackComponent("OpenComputers:item.42", 226, 153, -.15f, 3000, true);//cpu t2 - new RackComponent("OpenComputers:item.43", 374, 241, -.2f, 4500, true);//cpu t3 - - new RackComponent("OpenComputers:item.8", 20, 27, -.1f, 1500, true);//gpu t1 - new RackComponent("OpenComputers:item.9", 62, 67, -.2f, 3000, true);//gpu t2 - new RackComponent("OpenComputers:item.10", 130, 111, -.3f, 4500, true);//gpu t3 - - new RackComponent("OpenComputers:item.101", 350, 234, -.1f, 1500, true);//apu t1 - new RackComponent("OpenComputers:item.102", 606, 398, -.2f, 4500, true);//apu t2 - new RackComponent("OpenComputers:item.103", 1590, 1006, -.3f, 9000, true);//apu tC + new RackComponent("OpenComputers:item.oc.Transistor", 0, 1, 0f, 100, true);//Transistor + new RackComponent("OpenComputers:item.oc.Microchip0", 7, 12, -.05f, 1500, true);//chip t1 + new RackComponent("OpenComputers:item.oc.Microchip1", 18, 20, -.1f, 3000, true);//chip t2 + new RackComponent("OpenComputers:item.oc.Microchip2", 25, 22, -.15f, 4500, true);//chip t3 + new RackComponent("OpenComputers:item.oc.ALU", 10, 15, -.05f, 3000, true);//alu + new RackComponent("OpenComputers:item.oc.ControlUnit", 25, 18, -.05f, 1500, true);//cu + + new RackComponent("OpenComputers:item.oc.ComponentBus0", 42, 30, -.05f, 1500, true);//bus t1 + new RackComponent("OpenComputers:item.oc.ComponentBus1", 70, 50, -.1f, 3000, true);//bus t2 + new RackComponent("OpenComputers:item.oc.ComponentBus2", 105, 72, -.15f, 4500, true);//bus t3 + + new RackComponent("OpenComputers:item.oc.CPU0", 106, 73, -.1f, 1500, true);//cpu t1 + new RackComponent("OpenComputers:item.oc.CPU1", 226, 153, -.15f, 3000, true);//cpu t2 + new RackComponent("OpenComputers:item.oc.CPU2", 374, 241, -.2f, 4500, true);//cpu t3 + + new RackComponent("OpenComputers:item.oc.GraphicsCard0", 20, 27, -.1f, 1500, true);//gpu t1 + new RackComponent("OpenComputers:item.oc.GraphicsCard1", 62, 67, -.2f, 3000, true);//gpu t2 + new RackComponent("OpenComputers:item.oc.GraphicsCard2", 130, 111, -.3f, 4500, true);//gpu t3 + + new RackComponent("OpenComputers:item.oc.APU0", 350, 234, -.1f, 1500, true);//apu t2 + new RackComponent("OpenComputers:item.oc.APU1", 606, 398, -.2f, 4500, true);//apu t3 + new RackComponent("OpenComputers:item.oc.APU2", 1590, 1006, -.3f, 9000, true);//apu tC } } 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 361b9c678f..d723dd908c 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 @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Uncertainty; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Uncertainty; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_UncertaintyAdv; @@ -16,11 +16,16 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; +import org.apache.commons.lang3.reflect.FieldUtils; + +import static net.minecraft.util.StatCollector.translateToLocal; +import static net.minecraft.util.StatCollector.translateToLocalFormatted; /** * Created by danie_000 on 15.12.2016. @@ -31,8 +36,10 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch public short[] matrix = new short[]{500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500}; public byte selection = -1, mode = 0, status = -128;//all 8 bits set + private String clientLocale = "en_US"; + public GT_MetaTileEntity_Hatch_Uncertainty(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Feeling certain, or not?"); + super(aID, aName, aNameRegional, aTier, 0, ""); Util.setTier(aTier,this); regenerate(); } @@ -100,7 +107,7 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch @Override public String[] getInfoData() { return new String[]{ - "Status: " + EnumChatFormatting.GOLD + status + translateToLocalFormatted("tt.keyword.Status", clientLocale) + ": " + EnumChatFormatting.GOLD + status }; } @@ -174,6 +181,12 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch if (aBaseMetaTileEntity.isClientSide()) { return true; } + try { + EntityPlayerMP player = (EntityPlayerMP) aPlayer; + clientLocale = (String) FieldUtils.readField(player, "translator", true); + } catch (Exception e) { + clientLocale = "en_US"; + } aBaseMetaTileEntity.openGUI(aPlayer); return true; } @@ -182,8 +195,8 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - mDescription, - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Schrödinger equation in a box" + translateToLocal("gt.blockmachines.hatch.certain.desc.0"),//Feeling certain, or not? + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.hatch.certain.desc.1")//Schrödinger equation in a box }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/TextParametersMessage.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/TextParametersMessage.java index d206143700..b0b53f6c79 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/TextParametersMessage.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/TextParametersMessage.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_ParamText; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; 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 cb189538d8..da067078c9 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 @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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 index b3b720732d..c8fa85996a 100644 --- 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 @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamText.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamText.java index 7b6f97981f..9c0e08948f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamText.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamText.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_ParamText; import com.github.technus.tectech.thing.metaTileEntity.hatch.TextParametersMessage; 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 52f0832cb2..7eb71651bb 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,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; -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; 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 index ca92f0496e..4346118619 100644 --- 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 @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; -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; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamText.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamText.java index 2b17563db0..50e608294e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamText.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamText.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.font.TecTechFontRender; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_ParamText; 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 21e020be01..8a51494b94 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 @@ -1,26 +1,27 @@ 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 com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -28,37 +29,42 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region variables - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private static Textures.BlockIcons.CustomIcon ScreenON; - //endregion - - //region structure - private static final String[][] shape = new String[][]{ - {"\u0002", "D000", "C0 0", "C0 . 0", "C0 0", "D000"}, - {"C01A10", "C01A10", "D1A1", "00B101B00", "11111111111", "C01110", "11111111111", "00B101B00", "D1A1", "C01A10", "C01A10",}, - {"C01A10", "A223222322", "A244242442", "03442424430", "12225252221", "A244222442", "12225252221", "03442424430", "A244242442", "A223222322", "C01A10",}, - {"D111", "A244222442", "A4G4", "A4G4", "12G21", "12G21", "12G21", "A4G4", "A4G4", "A244222442", "D111",}, - {"A0C0C0", "03444244430", "A4G4", "A4G4", "A4G4", "02G20", "A4G4", "A4G4", "A4G4", "03444244430", "A0C0C0",}, - {"00C!C00", "02444544420", "A4G4", "A4G4", "A4G4", "!5G5!", "A4G4", "A4G4", "A4G4", "02444544420", "00C!C00",}, - {"A0C0C0", "03444244430", "A4G4", "A4G4", "A4G4", "02G20", "A4G4", "A4G4", "A4G4", "03444244430", "A0C0C0",}, - {"D111", "A244222442", "A4G4", "A4G4", "12G21", "12G21", "12G21", "A4G4", "A4G4", "A244222442", "D111",}, - {"C01A10", "A223222322", "A244242442", "03442424430", "12225252221", "A244222442", "12225252221", "03442424430", "A244242442", "A223222322", "C01A10",}, - {"C01A10", "C01A10", "D1A1", "00B101B00", "11111111111", "C01110", "11111111111", "00B101B00", "D1A1", "C01A10", "C01A10",}, - {"\u0002", "D000", "C0 0", "C0 0", "C0 0", "D000"}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 5, 12, 6, 0, 10}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; - private static final String[] description = new String[]{ + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.annihilation.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.annihilation.hint.1"),//2 - Elemental Hatches or Molecular Casing }; //endregion + //region structure + private static final IStructureDefinition<GT_MetaTileEntity_EM_annihilation> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_annihilation>builder() + .addShape("main", transpose(new String[][]{ + {" ", " AB BA ", " AB BA ", " BBB ", " A A A ", "AA F AA", " A A A ", " BBB ", " AB BA ", " AB BA ", " "}, + {" ", " AB BA ", " EECEEECEE ", " EGGEEEGGE ", "ACGGGEGGGCA", "AEGGGDGGGEA", "ACGGGEGGGCA", " EGGEEEGGE ", " EECEEECEE ", " AB BA ", " "}, + {" ", " B B ", " EGGEGEGGE ", " G G ", " G G ", " G G ", " G G ", " G G ", " EGGEGEGGE ", " B B ", " "}, + {" AAA ", "AA BAB AA", "ACGGEGEGGCA", " G G ", " G G ", " G G ", " G G ", " G G ", "ACGGEGEGGCA", "AA BAB AA", " AAA "}, + {" AHHHA ", "BBBBBBBBBBB", "BEEEDEDEEEB", "BE EB", " G G ", " G G ", " G G ", "BE EB", "BEEEDEDEEEB", "BBBBBBBBBBB", " AHHHA "}, + {" AH~HA ", " ABBBA ", " EGGEEEGGE ", "BE EB", "AE EA", "FD DF", "AE EA", "BE EB", " EGGEEEGGE ", " ABBBA ", " AHHHA "}, + {" AHHHA ", "BBBBBBBBBBB", "BEEEDEDEEEB", "BE EB", " G G ", " G G ", " G G ", "BE EB", "BEEEDEDEEEB", "BBBBBBBBBBB", " AHHHA "}, + {" AAA ", "AA BAB AA", "ACGGEGEGGCA", " G G ", " G G ", " G G ", " G G ", " G G ", "ACGGEGEGGCA", "AA BAB AA", " AAA "}, + {" ", " B B ", " EGGEGEGGE ", " G G ", " G G ", " G G ", " G G ", " G G ", " EGGEGEGGE ", " B B ", " "}, + {" ", " AB BA ", " EECEEECEE ", " EGGEEEGGE ", "ACGGGEGGGCA", "AEGGGDGGGEA", "ACGGGEGGGCA", " EGGEEEGGE ", " EECEEECEE ", " AB BA ", " "}, + {" ", " AB BA ", " AB BA ", " BBB ", " A A A ", "AA F AA", " A A A ", " BBB ", " AB BA ", " AB BA ", " "} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofBlock(sBlockCasingsTT, 6)) + .addElement('D', ofBlock(sBlockCasingsTT, 10)) + .addElement('E', ofBlock(sBlockCasingsTT, 12)) + .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_annihilation::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_annihilation::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .build(); + //endregion + public GT_MetaTileEntity_EM_annihilation(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -74,7 +80,7 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 5, 5, 0); + return structureCheck_EM("main", 5, 5, 0); } @Override @@ -97,18 +103,23 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 5, 5, 0, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 5, 5, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_annihilation> getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} 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 79ae424bcb..3d6bb58cb0 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 @@ -1,29 +1,29 @@ 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 com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_decay.URANIUM_INGOT_MASS_DIFF; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_decay.URANIUM_MASS_TO_EU_INSTANT; -import static gregtech.api.enums.GT_Values.E; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -34,10 +34,11 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - private static final double NEUTRONIUM_BLOCK_MASS = 4.1E17; - private static final double NEUTRONIUM_BLOCK_ATOM_COUNT = 2.4478671E44; + //todo CHECK VALUES + private static final double NEUTRONIUM_BLOCK_MASS = 4.1E17; + private static final double NEUTRONIUM_BLOCK_ATOM_COUNT = 2.4478671E44; private static final double NEUTRONIUM_BLOCK_TO_EU_INSTANT = URANIUM_MASS_TO_EU_INSTANT * NEUTRONIUM_BLOCK_MASS / (URANIUM_INGOT_MASS_DIFF * 1.78266191e-36);//~ 5.314e40 - private static final double NEUTRON_TO_EU_INSTANT = NEUTRONIUM_BLOCK_TO_EU_INSTANT / NEUTRONIUM_BLOCK_ATOM_COUNT;//~ 0.00021708694 + private static final double NEUTRON_TO_EU_INSTANT = NEUTRONIUM_BLOCK_TO_EU_INSTANT / NEUTRONIUM_BLOCK_ATOM_COUNT;//~ 0.00021708694 public boolean glassDome = false; //endregion @@ -47,47 +48,93 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E //per dim disable thingies //region structure actual - private static final String[][] shape = new String[][]{ - {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, - {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, - {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, - {"\u0005", "O0A0", "O0A0", "P1", "P1", "\u0004", "F00Q00", "H11M11", "F00Q00", "\u0004", "P1", "P1", "O0A0", "O0A0",}, - {"\u0004", "O0A0", "N00000", "P1", "P4", "P4", "\u0003", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "\u0003", "P4", "P4", "P1", "N00000", "O0A0",}, - {"\u0003", "O0A0", "O0A0", "P1", "M2224222", "\u0004", "G2Q2", "G2Q2", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "G2Q2", "G2Q2", "\u0004", "M2224222", "P1", "O0A0", "O0A0",}, - {"\u0002", "O0A0", "N00000", "P1", "P4", "\u0006", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "\u0006", "P4", "P1", "N00000", "O0A0",}, - {"\u0001", "O0A0", "O0A0", "P1", "M2224222", "\u0006", "E2U2", "E2U2", "B00A2U2A00", "D14U41", "B00A2U2A00", "E2U2", "E2U2", "\u0006", "M2224222", "P1", "O0A0", "O0A0",}, - {"\u0001", "O0A0", "P1", "P4", "\u0009", "B0[0", "C14W41", "B0[0", "\u0009", "P4", "P1", "O0A0",}, - {E, "O0A0", "O0A0", "P1", "P4", "\u0009", "A00[00", "C14W41", "A00[00", "\u0009", "P4", "P1", "O0A0", "O0A0",}, - {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, - {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, - {"O0A0", "O0A0", "M1111111", "\u0009", "B1[1", "B1[1", "001[100", "B1[1", "001[100", "B1[1", "B1[1", "\u0009", "M1111111", "O0A0", "O0A0",}, - {"O0A0", "N11111", "L11E11", "\u0001", "G2Q2", E, "E2U2", "\u0003", "B1[1", "B1[1", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "B1[1", "B1[1", "\u0003", "E2U2", E, "G2Q2", "\u0001", "L11E11", "N11111", "O0A0",}, - {"O0A0", "M1101011", "L1B222B1", E, "F0S0", "G2Q2", "D0W0", "E2U2", "\u0003", "B1[1", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "B1[1", "\u0003", "E2U2", "D0W0", "G2Q2", "F0S0", E, "L1B222B1", "M1101011", "O0A0",}, - {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, - {"O0A0", "M1111111", "J111A23332A111", "H11M11", "F0144M4410", "F14Q41", "D014S410", "D14U41", "C14W41", "C14W41", "B1[1", "B1[1", "B1[1", "A1]1", "A12[21", "013[310", "A13[31", "013[310", "A12[21", "A1]1", "B1[1", "B1[1", "B1[1", "C14W41", "C14W41", "D14U41", "D014S410", "F14Q41", "F0144M4410", "H11M11", "J111A23332A111", "M1111111", "O0A0",}, - {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, - {"O0A0", "M1101011", "L1B222B1", E, "F0S0", "G2Q2", "D0W0", "E2U2", "\u0003", "B1[1", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "B1[1", "\u0003", "E2U2", "D0W0", "G2Q2", "F0S0", E, "L1B222B1", "M1101011", "O0A0",}, - {"O0A0", "N11111", "L11E11", "\u0001", "G2Q2", E, "E2U2", "\u0003", "B1[1", "B1[1", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "B1[1", "B1[1", "\u0003", "E2U2", E, "G2Q2", "\u0001", "L11E11", "N11111", "O0A0",}, - {"O0A0", "O0A0", "M1111111", "\u0009", "B1[1", "B1[1", "001[100", "B1[1", "001[100", "B1[1", "B1[1", "\u0009", "M1111111", "O0A0", "O0A0",}, - {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, - {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, - {E, "O0A0", "O0A0", "P1", "P4", "\u0009", "A00[00", "C14W41", "A00[00", "\u0009", "P4", "P1", "O0A0", "O0A0",}, - {"\u0001", "O0A0", "P1", "P4", "\u0009", "B0[0", "C14W41", "B0[0", "\u0009", "P4", "P1", "O0A0",}, - {"\u0001", "O0A0", "O0A0", "P1", "M2224222", "\u0006", "E2U2", "E2U2", "B00A2U2A00", "D14U41", "B00A2U2A00", "E2U2", "E2U2", "\u0006", "M2224222", "P1", "O0A0", "O0A0",}, - {"\u0002", "O0A0", "N00000", "P1", "P4", "\u0006", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "\u0006", "P4", "P1", "N00000", "O0A0",}, - {"\u0003", "O0A0", "O0A0", "P1", "M2224222", "\u0004", "G2Q2", "G2Q2", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "G2Q2", "G2Q2", "\u0004", "M2224222", "P1", "O0A0", "O0A0",}, - {"\u0004", "O0A0", "N00000", "P1", "P4", "P4", "\u0003", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "\u0003", "P4", "P4", "P1", "N00000", "O0A0",}, - {"\u0005", "O0A0", "O0A0", "P1", "P1", "\u0004", "F00Q00", "H11M11", "F00Q00", "\u0004", "P1", "P1", "O0A0", "O0A0",}, - {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, - {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, - {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{12, 13, 14, 10, 11}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; + private static final IStructureDefinition<GT_MetaTileEntity_EM_bhg> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_bhg>builder() + .addShape("main_t1", transpose(new String[][]{ + {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " C C ", " C C ", " CCCCCCCCC ", " C C ", " CCCCCCCCC ", " C C ", " C C ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " C C ", " C C ", " C C ", " DDDDD ", " DDCDCDD ", " CCCCDCCDCCDCCCC ", " DDDDDDD ", " CCCCDCCDCCDCCCC ", " DDCDCDD ", " DDDDD ", " C C ", " C C ", " C C ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " C C ", " C C ", " C C ", " D ", " D ", " DDDDDDD ", " DD DD ", " D EEE D ", " CCC D EAAAE D CCC ", " DDD EAAAE DDD ", " CCC D EAAAE D CCC ", " D EEE D ", " DD DD ", " DDDDDDD ", " D ", " D ", " C C ", " C C ", " C C ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " C C ", " C C ", " D ", " D ", " ", " ", " ", " ", " ", " CC CC ", " DD DD ", " CC CC ", " ", " ", " ", " ", " ", " D ", " D ", " C C ", " C C ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " C C ", " CCCCC ", " D ", " B ", " B ", " ", " ", " ", " ", " C C ", " CC CC ", " CDBB BBDC ", " CC CC ", " C C ", " ", " ", " ", " ", " B ", " B ", " D ", " CCCCC ", " C C ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " C C ", " C C ", " D ", " EEEBEEE ", " ", " ", " ", " ", " ", " E E ", " E E ", " CC E E CC ", " DB BD ", " CC E E CC ", " E E ", " E E ", " ", " ", " ", " ", " ", " EEEBEEE ", " D ", " C C ", " C C ", " ", " ", " ", " "}, + {" ", " ", " ", " C C ", " CCCCC ", " D ", " B ", " ", " ", " ", " ", " ", " ", " ", " C C ", " CC CC ", " CDB BDC ", " CC CC ", " C C ", " ", " ", " ", " ", " ", " ", " ", " B ", " D ", " CCCCC ", " C C ", " ", " ", " "}, + {" ", " ", " C C ", " C C ", " D ", " EEEBEEE ", " ", " ", " ", " ", " ", " ", " ", " E E ", " E E ", " CC E E CC ", " DB BD ", " CC E E CC ", " E E ", " E E ", " ", " ", " ", " ", " ", " ", " ", " EEEBEEE ", " D ", " C C ", " C C ", " ", " "}, + {" ", " ", " C C ", " D ", " B ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " DB BD ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " B ", " D ", " C C ", " ", " "}, + {" ", " C C ", " C C ", " D ", " B ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " CC CC ", " DB BD ", " CC CC ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " B ", " D ", " C C ", " C C ", " "}, + {" ", " C C ", " D ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " D D ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " D ", " C C ", " "}, + {" ", " C C ", " D ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " D D ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " D ", " C C ", " "}, + {" CCCCCCC ", " C C ", " DDDDDDD ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " D D ", " D D ", "CCD DCC", " D D ", "CCD DCC", " D D ", " D D ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " DDDDDDD ", " C C ", " C C "}, + {" CCHHHHHCC ", " DDDDD ", " DD DD ", " ", " ", " E E ", " ", " E E ", " ", " ", " ", " ", " D D ", " D D ", " D D ", "CD DC", " D D ", "CD DC", " D D ", " D D ", " D D ", " ", " ", " ", " ", " E E ", " ", " E E ", " ", " ", " DD DD ", " DDDDD ", " C C "}, + {" CHHHHHHHC ", " DDCDCDD ", " D EEE D ", " ", " C C ", " E E ", " C C ", " E E ", " ", " ", " ", " ", " D D ", " D D ", " D D ", "CCE ECC", " DE ED ", "CCE ECC", " D D ", " D D ", " D D ", " ", " ", " ", " ", " E E ", " C C ", " E E ", " C C ", " ", " D EEE D ", " DDCDCDD ", " C C "}, + {" CHHFFFHHC ", " CCCCDCCDCCDCCCC ", " CCC D EAAAE D CCC ", " CC CC ", " CC CC ", " CC E E CC ", " CC CC ", " CC E E CC ", " C C ", " CC CC ", " C C ", " C C ", "CCD DCC", "CD DC", "CCE ECC", "CCA ACC", "CDA ADC", "CCA ACC", "CCE ECC", "CD DC", "CCD DCC", " C C ", " C C ", " CC CC ", " C C ", " CC E E CC ", " CC CC ", " CC E E CC ", " CC CC ", " CC CC ", " CCC D EAAAE D CCC ", " CCCCDCCDCCDCCCC ", " CCCCCCCCC "}, + {" CHHF~FHHC ", " DDDDDDD ", " DDD EAAAE DDD ", " DD DD ", " CDBB BBDC ", " DB BD ", " CDB BDC ", " DB BD ", " DB BD ", " DB BD ", " D D ", " D D ", " D D ", " D D ", " DE ED ", "CDA ADC", " DA AD ", "CDA ADC", " DE ED ", " D D ", " D D ", " D D ", " D D ", " DB BD ", " DB BD ", " DB BD ", " CDB BDC ", " DB BD ", " CDBB BBDC ", " DD DD ", " DDD EAAAE DDD ", " DDDDDDD ", " C C "}, + {" CHHFFFHHC ", " CCCCDCCDCCDCCCC ", " CCC D EAAAE D CCC ", " CC CC ", " CC CC ", " CC E E CC ", " CC CC ", " CC E E CC ", " C C ", " CC CC ", " C C ", " C C ", "CCD DCC", "CD DC", "CCE ECC", "CCA ACC", "CDA ADC", "CCA ACC", "CCE ECC", "CD DC", "CCD DCC", " C C ", " C C ", " CC CC ", " C C ", " CC E E CC ", " CC CC ", " CC E E CC ", " CC CC ", " CC CC ", " CCC D EAAAE D CCC ", " CCCCDCCDCCDCCCC ", " CCCCCCCCC "}, + {" CHHHHHHHC ", " DDCDCDD ", " D EEE D ", " ", " C C ", " E E ", " C C ", " E E ", " ", " ", " ", " ", " D D ", " D D ", " D D ", "CCE ECC", " DE ED ", "CCE ECC", " D D ", " D D ", " D D ", " ", " ", " ", " ", " E E ", " C C ", " E E ", " C C ", " ", " D EEE D ", " DDCDCDD ", " C C "}, + {" CCHHHHHCC ", " DDDDD ", " DD DD ", " ", " ", " E E ", " ", " E E ", " ", " ", " ", " ", " D D ", " D D ", " D D ", "CD DC", " D D ", "CD DC", " D D ", " D D ", " D D ", " ", " ", " ", " ", " E E ", " ", " E E ", " ", " ", " DD DD ", " DDDDD ", " C C "}, + {" CCCCCCC ", " C C ", " DDDDDDD ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " D D ", " D D ", "CCD DCC", " D D ", "CCD DCC", " D D ", " D D ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " DDDDDDD ", " C C ", " C C "}, + {" ", " C C ", " D ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " D D ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " D ", " C C ", " "}, + {" ", " C C ", " D ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " D D ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " D ", " C C ", " "}, + {" ", " C C ", " C C ", " D ", " B ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " CC CC ", " DB BD ", " CC CC ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " B ", " D ", " C C ", " C C ", " "}, + {" ", " ", " C C ", " D ", " B ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " DB BD ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " B ", " D ", " C C ", " ", " "}, + {" ", " ", " C C ", " C C ", " D ", " EEEBEEE ", " ", " ", " ", " ", " ", " ", " ", " E E ", " E E ", " CC E E CC ", " DB BD ", " CC E E CC ", " E E ", " E E ", " ", " ", " ", " ", " ", " ", " ", " EEEBEEE ", " D ", " C C ", " C C ", " ", " "}, + {" ", " ", " ", " C C ", " CCCCC ", " D ", " B ", " ", " ", " ", " ", " ", " ", " ", " C C ", " CC CC ", " CDB BDC ", " CC CC ", " C C ", " ", " ", " ", " ", " ", " ", " ", " B ", " D ", " CCCCC ", " C C ", " ", " ", " "}, + {" ", " ", " ", " ", " C C ", " C C ", " D ", " EEEBEEE ", " ", " ", " ", " ", " ", " E E ", " E E ", " CC E E CC ", " DB BD ", " CC E E CC ", " E E ", " E E ", " ", " ", " ", " ", " ", " EEEBEEE ", " D ", " C C ", " C C ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " C C ", " CCCCC ", " D ", " B ", " B ", " ", " ", " ", " ", " C C ", " CC CC ", " CDBB BBDC ", " CC CC ", " C C ", " ", " ", " ", " ", " B ", " B ", " D ", " CCCCC ", " C C ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " C C ", " C C ", " D ", " D ", " ", " ", " ", " ", " ", " CC CC ", " DD DD ", " CC CC ", " ", " ", " ", " D ", " D ", " D ", " D ", " C C ", " C C ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " C C ", " C C ", " C C ", " D ", " D ", " DDDDDDD ", " DD DD ", " D EEE D ", " CCC D EAAAE D CCC ", " DDD EAAAE DDD ", " CCC D EAAAE D CCC ", " D EEE D ", " DD DD ", " DDDDDDD ", " D ", " D ", " C C ", " C C ", " C C ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " C C ", " C C ", " C C ", " DDDDD ", " DDCDCDD ", " CCCCDCCDCCDCCCC ", " DDDDDDD ", " CCCCDCCDCCDCCCC ", " DDCDCDD ", " DDDDD ", " C C ", " C C ", " C C ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " C C ", " C C ", " CCCCCCCCC ", " C C ", " CCCCCCCCC ", " C C ", " C C ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "} + })) + .addShape("main_t2", transpose(new String[][]{ + {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " C C ", " C C ", " CCCCCCCCC ", " C C ", " CCCCCCCCC ", " C C ", " C C ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " GGC CGG ", " GGGC CGGG ", " GGGGC CGGGG ", " GGGGDDDDDGGGG ", " GGGDDCDCDDGGG ", " CCCCDCCDCCDCCCC ", " DDDDDDD ", " CCCCDCCDCCDCCCC ", " GGGDDCDCDDGGG ", " GGGGDDDDDGGGG ", " GGGGC CGGGG ", " GGGC CGGG ", " GGC CGG ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " C C ", " GGC CGG ", " GGGGC CGGGG ", " GGG D GGG ", " GGG D GGG ", " GG DDDDDDD GG ", " GG DD DD GG ", " GG D EEE D GG ", " CCC D EAAAE D CCC ", " DDD EAAAE DDD ", " CCC D EAAAE D CCC ", " GG D EEE D GG ", " GG DD DD GG ", " GG DDDDDDD GG ", " GGG D GGG ", " GGG D GGG ", " GGGGC CGGGG ", " GGC CGG ", " C C ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " C C ", " GGGC CGGG ", " GGG D GGG ", " GG D GG ", " GG GG ", " G G ", " GG GG ", " G G ", " G G ", " CC CC ", " DD DD ", " CC CC ", " G G ", " G G ", " GG GG ", " G G ", " GG GG ", " GG D GG ", " GGG D GGG ", " GGGC CGGG ", " C C ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " C C ", " GGGCCCCCGGG ", " GGG D GGG ", " GG B GG ", " GG B GG ", " G G ", " GG GG ", " G G ", " G G ", " C C ", " CC CC ", " CDBB BBDC ", " CC CC ", " C C ", " G G ", " G G ", " GG GG ", " G G ", " GG B GG ", " GG B GG ", " GGG D GGG ", " GGGCCCCCGGG ", " C C ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " C C ", " GGGGGC CGGGGG ", " GGG D GGG ", " GG EEEBEEE GG ", " GG GG ", " G G ", " GG GG ", " G G ", " G G ", " G E E G ", " G E E G ", " CC E E CC ", " DB BD ", " CC E E CC ", " G E E G ", " G E E G ", " G G ", " G G ", " GG GG ", " G G ", " GG GG ", " GG EEEBEEE GG ", " GGG D GGG ", " GGGGGC CGGGGG ", " C C ", " ", " ", " ", " "}, + {" ", " ", " ", " C C ", " GGGCCCCCGGG ", " GGG D GGG ", " GG B GG ", " G G ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " C C ", " CC CC ", " CDB BDC ", " CC CC ", " C C ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " G G ", " GG B GG ", " GGG D GGG ", " GGGCCCCCGGG ", " C C ", " ", " ", " "}, + {" ", " ", " C C ", " GGGC CGGG ", " GGG D GGG ", " GG EEEBEEE GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G E E G ", " G E E G ", " CC E E CC ", " DB BD ", " CC E E CC ", " G E E G ", " G E E G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG EEEBEEE GG ", " GGG D GGG ", " GGGC CGGG ", " C C ", " ", " "}, + {" ", " ", " GGC CGG ", " GGG D GGG ", " GG B GG ", " GG GG ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " C C ", " DB BD ", " C C ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " GG GG ", " GG B GG ", " GGG D GGG ", " GGC CGG ", " ", " "}, + {" ", " C C ", " GGGGC CGGGG ", " GG D GG ", " GG B GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " CC CC ", " DB BD ", " CC CC ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG B GG ", " GG D GG ", " GGGGC CGGGG ", " C C ", " "}, + {" ", " GGC CGG ", " GGG D GGG ", " GG GG ", " G G ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " C C ", " D D ", " C C ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " G G ", " GG GG ", " GGG D GGG ", " GGC CGG ", " "}, + {" ", " GGGC CGGG ", " GGG D GGG ", " G G ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " C C ", " D D ", " C C ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " G G ", " GGG D GGG ", " GGGC CGGG ", " "}, + {" CCCCCCC ", " GGGGC CGGGG ", " GG DDDDDDD GG ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GD DG ", " GD DG ", "CCD DCC", " D D ", "CCD DCC", " GD DG ", " GD DG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " GG DDDDDDD GG ", " GGGGC CGGGG ", " C C "}, + {" CCHHHHHCC ", " GGGGDDDDDGGGG ", " GG DD DD GG ", " G G ", " G G ", " G E E G ", " G G ", " G E E G ", " G G ", " G G ", " G G ", " G G ", " GD DG ", " GD DG ", " D D ", "CD DC", " D D ", "CD DC", " D D ", " GD DG ", " GD DG ", " G G ", " G G ", " G G ", " G G ", " G E E G ", " G G ", " G E E G ", " G G ", " G G ", " GG DD DD GG ", " GGGGDDDDDGGGG ", " C C "}, + {" CHHHHHHHC ", " GGGDDCDCDDGGG ", " GG D EEE D GG ", " G G ", " C C ", " G E E G ", " C C ", " G E E G ", " G G ", " G G ", " G G ", " G G ", " GD DG ", " D D ", " D D ", "CCE ECC", " DE ED ", "CCE ECC", " D D ", " D D ", " GD DG ", " G G ", " G G ", " G G ", " G G ", " G E E G ", " C C ", " G E E G ", " C C ", " G G ", " GG D EEE D GG ", " GGGDDCDCDDGGG ", " C C "}, + {" CHHFFFHHC ", " CCCCDCCDCCDCCCC ", " CCC D EAAAE D CCC ", " CC CC ", " CC CC ", " CC E E CC ", " CC CC ", " CC E E CC ", " C C ", " CC CC ", " C C ", " C C ", "CCD DCC", "CD DC", "CCE ECC", "CCA ACC", "CDA ADC", "CCA ACC", "CCE ECC", "CD DC", "CCD DCC", " C C ", " C C ", " CC CC ", " C C ", " CC E E CC ", " CC CC ", " CC E E CC ", " CC CC ", " CC CC ", " CCC D EAAAE D CCC ", " CCCCDCCDCCDCCCC ", " CCCCCCCCC "}, + {" CHHF~FHHC ", " DDDDDDD ", " DDD EAAAE DDD ", " DD DD ", " CDBB BBDC ", " DB BD ", " CDB BDC ", " DB BD ", " DB BD ", " DB BD ", " D D ", " D D ", " D D ", " D D ", " DE ED ", "CDA ADC", " DA AD ", "CDA ADC", " DE ED ", " D D ", " D D ", " D D ", " D D ", " DB BD ", " DB BD ", " DB BD ", " CDB BDC ", " DB BD ", " CDBB BBDC ", " DD DD ", " DDD EAAAE DDD ", " DDDDDDD ", " C C "}, + {" CHHFFFHHC ", " CCCCDCCDCCDCCCC ", " CCC D EAAAE D CCC ", " CC CC ", " CC CC ", " CC E E CC ", " CC CC ", " CC E E CC ", " C C ", " CC CC ", " C C ", " C C ", "CCD DCC", "CD DC", "CCE ECC", "CCA ACC", "CDA ADC", "CCA ACC", "CCE ECC", "CD DC", "CCD DCC", " C C ", " C C ", " CC CC ", " C C ", " CC E E CC ", " CC CC ", " CC E E CC ", " CC CC ", " CC CC ", " CCC D EAAAE D CCC ", " CCCCDCCDCCDCCCC ", " CCCCCCCCC "}, + {" CHHHHHHHC ", " GGGDDCDCDDGGG ", " GG D EEE D GG ", " G G ", " C C ", " G E E G ", " C C ", " G E E G ", " G G ", " G G ", " G G ", " G G ", " GD DG ", " D D ", " D D ", "CCE ECC", " DE ED ", "CCE ECC", " D D ", " D D ", " GD DG ", " G G ", " G G ", " G G ", " G G ", " G E E G ", " C C ", " G E E G ", " C C ", " G G ", " GG D EEE D GG ", " GGGDDCDCDDGGG ", " C C "}, + {" CCHHHHHCC ", " GGGGDDDDDGGGG ", " GG DD DD GG ", " G G ", " G G ", " G E E G ", " G G ", " G E E G ", " G G ", " G G ", " G G ", " G G ", " GD DG ", " GD DG ", " D D ", "CD DC", " D D ", "CD DC", " D D ", " GD DG ", " GD DG ", " G G ", " G G ", " G G ", " G G ", " G E E G ", " G G ", " G E E G ", " G G ", " G G ", " GG DD DD GG ", " GGGGDDDDDGGGG ", " C C "}, + {" CCCCCCC ", " GGGGC CGGGG ", " GG DDDDDDD GG ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GD DG ", " GD DG ", "CCD DCC", " D D ", "CCD DCC", " GD DG ", " GD DG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " GG DDDDDDD GG ", " GGGGC CGGGG ", " C C "}, + {" ", " GGGC CGGG ", " GGG D GGG ", " G G ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " C C ", " D D ", " C C ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " G G ", " GGG D GGG ", " GGGC CGGG ", " "}, + {" ", " GGC CGG ", " GGG D GGG ", " GG GG ", " G G ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " C C ", " D D ", " C C ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " G G ", " GG GG ", " GGG D GGG ", " GGC CGG ", " "}, + {" ", " C C ", " GGGGC CGGGG ", " GG D GG ", " GG B GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " CC CC ", " DB BD ", " CC CC ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG B GG ", " GG D GG ", " GGGGC CGGGG ", " C C ", " "}, + {" ", " ", " GGC CGG ", " GGG D GGG ", " GG B GG ", " GG GG ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " C C ", " DB BD ", " C C ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " GG GG ", " GG B GG ", " GGG D GGG ", " GGC CGG ", " ", " "}, + {" ", " ", " C C ", " GGGC CGGG ", " GGG D GGG ", " GG EEEBEEE GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G E E G ", " G E E G ", " CC E E CC ", " DB BD ", " CC E E CC ", " G E E G ", " G E E G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG EEEBEEE GG ", " GGG D GGG ", " GGGC CGGG ", " C C ", " ", " "}, + {" ", " ", " ", " C C ", " GGGCCCCCGGG ", " GGG D GGG ", " GG B GG ", " G G ", " GG GG ", " G G ", " G G ", " G G ", " G G ", " G G ", " C C ", " CC CC ", " CDB BDC ", " CC CC ", " C C ", " G G ", " G G ", " G G ", " G G ", " G G ", " GG GG ", " G G ", " GG B GG ", " GGG D GGG ", " GGGCCCCCGGG ", " C C ", " ", " ", " "}, + {" ", " ", " ", " ", " C C ", " GGGGGC CGGGGG ", " GGG D GGG ", " GG EEEBEEE GG ", " GG GG ", " G G ", " GG GG ", " G G ", " G G ", " G E E G ", " G E E G ", " CC E E CC ", " DB BD ", " CC E E CC ", " G E E G ", " G E E G ", " G G ", " G G ", " GG GG ", " G G ", " GG GG ", " GG EEEBEEE GG ", " GGG D GGG ", " GGGGGC CGGGGG ", " C C ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " C C ", " GGGCCCCCGGG ", " GGG D GGG ", " GG B GG ", " GG B GG ", " G G ", " GG GG ", " G G ", " G G ", " C C ", " CC CC ", " CDBB BBDC ", " CC CC ", " C C ", " G G ", " G G ", " GG GG ", " G G ", " GG B GG ", " GG B GG ", " GGG D GGG ", " GGGCCCCCGGG ", " C C ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " C C ", " GGGC CGGG ", " GGG D GGG ", " GG D GG ", " GG GG ", " G G ", " GG GG ", " G G ", " G G ", " CC CC ", " DD DD ", " CC CC ", " G G ", " G G ", " GG GG ", " G D G ", " GG D GG ", " GG D GG ", " GGG D GGG ", " GGGC CGGG ", " C C ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " C C ", " GGC CGG ", " GGGGC CGGGG ", " GGG D GGG ", " GGG D GGG ", " GG DDDDDDD GG ", " GG DD DD GG ", " GG D EEE D GG ", " CCC D EAAAE D CCC ", " DDD EAAAE DDD ", " CCC D EAAAE D CCC ", " GG D EEE D GG ", " GG DD DD GG ", " GG DDDDDDD GG ", " GGG D GGG ", " GGG D GGG ", " GGGGC CGGGG ", " GGC CGG ", " C C ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " GGC CGG ", " GGGC CGGG ", " GGGGC CGGGG ", " GGGGDDDDDGGGG ", " GGGDDCDCDDGGG ", " CCCCDCCDCCDCCCC ", " DDDDDDD ", " CCCCDCCDCCDCCCC ", " GGGDDCDCDDGGG ", " GGGGDDDDDGGGG ", " GGGGC CGGGG ", " GGGC CGGG ", " GGC CGG ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, + {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " C C ", " C C ", " C C ", " CCCCCCCCC ", " C C ", " CCCCCCCCC ", " C C ", " C C ", " C C ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 10)) + .addElement('B', ofBlock(sBlockCasingsTT, 11)) + .addElement('C', ofBlock(sBlockCasingsTT, 12)) + .addElement('D', ofBlock(sBlockCasingsTT, 13)) + .addElement('E', ofBlock(sBlockCasingsTT, 14)) + .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .build(); + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_bhg> getStructure_EM() { + return STRUCTURE_DEFINITION; + } + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.blackholegenerator.hint.0"),//1 - Classic Hatches or High Power Casing @@ -95,46 +142,6 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E }; //endregion - //region structure dank - glass sphere for the looks - private static final String[][] shape2 = new String[][]{ - {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, - {"\u0008", "O0A0", "M110A011", "L1110A0111", "K11110A01111", "J1111222221111", "J1112202022111", "I000020020020000", "M2222222", "I000020020020000", "J1112202022111", "J1111222221111", "K11110A01111", "L1110A0111", "M110A011", "O0A0",}, - {"\u0006", "O0A0", "M110A011", "K11110A01111", "J111C2C111", "I111D2D111", "I11B2222222B11", "H11B22E22B11", "H11B2B333B2B11", "G000B2A34443A2B000", "J222A34443A222", "G000B2A34443A2B000", "H11B2B333B2B11", "H11B22E22B11", "I11B2222222B11", "I111D2D111", "J111C2C111", "K11110A01111", "M110A011", "O0A0",}, - {"\u0005", "O0A0", "L1110A0111", "J111C2C111", "I11E2E11", "H11M11", "H1O1", "G11O11", "G1Q1", "G1Q1", "F00Q00", "H22M22", "F00Q00", "G1Q1", "G1Q1", "G11O11", "H1O1", "H11M11", "I11E2E11", "J111C2C111", "L1110A0111", "O0A0",}, - {"\u0004", "O0A0", "K11100000111", "I111D2D111", "H11F5F11", "G11G5G11", "G1Q1", "F11Q11", "F1S1", "F1S1", "F0S0", "E00S00", "F0255M5520", "E00S00", "F0S0", "F1S1", "F1S1", "F11Q11", "G1Q1", "G11G5G11", "H11F5F11", "I111D2D111", "K11100000111", "O0A0",}, - {"\u0003", "O0A0", "J111110A011111", "H111E2E111", "G11D3335333D11", "F11Q11", "F1S1", "E11S11", "E1U1", "E1U1", "E1A3Q3A1", "E1A3Q3A1", "D00A3Q3A00", "F25Q52", "D00A3Q3A00", "E1A3Q3A1", "E1A3Q3A1", "E1U1", "E1U1", "E11S11", "F1S1", "F11Q11", "G11D3335333D11", "H111E2E111", "J111110A011111", "O0A0",}, - {"\u0002", "O0A0", "K11100000111", "H111E2E111", "G11G5G11", "F1S1", "E11S11", "E1U1", "E1U1", "D1W1", "D1W1", "D1W1", "D0W0", "C00W00", "D025S520", "C00W00", "D0W0", "D1W1", "D1W1", "D1W1", "E1U1", "E1U1", "E11S11", "F1S1", "G11G5G11", "H111E2E111", "K11100000111", "O0A0",}, - {"\u0001", "O0A0", "L1110A0111", "I111D2D111", "G11D3335333D11", "F1S1", "E1U1", "E1U1", "D1W1", "D1W1", "D1W1", "C1Y1", "C1A3U3A1", "C1A3U3A1", "B00A3U3A00", "D25U52", "B00A3U3A00", "C1A3U3A1", "C1A3U3A1", "C1Y1", "D1W1", "D1W1", "D1W1", "E1U1", "E1U1", "F1S1", "G11D3335333D11", "I111D2D111", "L1110A0111", "O0A0",}, - {"\u0001", "M110A011", "J111C2C111", "H11F5F11", "F11Q11", "E11S11", "E1U1", "D1W1", "D1W1", "C1Y1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B0[0", "C25W52", "B0[0", "B1[1", "B1[1", "C1Y1", "C1Y1", "C1Y1", "D1W1", "D1W1", "E1U1", "E11S11", "F11Q11", "H11F5F11", "J111C2C111", "M110A011",}, - {E, "O0A0", "K11110A01111", "I11E2E11", "G11G5G11", "F1S1", "E1U1", "D1W1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B1[1", "B1[1", "A00[00", "C25W52", "A00[00", "B1[1", "B1[1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "D1W1", "E1U1", "F1S1", "G11G5G11", "I11E2E11", "K11110A01111", "O0A0",}, - {E, "M110A011", "J111C2C111", "H11M11", "G1Q1", "E11S11", "E1U1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B1[1", "A1]1", "A1]1", "A0]0", "B2[2", "A0]0", "A1]1", "A1]1", "B1[1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "E1U1", "E11S11", "G1Q1", "H11M11", "J111C2C111", "M110A011",}, - {E, "L1110A0111", "I111D2D111", "H1O1", "F11Q11", "E1U1", "D1W1", "D1W1", "C1Y1", "B1[1", "B1[1", "B1[1", "A1]1", "A1]1", "A1]1", "A0]0", "B2[2", "A0]0", "A1]1", "A1]1", "A1]1", "B1[1", "B1[1", "B1[1", "C1Y1", "D1W1", "D1W1", "E1U1", "F11Q11", "H1O1", "I111D2D111", "L1110A0111",}, - {"O0A0", "K11110A01111", "I11B2222222B11", "G11O11", "F1S1", "E1U1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A12[21", "002[200", "B2[2", "002[200", "A12[21", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "E1U1", "F1S1", "G11O11", "I11B2222222B11", "K11110A01111", "O0A0",}, - {"O0A0", "J1111222221111", "H11B22E22B11", "G1Q1", "F1S1", "E1A3Q3A1", "D1W1", "C1A3U3A1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A12[21", "A2]2", "02]20", "A2]2", "02]20", "A2]2", "A12[21", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1A3U3A1", "D1W1", "E1A3Q3A1", "F1S1", "G1Q1", "H11B22E22B11", "J1111222221111", "O0A0",}, - {"O0A0", "J1112202022111", "H11B2B333B2B11", "G1Q1", "F0S0", "E1A3Q3A1", "D0W0", "C1A3U3A1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A2]2", "A2]2", "003[300", "A23[32", "003[300", "A2]2", "A2]2", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1A3U3A1", "D0W0", "E1A3Q3A1", "F0S0", "G1Q1", "H11B2B333B2B11", "J1112202022111", "O0A0",}, - {"L000000000", "I000020020020000", "G000B2A34443A2B000", "F00Q00", "E00S00", "D00A3Q3A00", "C00W00", "B00A3U3A00", "B0[0", "A00[00", "A0]0", "A0]0", "002[200", "02]20", "003[300", "004[400", "024[420", "004[400", "003[300", "02]20", "002[200", "A0]0", "A0]0", "A00[00", "B0[0", "B00A3U3A00", "C00W00", "D00A3Q3A00", "E00S00", "F00Q00", "G000B2A34443A2B000", "I000020020020000", "L000000000",}, - {"O0A0", "M2222222", "J222A34443A222", "H22M22", "F0255M5520", "F25Q52", "D025S520", "D25U52", "C25W52", "C25W52", "B2[2", "B2[2", "B2[2", "A2]2", "A23[32", "024[420", "A24[42", "024[420", "A23[32", "A2]2", "B2[2", "B2[2", "B2[2", "C25W52", "C25W52", "D25U52", "D025S520", "F25Q52", "F0255M5520", "H22M22", "J222A34443A222", "M2222222", "O0A0",}, - {"L000000000", "I000020020020000", "G000B2A34443A2B000", "F00Q00", "E00S00", "D00A3Q3A00", "C00W00", "B00A3U3A00", "B0[0", "A00[00", "A0]0", "A0]0", "002[200", "02]20", "003[300", "004[400", "024[420", "004[400", "003[300", "02]20", "002[200", "A0]0", "A0]0", "A00[00", "B0[0", "B00A3U3A00", "C00W00", "D00A3Q3A00", "E00S00", "F00Q00", "G000B2A34443A2B000", "I000020020020000", "L000000000",}, - {"O0A0", "J1112202022111", "H11B2B333B2B11", "G1Q1", "F0S0", "E1A3Q3A1", "D0W0", "C1A3U3A1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A2]2", "A2]2", "003[300", "A23[32", "003[300", "A2]2", "A2]2", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1A3U3A1", "D0W0", "E1A3Q3A1", "F0S0", "G1Q1", "H11B2B333B2B11", "J1112202022111", "O0A0",}, - {"O0A0", "J1111222221111", "H11B22E22B11", "G1Q1", "F1S1", "E1A3Q3A1", "D1W1", "C1A3U3A1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A12[21", "A2]2", "02]20", "A2]2", "02]20", "A2]2", "A12[21", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1A3U3A1", "D1W1", "E1A3Q3A1", "F1S1", "G1Q1", "H11B22E22B11", "J1111222221111", "O0A0",}, - {"O0A0", "K11110A01111", "I11B2222222B11", "G11O11", "F1S1", "E1U1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A12[21", "002[200", "B2[2", "002[200", "A12[21", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "E1U1", "F1S1", "G11O11", "I11B2222222B11", "K11110A01111", "O0A0",}, - {E, "L1110A0111", "I111D2D111", "H1O1", "F11Q11", "E1U1", "D1W1", "D1W1", "C1Y1", "B1[1", "B1[1", "B1[1", "A1]1", "A1]1", "A1]1", "A0]0", "B2[2", "A0]0", "A1]1", "A1]1", "A1]1", "B1[1", "B1[1", "B1[1", "C1Y1", "D1W1", "D1W1", "E1U1", "F11Q11", "H1O1", "I111D2D111", "L1110A0111",}, - {E, "M110A011", "J111C2C111", "H11M11", "G1Q1", "E11S11", "E1U1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B1[1", "A1]1", "A1]1", "A0]0", "B2[2", "A0]0", "A1]1", "A1]1", "B1[1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "E1U1", "E11S11", "G1Q1", "H11M11", "J111C2C111", "M110A011",}, - {E, "O0A0", "K11110A01111", "I11E2E11", "G11G5G11", "F1S1", "E1U1", "D1W1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B1[1", "B1[1", "A00[00", "C25W52", "A00[00", "B1[1", "B1[1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "D1W1", "E1U1", "F1S1", "G11G5G11", "I11E2E11", "K11110A01111", "O0A0",}, - {"\u0001", "M110A011", "J111C2C111", "H11F5F11", "F11Q11", "E11S11", "E1U1", "D1W1", "D1W1", "C1Y1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B0[0", "C25W52", "B0[0", "B1[1", "B1[1", "C1Y1", "C1Y1", "C1Y1", "D1W1", "D1W1", "E1U1", "E11S11", "F11Q11", "H11F5F11", "J111C2C111", "M110A011",}, - {"\u0001", "O0A0", "L1110A0111", "I111D2D111", "G11D3335333D11", "F1S1", "E1U1", "E1U1", "D1W1", "D1W1", "D1W1", "C1Y1", "C1A3U3A1", "C1A3U3A1", "B00A3U3A00", "D25U52", "B00A3U3A00", "C1A3U3A1", "C1A3U3A1", "C1Y1", "D1W1", "D1W1", "D1W1", "E1U1", "E1U1", "F1S1", "G11D3335333D11", "I111D2D111", "L1110A0111", "O0A0",}, - {"\u0002", "O0A0", "K11100000111", "H111E2E111", "G11G5G11", "F1S1", "E11S11", "E1U1", "E1U1", "D1W1", "D1W1", "D1W1", "D0W0", "C00W00", "D025S520", "C00W00", "D0W0", "D1W1", "D1W1", "D1W1", "E1U1", "E1U1", "E11S11", "F1S1", "G11G5G11", "H111E2E111", "K11100000111", "O0A0",}, - {"\u0003", "O0A0", "J111110A011111", "H111E2E111", "G11D3335333D11", "F11Q11", "F1S1", "E11S11", "E1U1", "E1U1", "E1A3Q3A1", "E1A3Q3A1", "D00A3Q3A00", "F25Q52", "D00A3Q3A00", "E1A3Q3A1", "E1A3Q3A1", "E1U1", "E1U1", "E11S11", "F1S1", "F11Q11", "G11D3335333D11", "H111E2E111", "J111110A011111", "O0A0",}, - {"\u0004", "O0A0", "K11100000111", "I111D2D111", "H11F5F11", "G11G5G11", "G1Q1", "F11Q11", "F1S1", "F1S1", "F0S0", "E00S00", "F0255M5520", "E00S00", "F0S0", "F1S1", "F1S1", "F11Q11", "G1Q1", "G11G5G11", "H11F5F11", "I111D2D111", "K11100000111", "O0A0",}, - {"\u0005", "O0A0", "L1110A0111", "J111C2C111", "I11E2E11", "H11M11", "H1O1", "G11O11", "G1Q1", "G1Q1", "F00Q00", "H22M22", "F00Q00", "G1Q1", "G1Q1", "G11O11", "H1O1", "H11M11", "I11E2E11", "J111C2C111", "L1110A0111", "O0A0",}, - {"\u0006", "O0A0", "M110A011", "K11110A01111", "J111C2C111", "I111D2D111", "I11B2222222B11", "H11B22E22B11", "H11B2B333B2B11", "G000B2A34443A2B000", "J222A34443A222", "G000B2A34443A2B000", "H11B2B333B2B11", "H11B22E22B11", "I11B2222222B11", "I111D2D111", "J111C2C111", "K11110A01111", "M110A011", "O0A0",}, - {"\u0008", "O0A0", "M110A011", "L1110A0111", "K11110A01111", "J1111222221111", "J1112202022111", "I000020020020000", "M2222222", "I000020020020000", "J1112202022111", "J1111222221111", "K11110A01111", "L1110A0111", "M110A011", "O0A0",}, - {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, - }; - private static final Block[] blockType2 = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta2 = new byte[]{12, 0, 13, 14, 10, 11}; - //endregion - public GT_MetaTileEntity_EM_bhg(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -259,11 +266,11 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - if (structureCheck_EM(shape2, blockType2, blockMeta2, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 16, 16, 0)) { + if (structureCheck_EM("t2", 16, 16, 0)) { glassDome = true; return true; } - if (structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 16, 16, 0)) { + if (structureCheck_EM("t1", 16, 16, 0)) { glassDome = false; return true; } @@ -291,22 +298,22 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; } @Override - public void construct(int stackSize, boolean hintsOnly) { - if ((stackSize & 1) == 1) { - StructureBuilderExtreme(shape, blockType, blockMeta, 16, 16, 0, getBaseMetaTileEntity(), this, hintsOnly); - } else { - StructureBuilderExtreme(shape2, blockType2, blockMeta2, 16, 16, 0, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + try { + structureBuild_EM((stackSize.stackSize & 1) == 1 ? "main_t1" : "main_t2", 16, 16, 0, stackSize, hintsOnly); + } catch (Exception e) { + e.printStackTrace(); } } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} 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 deleted file mode 100644 index 2b0b0f8465..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ /dev/null @@ -1,695 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; -import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalMutableDefinitionStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; -import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -import java.util.HashMap; - -import static com.github.technus.tectech.Util.StructureBuilderExtreme; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; -import static net.minecraft.util.StatCollector.translateToLocal; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - //region variables - private static Textures.BlockIcons.CustomIcon ScreenOFF; - private static Textures.BlockIcons.CustomIcon ScreenON; - private static Textures.BlockIcons.CustomIcon ScreenON_Slave; - private static Textures.BlockIcons.CustomIcon ScreenOFF_Slave; - - protected static final byte FUSE_MODE = 0, COLLIDE_MODE = 1; - private static double MASS_TO_EU_INSTANT; - private static int STARTUP_COST, KEEPUP_COST; - - protected byte eTier = 0; - protected cElementalInstanceStack stack; - private long plasmaEnergy; - - protected boolean started = false; - //endregion - - //region collision handlers - public static final HashMap<Integer, IColliderHandler> FUSE_HANDLERS = new HashMap<>(); - public static final HashMap<String, IPrimitiveColliderHandler> PRIMITIVE_FUSE_HANDLERS = new HashMap<>(); - - public interface IPrimitiveColliderHandler { - void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out); - } - - public interface IColliderHandler extends IPrimitiveColliderHandler { - byte getRequiredTier(); - } - - static { - FUSE_HANDLERS.put((dAtomDefinition.getClassTypeStatic() << 16) | dAtomDefinition.getClassTypeStatic(), new IColliderHandler() { - @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { - try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); - defs.putUnifyAll(in1.definition.getSubParticles()); - defs.putUnifyAll(in2.definition.getSubParticles()); - dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(atom, Math.min(in1.amount, in2.amount))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); - } - } - - @Override - public byte getRequiredTier() { - return 1; - } - }); - registerSimpleAtomFuse(dHadronDefinition.getClassTypeStatic()); - registerSimpleAtomFuse(dComplexAspectDefinition.getClassTypeStatic()); - registerSimpleAtomFuse(cElementalPrimitive.getClassTypeStatic()); - - FUSE_HANDLERS.put((dHadronDefinition.getClassTypeStatic() << 16) | dHadronDefinition.getClassTypeStatic(), new IColliderHandler() { - @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { - try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); - defs.putUnifyAll(in1.definition.getSubParticles()); - defs.putUnifyAll(in2.definition.getSubParticles()); - dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); - } - } - - @Override - public byte getRequiredTier() { - return 2; - } - }); - FUSE_HANDLERS.put((dHadronDefinition.getClassTypeStatic() << 16) | cElementalPrimitive.getClassTypeStatic(), new IColliderHandler() { - @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { - try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); - defs.putUnifyAll(in1.definition.getSubParticles()); - defs.putUnify(in2.definition.getStackForm(1)); - dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); - } - } - - @Override - public byte getRequiredTier() { - return 2; - } - }); - - registerSimpleAspectFuse(dComplexAspectDefinition.getClassTypeStatic()); - registerSimpleAspectFuse(cElementalPrimitive.getClassTypeStatic()); - - FUSE_HANDLERS.put((cElementalPrimitive.getClassTypeStatic() << 16) | cElementalPrimitive.getClassTypeStatic(), new IColliderHandler() { - @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { - IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get(in1.definition.getClass().getName() + '\0' + in2.definition.getClass().getName()); - if (collisionHandler != null) { - collisionHandler.collide(in2, in1, out); - } else { - out.putUnifyAll(in1, in2); - } - } - - @Override - public byte getRequiredTier() { - return 2; - } - }); - - PRIMITIVE_FUSE_HANDLERS.put(eQuarkDefinition.class.getName() + '\0' + eQuarkDefinition.class.getName(), (in1, in2, out) -> { - try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); - defs.putUnify(in1.definition.getStackForm(1)); - defs.putUnify(in2.definition.getStackForm(1)); - dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); - } - }); - PRIMITIVE_FUSE_HANDLERS.put(ePrimalAspectDefinition.class.getName() + '\0' + ePrimalAspectDefinition.class.getName(), (in1, in2, out) -> { - if (fuseAspects(in1, in2, out)) return; - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); - } - }); - } - - private static boolean fuseAspects(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { - try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); - defs.putUnify(in1.definition.getStackForm(1)); - defs.putUnify(in2.definition.getStackForm(1)); - dComplexAspectDefinition aspect = new dComplexAspectDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(aspect, Math.min(in1.amount, in2.amount))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return true; - } - return false; - } - - private static void registerSimpleAspectFuse(byte classTypeStatic) { - FUSE_HANDLERS.put((dComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { - @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { - if (fuseAspects(in1, in2, out)) return; - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); - } - } - - @Override - public byte getRequiredTier() { - return 1; - } - }); - } - - private static void registerSimpleAtomFuse(byte classTypeStatic) { - FUSE_HANDLERS.put((dAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { - @Override - public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { - try { - cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); - defs.putUnifyAll(in1.definition.getSubParticles()); - defs.putUnify(in2.definition.getStackForm(1)); - dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(atom, Math.min(in1.amount, in2.amount))); - } catch (Exception e) { - out.putUnifyAll(in1, in2); - return; - } - if (in1.amount > in2.amount) { - out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); - } else if (in2.amount > in1.amount) { - out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); - } - } - - @Override - public byte getRequiredTier() { - return 1; - } - }); - } - //endregion - - //region parameters - protected Parameters.Group.ParameterIn mode; - private static final IStatusFunction<GT_MetaTileEntity_EM_collider> MODE_STATUS = (base_EM, p) -> { - if (base_EM.isMaster()) { - double mode = p.get(); - if (mode == FUSE_MODE || mode == COLLIDE_MODE) { - return STATUS_OK; - } else if (mode > 1) { - return STATUS_TOO_HIGH; - } else if (mode < 0) { - return STATUS_TOO_LOW; - } - return STATUS_WRONG; - } - return STATUS_UNUSED; - }; - private static final INameFunction<GT_MetaTileEntity_EM_collider> MODE_NAME = (base_EM, p) -> { - if (base_EM.isMaster()) { - double mode = p.get(); - if (mode == FUSE_MODE) { - return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.0");//Mode: Fuse - } else if (mode == COLLIDE_MODE) { - return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.1");//Mode: Collide - } - return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.2");//Mode: Undefined - } - return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.3");//Currently Slaves... - }; - //endregion - - //region structure - //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {"I0A0A0", "I00000", "I0A0A0",}, - {"H0000000", "G001111100", "H0000000",}, - {"F22223332222", "F41155555114", "F22223332222",}, - {"E2000000000002", "E4155111115514", "E2000000000002",}, - {"D20000E00002", "D41511E11514", "D20000E00002",}, - {"C2000I0002", "C4151I1514", "C2000I0002",}, - {"B2000K0002", "B4151K1514", "B2000K0002",}, - {"B200M002", "A0151M1510", "B200M002",}, - {"A0200M0020", "A0151M1510", "A0200M0020",}, - {"0020O0200", "0151O1510", "0020O0200",}, - {"A030O030", "0151O1510", "A030O030",}, - {"0030O0300", "0151O1510", "0030O0300",}, - {"A030O030", "0151O1510", "A030O030",}, - {"0020O0200", "0151O1510", "0020O0200",}, - {"A0200M0020", "A0151M1510", "A0200M0020",}, - {"B200M002", "A0151M1510", "B200M002",}, - {"B2000K0002", "B4151K1514", "B2000K0002",}, - {"C2000I0002", "C4151I1514", "C2000I0002",}, - {"D200002 200002", "D415112 . 211514", "D200002 200002",}, - {"E20!!22222!!02", "E4155111115514", "E20!!22222!!02",}, - {"F2222#\"#2222", "F41155555114", "F2222#\"#2222",}, - }; - private static final Block[] blockType = new Block[]{ - sBlockCasingsTT, - sBlockCasingsTT, - sBlockCasingsTT, - QuantumGlassBlock.INSTANCE, - sBlockCasingsTT, - sBlockCasingsTT - }; - private static final byte[] blockMeta1 = new byte[]{4, 7, 4, 0, 4, 8}; - private static final byte[] blockMeta2 = new byte[]{4, 7, 5, 0, 6, 9}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{ - this::addClassicToMachineList, - this::addElementalInputToMachineList, - this::addElementalOutputToMachineList, - this::addElementalMufflerToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4, 4, 4}; - private static final String[] description = new String[]{ - EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.0"),//1 - Classic Hatches or High Power Casing - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.1"),//2 - Elemental Input Hatches or Molecular Casing - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.2"),//3 - Elemental Output Hatches or Molecular Casing - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.3"),//4 - Elemental Overflow Hatches or Molecular Casing - translateToLocal("gt.blockmachines.multimachine.em.collider.hint.4"),//General - Another Controller facing opposite direction - }; - //endregion - - public GT_MetaTileEntity_EM_collider(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_collider(String aName) { - super(aName); - } - - public static void setValues(int heliumPlasmaValue) { - double MASS_TO_EU_PARTIAL = heliumPlasmaValue / 1.75893000478707E07;//mass diff - MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20; - STARTUP_COST = -heliumPlasmaValue * 10000; - KEEPUP_COST = -heliumPlasmaValue; - } - - protected double fuse(GT_MetaTileEntity_EM_collider partner) { - if (partner.stack != null && stack != null) {//todo add single event mode as an option - boolean check = stack.definition.fusionMakesEnergy(stack.getEnergy()) && - partner.stack.definition.fusionMakesEnergy(partner.stack.getEnergy()); - - cElementalInstanceStack stack2 = partner.stack; - double preMass = stack2.getMass() + stack.getMass(); - //System.out.println("preMass = " + preMass); - - cElementalInstanceStackMap map = new cElementalInstanceStackMap(); - IColliderHandler colliderHandler; - if (stack2.definition.getClassType() > stack.definition.getClassType()) {//always bigger first - colliderHandler = FUSE_HANDLERS.get((stack2.definition.getClassType() << 16) | stack.definition.getClassType()); - if (handleRecipe(stack2, map, colliderHandler)) return 0; - } else { - colliderHandler = FUSE_HANDLERS.get((stack.definition.getClassType() << 16) | stack2.definition.getClassType()); - if (handleRecipe(stack2, map, colliderHandler)) return 0; - } - for (cElementalInstanceStack newStack : map.values()) { - check &= newStack.definition.fusionMakesEnergy(newStack.getEnergy()); - } - //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); - outputEM = new cElementalInstanceStackMap[]{map}; - - partner.stack = stack = null; - //System.out.println("check = " + check); - //System.out.println("preMass-map.getMass() = " + (preMass - map.getMass())); - return check ? preMass - map.getMass() : - Math.min(preMass - map.getMass(), 0); - } - return 0; - } - - private boolean handleRecipe(cElementalInstanceStack stack2, cElementalInstanceStackMap map, IColliderHandler colliderHandler) { - if (colliderHandler != null && eTier >= colliderHandler.getRequiredTier()) { - colliderHandler.collide(stack2, stack, map); - } else { - map.putUnifyAll(stack, stack2); - outputEM = new cElementalInstanceStackMap[]{map}; - return true; - } - return false; - } - - protected GT_MetaTileEntity_EM_collider getPartner() { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; - IGregTechTileEntity gregTechBaseTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir, yDir, zDir); - if (gregTechBaseTileEntity != null) { - IMetaTileEntity gregTechMetaTileEntity = gregTechBaseTileEntity.getMetaTileEntity(); - return gregTechMetaTileEntity instanceof GT_MetaTileEntity_EM_collider && - ((GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity).mMachine && - gregTechBaseTileEntity.getBackFacing() == iGregTechTileEntity.getFrontFacing() ? - (GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity : null; - } - return null; - } - - protected final boolean isMaster() { - return getBaseMetaTileEntity().getFrontFacing() % 2 == 0; - } - - private void makeEU(double massDiff) { - plasmaEnergy += massDiff * MASS_TO_EU_INSTANT; - System.out.println("plasmaEnergy = " + plasmaEnergy); - } - - private cElementalInstanceStackMap tickStack() { - if (stack == null) { - return null; - } - cElementalInstanceStackMap newInstances = stack.decay(1, stack.age += 1, 0); - if (newInstances == null) { - stack.nextColor(); - } else { - stack = newInstances.remove(newInstances.getLast().definition); - } - return newInstances; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_collider(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 2; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 2; - if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir) != sBlockCasingsTT) { - eTier = 0; - return false; - } - - if (iGregTechTileEntity.getMetaIDOffset(xDir, 0, zDir) == 8) { - eTier = 1; - } else if (iGregTechTileEntity.getMetaIDOffset(xDir, 0, zDir) == 9) { - eTier = 2; - } else { - eTier = 0; - return false; - } - - boolean test; - switch (eTier) { - case 1: - test = structureCheck_EM(shape, blockType, blockMeta1, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 11, 1, 18); - break; - case 2: - test = structureCheck_EM(shape, blockType, blockMeta2, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 11, 1, 18); - break; - default: - eTier = 0; - return false; - } - if (test) { - return true; - } - eTier = 0; - return false; - } - - @Override - public boolean checkRecipe_EM(ItemStack itemStack) { - GT_MetaTileEntity_EM_collider partner = getPartner(); - if (partner == null) { - return false; - } - mEfficiencyIncrease = 10000; - if (started) { - if (stack == null) { - for (GT_MetaTileEntity_Hatch_InputElemental inputElemental : eInputHatches) { - cElementalInstanceStackMap container = inputElemental.getContainerHandler(); - if (container.isEmpty()) { - continue; - } - stack = container.remove(container.getFirst().definition); - long eut = KEEPUP_COST + (long) (KEEPUP_COST * Math.abs(stack.getMass() / dAtomDefinition.getSomethingHeavy().getMass())) / 2; - if (eut < Integer.MIN_VALUE + 7) { - return false; - } - mMaxProgresstime = 20; - mEUt = (int) eut; - eAmpereFlow = 5; - return true; - } - mMaxProgresstime = 20; - mEUt = KEEPUP_COST; - eAmpereFlow = 1; - return true; - } - mMaxProgresstime = 20; - mEUt = KEEPUP_COST; - eAmpereFlow = 2; - return true; - } else { - started = true; - mMaxProgresstime = 20; - mEUt = STARTUP_COST; - eAmpereFlow = 10; - return true; - } - } - - @Override - public void outputAfterRecipe_EM() { - GT_MetaTileEntity_EM_collider partner = getPartner(); - if (partner == null) { - if (stack != null) { - cleanMassEM_EM(stack.getMass()); - stack = null; - } - return; - } - if (isMaster()) { - switch ((int) mode.get()) { - case FUSE_MODE: - makeEU(fuse(partner)); - break; - case COLLIDE_MODE: - //collide(partner);//todo - break; - default: { - outputEM = new cElementalInstanceStackMap[2]; - outputEM[1] = tickStack(); - if (outputEM[1] == null) { - outputEM[1] = partner.tickStack(); - } else { - cElementalInstanceStackMap map = partner.tickStack(); - if (map != null) { - outputEM[1].putUnifyAll(map); - } - } - } - } - if (outputEM != null) { - for (int i = 0, lim = Math.min(outputEM.length, eOutputHatches.size()); i < lim; i++) { - if (outputEM[i] != null) { - eOutputHatches.get(i).getContainerHandler().putUnifyAll(outputEM[i]); - outputEM[i] = null; - } - } - } - } - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - translateToLocal("gt.blockmachines.multimachine.em.collider.desc.0"),//Collide matter at extreme velocities. - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.collider.desc.1")//Faster than light*!!! - }; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE"); - ScreenOFF_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_SLAVE"); - ScreenON_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE_SLAVE"); - super.registerIcons(aBlockIconRegister); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - if (aFacing % 2 == 0) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; - } else { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedTexture(aActive ? ScreenON_Slave : ScreenOFF_Slave)}; - } - } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4]}; - } - - @Override - protected void parametersInstantiation_EM() { - Parameters.Group hatch_0 = parametrization.getGroup(0); - mode = hatch_0.makeInParameter(0, FUSE_MODE, MODE_NAME, MODE_STATUS); - } - - @Override - public void parametersStatusesWrite_EM(boolean machineBusy) { - if (isMaster()) { - super.parametersStatusesWrite_EM(machineBusy); - } - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setByte("eTier", eTier);//collider tier - aNBT.setBoolean("eStarted", started); - if (stack != null) { - aNBT.setTag("eStack", stack.toNBT()); - } - aNBT.setLong("ePlasmaEnergy", plasmaEnergy); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - eTier = aNBT.getByte("eTier");//collider tier - started = aNBT.getBoolean("eStarted"); - if (aNBT.hasKey("eStack")) { - stack = cElementalInstanceStack.fromNBT(aNBT.getCompoundTag("eStack")); - } - plasmaEnergy = aNBT.getLong("ePlasmaEnergy"); - } - - @Override - public void stopMachine() { - started = false; - if (stack != null) { - cleanMassEM_EM(stack.getMass()); - stack = null; - } - super.stopMachine(); - } - - @Override - protected void afterRecipeCheckFailed() { - started = false; - if (stack != null) { - cleanMassEM_EM(stack.getMass()); - stack = null; - } - getBaseMetaTileEntity().disableWorking(); - super.afterRecipeCheckFailed(); - } - - @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (!aBaseMetaTileEntity.isAllowedToWork()) { - started = false; - } - super.onPreTick(aBaseMetaTileEntity, aTick); - } - - @Override - public void construct(int stackSize, boolean hintsOnly) { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; - if (hintsOnly) { - TecTech.proxy.hint_particle(iGregTechTileEntity.getWorld(), - iGregTechTileEntity.getXCoord() + xDir, - iGregTechTileEntity.getYCoord() + yDir, - iGregTechTileEntity.getZCoord() + zDir, - TT_Container_Casings.sHintCasingsTT, 12); - } else { - if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir).getMaterial() == Material.air) { - iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); - } - } - if ((stackSize & 1) == 1) { - StructureBuilderExtreme(shape, blockType, blockMeta1, 11, 1, 18, iGregTechTileEntity, this, hintsOnly); - } else { - StructureBuilderExtreme(shape, blockType, blockMeta2, 11, 1, 18, iGregTechTileEntity, this, hintsOnly); - } - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } -}
\ No newline at end of file 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 edb581179e..6ad3282d9d 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 @@ -1,16 +1,17 @@ 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.Util; -import com.github.technus.tectech.Vec3pos; import com.github.technus.tectech.mechanics.dataTransport.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.hatch.GT_MetaTileEntity_Hatch_Rack; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -20,7 +21,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -28,12 +28,15 @@ import net.minecraft.util.ResourceLocation; import java.util.ArrayList; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.CommonValues.MULTI_CHECK_AT; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -48,38 +51,61 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB //endregion //region structure - private static final String[][] front = new String[][]{{"A ", "A ", "A. ", "A ",},}; - private static final String[][] terminator = new String[][]{{"A ", "A ", "A ", "A ",},}; - private static final String[][] cap = new String[][]{{"-01", "A22", "A22", "-01",},}; - private static final String[][] slice = new String[][]{{"-01", "A!2", "A!2", "-01",},}; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{2, 1, 3}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addToMachineList, this::addRackToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{1, 3}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.computer.hint.0"),//1 - Classic/Data Hatches or Computer casing translateToLocal("gt.blockmachines.multimachine.em.computer.hint.1"),//2 - Rack Hatches or Advanced computer casing }; + + private static final IStructureDefinition<GT_MetaTileEntity_EM_computer> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_computer>builder() + .addShape("front", transpose(new String[][]{ + {" AA"}, + {" AA"}, + {" ~A"}, + {" AA"} + })) + .addShape("cap", transpose(new String[][]{ + {"-CB"}, + {" DD"}, + {" DD"}, + {"-CB"} + })) + .addShape("slice", transpose(new String[][]{ + {"-CB"}, + {" ED"}, + {" ED"}, + {"-CB"} + })) + .addShape("back", transpose(new String[][]{ + {" AA"}, + {" AA"}, + {" AA"}, + {" AA"} + })) + .addElement('B', ofBlock(sBlockCasingsTT, 1)) + .addElement('C', ofBlock(sBlockCasingsTT, 2)) + .addElement('D', ofBlock(sBlockCasingsTT, 3)) + .addElement('A', ofHatchAdderOptional(GT_MetaTileEntity_EM_computer::addToMachineList, textureOffset + 1, 1, sBlockCasingsTT, 1)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_computer::addRackToMachineList, textureOffset + 3, 2, sBlockCasingsTT, 3)) + .build(); //endregion //region parameters protected Parameters.Group.ParameterIn overclock, overvolt; protected Parameters.Group.ParameterOut maxCurrentTemp, availableData; - private static final INameFunction<GT_MetaTileEntity_EM_computer> OC_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.em.computer.cfgi.0");//Overclock ratio - private static final INameFunction<GT_MetaTileEntity_EM_computer> OV_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.em.computer.cfgi.1");//Overvoltage ratio - private static final INameFunction<GT_MetaTileEntity_EM_computer> MAX_TEMP_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.em.computer.cfgo.0");//Current max. heat - private static final INameFunction<GT_MetaTileEntity_EM_computer> COMPUTE_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.em.computer.cfgo.1");//Produced computation - private static final IStatusFunction<GT_MetaTileEntity_EM_computer> OC_STATUS = + private static final INameFunction<GT_MetaTileEntity_EM_computer> OC_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.em.computer.cfgi.0");//Overclock ratio + private static final INameFunction<GT_MetaTileEntity_EM_computer> OV_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.em.computer.cfgi.1");//Overvoltage ratio + private static final INameFunction<GT_MetaTileEntity_EM_computer> MAX_TEMP_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.em.computer.cfgo.0");//Current max. heat + private static final INameFunction<GT_MetaTileEntity_EM_computer> COMPUTE_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.em.computer.cfgo.1");//Produced computation + private static final IStatusFunction<GT_MetaTileEntity_EM_computer> OC_STATUS = (base, p) -> LedStatus.fromLimitsInclusiveOuterBoundary(p.get(), 0, 1, 1, 3); - private static final IStatusFunction<GT_MetaTileEntity_EM_computer> OV_STATUS = + private static final IStatusFunction<GT_MetaTileEntity_EM_computer> OV_STATUS = (base, p) -> LedStatus.fromLimitsInclusiveOuterBoundary(p.get(), .7, .8, 1.2, 2); private static final IStatusFunction<GT_MetaTileEntity_EM_computer> MAX_TEMP_STATUS = (base, p) -> LedStatus.fromLimitsInclusiveOuterBoundary(p.get(), -10000, 0, 0, 5000); - private static final IStatusFunction<GT_MetaTileEntity_EM_computer> COMPUTE_STATUS = (base, p) -> { + private static final IStatusFunction<GT_MetaTileEntity_EM_computer> COMPUTE_STATUS = (base, p) -> { if (base.eAvailableData < 0) { return STATUS_TOO_LOW; } @@ -124,27 +150,27 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } } eRacks.clear(); - if (!structureCheck_EM(front, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, 0)) { + if (!structureCheck_EM("front", 1, 2, 0)) { return false; } - if (!structureCheck_EM(cap, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, -1)) { + if (!structureCheck_EM("cap", 1, 2, -1)) { return false; } byte offset = -2, totalLen = 4; while (offset > -16) { - if (!structureCheck_EM(slice, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, offset)) { + if (!structureCheck_EM("slice", 1, 2, offset)) { break; } totalLen++; offset--; } - if (totalLen > 16) { + if (totalLen > 17) { return false; } - if (!structureCheck_EM(cap, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, ++offset)) { + if (!structureCheck_EM("cap", 1, 2, ++offset)) { return false; } - if (!structureCheck_EM(terminator, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, --offset)) { + if (!structureCheck_EM("back", 1, 2, --offset)) { return false; } eCertainMode = (byte) Math.min(totalLen / 3, 5); @@ -157,11 +183,28 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if (aBaseMetaTileEntity.isServerSide() && mMachine && !aBaseMetaTileEntity.isActive() && aTick % 20 == MULTI_CHECK_AT) { + double maxTemp = 0; + for (GT_MetaTileEntity_Hatch_Rack rack : eRacks) { + if (!GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) { + continue; + } + if (rack.heat > maxTemp) { + maxTemp = rack.heat; + } + } + maxCurrentTemp.set(maxTemp); + } + } + + @Override public boolean checkRecipe_EM(ItemStack itemStack) { parametrization.setToDefaults(false, true); eAvailableData = 0; - double maxTemp = 0; - double overClockRatio = overclock.get(); + double maxTemp = 0; + double overClockRatio = overclock.get(); double overVoltageRatio = overvolt.get(); if (Double.isNaN(overClockRatio) || Double.isNaN(overVoltageRatio)) { return false; @@ -175,7 +218,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB return false; } short thingsActive = 0; - int rackComputation; + int rackComputation; for (GT_MetaTileEntity_Hatch_Rack rack : eRacks) { if (!GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) { @@ -224,7 +267,10 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public void outputAfterRecipe_EM() { if (!eOutputData.isEmpty()) { - Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); + Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity().getXCoord(), + getBaseMetaTileEntity().getYCoord(), + getBaseMetaTileEntity().getZCoord()); + QuantumDataPacket pack = new QuantumDataPacket(eAvailableData / eOutputData.size()).unifyTraceWith(pos); if (pack == null) { return; @@ -265,7 +311,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3]}; } @@ -335,22 +381,27 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { + public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity igt = getBaseMetaTileEntity(); - StructureBuilderExtreme(front, blockType, blockMeta, 1, 2, 0, igt, this, hintsOnly); - StructureBuilderExtreme(cap, blockType, blockMeta, 1, 2, -1, igt, this, hintsOnly); + structureBuild_EM("front", 1, 2, 0, stackSize, hintsOnly); + structureBuild_EM("cap", 1, 2, -1, stackSize, hintsOnly); byte offset = -2; - for (int rackSlices = Math.min(stackSize, 12); rackSlices > 0; rackSlices--) { - StructureBuilderExtreme(slice, blockType, blockMeta, 1, 2, offset--, igt, this, hintsOnly); + for (int rackSlices = Math.min(stackSize.stackSize, 12); rackSlices > 0; rackSlices--) { + structureBuild_EM("slice", 1, 2, offset--, stackSize, hintsOnly); } - StructureBuilderExtreme(cap, blockType, blockMeta, 1, 2, offset--, igt, this, hintsOnly); - StructureBuilderExtreme(terminator, blockType, blockMeta, 1, 2, offset, igt, this, hintsOnly); + structureBuild_EM("cap", 1, 2, offset--, stackSize, hintsOnly); + structureBuild_EM("back", 1, 2, offset, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_computer> getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} 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 263a46a9d3..014e2b3a65 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 @@ -1,26 +1,27 @@ 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 com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -35,30 +36,30 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB //endregion //region structure - private static final String[][] shape = new String[][]{ - {"A000", "0 0", "0 . 0", "0 0", "A000",}, - {"00000", "00000", "00000", "00000", "00000",}, - {"0C0", "A!!!", "A!1!", "A!!!", "0C0",}, - {"22222", "22222", "22122", "22222", "22222",}, - {"23432", "33333", "43134", "33333", "23432",}, - {"23332", "33333", "33533", "33333", "23332",}, - {"23432", "33333", "43134", "33333", "23432",}, - {"22222", "22222", "22122", "22222", "22222",}, - {"0C0", "A!!!", "A!1!", "A!!!", "0C0",}, - {"00000", "00000", "00000", "00000", "00000",}, - {"A000", "0 0", "0 0", "0 0", "A000",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 10, 5, 0, 6, 9}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.crafter.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.crafter.hint.1"),//2 - Elemental Hatches or Molecular Casing }; + + private static final IStructureDefinition<GT_MetaTileEntity_EM_crafting> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_crafting>builder() + .addShape("main", transpose(new String[][]{ + {" AAA ", "AAAAA", "A A", "BBBBB", "BGCGB", "BGGGB", "BGCGB", "BBBBB", "A A", "AAAAA", " AAA "}, + {"AHHHA", "AAAAA", " FFF ", "BBBBB", "GGGGG", "GGGGG", "GGGGG", "BBBBB", " FFF ", "AAAAA", "AHHHA"}, + {"AH~HA", "AAAAA", " FEF ", "BBEBB", "CGEGC", "GGDGG", "CGEGC", "BBEBB", " FEF ", "AAAAA", "AHHHA"}, + {"AHHHA", "AAAAA", " FFF ", "BBBBB", "GGGGG", "GGGGG", "GGGGG", "BBBBB", " FFF ", "AAAAA", "AHHHA"}, + {" AAA ", "AAAAA", "A A", "BBBBB", "BGCGB", "BGGGB", "BGCGB", "BBBBB", "A A", "AAAAA", " AAA "} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofBlock(sBlockCasingsTT, 6)) + .addElement('D', ofBlock(sBlockCasingsTT, 9)) + .addElement('E', ofBlock(sBlockCasingsTT, 10)) + .addElement('G', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_crafting::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_crafting::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .build(); //endregion public GT_MetaTileEntity_EM_crafting(int aID, String aName, String aNameRegional) { @@ -76,7 +77,7 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + return structureCheck_EM("main", 2, 2, 0); } @Override @@ -99,18 +100,23 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 2, 2, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_crafting> getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index f18fe57b6f..9a9747f012 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -1,16 +1,16 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputDataItems; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputDataItems; 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 com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -19,7 +19,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess; -import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -27,37 +26,41 @@ import net.minecraft.util.ResourceLocation; import java.util.ArrayList; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; 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.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region variables private final ArrayList<GT_MetaTileEntity_Hatch_OutputDataItems> eStacksDataOutputs = new ArrayList<>(); - private final ArrayList<GT_MetaTileEntity_Hatch_DataAccess> eDataAccessHatches = new ArrayList<>(); + private final ArrayList<GT_MetaTileEntity_Hatch_DataAccess> eDataAccessHatches = new ArrayList<>(); //endregion //region structure - private static final String[][] shape = new String[][]{ - {"0 0", "0 . 0", "0 0",}, - {"0!!!0", "01110", "0!!!0",}, - {"0!!!0", "0!!!0", "0!!!0",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{2, 1}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addDataBankHatchToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 1}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 1}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.databank.hint.0"),//1 - Classic Hatches or high power casing translateToLocal("gt.blockmachines.multimachine.em.databank.hint.1"),//2 - Data Access/Data Bank Master Hatches or computer casing }; + + private static final IStructureDefinition<GT_MetaTileEntity_EM_dataBank> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_dataBank>builder() + .addShape("main", transpose(new String[][]{ + {"BCCCB", "BDDDB", "BDDDB"}, + {"BC~CB", "BAAAB", "BDDDB"}, + {"BCCCB", "BDDDB", "BDDDB"} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 1)) + .addElement('B', ofBlock(sBlockCasingsTT, 2)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_dataBank::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_dataBank::addDataBankHatchToMachineList, textureOffset + 1, 2, sBlockCasingsTT, 1)) + .build(); //endregion public GT_MetaTileEntity_EM_dataBank(int aID, String aName, String aNameRegional) { @@ -77,7 +80,7 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { eDataAccessHatches.clear(); eStacksDataOutputs.clear(); - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 1, 0); + return structureCheck_EM("main", 2, 1, 0); } @Override @@ -138,7 +141,7 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1], new TT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1], new TT_RenderedExtendedFacingTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1]}; } @@ -170,12 +173,17 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 2, 1, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_dataBank> getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} 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 ae9ee1c524..18b0047ef4 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,13 +1,17 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -16,9 +20,9 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.util.GT_Utility; import ic2.core.init.MainConfig; import ic2.core.util.ConfigUtil; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -26,13 +30,16 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.CommonValues.VN; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; 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.thing.metaTileEntity.multi.base.LedStatus.STATUS_OK; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.STATUS_TOO_LOW; +import static com.github.technus.tectech.util.CommonValues.VN; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -44,36 +51,36 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10; - private static final double URANIUM_MASS_TO_EU_PARTIAL = ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF; + public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10* EM_COUNT_PER_MATERIAL_AMOUNT; + private static final double URANIUM_MASS_TO_EU_PARTIAL = ConfigUtil.getDouble(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF; public static final double URANIUM_MASS_TO_EU_INSTANT = URANIUM_MASS_TO_EU_PARTIAL * 20; private String clientLocale = "en_US"; //endregion //region structure - private static final String[][] shape = new String[][]{ - {"0C0", "A ", "A . ", "A ", "0C0",}, - {"00000", "00000", "00000", "00000", "00000",}, - {"0C0", "A!!!", "A!0!", "A!!!", "0C0",}, - {"01110", "12221", "12221", "12221", "01110",}, - {"01310", "12221", "32223", "12221", "01310",}, - {"01110", "12221", "12221", "12221", "01110",}, - {"0C0", "A!!!", "A!0!", "A!!!", "0C0",}, - {"00000", "00000", "00000", "00000", "00000",}, - {"0C0", "A ", "A ", "A ", "0C0",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 5, 8, 6}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.decay.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.decay.hint.1"),//2 - Elemental Hatches or Molecular Casing }; + + private static final IStructureDefinition<GT_MetaTileEntity_EM_decay> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_decay>builder() + .addShape("main",transpose(new String[][]{ + {"A A","AAAAA","A A","ABBBA","ABCBA","ABBBA","A A","AAAAA","A A"}, + {" FFF ","AAAAA"," EEE ","BDDDB","BDDDB","BDDDB"," EEE ","AAAAA"," FFF "}, + {" F~F ","AAAAA"," EAE ","BDDDB","CDDDC","BDDDB"," EAE ","AAAAA"," FFF "}, + {" FFF ","AAAAA"," EEE ","BDDDB","BDDDB","BDDDB"," EEE ","AAAAA"," FFF "}, + {"A A","AAAAA","A A","ABBBA","ABCBA","ABBBA","A A","AAAAA","A A"} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofBlock(sBlockCasingsTT, 6)) + .addElement('D', ofBlock(sBlockCasingsTT, 8)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_decay::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_decay::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .build(); //endregion //region parameters @@ -102,57 +109,53 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + return structureCheck_EM("main", 2, 2, 0); } @Override public boolean checkRecipe_EM(ItemStack itemStack) { - cElementalInstanceStackMap map = getInputsClone_EM(); + EMInstanceStackMap map = getInputsClone_EM(); if (map != null && map.hasStacks()) { for (GT_MetaTileEntity_Hatch_InputElemental i : eInputHatches) { - i.getContainerHandler().clear(); + i.getContentHandler().clear(); } return startRecipe(map); } return false; } - private boolean startRecipe(cElementalInstanceStackMap input) { + private boolean startRecipe(EMInstanceStackMap input) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; - outputEM = new cElementalInstanceStackMap[2]; + outputEM = new EMInstanceStackMap[2]; outputEM[0] = input; - outputEM[1] = new cElementalInstanceStackMap(); - + outputEM[1] = new EMInstanceStackMap(); - for (cElementalInstanceStack stack : outputEM[0].values()) { - if (stack.getEnergy() == 0 && stack.definition.decayMakesEnergy(1) - && getBaseMetaTileEntity().decreaseStoredEnergyUnits( - (long) (stack.getEnergySettingCost(1) * URANIUM_MASS_TO_EU_INSTANT), false)) { + for (EMInstanceStack stack : outputEM[0].valuesToArray()) { + if (stack.getEnergy() == 0 && stack.getDefinition().decayMakesEnergy(1) && + getBaseMetaTileEntity().decreaseStoredEnergyUnits( + (long) (stack.getEnergySettingCost(1) * URANIUM_MASS_TO_EU_INSTANT), false)) { stack.setEnergy(1); - } else if (!stack.definition.decayMakesEnergy(stack.getEnergy())) { - outputEM[0].remove(stack.definition); + } else if (!stack.getDefinition().decayMakesEnergy(stack.getEnergy())) { + outputEM[0].removeKey(stack.getDefinition()); outputEM[1].putReplace(stack); } - //System.out.println(stack.definition.getSymbol()+" "+stack.amount); } - float preMass = outputEM[0].getMass(); - outputEM[0].tickContent(1, 0, 1); - double energyDose = ((preMass - outputEM[0].getMass()) * URANIUM_MASS_TO_EU_PARTIAL); eAmpereFlow = (long) ampereFlow.get(); if (eAmpereFlow <= 0) { mEUt = 0; return false; } - mEUt = (int) (energyDose / eAmpereFlow); + double energyDose = -outputEM[0].tickContent(1, 0, 1) * URANIUM_MASS_TO_EU_PARTIAL; + mEUt = (int) ( energyDose / eAmpereFlow); return outputEM[0].hasStacks(); } @Override public void outputAfterRecipe_EM() { for (int i = 0; i < 2 && i < eOutputHatches.size(); i++) { - eOutputHatches.get(i).getContainerHandler().putUnifyAll(outputEM[i]); + eOutputHatches.get(i).getContentHandler().putUnifyAll(outputEM[i]); outputEM[i] = null; } } @@ -185,21 +188,30 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase return new String[]{ translateToLocalFormatted("tt.keyword.Progress", clientLocale) + ":", - EnumChatFormatting.GREEN + Integer.toString(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + - EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", translateToLocalFormatted("tt.keyphrase.Energy_Hatches", clientLocale) + ":", - EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", (mEUt <= 0 ? translateToLocalFormatted("tt.keyphrase.Probably_uses", clientLocale) + ": " : translateToLocalFormatted("tt.keyphrase.Probably_makes", clientLocale) + ": ") + - EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t at " + - EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", - translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + EnumChatFormatting.BLUE + eSafeVoid, - translateToLocalFormatted("tt.keyword.Computation", clientLocale) + ": " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET, + EnumChatFormatting.RED + GT_Utility.formatNumbers(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t at " + + EnumChatFormatting.RED + GT_Utility.formatNumbers(eAmpereFlow) + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eMaxAmpereFlow) + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + + EnumChatFormatting.BLUE + eSafeVoid, + translateToLocalFormatted("tt.keyword.Computation", clientLocale) + ": " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eAvailableData) + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(eRequiredData) + EnumChatFormatting.RESET, }; } @@ -214,7 +226,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; } @@ -239,17 +251,21 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase } else { return true; } - System.out.println(clientLocale); return true; } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 2, 2, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_decay> getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} 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 27b770c88b..5a045102ef 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,21 +1,21 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.iExchangeInfo; +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMDequantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.OreDictionaryStack; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; @@ -24,13 +24,16 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; +import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass; import static com.github.technus.tectech.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.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -39,21 +42,22 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {"010", "111", "010",}, - {"\"\"\"", "\"1\"", "\"\"\"",}, - {"121", "2!2", "121",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; - private static final byte[] blockMeta = new byte[]{0, 4, 0}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{ - this::addClassicToMachineList, - this::addElementalInputToMachineList, - this::addElementalMufflerToMachineList}; - 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 IStructureDefinition<GT_MetaTileEntity_EM_dequantizer> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_dequantizer>builder() + .addShape("main", transpose(new String[][]{ + {"CCC", "ABA", "EEE", "BDB"}, + {"C~C", "BBB", "EBE", "DFD"}, + {"CCC", "ABA", "EEE", "BDB"} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 0)) + .addElement('B', ofBlock(sBlockCasingsTT, 4)) + .addElement('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_dequantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('F', ofHatchAdder(GT_MetaTileEntity_EM_dequantizer::addElementalInputToMachineList, textureOffset + 4, 2)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_dequantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) + .build(); + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.emtomatter.hint.0"),//1 - Classic Hatches or High Power Casing" @@ -70,11 +74,11 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo super(aName); } - private void startRecipe(iHasElementalDefinition from, long energy) { + private void startRecipe(IEMStack from, long energy) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; - float mass = from.getMass(); - float euMult = Math.abs(mass / refMass); + double mass = from.getMass(); + double euMult = Math.abs(mass / refMass); eAmpereFlow = (int) Math.ceil(Math.sqrt(Math.sqrt(euMult))); if (mass > refUnstableMass || from.getDefinition().getRawTimeSpan(energy) < STABLE_RAW_LIFE_TIME) { mEUt = (int) -V[8]; @@ -90,42 +94,29 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } @Override public boolean checkRecipe_EM(ItemStack itemStack) { for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - cElementalInstanceStackMap map = in.getContainerHandler(); - for (cElementalInstanceStack stack : map.values()) { - iExchangeInfo info = stack.getDefinition().someAmountIntoFluidStack(); - if (info != null) { - if (map.removeAllAmounts(false, (iHasElementalDefinition) info.input())) { - mOutputFluids = new FluidStack[]{(FluidStack) info.output()}; - startRecipe((iHasElementalDefinition) info.input(), stack.getEnergy()); - return true; - } - } - - info = stack.getDefinition().someAmountIntoItemsStack(); - if (info != null) { - if (map.removeAllAmounts(false, (iHasElementalDefinition) info.input())) { - mOutputItems = new ItemStack[]{(ItemStack) info.output()}; - startRecipe((iHasElementalDefinition) info.input(), stack.getEnergy()); - return true; - } - } - - info = stack.getDefinition().someAmountIntoOredictStack(); - if (info != null) { - if (map.removeAllAmounts(false, (iHasElementalDefinition) info.input())) { - ArrayList<ItemStack> items = OreDictionary.getOres(((aOredictDequantizationInfo) info).out); + EMInstanceStackMap map = in.getContentHandler(); + for (EMInstanceStack stack : map.valuesToArray()) { + EMDequantizationInfo emDequantizationInfo = TecTech.transformationInfo.getInfoMap().get(stack.getDefinition()); + if (emDequantizationInfo != null && emDequantizationInfo.getStack() != null && map.removeAllAmounts(emDequantizationInfo.getInput())) { + Object out = emDequantizationInfo.getStack(); + if (out instanceof ItemStack) { + mOutputItems = new ItemStack[]{emDequantizationInfo.getItem()}; + } else if (out instanceof FluidStack) { + mOutputFluids = new FluidStack[]{emDequantizationInfo.getFluid()}; + } else if (out instanceof OreDictionaryStack) { + ArrayList<ItemStack> items = OreDictionary.getOres(OreDictionary.getOreName(emDequantizationInfo.getOre().getOreId())); if (items != null && !items.isEmpty()) { mOutputItems = new ItemStack[]{items.get(0)}; - startRecipe((iHasElementalDefinition) info.input(), stack.getEnergy()); - return true; } } + startRecipe(emDequantizationInfo.getInput(), stack.getEnergy()); + return true; } } } @@ -148,12 +139,17 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_dequantizer> getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} 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 4e8e8d27ec..f6833d2cb9 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 @@ -1,32 +1,33 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import cofh.api.energy.IEnergyContainerItem; -import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; 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 com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; -import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; 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.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.GregTech_API.mEUtoRF; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -34,21 +35,24 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure - private static final String[][] shape = new String[][]{ - {" ", "000", "1.1", "000", " ",}, - {" ", "010", "111", "010", " ",}, - {" ", "000", "111", "000", " ",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{7, 4}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.infuser.hint"),//1 - Classic Hatches or High Power Casing }; + + private static final IStructureDefinition<GT_MetaTileEntity_EM_infuser> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_infuser>builder() + .addShape("main", transpose(new String[][]{ + {"CCC", "CCC", "CCC"}, + {"BBB", "BAB", "BBB"}, + {"A~A", "AAA", "AAA"}, + {"BBB", "BAB", "BBB"}, + {"CCC", "CCC", "CCC"} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 7)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_infuser::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .build(); //endregion public GT_MetaTileEntity_EM_infuser(int aID, String aName, String aNameRegional) { @@ -112,7 +116,7 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, 0); + return structureCheck_EM("main", 1, 2, 0); } @Override @@ -182,12 +186,17 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 1, 2, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_infuser> getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} 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 aba87eaf6b..23e7267388 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,23 +1,26 @@ 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.multi.base.*; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; -import static gregtech.api.enums.GT_Values.E; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -26,34 +29,36 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {"000", "000", "000",}, - {"!!!", "!0!", "!!!",}, - {"!!!", "!!!", "!!!",}, - }; - private static final String[][] shapeBig = new String[][]{ - {E, "A ", "A . ", "A ",}, - {"A!!!", "!000!", "!010!", "!000!", "A!!!",}, - {"!!!!!", "!000!", "!000!", "!000!", "!!!!!",}, - {"A!!!", "!000!", "!000!", "!000!", "A!!!",}, - {"A!!!", "!!!!!", "!!!!!", "!!!!!", "A!!!",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 5}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.junction.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.junction.hint.1"),//2 - Elemental Hatches or Molecular Casing }; + + private static final IStructureDefinition<GT_MetaTileEntity_EM_junction> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_junction>builder() + .addShape("main", new String[][]{ + {"CCC", "C~C", "CCC"}, + {"AAA", "AAA", "AAA"}, + {"DDD", "DAD", "DDD"}, + {"DDD", "DDD", "DDD"} + }) + .addShape("mainBig", new String[][]{ + {" A ", " CCC ", "AC~CA", " CCC ", " A "}, + {" DDD ", "DAAAD", "DAAAD", "DAAAD", " DDD "}, + {"ADDDA", "DAAAD", "DABAD", "DAAAD", "ADDDA"}, + {" DDD ", "DAAAD", "DAAAD", "DAAAD", " DDD "}, + {" A ", "DDDDD", "ADDDA", "DDDDD", " A "} + }) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_junction::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_junction::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .build(); //endregion //region parameters - private static final INameFunction<GT_MetaTileEntity_EM_junction> ROUTE_NAME = + private static final INameFunction<GT_MetaTileEntity_EM_junction> ROUTE_NAME = (base, p) -> (p.parameterId() == 0 ? translateToLocal("tt.keyword.Source") + " " : translateToLocal("tt.keyword.Destination") + " ") + p.hatchId(); private static final IStatusFunction<GT_MetaTileEntity_EM_junction> SRC_STATUS = (base, p) -> { @@ -62,7 +67,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB v = (int) v; if (v < 0) return STATUS_TOO_LOW; if (v == 0) return STATUS_NEUTRAL; - if (v >= base.eInputHatches.size()) return STATUS_TOO_HIGH; + if (v > base.eOutputHatches.size()) return STATUS_TOO_HIGH; return STATUS_OK; }; private static final IStatusFunction<GT_MetaTileEntity_EM_junction> DST_STATUS = @@ -73,13 +78,13 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB v = (int) v; if (v < 0) return STATUS_TOO_LOW; if (v == 0) return STATUS_LOW; - if (v >= base.eInputHatches.size()) return STATUS_TOO_HIGH; + if (v > base.eInputHatches.size()) return STATUS_TOO_HIGH; return STATUS_OK; } return STATUS_NEUTRAL; }; - protected Parameters.Group.ParameterIn[] src; - protected Parameters.Group.ParameterIn[] dst; + protected Parameters.Group.ParameterIn[] src; + protected Parameters.Group.ParameterIn[] dst; //endregion public GT_MetaTileEntity_EM_junction(int aID, String aName, String aNameRegional) { @@ -97,11 +102,11 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - int meta = iGregTechTileEntity.getMetaIDAtSide(GT_Utility.getOppositeSide(iGregTechTileEntity.getFrontFacing())); + int meta = iGregTechTileEntity.getMetaIDAtSideAndDistance(GT_Utility.getOppositeSide(iGregTechTileEntity.getFrontFacing()),2); if (meta == 4) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } else if (meta == 5) { - return structureCheck_EM(shapeBig, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + return structureCheck_EM("mainBig", 2, 2, 0); } return false; } @@ -109,7 +114,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override public boolean checkRecipe_EM(ItemStack itemStack) { for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - if (in.getContainerHandler().hasStacks()) { + if (in.getContentHandler().hasStacks()) { mEUt = -(int) V[8]; eAmpereFlow = 1 + (eInputHatches.size() + eOutputHatches.size() >> 1); mMaxProgresstime = 20; @@ -133,8 +138,8 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB if (inIndex < 0 || inIndex >= eInputHatches.size()) { continue; } - int outIndex = (int) dst - 1; - GT_MetaTileEntity_Hatch_InputElemental in = eInputHatches.get(inIndex); + int outIndex = (int) dst - 1; + GT_MetaTileEntity_Hatch_InputElemental in = eInputHatches.get(inIndex); if (outIndex == -1) {//param==0 -> null the content cleanHatchContentEM_EM(in); } else { @@ -142,8 +147,8 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB continue; } GT_MetaTileEntity_Hatch_OutputElemental out = eOutputHatches.get(outIndex); - out.getContainerHandler().putUnifyAll(in.getContainerHandler()); - in.getContainerHandler().clear(); + out.getContentHandler().putUnifyAll(in.getContentHandler()); + in.getContentHandler().clear(); } } } @@ -169,12 +174,21 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + if ((stackSize.stackSize & 1) == 1) { + structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); + } else { + structureBuild_EM("mainBig", 2, 2, 0, stackSize, hintsOnly); + } + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_junction> getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} 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 4d65b67ed0..dc218da530 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 @@ -1,25 +1,23 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElementalDefinition; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aFluidQuantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aItemQuantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictQuantizationInfo; -import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMFluidQuantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMItemQuantizationInfo; +import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMOredictQuantizationInfo; import com.github.technus.tectech.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 com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; @@ -28,18 +26,21 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; -import static com.github.technus.tectech.Util.isInputEqual; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.DEFAULT_ENERGY_LEVEL; -import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; +import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.DEFAULT_ENERGY_LEVEL; +import static com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition.STABLE_RAW_LIFE_TIME; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refMass; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition.refUnstableMass; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullFluid; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; 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.CommonValues.V; +import static com.github.technus.tectech.util.Util.isInputEqual; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -48,21 +49,21 @@ import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {"010", "101", "010",}, - {"\"\"\"", "\"0\"", "\"\"\"",}, - {"202", "0!0", "202",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE}; - private static final byte[] blockMeta = new byte[]{4, 0, 0}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{ - this::addClassicToMachineList, - this::addElementalOutputToMachineList, - this::addElementalMufflerToMachineList}; - 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 IStructureDefinition<GT_MetaTileEntity_EM_quantizer> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_quantizer>builder() + .addShape("main", transpose(new String[][]{ + {"CCC", "BAB", "EEE", "DBD"}, + {"C~C", "ABA", "EBE", "BFB"}, + {"CCC", "BAB", "EEE", "DBD"} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 0)) + .addElement('B', ofBlock(sBlockCasingsTT, 4)) + .addElement('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('F', ofHatchAdder(GT_MetaTileEntity_EM_quantizer::addElementalOutputToMachineList, textureOffset + 4, 2)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_quantizer::addElementalMufflerToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) + .build(); + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.mattertoem.hint.0"),//1 - Classic Hatches or High Power Casing @@ -86,20 +87,20 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } @Override public boolean checkRecipe_EM(ItemStack itemStack) {//TODO implement instance quantization if (GregTech_API.sPostloadFinished) { ArrayList<ItemStack> storedInputs = getStoredInputs(); - ItemStack[] inI = storedInputs.toArray(nullItem); + ItemStack[] inI = storedInputs.toArray(nullItem); if (inI.length > 0) { for (ItemStack is : inI) { //ITEM STACK quantization - aItemQuantizationInfo aIQI = bTransformationInfo.itemQuantization.get(new aItemQuantizationInfo(is, false, null)); + EMItemQuantizationInfo aIQI = TecTech.transformationInfo.getItemQuantization().get(new EMItemQuantizationInfo(is, false, null)); if (aIQI == null) { - aIQI = bTransformationInfo.itemQuantization.get(new aItemQuantizationInfo(is, true, null));//todo check if works? + aIQI = TecTech.transformationInfo.getItemQuantization().get(new EMItemQuantizationInfo(is, true, null));//todo check if works? } if (aIQI == null) { //ORE DICT quantization //todo fix for uranium? @@ -108,12 +109,12 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (DEBUG_MODE) { TecTech.LOGGER.info("Quantifier-Ore-recipe " + is.getItem().getUnlocalizedName() + '.' + is.getItemDamage() + ' ' + OreDictionary.getOreName(ID)); } - aOredictQuantizationInfo aOQI = bTransformationInfo.oredictQuantization.get(ID); + EMOredictQuantizationInfo aOQI = TecTech.transformationInfo.getOredictQuantization().get(ID); if (aOQI == null) { continue; } - iHasElementalDefinition into = aOQI.output(); - if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aOQI.amount, is.getItemDamage())}, null, inI)) { + IEMStack into = aOQI.getOut(); + if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aOQI.getAmount(), is.getItemDamage())}, null, inI)) { startRecipe(into); return true; } @@ -123,7 +124,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (DEBUG_MODE) { TecTech.LOGGER.info("Quantifier-Item-recipe " + is.getItem().getUnlocalizedName() + '.' + is.getItemDamage()); } - iHasElementalDefinition into = aIQI.output(); + IEMStack into = aIQI.output(); if (into != null && isInputEqual(true, false, nullFluid, new ItemStack[]{new ItemStack(is.getItem(), aIQI.input().stackSize, is.getItemDamage())}, null, inI)) { startRecipe(into); return true; @@ -132,14 +133,14 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock } } ArrayList<FluidStack> storedFluids = getStoredFluids(); - FluidStack[] inF = storedFluids.toArray(nullFluid); + FluidStack[] inF = storedFluids.toArray(nullFluid); if (inF.length > 0) { for (FluidStack fs : inF) { - aFluidQuantizationInfo aFQI = bTransformationInfo.fluidQuantization.get(fs.getFluid().getID()); + EMFluidQuantizationInfo aFQI = TecTech.transformationInfo.getFluidQuantization().get(fs.getFluid().getID()); if (aFQI == null) { continue; } - iHasElementalDefinition into = aFQI.output(); + IEMStack into = aFQI.output(); if (into != null && fs.amount >= aFQI.input().amount && isInputEqual(true, false, new FluidStack[]{aFQI.input()}, nullItem, inF, (ItemStack[]) null)) { startRecipe(into); @@ -151,21 +152,21 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock return false; } - private void startRecipe(iHasElementalDefinition into) { + private void startRecipe(IEMStack into) { mMaxProgresstime = 20; mEfficiencyIncrease = 10000; - float mass = into.getMass(); - float euMult = Math.abs(mass / refMass); + double mass = into.getMass(); + double euMult = Math.abs(mass / refMass); eAmpereFlow = (int) Math.ceil(Math.sqrt(Math.sqrt(euMult))); if (mass > refUnstableMass || into.getDefinition().getRawTimeSpan(DEFAULT_ENERGY_LEVEL) < STABLE_RAW_LIFE_TIME) { mEUt = (int) -V[8]; } else { mEUt = (int) -V[6]; } - outputEM = new cElementalInstanceStackMap[]{ - into instanceof cElementalInstanceStack ? - new cElementalInstanceStackMap((cElementalInstanceStack) into) : - new cElementalInstanceStackMap(new cElementalInstanceStack(into.getDefinition(), into.getAmount())) + outputEM = new EMInstanceStackMap[]{ + into instanceof EMInstanceStack ? + new EMInstanceStackMap((EMInstanceStack) into) : + new EMInstanceStackMap(new EMInstanceStack(into.getDefinition(), into.getAmount())) }; } @@ -175,7 +176,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock stopMachine(); return; } - eOutputHatches.get(0).getContainerHandler().putUnifyAll(outputEM[0]); + eOutputHatches.get(0).getContentHandler().putUnifyAll(outputEM[0]); outputEM = null; } @@ -197,12 +198,17 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_quantizer> getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} 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 c78d314c07..9cd3bf40e7 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 @@ -1,13 +1,13 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; 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 com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; @@ -21,10 +21,8 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockB import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -35,16 +33,18 @@ import org.apache.commons.lang3.reflect.FieldUtils; import java.util.ArrayList; import java.util.LinkedHashMap; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.CommonValues.VN; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; 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.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting.crafter; import static com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine.machine; -import static gregtech.api.enums.GT_Values.E; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.VN; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -53,39 +53,43 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; */ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region variables - private final ArrayList<GT_MetaTileEntity_Hatch_Holder> eHolders = new ArrayList<>(); - private GT_Recipe.GT_Recipe_AssemblyLine tRecipe; - private TT_recipe.TT_assLineRecipe aRecipe; - private String machineType; - private ItemStack holdItem; - private long computationRemaining, computationRequired; + private final ArrayList<GT_MetaTileEntity_Hatch_Holder> eHolders = new ArrayList<>(); + private GT_Recipe.GT_Recipe_AssemblyLine tRecipe; + private TT_recipe.TT_assLineRecipe aRecipe; + private String machineType; + private static final String assembly = "Assembly line"; + private ItemStack holdItem; + private long computationRemaining, computationRequired; private static LinkedHashMap<String, String> lServerNames; - private String clientLocale = "en_US"; - //endregion - - //region structure - private static final String[][] shape = new String[][]{ - {E, "000", E, E, E, "000"/*,E,*/}, - {"A0", "010", "A1", "A!", "A1", "010", "A0",}, - {"A0", "010", E, E, E, "010", "A0",}, - {"000", "010", E, E, E, "010", "000",}, - {"000", "212", "010", "0.0", "010", "212", "000",}, - {"000", "212", "111", "111", "111", "212", "000",}, - {"000", "222", " ", " ", " ", "222", "000",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{1, 3, 2}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addHolderToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, Blocks.air}; - private static final byte[] blockMetaFallback = new byte[]{1, 0}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.research.hint.0"),//1 - Classic/Data Hatches or Computer casing translateToLocal("gt.blockmachines.multimachine.em.research.hint.1"),//2 - Holder Hatch }; + + private String clientLocale = "en_US"; + //endregion + + //region structure + private static final IStructureDefinition<GT_MetaTileEntity_EM_research> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_research>builder() + .addShape("main", transpose(new String[][]{ + {" ", " A ", " A ", "AAA", "AAA", "AAA", "AAA"}, + {"AAA", "ACA", "ACA", "ACA", "BCB", "BCB", "BBB"}, + {" ", " C ", " ", " ", "ACA", "CCC", "DDD"}, + {" ", " E ", " ", " ", "A~A", "CCC", "DDD"}, + {" ", " C ", " ", " ", "ACA", "CCC", "DDD"}, + {"AAA", "ACA", "ACA", "ACA", "BCB", "BCB", "BBB"}, + {" ", " A ", " A ", "AAA", "AAA", "AAA", "AAA"} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 1)) + .addElement('B', ofBlock(sBlockCasingsTT, 2)) + .addElement('C', ofBlock(sBlockCasingsTT, 3)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_research::addClassicToMachineList, textureOffset + 1, 1, sBlockCasingsTT, 1)) + .addElement('E', ofHatchAdder(GT_MetaTileEntity_EM_research::addHolderToMachineList, 3, 2)) + .build(); //endregion public GT_MetaTileEntity_EM_research(int aID, String aName, String aNameRegional) { @@ -139,8 +143,12 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB private void makeStick2() { String s = tRecipe.mOutput.getDisplayName(); if (getBaseMetaTileEntity().isServerSide()) { - s = lServerNames.get(tRecipe.mOutput.getDisplayName()); - if (s == null) { + if (lServerNames != null) { + s = lServerNames.get(tRecipe.mOutput.getDisplayName()); + if (s == null) { + s = tRecipe.mOutput.getDisplayName(); + } + } else { s = tRecipe.mOutput.getDisplayName(); } } @@ -179,7 +187,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB tNBTList.appendTag(new NBTTagString("Construction plan for " + tRecipe.mOutput.stackSize + " " + s + ". Needed EU/t: " + tRecipe.mEUt + " Production time: " + (tRecipe.mDuration / 20))); for (int i = 0; i < tRecipe.mInputs.length; i++) { if (tRecipe.mOreDictAlt[i] != null) { - int count = 0; + int count = 0; StringBuilder tBuilder = new StringBuilder("Input Bus " + (i + 1) + ": "); for (ItemStack tStack : tRecipe.mOreDictAlt[i]) { if (tStack != null) { @@ -232,7 +240,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB mEfficiencyIncrease = 10000; eRequiredData = (short) (ttRecipe.mSpecialValue >>> 16); eAmpereFlow = (short) (ttRecipe.mSpecialValue & 0xFFFF); - mEUt = ttRecipe.mEUt; + mEUt = Math.min(ttRecipe.mEUt, -ttRecipe.mEUt); eHolders.get(0).getBaseMetaTileEntity().setActive(true); return true; } @@ -254,7 +262,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } eHolders.clear(); - if (!structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 3, 4)) { + if (!structureCheck_EM("main", 1, 3, 4)) { return false; } @@ -275,6 +283,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB if (ItemList.Tool_DataStick.isStackEqual(itemStack, false, true)) { for (GT_Recipe.GT_Recipe_AssemblyLine assRecipe : TT_recipe.GT_Recipe_MapTT.sAssemblylineRecipes) { if (GT_Utility.areStacksEqual(assRecipe.mResearchItem, holdItem, true)) { + machineType = assembly; tRecipe = assRecipe; //if found if (iterateRecipes()) return true; @@ -353,7 +362,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB @Override public String[] getInfoData() { long storedEnergy = 0; - long maxEnergy = 0; + long maxEnergy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); @@ -369,28 +378,38 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB return new String[]{ translateToLocalFormatted("tt.keyphrase.Energy_Hatches", clientLocale) + ":", - EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", (mEUt <= 0 ? translateToLocalFormatted("tt.keyphrase.Probably_uses", clientLocale) + ": " : translateToLocalFormatted("tt.keyphrase.Probably_makes", clientLocale) + ": ") + - EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t " + translateToLocalFormatted("tt.keyword.at", clientLocale) + " " + - EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", - translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + EnumChatFormatting.BLUE + eSafeVoid, - translateToLocalFormatted("tt.keyphrase.Computation_Available", clientLocale) + ": " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET, + EnumChatFormatting.RED + GT_Utility.formatNumbers(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t " + + translateToLocalFormatted("tt.keyword.at", clientLocale) + " " + + EnumChatFormatting.RED + GT_Utility.formatNumbers(eAmpereFlow) + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eMaxAmpereFlow) + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + + EnumChatFormatting.BLUE + eSafeVoid, + translateToLocalFormatted("tt.keyphrase.Computation_Available", clientLocale) + ": " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eAvailableData) + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(eRequiredData) + EnumChatFormatting.RESET, translateToLocalFormatted("tt.keyphrase.Computation_Remaining", clientLocale) + ":", - EnumChatFormatting.GREEN + Long.toString(computationRemaining / 20L) + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.YELLOW + computationRequired / 20L + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(computationRemaining / 20L) + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(computationRequired / 20L) }; } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3], new TT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3], new TT_RenderedExtendedFacingTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3]}; } @@ -462,6 +481,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB for (GT_Recipe.GT_Recipe_AssemblyLine tRecipe : TT_recipe.GT_Recipe_MapTT.sAssemblylineRecipes) { if (GT_Utility.areStacksEqual(tRecipe.mResearchItem, holdItem, true)) { this.tRecipe = tRecipe; + machineType = assembly; break; } } @@ -539,7 +559,6 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } else { return true; } - System.out.println(clientLocale); return true; } @@ -549,12 +568,17 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 3, 4, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 1, 3, 4, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_research> getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} 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 6170bd081f..8583f03193 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,19 +1,21 @@ 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.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMPrimitiveDefinition; import com.github.technus.tectech.recipe.TT_recipe; import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; import com.github.technus.tectech.thing.item.ElementalDefinitionScanStorage_EM; -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.*; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import gregtech.api.enums.ItemList; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -21,6 +23,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -32,17 +35,19 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.CommonValues.VN; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; -import static com.github.technus.tectech.Util.areBitsSet; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; -import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; import static com.github.technus.tectech.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; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting.crafter; import static com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine.machine; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.VN; +import static com.github.technus.tectech.util.Util.areBitsSet; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -52,41 +57,21 @@ import static net.minecraft.util.StatCollector.translateToLocalFormatted; public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region variables public static final int SCAN_DO_NOTHING = 0, - SCAN_GET_NOMENCLATURE = 1, SCAN_GET_DEPTH_LEVEL = 2, SCAN_GET_AMOUNT = 4, SCAN_GET_CHARGE = 8, - SCAN_GET_MASS = 16, SCAN_GET_ENERGY_LEVEL = 32, SCAN_GET_TIMESPAN_INFO = 64, SCAN_GET_ENERGY_STATES = 128, - SCAN_GET_COLOR = 256, SCAN_GET_AGE = 512, SCAN_GET_TIMESPAN_MULT = 1024, SCAN_GET_CLASS_TYPE = 2048; + SCAN_GET_NOMENCLATURE = 1, SCAN_GET_DEPTH_LEVEL = 2, SCAN_GET_AMOUNT = 4, SCAN_GET_CHARGE = 8, + SCAN_GET_MASS = 16, SCAN_GET_ENERGY_LEVEL = 32, SCAN_GET_TIMESPAN_INFO = 64, SCAN_GET_ENERGY_STATES = 128, + SCAN_GET_COLOR = 256, SCAN_GET_AGE = 512, SCAN_GET_TIMESPAN_MULT = 1024, SCAN_GET_CLASS_TYPE = 2048; private TT_recipe.TT_EMRecipe.TT_EMRecipe eRecipe; - private cElementalDefinitionStack objectResearched; - private cElementalInstanceStackMap objectsScanned; - private String machineType; - private long computationRemaining, computationRequired; + private EMDefinitionStack objectResearched; + private EMInstanceStackMap objectsScanned; + private String machineType; + private long computationRemaining, computationRequired; private int[] scanComplexity; private String clientLocale = "en_US"; //endregion //region structure - private static final String[][] shape = new String[][]{ - {" ", " 222 ", " 2.2 ", " 222 ", " ",}, - {"00000", "00000", "00000", "00000", "00000",}, - {"00100", "01110", "11111", "01110", "00100",}, - {"01110", "1---1", "1---1", "1---1", "01110",}, - {"01110", "1---1", "1-A-1", "1---1", "01110",}, - {"01110", "1---1", "1---1", "1---1", "01110",}, - {"00100", "01110", "11\"11", "01110", "00100",}, - {"#####", "#000#", "#0!0#", "#000#", "#####",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 0, 0}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{ - this::addClassicToMachineList, - this::addElementalInputToMachineList, - this::addElementalOutputToMachineList, - this::addElementalMufflerToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4, textureOffset + 4, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4, 4, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.0"),//1 - Classic Hatches or High Power Casing @@ -94,10 +79,28 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.2"),//3 - Elemental Output Hatches or Molecular Casing translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.3"),//4 - Elemental Overflow Hatches or Molecular Casing }; + + private static final IStructureDefinition<GT_MetaTileEntity_EM_scanner> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_scanner>builder() + .addShape("main", transpose(new String[][]{ + {"CCCCC", "BBBBB", "BBDBB", "BDDDB", "BDDDB", "BDDDB", "BBDBB", "EEEEE"}, + {"CAAAC", "BBBBB", "BDDDB", "D---D", "D---D", "D---D", "BDDDB", "EBBBE"}, + {"CA~AC", "BBBBB", "DDDDD", "D---D", "D- -D", "D---D", "DDGDD", "EBFBE"}, + {"CAAAC", "BBBBB", "BDDDB", "D---D", "D---D", "D---D", "BDDDB", "EBBBE"}, + {"CCCCC", "BBBBB", "BBDBB", "BDDDB", "BDDDB", "BDDDB", "BBDBB", "EEEEE"} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 0)) + .addElement('B', ofBlock(sBlockCasingsTT, 4)) + .addElement('D', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('C', ofHatchAdderOptional(GT_MetaTileEntity_EM_scanner::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('F', ofHatchAdder(GT_MetaTileEntity_EM_scanner::addElementalInputToMachineList, textureOffset + 4, 2)) + .addElement('G', ofHatchAdder(GT_MetaTileEntity_EM_scanner::addElementalOutputToMachineList, textureOffset + 4, 3)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_scanner::addElementalMufflerToMachineList, textureOffset + 4, 4, sBlockCasingsTT, 4)) + .build(); //endregion //region parameters - private static final INameFunction<GT_MetaTileEntity_EM_scanner> CONFIG_NAME = + private static final INameFunction<GT_MetaTileEntity_EM_scanner> CONFIG_NAME = (base, p) -> "Config at Depth: " + (p.hatchId() * 2 + p.parameterId()); private static final IStatusFunction<GT_MetaTileEntity_EM_scanner> CONFIG_STATUS = (base, p) -> { @@ -111,7 +114,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa if (v < 0) return LedStatus.STATUS_TOO_LOW; return LedStatus.STATUS_OK; }; - protected Parameters.Group.ParameterIn[] scanConfiguration; + protected Parameters.Group.ParameterIn[] scanConfiguration; //endregion public GT_MetaTileEntity_EM_scanner(int aID, String aName, String aNameRegional) { @@ -127,9 +130,9 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa private void quantumStuff(boolean shouldExist) { IGregTechTileEntity base = getBaseMetaTileEntity(); if (base != null && base.getWorld() != null) { - int xDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetX * 4 + base.getXCoord(); - int yDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetY * 4 + base.getYCoord(); - int zDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetZ * 4 + base.getZCoord(); + int xDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetX * 4 + base.getXCoord(); + int yDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetY * 4 + base.getYCoord(); + int zDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetZ * 4 + base.getZCoord(); Block block = base.getWorld().getBlock(xDir, yDir, zDir); if (shouldExist) { if (block != null && block.getMaterial() == Material.air) { @@ -207,7 +210,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - if (!structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0)) { + if (!structureCheck_EM("main", 2, 2, 0)) { return false; } return eInputHatches.size() == 1 && eOutputHatches.size() == 1 && eOutputHatches.get(0).getBaseMetaTileEntity().getFrontFacing() == iGregTechTileEntity.getFrontFacing(); @@ -216,32 +219,32 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkRecipe_EM(ItemStack itemStack) { eRecipe = null; - if (!eInputHatches.isEmpty() && eInputHatches.get(0).getContainerHandler().hasStacks() && !eOutputHatches.isEmpty()) { - cElementalInstanceStackMap researchEM = eInputHatches.get(0).getContainerHandler(); + if (!eInputHatches.isEmpty() && eInputHatches.get(0).getContentHandler().hasStacks() && !eOutputHatches.isEmpty()) { + EMInstanceStackMap researchEM = eInputHatches.get(0).getContentHandler(); if (ItemList.Tool_DataOrb.isStackEqual(itemStack, false, true)) { GT_Recipe scannerRecipe = null; - for (cElementalInstanceStack stackEM : researchEM.values()) { + for (EMInstanceStack stackEM : researchEM.valuesToArray()) { objectsScanned = null; - eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(stackEM.definition); + eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(stackEM.getDefinition()); if (eRecipe != null) { scannerRecipe = eRecipe.scannerRecipe; machineType = machine; - objectResearched = new cElementalDefinitionStack(stackEM.definition, 1); + objectResearched = new EMDefinitionStack(stackEM.getDefinition(), 1); //cleanMassEM_EM(objectResearched.getMass()); - researchEM.remove(objectResearched.definition); + researchEM.removeKey(objectResearched.getDefinition()); break; } - eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(stackEM.definition); + eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(stackEM.getDefinition()); if (eRecipe != null) { scannerRecipe = eRecipe.scannerRecipe; machineType = crafter; - objectResearched = new cElementalDefinitionStack(stackEM.definition, 1); + objectResearched = new EMDefinitionStack(stackEM.getDefinition(), 1); //cleanMassEM_EM(objectResearched.getMass()); - researchEM.remove(objectResearched.definition); + researchEM.removeKey(objectResearched.getDefinition()); break; } cleanStackEM_EM(stackEM); - researchEM.remove(stackEM.definition); + researchEM.removeKey(stackEM.getDefinition()); } if (eRecipe != null && scannerRecipe != null) {//todo make sure it werks computationRequired = computationRemaining = scannerRecipe.mDuration * 20L; @@ -256,7 +259,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } else if (CustomItemList.scanContainer.isStackEqual(itemStack, false, true)) { eRecipe = null; if (researchEM.hasStacks()) { - objectsScanned = researchEM.takeAllToNewMap(); + objectsScanned = researchEM.takeAll(); cleanMassEM_EM(objectsScanned.getMass()); computationRequired = 0; @@ -307,7 +310,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa NBTTagCompound tNBT = mInventory[1].getTagCompound();//code above makes it not null tNBT.setString("eMachineType", machineType); - tNBT.setTag(E_RECIPE_ID, objectResearched.toNBT()); + tNBT.setTag(E_RECIPE_ID, objectResearched.toNBT(TecTech.definitionsRegistry)); tNBT.setString("author", EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.WHITE + ' ' + machineType + " EM Recipe Generator"); } else if (objectsScanned != null && CustomItemList.scanContainer.isStackEqual(mInventory[1], false, true)) { ElementalDefinitionScanStorage_EM.setContent(mInventory[1], objectsScanned, scanComplexity); @@ -329,7 +332,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public String[] getInfoData() { long storedEnergy = 0; - long maxEnergy = 0; + long maxEnergy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); @@ -345,21 +348,31 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa return new String[]{ translateToLocalFormatted("tt.keyphrase.Energy_Hatches", clientLocale) + ":", - EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", (mEUt <= 0 ? translateToLocalFormatted("tt.keyphrase.Probably_uses", clientLocale) + ": " : translateToLocalFormatted("tt.keyphrase.Probably_makes", clientLocale) + ": ") + - EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t " + translateToLocalFormatted("tt.keyword.at", clientLocale) + " " + - EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", - translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", - translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + - " " + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + EnumChatFormatting.BLUE + eSafeVoid, - translateToLocalFormatted("tt.keyphrase.Computation_Available", clientLocale) + ": " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET, + EnumChatFormatting.RED + GT_Utility.formatNumbers(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t " + + translateToLocalFormatted("tt.keyword.at", clientLocale) + " " + + EnumChatFormatting.RED + GT_Utility.formatNumbers(eAmpereFlow) + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyphrase.Tier_Rating", clientLocale) + ": " + + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyphrase.Amp_Rating", clientLocale) + ": " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eMaxAmpereFlow) + EnumChatFormatting.RESET + " A", + translateToLocalFormatted("tt.keyword.Problems", clientLocale) + ": " + + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyword.Efficiency", clientLocale) + ": " + + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + translateToLocalFormatted("tt.keyword.PowerPass", clientLocale) + ": " + + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + " " + + translateToLocalFormatted("tt.keyword.SafeVoid", clientLocale) + ": " + + EnumChatFormatting.BLUE + eSafeVoid, + translateToLocalFormatted("tt.keyphrase.Computation_Available", clientLocale) + ": " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eAvailableData) + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(eRequiredData) + EnumChatFormatting.RESET, translateToLocalFormatted("tt.keyphrase.Computation_Remaining", clientLocale) + ":", - EnumChatFormatting.GREEN + Long.toString(computationRemaining / 20L) + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.YELLOW + computationRequired / 20L + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(computationRemaining / 20L) + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(computationRequired / 20L) }; } @@ -385,7 +398,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa aNBT.setLong("eComputationRemaining", computationRemaining); aNBT.setLong("eComputationRequired", computationRequired); if (objectResearched != null) { - aNBT.setTag("eObject", objectResearched.toNBT()); + aNBT.setTag("eObject", objectResearched.toNBT(TecTech.definitionsRegistry)); } else { aNBT.removeTag("eObject"); } @@ -395,7 +408,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa aNBT.removeTag("eScanComplexity"); } if (objectsScanned != null) { - aNBT.setTag("eScanObjects", objectsScanned.toNBT()); + aNBT.setTag("eScanObjects", objectsScanned.toNBT(TecTech.definitionsRegistry)); } else { aNBT.removeTag("eScanObjects"); } @@ -407,8 +420,8 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa computationRemaining = aNBT.getLong("eComputationRemaining"); computationRequired = aNBT.getLong("eComputationRequired"); if (aNBT.hasKey("eObject")) { - objectResearched = cElementalDefinitionStack.fromNBT(aNBT.getCompoundTag("eObject")); - if (objectResearched.definition == nbtE__) { + objectResearched = EMDefinitionStack.fromNBT(TecTech.definitionsRegistry, aNBT.getCompoundTag("eObject")); + if (objectResearched.getDefinition() == EMPrimitiveDefinition.nbtE__) { objectResearched = null; } } else { @@ -421,10 +434,10 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } try { if (aNBT.hasKey("eScanObjects")) { - objectsScanned = cElementalInstanceStackMap.fromNBT(aNBT.getCompoundTag("eScanObjects")); + objectsScanned = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry, aNBT.getCompoundTag("eScanObjects")); } - } catch (tElementalException e) { - objectsScanned = new cElementalInstanceStackMap(); + } catch (EMException e) { + objectsScanned = new EMInstanceStackMap(); } } @@ -443,11 +456,11 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa if (computationRemaining > 0 && objectResearched != null) { eRecipe = null; if (ItemList.Tool_DataOrb.isStackEqual(mInventory[1], false, true)) { - eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(objectResearched.definition); + eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(objectResearched.getDefinition()); if (eRecipe != null) { machineType = machine; } else { - eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(objectResearched.definition); + eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(objectResearched.getDefinition()); if (eRecipe != null) { machineType = crafter; } @@ -494,7 +507,6 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } else { return true; } - System.out.println(clientLocale); return true; } @@ -514,12 +526,17 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack trigger, boolean hintsOnly) { + structureBuild_EM("main", 2, 2, 0, trigger, hintsOnly); + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_scanner> getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} 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 b159827012..7103e6dfff 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 @@ -1,19 +1,20 @@ 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 com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -21,24 +22,29 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure - private static final String[][] shape = new String[][]{ - {"A010", "0 0", "1 . 1", "0 0", "A010",}, - {"23232", "32223", "22222", "32223", "23232",}, - {"12!21", "22422", "!444!", "22422", "12!21",}, - {"23232", "32223", "22222", "32223", "23232",}, - {"A010", "0 0", "1 1", "0 0", "A010",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 0, 5, 6, 9}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.stabilizer.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.stabilizer.hint.1"),//2 - Elemental Hatches or Molecular Casing }; + + private static final IStructureDefinition<GT_MetaTileEntity_EM_stabilizer> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_stabilizer>builder() + .addShape("main", transpose(new String[][]{ + {" AFA ", "BCBCB", "FBGBF", "BCBCB", " AFA "}, + {"AEEEA", "CBBBC", "BBDBB", "CBBBC", "AEEEA"}, + {"FE~EF", "BBBBB", "GDDDG", "BBBBB", "FEEEF"}, + {"AEEEA", "CBBBC", "BBDBB", "CBBBC", "AEEEA"}, + {" AFA ", "BCBCB", "FBGBF", "BCBCB", " AFA "} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofBlock(sBlockCasingsTT, 6)) + .addElement('D', ofBlock(sBlockCasingsTT, 9)) + .addElement('F', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_stabilizer::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('G', ofHatchAdderOptional(GT_MetaTileEntity_EM_stabilizer::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .build(); //endregion public GT_MetaTileEntity_EM_stabilizer(int aID, String aName, String aNameRegional) { @@ -56,7 +62,7 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + return structureCheck_EM("main", 2, 2, 0); } @Override @@ -69,12 +75,17 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 2, 2, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_stabilizer> getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} 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 795349c50c..bbf33c6ae7 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 @@ -1,31 +1,36 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.Vec3pos; import com.github.technus.tectech.mechanics.dataTransport.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.*; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -33,25 +38,25 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {" ", " 0 ", " ",}, - {" ", " ", " ",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{3}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset + 1}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{1}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", "1 - Classic/Data Hatches or Computer casing",//1 - Classic/Data Hatches or Computer casing }; + + private static final IStructureDefinition<GT_MetaTileEntity_EM_switch> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_switch>builder() + .addShape("main", transpose(new String[][]{ + {"BBB", "BBB", "BBB"}, + {"B~B", "BAB", "BBB"}, + {"BBB", "BBB", "BBB"} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 3)) + .addElement('B', ofHatchAdderOptional(GT_MetaTileEntity_EM_switch::addClassicToMachineList, textureOffset + 1, 1, sBlockCasingsTT, 1)) + .build(); //endregion //region parameters - private static final INameFunction<GT_MetaTileEntity_EM_switch> ROUTE_NAME = + private static final INameFunction<GT_MetaTileEntity_EM_switch> ROUTE_NAME = (base, p) -> (p.parameterId() == 0 ? translateToLocal("tt.keyword.Destination") + " " : translateToLocal("tt.keyword.Weight") + " ") + p.hatchId(); private static final IStatusFunction<GT_MetaTileEntity_EM_switch> WEI_STATUS = (base, p) -> { @@ -74,8 +79,8 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } return STATUS_NEUTRAL; }; - protected Parameters.Group.ParameterIn[] dst; - protected Parameters.Group.ParameterIn[] weight; + protected Parameters.Group.ParameterIn[] dst; + protected Parameters.Group.ParameterIn[] weight; //endregion public GT_MetaTileEntity_EM_switch(int aID, String aName, String aNameRegional) { @@ -93,7 +98,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + return structureCheck_EM("main", 1, 1, 0); } @Override @@ -128,7 +133,10 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } } - Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); + Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity().getXCoord(), + getBaseMetaTileEntity().getYCoord(), + getBaseMetaTileEntity().getZCoord()); + QuantumDataPacket pack = new QuantumDataPacket(0L).unifyTraceWith(pos); if (pack == null) { return; @@ -191,7 +199,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1], new TT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1], new TT_RenderedExtendedFacingTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1]}; } @@ -216,12 +224,17 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_switch> getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} 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 1a3bebf59b..75eb05bdeb 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 @@ -1,30 +1,30 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; 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 com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; import static gregtech.api.GregTech_API.sBlockCasings1; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -32,21 +32,29 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure - private static final String[][] shape = new String[][]{ - {" ", " . ", " ",}, - {" ", " 0 ", " ",}, - {" ", " ", " ",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasings1}; - private static final byte[] blockMeta = new byte[]{15}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addEnergyIOToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0}; - private static final String[] description = new String[]{ + private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.transformer.hint"),//1 - Energy IO Hatches or High Power Casing }; + private static final IStructureDefinition<GT_MetaTileEntity_EM_transformer> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_transformer>builder() + .addShape("main", new String[][]{ + {"111", "1~1", "111",}, + {"111", "101", "111",}, + {"111", "111", "111",}, + }) + .addElement('0', ofBlock(sBlockCasings1, 15)) + .addElement('1', ofChain( + ofHatchAdder(GT_MetaTileEntity_EM_transformer::addEnergyIOToMachineList, textureOffset, 1), + onElementPass(t -> t.casingCount++, ofBlock(sBlockCasingsTT, 0)) + )) + .build(); + private int casingCount = 0; + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_transformer> getStructure_EM() { + return STRUCTURE_DEFINITION; + } //endregion public GT_MetaTileEntity_EM_transformer(int aID, String aName, String aNameRegional) { @@ -78,7 +86,8 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); + casingCount = 0; + return structureCheck_EM("main", 1, 1, 0) && casingCount >= 5; } @Override @@ -118,7 +127,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][0], new TT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][0], new TT_RenderedExtendedFacingTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][0]}; } @@ -149,12 +158,12 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 1, 1, 0, stackSize, hintsOnly); } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} 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 034fdca334..83151d71c3 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 @@ -1,27 +1,27 @@ 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 com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static gregtech.api.enums.GT_Values.E; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -34,30 +34,33 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB //endregion //region structure - private static final String[][] shape = new String[][]{ - {E, E, E, "C ", "C . ", "C "/*,E,E,E,*/}, - {E, E, "D0", "C000", "B00100", "C000", "D0"/*,E,E,*/}, - {E, E, "D0", "C2A2", "B0C0", "C2A2", "D0"/*,E,E,*/}, - {E, "D0", "D0", E, "A00C00", E, "D0", "D0"/*,E,*/}, - {E, "D0", E, E, "A0E0", E, E, "D0"/*,E,*/}, - {"D0", "D0", E, E, "00E00", E, E, "D0", "D0",}, - {"B00000", "A0033300", "003C300", "03E30", "03E30", "03E30", "003C300", "A0033300", "B00000",}, - {"B0!!!0", "A 31113 ", "031222130", "!12C21!", "!12C21!", "!12C21!", "031222130", "A 31113 ", "B0!!!0",}, - {"B0!!!0", "A 31113 ", "031444130", "!14C41!", "!14C41!", "!14C41!", "031444130", "A 31113 ", "B0!!!0",}, - {"B0!!!0", "A 31113 ", "031222130", "!12C21!", "!12C21!", "!12C21!", "031222130", "A 31113 ", "B0!!!0",}, - {"B00000", "A0033300", "003C300", "03E30", "03E30", "03E30", "003C300", "A0033300", "B00000",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{12, 10, 0, 5, 11}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.wormhole.hint.0"),//1 - Classic Hatches or High Power Casing translateToLocal("gt.blockmachines.multimachine.em.wormhole.hint.1"),//2 - Elemental Hatches or Molecular Casing }; + + private static final IStructureDefinition<GT_MetaTileEntity_EM_wormhole> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_wormhole>builder() + .addShape("main", transpose(new String[][]{ + {" ", " ", " ", " ", " ", " D ", " DDDDD ", " DGGGD ", " DGGGD ", " DGGGD ", " DDDDD "}, + {" ", " ", " ", " D ", " D ", " D ", " DDAAADD ", " EABBBAE ", " EABBBAE ", " EABBBAE ", " DDAAADD "}, + {" ", " D ", " D ", " D ", " ", " ", "DDA ADD", "DABFFFBAD", "DABCCCBAD", "DABFFFBAD", "DDA ADD"}, + {" EEE ", " DDD ", " F F ", " ", " ", " ", "DA AD", "GBF FBG", "GBC CBG", "GBF FBG", "DA AD"}, + {" E~E ", " DDBDD ", " D D ", " DD DD ", " D D ", "DD DD", "DA AD", "GBF FBG", "GBC CBG", "GBF FBG", "DA AD"}, + {" EEE ", " DDD ", " F F ", " ", " ", " ", "DA AD", "GBF FBG", "GBC CBG", "GBF FBG", "DA AD"}, + {" ", " D ", " D ", " D ", " ", " ", "DDA ADD", "DABFFFBAD", "DABCCCBAD", "DABFFFBAD", "DDA ADD"}, + {" ", " ", " ", " D ", " D ", " D ", " DDAAADD ", " EABBBAE ", " EABBBAE ", " EABBBAE ", " DDAAADD "}, + {" ", " ", " ", " ", " ", " D ", " DDDDD ", " DGGGD ", " DGGGD ", " DGGGD ", " DDDDD "} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 5)) + .addElement('B', ofBlock(sBlockCasingsTT, 10)) + .addElement('C', ofBlock(sBlockCasingsTT, 11)) + .addElement('D', ofBlock(sBlockCasingsTT, 12)) + .addElement('F', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_EM_wormhole::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('G', ofHatchAdderOptional(GT_MetaTileEntity_EM_wormhole::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .build(); //endregion public GT_MetaTileEntity_EM_wormhole(int aID, String aName, String aNameRegional) { @@ -75,7 +78,7 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 4, 4, 0); + return structureCheck_EM("main", 4, 4, 0); } @Override @@ -98,18 +101,23 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4]}; } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 4, 4, 0, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 4, 4, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_wormhole> getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} 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 60a642ee95..fec070407b 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 @@ -1,17 +1,18 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; @@ -23,11 +24,14 @@ import net.minecraft.util.EnumChatFormatting; import java.util.ArrayList; import java.util.HashSet; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.loader.MainLoader.microwaving; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.GregTech_API.sBlockCasings4; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; +import static net.minecraft.util.AxisAlignedBB.getBoundingBox; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -40,25 +44,23 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock //region structure //use multi A energy inputs, use less power the longer it runs - private static final String[][] shape = new String[][]{ - {"00000", "00000", "00.00", "0 0",}, - {"0---0", "0---0", "0---0", " 000 ",}, - {"0---0", "0---0", "0---0", " 000 ",}, - {"0---0", "0---0", "0---0", " 000 ",}, - {"00000", "00000", "00000", "0 0",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasings4}; - private static final byte[] blockMeta = new byte[]{1}; - - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList}; - private static final short[] casingTextures = new short[]{49}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasings4}; - private static final byte[] blockMetaFallback = new byte[]{1}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.tm.microwave.hint.0"),//1 - Classic Hatches or Clean Stainless Steel Casing translateToLocal("gt.blockmachines.multimachine.tm.microwave.hint.1"),//Also acts like a hopper so give it an Output Bus }; + + private static final IStructureDefinition<GT_MetaTileEntity_TM_microwave> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_TM_microwave>builder() + .addShape("main", transpose(new String[][]{ + {"AAAAA", "A---A", "A---A", "A---A", "AAAAA"}, + {"AAAAA", "A---A", "A---A", "A---A", "AAAAA"}, + {"AA~AA", "A---A", "A---A", "A---A", "AAAAA"}, + {"ABBBA", "BAAAB", "BAAAB", "BAAAB", "ABBBA"} + })) + .addElement('A', ofBlock(sBlockCasings4, 1)) + .addElement('B', ofHatchAdderOptional(GT_MetaTileEntity_TM_microwave::addClassicToMachineList, 49, 1, sBlockCasings4, 1)) + .build(); //endregion //region parameters @@ -67,11 +69,11 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock private static final INameFunction<GT_MetaTileEntity_TM_microwave> POWER_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.microwave.cfgi.0");//Power setting private static final INameFunction<GT_MetaTileEntity_TM_microwave> TIMER_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.microwave.cfgi.1");//Timer setting - private static final INameFunction<GT_MetaTileEntity_TM_microwave> TIMER_VALUE_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.microwave.cfgo.0");//Timer value - private static final INameFunction<GT_MetaTileEntity_TM_microwave> TIMER_REMAINING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.microwave.cfgo.1");//Timer remaining - private static final IStatusFunction<GT_MetaTileEntity_TM_microwave> POWER_STATUS = + private static final INameFunction<GT_MetaTileEntity_TM_microwave> TIMER_VALUE_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.microwave.cfgo.0");//Timer value + private static final INameFunction<GT_MetaTileEntity_TM_microwave> TIMER_REMAINING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.microwave.cfgo.1");//Timer remaining + private static final IStatusFunction<GT_MetaTileEntity_TM_microwave> POWER_STATUS = (base, p) -> LedStatus.fromLimitsInclusiveOuterBoundary(p.get(), 300, 1000, 1000, Double.POSITIVE_INFINITY); - private static final IStatusFunction<GT_MetaTileEntity_TM_microwave> TIMER_STATUS = (base, p) -> { + private static final IStatusFunction<GT_MetaTileEntity_TM_microwave> TIMER_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (int) value; @@ -96,7 +98,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + return structureCheck_EM("main", 2, 2, 0); } @Override @@ -123,18 +125,16 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } timerValue.set(timerValue.get() + 1); remainingTime.set(timerSetting.get() - timerValue.get()); - IGregTechTileEntity mte = getBaseMetaTileEntity(); - int[] xyzOffsets = getTranslatedOffsets(0, -1, 2); - double xPos = mte.getXCoord() + 0.5f + xyzOffsets[0]; - double yPos = mte.getYCoord() + 0.5f + xyzOffsets[1]; - double zPos = mte.getZCoord() + 0.5f + xyzOffsets[2]; - AxisAlignedBB aabb = getBoundingBox(-2, -2, -2, 2, 2, 2).offset(xPos, yPos, zPos); - xyzOffsets = getTranslatedOffsets(0, -4, 0); - double[] xyzExpansion = getTranslatedOffsets(1.5, 0, 1.5); - for (int i = 0; i < 3; i++) {//gets ABS from translated to get expansion values - if (xyzExpansion[i] < 0) xyzExpansion[i] = -xyzExpansion[i]; - } - int power = (int) powerSetting.get(); + IGregTechTileEntity mte = getBaseMetaTileEntity(); + Vec3Impl xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -1, 2)); + double xPos = mte.getXCoord() + 0.5f + xyzOffsets.get0(); + double yPos = mte.getYCoord() + 0.5f + xyzOffsets.get1(); + double zPos = mte.getZCoord() + 0.5f + xyzOffsets.get2(); + AxisAlignedBB aabb = getBoundingBox(-2, -2, -2, 2, 2, 2) + .offset(xPos, yPos, zPos); + xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -4, 0)); + Vec3Impl xyzExpansion = getExtendedFacing().getWorldOffset(new Vec3Impl(1, 0, 1)).abs(); + int power = (int) powerSetting.get(); int damagingFactor = Math.min(power >> 6, 8) + Math.min(power >> 8, 24) + @@ -142,7 +142,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock (power >> 18); ArrayList<ItemStack> itemsToOutput = new ArrayList<>(); - HashSet<Entity> tickedStuff = new HashSet<>(); + HashSet<Entity> tickedStuff = new HashSet<>(); boolean inside = true; do { @@ -169,8 +169,8 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } } } - aabb.offset(xyzOffsets[0], xyzOffsets[1], xyzOffsets[2]); - aabb = aabb.expand(xyzExpansion[0], xyzExpansion[1], xyzExpansion[2]); + aabb.offset(xyzOffsets.get0(), xyzOffsets.get1(), xyzOffsets.get2()); + aabb = aabb.expand(xyzExpansion.get0() * 1.5, xyzExpansion.get1() * 1.5, xyzExpansion.get2() * 1.5); inside = false; damagingFactor >>= 1; } while (damagingFactor > 0); @@ -195,22 +195,22 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, true, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, true); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, true, true);//todo texture + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, false, true);//todo texture } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49], new TT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49], new TT_RenderedExtendedFacingTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; } else if (aSide == GT_Utility.getOppositeSide(aFacing)) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49], aActive ? Textures.BlockIcons.CASING_BLOCKS[52] : Textures.BlockIcons.CASING_BLOCKS[53]}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49], aActive ? Textures.BlockIcons.casingTexturePages[0][52] : Textures.BlockIcons.casingTexturePages[0][53]}; } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49]}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49]}; } @Override @@ -245,12 +245,17 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 2, 2, 0, stackSize, hintsOnly); + } + + @Override + public IStructureDefinition<GT_MetaTileEntity_TM_microwave> getStructure_EM() { + return STRUCTURE_DEFINITION; } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java new file mode 100644 index 0000000000..ba0af2d349 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -0,0 +1,146 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.item.ItemStack; + +@Deprecated +public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + protected GT_MetaTileEntity_TM_proccessingStack(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + @Override + public IStructureDefinition<? extends GT_MetaTileEntity_MultiblockBase_EM> getStructure_EM() { + return null; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + + } + + @Override + public String[] getStructureDescription(ItemStack stackSize) { + return new String[0]; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return null; + } + /* + //region variables + private boolean hasBeenPausedThisCycle = false; + //endregion + + //region structure + //use multi A energy inputs, use less power the longer it runs + private static final String[][] base = new String[][]{ + {" ",}, + {" 0 ",}, + {" ",}, + }; + private static final String[][] slice = new String[][]{ + {"111",}, + {"101",}, + {"111",}, + }; + private static final String[][] cap = new String[][]{ + {" ",}, + {" 0 ",}, + {" ",}, + }; + private static final Block[] blockType = new Block[]{sBlockCasings4}; + private static final byte[] blockMeta = new byte[]{1}; + + private static final IHatchAdder<GT_MetaTileEntity_TM_proccessingStack>[] addingMethods = adders( + GT_MetaTileEntity_TM_proccessingStack::addClassicToMachineList); + private static final short[] casingTextures = new short[]{49}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasings4}; + private static final byte[] blockMetaFallback = new byte[]{1}; + private static final String[] description = new String[]{ + EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", + translateToLocal("gt.blockmachines.multimachine.tm.proccessingStack.hint.0"), + translateToLocal("gt.blockmachines.multimachine.tm.proccessingStack.hint.1"), + }; + //endregion + + public GT_MetaTileEntity_TM_proccessingStack(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_TM_proccessingStack(String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_TM_proccessingStack(mName); + } + + @Override + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return false; + //return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 0, 0); + } + + @Override + public boolean checkRecipe_EM(ItemStack itemStack) { + return true; + } + + @Override + public void outputAfterRecipe_EM() { + + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.BASS_MARK, + translateToLocal("gt.blockmachines.multimachine.tm.proccessingStack.desc.0"), + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.tm.proccessingStack.desc.1"), + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.multimachine.tm.proccessingStack.desc.2"), + }; + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity,true, false, true); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",true, false, true); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49], new TT_RenderedExtendedFacingTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; + } else if (aSide == GT_Utility.getOppositeSide(aFacing)) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49], aActive ? Textures.BlockIcons.casingTexturePages[0][52] : Textures.BlockIcons.casingTexturePages[0][53]}; + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][49]}; + } + + @Override + public boolean onRunningTick(ItemStack aStack) { + return true; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + //StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + } + + @Override + public String[] getStructureDescription(ItemStack stackSize) { + return description; + } + */ +}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index a95963f1a7..8d910d9431 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -1,137 +1,171 @@ 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.loader.NetworkDispatcher; -import com.github.technus.tectech.mechanics.data.RendererMessage; -import com.github.technus.tectech.mechanics.data.ThaumSpark; -import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil; -import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.spark.RendererMessage; +import com.github.technus.tectech.mechanics.spark.ThaumSpark; +import com.github.technus.tectech.mechanics.tesla.ITeslaConnectable; +import com.github.technus.tectech.mechanics.tesla.ITeslaConnectableSimple; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Capacitor; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Param; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; -import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_TeslaCoil; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; +import com.google.common.collect.Multimap; +import com.google.common.collect.MultimapBuilder; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.*; -import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; -import java.util.HashMap; import java.util.HashSet; -import java.util.Map; -import static com.github.technus.tectech.CommonValues.V; -import static com.github.technus.tectech.Util.*; +import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.*; +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.sBlockCasingsBA0; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; -import static gregtech.api.enums.GT_Values.E; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; +import static java.lang.Math.min; import static net.minecraft.util.StatCollector.translateToLocal; -public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - //region variables - private final static HashSet<ThaumSpark> sparkList = new HashSet<>(); +public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable, ITeslaConnectable { + //Interface fields + private final Multimap<Integer, ITeslaConnectableSimple> teslaNodeMap = MultimapBuilder.treeKeys().linkedListValues().build(); + private final HashSet<ThaumSpark> sparkList = new HashSet<>(); + private int sparkCount = 10; + //region variables + private static final int transferRadiusTowerFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_TOWER;//Default is 32 + private static final int transferRadiusTransceiverFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_TRANSCEIVER;//Default is 16 + private static final int transferRadiusCoverUltimateFromConfig = TecTech.configTecTech.TESLA_MULTI_RANGE_COVER;//Default is 16 + private static final int plasmaRangeMultiT1 = TecTech.configTecTech.TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1;//Default is 2 + private static final int plasmaRangeMultiT2 = TecTech.configTecTech.TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2;//Default is 4 + private static final int heliumUse = TecTech.configTecTech.TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM;//Default is 100 + private static final int nitrogenUse = TecTech.configTecTech.TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN;//Default is 50 + private static final int radonUse = TecTech.configTecTech.TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON;//Default is 50 + //Default is {1, 1, 1} + private static final int[] plasmaTierLoss = new int[]{TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T0, + TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T1, TecTech.configTecTech.TESLA_MULTI_LOSS_PER_BLOCK_T2}; + private static final float overDriveLoss = TecTech.configTecTech.TESLA_MULTI_LOSS_FACTOR_OVERDRIVE;//Default is 0.25F; + private static final boolean doFluidOutput = TecTech.configTecTech.TESLA_MULTI_GAS_OUTPUT; //Default is false + + //Face icons private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - private int mTier = 0; //Determines max voltage and efficiency (MV to LuV) - private int maxTier = 6; //Max tier for efficiency calcuation - - private float energyEfficiency = 1; - private float overdriveEfficiency = 1; - private float minEfficiency = TecTech.configTecTech.TESLA_MULTI_MIN_EFFICIENCY;//Default is 0.955F - private float maxEfficiency = TecTech.configTecTech.TESLA_MULTI_MAX_EFFICIENCY;//Default is 0.98F; - private float overdriveEfficiencyExtra = TecTech.configTecTech.TESLA_MULTI_OVERDRIVE_LOSS;//Default is 0.005F + private int mTier = 0; //Determines max voltage (LV to ZPM) + private int plasmaTier = 0; //0 is None, 1 is Helium or Nitrogen, 2 is Radon (Does not match actual plasma tiers) - private Map<IGregTechTileEntity, Integer> eTeslaMap = new HashMap<>(); //Used to store targets for power transmission - private final ArrayList<GT_MetaTileEntity_Hatch_Capacitor> eCapacitorHatches = new ArrayList<>(); //Used to determine count and tier of capacitors present + private FluidStack[] mOutputFluidsQueue; //Used to buffer the fluid outputs, so the tesla takes a second to 'cool' any plasma it would output as a gas - private int scanTime = 0; //Scan timer used for tesla search intervals + private final ArrayList<GT_MetaTileEntity_Hatch_Capacitor> eCapacitorHatches = new ArrayList<>(); //Capacitor hatches which determine the max voltage tier and count of amps - private long energyCapacity = 0; //Total energy storage limited by capacitors + private long energyCapacity = 0; //Total energy storage limited by capacitors private long outputVoltageMax = 0; //Tesla voltage output limited by capacitors - private int vTier = -1; //Tesla voltage tier limited by capacitors + private int vTier = -1; //Tesla voltage tier limited by capacitors private long outputCurrentMax = 0; //Tesla current output limited by capacitors - //Prevents unnecessary offset calculation - private byte oldRotation = -1; - private byte oldOrientation = -1; + //outputVoltage and current after settings + private long outputVoltage; + private long outputCurrent; - //Coordinate Arrays - private int[][] scanPosOffsets = new int[10][3]; - private int[] posZap = new int[3];//Power Transfer Origin - public int[] posTop = new int[3];//Lightning Origin + //Prevents unnecessary offset calculation, saving on lag + private byte oldRotation = -1; + private byte oldOrientation = -1; + //Location of the center of the sphere on top of the tower, used as the Thaumcraft lightning and origin + public Vec3Impl posTop = Vec3Impl.NULL_VECTOR; //endregion //region structure - private static final String[][] shape = new String[][]{//3 16 0 - {"\u000F", "A . ",}, - {E, "B000", "B000", "B000", "\u0001", "B000", E, "B000", E, "B000", E, "B000", "\u0001", "B111", " 22222 ",}, - {"B000", "A00000", "A00000", "A00000", "B000", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", "\u0001", "A1C1", " 21112 ",}, - {"B000", "A00000", "A00000", "A00000", "B030", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "C3", "A1A3A1", " 21212 ",}, - {"B000", "A00000", "A00000", "A00000", "B000", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", "\u0001", "A1C1", " 21112 ",}, - {E, "B000", "B000", "B000", "\u0001", "B000", E, "B000", E, "B000", E, "B000", "\u0001", "B111", " 22222 ",}, - {"\u000F", "A ",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsBA0, sBlockCasingsBA0, sBlockCasingsBA0, sBlockCasingsBA0}; - private static final byte[] blockMetaT0 = new byte[]{7, 0, 6, 8}; - private static final byte[] blockMetaT1 = new byte[]{7, 1, 6, 8}; - private static final byte[] blockMetaT2 = new byte[]{7, 2, 6, 8}; - private static final byte[] blockMetaT3 = new byte[]{7, 3, 6, 8}; - private static final byte[] blockMetaT4 = new byte[]{7, 4, 6, 8}; - private static final byte[] blockMetaT5 = new byte[]{7, 5, 6, 8}; - private static final byte[][] blockMetas = new byte[][]{blockMetaT0, blockMetaT1, blockMetaT2, blockMetaT3, blockMetaT4, blockMetaT5}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addCapacitorToMachineList, this::addFrameToMachineList}; - private static final short[] casingTextures = new short[]{(texturePage << 7) + 16 + 6, 0}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsBA0, null}; - private static final byte[] blockMetaFallback = new byte[]{6, 0}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.hint.0"),//1 - Classic Hatches, Capacitor Hatches or Tesla Base Casing - translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.hint.1"),//2 - Titanium Frames + translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.hint.1"),//2 - ""Titanium frames"" }; + + private static final IStructureDefinition<GT_MetaTileEntity_TM_teslaCoil> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_TM_teslaCoil>builder() + .addShape("main", transpose(new String[][]{ + {" ", " ", " BBB ", " BBB ", " BBB ", " ", " "}, + {" ", " BBB ", " BBBBB ", " BBBBB ", " BBBBB ", " BBB ", " "}, + {" ", " BBB ", " BBBBB ", " BBBBB ", " BBBBB ", " BBB ", " "}, + {" ", " BBB ", " BBBBB ", " BBBBB ", " BBBBB ", " BBB ", " "}, + {" ", " ", " BBB ", " BCB ", " BBB ", " ", " "}, + {" ", " ", " ", " C ", " ", " ", " "}, + {" ", " BBB ", " B F B ", " BFCFB ", " B F B ", " BBB ", " "}, + {" ", " ", " ", " C ", " ", " ", " "}, + {" ", " BBB ", " B F B ", " BFCFB ", " B F B ", " BBB ", " "}, + {" ", " ", " ", " C ", " ", " ", " "}, + {" ", " BBB ", " B F B ", " BFCFB ", " B F B ", " BBB ", " "}, + {" ", " ", " ", " C ", " ", " ", " "}, + {" ", " BBB ", " B F B ", " BFCFB ", " B F B ", " BBB ", " "}, + {" ", " ", " ", " C ", " ", " ", " "}, + {" ", " ", " ", " C ", " ", " ", " "}, + {" ", " DDD ", " D D ", " D C D ", " D D ", " DDD ", " "}, + {" EE~EE ", "EAAAAAE", "EADDDAE", "EADADAE", "EADDDAE", " AAAAAE", " EEEEE "} + })) + .addElement('A', ofBlock(sBlockCasingsBA0, 6)) + .addElement('B', ofBlock(sBlockCasingsBA0, 7)) + .addElement('C', ofBlock(sBlockCasingsBA0, 8)) + .addElement('D', defer(t -> ofBlock(sBlockCasingsBA0, t.getCoilWindingMeta()))) + .addElement('E', ofHatchAdderOptional(GT_MetaTileEntity_TM_teslaCoil::addCapacitorToMachineList, textureOffset + 16 + 6, 1, sBlockCasingsBA0, 6)) + .addElement('F', ofHatchAdder(GT_MetaTileEntity_TM_teslaCoil::addFrameToMachineList, 0, 2)) + .build(); + + public int getCoilWindingMeta() { + Vec3Impl xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -1, 1)); + return this.getBaseMetaTileEntity().getMetaIDOffset(xyzOffsets.get0(), xyzOffsets.get1(), xyzOffsets.get2()); + } //endregion //region parameters - protected Parameters.Group.ParameterIn popogaSetting, histLowSetting, histHighSetting, transferRadiusTowerSetting, transferRadiusTransceiverSetting, transferRadiusCoverUltimateSetting, outputVoltageSetting, outputCurrentSetting, scanTimeMinSetting, overDriveSetting; - protected Parameters.Group.ParameterOut popogaDisplay, transferRadiusTowerDisplay, transferRadiusTransceiverDisplay, transferRadiusCoverUltimateDisplay, outputVoltageDisplay, outputCurrentDisplay, energyCapacityDisplay, energyStoredDisplay, energyFractionDisplay, scanTimeDisplay; + protected Parameters.Group.ParameterIn popogaSetting, histLowSetting, histHighSetting, transferRadiusTowerSetting, transferRadiusTransceiverSetting, transferRadiusCoverUltimateSetting, outputVoltageSetting, outputCurrentSetting, sortTimeMinSetting, overDriveSetting; + protected Parameters.Group.ParameterOut popogaDisplay, transferRadiusTowerDisplay, transferRadiusTransceiverDisplay, transferRadiusCoverUltimateDisplay, outputVoltageDisplay, outputCurrentDisplay, energyCapacityDisplay, energyStoredDisplay, energyFractionDisplay, sortTimeDisplay; - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_LOW_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.0");//Hysteresis low setting - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_HIGH_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.1");//Hysteresis high setting - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TOWER_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.2");//Tesla Towers transfer radius setting - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TRANSCEIVER_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.3");//Tesla Transceiver transfer radius setting + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_LOW_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.0");//Hysteresis low setting + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_HIGH_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.1");//Hysteresis high setting + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TOWER_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.2");//Tesla Towers transfer radius setting + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TRANSCEIVER_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.3");//Tesla Transceiver transfer radius setting private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_COVER_ULTIMATE_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.4");//Tesla Ultimate Cover transfer radius setting - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_VOLTAGE_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.5");//Output voltage setting - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_CURRENT_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.6");//Output current setting - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> SCAN_TIME_MIN_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.7");//Scan time Min setting - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> OVERDRIVE_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.8");//Overdrive setting - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> POPOGA_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.9");//Unused - - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TOWER_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.0");//Tesla Towers transfer radius display - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TRANSCEIVER_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.1");//Tesla Transceiver transfer radius display + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_VOLTAGE_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.5");//Output voltage setting + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_CURRENT_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.6");//Output current setting + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> SCAN_TIME_MIN_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.7");//Scan time Min setting + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> OVERDRIVE_SETTING_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.8");//Overdrive setting + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> POPOGA_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgi.9");//Unused + + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TOWER_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.0");//Tesla Towers transfer radius display + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TRANSCEIVER_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.1");//Tesla Transceiver transfer radius display private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_COVER_ULTIMATE_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.2");//Tesla Ultimate Cover transfer radius display - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_VOLTAGE_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.3");//Output voltage display - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_CURRENT_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.4");//Output current display - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> ENERGY_CAPACITY_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.5");//Energy Capacity display - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> ENERGY_STORED_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.6");//Energy Stored display - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> ENERGY_FRACTION_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.7");//Energy Fraction display - private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> SCAN_TIME_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.8");//Scan time display - - private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_LOW_STATUS = (base, p) -> { + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_VOLTAGE_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.3");//Output voltage display + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_CURRENT_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.4");//Output current display + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> ENERGY_CAPACITY_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.5");//Energy Capacity display + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> ENERGY_STORED_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.6");//Energy Stored display + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> ENERGY_FRACTION_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.7");//Energy Fraction display + private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> SCAN_TIME_DISPLAY_NAME = (base, p) -> translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.cfgo.8");//Scan time display + + private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_LOW_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) { return STATUS_WRONG; @@ -140,32 +174,41 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock if (value > base.histHighSetting.get()) return STATUS_TOO_HIGH; return STATUS_OK; }; - private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_HIGH_STATUS = (base, p) -> { + private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_HIGH_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; if (value <= base.histLowSetting.get()) return STATUS_TOO_LOW; if (value > 0.95) return STATUS_TOO_HIGH; return STATUS_OK; }; - private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TOWER_STATUS = (base, p) -> { + private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TOWER_STATUS = (base, p) -> { + double value = p.get(); + if (Double.isNaN(value)) return STATUS_WRONG; + value = (int) value; + if (value < 0) return STATUS_TOO_LOW; + if (value > transferRadiusTowerFromConfig) return STATUS_HIGH; + if (value < transferRadiusTowerFromConfig) return STATUS_LOW; + return STATUS_OK; + }; + private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TRANSCEIVER_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (int) value; if (value < 0) return STATUS_TOO_LOW; - if (value > 40) return STATUS_TOO_HIGH; - if (value < 32) return STATUS_LOW; + if (value > transferRadiusTransceiverFromConfig) return STATUS_HIGH; + if (value < transferRadiusTransceiverFromConfig) return STATUS_LOW; return STATUS_OK; }; - private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS = (base, p) -> { + private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_COVER_ULTIMATE_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (int) value; if (value < 0) return STATUS_TOO_LOW; - if (value > 20) return STATUS_TOO_HIGH; - if (value < 16) return STATUS_LOW; + if (value > transferRadiusCoverUltimateFromConfig) return STATUS_HIGH; + if (value < transferRadiusCoverUltimateFromConfig) return STATUS_LOW; return STATUS_OK; }; - private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_VOLTAGE_OR_CURRENT_STATUS = (base, p) -> { + private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_VOLTAGE_OR_CURRENT_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (long) value; @@ -173,7 +216,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock if (value <= 0) return STATUS_TOO_LOW; return STATUS_OK; }; - private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> SCAN_TIME_MIN_STATUS = (base, p) -> { + private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> SCAN_TIME_MIN_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (int) value; @@ -181,7 +224,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock if (value == 100) return STATUS_OK; return STATUS_HIGH; }; - private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> OVERDRIVE_STATUS = (base, p) -> { + private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> OVERDRIVE_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (int) value; @@ -189,20 +232,20 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock if (value == 0) return STATUS_LOW; return STATUS_HIGH; }; - private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> POPOGA_STATUS = (base, p) -> { + private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> POPOGA_STATUS = (base, p) -> { if (base.getBaseMetaTileEntity().getWorld().isThundering()) { return STATUS_WTF; } return STATUS_NEUTRAL; }; - private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> SCAN_TIME_STATUS = (base, p) -> { + private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> SCAN_TIME_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (int) value; - if (value == 0 || value == 20 || value == 40 || value == 60 || value == 80) return STATUS_HIGH; + if (value == 0) return STATUS_HIGH; return STATUS_LOW; }; - private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> POWER_STATUS = (base, p) -> { + private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> POWER_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; value = (long) value; @@ -212,7 +255,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock return STATUS_LOW; } }; - private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> ENERGY_STATUS = (base, p) -> { + private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> ENERGY_STATUS = (base, p) -> { double value = p.get(); if (Double.isNaN(value)) return STATUS_WRONG; if (base.energyFractionDisplay.get() > base.histHighSetting.get()) { @@ -233,60 +276,64 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock super(aName); } - private long getEnergyEfficiency(long voltage, int distance, boolean overDriveToggle) { - if (overDriveToggle) { - return (long) ((voltage * 2) - (voltage * Math.pow(overdriveEfficiency, distance))); - } else { - return (long) (voltage * Math.pow(energyEfficiency, distance)); + private float getRangeMulti(int mTier, int vTier) { + //By Default: + //Helium and Nitrogen Plasmas will double the range + //Radon will quadruple the range + int plasmaBoost; + switch (plasmaTier) { + case 2: + plasmaBoost = plasmaRangeMultiT2; + break; + case 1: + plasmaBoost = plasmaRangeMultiT1; + break; + default: + plasmaBoost = 1; } - } - private float getRangeMulti(int mTier, int vTier) { //Over-tiered coils will add +25% range if (vTier > mTier) { - return 1.25F; - } - return 1F; - } - - private void scanForTransmissionTargets(int[] coordsMin, int[] coordsMax) { - //This makes sure the minimums are actually smaller than the maximums - int xMin = coordsMin[0] < coordsMax[0] ? coordsMin[0] : coordsMax[0]; - int yMin = coordsMin[1] < coordsMax[1] ? coordsMin[1] : coordsMax[1]; - int zMin = coordsMin[2] < coordsMax[2] ? coordsMin[2] : coordsMax[2]; - //And vice versa - int xMax = coordsMin[0] > coordsMax[0] ? coordsMin[0] : coordsMax[0]; - int yMax = coordsMin[1] > coordsMax[1] ? coordsMin[1] : coordsMax[1]; - int zMax = coordsMin[2] > coordsMax[2] ? coordsMin[2] : coordsMax[2]; - - for (int xPos = xMin; xPos <= xMax; xPos++) { - for (int yPos = yMin; yPos <= yMax; yPos++) { - for (int zPos = zMin; zPos <= zMax; zPos++) { - if (xPos == 0 && yPos == 0 && zPos == 0) { - continue; + return 1.25F * plasmaBoost; + } + return 1F * plasmaBoost; + } + + private void checkPlasmaBoost() { + //If there's fluid in the queue, try to output it + //That way it takes at least a second to 'process' the plasma + if (mOutputFluidsQueue != null) { + mOutputFluids = mOutputFluidsQueue; + mOutputFluidsQueue = null; + } + + for (GT_MetaTileEntity_Hatch_Input fluidHatch : mInputHatches) { + if (fluidHatch.mFluid != null) { + if (fluidHatch.mFluid.isFluidEqual(Materials.Helium.getPlasma(1)) && fluidHatch.mFluid.amount >= heliumUse) { + fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - heliumUse; + if (doFluidOutput) { + mOutputFluidsQueue = new FluidStack[]{Materials.Helium.getGas(heliumUse)}; } - IGregTechTileEntity node = getBaseMetaTileEntity().getIGregTechTileEntityOffset(xPos, yPos, zPos); - if (node == null) { - continue; + plasmaTier = 1; + return; + } else if (fluidHatch.mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) && fluidHatch.mFluid.amount >= nitrogenUse) { + fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - nitrogenUse; + if (doFluidOutput) { + mOutputFluidsQueue = new FluidStack[]{Materials.Nitrogen.getGas(nitrogenUse)}; } - IMetaTileEntity nodeInside = node.getMetaTileEntity(); - if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil || nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive() || (node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil)) { - eTeslaMap.put(node, (int) Math.ceil(Math.sqrt(Math.pow(xPos, 2) + Math.pow(yPos, 2) + Math.pow(zPos, 2)))); + plasmaTier = 1; + return; + } else if (fluidHatch.mFluid.isFluidEqual(Materials.Radon.getPlasma(1)) && fluidHatch.mFluid.amount >= radonUse) { + fluidHatch.mFluid.amount = fluidHatch.mFluid.amount - radonUse; + if (doFluidOutput) { + mOutputFluidsQueue = new FluidStack[]{Materials.Radon.getGas(radonUse)}; } + plasmaTier = 2; + return; } } } - - } - - private void thaumLightning(IGregTechTileEntity mte, IGregTechTileEntity node) { - byte xR = (byte) (node.getXCoord() - posTop[0]); - byte yR = (byte) (node.getYCoord() - posTop[1]); - byte zR = (byte) (node.getZCoord() - posTop[2]); - - int wID = mte.getWorld().provider.dimensionId; - - sparkList.add(new ThaumSpark(posTop[0], posTop[1], posTop[2], xR, yR, zR, wID)); + plasmaTier = 0; } @Override @@ -303,11 +350,14 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } eCapacitorHatches.clear(); - int[] xyzOffsets; - xyzOffsets = getTranslatedOffsets(0, -1, 1); - mTier = iGregTechTileEntity.getMetaIDOffset(xyzOffsets[0], xyzOffsets[1], xyzOffsets[2]); + Vec3Impl xyzOffsets; + xyzOffsets = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -1, 1)); + mTier = iGregTechTileEntity.getMetaIDOffset(xyzOffsets.get0(), xyzOffsets.get1(), xyzOffsets.get2()); + if (mTier == 9) { + mTier = 6; + }//Hacky remap because the ZPM coils were added later - if (structureCheck_EM(shape, blockType, blockMetas[mTier], addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 3, 16, 0) && eCapacitorHatches.size() > 0) { + if (structureCheck_EM("main", 3, 16, 0)) { for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(cap)) { cap.getBaseMetaTileEntity().setActive(iGregTechTileEntity.isActive()); @@ -315,37 +365,19 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } //Only recalculate offsets on orientation or rotation change - if (oldRotation != getFrontRotation() || oldOrientation != iGregTechTileEntity.getFrontFacing()) { - oldRotation = getFrontRotation(); + if (oldRotation != getExtendedFacing().ordinal() || oldOrientation != iGregTechTileEntity.getFrontFacing()) { + oldRotation = (byte) getExtendedFacing().ordinal(); oldOrientation = iGregTechTileEntity.getFrontFacing(); + Vec3Impl posBMTE = new Vec3Impl(getBaseMetaTileEntity().getXCoord(), + getBaseMetaTileEntity().getYCoord(), + getBaseMetaTileEntity().getZCoord()); + //Calculate coordinates of the middle bottom - xyzOffsets = getTranslatedOffsets(0, 0, 2); - posZap[0] = iGregTechTileEntity.getXCoord() + xyzOffsets[0]; - posZap[1] = iGregTechTileEntity.getYCoord() + xyzOffsets[1]; - posZap[2] = iGregTechTileEntity.getZCoord() + xyzOffsets[2]; + posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, 0, 2)).add(posBMTE); //Calculate coordinates of the top sphere - xyzOffsets = getTranslatedOffsets(0, -14, 2); - posTop[0] = iGregTechTileEntity.getXCoord() + xyzOffsets[0]; - posTop[1] = iGregTechTileEntity.getYCoord() + xyzOffsets[1]; - posTop[2] = iGregTechTileEntity.getZCoord() + xyzOffsets[2]; - - //Calculate offsets for scanning - scanPosOffsets[0] = getTranslatedOffsets(40, 0, 43); - scanPosOffsets[1] = getTranslatedOffsets(-40, -4, -37); - - scanPosOffsets[2] = getTranslatedOffsets(40, -5, 43); - scanPosOffsets[3] = getTranslatedOffsets(-40, -8, -37); - - scanPosOffsets[4] = getTranslatedOffsets(40, -9, 43); - scanPosOffsets[5] = getTranslatedOffsets(-40, -12, -37); - - scanPosOffsets[6] = getTranslatedOffsets(40, -13, 43); - scanPosOffsets[7] = getTranslatedOffsets(-40, -16, -37); - - scanPosOffsets[8] = getTranslatedOffsets(40, -17, 43); - scanPosOffsets[9] = getTranslatedOffsets(-40, -20, -37); + posTop = getExtendedFacing().getWorldOffset(new Vec3Impl(0, -14, 2)).add(posBMTE); } return true; } @@ -354,6 +386,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override public boolean checkRecipe_EM(ItemStack itemStack) { + checkPlasmaBoost(); + if (!histHighSetting.getStatus(false).isOk || !histLowSetting.getStatus(false).isOk || !transferRadiusTowerSetting.getStatus(false).isOk || @@ -361,7 +395,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock !transferRadiusCoverUltimateSetting.getStatus(false).isOk || !outputVoltageSetting.getStatus(false).isOk || !outputCurrentSetting.getStatus(false).isOk || - !scanTimeMinSetting.getStatus(false).isOk || + !sortTimeMinSetting.getStatus(false).isOk || !overDriveSetting.getStatus(false).isOk ) return false; @@ -378,10 +412,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } } - //Calculate Efficiency values - energyEfficiency = map(mTier + 1, 1, maxTier, minEfficiency, maxEfficiency); - overdriveEfficiency = energyEfficiency - overdriveEfficiencyExtra; - energyCapacity = 0; outputCurrentMax = 0; @@ -426,15 +456,15 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister aBlockIconRegister) { + super.registerIcons(aBlockIconRegister); ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/TM_TESLA_TOWER"); ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/TM_TESLA_TOWER_ACTIVE"); - super.registerIcons(aBlockIconRegister); } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][16 + 6], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][16 + 6], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][16 + 6]}; } @@ -442,8 +472,13 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @Override public void onRemoval() { super.onRemoval(); - for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { - cap.getBaseMetaTileEntity().setActive(false); + if (!getBaseMetaTileEntity().isClientSide()) { + teslaSimpleNodeSetRemove(this); + for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(cap)) { + cap.getBaseMetaTileEntity().setActive(false); + } + } } } @@ -464,17 +499,17 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock popogaSetting = hatch_0.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); histHighSetting = hatch_1.makeInParameter(0, 0.75, HYSTERESIS_HIGH_SETTING_NAME, HYSTERESIS_HIGH_STATUS); popogaSetting = hatch_1.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - transferRadiusTowerSetting = hatch_2.makeInParameter(0, 32, TRANSFER_RADIUS_TOWER_SETTING_NAME, TRANSFER_RADIUS_TOWER_STATUS); + transferRadiusTowerSetting = hatch_2.makeInParameter(0, transferRadiusTowerFromConfig, TRANSFER_RADIUS_TOWER_SETTING_NAME, TRANSFER_RADIUS_TOWER_STATUS); popogaSetting = hatch_2.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - transferRadiusTransceiverSetting = hatch_3.makeInParameter(0, 16, TRANSFER_RADIUS_TRANSCEIVER_SETTING_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS); - transferRadiusCoverUltimateSetting = hatch_3.makeInParameter(1, 16, TRANSFER_RADIUS_COVER_ULTIMATE_SETTING_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS); + transferRadiusTransceiverSetting = hatch_3.makeInParameter(0, transferRadiusTransceiverFromConfig, TRANSFER_RADIUS_TRANSCEIVER_SETTING_NAME, TRANSFER_RADIUS_TRANSCEIVER_STATUS); + transferRadiusCoverUltimateSetting = hatch_3.makeInParameter(1, transferRadiusCoverUltimateFromConfig, TRANSFER_RADIUS_COVER_ULTIMATE_SETTING_NAME, TRANSFER_RADIUS_COVER_ULTIMATE_STATUS); outputVoltageSetting = hatch_4.makeInParameter(0, -1, OUTPUT_VOLTAGE_SETTING_NAME, OUTPUT_VOLTAGE_OR_CURRENT_STATUS); popogaSetting = hatch_4.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); outputCurrentSetting = hatch_5.makeInParameter(0, -1, OUTPUT_CURRENT_SETTING_NAME, OUTPUT_VOLTAGE_OR_CURRENT_STATUS); popogaSetting = hatch_5.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); popogaSetting = hatch_6.makeInParameter(0, 0, POPOGA_NAME, POPOGA_STATUS); popogaSetting = hatch_6.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - scanTimeMinSetting = hatch_7.makeInParameter(0, 100, SCAN_TIME_MIN_SETTING_NAME, SCAN_TIME_MIN_STATUS); + sortTimeMinSetting = hatch_7.makeInParameter(0, 100, SCAN_TIME_MIN_SETTING_NAME, SCAN_TIME_MIN_STATUS); popogaSetting = hatch_7.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); overDriveSetting = hatch_8.makeInParameter(0, 0, OVERDRIVE_SETTING_NAME, OVERDRIVE_STATUS); popogaSetting = hatch_8.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); @@ -487,15 +522,15 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock popogaDisplay = hatch_1.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); transferRadiusTowerDisplay = hatch_2.makeOutParameter(0, 0, TRANSFER_RADIUS_TOWER_DISPLAY_NAME, TRANSFER_RADIUS_TOWER_STATUS); popogaDisplay = hatch_2.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - transferRadiusTransceiverDisplay = hatch_3.makeOutParameter(0, 0, TRANSFER_RADIUS_TRANSCEIVER_DISPLAY_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS); - transferRadiusCoverUltimateDisplay = hatch_3.makeOutParameter(1, 0, TRANSFER_RADIUS_COVER_ULTIMATE_DISPLAY_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS); + transferRadiusTransceiverDisplay = hatch_3.makeOutParameter(0, 0, TRANSFER_RADIUS_TRANSCEIVER_DISPLAY_NAME, TRANSFER_RADIUS_TRANSCEIVER_STATUS); + transferRadiusCoverUltimateDisplay = hatch_3.makeOutParameter(1, 0, TRANSFER_RADIUS_COVER_ULTIMATE_DISPLAY_NAME, TRANSFER_RADIUS_COVER_ULTIMATE_STATUS); outputVoltageDisplay = hatch_4.makeOutParameter(0, 0, OUTPUT_VOLTAGE_DISPLAY_NAME, POWER_STATUS); popogaDisplay = hatch_4.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); outputCurrentDisplay = hatch_5.makeOutParameter(0, 0, OUTPUT_CURRENT_DISPLAY_NAME, POWER_STATUS); energyCapacityDisplay = hatch_5.makeOutParameter(1, 0, ENERGY_CAPACITY_DISPLAY_NAME, ENERGY_STATUS); energyStoredDisplay = hatch_6.makeOutParameter(0, 0, ENERGY_STORED_DISPLAY_NAME, ENERGY_STATUS); energyFractionDisplay = hatch_6.makeOutParameter(1, 0, ENERGY_FRACTION_DISPLAY_NAME, ENERGY_STATUS); - scanTimeDisplay = hatch_7.makeOutParameter(0, 0, SCAN_TIME_DISPLAY_NAME, SCAN_TIME_STATUS); + sortTimeDisplay = hatch_7.makeOutParameter(0, 0, SCAN_TIME_DISPLAY_NAME, SCAN_TIME_STATUS); popogaDisplay = hatch_7.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); popogaDisplay = hatch_8.makeOutParameter(0, 0, POPOGA_NAME, POPOGA_STATUS); popogaDisplay = hatch_8.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); @@ -513,6 +548,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); energyCapacity = aNBT.getLong("eEnergyCapacity"); + teslaSimpleNodeSetAdd(this); } @Override @@ -522,23 +558,28 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock cap.getBaseMetaTileEntity().setActive(false); } + ePowerPass = false; setEUVar(0); energyStoredDisplay.set(0); energyFractionDisplay.set(0); } @Override - public boolean onRunningTick(ItemStack aStack) { - IGregTechTileEntity mte = getBaseMetaTileEntity(); + public void onFirstTick_EM(IGregTechTileEntity aBaseMetaTileEntity) { + super.onFirstTick_EM(aBaseMetaTileEntity); + if (!aBaseMetaTileEntity.isClientSide()) { + teslaSimpleNodeSetAdd(this); + generateTeslaNodeMap(this); + } + } + @Override + public boolean onRunningTick(ItemStack aStack) { //Hysteresis based ePowerPass setting - long energyMax = maxEUStore() / 2; - long energyStored = getEUVar(); + float energyFrac = (float) getEUVar() / energyCapacity; - float energyFrac = (float) energyStored / energyMax; - - energyCapacityDisplay.set(energyMax); - energyStoredDisplay.set(energyStored); + energyCapacityDisplay.set(energyCapacity); + energyStoredDisplay.set(getEUVar()); energyFractionDisplay.set(energyFrac); if (!ePowerPass && energyFrac > histHighSetting.get()) { @@ -547,236 +588,58 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock ePowerPass = false; } - //Clean the eTeslaMap - for (Map.Entry<IGregTechTileEntity, Integer> Rx : eTeslaMap.entrySet()) { - IGregTechTileEntity node = Rx.getKey(); - if (node != null) { - IMetaTileEntity nodeInside = node.getMetaTileEntity(); - try { - if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive()) { - GT_MetaTileEntity_TM_teslaCoil teslaTower = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; - if (teslaTower.maxEUStore() > 0) { - continue; - } - } else if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil) { - GT_MetaTileEntity_TeslaCoil teslaTransceiver = (GT_MetaTileEntity_TeslaCoil) nodeInside; - if (teslaTransceiver.mBatteryCount > 0) { - continue; - } - } else if ((node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil) && node.getEUCapacity() > 0) { - continue; - } - } catch (Exception e) { - } - } - eTeslaMap.remove(Rx.getKey()); - } - - //Scan for transmission targets - switch (scanTime) { - case 0: - scanTimeDisplay.updateStatus(); - scanForTransmissionTargets(scanPosOffsets[0], scanPosOffsets[1]); - break; - case 20: - scanTimeDisplay.updateStatus(); - scanForTransmissionTargets(scanPosOffsets[2], scanPosOffsets[3]); - break; - case 40: - scanTimeDisplay.updateStatus(); - scanForTransmissionTargets(scanPosOffsets[4], scanPosOffsets[5]); - break; - case 60: - scanTimeDisplay.updateStatus(); - scanForTransmissionTargets(scanPosOffsets[6], scanPosOffsets[7]); - break; - case 80: - scanTimeDisplay.updateStatus(); - scanForTransmissionTargets(scanPosOffsets[8], scanPosOffsets[9]); - break; - default: - if (scanTime == (int) scanTimeMinSetting.get() - 1) { - scanTime = -1; - - for (Map.Entry<IGregTechTileEntity, Integer> Rx : eTeslaMap.entrySet()) { - IGregTechTileEntity node = Rx.getKey(); - if (node != null) { - IMetaTileEntity nodeInside = node.getMetaTileEntity(); - try { - if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil) { - GT_MetaTileEntity_TeslaCoil teslaCoil = (GT_MetaTileEntity_TeslaCoil) nodeInside; - - int tX = node.getXCoord(); - int tY = node.getYCoord(); - int tZ = node.getZCoord(); - - int tXN = posZap[0]; - int tYN = posZap[1]; - int tZN = posZap[2]; - - int tOffset = (int) Math.ceil(Math.sqrt(Math.pow(tX - tXN, 2) + Math.pow(tY - tYN, 2) + Math.pow(tZ - tZN, 2))); - teslaCoil.eTeslaMap.put(mte, tOffset); - - for (Map.Entry<IGregTechTileEntity, Integer> RRx : eTeslaMap.entrySet()) { - IGregTechTileEntity nodeN = RRx.getKey(); - if (nodeN == node) { - continue; - } - tXN = nodeN.getXCoord(); - tYN = nodeN.getYCoord(); - tZN = nodeN.getZCoord(); - tOffset = (int) Math.ceil(Math.sqrt(Math.pow(tX - tXN, 2) + Math.pow(tY - tYN, 2) + Math.pow(tZ - tZN, 2))); - if (tOffset > 20) { - continue; - } - teslaCoil.eTeslaMap.put(nodeN, tOffset); - } - } - } catch (Exception e) { - eTeslaMap.remove(Rx.getKey()); - } - } - } - } - break; - } - - scanTime++; - scanTimeDisplay.set(scanTime); - //Power Limit Settings - long outputVoltage; if (outputVoltageSetting.get() > 0) { - outputVoltage = Math.min(outputVoltageMax, (long) outputVoltageSetting.get()); + outputVoltage = min(outputVoltageMax, (long) outputVoltageSetting.get()); } else { outputVoltage = outputVoltageMax; } outputVoltageDisplay.set(outputVoltage); - long outputCurrent; if (outputCurrentSetting.get() > 0) { - outputCurrent = Math.min(outputCurrentMax, (long) outputCurrentSetting.get()); + outputCurrent = min(outputCurrentMax, (long) outputCurrentSetting.get()); } else { outputCurrent = outputCurrentMax; } - outputCurrentDisplay.set(0); - - //Stuff to do if ePowerPass - if (ePowerPass) { - //Range calculation and display - float rangeFrac = (float) ((-0.5 * Math.pow(energyFrac, 2)) + (1.5 * energyFrac)); - int transferRadiusTower = (int) (transferRadiusTowerSetting.get() * getRangeMulti(mTier, vTier) * rangeFrac); - transferRadiusTowerDisplay.set(transferRadiusTower); - int transferRadiusTransceiver = (int) (transferRadiusTransceiverSetting.get() * getRangeMulti(mTier, vTier) * rangeFrac); - transferRadiusTransceiverDisplay.set(transferRadiusTransceiver); - int transferRadiusCoverUltimate = (int) (transferRadiusCoverUltimateSetting.get() * getRangeMulti(mTier, vTier) * rangeFrac); - transferRadiusCoverUltimateDisplay.set(transferRadiusCoverUltimate); - - //Clean the eTeslaMap - for (Map.Entry<IGregTechTileEntity, Integer> Rx : eTeslaMap.entrySet()) { - IGregTechTileEntity node = Rx.getKey(); - if (node != null) { - IMetaTileEntity nodeInside = node.getMetaTileEntity(); - try { - if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive()) { - GT_MetaTileEntity_TM_teslaCoil teslaTower = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; - if (teslaTower.maxEUStore() > 0) { - continue; - } - } else if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil) { - GT_MetaTileEntity_TeslaCoil teslaCoil = (GT_MetaTileEntity_TeslaCoil) nodeInside; - if (teslaCoil.getStoredEnergy()[1] > 0) { - continue; - } - } else if ((node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil) && node.getEUCapacity() > 0) { - continue; - } - } catch (Exception e) { - } - } - eTeslaMap.remove(Rx.getKey()); - } - //Power transfer - long sparks = outputCurrent; - while (sparks > 0) { - boolean overdriveToggle = overDriveSetting.get() > 0; - boolean idle = true; - for (Map.Entry<IGregTechTileEntity, Integer> Rx : entriesSortedByValues(eTeslaMap)) { - if (energyStored >= (overdriveToggle ? outputVoltage * 2 : outputVoltage)) { - IGregTechTileEntity node = Rx.getKey(); - IMetaTileEntity nodeInside = node.getMetaTileEntity(); - - long outputVoltageInjectable; - long outputVoltageConsumption; - if (overdriveToggle) { - outputVoltageInjectable = outputVoltage; - outputVoltageConsumption = getEnergyEfficiency(outputVoltage, Rx.getValue(), true); - } else { - outputVoltageInjectable = getEnergyEfficiency(outputVoltage, Rx.getValue(), false); - outputVoltageConsumption = outputVoltage; - } - - if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && Rx.getValue() <= transferRadiusTower) { - GT_MetaTileEntity_TM_teslaCoil nodeTesla = (GT_MetaTileEntity_TM_teslaCoil) nodeInside; - if (!nodeTesla.ePowerPass) { - if (nodeTesla.getEUVar() + outputVoltageInjectable <= (nodeTesla.maxEUStore() / 2)) { - setEUVar(getEUVar() - outputVoltageConsumption); - node.increaseStoredEnergyUnits(outputVoltageConsumption, true); - thaumLightning(mte, node); - sparks--; - idle = false; - } - } - } else if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil && Rx.getValue() <= transferRadiusTransceiver) { - GT_MetaTileEntity_TeslaCoil nodeTesla = (GT_MetaTileEntity_TeslaCoil) nodeInside; - if (!nodeTesla.powerPassToggle) { - if (node.injectEnergyUnits((byte) 6, outputVoltageInjectable, 1L) > 0L) { - setEUVar(getEUVar() - outputVoltageConsumption); - thaumLightning(mte, node); - sparks--; - idle = false; - } - } - } else if ((node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil_Ultimate) && Rx.getValue() <= transferRadiusCoverUltimate) { - if (node.injectEnergyUnits((byte) 1, outputVoltageInjectable, 1L) > 0L) { - setEUVar(getEUVar() - outputVoltageConsumption); - thaumLightning(mte, node); - sparks--; - idle = false; - } - } - if (sparks == 0) { - break; - } - } else { - idle = true; - break; - } - } - if (idle) { - break; - } - } - outputCurrentDisplay.set(outputCurrent - sparks); - if (scanTime % 60 == 0 && !sparkList.isEmpty()) { + //Range calculation and display + int transferRadiusTower = getTeslaTransmissionRange(); + transferRadiusTowerDisplay.set(transferRadiusTower); + transferRadiusTransceiverDisplay.set(transferRadiusTower * 2); + transferRadiusCoverUltimateDisplay.set(transferRadiusTower); + + //Power transfer + outputCurrentDisplay.set(powerTeslaNodeMap(this)); + + //TODO Encapsulate the spark sender + sparkCount--; + if (sparkCount == 0) { + IGregTechTileEntity mte = getBaseMetaTileEntity(); + sparkCount = 10; + if (!sparkList.isEmpty()) { NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList), mte.getWorld().provider.dimensionId, mte.getXCoord(), mte.getYCoord(), mte.getZCoord(), 256); + sparkList.clear(); } - sparkList.clear(); - } else { - outputCurrentDisplay.set(0); } return true; } @Override public long maxEUStore() { - return energyCapacity * 2; + //Setting the power here so that the tower looses all it's charge once disabled + //This also stops it from exploding + return getBaseMetaTileEntity().isActive() ? energyCapacity * 2 : 0; + } + + @Override + public long getEUVar() { + //Same reason as maxEUStore, set to 1 instead of zero so it doesn't drain constantly + return getBaseMetaTileEntity().isActive() ? super.getEUVar() : 1; } private boolean addCapacitorToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { @@ -815,6 +678,14 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); return eParamHatches.add((GT_MetaTileEntity_Hatch_Param) aMetaTileEntity); } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); + } return false; } @@ -823,12 +694,111 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMetas[(stackSize - 1) % 6], 3, 16, 0, getBaseMetaTileEntity(), this, hintsOnly); + public IStructureDefinition<GT_MetaTileEntity_TM_teslaCoil> getStructure_EM() { + return STRUCTURE_DEFINITION; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 3, 16, 0, stackSize, hintsOnly); } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file + + @Override + public byte getTeslaReceptionCapability() { + return 0; + } + + @Override + public float getTeslaReceptionCoefficient() { + return 0; + } + + @Override + public Multimap<Integer, ITeslaConnectableSimple> getTeslaNodeMap() { + return teslaNodeMap; + } + + @Override + public HashSet<ThaumSpark> getSparkList() { + return sparkList; + } + + @Override + public byte getTeslaTransmissionCapability() { + return 1; + } + + @Override + public int getTeslaTransmissionRange() { + return (int) (transferRadiusTowerSetting.get() * getRangeMulti(mTier, vTier)); + } + + @Override + public boolean isOverdriveEnabled() { + return overDriveSetting.get() > 0; + } + + @Override + public int getTeslaEnergyLossPerBlock() { + return plasmaTierLoss[plasmaTier]; + } + + @Override + public float getTeslaOverdriveLossCoefficient() { + return overDriveLoss; + } + + @Override + public long getTeslaOutputVoltage() { + return outputVoltage; + } + + @Override + public long getTeslaOutputCurrent() { + return outputCurrent; + } + + @Override + public boolean teslaDrainEnergy(long teslaVoltageDrained) { + if (getEUVar() < teslaVoltageDrained) { + return false; + } + + setEUVar(getEUVar() - teslaVoltageDrained); + return true; + } + + @Override + public boolean isTeslaReadyToReceive() { + return !this.ePowerPass; + } + + @Override + public long getTeslaStoredEnergy() { + return getEUVar(); + } + + @Override + public Vec3Impl getTeslaPosition() { + return posTop; + } + + @Override + public Integer getTeslaDimension() { + return this.getBaseMetaTileEntity().getWorld().provider.dimensionId; + } + + @Override + public boolean teslaInjectEnergy(long teslaVoltageInjected) { + if (this.getEUVar() + teslaVoltageInjected <= (this.maxEUStore() / 2)) { + this.getBaseMetaTileEntity().increaseStoredEnergyUnits(teslaVoltageInjected, true); + return true; + } + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java index c42c15bd8d..c2d1012910 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.gui.GT_Slot_Holo; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -20,18 +20,18 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { public long[] eParamsOutl = new long[20]; public byte eCertainMode = 5, eCertainStatus = 127; public boolean ePowerPass = false, eSafeVoid = false, allowedToWork = false; - public final boolean ePowerPassButton, eSafeVoidButton, allowedToWorkButton; + public final boolean eSafeVoidButton, allowedToWorkButton,ePowerPassButton; + public boolean ePowerPassCover; - public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean enablePowerPass, boolean enableSafeVoid, boolean enablePowerButton) { + public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity,boolean enablePowerPassButton, boolean enableSafeVoid, boolean enablePowerButton) { super(aInventoryPlayer, aTileEntity); - ePowerPassButton=enablePowerPass; + ePowerPassButton=enablePowerPassButton; eSafeVoidButton=enableSafeVoid; allowedToWorkButton=enablePowerButton; } public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - ePowerPassButton=eSafeVoidButton=allowedToWorkButton=true; + this(aInventoryPlayer,aTileEntity,true,true,true); } public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) { @@ -72,9 +72,13 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { IGregTechTileEntity base = mte.getBaseMetaTileEntity(); switch (aSlotIndex) { case 0: - if(ePowerPassButton) { + if(ePowerPassButton || mte.ePowerPassCover) { TecTech.proxy.playSound(base,"fx_click"); - mte.ePowerPass ^= true; + if(mte.ePowerPassCover){ + mte.ePowerPass ^= true; + }else { + mte.ePowerPass = false; + } if (!allowedToWorkButton) {//TRANSFORMER HACK if (mte.ePowerPass) { mte.getBaseMetaTileEntity().enableWorking(); @@ -118,6 +122,7 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { eCertainMode = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eCertainMode; eCertainStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eCertainStatus; ePowerPass = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).ePowerPass; + ePowerPassCover = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).ePowerPassCover; eSafeVoid = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eSafeVoid; allowedToWork = mTileEntity.isAllowedToWork(); @@ -127,7 +132,7 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { var1.sendProgressBarUpdate(this, i++, (eParamsInStatus[j].getOrdinalByte() | (eParamsOutStatus[j].getOrdinalByte() << 8))); } var1.sendProgressBarUpdate(this, 120, eCertainMode | (eCertainStatus << 8)); - var1.sendProgressBarUpdate(this, 121, (ePowerPass ? 1 : 0) + (eSafeVoid ? 2 : 0) + (allowedToWork ? 4 : 0)); + var1.sendProgressBarUpdate(this, 121, (ePowerPass ? 1 : 0) + (eSafeVoid ? 2 : 0) + (allowedToWork ? 4 : 0) + (ePowerPassButton?8:0)); for(int i=128,k=208,j=0;j<20;j++,i+=4,k+=4) { Util.sendDouble(eParamsOut[j], this, var1, i); Util.sendDouble(eParamsIn[j], this, var1, k); @@ -151,6 +156,7 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { ePowerPass = (par2 & 1) == 1; eSafeVoid = (par2 & 2) == 2; allowedToWork = (par2 & 4) == 4; + ePowerPassCover = (par2 & 8) == 8; } else if(par1>=128 && par1<208){ int pos=(par1-128)>>2; eParamsOut[pos]=Double.longBitsToDouble(eParamsOutl[pos]=Util.receiveLong(eParamsOutl[pos],par1&0xFFFFFFFC,par1,par2)); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java index 5f5ddf6e4a..070976006c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java @@ -18,13 +18,13 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; */ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Machine { - private String mName; - private static byte counter = 0; - private final boolean ePowerPassButton, eSafeVoidButton, allowedToWorkButton; - private final GT_Container_MultiMachineEM mContainer; + protected final String mName; + protected static byte counter = 0; + protected final boolean eSafeVoidButton, allowedToWorkButton,ePowerPassButton; + protected final GT_Container_MultiMachineEM mContainer; - public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile, boolean enablePowerPass, boolean enableSafeVoid, boolean enablePowerButton) { - super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); + protected GT_GUIContainer_MultiMachineEM(GT_Container_MultiMachineEM container, String aName, String aTextureFile,boolean enablePowerPass, boolean enableSafeVoid, boolean enablePowerButton) { + super(container, RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); mContainer=(GT_Container_MultiMachineEM)super.mContainer; mName = aName; ePowerPassButton=enablePowerPass; @@ -34,13 +34,16 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach xSize = 198; } + public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile,boolean enablePowerPass, boolean enableSafeVoid, boolean enablePowerButton) { + this(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity),aName,aTextureFile,enablePowerPass,enableSafeVoid,enablePowerButton); + } + + protected GT_GUIContainer_MultiMachineEM(GT_Container_MultiMachineEM container, String aName, String aTextureFile) { + this(container,aName,aTextureFile,true,true,true); + } + public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { - super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); - mContainer=(GT_Container_MultiMachineEM)super.mContainer; - mName = aName; - ePowerPassButton=eSafeVoidButton=allowedToWorkButton=true; - ySize= 192; - xSize = 198; + this(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity),aName,aTextureFile); } @Override @@ -108,10 +111,12 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach counter = (byte) ((1 + counter) % 6); GL11.glColor4f(1f, 1f, 1f, 1f); x+= 173; - if(!ePowerPassButton) { + if (!ePowerPassButton && !mContainer.ePowerPassCover) {//no function drawTexturedModalRect(x, y + 115, 231, 23, 18, 18); - } else if (mContainer.ePowerPass) { - drawTexturedModalRect(x, y + 115, 207, 23, 18, 18); + } else { + if (mContainer.ePowerPass) {// + drawTexturedModalRect(x, y + 115, 207, 23, 18, 18); + } } if(!eSafeVoidButton) { @@ -201,7 +206,7 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach } } - private void LEDdrawP(int x, int y, int i, int j, LedStatus status) { + protected void LEDdrawP(int x, int y, int i, int j, LedStatus status) { int v = 192, su = 8, sv = 6, u = 11; switch (status) { case STATUS_WTF: { @@ -290,7 +295,7 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach } } - private void LEDtooltips(int x,int y){ + protected void LEDtooltips(int x,int y){ int renderPosX=x; int renderPosY=y; x-= (width - xSize) / 2; @@ -330,7 +335,7 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach } } - private void hoveringText(List strings, int x, int y, FontRenderer font) { + protected void hoveringText(List strings, int x, int y, FontRenderer font) { if (!strings.isEmpty()) { GL11.glDisable(GL12.GL_RESCALE_NORMAL); //RenderHelper.disableStandardItemLighting(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java index 54f438aa9f..3a019de78c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java @@ -2,17 +2,23 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; -import com.github.technus.tectech.Vec3pos; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalDefinitionStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.core.tElementalException; -import com.github.technus.tectech.thing.metaTileEntity.IFrontRotation; +import com.github.technus.tectech.mechanics.elementalMatter.core.EMException; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; import com.github.technus.tectech.thing.metaTileEntity.hatch.*; -import com.github.technus.tectech.thing.metaTileEntity.RotationMessage; -import com.github.technus.tectech.loader.NetworkDispatcher; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.Util; +import com.gtnewhorizon.structurelib.StructureLibAPI; +import com.gtnewhorizon.structurelib.alignment.IAlignment; +import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; +import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider; +import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; +import com.gtnewhorizon.structurelib.alignment.enumerable.Flip; +import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.util.Vec3Impl; +import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -25,28 +31,29 @@ import gregtech.api.metatileentity.implementations.*; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Pollution; -import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; -import static com.github.technus.tectech.CommonValues.*; -import static com.github.technus.tectech.Util.*; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; +import static com.github.technus.tectech.util.CommonValues.*; +import static com.github.technus.tectech.util.DoubleCount.div; +import static com.github.technus.tectech.util.Util.getTier; +import static java.lang.Math.min; /** * Created by danie_000 on 27.10.2016. */ -public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEntity_MultiBlockBase implements IFrontRotation { +public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEntity_MultiBlockBase implements IAlignment { //region Client side variables (static - one per class) //Front icon holders - static so it is default one for my blocks @@ -79,6 +86,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected ArrayList<GT_MetaTileEntity_Hatch_InputData> eInputData = new ArrayList<>(); protected ArrayList<GT_MetaTileEntity_Hatch_OutputData> eOutputData = new ArrayList<>(); + //endregion + //region parameters public final Parameters parametrization; //endregion @@ -97,7 +106,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //storage for output EM that will be auto handled in case of failure to finish recipe //if you succed to use a recipe - be sure to output EM from outputEM to hatches in the output method - protected cElementalInstanceStackMap[] outputEM; + protected EMInstanceStackMap[] outputEM; //are parameters correct - change in check recipe/output/update params etc. (maintenance status boolean) protected boolean eParameters = true; @@ -109,6 +118,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //if u need to force some things to be fixed - u might need to override doRandomMaintenanceDamage protected byte minRepairStatus = 3; + //is power pass cover present + public boolean ePowerPassCover = false; + //functionality toggles - changed by buttons in gui also public boolean ePowerPass = false, eSafeVoid = false; @@ -129,8 +141,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt private boolean explodedThisTick = false; //front rotation val - private byte frontRotation = 0; - + private IAlignmentLimits alignmentLimits = IAlignmentLimits.UNLIMITED; + private ExtendedFacing extendedFacing = ExtendedFacing.DEFAULT; //endregion protected GT_MetaTileEntity_MultiblockBase_EM(int aID, String aName, String aNameRegional) { @@ -148,359 +160,69 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } //region SUPER STRUCT - @Override - public boolean isFrontRotationValid(byte frontRotation, byte frontFacing) { - return true; + public IAlignmentLimits getAlignmentLimits() { + return alignmentLimits; } - public boolean isFacingValid_EM(byte aFacing) { - return true; + @Override + public ExtendedFacing getExtendedFacing() { + return extendedFacing; } @Override - public void rotateAroundFrontPlane(boolean direction) { - if (direction) { - frontRotation++; - if (frontRotation > 3) frontRotation = 0; - } else { - frontRotation--; - if (frontRotation < 0) frontRotation = 3; - } - if (isFrontRotationValid(frontRotation, getBaseMetaTileEntity().getFrontFacing())) { - updateRotationOnClients(); - } else { - rotateAroundFrontPlane(direction); + public void setExtendedFacing(ExtendedFacing newExtendedFacing) { + if(extendedFacing!=newExtendedFacing){ + extendedFacing=newExtendedFacing; + IGregTechTileEntity base = getBaseMetaTileEntity(); + mMachine = false; + if (getBaseMetaTileEntity().isServerSide()) { + //NetworkDispatcher.INSTANCE.sendToAllAround(new AlignmentMessage.AlignmentData(this), + // base.getWorld().provider.dimensionId, + // base.getXCoord(), base.getYCoord(), base.getZCoord(), 512); + StructureLibAPI.sendAlignment((IAlignmentProvider) base, + new NetworkRegistry.TargetPoint(base.getWorld().provider.dimensionId, + base.getXCoord(), base.getYCoord(), base.getZCoord(), 512)); + }else{ + base.issueTextureUpdate(); + } } } - /** - * Gets AABB based on abc and not xyz, without offsetting to controller position!!! - * - * @param minA - * @param minB - * @param minC - * @param maxA - * @param maxB - * @param maxC - * @return - */ - public final AxisAlignedBB getBoundingBox(double minA, double minB, double minC, double maxA, double maxB, double maxC) { - double[] offSetsMin = getTranslatedOffsets(minA, minB, minC); - double[] offSetsMax = getTranslatedOffsets(maxA, maxB, maxC); - for (int i = 0; i < 3; i++) { - if (offSetsMax[i] < offSetsMin[i]) { - double temp = offSetsMax[i]; - offSetsMax[i] = offSetsMin[i]; - offSetsMin[i] = temp; - } - } - return AxisAlignedBB.getBoundingBox( - offSetsMin[0], offSetsMin[1], offSetsMin[2], - offSetsMax[0], offSetsMax[1], offSetsMax[2] - ); + @Override + public boolean isFacingValid(byte aFacing) { + return canSetToDirectionAny(ForgeDirection.getOrientation(aFacing)); + } + + @Override + public void onFacingChange() { + toolSetDirection(ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing())); } /** - * Translates relative axis coordinates abc to absolute axis coordinates xyz - * abc from the CONTROLLER! - * - * @param a - * @param b - * @param c - * @return + * Gets structure + * @return STATIC INSTANCE OF STRUCTURE */ - public final double[] getTranslatedOffsets(double a, double b, double c) { - double[] result = new double[3]; - switch (getBaseMetaTileEntity().getFrontFacing() + (frontRotation << 3)) { - case 4: - result[0] = c; - result[2] = a; - result[1] = -b; - break; - case 12: - result[0] = c; - result[1] = -a; - result[2] = -b; - break; - case 20: - result[0] = c; - result[2] = -a; - result[1] = b; - break; - case 28: - result[0] = c; - result[1] = a; - result[2] = b; - break; - - case 3: - result[0] = a; - result[2] = -c; - result[1] = -b; - break; - case 11: - result[1] = -a; - result[2] = -c; - result[0] = -b; - break; - case 19: - result[0] = -a; - result[2] = -c; - result[1] = b; - break; - case 27: - result[1] = a; - result[2] = -c; - result[0] = b; - break; - - case 5: - result[0] = -c; - result[2] = -a; - result[1] = -b; - break; - case 13: - result[0] = -c; - result[1] = -a; - result[2] = b; - break; - case 21: - result[0] = -c; - result[2] = a; - result[1] = b; - break; - case 29: - result[0] = -c; - result[1] = a; - result[2] = -b; - break; + public abstract IStructureDefinition<? extends GT_MetaTileEntity_MultiblockBase_EM> getStructure_EM(); - case 2: - result[0] = -a; - result[2] = c; - result[1] = -b; - break; - case 10: - result[1] = -a; - result[2] = c; - result[0] = b; - break; - case 18: - result[0] = a; - result[2] = c; - result[1] = b; - break; - case 26: - result[1] = a; - result[2] = c; - result[0] = -b; - break; - //Things get odd if the block faces up or down... - case 1: - result[0] = a; - result[2] = b; - result[1] = -c; - break;//similar to 3 - case 9: - result[2] = a; - result[0] = -b; - result[1] = -c; - break;//similar to 3 - case 17: - result[0] = -a; - result[2] = -b; - result[1] = -c; - break;//similar to 3 - case 25: - result[2] = -a; - result[0] = b; - result[1] = -c; - break;//similar to 3 - - case 0: - result[0] = -a; - result[2] = b; - result[1] = c; - break;//similar to 2 - case 8: - result[2] = a; - result[0] = b; - result[1] = c; - break; - case 16: - result[0] = a; - result[2] = -b; - result[1] = c; - break; - case 24: - result[2] = -a; - result[0] = -b; - result[0] = -b; - result[1] = +c; - break; - } - return result; + @SuppressWarnings("unchecked") + private IStructureDefinition<GT_MetaTileEntity_MultiblockBase_EM> getStructure_EM_Internal(){ + return (IStructureDefinition<GT_MetaTileEntity_MultiblockBase_EM>)getStructure_EM(); } - public final int[] getTranslatedOffsets(int a, int b, int c) { - int[] result = new int[3]; - switch (getBaseMetaTileEntity().getFrontFacing() + (frontRotation << 3)) { - case 4: - result[0] = c; - result[2] = a; - result[1] = -b; - break; - case 12: - result[0] = c; - result[1] = -a; - result[2] = -b; - break; - case 20: - result[0] = c; - result[2] = -a; - result[1] = b; - break; - case 28: - result[0] = c; - result[1] = a; - result[2] = b; - break; - - case 3: - result[0] = a; - result[2] = -c; - result[1] = -b; - break; - case 11: - result[1] = -a; - result[2] = -c; - result[0] = -b; - break; - case 19: - result[0] = -a; - result[2] = -c; - result[1] = b; - break; - case 27: - result[1] = a; - result[2] = -c; - result[0] = b; - break; - - case 5: - result[0] = -c; - result[2] = -a; - result[1] = -b; - break; - case 13: - result[0] = -c; - result[1] = -a; - result[2] = b; - break; - case 21: - result[0] = -c; - result[2] = a; - result[1] = b; - break; - case 29: - result[0] = -c; - result[1] = a; - result[2] = -b; - break; - - case 2: - result[0] = -a; - result[2] = c; - result[1] = -b; - break; - case 10: - result[1] = -a; - result[2] = c; - result[0] = b; - break; - case 18: - result[0] = a; - result[2] = c; - result[1] = b; - break; - case 26: - result[1] = a; - result[2] = c; - result[0] = -b; - break; - //Things get odd if the block faces up or down... - case 1: - result[0] = a; - result[2] = b; - result[1] = -c; - break;//similar to 3 - case 9: - result[2] = a; - result[0] = -b; - result[1] = -c; - break;//similar to 3 - case 17: - result[0] = -a; - result[2] = -b; - result[1] = -c; - break;//similar to 3 - case 25: - result[2] = -a; - result[0] = b; - result[1] = -c; - break;//similar to 3 - - case 0: - result[0] = -a; - result[2] = b; - result[1] = c; - break;//similar to 2 - case 8: - result[2] = a; - result[0] = b; - result[1] = c; - break; - case 16: - result[0] = a; - result[2] = -b; - result[1] = c; - break; - case 24: - result[2] = -a; - result[0] = -b; - result[0] = -b; - result[1] = +c; - break; - } - return result; + public final boolean structureCheck_EM(String piece,int horizontalOffset, int verticalOffset, int depthOffset) { + IGregTechTileEntity baseMetaTileEntity = getBaseMetaTileEntity(); + return getStructure_EM_Internal().check(this,piece, baseMetaTileEntity.getWorld(),getExtendedFacing(), + baseMetaTileEntity.getXCoord(),baseMetaTileEntity.getYCoord(),baseMetaTileEntity.getZCoord(), + horizontalOffset,verticalOffset,depthOffset,!mMachine); } - //can be used to check structures of multi-blocks larger than one chunk, but... - //ALL THE HATCHES AND THE CONTROLLER SHOULD BE IN ONE CHUNK OR IN LOADED CHUNKS - //@Deprecated - //public final boolean structureCheck_EM( - // String[][] structure,//0-9 casing, +- air no air, a-z ignore - // Block[] blockType,//use numbers 0-9 for casing types - // byte[] blockMeta,//use numbers 0-9 for casing types - // int horizontalOffset, int verticalOffset, int depthOffset) { - // return StructureChecker(structure, blockType, blockMeta, - // horizontalOffset, verticalOffset, depthOffset, getBaseMetaTileEntity(), !mMachine); - //} - - public final boolean structureCheck_EM( - String[][] structure,//0-9 casing, +- air no air, a-z ignore - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - IHatchAdder[] addingMethods, - short[] casingTextures, - Block[] blockTypeFallback,//use numbers 0-9 for casing types - byte[] blockMetaFallback,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset) { - return StructureCheckerExtreme(structure, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, - horizontalOffset, verticalOffset, depthOffset, getBaseMetaTileEntity(), this, !mMachine); + public final boolean structureBuild_EM(String piece, int horizontalOffset, int verticalOffset, int depthOffset, ItemStack trigger, boolean hintsOnly) { + IGregTechTileEntity baseMetaTileEntity = getBaseMetaTileEntity(); + return getStructure_EM_Internal().buildOrHints(this, trigger, piece, baseMetaTileEntity.getWorld(), + getExtendedFacing(), baseMetaTileEntity.getXCoord(), baseMetaTileEntity.getYCoord(), + baseMetaTileEntity.getZCoord(), horizontalOffset, verticalOffset, depthOffset, hintsOnly); } - //endregion //region METHODS TO OVERRIDE - general functionality, recipe check, output @@ -548,7 +270,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt */ @Override protected void addFluidOutputs(FluidStack[] mOutputFluids) { - int min = mOutputFluids.length > mOutputHatches.size() ? mOutputHatches.size() : mOutputFluids.length; + int min = Math.min(mOutputFluids.length, mOutputHatches.size()); for (int i = 0; i < min; ++i) { if (mOutputHatches.get(i) != null && mOutputFluids[i] != null && GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(mOutputHatches.get(i))) { mOutputHatches.get(i).fill(mOutputFluids[i], true); @@ -642,21 +364,23 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return new String[]{ "Progress:", - EnumChatFormatting.GREEN + Integer.toString(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + - EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", "Energy Hatches:", - EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", (mEUt * eAmpereFlow <= 0 ? "Probably uses: " : "Probably makes: ") + - EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t at " + - EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", - "Tier Rating: " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + - " Amp Rating: " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", + EnumChatFormatting.RED + GT_Utility.formatNumbers(Math.abs(mEUt)) + EnumChatFormatting.RESET + " EU/t at " + + EnumChatFormatting.RED + GT_Utility.formatNumbers(eAmpereFlow) + EnumChatFormatting.RESET + " A", + "Tier Rating: " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + + " Amp Rating: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eMaxAmpereFlow) + EnumChatFormatting.RESET + " A", "Problems: " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " Efficiency: " + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", "PowerPass: " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + " SafeVoid: " + EnumChatFormatting.BLUE + eSafeVoid, - "Computation: " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET + "Computation: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(eAvailableData) + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(eRequiredData) + EnumChatFormatting.RESET }; } @@ -728,7 +452,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4]}; } @@ -801,11 +525,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) { hatch_elemental.id = -1; } - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { + for (GT_MetaTileEntity_Hatch_OutputData hatch_data : eOutputData) { hatch_data.id = -1; hatch_data.q = null; } - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) { + for (GT_MetaTileEntity_Hatch_InputData hatch_data : eInputData) { hatch_data.id = -1; } for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) { @@ -903,7 +627,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt */ protected long getAvailableData_EM() { long result = 0; - Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); + IGregTechTileEntity baseMetaTileEntity = getBaseMetaTileEntity(); + Vec3Impl pos = new Vec3Impl(baseMetaTileEntity.getXCoord(),baseMetaTileEntity.getYCoord(),baseMetaTileEntity.getZCoord()); for (GT_MetaTileEntity_Hatch_InputData in : eInputData) { if (in.q != null) { Long value = in.q.contentIfNotInTrace(pos); @@ -975,13 +700,14 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt aNBT.setByte("eCertainM", eCertainMode); aNBT.setByte("eCertainS", eCertainStatus); aNBT.setByte("eMinRepair", minRepairStatus); - aNBT.setByte("eRotation", frontRotation); + aNBT.setByte("eRotation", (byte)extendedFacing.getRotation().getIndex()); + aNBT.setByte("eFlip", (byte)extendedFacing.getFlip().getIndex()); aNBT.setBoolean("eParam", eParameters); aNBT.setBoolean("ePass", ePowerPass); + aNBT.setBoolean("ePowerPassCover", ePowerPassCover); aNBT.setBoolean("eVoid", eSafeVoid); aNBT.setBoolean("eBoom", eDismantleBoom); aNBT.setBoolean("eOK", mMachine); - //Ensures compatibility if (mOutputItems != null) { aNBT.setInteger("mOutputItemsLength", mOutputItems.length); @@ -1011,7 +737,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt NBTTagCompound output = new NBTTagCompound(); for (int i = 0; i < outputEM.length; i++) { if (outputEM[i] != null) { - output.setTag(Integer.toString(i), outputEM[i].toNBT()); + output.setTag(Integer.toString(i), outputEM[i].toNBT(TecTech.definitionsRegistry)); } } aNBT.setTag("outputEM", output); @@ -1058,16 +784,20 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt eMaxAmpereGen = aNBT.getLong("eGenRating"); maxEUinputMin = aNBT.getLong("eMaxEUmin"); maxEUinputMax = aNBT.getLong("eMaxEUmax"); - eAmpereFlow = aNBT.getLong("eRating"); + eAmpereFlow = aNBT.hasKey("eRating")?aNBT.getLong("eRating"):1; eMaxAmpereFlow = aNBT.getLong("eMaxA"); eRequiredData = aNBT.getLong("eDataR"); eAvailableData = aNBT.getLong("eDataA"); eCertainMode = aNBT.getByte("eCertainM"); eCertainStatus = aNBT.getByte("eCertainS"); - minRepairStatus = aNBT.getByte("eMinRepair"); - frontRotation = aNBT.getByte("eRotation"); - eParameters = aNBT.getBoolean("eParam"); + minRepairStatus = aNBT.hasKey("eMinRepair")?aNBT.getByte("eMinRepair"):3; + extendedFacing=ExtendedFacing.of( + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()), + Rotation.byIndex(aNBT.getByte("eRotation")), + Flip.byIndex(aNBT.getByte("eFlip"))); + eParameters = !aNBT.hasKey("eParam") || aNBT.getBoolean("eParam"); ePowerPass = aNBT.getBoolean("ePass"); + ePowerPassCover = aNBT.getBoolean("ePowerPassCover"); eSafeVoid = aNBT.getBoolean("eVoid"); eDismantleBoom = aNBT.getBoolean("eBoom"); mMachine = aNBT.getBoolean("eOK"); @@ -1092,13 +822,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt int outputLen = aNBT.getInteger("eOutputStackCount"); if (outputLen > 0) { - outputEM = new cElementalInstanceStackMap[outputLen]; + outputEM = new EMInstanceStackMap[outputLen]; NBTTagCompound compound = aNBT.getCompoundTag("outputEM"); for (int i = 0; i < outputEM.length; i++) { if (compound.hasKey(Integer.toString(i))) { try { - outputEM[i] = cElementalInstanceStackMap.fromNBT(compound.getCompoundTag(Integer.toString(i))); - } catch (tElementalException e) { + outputEM[i] = EMInstanceStackMap.fromNBT(TecTech.definitionsRegistry,compound.getCompoundTag(Integer.toString(i))); + } catch (EMException e) { if (DEBUG_MODE) { e.printStackTrace(); } @@ -1216,7 +946,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt private void cleanOrExplode() { if (outputEM != null) { float mass = 0; - for (cElementalInstanceStackMap tree : outputEM) { + for (EMInstanceStackMap tree : outputEM) { if (tree != null) { mass += tree.getMass(); } @@ -1264,40 +994,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //region internal - @Override - public final byte getFrontRotation() { - return frontRotation; - } - - @Override - public final void forceSetRotationDoRender(byte rotation) { - frontRotation = rotation; - IGregTechTileEntity base = getBaseMetaTileEntity(); - if (base.isClientSide()) { - base.issueTextureUpdate(); - } - } - - protected final void updateRotationOnClients() { - if (getBaseMetaTileEntity().isServerSide()) { - IGregTechTileEntity base = getBaseMetaTileEntity(); - NetworkDispatcher.INSTANCE.sendToAllAround(new RotationMessage.RotationData(this), - base.getWorld().provider.dimensionId, - base.getXCoord(), - base.getYCoord(), - base.getZCoord(), - 256); - } - } - - @Override - public final boolean isFacingValid(byte aFacing) { - if (!isFrontRotationValid(frontRotation, aFacing)) { - rotateAroundFrontPlane(false); - } - return isFacingValid_EM(aFacing); - } - /** * internal check machine * @@ -1379,7 +1075,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { isFacingValid(aBaseMetaTileEntity.getFrontFacing()); if (getBaseMetaTileEntity().isClientSide()) { - NetworkDispatcher.INSTANCE.sendToServer(new RotationMessage.RotationQuery(this)); + StructureLibAPI.queryAlignment((IAlignmentProvider) aBaseMetaTileEntity); } onFirstTick_EM(aBaseMetaTileEntity); } @@ -1392,6 +1088,20 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt */ @Override public boolean onRunningTick(ItemStack aStack) { + return onRunningTickCheck(aStack); + } + + public boolean onRunningTickCheck_EM(ItemStack aStack) { + if (eRequiredData > eAvailableData) { + if (energyFlowOnRunningTick_EM(aStack, false)) { + stopMachine(); + } + return false; + } + return energyFlowOnRunningTick_EM(aStack, true); + } + + public boolean onRunningTickCheck(ItemStack aStack) { if (eRequiredData > eAvailableData) { if (energyFlowOnRunningTick(aStack, false)) { stopMachine(); @@ -1413,57 +1123,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } if (--mUpdate == 0 || --mStartUpCheck == 0 || cyclicUpdate() || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) { - mInputHatches.clear(); - mInputBusses.clear(); - mOutputHatches.clear(); - mOutputBusses.clear(); - mDynamoHatches.clear(); - mEnergyHatches.clear(); - mMufflerHatches.clear(); - mMaintenanceHatches.clear(); - - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { - hatch_elemental.id = -1; - } - } - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { - hatch_elemental.id = -1; - } - } - - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { - hatch_data.id = -1; - } - } - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { - hatch_data.id = -1; - } - } - - for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - hatch.getBaseMetaTileEntity().setActive(false); - } - } - for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - hatch.getBaseMetaTileEntity().setActive(false); - } - } - - eUncertainHatches.clear(); - eEnergyMulti.clear(); - eInputHatches.clear(); - eOutputHatches.clear(); - eParamHatches.clear(); - eMufflerHatches.clear(); - eDynamoMulti.clear(); - eOutputData.clear(); - eInputData.clear(); + clearHatches_EM(); if (aBaseMetaTileEntity instanceof BaseTileEntity) { ((BaseTileEntity) aBaseMetaTileEntity).ignoreUnloadedChunks = mMachine; @@ -1475,7 +1135,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt explodeMultiblock(); } if (outputEM != null) { - for (cElementalInstanceStackMap tree : outputEM) { + for (EMInstanceStackMap tree : outputEM) { if (tree != null && tree.hasStacks()) { explodeMultiblock(); } @@ -1488,122 +1148,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } if (mMachine) { - short id = 1; - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { - hatch_elemental.id = id++; - } - } - id = 1; - for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { - hatch_elemental.id = id++; - } - } + setupHatches_EM(); - id = 1; - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { - hatch_data.id = id++; - } - } - id = 1; - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { - hatch_data.id = id++; - } - } + setupEnergyHatchesVariables_EM(); - if (!mEnergyHatches.isEmpty() || !eEnergyMulti.isEmpty() || !mDynamoHatches.isEmpty() || !eDynamoMulti.isEmpty()) { - maxEUinputMin = V[15]; - maxEUinputMax = V[0]; - maxEUoutputMin = V[15]; - maxEUoutputMax = V[0]; - for (GT_MetaTileEntity_Hatch_Energy hatch : mEnergyHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - if (hatch.maxEUInput() < maxEUinputMin) { - maxEUinputMin = hatch.maxEUInput(); - } - if (hatch.maxEUInput() > maxEUinputMax) { - maxEUinputMax = hatch.maxEUInput(); - } - } - } - for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : eEnergyMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - if (hatch.maxEUInput() < maxEUinputMin) { - maxEUinputMin = hatch.maxEUInput(); - } - if (hatch.maxEUInput() > maxEUinputMax) { - maxEUinputMax = hatch.maxEUInput(); - } - } - } - for (GT_MetaTileEntity_Hatch_Dynamo hatch : mDynamoHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - if (hatch.maxEUOutput() < maxEUoutputMin) { - maxEUoutputMin = hatch.maxEUOutput(); - } - if (hatch.maxEUOutput() > maxEUoutputMax) { - maxEUoutputMax = hatch.maxEUOutput(); - } - } - } - for (GT_MetaTileEntity_Hatch_DynamoMulti hatch : eDynamoMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - if (hatch.maxEUOutput() < maxEUoutputMin) { - maxEUoutputMin = hatch.maxEUOutput(); - } - if (hatch.maxEUOutput() > maxEUoutputMax) { - maxEUoutputMax = hatch.maxEUOutput(); - } - } - } - eMaxAmpereFlow = 0; - eMaxAmpereGen = 0; - //counts only full amps - for (GT_MetaTileEntity_Hatch_Energy hatch : mEnergyHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - eMaxAmpereFlow += hatch.maxEUInput() / maxEUinputMin; - } - } - for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : eEnergyMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - eMaxAmpereFlow += hatch.maxEUInput() / maxEUinputMin * hatch.Amperes; - } - } - for (GT_MetaTileEntity_Hatch_Dynamo hatch : mDynamoHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - eMaxAmpereGen += hatch.maxEUOutput() / maxEUoutputMin; - } - } - for (GT_MetaTileEntity_Hatch_DynamoMulti hatch : eDynamoMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - eMaxAmpereGen += hatch.maxEUOutput() / maxEUoutputMin * hatch.Amperes; - } - } - } else { - maxEUinputMin = 0; - maxEUinputMax = 0; - eMaxAmpereFlow = 0; - maxEUoutputMin = 0; - maxEUoutputMax = 0; - eMaxAmpereGen = 0; - } if (getEUVar() > maxEUStore()) { setEUVar(maxEUStore()); } - - for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - hatch.getBaseMetaTileEntity().setActive(true); - } - } - for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { - hatch.getBaseMetaTileEntity().setActive(true); - } - } } else { maxEUinputMin = 0; maxEUinputMax = 0; @@ -1619,78 +1170,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (MULTI_PURGE_1_AT == Tick || MULTI_PURGE_2_AT == Tick) { purgeAllOverflowEM_EM(); } else if (MULTI_CHECK_AT == Tick) { - for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - if (GT_MetaTileEntity_MultiBlockBase.disableMaintenance) { - mWrench = true; - mScrewdriver = true; - mSoftHammer = true; - mHardHammer = true; - mSolderingTool = true; - mCrowbar = true; - } else { - if (tHatch.mAuto && !(mWrench && mScrewdriver && mSoftHammer && mHardHammer && mSolderingTool && mCrowbar)) { - tHatch.autoMaintainance(); - } - if (tHatch.mWrench) { - mWrench = true; - } - if (tHatch.mScrewdriver) { - mScrewdriver = true; - } - if (tHatch.mSoftHammer) { - mSoftHammer = true; - } - if (tHatch.mHardHammer) { - mHardHammer = true; - } - if (tHatch.mSolderingTool) { - mSolderingTool = true; - } - if (tHatch.mCrowbar) { - mCrowbar = true; - } - - tHatch.mWrench = false; - tHatch.mScrewdriver = false; - tHatch.mSoftHammer = false; - tHatch.mHardHammer = false; - tHatch.mSolderingTool = false; - tHatch.mCrowbar = false; - } - } - } + maintenance_EM(); } else if (MOVE_AT == Tick && eSafeVoid) { - for (GT_MetaTileEntity_Hatch_OverflowElemental voider : eMufflerHatches) { - if (voider.overflowMax < voider.getOverflowMatter()) { - continue; - } - float remaining = voider.overflowMax - voider.getOverflowMatter(); - for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { - for (cElementalInstanceStack instance : in.getContainerHandler().values()) { - 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)) { - voider.setOverflowMatter(voider.overflowMax); - } - in.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); - } - } - } - for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) { - for (cElementalInstanceStack instance : out.getContainerHandler().values()) { - 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)) { - voider.setOverflowMatter(voider.overflowMax); - } - out.getContainerHandler().removeAmount(false, new cElementalDefinitionStack(instance.definition, qty)); - } - } - } - } + safeVoid_EM(); } if (getRepairStatus() >= minRepairStatus) {//S @@ -1698,53 +1180,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt hatchesStatusUpdate_EM(); } - //region power pass and controller charging - {//DO - long euVar; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { - if (getEUVar() > getMinimumStoredEU()) { - break; - } - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUInput(); - if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) { - setEUVar(getEUVar() + euVar); - } - } - } - for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { - if (getEUVar() > getMinimumStoredEU()) { - break; - } - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUInput() * tHatch.Amperes; - if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) { - setEUVar(getEUVar() + euVar); - } - } - } - if (ePowerPass && getEUVar() > getMinimumStoredEU()) { - for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUOutput(); - if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7, 1), false)) { - tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); - } - } - } - for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - euVar = tHatch.maxEUOutput() * tHatch.Amperes; - if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7, tHatch.Amperes), false)) { - tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); - } - } - } - } - } - //endregion + dischargeController_EM(aBaseMetaTileEntity); + chargeController_EM(aBaseMetaTileEntity); if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) {//Start if (onRunningTick(mInventory[1])) {//Compute EU @@ -1753,41 +1190,22 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt stopMachine(); } - if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime && RECIPE_AT == Tick) {//progress increase and done + if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) {//progress increase and done hatchesStatusUpdate_EM(); outputAfterRecipe_EM(); cleanOutputEM_EM(); - if (mOutputItems != null) { - for (ItemStack tStack : mOutputItems) { - if (tStack != null) { - addOutput(tStack); - } - } - } - mOutputItems = null; - - if (mOutputFluids != null) { - if (mOutputFluids.length == 1) { - for (FluidStack tStack : mOutputFluids) { - if (tStack != null) { - addOutput(tStack); - } - } - } else if (mOutputFluids.length > 1) { - addFluidOutputs(mOutputFluids); - } - } - mOutputFluids = null; + addClassicOutputs_EM(); updateSlots(); mProgresstime = 0; mMaxProgresstime = 0; mEfficiencyIncrease = 0; + if (aBaseMetaTileEntity.isAllowedToWork()) { if (checkRecipe(mInventory[1])) { - mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - (getIdealStatus() - getRepairStatus()) * 1000)); + mEfficiency = Math.max(0, min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - (getIdealStatus() - getRepairStatus()) * 1000)); } else { afterRecipeCheckFailed(); } @@ -1802,7 +1220,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } else if (RECIPE_AT == Tick || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) { if (aBaseMetaTileEntity.isAllowedToWork()) { if (checkRecipe(mInventory[1])) { - mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - (getIdealStatus() - getRepairStatus()) * 1000)); + mEfficiency = Math.max(0, min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - (getIdealStatus() - getRepairStatus()) * 1000)); } else { afterRecipeCheckFailed(); } @@ -1828,6 +1246,385 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } + protected void addClassicOutputs_EM() { + if (mOutputItems != null) { + for (ItemStack tStack : mOutputItems) { + if (tStack != null) { + addOutput(tStack); + } + } + } + mOutputItems = null; + + if (mOutputFluids != null) { + if (mOutputFluids.length == 1) { + for (FluidStack tStack : mOutputFluids) { + if (tStack != null) { + addOutput(tStack); + } + } + } else if (mOutputFluids.length > 1) { + addFluidOutputs(mOutputFluids); + } + } + mOutputFluids = null; + } + + protected void safeVoid_EM() { + for (GT_MetaTileEntity_Hatch_OverflowElemental voider : eMufflerHatches) { + if (voider.overflowMax < voider.getOverflowMatter()) { + continue; + } + double remaining = voider.overflowMax - voider.getOverflowMatter(); + for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { + for (EMInstanceStack instance : in.getContentHandler().valuesToArray()) { + double qty = div(remaining, instance.getDefinition().getMass()); + if (qty > 0) { + qty = min(qty, instance.getAmount()); + if (voider.addOverflowMatter(instance.getDefinition().getMass() * qty)) { + voider.setOverflowMatter(voider.overflowMax); + } + in.getContentHandler().removeAmount(new EMDefinitionStack(instance.getDefinition(), qty)); + } + } + } + for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) { + for (EMInstanceStack instance : out.getContentHandler().valuesToArray()) { + double qty = div(remaining, instance.getDefinition().getMass()); + if (qty > 0) { + qty = min(qty, instance.getAmount()); + if (voider.addOverflowMatter(instance.getDefinition().getMass() * qty)) { + voider.setOverflowMatter(voider.overflowMax); + } + out.getContentHandler().removeAmount(new EMDefinitionStack(instance.getDefinition(), qty)); + } + } + } + } + } + + protected void maintenance_EM() { + for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + if (GT_MetaTileEntity_MultiBlockBase.disableMaintenance) { + mWrench = true; + mScrewdriver = true; + mSoftHammer = true; + mHardHammer = true; + mSolderingTool = true; + mCrowbar = true; + } else { + if (tHatch.mAuto && !(mWrench && mScrewdriver && mSoftHammer && mHardHammer && mSolderingTool && mCrowbar)) { + tHatch.autoMaintainance(); + } + if (tHatch.mWrench) { + mWrench = true; + } + if (tHatch.mScrewdriver) { + mScrewdriver = true; + } + if (tHatch.mSoftHammer) { + mSoftHammer = true; + } + if (tHatch.mHardHammer) { + mHardHammer = true; + } + if (tHatch.mSolderingTool) { + mSolderingTool = true; + } + if (tHatch.mCrowbar) { + mCrowbar = true; + } + + tHatch.mWrench = false; + tHatch.mScrewdriver = false; + tHatch.mSoftHammer = false; + tHatch.mHardHammer = false; + tHatch.mSolderingTool = false; + tHatch.mCrowbar = false; + } + } + } + } + + protected void clearHatches_EM() { + mInputHatches.clear(); + mInputBusses.clear(); + mOutputHatches.clear(); + mOutputBusses.clear(); + mDynamoHatches.clear(); + mEnergyHatches.clear(); + mMufflerHatches.clear(); + mMaintenanceHatches.clear(); + + for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { + hatch_elemental.id = -1; + } + } + for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { + hatch_elemental.id = -1; + } + } + + for (GT_MetaTileEntity_Hatch_DataConnector<?> hatch_data : eOutputData) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { + hatch_data.id = -1; + } + } + for (GT_MetaTileEntity_Hatch_DataConnector<?> hatch_data : eInputData) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { + hatch_data.id = -1; + } + } + + for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + hatch.getBaseMetaTileEntity().setActive(false); + } + } + for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + hatch.getBaseMetaTileEntity().setActive(false); + } + } + + eUncertainHatches.clear(); + eEnergyMulti.clear(); + eInputHatches.clear(); + eOutputHatches.clear(); + eParamHatches.clear(); + eMufflerHatches.clear(); + eDynamoMulti.clear(); + eOutputData.clear(); + eInputData.clear(); + } + + protected void setupHatches_EM() { + short id = 1; + for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { + hatch_elemental.id = id++; + } + } + id = 1; + for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) { + hatch_elemental.id = id++; + } + } + + id = 1; + for (GT_MetaTileEntity_Hatch_DataConnector<?> hatch_data : eOutputData) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { + hatch_data.id = id++; + } + } + id = 1; + for (GT_MetaTileEntity_Hatch_DataConnector<?> hatch_data : eInputData) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { + hatch_data.id = id++; + } + } + + for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + hatch.getBaseMetaTileEntity().setActive(true); + } + } + for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + hatch.getBaseMetaTileEntity().setActive(true); + } + } + } + + protected void setupEnergyHatchesVariables_EM() { + if (!mEnergyHatches.isEmpty() || !eEnergyMulti.isEmpty() || !mDynamoHatches.isEmpty() || !eDynamoMulti.isEmpty()) { + maxEUinputMin = V[15]; + maxEUinputMax = V[0]; + maxEUoutputMin = V[15]; + maxEUoutputMax = V[0]; + for (GT_MetaTileEntity_Hatch_Energy hatch : mEnergyHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + if (hatch.maxEUInput() < maxEUinputMin) { + maxEUinputMin = hatch.maxEUInput(); + } + if (hatch.maxEUInput() > maxEUinputMax) { + maxEUinputMax = hatch.maxEUInput(); + } + } + } + for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : eEnergyMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + if (hatch.maxEUInput() < maxEUinputMin) { + maxEUinputMin = hatch.maxEUInput(); + } + if (hatch.maxEUInput() > maxEUinputMax) { + maxEUinputMax = hatch.maxEUInput(); + } + } + } + for (GT_MetaTileEntity_Hatch_Dynamo hatch : mDynamoHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + if (hatch.maxEUOutput() < maxEUoutputMin) { + maxEUoutputMin = hatch.maxEUOutput(); + } + if (hatch.maxEUOutput() > maxEUoutputMax) { + maxEUoutputMax = hatch.maxEUOutput(); + } + } + } + for (GT_MetaTileEntity_Hatch_DynamoMulti hatch : eDynamoMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + if (hatch.maxEUOutput() < maxEUoutputMin) { + maxEUoutputMin = hatch.maxEUOutput(); + } + if (hatch.maxEUOutput() > maxEUoutputMax) { + maxEUoutputMax = hatch.maxEUOutput(); + } + } + } + eMaxAmpereFlow = 0; + eMaxAmpereGen = 0; + //counts only full amps + for (GT_MetaTileEntity_Hatch_Energy hatch : mEnergyHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + eMaxAmpereFlow += hatch.maxEUInput() / maxEUinputMin; + } + } + for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : eEnergyMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + eMaxAmpereFlow += hatch.maxEUInput() / maxEUinputMin * hatch.Amperes; + } + } + for (GT_MetaTileEntity_Hatch_Dynamo hatch : mDynamoHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + eMaxAmpereGen += hatch.maxEUOutput() / maxEUoutputMin; + } + } + for (GT_MetaTileEntity_Hatch_DynamoMulti hatch : eDynamoMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { + eMaxAmpereGen += hatch.maxEUOutput() / maxEUoutputMin * hatch.Amperes; + } + } + } else { + maxEUinputMin = 0; + maxEUinputMax = 0; + eMaxAmpereFlow = 0; + maxEUoutputMin = 0; + maxEUoutputMax = 0; + eMaxAmpereGen = 0; + } + } + + protected void dischargeController_EM(IGregTechTileEntity aBaseMetaTileEntity) { + if(ePowerPass && getEUVar() > getMinimumStoredEU()){ + powerPass(aBaseMetaTileEntity); + } + } + + protected final void powerPass(IGregTechTileEntity aBaseMetaTileEntity) { + long euVar; + for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUOutput() * tHatch.maxAmperesOut(); + if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, tHatch.maxAmperesOut()), false)) { + tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); + } + } + } + for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUOutput() * tHatch.maxAmperesOut(); + if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, tHatch.maxAmperesOut()), false)) { + tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); + } + } + } + } + + protected final void powerPass_EM(IGregTechTileEntity aBaseMetaTileEntity) { + long euVar; + for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUOutput(); + if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, 1), false)) { + tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); + } + } + } + for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUOutput() * tHatch.Amperes; + if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, tHatch.Amperes), false)) { + tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); + } + } + } + } + + protected void chargeController_EM(IGregTechTileEntity aBaseMetaTileEntity) { + powerInput(); + } + + protected final void powerInput() { + long euVar; + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { + if (getEUVar() > getMinimumStoredEU()) { + break; + } + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = Math.min(tHatch.maxEUInput() * tHatch.maxAmperesIn(),tHatch.getEUVar()); + if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) { + setEUVar(getEUVar() + euVar); + } + } + } + for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { + if (getEUVar() > getMinimumStoredEU()) { + break; + } + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = Math.min(tHatch.maxEUInput() * tHatch.maxAmperesIn(),tHatch.getEUVar()); + if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) { + setEUVar(getEUVar() + euVar); + } + } + } + } + + protected final void powerInput_EM() { + long euVar; + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { + if (getEUVar() > getMinimumStoredEU()) { + break; + } + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUInput(); + if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) { + setEUVar(getEUVar() + euVar); + } + } + } + for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { + if (getEUVar() > getMinimumStoredEU()) { + break; + } + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + euVar = tHatch.maxEUInput() * tHatch.Amperes; + if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) { + setEUVar(getEUVar() + euVar); + } + } + } + } + //endregion //region EFFICIENCY AND FIXING LIMITS @@ -1852,13 +1649,26 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //region ENERGY!!!! //new method - private boolean energyFlowOnRunningTick(ItemStack aStack, boolean allowProduction) { + public boolean energyFlowOnRunningTick_EM(ItemStack aStack, boolean allowProduction) { long euFlow = mEUt * eAmpereFlow;//quick scope sign if (allowProduction && euFlow > 0) { addEnergyOutput_EM((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); } else if (euFlow < 0) { if (!drainEnergyInput_EM(mEUt, (long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, mEfficiency), eAmpereFlow)) { - stopMachine(); + criticalStopMachine(); + return false; + } + } + return true; + } + + public boolean energyFlowOnRunningTick(ItemStack aStack, boolean allowProduction) { + long euFlow = mEUt * eAmpereFlow;//quick scope sign + if (allowProduction && euFlow > 0) { + addEnergyOutput_EM((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); + } else if (euFlow < 0) { + if (!drainEnergyInput((long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, mEfficiency), eAmpereFlow)) { + criticalStopMachine(); return false; } } @@ -1900,39 +1710,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Deprecated @Override - public final boolean addEnergyOutput(long EU) { - if (EU <= 0L) { - return true; - } - for (GT_MetaTileEntity_Hatch tHatch : eDynamoMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - if (tHatch.maxEUOutput() < EU) { - explodeMultiblock(); - } - if (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(EU, false)) { - return true; - } - } - } - for (GT_MetaTileEntity_Hatch tHatch : mDynamoHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - if (tHatch.maxEUOutput() < EU) { - explodeMultiblock(); - } - if (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(EU, false)) { - return true; - } - } - } - return false; + public final boolean addEnergyOutput(long eu) { + return addEnergyOutput_EM(eu,1); } - /** - * @param EU - * @param Amperes - * @return if was able to put inside the hatches - */ - private boolean addEnergyOutput_EM(long EU, long Amperes) { + public boolean addEnergyOutput_EM(long EU, long Amperes) { if (EU < 0) { EU = -EU; } @@ -1975,47 +1757,35 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } } - setEUVar(Math.min(getEUVar() + euVar, maxEUStore())); + setEUVar(min(getEUVar() + euVar, maxEUStore())); return false; } @Deprecated @Override - public final boolean drainEnergyInput(long EU) { - if (EU <= 0L) { - return true; - } - for (GT_MetaTileEntity_Hatch tHatch : eEnergyMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch) && tHatch.maxEUInput() > EU && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) { - return true; - } - } - for (GT_MetaTileEntity_Hatch tHatch : mEnergyHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch) && tHatch.maxEUInput() > EU && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) { - return true; - } - } - return false; + public final boolean drainEnergyInput(long eu) { + return drainEnergyInput_EM(0,eu,1); } - private boolean drainEnergyInput_EM(long EUtTierVoltage, long EUtEffective, long Amperes) { - if (EUtTierVoltage < 0) { - EUtTierVoltage = -EUtTierVoltage; + public boolean drainEnergyInput_EM(long EUtTierVoltage, long EUtEffective, long Amperes) { + long EUuse = EUtEffective * Amperes; + if(EUuse==0){ + return true; } - if (EUtEffective < 0) { - EUtEffective = -EUtEffective; + if(maxEUinputMin==0){ + return false; } - if (Amperes < 0) { - Amperes = -Amperes; + if (EUuse < 0) { + EUuse = -EUuse; } - long EUuse = EUtEffective * Amperes; if (EUuse > getEUVar() || //not enough power - EUtTierVoltage > maxEUinputMax || //TIER IS BASED ON BEST HATCH! not total EUtEffective input - (EUtTierVoltage * Amperes - 1) / maxEUinputMin + 1 > eMaxAmpereFlow) {// EUuse==0? --> (EUuse - 1) / maxEUinputMin + 1 = 1! //if not too much A + (EUtTierVoltage==0? EUuse> getMaxInputEnergy(): + (EUtTierVoltage > maxEUinputMax) || //TIER IS BASED ON BEST HATCH! not total EUtEffective input + (EUtTierVoltage * Amperes - 1) / maxEUinputMin + 1 > eMaxAmpereFlow)) {// EUuse==0? --> (EUuse - 1) / maxEUinputMin + 1 = 1! //if not too much A if (DEBUG_MODE) { TecTech.LOGGER.debug("L1 " + EUuse + ' ' + getEUVar() + ' ' + (EUuse > getEUVar())); TecTech.LOGGER.debug("L2 " + EUtEffective + ' ' + maxEUinputMax + ' ' + (EUtEffective > maxEUinputMax)); - TecTech.LOGGER.debug("L3 " + EUuse + ' ' + eMaxAmpereFlow); + TecTech.LOGGER.debug("L3 " + Amperes + ' ' + getMaxInputEnergy()); TecTech.LOGGER.debug("L4 " + ((EUuse - 1) / maxEUinputMin + 1) + ' ' + eMaxAmpereFlow + ' ' + ((EUuse - 1) / maxEUinputMin + 1 > eMaxAmpereFlow)); } return false; @@ -2025,6 +1795,26 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return true; } + public boolean drainEnergyInput(long EUtEffective, long Amperes) { + long EUuse = EUtEffective * Amperes; + if(EUuse==0){ + return true; + } + if(maxEUinputMin==0){ + return false; + } + if (EUuse < 0) { + EUuse = -EUuse; + } + //not enough power + if (EUuse > getEUVar() || EUuse > getMaxInputEnergy()) {// EUuse==0? --> (EUuse - 1) / maxEUinputMin + 1 = 1! //if not too much A + return false; + } + //sub eu + setEUVar(getEUVar() - EUuse); + return true; + } + //new method public final boolean overclockAndPutValuesIn_EM(long EU, int time) {//TODO revise if (EU == 0L) { @@ -2032,7 +1822,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt mMaxProgresstime = time; return true; } - long tempEUt = EU < V[1] ? V[1] : EU; + long tempEUt = Math.max(EU, V[1]); long tempTier = maxEUinputMax >> 2; while (tempEUt < tempTier) { tempEUt <<= 2; @@ -2050,7 +1840,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt }//Use in EM check recipe return statement if you want overclocking @Override // same as gt sum of all hatches - public final long getMaxInputVoltage() { + public long getMaxInputVoltage() { + return getMaxInputVoltageSum(); + } + + // same as gt sum of all hatches + public final long getMaxInputVoltageSum() { long rVoltage = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { @@ -2070,12 +1865,27 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt long energy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + energy += tHatch.maxEUInput()*tHatch.maxAmperesIn(); + } + } + for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + energy += tHatch.maxEUInput()*tHatch.maxAmperesIn(); + } + } + return energy; + } + + public final long getMaxInputEnergy_EM() { + long energy = 0; + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { energy += tHatch.maxEUInput(); } } for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - energy += tHatch.maxEUInput() * tHatch.Amperes; + energy += tHatch.maxEUInput()*tHatch.Amperes; } } return energy; @@ -2099,19 +1909,19 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //region convenience copies input and output EM //new Method - public final cElementalInstanceStackMap getInputsClone_EM() { - cElementalInstanceStackMap in = new cElementalInstanceStackMap(); + public final EMInstanceStackMap getInputsClone_EM() { + EMInstanceStackMap in = new EMInstanceStackMap(); for (GT_MetaTileEntity_Hatch_ElementalContainer hatch : eInputHatches) { - in.putUnifyAll(hatch.getContainerHandler()); + in.putUnifyAll(hatch.getContentHandler()); } return in.hasStacks() ? in : null; } //new Method - public final cElementalInstanceStackMap getOutputsClone_EM() { - cElementalInstanceStackMap out = new cElementalInstanceStackMap(); + public final EMInstanceStackMap getOutputsClone_EM() { + EMInstanceStackMap out = new EMInstanceStackMap(); for (GT_MetaTileEntity_Hatch_ElementalContainer hatch : eOutputHatches) { - out.putUnifyAll(hatch.getContainerHandler()); + out.putUnifyAll(hatch.getContentHandler()); } return out.hasStacks() ? out : null; } @@ -2141,17 +1951,17 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (target == null) { return; } - cleanMassEM_EM(target.getContainerHandler().getMass()); + cleanMassEM_EM(target.getContentHandler().getMass()); } - public void cleanStackEM_EM(cElementalInstanceStack target) { + public void cleanStackEM_EM(EMInstanceStack target) { if (target == null) { return; } cleanMassEM_EM(target.getMass()); } - public void cleanMassEM_EM(float mass) { + public void cleanMassEM_EM(double mass) { if (mass > 0) { if (eMufflerHatches.size() < 1) { TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(), mass); @@ -2176,7 +1986,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return; } float mass = 0; - for (cElementalInstanceStackMap map : outputEM) { + for (EMInstanceStackMap map : outputEM) { if (map != null) { mass += map.getMass(); } @@ -2264,13 +2074,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public void doExplosion(long aExplosionPower) { - explodeMultiblock(); if (!TecTech.configTecTech.BOOM_ENABLE) { TecTech.proxy.broadcast("Multi DoExplosion BOOM! " + getBaseMetaTileEntity().getXCoord() + ' ' + getBaseMetaTileEntity().getYCoord() + ' ' + getBaseMetaTileEntity().getZCoord()); StackTraceElement[] ste = Thread.currentThread().getStackTrace(); TecTech.proxy.broadcast("Multi DoExplosion BOOM! " + ste[2].toString()); return; } + explodeMultiblock(); super.doExplosion(aExplosionPower); }//Redirecting to explodemultiblock //endregion @@ -2759,4 +2569,4 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return false; } //endregion -}
\ No newline at end of file +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java deleted file mode 100644 index b695472012..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi.base; - - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - -public interface IHatchAdder { - Boolean apply(IGregTechTileEntity iGregTechTileEntity, Short aShort); -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java index 41bc0e5a37..8429bf4e67 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java @@ -5,68 +5,70 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; */ public class MultiblockControl<T>{ - private final int[] controls=new int[7]; private final boolean shouldExplode; - private final T values; + private final T value; + private final int eUt; + private final int amperes; + private final int requiredData; + private final int effIncrease; + private final int maxProgressTime; + private final int pollutionToAdd; + private final double excessMass; - public MultiblockControl(T values, int EUt, int amperes, int requiredData, int effIncrease, int maxProgressTime){ - this.values = values; - controls[0]=EUt; - controls[1]=amperes; - controls[2]=requiredData; - controls[3]=effIncrease; - controls[4]=maxProgressTime; - shouldExplode=false; + public MultiblockControl(T value, int eUt, int amperes, int requiredData, int effIncrease, int maxProgressTime, int pollutionToAdd, double excessMass,boolean shouldExplode){ + this.value = value; + this.eUt = eUt; + this.amperes = amperes; + this.requiredData = requiredData; + this.effIncrease = effIncrease; + this.maxProgressTime = maxProgressTime; + this.pollutionToAdd = pollutionToAdd; + this.excessMass = excessMass; + this.shouldExplode=shouldExplode; } - public MultiblockControl(T values, int EUt, int amperes, int requiredData, int effIncrease, int maxProgressTime, int pollutionToAdd, float excessMass){ - this.values = values; - controls[0]=EUt; - controls[1]=amperes; - controls[2]=requiredData; - controls[3]=effIncrease; - controls[4]=maxProgressTime; - controls[5]=pollutionToAdd; - controls[6]=Float.floatToIntBits(excessMass); - shouldExplode=false; + public MultiblockControl(T value, int eUt, int amperes, int requiredData, int effIncrease, int maxProgressTime, int pollutionToAdd, double excessMass){ + this(value, eUt, amperes, requiredData, effIncrease, maxProgressTime,pollutionToAdd,excessMass,false); } - public MultiblockControl(float excessMass){ - this.values = null; - controls[6]=Float.floatToIntBits(excessMass); - shouldExplode=true; + public MultiblockControl(T value, int eUt, int amperes, int requiredData, int effIncrease, int maxProgressTime){ + this(value,eUt,amperes,requiredData,effIncrease,maxProgressTime,0,0); + } + + public MultiblockControl(double excessMass){ + this(null,0,0,0,0,0,0,excessMass,true); } public T getValue() { - return values; + return value; } public int getEUT(){ - return controls[0]; + return eUt; } public int getAmperage(){ - return controls[1]; + return amperes; } public int getRequiredData(){ - return controls[2]; + return requiredData; } public int getEffIncrease(){ - return controls[3]; + return effIncrease; } public int getMaxProgressTime(){ - return controls[4]; + return maxProgressTime; } public int getPollutionToAdd(){ - return controls[5]; + return pollutionToAdd; } - public float getExcessMass(){ - return Float.intBitsToFloat(controls[6]); + public double getExcessMass(){ + return excessMass; } public boolean shouldExplode() { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/SoundLoop.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/SoundLoop.java index 338af1626e..e8e1a7eb27 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/SoundLoop.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/SoundLoop.java @@ -25,7 +25,7 @@ public class SoundLoop extends MovingSound{ zPosF=base.getZCoord(); worldID=base.getWorld().provider.dimensionId; repeat=true; - volume=0f; + volume= 0.0625f; } @Override @@ -34,14 +34,13 @@ public class SoundLoop extends MovingSound{ return; } if(fadeMe) { - volume-=0.05f; - if(volume<0){ + volume-=0.0625f; + if(volume<=0){ volume=0; - }else if(volume==0){ donePlaying=true; } }else if(volume<1) { - volume += 0.05f; + volume += 0.0625f; } World world=Minecraft.getMinecraft().thePlayer.worldObj; donePlaying=world.provider.dimensionId!=worldID || diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedTexture.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java index 39a12f1f86..5ed53634de 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedTexture.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/render/TT_RenderedExtendedFacingTexture.java @@ -1,6 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base.render; -import com.github.technus.tectech.thing.metaTileEntity.IFrontRotation; +import com.github.technus.tectech.util.LightingHelper; +import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider; +import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; import gregtech.api.enums.Dyes; import gregtech.api.interfaces.IColorModulationContainer; import gregtech.api.interfaces.IIconContainer; @@ -14,8 +16,9 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; -public class TT_RenderedTexture implements ITexture,IColorModulationContainer { +public class TT_RenderedExtendedFacingTexture implements ITexture,IColorModulationContainer { private final IIconContainer mIconContainer; private final boolean mAllowAlpha; /** @@ -26,58 +29,64 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { */ public short[] mRGBa; - public TT_RenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean aAllowAlpha) { + public TT_RenderedExtendedFacingTexture(IIconContainer aIcon, short[] aRGBa, boolean aAllowAlpha) { if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ TT_RenderedTexture"); mIconContainer = aIcon; mAllowAlpha = aAllowAlpha; mRGBa = aRGBa; } - public TT_RenderedTexture(IIconContainer aIcon, short[] aRGBa) { + public TT_RenderedExtendedFacingTexture(IIconContainer aIcon, short[] aRGBa) { this(aIcon, aRGBa, true); } - public TT_RenderedTexture(IIconContainer aIcon) { + public TT_RenderedExtendedFacingTexture(IIconContainer aIcon) { this(aIcon, Dyes._NULL.mRGBa); } @Override public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); - byte rotation = getRotation(aX, aY, aZ); + aRenderer.field_152631_f = true; + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingXPos(aBlock, aX, aY, aZ).setupColor(ForgeDirection.EAST.ordinal(), mRGBa); + ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceXPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); + lighting.setupColor(ForgeDirection.EAST.ordinal(), 0xffffff); renderFaceXPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } + aRenderer.field_152631_f = false; } @Override public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); - byte rotation = getRotation(aX, aY, aZ); + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingXNeg(aBlock, aX, aY, aZ).setupColor(ForgeDirection.WEST.ordinal(), mRGBa); + ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceXNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); + lighting.setupColor(ForgeDirection.WEST.ordinal(), 0xffffff); renderFaceXNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } } @Override public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 1.0F), (int) (mRGBa[1] * 1.0F), (int) (mRGBa[2] * 1.0F), mAllowAlpha ? 255 - mRGBa[3] : 255); - byte rotation = getRotation(aX, aY, aZ); + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingYPos(aBlock, aX, aY, aZ).setupColor(ForgeDirection.UP.ordinal(), mRGBa); + ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceYPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(255, 255, 255, 255); + lighting.setupColor(ForgeDirection.UP.ordinal(), 0xffffff); renderFaceYPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } } @Override public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255); - byte rotation = getRotation(aX, aY, aZ); + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingYNeg(aBlock, aX, aY, aZ).setupColor(ForgeDirection.DOWN.ordinal(), mRGBa); + ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceYNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { Tessellator.instance.setColorRGBA(255, 255, 255, 255); @@ -87,50 +96,73 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { @Override public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); - byte rotation = getRotation(aX, aY, aZ); + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingZPos(aBlock, aX, aY, aZ).setupColor(ForgeDirection.SOUTH.ordinal(), mRGBa); + ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceZPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); + lighting.setupColor(ForgeDirection.SOUTH.ordinal(), 0xffffff); renderFaceZPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } } @Override public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); - byte rotation = getRotation(aX, aY, aZ); + aRenderer.field_152631_f = true; + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingZNeg(aBlock, aX, aY, aZ).setupColor(ForgeDirection.NORTH.ordinal(), mRGBa); + ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceZNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); + lighting.setupColor(ForgeDirection.NORTH.ordinal(), 0xffffff); renderFaceZNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } + aRenderer.field_152631_f = false; } - /** * Renders the given texture to the bottom face of the block. Args: block, x, y, z, texture */ - public void renderFaceYNeg(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, byte rotation) { + public void renderFaceYNeg(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing rotation) { Tessellator tessellator = Tessellator.instance; if (aRenderer.hasOverrideBlockTexture()) { icon = aRenderer.overrideBlockTexture; } - double d3 = (double) icon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); - double d4 = (double) icon.getInterpolatedU(aRenderer.renderMinX * 16.0D); - double d5 = (double) icon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); - double d6 = (double) icon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); + double d3 = icon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); + double d4 = icon.getInterpolatedU(aRenderer.renderMinX * 16.0D); + double d5 = icon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); + double d6 = icon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = (double) icon.getMaxU(); - d4 = (double) icon.getMinU(); + d3 = icon.getMaxU(); + d4 = icon.getMinU(); } if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d5 = (double) icon.getMinV(); - d6 = (double) icon.getMaxV(); + d5 = icon.getMinV(); + d6 = icon.getMaxV(); + } + + { + double temp; + switch (rotation.getFlip().ordinal()){ + case 1: + temp=d3; + d3=d4; + d4=temp; + break; + case 2: + temp=d5; + d5=d6; + d6=temp; + case 3: + temp=d3; + d3=d4; + d4=temp; + break; + } } double d7 = d4; @@ -138,12 +170,12 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { double d9 = d5; double d10 = d6; - switch (rotation) { + switch (rotation.getRotation().ordinal()) { case 3: - d3 = (double) icon.getInterpolatedU(aRenderer.renderMaxZ * 16.0D); - d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxX * 16.0D); - d4 = (double) icon.getInterpolatedU(aRenderer.renderMinZ * 16.0D); - d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinX * 16.0D); + d3 = icon.getInterpolatedU(aRenderer.renderMaxZ * 16.0D); + d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxX * 16.0D); + d4 = icon.getInterpolatedU(aRenderer.renderMinZ * 16.0D); + d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMinX * 16.0D); d9 = d5; d10 = d6; d7 = d3; @@ -152,10 +184,10 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { d6 = d9; break; case 1: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinZ * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMinX * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxZ * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMaxX * 16.0D); + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMinZ * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMinX * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxZ * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMaxX * 16.0D); d7 = d4; d8 = d3; d3 = d4; @@ -164,10 +196,10 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { d10 = d5; break; case 2: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxX * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinX * 16.0D); - d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinZ * 16.0D); - d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxZ * 16.0D); + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxX * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMinX * 16.0D); + d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMinZ * 16.0D); + d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxZ * 16.0D); d7 = d4; d8 = d3; d9 = d5; @@ -210,27 +242,46 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { /** * Renders the given texture to the top face of the block. Args: block, x, y, z, texture */ - public void renderFaceYPos(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, byte rotation) { + public void renderFaceYPos(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing rotation) { Tessellator tessellator = Tessellator.instance; if (aRenderer.hasOverrideBlockTexture()) { icon = aRenderer.overrideBlockTexture; } - double d3 = (double) icon.getInterpolatedU(aRenderer.renderMinX * 16.0D); - double d4 = (double) icon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); - double d5 = (double) icon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); - double d6 = (double) icon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); + double d3 = icon.getInterpolatedU(aRenderer.renderMinX * 16.0D); + double d4 = icon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); + double d5 = icon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); + double d6 = icon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = (double) icon.getMinU(); - d4 = (double) icon.getMaxU(); + d3 = icon.getMinU(); + d4 = icon.getMaxU(); } if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d5 = (double) icon.getMinV(); - - d6 = (double) icon.getMaxV(); + d5 = icon.getMinV(); + d6 = icon.getMaxV(); + } + + { + double temp; + switch (rotation.getFlip().ordinal()){ + case 1: + temp=d3; + d3=d4; + d4=temp; + break; + case 2: + temp=d5; + d5=d6; + d6=temp; + case 3: + temp=d3; + d3=d4; + d4=temp; + break; + } } double d7 = d4; @@ -238,12 +289,12 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { double d9 = d5; double d10 = d6; - switch (rotation) { + switch (rotation.getRotation().ordinal()) { case 1: - d3 = (double) icon.getInterpolatedU(aRenderer.renderMinZ * 16.0D); - d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxX * 16.0D); - d4 = (double) icon.getInterpolatedU(aRenderer.renderMaxZ * 16.0D); - d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinX * 16.0D); + d3 = icon.getInterpolatedU(aRenderer.renderMinZ * 16.0D); + d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxX * 16.0D); + d4 = icon.getInterpolatedU(aRenderer.renderMaxZ * 16.0D); + d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMinX * 16.0D); d9 = d5; d10 = d6; d7 = d3; @@ -252,10 +303,10 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { d6 = d9; break; case 3: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxZ * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMinX * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinZ * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMaxX * 16.0D); + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxZ * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMinX * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMinZ * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMaxX * 16.0D); d7 = d4; d8 = d3; d3 = d4; @@ -264,10 +315,10 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { d10 = d5; break; case 2: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinX * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxX * 16.0D); - d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinZ * 16.0D); - d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxZ * 16.0D); + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMinX * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxX * 16.0D); + d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMinZ * 16.0D); + d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxZ * 16.0D); d7 = d4; d8 = d3; d9 = d5; @@ -310,23 +361,24 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { /** * Renders the given texture to the north (z-negative) face of the block. Args: block, x, y, z, texture */ - public void renderFaceZNeg(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, byte rotation) { + public void renderFaceZNeg(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing rotation) { Tessellator tessellator = Tessellator.instance; if (aRenderer.hasOverrideBlockTexture()) { icon = aRenderer.overrideBlockTexture; } - double d3 = (double) icon.getInterpolatedU(aRenderer.renderMinX * 16.0D); - double d4 = (double) icon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); + double d3 = icon.getInterpolatedU(aRenderer.renderMinX * 16.0D); + double d4 = icon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); if (aRenderer.field_152631_f) { - d4 = (double) icon.getInterpolatedU((1.0D - aRenderer.renderMinX) * 16.0D); - d3 = (double) icon.getInterpolatedU((1.0D - aRenderer.renderMaxX) * 16.0D); + d4 = icon.getInterpolatedU((1.0D - aRenderer.renderMinX) * 16.0D); + d3 = icon.getInterpolatedU((1.0D - aRenderer.renderMaxX) * 16.0D); } - double d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxY * 16.0D); - double d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinY * 16.0D); + double d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxY * 16.0D); + double d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMinY * 16.0D); + double d7; if (aRenderer.flipTexture) { @@ -336,13 +388,33 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { } if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = (double) icon.getMinU(); - d4 = (double) icon.getMaxU(); + d3 = icon.getMinU(); + d4 = icon.getMaxU(); } if (aRenderer.renderMinY < 0.0D || aRenderer.renderMaxY > 1.0D) { - d5 = (double) icon.getMinV(); - d6 = (double) icon.getMaxV(); + d5 = icon.getMinV(); + d6 = icon.getMaxV(); + } + + { + double temp; + switch (rotation.getFlip().ordinal()){ + case 1: + temp=d3; + d3=d4; + d4=temp; + break; + case 2: + temp=d5; + d5=d6; + d6=temp; + case 3: + temp=d3; + d3=d4; + d4=temp; + break; + } } d7 = d4; @@ -350,12 +422,12 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { double d9 = d5; double d10 = d6; - switch (rotation) { + switch (rotation.getRotation().ordinal()) { case 3: - d3 = (double) icon.getInterpolatedU(aRenderer.renderMaxY * 16.0D); - d4 = (double) icon.getInterpolatedU(aRenderer.renderMinY * 16.0D); - d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinX * 16.0D); - d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxX * 16.0D); + d3 = icon.getInterpolatedU(aRenderer.renderMaxY * 16.0D); + d4 = icon.getInterpolatedU(aRenderer.renderMinY * 16.0D); + d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMinX * 16.0D); + d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxX * 16.0D); d9 = d5; d10 = d6; d7 = d3; @@ -364,10 +436,10 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { d6 = d9; break; case 1: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinY * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxY * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMaxX * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMinX * 16.0D); + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMinY * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxY * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMaxX * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMinX * 16.0D); d7 = d4; d8 = d3; d3 = d4; @@ -376,10 +448,10 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { d10 = d5; break; case 2: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinX * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxX * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMaxY * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMinY * 16.0D); + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMinX * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxX * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMaxY * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMinY * 16.0D); d7 = d4; d8 = d3; d9 = d5; @@ -422,17 +494,17 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { /** * Renders the given texture to the south (z-positive) face of the block. Args: block, x, y, z, texture */ - public void renderFaceZPos(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, byte rotation) { + public void renderFaceZPos(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing rotation) { Tessellator tessellator = Tessellator.instance; if (aRenderer.hasOverrideBlockTexture()) { icon = aRenderer.overrideBlockTexture; } - double d3 = (double) icon.getInterpolatedU(aRenderer.renderMinX * 16.0D); - double d4 = (double) icon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); - double d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxY * 16.0D); - double d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinY * 16.0D); + double d3 = icon.getInterpolatedU(aRenderer.renderMinX * 16.0D); + double d4 = icon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); + double d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxY * 16.0D); + double d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMinY * 16.0D); double d7; if (aRenderer.flipTexture) { @@ -442,13 +514,33 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { } if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = (double) icon.getMinU(); - d4 = (double) icon.getMaxU(); + d3 = icon.getMinU(); + d4 = icon.getMaxU(); } if (aRenderer.renderMinY < 0.0D || aRenderer.renderMaxY > 1.0D) { - d5 = (double) icon.getMinV(); - d6 = (double) icon.getMaxV(); + d5 = icon.getMinV(); + d6 = icon.getMaxV(); + } + + { + double temp; + switch (rotation.getFlip().ordinal()){ + case 1: + temp=d3; + d3=d4; + d4=temp; + break; + case 2: + temp=d5; + d5=d6; + d6=temp; + case 3: + temp=d3; + d3=d4; + d4=temp; + break; + } } d7 = d4; @@ -456,12 +548,12 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { double d9 = d5; double d10 = d6; - switch (rotation) { + switch (rotation.getRotation().ordinal()) { case 1: - d3 = (double) icon.getInterpolatedU(aRenderer.renderMinY * 16.0D); - d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinX * 16.0D); - d4 = (double) icon.getInterpolatedU(aRenderer.renderMaxY * 16.0D); - d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxX * 16.0D); + d3 = icon.getInterpolatedU(aRenderer.renderMinY * 16.0D); + d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMinX * 16.0D); + d4 = icon.getInterpolatedU(aRenderer.renderMaxY * 16.0D); + d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxX * 16.0D); d9 = d5; d10 = d6; d7 = d3; @@ -470,10 +562,10 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { d6 = d9; break; case 3: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxY * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMinX * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinY * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMaxX * 16.0D); + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxY * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMinX * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMinY * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMaxX * 16.0D); d7 = d4; d8 = d3; d3 = d4; @@ -482,10 +574,10 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { d10 = d5; break; case 2: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinX * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxX * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMaxY * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMinY * 16.0D); + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMinX * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxX * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMaxY * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMinY * 16.0D); d7 = d4; d8 = d3; d9 = d5; @@ -528,17 +620,17 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { /** * Renders the given texture to the west (x-negative) face of the block. Args: block, x, y, z, texture */ - public void renderFaceXNeg(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, byte rotation) { + public void renderFaceXNeg(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing rotation) { Tessellator tessellator = Tessellator.instance; if (aRenderer.hasOverrideBlockTexture()) { icon = aRenderer.overrideBlockTexture; } - double d3 = (double) icon.getInterpolatedU(aRenderer.renderMinZ * 16.0D); - double d4 = (double) icon.getInterpolatedU(aRenderer.renderMaxZ * 16.0D); - double d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxY * 16.0D); - double d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinY * 16.0D); + double d3 = icon.getInterpolatedU(aRenderer.renderMinZ * 16.0D); + double d4 = icon.getInterpolatedU(aRenderer.renderMaxZ * 16.0D); + double d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxY * 16.0D); + double d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMinY * 16.0D); double d7; if (aRenderer.flipTexture) { @@ -548,13 +640,33 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { } if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d3 = (double) icon.getMinU(); - d4 = (double) icon.getMaxU(); + d3 = icon.getMinU(); + d4 = icon.getMaxU(); } if (aRenderer.renderMinY < 0.0D || aRenderer.renderMaxY > 1.0D) { - d5 = (double) icon.getMinV(); - d6 = (double) icon.getMaxV(); + d5 = icon.getMinV(); + d6 = icon.getMaxV(); + } + + { + double temp; + switch (rotation.getFlip().ordinal()){ + case 1: + temp=d3; + d3=d4; + d4=temp; + break; + case 2: + temp=d5; + d5=d6; + d6=temp; + case 3: + temp=d3; + d3=d4; + d4=temp; + break; + } } d7 = d4; @@ -562,12 +674,12 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { double d9 = d5; double d10 = d6; - switch (rotation) { + switch (rotation.getRotation().ordinal()) { case 1: - d3 = (double) icon.getInterpolatedU(aRenderer.renderMinY * 16.0D); - d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxZ * 16.0D); - d4 = (double) icon.getInterpolatedU(aRenderer.renderMaxY * 16.0D); - d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinZ * 16.0D); + d3 = icon.getInterpolatedU(aRenderer.renderMinY * 16.0D); + d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxZ * 16.0D); + d4 = icon.getInterpolatedU(aRenderer.renderMaxY * 16.0D); + d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMinZ * 16.0D); d9 = d5; d10 = d6; d7 = d3; @@ -576,10 +688,10 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { d6 = d9; break; case 3: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxY * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinY * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxY * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMinY * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); d7 = d4; d8 = d3; d3 = d4; @@ -588,10 +700,10 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { d10 = d5; break; case 2: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinZ * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxZ * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMaxY * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMinY * 16.0D); + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMinZ * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxZ * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMaxY * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMinY * 16.0D); d7 = d4; d8 = d3; d9 = d5; @@ -634,23 +746,23 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { /** * Renders the given texture to the east (x-positive) face of the block. Args: block, x, y, z, texture */ - public void renderFaceXPos(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, byte rotation) { + public void renderFaceXPos(RenderBlocks aRenderer, double x, double y, double z, IIcon icon, ExtendedFacing rotation) { Tessellator tessellator = Tessellator.instance; if (aRenderer.hasOverrideBlockTexture()) { icon = aRenderer.overrideBlockTexture; } - double d3 = (double) icon.getInterpolatedU(aRenderer.renderMinZ * 16.0D); - double d4 = (double) icon.getInterpolatedU(aRenderer.renderMaxZ * 16.0D); + double d3 = icon.getInterpolatedU(aRenderer.renderMinZ * 16.0D); + double d4 = icon.getInterpolatedU(aRenderer.renderMaxZ * 16.0D); if (aRenderer.field_152631_f) { - d4 = (double) icon.getInterpolatedU((1.0D - aRenderer.renderMinZ) * 16.0D); - d3 = (double) icon.getInterpolatedU((1.0D - aRenderer.renderMaxZ) * 16.0D); + d4 = icon.getInterpolatedU((1.0D - aRenderer.renderMinZ) * 16.0D); + d3 = icon.getInterpolatedU((1.0D - aRenderer.renderMaxZ) * 16.0D); } - double d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxY * 16.0D); - double d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinY * 16.0D); + double d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxY * 16.0D); + double d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMinY * 16.0D); double d7; if (aRenderer.flipTexture) { @@ -660,13 +772,33 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { } if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d3 = (double) icon.getMinU(); - d4 = (double) icon.getMaxU(); + d3 = icon.getMinU(); + d4 = icon.getMaxU(); } if (aRenderer.renderMinY < 0.0D || aRenderer.renderMaxY > 1.0D) { - d5 = (double) icon.getMinV(); - d6 = (double) icon.getMaxV(); + d5 = icon.getMinV(); + d6 = icon.getMaxV(); + } + + { + double temp; + switch (rotation.getFlip().ordinal()){ + case 1: + temp=d3; + d3=d4; + d4=temp; + break; + case 2: + temp=d5; + d5=d6; + d6=temp; + case 3: + temp=d3; + d3=d4; + d4=temp; + break; + } } d7 = d4; @@ -674,12 +806,12 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { double d9 = d5; double d10 = d6; - switch (rotation) { + switch (rotation.getRotation().ordinal()) { case 3: - d3 = (double) icon.getInterpolatedU(aRenderer.renderMaxY * 16.0D); - d5 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMinZ * 16.0D); - d4 = (double) icon.getInterpolatedU(aRenderer.renderMinY * 16.0D); - d6 = (double) icon.getInterpolatedV(16.0D - aRenderer.renderMaxZ * 16.0D); + d3 = icon.getInterpolatedU(aRenderer.renderMaxY * 16.0D); + d5 = icon.getInterpolatedV(16.0D - aRenderer.renderMinZ * 16.0D); + d4 = icon.getInterpolatedU(aRenderer.renderMinY * 16.0D); + d6 = icon.getInterpolatedV(16.0D - aRenderer.renderMaxZ * 16.0D); d9 = d5; d10 = d6; d7 = d3; @@ -688,10 +820,10 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { d6 = d9; break; case 1: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinY * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxY * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMinY * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxY * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); d7 = d4; d8 = d3; d3 = d4; @@ -700,10 +832,10 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { d10 = d5; break; case 2: - d3 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMinZ * 16.0D); - d4 = (double) icon.getInterpolatedU(16.0D - aRenderer.renderMaxZ * 16.0D); - d5 = (double) icon.getInterpolatedV(aRenderer.renderMaxY * 16.0D); - d6 = (double) icon.getInterpolatedV(aRenderer.renderMinY * 16.0D); + d3 = icon.getInterpolatedU(16.0D - aRenderer.renderMinZ * 16.0D); + d4 = icon.getInterpolatedU(16.0D - aRenderer.renderMaxZ * 16.0D); + d5 = icon.getInterpolatedV(aRenderer.renderMaxY * 16.0D); + d6 = icon.getInterpolatedV(aRenderer.renderMinY * 16.0D); d7 = d4; d8 = d3; d9 = d5; @@ -753,17 +885,21 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { return mIconContainer != null; } - private static byte getRotation(int x, int y, int z) { + private static ExtendedFacing getExtendedFacing(int x, int y, int z) { World w = Minecraft.getMinecraft().theWorld; if (w != null) { TileEntity te = w.getTileEntity(x, y, z); if (te instanceof IGregTechTileEntity) { IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity(); - if (meta instanceof IFrontRotation) { - return ((IFrontRotation) meta).getFrontRotation(); + if (meta instanceof IAlignmentProvider) { + return ((IAlignmentProvider) meta).getAlignment().getExtendedFacing(); + }else{ + return ExtendedFacing.of(ForgeDirection.getOrientation(meta.getBaseMetaTileEntity().getFrontFacing())); } + } else if (te instanceof IAlignmentProvider) { + return ((IAlignmentProvider) te).getAlignment().getExtendedFacing(); } } - return 0; + return ExtendedFacing.DEFAULT; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java new file mode 100644 index 0000000000..a2a9eab3a1 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/GT_MetaTileEntity_EM_collider.java @@ -0,0 +1,693 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.em_collider; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMComplexAspectDefinition; +import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.EMPrimalAspectDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.core.decay.EMDecayResult; +import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.EMPrimitiveTemplate; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMDefinitionStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMHadronDefinition; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.EMQuarkDefinition; +import com.github.technus.tectech.thing.block.QuantumGlassBlock; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; +import com.gtnewhorizon.structurelib.StructureLibAPI; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.HashMap; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT; +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.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.DoubleCount.add; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; +import static net.minecraft.util.StatCollector.translateToLocal; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + //region variables + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + private static Textures.BlockIcons.CustomIcon ScreenON_Slave; + private static Textures.BlockIcons.CustomIcon ScreenOFF_Slave; + + protected static final byte FUSE_MODE = 0, COLLIDE_MODE = 1; + private static double MASS_TO_EU_INSTANT; + private static int STARTUP_COST, KEEPUP_COST; + + protected byte eTier = 0; + protected EMInstanceStack stack; + private long plasmaEnergy; + + protected boolean started = false; + //endregion + + //region collision handlers + public static final HashMap<Long, IColliderHandler> FUSE_HANDLERS = new HashMap<>(); + public static final HashMap<String, IPrimitiveColliderHandler> PRIMITIVE_FUSE_HANDLERS = new HashMap<>(); + + static { + FUSE_HANDLERS.put(((long) EMAtomDefinition.getClassTypeStatic() << 16) | EMAtomDefinition.getClassTypeStatic(), new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyAllExact(in2.getDefinition().getSubParticles()); + EMAtomDefinition atom = new EMAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return; + } + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + } + + @Override + public byte getRequiredTier() { + return 1; + } + }); + registerSimpleAtomFuse(EMHadronDefinition.getClassTypeStatic()); + registerSimpleAtomFuse(EMComplexAspectDefinition.getClassTypeStatic()); + registerSimpleAtomFuse(EMPrimitiveTemplate.getClassTypeStatic()); + + FUSE_HANDLERS.put(((long) EMHadronDefinition.getClassTypeStatic() << 16) | EMHadronDefinition.getClassTypeStatic(), new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyAllExact(in2.getDefinition().getSubParticles()); + EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return; + } + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + } + + @Override + public byte getRequiredTier() { + return 2; + } + }); + FUSE_HANDLERS.put(((long) EMHadronDefinition.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return; + } + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + } + + @Override + public byte getRequiredTier() { + return 2; + } + }); + + registerSimpleAspectFuse(EMComplexAspectDefinition.getClassTypeStatic()); + registerSimpleAspectFuse(EMPrimitiveTemplate.getClassTypeStatic()); + + FUSE_HANDLERS.put(((long) EMPrimitiveTemplate.getClassTypeStatic() << 16) | EMPrimitiveTemplate.getClassTypeStatic(), new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get(in1.getDefinition().getClass().getName() + '\0' + in2.getDefinition().getClass().getName()); + if (collisionHandler != null) { + collisionHandler.collide(in2, in1, out); + } else { + out.putUnifyAll(in1, in2); + } + } + + @Override + public byte getRequiredTier() { + return 2; + } + }); + + PRIMITIVE_FUSE_HANDLERS.put(EMQuarkDefinition.class.getName() + '\0' + EMQuarkDefinition.class.getName(), (in1, in2, out) -> { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyExact(in1.getDefinition().getStackForm(1)); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMHadronDefinition hadron = new EMHadronDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(hadron, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return; + } + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + }); + PRIMITIVE_FUSE_HANDLERS.put(EMPrimalAspectDefinition.class.getName() + '\0' + EMPrimalAspectDefinition.class.getName(), (in1, in2, out) -> { + if (fuseAspects(in1, in2, out)) return; + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + }); + } + + private static boolean fuseAspects(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyExact(in1.getDefinition().getStackForm(1)); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMComplexAspectDefinition aspect = new EMComplexAspectDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(aspect, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return true; + } + return false; + } + + private static void registerSimpleAspectFuse(int classTypeStatic) { + FUSE_HANDLERS.put(((long) EMComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + if (fuseAspects(in1, in2, out)) return; + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + } + + @Override + public byte getRequiredTier() { + return 1; + } + }); + } + + private static void registerSimpleAtomFuse(int classTypeStatic) { + FUSE_HANDLERS.put(((long) EMAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() { + @Override + public void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out) { + try { + EMDefinitionStackMap defs = new EMDefinitionStackMap(); + defs.putUnifyAllExact(in1.getDefinition().getSubParticles()); + defs.putUnifyExact(in2.getDefinition().getStackForm(1)); + EMAtomDefinition atom = new EMAtomDefinition(defs.toImmutable_optimized_unsafe_LeavesExposedElementalTree()); + out.putUnify(new EMInstanceStack(atom, Math.min(in1.getAmount(), in2.getAmount()))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); + return; + } + if (in1.getAmount() > in2.getAmount()) { + out.putUnify(new EMInstanceStack(in1.getDefinition(), in1.getAmount() - in2.getAmount())); + } else if (in2.getAmount() > in1.getAmount()) { + out.putUnify(new EMInstanceStack(in2.getDefinition(), in2.getAmount() - in1.getAmount())); + } + } + + @Override + public byte getRequiredTier() { + return 1; + } + }); + } + //endregion + + //region parameters + protected Parameters.Group.ParameterIn mode; + private static final IStatusFunction<GT_MetaTileEntity_EM_collider> MODE_STATUS = (base_EM, p) -> { + if (base_EM.isMaster()) { + double mode = p.get(); + if (mode == FUSE_MODE || mode == COLLIDE_MODE) { + return STATUS_OK; + } else if (mode > 1) { + return STATUS_TOO_HIGH; + } else if (mode < 0) { + return STATUS_TOO_LOW; + } + return STATUS_WRONG; + } + return STATUS_OK; + }; + private static final INameFunction<GT_MetaTileEntity_EM_collider> MODE_NAME = (base_EM, p) -> { + if (base_EM.isMaster()) { + double mode = p.get(); + if (mode == FUSE_MODE) { + return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.0");//Mode: Fuse + } else if (mode == COLLIDE_MODE) { + return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.1");//Mode: Collide + } + return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.2");//Mode: Undefined + } + return translateToLocal("gt.blockmachines.multimachine.em.collider.mode.3");//Currently Slaves... + }; + //endregion + + //region structure + //use multi A energy inputs, use less power the longer it runs + private static final String[] description = new String[]{ + EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", + translateToLocal("gt.blockmachines.multimachine.em.collider.hint.0"),//1 - Classic Hatches or High Power Casing + translateToLocal("gt.blockmachines.multimachine.em.collider.hint.1"),//2 - Elemental Input Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.collider.hint.2"),//3 - Elemental Output Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.collider.hint.3"),//4 - Elemental Overflow Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.collider.hint.4"),//General - Another Controller facing opposite direction + }; + + private static final IStructureDefinition<GT_MetaTileEntity_EM_collider> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_collider>builder() + .addShape("tier1", transpose(new String[][]{ + {" A A A ", " AAAAAAA ", " bbbbIIIbbbb ", " bAAAAAAAAAAAb ", " bAAAA AAAAb ", " bAAA AAAb ", " bAAA AAAb ", " bAA AAb ", " AbAA AAbA ", "AAbA AbAA", " AIA AIA ", "AAIA AIAA", " AIA AIA ", "AAbA AbAA", " AbAA AAbA ", " bAA AAb ", " bAAA AAAb ", " bAAA AAAb ", " bAAAAbJJJbAAAAb ", " bAHHbbbbbHHAb ", " bbbbGFGbbbb "}, + {" AAAAA ", " AADDDDDAA ", " cDDeeeeeDDc ", " cDeeDDDDDeeDc ", " cDeDD DDeDc ", " cDeD DeDc ", " cDeD DeDc ", " ADeD DeDA ", " ADeD DeDA ", "ADeD DeDA", "ADeD DeDA", "ADeD DeDA", "ADeD DeDA", "ADeD DeDA", " ADeD DeDA ", " ADeD DeDA ", " cDeD DeDc ", " cDeD DeDc ", " cDeDDbJ~JbDDeDc ", " cDeeDDDDDeeDc ", " cDDeeeeeDDc "}, + {" A A A ", " AAAAAAA ", " bbbbIIIbbbb ", " bAAAAAAAAAAAb ", " bAAAA AAAAb ", " bAAA AAAb ", " bAAA AAAb ", " bAA AAb ", " AbAA AAbA ", "AAbA AbAA", " AIA AIA ", "AAIA AIAA", " AIA AIA ", "AAbA AbAA", " AbAA AAbA ", " bAA AAb ", " bAAA AAAb ", " bAAA AAAb ", " bAAAAbJJJbAAAAb ", " bAHHbbbbbHHAb ", " bbbbGFGbbbb "} + })) + .addShape("tier2", transpose(new String[][]{ + {" A A A ", " AAAAAAA ", " BBBBIIIBBBB ", " BAAAAAAAAAAAB ", " BAAAA AAAAB ", " BAAA AAAB ", " BAAA AAAB ", " BAA AAB ", " ABAA AABA ", "AABA ABAA", " AIA AIA ", "AAIA AIAA", " AIA AIA ", "AABA ABAA", " ABAA AABA ", " BAA AAB ", " BAAA AAAB ", " BAAA AAAB ", " BAAAABJJJBAAAAB ", " BAHHBBBBBHHAB ", " BBBBGFGBBBB "}, + {" AAAAA ", " AADDDDDAA ", " CDDEEEEEDDC ", " CDEEDDDDDEEDC ", " CDEDD DDEDC ", " CDED DEDC ", " CDED DEDC ", " ADED DEDA ", " ADED DEDA ", "ADED DEDA", "ADED DEDA", "ADED DEDA", "ADED DEDA", "ADED DEDA", " ADED DEDA ", " ADED DEDA ", " CDED DEDC ", " CDED DEDC ", " CDEDDBJ~JBDDEDC ", " CDEEDDDDDEEDC ", " CDDEEEEEDDC "}, + {" A A A ", " AAAAAAA ", " BBBBIIIBBBB ", " BAAAAAAAAAAAB ", " BAAAA AAAAB ", " BAAA AAAB ", " BAAA AAAB ", " BAA AAB ", " ABAA AABA ", "AABA ABAA", " AIA AIA ", "AAIA AIAA", " AIA AIA ", "AABA ABAA", " ABAA AABA ", " BAA AAB ", " BAAA AAAB ", " BAAA AAAB ", " BAAAABJJJBAAAAB ", " BAHHBBBBBHHAB ", " BBBBGFGBBBB "} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('b', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('c', ofBlock(sBlockCasingsTT, 4)) + .addElement('C', ofBlock(sBlockCasingsTT, 6)) + .addElement('D', ofBlock(sBlockCasingsTT, 7)) + .addElement('e', ofBlock(sBlockCasingsTT, 8)) + .addElement('E', ofBlock(sBlockCasingsTT, 9)) + .addElement('I', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('J', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('H', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, textureOffset + 4, 3, sBlockCasingsTT, 4)) + .addElement('G', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, textureOffset + 4, 4, sBlockCasingsTT, 4)) + .build(); + + @Override + public IStructureDefinition<GT_MetaTileEntity_EM_collider> getStructure_EM() { + return STRUCTURE_DEFINITION; + } + + //endregion + + public GT_MetaTileEntity_EM_collider(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_EM_collider(String aName) { + super(aName); + } + + public static void setValues(int heliumPlasmaValue) { + double MASS_TO_EU_PARTIAL = heliumPlasmaValue / (1.75893000478707E07 * EM_COUNT_PER_MATERIAL_AMOUNT);//mass diff + MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20; + STARTUP_COST = -heliumPlasmaValue * 10000; + KEEPUP_COST = -heliumPlasmaValue; + } + + protected double fuse(GT_MetaTileEntity_EM_collider partner) {///CAN MAKE EU + if (partner.stack != null && stack != null) {//todo add single event mode as an option + boolean check = stack.getDefinition().fusionMakesEnergy(stack.getEnergy()) && + partner.stack.getDefinition().fusionMakesEnergy(partner.stack.getEnergy()); + + EMInstanceStack stack2 = partner.stack; + double preMass = add(stack2.getMass(), stack.getMass()); + //System.out.println("preMass = " + preMass); + + EMInstanceStackMap map = new EMInstanceStackMap(); + IColliderHandler colliderHandler; + if (stack2.getDefinition().getMatterMassType() > stack.getDefinition().getMatterMassType()) {//always bigger first + colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getMatterMassType() << 16) | stack.getDefinition().getMatterMassType()); + if (handleRecipe(stack2, map, colliderHandler)) return 0; + } else { + colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getMatterMassType() << 16) | stack2.getDefinition().getMatterMassType()); + if (handleRecipe(stack2, map, colliderHandler)) return 0; + } + for (EMInstanceStack newStack : map.valuesToArray()) { + check &= newStack.getDefinition().fusionMakesEnergy(newStack.getEnergy()); + } + //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); + outputEM = new EMInstanceStackMap[]{map}; + + partner.stack = stack = null; + //System.out.println("check = " + check); + //System.out.println("preMass-map.getMass() = " + (preMass - map.getMass())); + return check ? preMass - map.getMass() : Math.min(preMass - map.getMass(), 0); + } + return 0; + } + + protected double collide(GT_MetaTileEntity_EM_collider partner) {//DOES NOT MAKE EU! + if (partner.stack != null && stack != null) {//todo add single event mode as an option + EMInstanceStack stack2 = partner.stack; + double preMass = stack2.getMass() + stack.getMass(); + //System.out.println("preMass = " + preMass); + + EMInstanceStackMap map = new EMInstanceStackMap(); + IColliderHandler colliderHandler; + if (stack2.getDefinition().getMatterMassType() > stack.getDefinition().getMatterMassType()) {//always bigger first + colliderHandler = FUSE_HANDLERS.get((stack2.getDefinition().getMatterMassType() << 16) | stack.getDefinition().getMatterMassType()); + if (handleRecipe(stack2, map, colliderHandler)) return 0; + } else { + colliderHandler = FUSE_HANDLERS.get((stack.getDefinition().getMatterMassType() << 16) | stack2.getDefinition().getMatterMassType()); + if (handleRecipe(stack2, map, colliderHandler)) return 0; + } + //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); + outputEM = new EMInstanceStackMap[]{map}; + + partner.stack = stack = null; + //System.out.println("check = " + check); + //System.out.println("preMass-map.getMass() = " + (preMass - map.getMass())); + return Math.min(preMass - map.getMass(), 0); + } + return 0; + } + + private boolean handleRecipe(EMInstanceStack stack2, EMInstanceStackMap map, IColliderHandler colliderHandler) { + if (colliderHandler != null && eTier >= colliderHandler.getRequiredTier()) { + colliderHandler.collide(stack2, stack, map); + } else { + map.putUnifyAll(stack, stack2); + outputEM = new EMInstanceStackMap[]{map}; + return true; + } + return false; + } + + protected GT_MetaTileEntity_EM_collider getPartner() { + IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; + IGregTechTileEntity gregTechBaseTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir, yDir, zDir); + if (gregTechBaseTileEntity != null) { + IMetaTileEntity gregTechMetaTileEntity = gregTechBaseTileEntity.getMetaTileEntity(); + return gregTechMetaTileEntity instanceof GT_MetaTileEntity_EM_collider && + ((GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity).mMachine && + gregTechBaseTileEntity.getBackFacing() == iGregTechTileEntity.getFrontFacing() ? + (GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity : null; + } + return null; + } + + protected final boolean isMaster() { + return getBaseMetaTileEntity().getFrontFacing() % 2 == 0; + } + + private void makeEU(double massDiff) { + plasmaEnergy += massDiff * MASS_TO_EU_INSTANT; + if (DEBUG_MODE) { + System.out.println("plasmaEnergy = " + plasmaEnergy); + } + } + + private EMInstanceStackMap tickStack() { + if (stack == null) { + return null; + } + stack.setAge(stack.getAge() + 1); + EMDecayResult newInstances = stack.decay(1, stack.getAge(), 0); + if (newInstances == null) { + stack.nextColor(); + return null; + } else { + stack = newInstances.getOutput().removeKey(newInstances.getOutput().getLast().getDefinition()); + return newInstances.getOutput(); + } + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_collider(mName); + } + + @Override + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 2; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 2; + if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir) != sBlockCasingsTT) { + eTier = 0; + return false; + } + + if (iGregTechTileEntity.getMetaIDOffset(xDir, 0, zDir) == 8) { + eTier = 1; + } else if (iGregTechTileEntity.getMetaIDOffset(xDir, 0, zDir) == 9) { + eTier = 2; + } else { + eTier = 0; + return false; + } + if (structureCheck_EM("tier"+eTier, 11, 1, 18)) { + return true; + } + eTier = 0; + return false; + } + + @Override + public boolean checkRecipe_EM(ItemStack itemStack) { + GT_MetaTileEntity_EM_collider partner = getPartner(); + if (partner == null) { + return false; + } + mEfficiencyIncrease = 10000; + if (started) { + if (stack == null) { + for (GT_MetaTileEntity_Hatch_InputElemental inputElemental : eInputHatches) { + EMInstanceStackMap container = inputElemental.getContentHandler(); + if (container.isEmpty()) { + continue; + } + stack = container.removeKey(container.getFirst().getDefinition()); + long eut = KEEPUP_COST + (long) (KEEPUP_COST * Math.abs(stack.getMass() / EMAtomDefinition.getSomethingHeavy().getMass())) / 2; + if (eut < Integer.MIN_VALUE + 7) { + return false; + } + mMaxProgresstime = 20; + mEUt = (int) eut; + eAmpereFlow = 5; + return true; + } + mMaxProgresstime = 20; + mEUt = KEEPUP_COST; + eAmpereFlow = 1; + return true; + } + mMaxProgresstime = 20; + mEUt = KEEPUP_COST; + eAmpereFlow = 2; + } else { + started = true; + mMaxProgresstime = 20; + mEUt = STARTUP_COST; + eAmpereFlow = 10; + } + return true; + } + + @Override + public void outputAfterRecipe_EM() { + GT_MetaTileEntity_EM_collider partner = getPartner(); + if (partner == null) { + if (stack != null) { + cleanMassEM_EM(stack.getMass()); + stack = null; + } + return; + } + if (isMaster()) { + switch ((int) mode.get()) { + case FUSE_MODE: + makeEU(fuse(partner)); + break; + case COLLIDE_MODE: + collide(partner);//todo + break; + default: { + outputEM = new EMInstanceStackMap[2]; + outputEM[1] = tickStack(); + if (outputEM[1] == null) { + outputEM[1] = partner.tickStack(); + } else { + EMInstanceStackMap map = partner.tickStack(); + if (map != null) { + outputEM[1].putUnifyAll(map); + } + } + } + } + if (outputEM != null) { + for (int i = 0, lim = Math.min(outputEM.length, eOutputHatches.size()); i < lim; i++) { + if (outputEM[i] != null) { + eOutputHatches.get(i).getContentHandler().putUnifyAll(outputEM[i]); + outputEM[i] = null; + } + } + } + } + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + translateToLocal("gt.blockmachines.multimachine.em.collider.desc.0"),//Collide matter at extreme velocities. + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.collider.desc.1")//Faster than light*!!! + }; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE"); + ScreenOFF_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_SLAVE"); + ScreenON_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE_SLAVE"); + super.registerIcons(aBlockIconRegister); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + if (aFacing % 2 == 0) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON : ScreenOFF)}; + } else { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON_Slave : ScreenOFF_Slave)}; + } + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4]}; + } + + @Override + protected void parametersInstantiation_EM() { + Parameters.Group hatch_0 = parametrization.getGroup(0); + mode = hatch_0.makeInParameter(0, FUSE_MODE, MODE_NAME, MODE_STATUS); + } + + @Override + public void parametersStatusesWrite_EM(boolean machineBusy) { + if (isMaster()) { + super.parametersStatusesWrite_EM(machineBusy); + } + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setByte("eTier", eTier);//collider tier + aNBT.setBoolean("eStarted", started); + if (stack != null) { + aNBT.setTag("eStack", stack.toNBT(TecTech.definitionsRegistry)); + } + aNBT.setLong("ePlasmaEnergy", plasmaEnergy); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + eTier = aNBT.getByte("eTier");//collider tier + started = aNBT.getBoolean("eStarted"); + if (aNBT.hasKey("eStack")) { + stack = EMInstanceStack.fromNBT(TecTech.definitionsRegistry, aNBT.getCompoundTag("eStack")); + } + plasmaEnergy = aNBT.getLong("ePlasmaEnergy"); + } + + @Override + public void stopMachine() { + started = false; + if (stack != null) { + cleanMassEM_EM(stack.getMass()); + stack = null; + } + super.stopMachine(); + } + + @Override + protected void afterRecipeCheckFailed() { + started = false; + if (stack != null) { + cleanMassEM_EM(stack.getMass()); + stack = null; + } + getBaseMetaTileEntity().disableWorking(); + super.afterRecipeCheckFailed(); + } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (!aBaseMetaTileEntity.isAllowedToWork()) { + started = false; + } + super.onPreTick(aBaseMetaTileEntity, aTick); + } + + @Override + public void construct(ItemStack trigger, boolean hintsOnly) { + IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; + if (hintsOnly) { + StructureLibAPI.hintParticle(iGregTechTileEntity.getWorld(), + iGregTechTileEntity.getXCoord() + xDir, + iGregTechTileEntity.getYCoord() + yDir, + iGregTechTileEntity.getZCoord() + zDir, + StructureLibAPI.getBlockHint(), 12); + } + structureBuild_EM("tier"+(((trigger.stackSize-1)%2)+1), 11, 1, 18, trigger, hintsOnly); + } + + @Override + public String[] getStructureDescription(ItemStack stackSize) { + return description; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java new file mode 100644 index 0000000000..0114ac847b --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IColliderHandler.java @@ -0,0 +1,5 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.em_collider; + +public interface IColliderHandler extends IPrimitiveColliderHandler { + byte getRequiredTier(); +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java new file mode 100644 index 0000000000..3c4438b5e1 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_collider/IPrimitiveColliderHandler.java @@ -0,0 +1,8 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi.em_collider; + +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; + +public interface IPrimitiveColliderHandler { + void collide(EMInstanceStack in1, EMInstanceStack in2, EMInstanceStackMap out); +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index ef8c0e7c3d..e6e618a31c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java @@ -1,26 +1,32 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import java.util.Arrays; -import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.DoubleCount.*; /** * Created by danie_000 on 24.12.2017. */ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehaviour { private final byte tier; - private float radius, maxRPM, maxRCF, maxForce, maxCapacity; + private double maxRPM; + private final double radius; + private final double maxRCF; + private final double maxForce; + private final double maxCapacity; private Parameters.Group.ParameterIn settingRPM, settingFraction; private final static INameFunction<GT_MetaTileEntity_EM_machine> rpmName= (gt_metaTileEntity_em_machine, iParameter) -> "RPM Setting"; private final IStatusFunction<GT_MetaTileEntity_EM_machine> rpmStatus= (gt_metaTileEntity_em_machine, iParameter) -> { @@ -65,32 +71,32 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav //6 to 12 recommended public Behaviour_Centrifuge(int desiredTier) { tier = (byte) desiredTier; - radius = 0.5f - (12 - tier) / 64f; - maxRCF = (float) (Math.pow(Math.E, tier) * 12); - maxRPM = (float) Math.sqrt(maxRCF / (0.001118 * radius)); - float maxSafeMass = dAtomDefinition.getSomethingHeavy().getMass() * (1 << tier); + radius = 0.5D - (12D - tier) / 64D; + maxRCF = Math.pow(Math.E, tier) * 12D; + maxRPM = Math.sqrt(maxRCF / (0.001118D * radius)); + double maxSafeMass = EMAtomDefinition.getSomethingHeavy().getMass() * (1 << tier); maxForce = maxSafeMass * maxRCF;// (eV/c^2 * m/s) / g - maxCapacity = maxSafeMass * 4f * radius;// eV/c^2 + maxCapacity = maxSafeMass * EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED * radius;// eV/c^2 } private double getRCF(double RPM) { return RPM * RPM * radius * 0.001118; } - private void addRandomly(cElementalInstanceStack me, cElementalInstanceStackMap[] toThis, int fractionCount) { - long amountPerFraction = me.amount / fractionCount; - cElementalInstanceStack[] stacks = new cElementalInstanceStack[fractionCount]; + private void addRandomly(EMInstanceStack me, EMInstanceStackMap[] toThis, int fractionCount) { + double amountPerFraction = div(me.getAmount(),fractionCount); + EMInstanceStack[] stacks = new EMInstanceStack[fractionCount]; for (int i = 0; i < fractionCount; i++) { stacks[i] = me.clone(); - stacks[i].amount = amountPerFraction; + stacks[i].setAmount(amountPerFraction); toThis[i].putReplace(stacks[i]); } - int remainingAmount = (int) (me.amount % fractionCount); - while (remainingAmount > 0) { - int amountToAdd = TecTech.RANDOM.nextInt(remainingAmount) + 1; - stacks[TecTech.RANDOM.nextInt(fractionCount)].amount += amountToAdd; - remainingAmount -= amountToAdd; - } + //int remainingAmount = (int) (me.amount % fractionCount); + //while (remainingAmount > 0) { + // int amountToAdd = TecTech.RANDOM.nextInt(remainingAmount) + 1; + // stacks[TecTech.RANDOM.nextInt(fractionCount)].amount += amountToAdd; + // remainingAmount -= amountToAdd; + //} } @Override @@ -106,25 +112,26 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav } @Override - public MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { - cElementalInstanceStackMap input = inputs[0]; + public MultiblockControl<EMInstanceStackMap[]> process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + EMInstanceStackMap input = inputs[0]; if (input == null || input.isEmpty()) return null;//nothing in only valid input - cElementalInstanceStack[] stacks = input.values(); + EMInstanceStack[] stacks = input.valuesToArray(); double inputMass = 0; - for (cElementalInstanceStack stack : stacks) { + for (EMInstanceStack stack : stacks) { inputMass += Math.abs(stack.getMass()); } - float excessMass = 0; + double excessMass = 0; while (inputMass > maxCapacity) { - cElementalInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; - int amountToRemove = TecTech.RANDOM.nextInt((int) randomStack.getAmount()) + 1; - randomStack.amount -= amountToRemove;//mutates the parent InstanceStackMap - if (randomStack.amount <= 0) { - input.remove(randomStack.definition); + EMInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; + double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); + randomStack.setAmount(sub(randomStack.getAmount(),amountToRemove));//mutates the parent InstanceStackMap + if (randomStack.isInvalidAmount()) { + input.removeKey(randomStack.getDefinition()); + stacks = input.valuesToArray(); } - float mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; + double mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; excessMass += mass; inputMass -= mass; } @@ -135,10 +142,10 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav if (inputMass * RCF > maxForce) return new MultiblockControl<>(excessMass);//AND THEN IT EXPLODES // how many output hatches to use - int fractionCount = (int) settingFraction.get(); - cElementalInstanceStackMap[] outputs = new cElementalInstanceStackMap[fractionCount]; + int fractionCount = (int) settingFraction.get(); + EMInstanceStackMap[] outputs = new EMInstanceStackMap[fractionCount]; for (int i = 0; i < fractionCount; i++) { - outputs[i] = new cElementalInstanceStackMap(); + outputs[i] = new EMInstanceStackMap(); } //mixing factor... @@ -147,7 +154,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav TecTech.LOGGER.info("mixingFactor "+mixingFactor); } - int mEut = (int) (Math.pow(settingRPM.get() / maxRPM, 3f) * V[tier]); + int mEut = (int) (Math.pow(settingRPM.get() / maxRPM, 3D) * V[tier]); mEut = Math.max(mEut, 512); mEut = -mEut; int mTicks = (int) (20 * (inputMass / maxCapacity) * (fractionCount - 1)); @@ -155,31 +162,31 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav //take all from hatch handler and put into new map - this takes from hatch to inner data storage - stacks = input.takeAllToNewMap().values();//cleanup stacks + stacks = input.takeAll().valuesToArray();//cleanup stacks if (stacks.length > 1) { Arrays.sort(stacks, (o1, o2) -> { - float m1 = o1.definition.getMass(); - float m2 = o2.definition.getMass(); + double m1 = o1.getDefinition().getMass(); + double m2 = o2.getDefinition().getMass(); if (m1 < m2) return -1; if (m1 > m2) return 1; return o1.compareTo(o2); }); double absMassPerOutput = 0;//"volume" - for (cElementalInstanceStack stack : stacks) { + for (EMInstanceStack stack : stacks) { double tempMass=Math.abs(stack.getMass()); if(tempMass!=0) { - long amount = stack.amount; - stack.amount *= mixingFactor; + double amount = stack.getAmount(); + stack.setAmount(mul(stack.getAmount(),mixingFactor)); addRandomly(stack, outputs, fractionCount); - stack.amount = amount - stack.amount; + stack.setAmount(sub(amount, stack.getAmount())); absMassPerOutput += tempMass; } } //if(DEBUG_MODE){ // TecTech.LOGGER.info("absMass "+absMassPerOutput); //} - absMassPerOutput /= fractionCount; + absMassPerOutput = div(absMassPerOutput,fractionCount); if(DEBUG_MODE){ TecTech.LOGGER.info("absMassPerOutput "+absMassPerOutput); } @@ -190,7 +197,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav for (int stackNo = 0; stackNo < stacks.length; stackNo++) { if (stacks[stackNo] != null) { double stackMass = Math.abs(stacks[stackNo].getMass()); - long amount = (long) (remaining/Math.abs(stacks[stackNo].definition.getMass())); + double amount = div(remaining,Math.abs(stacks[stackNo].getDefinition().getMass())); //if(DEBUG_MODE){ // TecTech.LOGGER.info("stackMass "+stackMass); // TecTech.LOGGER.info("defMass "+stacks[stackNo].definition.getMass()); @@ -200,16 +207,16 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav if (stackMass == 0) { addRandomly(stacks[stackNo], outputs, fractionCount); stacks[stackNo] = null; - } else if (amount >= stacks[stackNo].amount) { - remaining -= stackMass; + } else if (amount >= stacks[stackNo].getAmount()) { + remaining= sub(remaining,stackMass); outputs[fraction].putUnify(stacks[stackNo]); stacks[stackNo] = null; } else if (amount > 0) { - remaining -= amount * stacks[stackNo].definition.getMass(); - cElementalInstanceStack clone = stacks[stackNo].clone(); - clone.amount = amount; + remaining= sub(remaining, mul(amount, stacks[stackNo].getDefinition().getMass())); + EMInstanceStack clone = stacks[stackNo].clone(); + clone.setAmount(amount); outputs[fraction].putUnify(clone); - stacks[stackNo].amount-=amount; + stacks[stackNo].setAmount(sub(stacks[stackNo].getAmount(),amount)); //if(DEBUG_MODE){ // TecTech.LOGGER.info("remainingAfter "+remaining); // TecTech.LOGGER.info("amountCloneAfter "+clone.amount+"/"+stacks[stackNo].amount); @@ -221,7 +228,7 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav } } //add remaining - for (cElementalInstanceStack stack : stacks) { + for (EMInstanceStack stack : stacks) { if (stack != null) { outputs[fractionCount - 1].putUnify(stack); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java index df21feb9f2..4c95c2acd7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; @@ -24,7 +24,7 @@ public class Behaviour_Electrolyzer implements GT_MetaTileEntity_EM_machine.IBeh } @Override - public MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + public MultiblockControl<EMInstanceStackMap[]> process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { return null; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java index 4b1c5f3cf6..3d1259f808 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java @@ -1,16 +1,19 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; -import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMInstanceStack; +import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.EMAtomDefinition; import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry.EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.DoubleCount.mul; +import static com.github.technus.tectech.util.DoubleCount.sub; /** * Created by danie_000 on 24.12.2017. @@ -19,8 +22,8 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ private final byte tier; private int ticks; private byte precisionFull,precisionMinimal; - private float maxCapacity; - private long maxCharge; + private double maxCapacity; + private double maxCharge; private int offsetMax; private Parameters.Group.ParameterIn fullSetting,minimalSetting,offsetSetting; private final static INameFunction<GT_MetaTileEntity_EM_machine> fullName= (gt_metaTileEntity_em_machine, iParameter) -> "Full Precision Input [e/3]"; @@ -85,8 +88,8 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ public Behaviour_ElectromagneticSeparator(int desiredTier){ tier=(byte) desiredTier; ticks =Math.max(20,(1<<(12-desiredTier))*20); - maxCapacity= dAtomDefinition.getSomethingHeavy().getMass()*(2<<tier); - maxCharge=144*(1<<(tier-5)); + maxCapacity= EMAtomDefinition.getSomethingHeavy().getMass()*(2<<tier)* EM_COUNT_PER_MATERIAL_AMOUNT_DIMINISHED; + maxCharge=144D*(1<<(tier-5)); switch (tier){ case 12: precisionFull=1; @@ -140,40 +143,40 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ } @Override - public MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { - cElementalInstanceStackMap input = inputs[0]; + public MultiblockControl<EMInstanceStackMap[]> process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + EMInstanceStackMap input = inputs[0]; if (input == null || input.isEmpty()) return null;//nothing in only valid input - cElementalInstanceStack[] stacks = input.values(); + EMInstanceStack[] stacks = input.valuesToArray(); double inputMass = 0; - for (cElementalInstanceStack stack : stacks) { + for (EMInstanceStack stack : stacks) { inputMass += Math.abs(stack.getMass()); } float excessMass = 0; while (inputMass > maxCapacity) { - cElementalInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; - int amountToRemove = TecTech.RANDOM.nextInt((int) randomStack.getAmount()) + 1; - randomStack.amount -= amountToRemove;//mutates the parent InstanceStackMap - if (randomStack.amount <= 0) { - input.remove(randomStack.definition); + EMInstanceStack randomStack = stacks[TecTech.RANDOM.nextInt(stacks.length)]; + double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); + randomStack.setAmount(sub(randomStack.getAmount(),amountToRemove));//mutates the parent InstanceStackMap + if (randomStack.isInvalidAmount()) { + input.removeKey(randomStack.getDefinition()); } - float mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; + double mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; excessMass += mass; inputMass -= mass; } - long totalCharge=Math.abs(input.getCharge()); + double totalCharge=Math.abs(input.getCharge()); if (totalCharge>maxCharge) return new MultiblockControl<>(excessMass);//AND THEN IT EXPLODES - int mEut=(int)(((double)totalCharge/(double) maxCharge)*V[tier]); + int mEut=(int)((totalCharge/ maxCharge)*V[tier]); mEut = Math.max(mEut, 512); int mTicks=(int)(ticks*(inputMass/maxCapacity)); mTicks=Math.max(mTicks,20); - cElementalInstanceStackMap[] outputs = new cElementalInstanceStackMap[3]; + EMInstanceStackMap[] outputs = new EMInstanceStackMap[3]; for (int i = 0; i < 3; i++) { - outputs[i] = new cElementalInstanceStackMap(); + outputs[i] = new EMInstanceStackMap(); } double offsetIn=offsetSetting.get(); @@ -182,9 +185,9 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ double levelsCountPlus1=precisionFullIn-precisionMinimalIn+1; //take all from hatch handler and put into new map - this takes from hatch to inner data storage - stacks = input.takeAllToNewMap().values();//cleanup stacks - for(cElementalInstanceStack stack:stacks){ - double charge=stack.definition.getCharge()-offsetIn; + stacks = input.takeAll().valuesToArray();//cleanup stacks + for(EMInstanceStack stack:stacks){ + double charge= stack.getDefinition().getCharge()-offsetIn; if(charge<precisionMinimalIn && charge>-precisionMinimalIn){ outputs[1].putReplace(stack); }else if(charge>=precisionFullIn){ @@ -192,24 +195,18 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ }else if(charge<=-precisionFullIn){ outputs[0].putReplace(stack); }else{ - long amount=(long)(stack.amount*((Math.abs(charge)-precisionMinimalIn+1)/levelsCountPlus1));//todo check - if(amount>=stack.amount){ - if(charge>0){ - outputs[2].putReplace(stack); - }else { - outputs[0].putReplace(stack); - } - }else { - cElementalInstanceStack clone=stack.clone(); - clone.amount-=amount; + double amount=mul(stack.getAmount(),(Math.abs(charge)-precisionMinimalIn+1D)/levelsCountPlus1);//todo check + if (amount < stack.getAmount()) { + EMInstanceStack clone = stack.clone(); + clone.setAmount(sub(clone.getAmount(), amount)); outputs[1].putReplace(clone); - stack.amount=amount; - if(charge>0){ - outputs[2].putReplace(stack); - }else { - outputs[0].putReplace(stack); - } + stack.setAmount(amount); + } + if(charge>0){ + outputs[2].putReplace(stack); + }else { + outputs[0].putReplace(stack); } } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java index cd6f637d61..7d472de847 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; @@ -24,7 +24,7 @@ public class Behaviour_PrecisionLaser implements GT_MetaTileEntity_EM_machine.IB } @Override - public MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + public MultiblockControl<EMInstanceStackMap[]> process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { return null; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java index 8187759445..05050a3c66 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java @@ -1,20 +1,20 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.V; /** * Created by danie_000 on 24.12.2017. */ public class Behaviour_Recycler implements GT_MetaTileEntity_EM_machine.IBehaviour { private final int tier; - private final float coeff; + private final double coeff; public Behaviour_Recycler(int tier){ this.tier=tier; - coeff=(float)(1/Math.pow(2,tier-4)); + coeff=(1D/Math.pow(2D,tier-4)); } @Override @@ -26,9 +26,9 @@ public class Behaviour_Recycler implements GT_MetaTileEntity_EM_machine.IBehavio } @Override - public MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { - float mass=0; - for (cElementalInstanceStackMap input : inputs) { + public MultiblockControl<EMInstanceStackMap[]> process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + double mass=0; + for (EMInstanceStackMap input : inputs) { if (input != null) { mass += input.getMass(); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java index 95bb8dce40..fa517c73d4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl; import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; @@ -24,7 +24,7 @@ public class Behaviour_Scanner implements GT_MetaTileEntity_EM_machine.IBehaviou } @Override - public MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { + public MultiblockControl<EMInstanceStackMap[]> process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) { return null; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java index d45fbc31d7..2c4217aaba 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java @@ -1,13 +1,14 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; -import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; -import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; 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.multi.base.*; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; @@ -21,10 +22,12 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; import java.util.function.Supplier; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -34,34 +37,38 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa //region variables public static final String machine = "EM Machinery"; - private ItemStack loadedMachine; + private ItemStack loadedMachine; private IBehaviour currentBehaviour; //endregion //region structure - private static final String[][] shape = new String[][]{ - {"B0", "A ", "0 - 0", "A ", "B0",}, - {"A000", "00000", "00.00", "00000", "A000",}, - {"A121", "1---1", "2---2", "1---1", "A121",}, - {"A131", "1---1", "3-A-3", "1---1", "A131",}, - {"A121", "1---1", "2---2", "1---1", "A121",}, - {"A000", "00000", "00-00", "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 final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", translateToLocal("gt.blockmachines.multimachine.em.processing.hint.0"),//1 - Classic Hatches or High Power Casing - translateToLocal("gt.blockmachines.multimachine.em.processing.hint.1"),};//2 - Elemental Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.processing.hint.1"),//2 - Elemental Hatches or Molecular Casing + }; + + private static final IStructureDefinition<GT_MetaTileEntity_EM_machine> STRUCTURE_DEFINITION = IStructureDefinition + .<GT_MetaTileEntity_EM_machine>builder() + .addShape("main", transpose(new String[][]{ + {" A ", " AAA ", " EBE ", " ECE ", " EBE ", " AAA ", " A "}, + {" DDD ", "AAAAA", "E---E", "E---E", "E---E", "AAAAA", " FFF "}, + {"AD-DA", "AA~AA", "B---B", "C- -C", "B---B", "AA-AA", "AFFFA"}, + {" DDD ", "AAAAA", "E---E", "E---E", "E---E", "AAAAA", " FFF "}, + {" A ", " AAA ", " EBE ", " ECE ", " EBE ", " AAA ", " A "} + })) + .addElement('A', ofBlock(sBlockCasingsTT, 4)) + .addElement('B', ofBlock(sBlockCasingsTT, 5)) + .addElement('C', ofBlock(sBlockCasingsTT, 6)) + .addElement('E', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('D', ofHatchAdderOptional(GT_MetaTileEntity_EM_machine::addClassicToMachineList, textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('F', ofHatchAdderOptional(GT_MetaTileEntity_EM_machine::addElementalToMachineList, textureOffset + 4, 2, sBlockCasingsTT, 4)) + .build(); //endregion //region parameters - protected Parameters.Group.ParameterIn[] inputMux; - protected Parameters.Group.ParameterIn[] outputMux; + protected Parameters.Group.ParameterIn[] inputMux; + protected Parameters.Group.ParameterIn[] outputMux; private static final IStatusFunction<GT_MetaTileEntity_EM_machine> SRC_STATUS = (base, p) -> { double v = p.get(); @@ -85,7 +92,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } return STATUS_NEUTRAL; }; - private static final INameFunction<GT_MetaTileEntity_EM_machine> ROUTE_NAME = + private static final INameFunction<GT_MetaTileEntity_EM_machine> ROUTE_NAME = (base, p) -> (p.parameterId() == 0 ? translateToLocal("tt.keyword.Source") + " " : translateToLocal("tt.keyword.Destination") + " ") + p.hatchId(); //endregion @@ -157,15 +164,15 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa * @param parameters array passed from previous method! * @return null if recipe should not start, control object to set machine state and start recipe */ - MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters); + MultiblockControl<EMInstanceStackMap[]> process(EMInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters); } private void quantumStuff(boolean shouldIExist) { IGregTechTileEntity base = getBaseMetaTileEntity(); if (base != null && base.getWorld() != null) { - int xDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetX * 2 + base.getXCoord(); - int yDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetY * 2 + base.getYCoord(); - int zDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetZ * 2 + base.getZCoord(); + int xDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetX * 2 + base.getXCoord(); + int yDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetY * 2 + base.getYCoord(); + int zDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetZ * 2 + base.getZCoord(); Block block = base.getWorld().getBlock(xDir, yDir, zDir); if (shouldIExist) { if (block != null && block.getMaterial() == Material.air) { @@ -186,7 +193,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 1); + return structureCheck_EM("main", 2, 2, 1); } @Override @@ -250,11 +257,11 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa return false; } - cElementalInstanceStackMap[] handles = new cElementalInstanceStackMap[6]; + EMInstanceStackMap[] handles = new EMInstanceStackMap[6]; for (int i = 0; i < 6; i++) { int pointer = (int) inputMux[i].get(); if (pointer >= 0 && pointer < eInputHatches.size()) { - handles[i] = eInputHatches.get(pointer).getContainerHandler(); + handles[i] = eInputHatches.get(pointer).getContentHandler(); } } @@ -268,7 +275,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } } - MultiblockControl<cElementalInstanceStackMap[]> control = currentBehaviour.process(handles, this, parametrization); + MultiblockControl<EMInstanceStackMap[]> control = currentBehaviour.process(handles, this, parametrization); if (control == null) { return false; } @@ -307,11 +314,11 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa return; } - cElementalInstanceStackMap[] handles = new cElementalInstanceStackMap[6]; + EMInstanceStackMap[] handles = new EMInstanceStackMap[6]; for (int i = 0; i < 6; i++) { int pointer = (int) outputMux[i].get(); if (pointer >= 0 && pointer < eOutputHatches.size()) { - handles[i] = eOutputHatches.get(pointer).getContainerHandler(); + handles[i] = eOutputHatches.get(pointer).getContentHandler(); } } //output @@ -349,12 +356,17 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 1, getBaseMetaTileEntity(), this, hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM("main", 2, 2, 1, stackSize, hintsOnly); } @Override - public String[] getStructureDescription(int stackSize) { + public IStructureDefinition<GT_MetaTileEntity_EM_machine> getStructure_EM() { + return STRUCTURE_DEFINITION; + } + + @Override + public String[] getStructureDescription(ItemStack stackSize) { return description; } -}
\ No newline at end of file +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo index 7059fdf6fd..a195157a17 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo @@ -23,16 +23,16 @@ BlockFakeLight.java for turrets: floodlightb +mega - projects + fix eu/t checks if needs maintenance!!! make microwave grinder cap autosmelting based on power - iterative halflife formula: =prev qty* 2^(-t diff / t half) - actual ion cannons diff --git a/src/main/java/com/github/technus/tectech/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 6c406313fb..ee6f469d59 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 @@ -1,6 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.pipe; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.mechanics.pipe.IActivePipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToDataPipe; +import com.github.technus.tectech.mechanics.pipe.PipeActivityMessage; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; import cpw.mods.fml.relauncher.Side; @@ -26,11 +29,12 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import static gregtech.api.enums.Dyes.MACHINE_METAL; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 26.02.2017. */ -public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements IConnectsToDataPipe,IActivePipe { +public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements IConnectsToDataPipe, IActivePipe { private static Textures.BlockIcons.CustomIcon EMpipe; private static Textures.BlockIcons.CustomIcon EMbar,EMbarActive; public byte connectionCount = 0; @@ -98,10 +102,10 @@ public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements IConn public String[] getDescription() { return new String[]{ 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", - EnumChatFormatting.AQUA + "Do not cross or split" + translateToLocal("gt.blockmachines.pipe.datastream.desc.0"),//Advanced data transmission + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.pipe.datastream.desc.1"),//Don't stare at the beam! + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.pipe.datastream.desc.2"),//Must be painted to work + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.pipe.datastream.desc.3")//Do not cross or split }; } @@ -117,25 +121,16 @@ public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements IConn public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()) { if ((aTick & 31) == 31) { + if(TecTech.RANDOM.nextInt(15)==0) { + NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), + aBaseMetaTileEntity.getWorld().provider.dimensionId, + aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord(), + 256); + } if(active){ - if(TecTech.RANDOM.nextInt(15)==0) { - NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), - aBaseMetaTileEntity.getWorld().provider.dimensionId, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord(), - 256); - } active=false; - }else if(getActive()){ - if(TecTech.RANDOM.nextInt(15)==0) { - NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), - aBaseMetaTileEntity.getWorld().provider.dimensionId, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord(), - 256); - } } mConnections = 0; connectionCount = 0; @@ -199,6 +194,7 @@ public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements IConn if (meta instanceof IConnectsToDataPipe && meta != source) { if (meta instanceof GT_MetaTileEntity_Pipe_Data && ((GT_MetaTileEntity_Pipe_Data) meta).connectionCount == 2) { + ((GT_MetaTileEntity_Pipe_Data) meta).markUsed(); return (IConnectsToDataPipe) meta; } if (((IConnectsToDataPipe) meta).isDataInputFacing(GT_Utility.getOppositeSide(b))) { @@ -274,9 +270,11 @@ public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements IConn } @Override - public void setActive(boolean active) { - this.active=active; - getBaseMetaTileEntity().issueTextureUpdate(); + public void setActive(boolean state) { + if(state!=active) { + active = state; + getBaseMetaTileEntity().issueTextureUpdate(); + } } @Override 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 742d298bc6..55a7f23b6a 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 @@ -1,6 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.pipe; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.mechanics.pipe.IActivePipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToElementalPipe; +import com.github.technus.tectech.mechanics.pipe.PipeActivityMessage; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; import cpw.mods.fml.relauncher.Side; @@ -27,11 +30,12 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import static gregtech.api.enums.Dyes.MACHINE_METAL; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 26.02.2017. */ -public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements IConnectsToElementalPipe,IActivePipe { +public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements IConnectsToElementalPipe, IActivePipe { private static Textures.BlockIcons.CustomIcon EMpipe; static Textures.BlockIcons.CustomIcon EMcandy,EMCandyActive; public byte connectionCount = 0; @@ -99,10 +103,10 @@ public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements IConnec public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - "Quantum tunneling device.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Not a portal!!!", - EnumChatFormatting.AQUA + "Must be painted to work", - EnumChatFormatting.AQUA + "Do not cross,split or turn" + translateToLocal("gt.blockmachines.pipe.elementalmatter.desc.0"),//Quantum tunneling device. + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.pipe.elementalmatter.desc.1"),//Not a portal!!! + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.pipe.elementalmatter.desc.2"),//Must be painted to work + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.pipe.elementalmatter.desc.3")//Do not cross, split or turn }; } @@ -118,25 +122,16 @@ public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements IConnec public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()) { if ((aTick & 31) == 31) { + if(TecTech.RANDOM.nextInt(15)==0) { + NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), + aBaseMetaTileEntity.getWorld().provider.dimensionId, + aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord(), + 256); + } if(active){ - if(TecTech.RANDOM.nextInt(7)==0) { - NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), - aBaseMetaTileEntity.getWorld().provider.dimensionId, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord(), - 256); - } active=false; - }else if(getActive()){ - if(TecTech.RANDOM.nextInt(7)==0) { - NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), - aBaseMetaTileEntity.getWorld().provider.dimensionId, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord(), - 256); - } } mConnections = 0; connectionCount = 0; @@ -239,9 +234,11 @@ public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements IConnec } @Override - public void setActive(boolean active) { - this.active=active; - getBaseMetaTileEntity().issueTextureUpdate(); + public void setActive(boolean state) { + if(state!=active) { + active = state; + getBaseMetaTileEntity().issueTextureUpdate(); + } } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Energy.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Energy.java index 4cc40b471c..ef767dacdd 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Energy.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Energy.java @@ -1,6 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.pipe; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.mechanics.pipe.IActivePipe; +import com.github.technus.tectech.mechanics.pipe.IConnectsToEnergyTunnel; +import com.github.technus.tectech.mechanics.pipe.PipeActivityMessage; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; import cpw.mods.fml.relauncher.Side; @@ -29,12 +32,13 @@ import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM.EMCandyActive; import static com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM.EMcandy; import static gregtech.api.enums.Dyes.MACHINE_METAL; +import static net.minecraft.util.StatCollector.translateToLocal; -public class GT_MetaTileEntity_Pipe_Energy extends MetaPipeEntity implements IConnectsToEnergyTunnel,IActivePipe { +public class GT_MetaTileEntity_Pipe_Energy extends MetaPipeEntity implements IConnectsToEnergyTunnel, IActivePipe { private static Textures.BlockIcons.CustomIcon EMpipe; public byte connectionCount = 0; - private boolean active; + private boolean active,lastActive; public GT_MetaTileEntity_Pipe_Energy(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, 0); @@ -95,10 +99,10 @@ public class GT_MetaTileEntity_Pipe_Energy extends MetaPipeEntity implements ICo public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - "Laser tunneling device.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Bright Vacuum!!!", - EnumChatFormatting.AQUA + "Must be painted to work", - EnumChatFormatting.AQUA + "Do not split or turn" + translateToLocal("gt.blockmachines.pipe.energystream.desc.0"),//Laser tunneling device. + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.pipe.energystream.desc.1"),//Bright Vacuum!!! + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.pipe.energystream.desc.2"),//Must be painted to work + EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.pipe.energystream.desc.3")//Do not split or turn }; } @@ -114,25 +118,16 @@ public class GT_MetaTileEntity_Pipe_Energy extends MetaPipeEntity implements ICo public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()) { if ((aTick & 31) == 31) { + if(TecTech.RANDOM.nextInt(15)==0) { + NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), + aBaseMetaTileEntity.getWorld().provider.dimensionId, + aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord(), + 256); + } if(active){ - if(TecTech.RANDOM.nextInt(31)==0) { - NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), - aBaseMetaTileEntity.getWorld().provider.dimensionId, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord(), - 256); - } active=false; - }else if(getActive()){ - if(TecTech.RANDOM.nextInt(31)==0) { - NetworkDispatcher.INSTANCE.sendToAllAround(new PipeActivityMessage.PipeActivityData(this), - aBaseMetaTileEntity.getWorld().provider.dimensionId, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord(), - 256); - } } mConnections = 0; connectionCount = 0; @@ -179,8 +174,10 @@ public class GT_MetaTileEntity_Pipe_Energy extends MetaPipeEntity implements ICo @Override public void setActive(boolean state){ - this.active=state; - getBaseMetaTileEntity().issueTextureUpdate(); + if(state!=active) { + active = state; + getBaseMetaTileEntity().issueTextureUpdate(); + } } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_BuckConverter.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_BuckConverter.java index 86c484059b..737046729f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_BuckConverter.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_BuckConverter.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.single; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_Container_BuckConverter; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_GUIContainer_BuckConverter; import cpw.mods.fml.relauncher.Side; @@ -20,16 +20,15 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_IN_POWER_TT; -import static com.github.technus.tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_OUT_POWER_TT; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.*; +import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_BuckConverter extends GT_MetaTileEntity_TieredMachineBlock { private static GT_RenderedTexture BUCK,BUCK_ACTIVE; public int EUT=0,AMP=0; public GT_MetaTileEntity_BuckConverter(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Electronic voltage regulator"); + super(aID, aName, aNameRegional, aTier, 0, ""); Util.setTier(aTier,this); } @@ -53,7 +52,7 @@ public class GT_MetaTileEntity_BuckConverter extends GT_MetaTileEntity_TieredMac @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1], aSide == aFacing ? (aActive?BUCK_ACTIVE:BUCK) : + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aSide == aFacing ? (aActive?BUCK_ACTIVE:BUCK) : (aSide==GT_Utility.getOppositeSide(aFacing)? OVERLAYS_ENERGY_IN_POWER_TT[mTier]: (aActive ? OVERLAYS_ENERGY_OUT_POWER_TT[mTier] : OVERLAYS_ENERGY_IN_POWER_TT[mTier]))}; @@ -133,9 +132,10 @@ public class GT_MetaTileEntity_BuckConverter extends GT_MetaTileEntity_TieredMac @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK_GENERAL, mDescription, - EnumChatFormatting.BLUE + "Adjustable step down transformer", - EnumChatFormatting.BLUE + "Switching power supply..." + CommonValues.TEC_MARK_GENERAL, + translateToLocal("gt.blockmachines.machine.tt.buck.desc.0"),//Electronic voltage regulator + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.machine.tt.buck.desc.1"),//Adjustable step down transformer + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.machine.tt.buck.desc.2")//Switching power supply... }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java index 6d594512bd..748b680faa 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.single; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_Container_DataReader; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_GUIContainer_DataReader; import cpw.mods.fml.common.FMLCommonHandler; @@ -26,13 +26,13 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; +import java.util.*; -import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; +import static com.github.technus.tectech.util.CommonValues.V; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 23.03.2017. @@ -42,7 +42,7 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine public static GT_RenderedTexture READER_ONLINE, READER_OFFLINE; public GT_MetaTileEntity_DataReader(int aID, String aName, String aNameRegional, int aTier) { - super(aID,aName,aNameRegional,aTier,1,"Reads Data Sticks and Orbs",1,1,"dataReader.png",""); + super(aID,aName,aNameRegional,aTier,1,"",1,1,"dataReader.png",""); Util.setTier(aTier,this); } @@ -68,16 +68,16 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if(aBaseMetaTileEntity.getWorld()==null){ if(aSide==aFacing){ - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; } - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1]}; } if(aSide==mMainFacing){ - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; }else if(aSide==aFacing){ - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; } - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1]}; } @Override @@ -91,8 +91,7 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine return DID_NOT_FIND_RECIPE; } ItemStack input=getInputAt(0); - ArrayList<IDataRender> renders=getRenders(new Util.ItemStack_NoNBT(input)); - for(IDataRender render:renders){ + for(IDataRender render:getRenders(new Util.ItemStack_NoNBT(input))){ if(render.canRender(input,mTier)){ mOutputItems[0]=input.copy(); input.stackSize-=1; @@ -134,9 +133,10 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK_GENERAL, mDescription, - EnumChatFormatting.BLUE + "Power it up and", - EnumChatFormatting.BLUE + "Put the data storage in" + CommonValues.TEC_MARK_GENERAL, + translateToLocal("gt.blockmachines.machine.tt.datareader.desc.0"),//Reads Data Sticks and Orbs + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.machine.tt.datareader.desc.1"),//Power it up and + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.machine.tt.datareader.desc.2")//Put the data storage in }; } @@ -183,8 +183,9 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine renders.add(render); } - public static ArrayList<IDataRender> getRenders(Util.ItemStack_NoNBT stack){ - return RENDER_REGISTRY.get(stack); + public static List<IDataRender> getRenders(Util.ItemStack_NoNBT stack){ + ArrayList<IDataRender> iDataRenders = RENDER_REGISTRY.get(stack); + return iDataRenders==null?Collections.emptyList():iDataRenders; } public interface IDataRender { @@ -271,11 +272,11 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine int time=itemStack.stackTagCompound.getInteger("time"); int EUt=itemStack.stackTagCompound.getInteger("eu"); font.drawString("Assembly Line Recipe", 7, 8, 0x80a0ff); - font.drawString(GT_Utility.trans("152","Total: ") + ((long)time * EUt) + " EU",7,93, 0x80a0ff); - font.drawString(GT_Utility.trans("153","Usage: ") + EUt + " EU/t",7,103, 0x80a0ff); - font.drawString(GT_Utility.trans("154","Voltage: ") + EUt + " EU",7,113, 0x80a0ff); + font.drawString(GT_Utility.trans("152","Total: ") + GT_Utility.formatNumbers((long)time * EUt) + " EU",7,93, 0x80a0ff); + font.drawString(GT_Utility.trans("153","Usage: ") + GT_Utility.formatNumbers(EUt) + " EU/t",7,103, 0x80a0ff); + font.drawString(GT_Utility.trans("154","Voltage: ") + GT_Utility.formatNumbers(EUt) + " EU",7,113, 0x80a0ff); font.drawString(GT_Utility.trans("155","Amperage: ") + 1 ,7,123, 0x80a0ff); - font.drawString( GT_Utility.trans("158","Time: ")+String.format("%.2f " + GT_Utility.trans("161"," secs"), 0.05F * time), 7,133, 0x80a0ff); + font.drawString( GT_Utility.trans("158","Time: ") + GT_Utility.formatNumbers(0.05d * time) + GT_Utility.trans("161"," secs"), 7,133, 0x80a0ff); for(Map.Entry<GT_Slot_Holo,ItemStack> entry:slots.entrySet()){ gui.renderItemSimple(entry.getKey(),entry.getValue()); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java index d9729d1e67..0d5a59a5c1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.single; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OverflowElemental; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_Container_DebugPollutor; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_GUIContainer_DebugPollutor; @@ -22,7 +22,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 23.03.2017. @@ -33,7 +34,7 @@ public class GT_MetaTileEntity_DebugPollutor extends GT_MetaTileEntity_TieredMac public float anomaly=0; public GT_MetaTileEntity_DebugPollutor(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Shit genny broke!"); + super(aID, aName, aNameRegional, aTier, 0, ""); Util.setTier(aTier,this); } @@ -56,7 +57,7 @@ public class GT_MetaTileEntity_DebugPollutor extends GT_MetaTileEntity_TieredMac @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1], aSide != aFacing ? aActive? new GT_RenderedTexture(GT_MetaTileEntity_Hatch_OverflowElemental.MufflerEM): new GT_RenderedTexture(GT_MetaTileEntity_Hatch_OverflowElemental.MufflerEMidle) : POLLUTOR}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aSide != aFacing ? aActive? new GT_RenderedTexture(GT_MetaTileEntity_Hatch_OverflowElemental.MufflerEM): new GT_RenderedTexture(GT_MetaTileEntity_Hatch_OverflowElemental.MufflerEMidle) : POLLUTOR}; } @Override @@ -144,9 +145,10 @@ public class GT_MetaTileEntity_DebugPollutor extends GT_MetaTileEntity_TieredMac @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK_GENERAL, mDescription, - EnumChatFormatting.BLUE + "Infinite Producer/Consumer", - EnumChatFormatting.BLUE + "Since i wanted one..." + CommonValues.TEC_MARK_GENERAL, + translateToLocal("gt.blockmachines.debug.tt.pollutor.desc.0"),//Shit genny broke! + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.debug.tt.pollutor.desc.1"),//Infinite Producer/Consumer + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.debug.tt.pollutor.desc.2")//Since i wanted one? }; } 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 b809f18ab0..931da27e6c 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 @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.single; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_Container_DebugPowerGenerator; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_GUIContainer_DebugPowerGenerator; import cpw.mods.fml.relauncher.Side; @@ -19,9 +19,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_IN_POWER_TT; -import static com.github.technus.tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_OUT_POWER_TT; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.*; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 23.03.2017. @@ -32,7 +31,7 @@ public class GT_MetaTileEntity_DebugPowerGenerator extends GT_MetaTileEntity_Tie public boolean producing=true; public GT_MetaTileEntity_DebugPowerGenerator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Power from nothing"); + super(aID, aName, aNameRegional, aTier, 0, ""); Util.setTier(aTier,this); } @@ -55,7 +54,7 @@ public class GT_MetaTileEntity_DebugPowerGenerator extends GT_MetaTileEntity_Tie @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1], aSide != aFacing ? aActive? OVERLAYS_ENERGY_OUT_POWER_TT[mTier]: OVERLAYS_ENERGY_IN_POWER_TT[mTier] : GENNY}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aSide != aFacing ? aActive? OVERLAYS_ENERGY_OUT_POWER_TT[mTier]: OVERLAYS_ENERGY_IN_POWER_TT[mTier] : GENNY}; } @Override @@ -136,9 +135,10 @@ public class GT_MetaTileEntity_DebugPowerGenerator extends GT_MetaTileEntity_Tie @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK_GENERAL, mDescription, - EnumChatFormatting.BLUE + "Infinite Producer/Consumer", - EnumChatFormatting.BLUE + "Since i wanted one..." + CommonValues.TEC_MARK_GENERAL, + translateToLocal("gt.blockmachines.debug.tt.genny.desc.0"),//Power from nothing + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.debug.tt.genny.desc.1"),//Infinite Producer/Consumer + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.debug.tt.genny.desc.2")//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 28390e2a71..01d5e2321e 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 @@ -1,10 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.single; -import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_Container_DebugStructureWriter; import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_GUIContainer_DebugStructureWriter; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; +import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; +import com.gtnewhorizon.structurelib.structure.StructureUtility; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -18,9 +20,15 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; -import static com.github.technus.tectech.Util.StructureWriter; +import java.util.Comparator; +import java.util.function.Function; + +import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by Tec on 23.03.2017. @@ -32,7 +40,7 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti public String[] result = new String[]{"Undefined"}; public GT_MetaTileEntity_DebugStructureWriter(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Scans Blocks Around"); + super(aID, aName, aNameRegional, aTier, 0, ""); Util.setTier(aTier,this); } @@ -55,7 +63,7 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aSide != aFacing ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : MARK}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aSide != aFacing ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : MARK}; } @Override @@ -103,22 +111,50 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti } @Override + public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { + super.onFirstTick(aBaseMetaTileEntity); + aBaseMetaTileEntity.disableWorking(); + } + + @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isAllowedToWork()) { - result = StructureWriter(getBaseMetaTileEntity(), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], false); - for (String s : result) { - TecTech.LOGGER.info(s); - } +// String pseudoJavaCode = StructureUtility.getPseudoJavaCode(aBaseMetaTileEntity.getWorld(), +// ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), +// aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), +// numbers[0], numbers[1], numbers[2], +// numbers[3], numbers[4], numbers[5],false); + String pseudoJavaCode = StructureUtility.getPseudoJavaCode( + aBaseMetaTileEntity.getWorld(), ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), + aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), + numbers[0], numbers[1], numbers[2], + te -> te.getClass().getCanonicalName(), + numbers[3], numbers[4], numbers[5], + false); + TecTech.LOGGER.info(pseudoJavaCode); + result = pseudoJavaCode.split("\\n"); aBaseMetaTileEntity.disableWorking(); } } @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - result = StructureWriter(getBaseMetaTileEntity(), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], true); - for (String s : result) { - TecTech.LOGGER.info(s); - } + IGregTechTileEntity aBaseMetaTileEntity = getBaseMetaTileEntity(); +// String pseudoJavaCode = StructureUtility.getPseudoJavaCode(aBaseMetaTileEntity.getWorld(), +// ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), +// aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), +// numbers[0], numbers[1], numbers[2], +// numbers[3], numbers[4], numbers[5],true); + String pseudoJavaCode = StructureUtility.getPseudoJavaCode( + aBaseMetaTileEntity.getWorld(), ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())), + aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), + numbers[0], numbers[1], numbers[2], + te -> te.getClass().getCanonicalName(), + numbers[3], numbers[4], numbers[5], + false); + TecTech.LOGGER.info(pseudoJavaCode); + result = pseudoJavaCode.split("\\n"); + aBaseMetaTileEntity.disableWorking(); } @Override @@ -127,8 +163,6 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti return true; } aBaseMetaTileEntity.openGUI(aPlayer); - //if (TecTechConfig.DEBUG_MODE && aPlayer.getHeldItem() != null) - // TecTech.LOGGER.info("UnlocalizedName: " + getUniqueIdentifier(aPlayer.getHeldItem())); return true; } @@ -150,9 +184,10 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK_GENERAL, mDescription, - EnumChatFormatting.BLUE + "Prints Multiblock NonTE structure check code", - EnumChatFormatting.BLUE + "ABC axises aligned to machine front" + CommonValues.TEC_MARK_GENERAL, + translateToLocal("gt.blockmachines.debug.tt.writer.desc.0"),//Scans Blocks Around + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.debug.tt.writer.desc.1"),//Prints Multiblock NonTE structure check code + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.debug.tt.writer.desc.2")//ABC axises aligned to machine front }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_MicroController.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_MicroController.java index ef5426a272..9bac9df2f3 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_MicroController.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_MicroController.java @@ -10,7 +10,7 @@ import com.github.technus.avrClone.memory.EepromMemory; import com.github.technus.avrClone.memory.RemovableMemory; import com.github.technus.avrClone.memory.program.ProgramMemory; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.avr.SidedRedstone; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -21,6 +21,7 @@ import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; import static com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DataReader.READER_OFFLINE; import static com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DataReader.READER_ONLINE; @@ -168,16 +169,16 @@ public class GT_MetaTileEntity_MicroController extends GT_MetaTileEntity_TieredM public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if(aBaseMetaTileEntity.getWorld()==null){ if(aSide==aFacing){ - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; } - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1]}; } if(aSide==aBaseMetaTileEntity.getFrontFacing()){ - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aActive ? READER_ONLINE : READER_OFFLINE}; }else if(aSide==aFacing){ - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; } - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1]}; } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_OwnerDetector.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_OwnerDetector.java index 7f44fb45ca..03ec9efd89 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_OwnerDetector.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_OwnerDetector.java @@ -1,8 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.single; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -14,12 +14,17 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import org.apache.commons.lang3.reflect.FieldUtils; -import static com.github.technus.tectech.CommonValues.RECIPE_AT; +import static com.github.technus.tectech.util.CommonValues.RECIPE_AT; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; +import static net.minecraft.util.StatCollector.translateToLocal; +import static net.minecraft.util.StatCollector.translateToLocalFormatted; /** * Created by Tec on 23.03.2017. @@ -30,7 +35,7 @@ public class GT_MetaTileEntity_OwnerDetector extends GT_MetaTileEntity_TieredMac private boolean interdimensional=true; public GT_MetaTileEntity_OwnerDetector(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Screwdrive to change mode"); + super(aID, aName, aNameRegional, aTier, 0, ""); Util.setTier(aTier,this); } @@ -54,7 +59,7 @@ public class GT_MetaTileEntity_OwnerDetector extends GT_MetaTileEntity_TieredMac @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aActive ? OWNER_ONLINE : OWNER_OFFLINE}; + return new ITexture[]{MACHINE_CASINGS_TT[mTier][aColorIndex + 1], aActive ? OWNER_ONLINE : OWNER_OFFLINE}; } @Override @@ -126,8 +131,15 @@ public class GT_MetaTileEntity_OwnerDetector extends GT_MetaTileEntity_TieredMac @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - interdimensional^=true; - GT_Utility.sendChatToPlayer(aPlayer,interdimensional?"Running interdimensional scan":"Running local dimension scan"); + String clientLocale; + try { + EntityPlayerMP player = (EntityPlayerMP) aPlayer; + clientLocale = (String) FieldUtils.readField(player, "translator", true); + } catch (Exception e) { + clientLocale = "en_US"; + } + interdimensional ^= true; + GT_Utility.sendChatToPlayer(aPlayer, interdimensional ? translateToLocalFormatted("tt.keyphrase.Running_interdimensional_scan", clientLocale) : translateToLocalFormatted("tt.keyphrase.Running_local_dimension_scan", clientLocale)); } @Override @@ -143,9 +155,10 @@ public class GT_MetaTileEntity_OwnerDetector extends GT_MetaTileEntity_TieredMac @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK_GENERAL, mDescription, - EnumChatFormatting.BLUE + "Looks for his pa", - EnumChatFormatting.BLUE + "Emits signal when happy" + CommonValues.TEC_MARK_GENERAL, + translateToLocal("gt.blockmachines.machine.tt.ownerdetector.desc.0"),//Screwdrive to change mode + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.machine.tt.ownerdetector.desc.1"),//Looks for his pa + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.machine.tt.ownerdetector.desc.2")//Emits signal when happy }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TT_Transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TT_Transformer.java index 09ab5fe508..61f2259c5c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TT_Transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TT_Transformer.java @@ -1,8 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.single; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.Util; -import gregtech.api.enums.Textures; +import com.github.technus.tectech.util.CommonValues; +import com.github.technus.tectech.util.Util; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -31,18 +30,18 @@ public class GT_MetaTileEntity_TT_Transformer extends GT_MetaTileEntity_Transfor public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[12][17][]; for (byte b = -1; b < 16; b++) { - rTextures[0][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_OUT_MULTI_TT[mTier]}; - rTextures[1][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_OUT_MULTI_TT[mTier]}; - rTextures[2][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_OUT_MULTI_TT[mTier]}; - rTextures[3][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_IN_POWER_TT[mTier + 1]}; - rTextures[4][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_IN_POWER_TT[mTier + 1]}; - rTextures[5][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_IN_POWER_TT[mTier + 1]}; - rTextures[6][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_IN_MULTI_TT[mTier]}; - rTextures[7][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_IN_MULTI_TT[mTier]}; - rTextures[8][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_IN_MULTI_TT[mTier]}; - rTextures[9][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_OUT_POWER_TT[mTier + 1]}; - rTextures[10][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_OUT_POWER_TT[mTier + 1]}; - rTextures[11][b + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][b + 1], OVERLAYS_ENERGY_OUT_POWER_TT[mTier + 1]}; + rTextures[0][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_OUT_MULTI_TT[mTier]}; + rTextures[1][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_OUT_MULTI_TT[mTier]}; + rTextures[2][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_OUT_MULTI_TT[mTier]}; + rTextures[3][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_IN_POWER_TT[mTier + 1]}; + rTextures[4][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_IN_POWER_TT[mTier + 1]}; + rTextures[5][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_IN_POWER_TT[mTier + 1]}; + rTextures[6][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_IN_MULTI_TT[mTier]}; + rTextures[7][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_IN_MULTI_TT[mTier]}; + rTextures[8][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_IN_MULTI_TT[mTier]}; + rTextures[9][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_OUT_POWER_TT[mTier + 1]}; + rTextures[10][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_OUT_POWER_TT[mTier + 1]}; + rTextures[11][b + 1] = new ITexture[]{MACHINE_CASINGS_TT[mTier][b + 1], OVERLAYS_ENERGY_OUT_POWER_TT[mTier + 1]}; } return rTextures; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java index 7abb46b47a..3b240e4c56 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java @@ -1,73 +1,67 @@ package com.github.technus.tectech.thing.metaTileEntity.single;
-import com.github.technus.tectech.CommonValues;
+import com.github.technus.tectech.mechanics.tesla.ITeslaConnectable;
+import com.github.technus.tectech.mechanics.tesla.ITeslaConnectableSimple;
+import com.github.technus.tectech.util.CommonValues;
import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.Util;
import com.github.technus.tectech.loader.NetworkDispatcher;
-import com.github.technus.tectech.mechanics.data.RendererMessage;
-import com.github.technus.tectech.mechanics.data.ThaumSpark;
-import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil;
-import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate;
-import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_TM_teslaCoil;
+import com.github.technus.tectech.mechanics.spark.RendererMessage;
+import com.github.technus.tectech.mechanics.spark.ThaumSpark;
+import com.github.technus.tectech.util.Util;
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.MultimapBuilder;
+import com.gtnewhorizon.structurelib.util.Vec3Impl;
import eu.usrv.yamcore.auxiliary.PlayerChatHelper;
-import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicBatteryBuffer;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.reflect.FieldUtils;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.Map;
-import static com.github.technus.tectech.CommonValues.V;
-import static com.github.technus.tectech.Util.entriesSortedByValues;
-import static com.github.technus.tectech.Util.map;
-import static com.github.technus.tectech.thing.metaTileEntity.Textures.TESLA_TRANSCEIVER_TOP_BA;
+import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.*;
+import static com.github.technus.tectech.util.CommonValues.V;
+import static com.github.technus.tectech.thing.metaTileEntity.Textures.*;
import static java.lang.Math.round;
-
-
-public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryBuffer {
- private final static HashSet<ThaumSpark> sparkList = new HashSet<>();
- private byte sparkCount = 0;
-
- private int maxTier = 4; //Max tier of transceiver
- private int minTier = 0; //Min tier of transceiver
-
- public Map<IGregTechTileEntity, Integer> eTeslaMap = new HashMap<>();//Tesla Map to map them tesla bois!
-
- private int transferRadiusMax = 20;
- private int transferRadiusMin = 4;
- private int transferRadiusLimitTop = (int) map(mTier + 1, minTier + 1, maxTier + 1, transferRadiusMin, transferRadiusMax);
- private int transferRadiusLimitBottom = 1; //Minimum user configurable
- private int transferRadius = transferRadiusLimitTop; //Default transferRadius setting
- private int transferRadiusTower = 0; //Radius for transceiver to tower transfers
- private int transferRadiusCover = 0; //Radius for transceiver to cover transfers
-
- public boolean powerPassToggle = false; //Power Pass for public viewing
- private int histSteps = 20; //Hysteresis Resolution
- private int histSettingLow = 3; //Hysteresis Low Limit
- private int histSettingHigh = 15; //Hysteresis High Limit
- private int histLowLimit = 1; //How low can you configure it?
- private int histHighLimit = 19; //How high can you configure it?
- private float histLow = (float) histSettingLow / histSteps; //Power pass is disabled if power is under this fraction
- private float histHigh = (float) histSettingHigh / histSteps; //Power pass is enabled if power is over this fraction
-
- private long outputVoltage = V[mTier];
- private float minEfficiency = TecTech.configTecTech.TESLA_SINGLE_MIN_EFFICIENCY;//Default is 0.91F
- private float maxEfficiency = TecTech.configTecTech.TESLA_SINGLE_MAX_EFFICIENCY;//Default is 0.95F
- private float overdriveEfficiencyExtra = TecTech.configTecTech.TESLA_SINGLE_OVERDRIVE_LOSS;//Default is 0.010F
- private float energyEfficiency = map(mTier + 1, minTier + 1, maxTier + 1, minEfficiency, maxEfficiency);
- private float overdriveEfficiency = energyEfficiency - overdriveEfficiencyExtra;
+import static net.minecraft.util.StatCollector.translateToLocal;
+import static net.minecraft.util.StatCollector.translateToLocalFormatted;
+
+public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryBuffer implements ITeslaConnectable {
+ //Interface fields
+ private final Multimap<Integer, ITeslaConnectableSimple> teslaNodeMap = MultimapBuilder.treeKeys().linkedListValues().build();
+ private final HashSet<ThaumSpark> sparkList = new HashSet<>();
+ private int sparkCount = 10;
+
+ private final static int transferRadiusMax = TecTech.configTecTech.TESLA_SINGLE_RANGE;//Default is 20
+ private final static int perBlockLoss = TecTech.configTecTech.TESLA_SINGLE_LOSS_PER_BLOCK;//Default is 1
+ private final static float overDriveLoss = TecTech.configTecTech.TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE;//Default is 0.25F
+ private final static int transferRadiusMin = 4;//Minimum user configurable
+ private int transferRadius = transferRadiusMax;//Default transferRadius setting
+
+ public boolean powerPassToggle = false;//Power Pass for public viewing
+ private final static int histSteps = 20;//Hysteresis Resolution
+ private int histSettingLow = 3;//Hysteresis Low Limit
+ private int histSettingHigh = 15;//Hysteresis High Limit
+ private final static int histLowLimit = 1;//How low can you configure it?
+ private final static int histHighLimit = 19;//How high can you configure it?
+ private float histLow = (float) histSettingLow / histSteps;//Power pass is disabled if power is under this fraction
+ private float histHigh = (float) histSettingHigh / histSteps;//Power pass is enabled if power is over this fraction
+
+ private final long outputVoltage = V[mTier];
private boolean overdriveToggle = false;
+ private String clientLocale = "en_US";
+
public GT_MetaTileEntity_TeslaCoil(int aID, String aName, String aNameRegional, int aTier, int aSlotCount) {
- super(aID, aName, aNameRegional, aTier, "Tesla Coil Transceiver", aSlotCount);
+ super(aID, aName, aNameRegional, aTier, "", aSlotCount);
Util.setTier(aTier, this);
}
@@ -77,24 +71,24 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB @Override
public String[] getDescription() {
- String[] jargon = new String[3];
- jargon[0] = CommonValues.BASS_MARK;
- jargon[1] = "Your Tesla I/O machine of choice";
- jargon[2] = EnumChatFormatting.AQUA + "Lightning stoves for the rich";
+ String[] jargon = new String[]{
+ CommonValues.BASS_MARK,
+ translateToLocal("gt.blockmachines.machine.tt.tesla.desc.0"),//Your Tesla I/O machine of choice
+ EnumChatFormatting.AQUA + translateToLocal("gt.blockmachines.machine.tt.tesla.desc.1")//Lightning stoves for the rich
+ };
String[] sDesc = super.getDescription();
- sDesc = Arrays.copyOfRange(sDesc, 1, sDesc.length);
- String[] desc = ArrayUtils.addAll(jargon, sDesc);
- return desc;
+ sDesc = Arrays.copyOfRange(sDesc, 1, sDesc.length);//Removes first element from array
+ return ArrayUtils.addAll(jargon, sDesc);
}
@Override
public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
if (overdriveToggle) {
overdriveToggle = false;
- PlayerChatHelper.SendInfo(aPlayer, "Overdrive disengaged");
+ PlayerChatHelper.SendInfo(aPlayer, translateToLocalFormatted("tt.keyphrase.Overdrive_disengaged", clientLocale));
} else {
overdriveToggle = true;
- PlayerChatHelper.SendInfo(aPlayer, "Overdrive engaged");
+ PlayerChatHelper.SendInfo(aPlayer, translateToLocalFormatted("tt.keyphrase.Overdrive_engaged", clientLocale));
}
return true;
}
@@ -108,7 +102,7 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB histSettingHigh = histSettingLow + 1;
}
histHigh = (float) histSettingHigh / histSteps;
- PlayerChatHelper.SendInfo(aPlayer, "Hysteresis high set to " + round(histHigh * 100F) + "%");
+ PlayerChatHelper.SendInfo(aPlayer, translateToLocalFormatted("tt.keyphrase.Hysteresis_high_set_to", clientLocale) + " " + round(histHigh * 100F) + "%");
} else {
if (histSettingLow > histLowLimit) {
histSettingLow--;
@@ -116,22 +110,22 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB histSettingLow = histSettingHigh - 1;
}
histLow = (float) histSettingLow / histSteps;
- PlayerChatHelper.SendInfo(aPlayer, "Hysteresis low set to " + round(histLow * 100F) + "%");
+ PlayerChatHelper.SendInfo(aPlayer, translateToLocalFormatted("tt.keyphrase.Hysteresis_low_set_to", clientLocale) + " " + round(histLow * 100F) + "%");
}
}
@Override
public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
if (aPlayer.isSneaking()) {
- if (transferRadius > transferRadiusLimitBottom) {
+ if (transferRadius > transferRadiusMin) {
transferRadius--;
}
} else {
- if (transferRadius < 0) {
+ if (transferRadius < transferRadiusMax) {
transferRadius++;
}
}
- PlayerChatHelper.SendInfo(aPlayer, "Tesla radius set to " + transferRadius + "m");
+ PlayerChatHelper.SendInfo(aPlayer, translateToLocalFormatted("tt.keyphrase.Tesla_radius_set_to", clientLocale) + " " + transferRadius + "m");
return false;
}
@@ -158,7 +152,7 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB }
//And after this cheeky-ness, toss the string XD
- return powerPassToggle ? "Sending power!" : "Receiving power!";
+ return powerPassToggle ? translateToLocalFormatted("tt.keyphrase.Sending_power", clientLocale) + "!" : translateToLocalFormatted("tt.keyphrase.Receiving_power", clientLocale) + "!";
}
@Override
@@ -169,13 +163,11 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB @Override
public ITexture[][][] getTextureSet(ITexture[] aTextures) {
ITexture[][][] rTextures = new ITexture[3][17][];
-
for (byte i = -1; i < 16; ++i) {
- rTextures[0][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1]};
- rTextures[1][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], TESLA_TRANSCEIVER_TOP_BA};
- rTextures[2][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], this.mInventory.length == 16 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[this.mTier] : (this.mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier])};
+ rTextures[0][i + 1] = new ITexture[]{MACHINE_CASINGS_TT[this.mTier][i + 1]};
+ rTextures[1][i + 1] = new ITexture[]{MACHINE_CASINGS_TT[this.mTier][i + 1], TESLA_TRANSCEIVER_TOP_BA};
+ rTextures[2][i + 1] = new ITexture[]{MACHINE_CASINGS_TT[this.mTier][i + 1], this.mInventory.length == 16 ? OVERLAYS_ENERGY_OUT_POWER_TT[this.mTier] : (this.mInventory.length > 4 ? OVERLAYS_ENERGY_OUT_MULTI_TT[this.mTier] : OVERLAYS_ENERGY_OUT_TT[this.mTier])};
}
-
return rTextures;
}
@@ -189,41 +181,30 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB return new GT_MetaTileEntity_TeslaCoil(mName, mTier, mDescription, mTextures, mInventory.length);
}
- private void thaumLightning(IGregTechTileEntity mte, IGregTechTileEntity node) {
- int x = mte.getXCoord();
- int y = mte.getYCoord();
- int z = mte.getZCoord();
-
- byte xR;
- byte yR;
- byte zR;
-
- IMetaTileEntity nodeInside = node.getMetaTileEntity();
- if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil) {
- GT_MetaTileEntity_TM_teslaCoil nodeTesla = (GT_MetaTileEntity_TM_teslaCoil) nodeInside;
- xR = (byte) (nodeTesla.posTop[0] - x);
- yR = (byte) (nodeTesla.posTop[1] - y);
- zR = (byte) (nodeTesla.posTop[2] - z);
- } else {
- xR = (byte) (node.getXCoord() - x);
- yR = (byte) (node.getYCoord() - y);
- zR = (byte) (node.getZCoord() - z);
+ @Override
+ public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
+ super.onFirstTick(aBaseMetaTileEntity);
+ if (!aBaseMetaTileEntity.isClientSide()) {
+ teslaSimpleNodeSetAdd(this);
+ generateTeslaNodeMap(this);
}
-
- int wID = mte.getWorld().provider.dimensionId;
-
- sparkList.add(new ThaumSpark(x, y, z, xR, yR, zR, wID));
}
- private long getEnergyEfficiency(long voltage, int distance, boolean overDriveToggle) {
- if (overDriveToggle) {
- return (long) ((voltage * 2) - (voltage * Math.pow(overdriveEfficiency, distance)));
- } else {
- return (long) (voltage * Math.pow(energyEfficiency, distance));
+ @Override
+ public void onRemoval() {
+ super.onRemoval();
+ if (!this.getBaseMetaTileEntity().isClientSide()) {
+ teslaSimpleNodeSetRemove(this);
}
}
@Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ teslaSimpleNodeSetAdd(this);
+ }
+
+ @Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPostTick(aBaseMetaTileEntity, aTick);
if (aBaseMetaTileEntity.isClientSide()) {
@@ -242,98 +223,128 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB powerPassToggle = false;
}
- //Stuff to do if ePowerPass
- if (powerPassToggle) {
- float rangeFrac = (float) ((-0.5 * Math.pow(energyFrac, 2)) + (1.5 * energyFrac));
- long outputCurrent = mBatteryCount;
- transferRadiusTower = (int) (transferRadius * rangeFrac);
- transferRadiusCover = (int) (transferRadiusTower / 1.25);
-
- //Clean the eTeslaMap
- for (Map.Entry<IGregTechTileEntity, Integer> Rx : eTeslaMap.entrySet()) {
- IGregTechTileEntity node = Rx.getKey();
- if (node != null) {
- IMetaTileEntity nodeInside = node.getMetaTileEntity();
- try {
- if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive()) {
- GT_MetaTileEntity_TM_teslaCoil teslaTower = (GT_MetaTileEntity_TM_teslaCoil) nodeInside;
- if (teslaTower.maxEUStore() > 0) {
- continue;
- }
- } else if ((node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil) && node.getEUCapacity() > 0) {
- continue;
- }
- } catch (Exception e) {
- }
- }
- eTeslaMap.remove(Rx.getKey());
+ //Send Power
+ powerTeslaNodeMap(this);
+
+ //TODO Encapsulate the spark sender
+ sparkCount--;
+ if (sparkCount == 0){
+ sparkCount = 10;
+ if(!sparkList.isEmpty()){
+ NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList),
+ aBaseMetaTileEntity.getWorld().provider.dimensionId,
+ aBaseMetaTileEntity.getXCoord(),
+ aBaseMetaTileEntity.getYCoord(),
+ aBaseMetaTileEntity.getZCoord(),
+ 256);
+ sparkList.clear();
}
+ }
+ }
- //Power transfer
- while (outputCurrent > 0) {
- boolean idle = true;
- for (Map.Entry<IGregTechTileEntity, Integer> Rx : entriesSortedByValues(eTeslaMap)) {
- if (getEUVar() >= (overdriveToggle ? outputVoltage * 2 : outputVoltage)) {
- IGregTechTileEntity node = Rx.getKey();
- IMetaTileEntity nodeInside = node.getMetaTileEntity();
-
- long outputVoltageInjectable;
- long outputVoltageConsumption;
- if (overdriveToggle) {
- outputVoltageInjectable = outputVoltage;
- outputVoltageConsumption = getEnergyEfficiency(outputVoltage, Rx.getValue(), true);
- } else {
- outputVoltageInjectable = getEnergyEfficiency(outputVoltage, Rx.getValue(), false);
- outputVoltageConsumption = outputVoltage;
- }
- if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && Rx.getValue() <= transferRadiusTower) {
- GT_MetaTileEntity_TM_teslaCoil nodeTesla = (GT_MetaTileEntity_TM_teslaCoil) nodeInside;
- if (!nodeTesla.ePowerPass) {
- if (nodeTesla.getEUVar() + outputVoltageInjectable <= (nodeTesla.maxEUStore() / 2)) {
- setEUVar(getEUVar() - outputVoltageConsumption);
- node.increaseStoredEnergyUnits(outputVoltageInjectable, true);
- thaumLightning(aBaseMetaTileEntity, node);
- outputCurrent--;
- idle = false;
- }
- }
- } else if ((node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil) && !(node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil_Ultimate) && Rx.getValue() <= transferRadiusCover) {
- if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil){
- GT_MetaTileEntity_TeslaCoil nodeTesla = (GT_MetaTileEntity_TeslaCoil) nodeInside;
- if (nodeTesla.powerPassToggle){
- continue;
- }
- }
- if (node.injectEnergyUnits((byte) 1, outputVoltageInjectable, 1L) > 0L) {
- setEUVar(getEUVar() - outputVoltageConsumption);
- thaumLightning(aBaseMetaTileEntity, node);
- outputCurrent--;
- idle = false;
- }
- }
- if (outputCurrent == 0) {
- break;
- }
- } else {
- idle = true;
- break;
- }
- }
- if (idle) {
- break;
- }
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ try {
+ EntityPlayerMP player = (EntityPlayerMP) aPlayer;
+ clientLocale = (String) FieldUtils.readField(player, "translator", true);
+ } catch (Exception e) {
+ clientLocale = "en_US";
}
+ aBaseMetaTileEntity.openGUI(aPlayer);
}
- sparkCount++;
- if (sparkCount == 60 && !sparkList.isEmpty()) {
- sparkCount = 0;
- NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList),
- aBaseMetaTileEntity.getWorld().provider.dimensionId,
- aBaseMetaTileEntity.getXCoord(),
- aBaseMetaTileEntity.getYCoord(),
- aBaseMetaTileEntity.getZCoord(),
- 256);
+ return true;
+ }
+
+ @Override
+ public byte getTeslaReceptionCapability() {
+ return 1;
+ }
+
+ @Override
+ public float getTeslaReceptionCoefficient() {
+ return 1;
+ }
+
+ @Override
+ public Multimap<Integer, ITeslaConnectableSimple> getTeslaNodeMap() {
+ return teslaNodeMap;
+ }
+
+ @Override
+ public HashSet<ThaumSpark> getSparkList() {
+ return sparkList;
+ }
+
+ @Override
+ public byte getTeslaTransmissionCapability() {
+ return 2;
+ }
+
+ @Override
+ public int getTeslaTransmissionRange() {
+ return transferRadius;
+ }
+
+ @Override
+ public boolean isOverdriveEnabled() {
+ return overdriveToggle;
+ }
+
+ @Override
+ public int getTeslaEnergyLossPerBlock() {
+ return perBlockLoss;
+ }
+
+ @Override
+ public float getTeslaOverdriveLossCoefficient() {
+ return overDriveLoss;
+ }
+
+ @Override
+ public long getTeslaOutputVoltage() {
+ return outputVoltage;
+ }
+
+ @Override
+ public long getTeslaOutputCurrent() {
+ return mBatteryCount;
+ }
+
+ @Override
+ public boolean teslaDrainEnergy(long teslaVoltageDrained) {
+ if (getEUVar() < teslaVoltageDrained) {
+ return false;
}
- sparkList.clear();
+
+ setEUVar(getEUVar() - teslaVoltageDrained);
+ return true;
+ }
+
+ @Override
+ public boolean isTeslaReadyToReceive() {
+ return !this.powerPassToggle;
+ }
+
+ @Override
+ public long getTeslaStoredEnergy() {
+ return getEUVar();
+ }
+
+ @Override
+ public Vec3Impl getTeslaPosition() {
+ return new Vec3Impl(this.getBaseMetaTileEntity().getXCoord(),
+ this.getBaseMetaTileEntity().getYCoord(),
+ this.getBaseMetaTileEntity().getZCoord());
+ }
+
+ @Override
+ public Integer getTeslaDimension() {
+ return this.getBaseMetaTileEntity().getWorld().provider.dimensionId;
+ }
+
+ @Override
+ public boolean teslaInjectEnergy(long teslaVoltageInjected) {
+ return this.getBaseMetaTileEntity().injectEnergyUnits((byte) 1, teslaVoltageInjected, 1L) > 0L;
}
-}
\ No newline at end of file +}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_WetTransformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_WetTransformer.java index 02f84bd7c3..ca937f813c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_WetTransformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_WetTransformer.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.single; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.util.CommonValues; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import static com.github.technus.tectech.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.V; import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_WetTransformer extends GT_MetaTileEntity_TT_Transformer { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugPollutor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugPollutor.java index ebeb266c64..b40a9126b7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugPollutor.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugPollutor.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.single.gui; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DebugPollutor; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_BuckConverter.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_BuckConverter.java index 946006c8fa..6b6b778d40 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_BuckConverter.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_BuckConverter.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.single.gui; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; -import static com.github.technus.tectech.CommonValues.VN; +import static com.github.technus.tectech.util.CommonValues.VN; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_BuckConverter extends GT_GUIContainerMetaTile_Machine { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java index eb2c2e4112..bde5b90048 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java @@ -1,6 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.single.gui; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DataReader; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.gui.GT_Slot_Holo; @@ -115,8 +115,8 @@ public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine private void renderDataBG(ItemStack thing, int mouseX, int mouseY, int x, int y, byte mTier) { if (thing != null) { - ArrayList<GT_MetaTileEntity_DataReader.IDataRender> renders = GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(thing)); - for (GT_MetaTileEntity_DataReader.IDataRender render : renders) { + for (GT_MetaTileEntity_DataReader.IDataRender render : + GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(thing))) { if (render.canRender(thing, mTier)) { if (!GT_Utility.areStacksEqual(stack, thing, false)) { render.initRender(thing); @@ -133,8 +133,8 @@ public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine if(stack==null){ return false; } - ArrayList<GT_MetaTileEntity_DataReader.IDataRender> renders = GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(stack)); - for (GT_MetaTileEntity_DataReader.IDataRender render : renders) { + for (GT_MetaTileEntity_DataReader.IDataRender render : + GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(stack))) { if (render.canRender(stack, mTier)) { render.renderForeground(stack, mouseX, mouseY, this, fontRendererObj); return true; @@ -147,8 +147,8 @@ public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine if(stack==null){ return false; } - ArrayList<GT_MetaTileEntity_DataReader.IDataRender> renders = GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(stack)); - for (GT_MetaTileEntity_DataReader.IDataRender render : renders) { + for (GT_MetaTileEntity_DataReader.IDataRender render : + GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(stack))) { if (render.canRender(stack, mTier)) { render.renderTooltips(stack, mouseX, mouseY, this); return true; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPowerGenerator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPowerGenerator.java index ad3839e80a..ee6e952040 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPowerGenerator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPowerGenerator.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.single.gui; -import com.github.technus.tectech.Util; +import com.github.technus.tectech.util.Util; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; -import static com.github.technus.tectech.CommonValues.VN; +import static com.github.technus.tectech.util.CommonValues.VN; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_DebugPowerGenerator extends GT_GUIContainerMetaTile_Machine { 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 index 4d66b28ca6..55fa327364 100644 --- a/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java +++ b/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java @@ -89,7 +89,7 @@ public class ReactorSimTileEntity extends TileEntityNuclearReactorElectric { @Override public double getReactorEUEnergyOutput() { - return (double)(getReactorEnergyOutput() * 5.0F * ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear")); + return getReactorEnergyOutput() * 5.0F * ConfigUtil.getDouble(MainConfig.get(), "balance/energy/generator/nuclear"); } //public List<TileEntity> getSubTiles() { diff --git a/src/main/java/com/github/technus/tectech/CommonValues.java b/src/main/java/com/github/technus/tectech/util/CommonValues.java index 9564643fbe..f5d5ce6900 100644 --- a/src/main/java/com/github/technus/tectech/CommonValues.java +++ b/src/main/java/com/github/technus/tectech/util/CommonValues.java @@ -1,4 +1,4 @@ -package com.github.technus.tectech; +package com.github.technus.tectech.util; import net.minecraft.util.EnumChatFormatting; diff --git a/src/main/java/com/github/technus/tectech/Converter.java b/src/main/java/com/github/technus/tectech/util/Converter.java index 5d1f5c802e..799d98a4d6 100644 --- a/src/main/java/com/github/technus/tectech/Converter.java +++ b/src/main/java/com/github/technus/tectech/util/Converter.java @@ -1,4 +1,4 @@ -package com.github.technus.tectech; +package com.github.technus.tectech.util; import java.io.*; diff --git a/src/main/java/com/github/technus/tectech/util/DoubleCount.java b/src/main/java/com/github/technus/tectech/util/DoubleCount.java new file mode 100644 index 0000000000..f5c391ab43 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/util/DoubleCount.java @@ -0,0 +1,123 @@ +package com.github.technus.tectech.util; + +import java.util.Arrays; + +import static java.lang.Math.*; + +public class DoubleCount { + /** + * Distributes count across probabilities + * + * @param count the count to divide + * @param probabilities probability ratios to divide by, descending + * @return divided count + * @throws ArithmeticException + */ + public static double[] distribute(double count, double... probabilities) throws ArithmeticException { + if (probabilities == null || Double.isNaN(count)) { + return null; + } else if (count == 0) { + return new double[probabilities.length]; + } else if (Double.isInfinite(count)) { + double[] doubles = new double[probabilities.length]; + Arrays.fill(doubles, count); + return doubles; + } else { + switch (probabilities.length) { + default: { + int size = probabilities.length; + double[] output = new double[size]; + size--; + double remaining = count, previous = probabilities[size], probability, out; + for (int i = size - 1; i >= 0; i--) { + probability = probabilities[i]; + out = count * probability; + out -= ulpSigned(out); + + remaining -= out; + output[i] = out; + + if (previous < probability) { + throw new ArithmeticException("Malformed probability order: " + Arrays.toString(probabilities)); + } + previous = probability; + if (probability >= 1) { + break; + } + } + if (remaining * count < 0) {//overshoot + finishIt(size, output, remaining); + } else { + output[size] = remaining; + } + return output; + } + case 1: + return new double[]{count}; + case 0: + return probabilities;//empty array at hand... + } + } + } + + public static double ulpSigned(double number) { + if (number == 0) { + return 0; + } + return number > 0 ? ulp(number) : -ulp(number); + } + + private static void finishIt(int size, double[] output, double remaining) { + for (int i = size - 1; i >= 0; i--) { + if (abs(output[i]) >= abs(remaining)) { + output[i] -= remaining; + break; + } else { + remaining += output[i]; + output[i] = 0; + } + } + } + + public static double div(double count, double divisor) { + if (count == 0 || abs(divisor) == 1 || abs(count)==abs(divisor)) { + return count/divisor; + } else { + double result = count / divisor; + return result - ulpSigned(result); + } + } + + public static double mul(double count, double multiplier) { + if (count == 0 || multiplier == 0 || abs(multiplier)==1 || abs(count)==1) { + return count*multiplier; + } else { + double result = count * multiplier; + return result - ulpSigned(result); + } + } + + public static double sub(double count, double value) { + if (count == 0 || value == 0 || count == value) { + return count - value; + } else { + double result = count - value; + if(result==count||result==value){ + return result; + } + return result - ulpSigned(result); + } + } + + public static double add(double count, double value) { + if (count == 0 || value == 0 || count == -value) { + return count + value; + } else { + double result = count + value; + if(result==count||result==value){ + return result; + } + return result - ulpSigned(result); + } + } +} diff --git a/src/main/java/com/github/technus/tectech/util/LightingHelper.java b/src/main/java/com/github/technus/tectech/util/LightingHelper.java new file mode 100644 index 0000000000..9a1c1b1abd --- /dev/null +++ b/src/main/java/com/github/technus/tectech/util/LightingHelper.java @@ -0,0 +1,726 @@ +/* + * LightingHelper - Derived and adapted from @Mineshopper / carpentersblocks + * Copyright (c) 2013-2021. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package com.github.technus.tectech.util; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; + +//This is duplicated in newer GT5u on the GTNH Branch inside the gregtech.api.util package +//But I include it here as the easiest way to implement backwards compat with non-NH stuff +//Yes, it could be done in a cleaner way. If you would like to, you're welcome to make your own PR and @basdxz +@SuppressWarnings("unused") +@SideOnly(Side.CLIENT) +public class LightingHelper { + public static final int NORMAL_BRIGHTNESS = 0xff00ff; + public static final int MAX_BRIGHTNESS = 0xf000f0; + protected static final float[] LIGHTNESS = {0.5F, 1.0F, 0.8F, 0.8F, 0.6F, 0.6F}; + private final RenderBlocks renderBlocks; + /** + * Brightness for side. + */ + private int brightness; + /** + * Ambient occlusion values for all four corners of side. + */ + private float aoTopLeft, aoBottomLeft, aoBottomRight, aoTopRight; + private boolean hasLightnessOverride; + private float lightnessOverride; + private boolean hasBrightnessOverride; + private int brightnessOverride; + private boolean hasColorOverride; + private int colorOverride = 0xffffff; + + /** + * Class constructor specifying the {@link RenderBlocks}. + * + * @param renderBlocks the {@link RenderBlocks} + */ + public LightingHelper(RenderBlocks renderBlocks) { + this.renderBlocks = renderBlocks; + } + + /** + * Gets average brightness from two brightness values. + * + * @param brightnessA the first brightness value + * @param brightnessB the second brightness value + * @return the mixed brightness + */ + public static int getAverageBrightness(int brightnessA, int brightnessB) { + int sectionA1 = brightnessA >> 16 & 0xff; + int sectionA2 = brightnessA & 255; + + int sectionB1 = brightnessB >> 16 & 0xff; + int sectionB2 = brightnessB & 255; + + int difference1 = (int) ((sectionA1 + sectionB1) / 2.0F); + int difference2 = (int) ((sectionA2 + sectionB2) / 2.0F); + + return difference1 << 16 | difference2; + } + + /** + * Gets rgb color from RGBA array. + * + * @param color the integer color + * @return a float array with rgb values + */ + public static float[] getRGB(short[] color) { + float red = color[0] / 255.0F; + float green = color[1] / 255.0F; + float blue = color[2] / 255.0F; + + return new float[]{red, green, blue}; + } + + /** + * Clears brightness override. + */ + public void clearBrightnessOverride() { + hasBrightnessOverride = false; + } + + /** + * Clears color override. + */ + public void clearColorOverride() { + hasColorOverride = false; + } + + /** + * Clears lightness override. + */ + public void clearLightnessOverride() { + hasLightnessOverride = false; + } + + /** + * @return the Ambient Occlusion for Bottom-Left corner + */ + public float getAoBottomLeft() { + return aoBottomLeft; + } + + /** + * @return the Ambient Occlusion for Bottom-Right corner + */ + public float getAoBottomRight() { + return aoBottomRight; + } + + /** + * @return the Ambient Occlusion for Top-Left corner + */ + public float getAoTopLeft() { + return aoTopLeft; + } + + /** + * @return the Ambient Occlusion for Top-Right corner + */ + public float getAoTopRight() { + return aoTopRight; + } + + /** + * Sets brightness override. + * + * @param brightness the brightness override + * @return the {@link LightingHelper} + */ + public LightingHelper setBrightnessOverride(int brightness) { + hasBrightnessOverride = true; + brightnessOverride = brightness; + return this; + } + + public LightingHelper setColorOverride(short[] color) { + return setColorOverride(getColor(color)); + } + + /** + * Sets color override. + * + * @param color the color override + * @return the {@link LightingHelper} + */ + public LightingHelper setColorOverride(int color) { + hasColorOverride = true; + colorOverride = color; + return this; + } + + /** + * Gets int color from RGBA array. + * + * @param rgba the short RGBA color array + * @return int color + */ + public static int getColor(short[] rgba) { + return (rgba[2] & 0xff) | (rgba[1] & 0xff) << 8 | (rgba[0] & 0xff) << 16; + } + + /** + * Sets lightness override. + * + * @param lightness the lightness override + * @return the {@link LightingHelper} + */ + public LightingHelper setLightnessOverride(float lightness) { + hasLightnessOverride = true; + lightnessOverride = lightness; + return this; + } + + /** + * Sets up the color using lightness, brightness, and the primary color + * value (usually the dye color) for the side. + * + * @param side the side + * @param rgba the primary short[] RGBA color array + */ + public void setupColor(int side, short[] rgba) { + setupColor(side, getColor(rgba)); + } + + /** + * Sets up the color using lightness, brightness, and the primary color + * value (usually the dye color) for the side. + * + * @param side the side + * @param hexColor the primary color + */ + public void setupColor(int side, int hexColor) { + Tessellator tessellator = Tessellator.instance; + float lightness = hasLightnessOverride ? lightnessOverride : LIGHTNESS[side]; + float[] rgb = getRGB(hexColor); + + if (hasColorOverride && !renderBlocks.hasOverrideBlockTexture()) { + rgb = getRGB(colorOverride); + } + + applyAnaglyph(rgb); + + if (renderBlocks.enableAO) { + tessellator.setBrightness(hasBrightnessOverride ? brightnessOverride : brightness); + + if (renderBlocks.hasOverrideBlockTexture()) { + + renderBlocks.colorRedTopLeft = renderBlocks.colorRedBottomLeft = renderBlocks.colorRedBottomRight = renderBlocks.colorRedTopRight = rgb[0]; + renderBlocks.colorGreenTopLeft = renderBlocks.colorGreenBottomLeft = renderBlocks.colorGreenBottomRight = renderBlocks.colorGreenTopRight = rgb[1]; + renderBlocks.colorBlueTopLeft = renderBlocks.colorBlueBottomLeft = renderBlocks.colorBlueBottomRight = renderBlocks.colorBlueTopRight = rgb[2]; + + } else { + + renderBlocks.colorRedTopLeft = renderBlocks.colorRedBottomLeft = renderBlocks.colorRedBottomRight = renderBlocks.colorRedTopRight = rgb[0] * lightness; + renderBlocks.colorGreenTopLeft = renderBlocks.colorGreenBottomLeft = renderBlocks.colorGreenBottomRight = renderBlocks.colorGreenTopRight = rgb[1] * lightness; + renderBlocks.colorBlueTopLeft = renderBlocks.colorBlueBottomLeft = renderBlocks.colorBlueBottomRight = renderBlocks.colorBlueTopRight = rgb[2] * lightness; + + renderBlocks.colorRedTopLeft *= aoTopLeft; + renderBlocks.colorGreenTopLeft *= aoTopLeft; + renderBlocks.colorBlueTopLeft *= aoTopLeft; + renderBlocks.colorRedBottomLeft *= aoBottomLeft; + renderBlocks.colorGreenBottomLeft *= aoBottomLeft; + renderBlocks.colorBlueBottomLeft *= aoBottomLeft; + renderBlocks.colorRedBottomRight *= aoBottomRight; + renderBlocks.colorGreenBottomRight *= aoBottomRight; + renderBlocks.colorBlueBottomRight *= aoBottomRight; + renderBlocks.colorRedTopRight *= aoTopRight; + renderBlocks.colorGreenTopRight *= aoTopRight; + renderBlocks.colorBlueTopRight *= aoTopRight; + } + + } else { + + tessellator.setColorOpaque_F(rgb[0] * lightness, rgb[1] * lightness, rgb[2] * lightness); + + } + } + + /** + * Gets rgb color from integer. + * + * @param color the integer color + * @return a float array with rgb values + */ + public static float[] getRGB(int color) { + float red = (color >> 16 & 0xff) / 255.0F; + float green = (color >> 8 & 0xff) / 255.0F; + float blue = (color & 0xff) / 255.0F; + + return new float[]{red, green, blue}; + } + + /** + * Will apply anaglyph color multipliers to RGB float array. + * <p> + * If {@link EntityRenderer#anaglyphEnable} is false, + * will do nothing. + * + * @param rgb array containing red, green and blue float values + */ + public void applyAnaglyph(float[] rgb) { + if (EntityRenderer.anaglyphEnable) { + rgb[0] = (rgb[0] * 30.0F + rgb[1] * 59.0F + rgb[2] * 11.0F) / 100.0F; + rgb[1] = (rgb[0] * 30.0F + rgb[1] * 70.0F) / 100.0F; + rgb[2] = (rgb[0] * 30.0F + rgb[2] * 70.0F) / 100.0F; + } + } + + /** + * Gets mixed ambient occlusion value from two inputs, with a + * ratio applied to the final result. + * + * @param ao1 the first ambient occlusion value + * @param ao2 the second ambient occlusion value + * @param ratio the ratio for mixing + * @return the mixed red, green, blue float values + */ + public static float getMixedAo(float ao1, float ao2, double ratio) { + float diff = (float) (Math.abs(ao1 - ao2) * (1.0F - ratio)); + + return ao1 > ao2 ? ao1 - diff : ao1 + diff; + } + + /** + * Sets up lighting for the West face and returns the {@link LightingHelper}. + * <p> + * This is a consolidated <code>method</code> that sets side shading + * with respect to the following attributes: + * <p> + * <ul> + * <li>{@link RenderBlocks#enableAO}</li> + * <li>{@link RenderBlocks#partialRenderBounds}</li> + * </ul> + * + * @param block the block {@link Block} + * @param x the x coordinate + * @param y the y coordinate + * @param z the z coordinate + * @return the {@link LightingHelper} + */ + public LightingHelper setupLightingXNeg(Block block, int x, int y, int z) { + + if (renderBlocks.enableAO) { + + int xOffset = renderBlocks.renderMinX > 0.0F ? x : x - 1; + + int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z); + brightness = mixedBrightness; + + float ratio = (float) (1.0F - renderBlocks.renderMinX); + float aoLightValue = renderBlocks.blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXYNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z); + renderBlocks.aoBrightnessXZNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z - 1); + renderBlocks.aoBrightnessXZNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z + 1); + renderBlocks.aoBrightnessXYNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z); + renderBlocks.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z - 1); + renderBlocks.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z + 1); + renderBlocks.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z - 1); + renderBlocks.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z + 1); + renderBlocks.aoLightValueScratchXYNN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y - 1, z).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXZNN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXZNP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYNP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y + 1, z).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZNNN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y - 1, z - 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZNNP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y - 1, z + 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZNPN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y + 1, z - 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZNPP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y + 1, z + 1).getAmbientOcclusionLightValue(), ratio); + + int brightnessMixedXYZNPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXZNN, renderBlocks.aoBrightnessXYZNPN, renderBlocks.aoBrightnessXYNP, mixedBrightness); + int brightnessMixedXYZNNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZNNN, renderBlocks.aoBrightnessXYNN, renderBlocks.aoBrightnessXZNN, mixedBrightness); + int brightnessMixedXYZNNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYNN, renderBlocks.aoBrightnessXYZNNP, renderBlocks.aoBrightnessXZNP, mixedBrightness); + int brightnessMixedXYZNPP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXZNP, renderBlocks.aoBrightnessXYNP, renderBlocks.aoBrightnessXYZNPP, mixedBrightness); + + float aoMixedXYZNPN = (renderBlocks.aoLightValueScratchXZNN + aoLightValue + renderBlocks.aoLightValueScratchXYZNPN + renderBlocks.aoLightValueScratchXYNP) / 4.0F; + float aoMixedXYZNNN = (renderBlocks.aoLightValueScratchXYZNNN + renderBlocks.aoLightValueScratchXYNN + renderBlocks.aoLightValueScratchXZNN + aoLightValue) / 4.0F; + float aoMixedXYZNNP = (renderBlocks.aoLightValueScratchXYNN + renderBlocks.aoLightValueScratchXYZNNP + aoLightValue + renderBlocks.aoLightValueScratchXZNP) / 4.0F; + float aoMixedXYZNPP = (aoLightValue + renderBlocks.aoLightValueScratchXZNP + renderBlocks.aoLightValueScratchXYNP + renderBlocks.aoLightValueScratchXYZNPP) / 4.0F; + + aoTopLeft = (float) (aoMixedXYZNPP * renderBlocks.renderMaxY * renderBlocks.renderMaxZ + aoMixedXYZNPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZNNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxZ); + aoBottomLeft = (float) (aoMixedXYZNPP * renderBlocks.renderMaxY * renderBlocks.renderMinZ + aoMixedXYZNPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZNNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinZ); + aoBottomRight = (float) (aoMixedXYZNPP * renderBlocks.renderMinY * renderBlocks.renderMinZ + aoMixedXYZNPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZNNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinZ); + aoTopRight = (float) (aoMixedXYZNPP * renderBlocks.renderMinY * renderBlocks.renderMaxZ + aoMixedXYZNPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZNNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxZ); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNPN, brightnessMixedXYZNNN, brightnessMixedXYZNNP, renderBlocks.renderMaxY * renderBlocks.renderMaxZ, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxZ), (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxZ), (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxZ); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNPN, brightnessMixedXYZNNN, brightnessMixedXYZNNP, renderBlocks.renderMaxY * renderBlocks.renderMinZ, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinZ), (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinZ), (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinZ); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNPN, brightnessMixedXYZNNN, brightnessMixedXYZNNP, renderBlocks.renderMinY * renderBlocks.renderMinZ, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinZ), (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinZ), (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinZ); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNPN, brightnessMixedXYZNNN, brightnessMixedXYZNNP, renderBlocks.renderMinY * renderBlocks.renderMaxZ, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxZ), (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxZ), (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxZ); + + } + + return this; + } + + /** + * Sets up lighting for the East face and returns the {@link LightingHelper}. + * <p> + * This is a consolidated <code>method</code> that sets side shading + * with respect to the following attributes: + * <p> + * <ul> + * <li>{@link RenderBlocks#enableAO}</li> + * <li>{@link RenderBlocks#partialRenderBounds}</li> + * </ul> + * + * @param block the block {@link Block} + * @param x the x coordinate + * @param y the y coordinate + * @param z the z coordinate + * @return the {@link LightingHelper} + */ + public LightingHelper setupLightingXPos(Block block, int x, int y, int z) { + + if (renderBlocks.enableAO) { + + int xOffset = renderBlocks.renderMaxX < 1.0F ? x : x + 1; + + int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z); + brightness = mixedBrightness; + + float aoLightValue = renderBlocks.blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXYPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z); + renderBlocks.aoBrightnessXZPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z - 1); + renderBlocks.aoBrightnessXZPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z + 1); + renderBlocks.aoBrightnessXYPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z); + renderBlocks.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z - 1); + renderBlocks.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y - 1, z + 1); + renderBlocks.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z - 1); + renderBlocks.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y + 1, z + 1); + renderBlocks.aoLightValueScratchXYPN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y - 1, z).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); + renderBlocks.aoLightValueScratchXZPN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); + renderBlocks.aoLightValueScratchXZPP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); + renderBlocks.aoLightValueScratchXYPP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y + 1, z).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); + renderBlocks.aoLightValueScratchXYZPNN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); + renderBlocks.aoLightValueScratchXYZPNP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); + renderBlocks.aoLightValueScratchXYZPPN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); + renderBlocks.aoLightValueScratchXYZPPP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxX); + + int brightnessMixedXYZPPP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXZPP, renderBlocks.aoBrightnessXYPP, renderBlocks.aoBrightnessXYZPPP, mixedBrightness); + int brightnessMixedXYZPNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYPN, renderBlocks.aoBrightnessXYZPNP, renderBlocks.aoBrightnessXZPP, mixedBrightness); + int brightnessMixedXYZPNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZPNN, renderBlocks.aoBrightnessXYPN, renderBlocks.aoBrightnessXZPN, mixedBrightness); + int brightnessMixedXYZPPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXZPN, renderBlocks.aoBrightnessXYZPPN, renderBlocks.aoBrightnessXYPP, mixedBrightness); + + float aoMixedXYZPPP = (aoLightValue + renderBlocks.aoLightValueScratchXZPP + renderBlocks.aoLightValueScratchXYPP + renderBlocks.aoLightValueScratchXYZPPP) / 4.0F; + float aoMixedXYZPNP = (renderBlocks.aoLightValueScratchXYPN + renderBlocks.aoLightValueScratchXYZPNP + aoLightValue + renderBlocks.aoLightValueScratchXZPP) / 4.0F; + float aoMixedXYZPNN = (renderBlocks.aoLightValueScratchXYZPNN + renderBlocks.aoLightValueScratchXYPN + renderBlocks.aoLightValueScratchXZPN + aoLightValue) / 4.0F; + float aoMixedXYZPPN = (renderBlocks.aoLightValueScratchXZPN + aoLightValue + renderBlocks.aoLightValueScratchXYZPPN + renderBlocks.aoLightValueScratchXYPP) / 4.0F; + + aoTopLeft = (float) (aoMixedXYZPNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxZ + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZPPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZPPP * renderBlocks.renderMinY * renderBlocks.renderMaxZ); + aoBottomLeft = (float) (aoMixedXYZPNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinZ + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZPPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZPPP * renderBlocks.renderMinY * renderBlocks.renderMinZ); + aoBottomRight = (float) (aoMixedXYZPNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinZ + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZPPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinZ) + aoMixedXYZPPP * renderBlocks.renderMaxY * renderBlocks.renderMinZ); + aoTopRight = (float) (aoMixedXYZPNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxZ + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZPPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxZ) + aoMixedXYZPPP * renderBlocks.renderMaxY * renderBlocks.renderMaxZ); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZPPN, brightnessMixedXYZPPP, (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxZ, (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxZ), renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxZ), renderBlocks.renderMinY * renderBlocks.renderMaxZ); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZPPN, brightnessMixedXYZPPP, (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinZ, (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinZ), renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinZ), renderBlocks.renderMinY * renderBlocks.renderMinZ); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZPPN, brightnessMixedXYZPPP, (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinZ, (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinZ), renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinZ), renderBlocks.renderMaxY * renderBlocks.renderMinZ); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZPPN, brightnessMixedXYZPPP, (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxZ, (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxZ), renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxZ), renderBlocks.renderMaxY * renderBlocks.renderMaxZ); + + } + + return this; + } + + /** + * Sets up lighting for the bottom face and returns the {@link LightingHelper}. + * <p> + * This is a consolidated <code>method</code> that sets side shading + * with respect to the following attributes: + * <p> + * <ul> + * <li>{@link RenderBlocks#enableAO}</li> + * <li>{@link RenderBlocks#partialRenderBounds}</li> + * </ul> + * + * @param block the block {@link Block} + * @param x the x coordinate + * @param y the y coordinate + * @param z the z coordinate + * @return the {@link LightingHelper} + */ + public LightingHelper setupLightingYNeg(Block block, int x, int y, int z) { + + if (renderBlocks.enableAO) { + + int yOffset = renderBlocks.renderMinY > 0.0F ? y : y - 1; + + int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z); + brightness = mixedBrightness; + + float ratio = (float) (1.0F - renderBlocks.renderMinY); + float aoLightValue = renderBlocks.blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXYNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z); + renderBlocks.aoBrightnessYZNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z - 1); + renderBlocks.aoBrightnessYZNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z + 1); + renderBlocks.aoBrightnessXYPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z); + renderBlocks.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z - 1); + renderBlocks.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z + 1); + renderBlocks.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z - 1); + renderBlocks.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z + 1); + renderBlocks.aoLightValueScratchXYNN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y - 1, z).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchYZNN = getMixedAo(renderBlocks.blockAccess.getBlock(x, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchYZNP = getMixedAo(renderBlocks.blockAccess.getBlock(x, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYPN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y - 1, z).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZNNN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y, z - 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZNNP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y, z + 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZPNN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y, z - 1).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZPNP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y, z + 1).getAmbientOcclusionLightValue(), ratio); + + int brightnessMixedXYZPNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZNP, renderBlocks.aoBrightnessXYZPNP, renderBlocks.aoBrightnessXYPN, mixedBrightness); + int brightnessMixedXYZPNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZNN, renderBlocks.aoBrightnessXYPN, renderBlocks.aoBrightnessXYZPNN, mixedBrightness); + int brightnessMixedXYZNNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYNN, renderBlocks.aoBrightnessXYZNNN, renderBlocks.aoBrightnessYZNN, mixedBrightness); + int brightnessMixedXYZNNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZNNP, renderBlocks.aoBrightnessXYNN, renderBlocks.aoBrightnessYZNP, mixedBrightness); + + float aoMixedXYZPNP = (renderBlocks.aoLightValueScratchYZNP + aoLightValue + renderBlocks.aoLightValueScratchXYZPNP + renderBlocks.aoLightValueScratchXYPN) / 4.0F; + float aoMixedXYZPNN = (aoLightValue + renderBlocks.aoLightValueScratchYZNN + renderBlocks.aoLightValueScratchXYPN + renderBlocks.aoLightValueScratchXYZPNN) / 4.0F; + float aoMixedXYZNNN = (renderBlocks.aoLightValueScratchXYNN + renderBlocks.aoLightValueScratchXYZNNN + aoLightValue + renderBlocks.aoLightValueScratchYZNN) / 4.0F; + float aoMixedXYZNNP = (renderBlocks.aoLightValueScratchXYZNNP + renderBlocks.aoLightValueScratchXYNN + renderBlocks.aoLightValueScratchYZNP + aoLightValue) / 4.0F; + + aoTopLeft = (float) (aoMixedXYZNNP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPNP * renderBlocks.renderMaxZ * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); + aoBottomLeft = (float) (aoMixedXYZNNP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPNP * renderBlocks.renderMinZ * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); + aoBottomRight = (float) (aoMixedXYZNNP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPNP * renderBlocks.renderMinZ * renderBlocks.renderMaxX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); + aoTopRight = (float) (aoMixedXYZNNP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPNP * renderBlocks.renderMaxZ * renderBlocks.renderMaxX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMaxZ * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMinZ * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMinZ * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMaxZ * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); + + } + + return this; + } + + /** + * Sets up lighting for the top face and returns the {@link LightingHelper}. + * <p> + * This is a consolidated <code>method</code> that sets side shading + * with respect to the following attributes: + * <p> + * <ul> + * <li>{@link RenderBlocks#enableAO}</li> + * <li>{@link RenderBlocks#partialRenderBounds}</li> + * </ul> + * + * @param block the block {@link Block} + * @param x the x coordinate + * @param y the y coordinate + * @param z the z coordinate + * @return the {@link LightingHelper} + */ + public LightingHelper setupLightingYPos(Block block, int x, int y, int z) { + + if (renderBlocks.enableAO) { + + int yOffset = renderBlocks.renderMaxY < 1.0F ? y : y + 1; + + int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z); + brightness = mixedBrightness; + + float aoLightValue = renderBlocks.blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXYNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z); + renderBlocks.aoBrightnessXYPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z); + renderBlocks.aoBrightnessYZPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z - 1); + renderBlocks.aoBrightnessYZPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z + 1); + renderBlocks.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z - 1); + renderBlocks.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z - 1); + renderBlocks.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, yOffset, z + 1); + renderBlocks.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, yOffset, z + 1); + renderBlocks.aoLightValueScratchXYNP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y + 1, z).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); + renderBlocks.aoLightValueScratchXYPP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y + 1, z).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); + renderBlocks.aoLightValueScratchYZPN = getMixedAo(renderBlocks.blockAccess.getBlock(x, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); + renderBlocks.aoLightValueScratchYZPP = getMixedAo(renderBlocks.blockAccess.getBlock(x, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); + renderBlocks.aoLightValueScratchXYZNPN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y, z - 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); + renderBlocks.aoLightValueScratchXYZPPN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y, z - 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); + renderBlocks.aoLightValueScratchXYZNPP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y, z + 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); + renderBlocks.aoLightValueScratchXYZPPP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y, z + 1).getAmbientOcclusionLightValue(), renderBlocks.renderMaxY); + + int brightnessMixedXYZPPP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZPP, renderBlocks.aoBrightnessXYZPPP, renderBlocks.aoBrightnessXYPP, mixedBrightness); + int brightnessMixedXYZPPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZPN, renderBlocks.aoBrightnessXYPP, renderBlocks.aoBrightnessXYZPPN, mixedBrightness); + int brightnessMixedXYZNPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYNP, renderBlocks.aoBrightnessXYZNPN, renderBlocks.aoBrightnessYZPN, mixedBrightness); + int brightnessMixedXYZNPP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZNPP, renderBlocks.aoBrightnessXYNP, renderBlocks.aoBrightnessYZPP, mixedBrightness); + + float aoMixedXYZPPP = (renderBlocks.aoLightValueScratchYZPP + aoLightValue + renderBlocks.aoLightValueScratchXYZPPP + renderBlocks.aoLightValueScratchXYPP) / 4.0F; + float aoMixedXYZPPN = (aoLightValue + renderBlocks.aoLightValueScratchYZPN + renderBlocks.aoLightValueScratchXYPP + renderBlocks.aoLightValueScratchXYZPPN) / 4.0F; + float aoMixedXYZNPN = (renderBlocks.aoLightValueScratchXYNP + renderBlocks.aoLightValueScratchXYZNPN + aoLightValue + renderBlocks.aoLightValueScratchYZPN) / 4.0F; + float aoMixedXYZNPP = (renderBlocks.aoLightValueScratchXYZNPP + renderBlocks.aoLightValueScratchXYNP + renderBlocks.aoLightValueScratchYZPP + aoLightValue) / 4.0F; + + aoTopLeft /*SE*/ = (float) (aoMixedXYZNPP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPP * renderBlocks.renderMaxZ * renderBlocks.renderMaxX + aoMixedXYZPPN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX + aoMixedXYZNPN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); + aoBottomLeft /*NE*/ = (float) (aoMixedXYZNPP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPP * renderBlocks.renderMinZ * renderBlocks.renderMaxX + aoMixedXYZPPN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX + aoMixedXYZNPN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); + aoBottomRight /*NW*/ = (float) (aoMixedXYZNPP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPP * renderBlocks.renderMinZ * renderBlocks.renderMinX + aoMixedXYZPPN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX + aoMixedXYZNPN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); + aoTopRight /*SW*/ = (float) (aoMixedXYZNPP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPP * renderBlocks.renderMaxZ * renderBlocks.renderMinX + aoMixedXYZPPN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX + aoMixedXYZNPN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZPPP, brightnessMixedXYZPPN, brightnessMixedXYZNPN, renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMaxZ * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZPPP, brightnessMixedXYZPPN, brightnessMixedXYZNPN, renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMinZ * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZPPP, brightnessMixedXYZPPN, brightnessMixedXYZNPN, renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMinZ * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZPPP, brightnessMixedXYZPPN, brightnessMixedXYZNPN, renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMaxZ * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); + } + + return this; + } + + /** + * Sets up lighting for the North face and returns the {@link LightingHelper}. + * <p> + * This is a consolidated <code>method</code> that sets side shading + * with respect to the following attributes: + * <p> + * <ul> + * <li>{@link RenderBlocks#enableAO}</li> + * <li>{@link RenderBlocks#partialRenderBounds}</li> + * </ul> + * + * @param block the block {@link Block} + * @param x the x coordinate + * @param y the y coordinate + * @param z the z coordinate + * @return the {@link LightingHelper} + */ + public LightingHelper setupLightingZNeg(Block block, int x, int y, int z) { + + if (renderBlocks.enableAO) { + + int zOffset = renderBlocks.renderMinZ > 0.0F ? z : z - 1; + + int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y, zOffset); + brightness = mixedBrightness; + + float ratio = (float) (1.0F - renderBlocks.renderMinZ); + float aoLightValue = renderBlocks.blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXZNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y, zOffset); + renderBlocks.aoBrightnessYZNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y - 1, zOffset); + renderBlocks.aoBrightnessYZPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y + 1, zOffset); + renderBlocks.aoBrightnessXZPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y, zOffset); + renderBlocks.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y - 1, zOffset); + renderBlocks.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y + 1, zOffset); + renderBlocks.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y - 1, zOffset); + renderBlocks.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y + 1, zOffset); + renderBlocks.aoLightValueScratchXZNN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchYZNN = getMixedAo(renderBlocks.blockAccess.getBlock(x, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchYZPN = getMixedAo(renderBlocks.blockAccess.getBlock(x, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXZPN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZNNN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y - 1, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZNPN = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y + 1, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZPNN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y - 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y - 1, z).getAmbientOcclusionLightValue(), ratio); + renderBlocks.aoLightValueScratchXYZPPN = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y + 1, z - 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y + 1, z).getAmbientOcclusionLightValue(), ratio); + + int brightnessMixedXYZPPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZPN, renderBlocks.aoBrightnessXZPN, renderBlocks.aoBrightnessXYZPPN, mixedBrightness); + int brightnessMixedXYZPNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZNN, renderBlocks.aoBrightnessXYZPNN, renderBlocks.aoBrightnessXZPN, mixedBrightness); + int brightnessMixedXYZNNN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZNNN, renderBlocks.aoBrightnessXZNN, renderBlocks.aoBrightnessYZNN, mixedBrightness); + int brightnessMixedXYZNPN = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXZNN, renderBlocks.aoBrightnessXYZNPN, renderBlocks.aoBrightnessYZPN, mixedBrightness); + + float aoMixedXYZPPN = (aoLightValue + renderBlocks.aoLightValueScratchYZPN + renderBlocks.aoLightValueScratchXZPN + renderBlocks.aoLightValueScratchXYZPPN) / 4.0F; + float aoMixedXYZPNN = (renderBlocks.aoLightValueScratchYZNN + aoLightValue + renderBlocks.aoLightValueScratchXYZPNN + renderBlocks.aoLightValueScratchXZPN) / 4.0F; + float aoMixedXYZNNN = (renderBlocks.aoLightValueScratchXYZNNN + renderBlocks.aoLightValueScratchXZNN + renderBlocks.aoLightValueScratchYZNN + aoLightValue) / 4.0F; + float aoMixedXYZNPN = (renderBlocks.aoLightValueScratchXZNN + renderBlocks.aoLightValueScratchXYZNPN + aoLightValue + renderBlocks.aoLightValueScratchYZPN) / 4.0F; + + aoTopLeft = (float) (aoMixedXYZNPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPN * renderBlocks.renderMaxY * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinX)); + aoBottomLeft = (float) (aoMixedXYZNPN * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPN * renderBlocks.renderMaxY * renderBlocks.renderMaxX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxX)); + aoBottomRight = (float) (aoMixedXYZNPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPN * renderBlocks.renderMinY * renderBlocks.renderMaxX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxX)); + aoTopRight = (float) (aoMixedXYZNPN * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPN * renderBlocks.renderMinY * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinX)); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPN, brightnessMixedXYZPPN, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMaxY * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinX)); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPN, brightnessMixedXYZPPN, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMaxY * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxX)); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPN, brightnessMixedXYZPPN, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxX), renderBlocks.renderMinY * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxX, (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxX)); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPN, brightnessMixedXYZPPN, brightnessMixedXYZPNN, brightnessMixedXYZNNN, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinX), renderBlocks.renderMinY * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinX, (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinX)); + + } + + return this; + } + + /** + * Sets up lighting for the South face and returns the {@link LightingHelper}. + * <p> + * This is a consolidated <code>method</code> that sets side shading + * with respect to the following attributes: + * <p> + * <ul> + * <li>{@link RenderBlocks#enableAO}</li> + * <li>{@link RenderBlocks#partialRenderBounds}</li> + * </ul> + * + * @param block the block {@link Block} + * @param x the x coordinate + * @param y the y coordinate + * @param z the z coordinate + * @return the {@link LightingHelper} + */ + public LightingHelper setupLightingZPos(Block block, int x, int y, int z) { + + if (renderBlocks.enableAO) { + + int zOffset = renderBlocks.renderMaxZ < 1.0F ? z : z + 1; + + int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y, zOffset); + brightness = mixedBrightness; + + float aoLightValue = renderBlocks.blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(); + + renderBlocks.aoBrightnessXZNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y, zOffset); + renderBlocks.aoBrightnessXZPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y, zOffset); + renderBlocks.aoBrightnessYZNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y - 1, zOffset); + renderBlocks.aoBrightnessYZPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y + 1, zOffset); + renderBlocks.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y - 1, zOffset); + renderBlocks.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x - 1, y + 1, zOffset); + renderBlocks.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y - 1, zOffset); + renderBlocks.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x + 1, y + 1, zOffset); + renderBlocks.aoLightValueScratchXZNP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); + renderBlocks.aoLightValueScratchXZPP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); + renderBlocks.aoLightValueScratchYZNP = getMixedAo(renderBlocks.blockAccess.getBlock(x, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); + renderBlocks.aoLightValueScratchYZPP = getMixedAo(renderBlocks.blockAccess.getBlock(x, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); + renderBlocks.aoLightValueScratchXYZNNP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y - 1, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); + renderBlocks.aoLightValueScratchXYZNPP = getMixedAo(renderBlocks.blockAccess.getBlock(x - 1, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x - 1, y + 1, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); + renderBlocks.aoLightValueScratchXYZPNP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y - 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y - 1, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); + renderBlocks.aoLightValueScratchXYZPPP = getMixedAo(renderBlocks.blockAccess.getBlock(x + 1, y + 1, z + 1).getAmbientOcclusionLightValue(), renderBlocks.blockAccess.getBlock(x + 1, y + 1, z).getAmbientOcclusionLightValue(), renderBlocks.renderMaxZ); + + int brightnessMixedXYZNPP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXZNP, renderBlocks.aoBrightnessXYZNPP, renderBlocks.aoBrightnessYZPP, mixedBrightness); + int brightnessMixedXYZNNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessXYZNNP, renderBlocks.aoBrightnessXZNP, renderBlocks.aoBrightnessYZNP, mixedBrightness); + int brightnessMixedXYZPNP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZNP, renderBlocks.aoBrightnessXYZPNP, renderBlocks.aoBrightnessXZPP, mixedBrightness); + int brightnessMixedXYZPPP = renderBlocks.getAoBrightness(renderBlocks.aoBrightnessYZPP, renderBlocks.aoBrightnessXZPP, renderBlocks.aoBrightnessXYZPPP, mixedBrightness); + + float aoMixedXYZNPP = (renderBlocks.aoLightValueScratchXZNP + renderBlocks.aoLightValueScratchXYZNPP + aoLightValue + renderBlocks.aoLightValueScratchYZPP) / 4.0F; + float aoMixedXYZNNP = (renderBlocks.aoLightValueScratchXYZNNP + renderBlocks.aoLightValueScratchXZNP + renderBlocks.aoLightValueScratchYZNP + aoLightValue) / 4.0F; + float aoMixedXYZPNP = (renderBlocks.aoLightValueScratchYZNP + aoLightValue + renderBlocks.aoLightValueScratchXYZPNP + renderBlocks.aoLightValueScratchXZPP) / 4.0F; + float aoMixedXYZPPP = (aoLightValue + renderBlocks.aoLightValueScratchYZPP + renderBlocks.aoLightValueScratchXZPP + renderBlocks.aoLightValueScratchXYZPPP) / 4.0F; + + aoTopLeft = (float) (aoMixedXYZNPP * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPP * renderBlocks.renderMaxY * renderBlocks.renderMinX + aoMixedXYZPNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinX + aoMixedXYZNNP * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinX)); + aoBottomLeft = (float) (aoMixedXYZNPP * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPPP * renderBlocks.renderMinY * renderBlocks.renderMinX + aoMixedXYZPNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinX + aoMixedXYZNNP * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinX)); + aoBottomRight = (float) (aoMixedXYZNPP * renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPP * renderBlocks.renderMinY * renderBlocks.renderMaxX + aoMixedXYZPNP * (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxX + aoMixedXYZNNP * (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxX)); + aoTopRight = (float) (aoMixedXYZNPP * renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPPP * renderBlocks.renderMaxY * renderBlocks.renderMaxX + aoMixedXYZPNP * (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxX + aoMixedXYZNNP * (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxX)); + + renderBlocks.brightnessTopLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPPP, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMinX), (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMinX), (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMinX, renderBlocks.renderMaxY * renderBlocks.renderMinX); + renderBlocks.brightnessBottomLeft = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPPP, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMinX), (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMinX), (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMinX, renderBlocks.renderMinY * renderBlocks.renderMinX); + renderBlocks.brightnessBottomRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPPP, renderBlocks.renderMinY * (1.0D - renderBlocks.renderMaxX), (1.0D - renderBlocks.renderMinY) * (1.0D - renderBlocks.renderMaxX), (1.0D - renderBlocks.renderMinY) * renderBlocks.renderMaxX, renderBlocks.renderMinY * renderBlocks.renderMaxX); + renderBlocks.brightnessTopRight = renderBlocks.mixAoBrightness(brightnessMixedXYZNPP, brightnessMixedXYZNNP, brightnessMixedXYZPNP, brightnessMixedXYZPPP, renderBlocks.renderMaxY * (1.0D - renderBlocks.renderMaxX), (1.0D - renderBlocks.renderMaxY) * (1.0D - renderBlocks.renderMaxX), (1.0D - renderBlocks.renderMaxY) * renderBlocks.renderMaxX, renderBlocks.renderMaxY * renderBlocks.renderMaxX); + } + + return this; + } +} diff --git a/src/main/java/com/github/technus/tectech/util/Util.java b/src/main/java/com/github/technus/tectech/util/Util.java new file mode 100644 index 0000000000..78522a2ae8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/util/Util.java @@ -0,0 +1,576 @@ +package com.github.technus.tectech.util; + +import com.github.technus.tectech.TecTech; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.ObfuscationReflectionHelper; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.GregTech_API; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.storage.IPlayerFileData; +import net.minecraft.world.storage.SaveHandler; +import net.minecraftforge.fluids.FluidStack; +import org.apache.commons.lang3.StringUtils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.lang.reflect.Field; +import java.nio.charset.StandardCharsets; +import java.util.*; + +/** + * Created by Tec on 21.03.2017. + */ +public final class Util { + private Util() { + } + + @SuppressWarnings("ComparatorMethodParameterNotUsed") + public static <K, V extends Comparable<? super V>> SortedSet<Map.Entry<K, V>> entriesSortedByValues(Map<K, V> map) { + SortedSet<Map.Entry<K, V>> sortedEntries = new TreeSet<>( + (e1, e2) -> { + int res = e1.getValue().compareTo(e2.getValue()); + return res != 0 ? res : 1; // Special fix to preserve items with equal values + } + ); + sortedEntries.addAll(map.entrySet()); + return sortedEntries; + } + + public static int bitStringToInt(String bits){ + if(bits==null){ + return 0; + } + if(bits.length() > 32){ + throw new NumberFormatException("Too long!"); + } + return Integer.parseInt(bits,2); + } + + public static int hexStringToInt(String hex){ + if(hex==null){ + return 0; + } + if(hex.length()>8){ + throw new NumberFormatException("Too long!"); + } + return Integer.parseInt(hex,16); + } + + public static double stringToDouble(String str){ + if(str==null){ + return 0; + } + return Double.parseDouble(str); + } + + public static double getValue(String in1) { + String str = in1.toLowerCase(); + double val; + try { + if (str.contains("b")) { + String[] split = str.split("b"); + val = Util.bitStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_", "")); + } else if (str.contains("x")) { + String[] split = str.split("x"); + val = Util.hexStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_", "")); + } else { + val = Util.stringToDouble(str); + } + return val; + } catch (Exception e) { + return 0; + } + } + + + public static String intBitsToString(int number) { + StringBuilder result = new StringBuilder(16); + + for (int i = 31; i >= 0; i--) { + int mask = 1 << i; + result.append((number & mask) != 0 ? "1" : "0"); + + if (i % 8 == 0) { + result.append(' '); + } + } + result.replace(result.length() - 1, result.length(), ""); + + return result.toString(); + } + + public static String intBitsToShortString(int number) { + StringBuilder result = new StringBuilder(35); + + 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(); + } + + public static String longBitsToShortString(long number) { + StringBuilder result = new StringBuilder(71); + + for (int i = 63; i >= 0; i--) { + long mask = 1L << i; + result.append((number & mask) != 0 ? ":" : "."); + + if (i % 8 == 0) { + result.append('|'); + } + } + result.replace(result.length() - 1, result.length(), ""); + + return result.toString(); + } + + public static float map(float x, float in_min, float in_max, float out_min, float out_max) { + return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; + } + + public static boolean isInputEqual(boolean aDecreaseStacksizeBySuccess, boolean aDontCheckStackSizes, FluidStack[] requiredFluidInputs, ItemStack[] requiredInputs, FluidStack[] givenFluidInputs, ItemStack... givenInputs) { + if (!GregTech_API.sPostloadFinished) { + return false; + } + if (requiredFluidInputs.length > 0 && givenFluidInputs == null) { + return false; + } + int amt; + for (FluidStack tFluid : requiredFluidInputs) { + if (tFluid != null) { + boolean temp = true; + amt = tFluid.amount; + for (FluidStack aFluid : givenFluidInputs) { + if (aFluid != null && aFluid.isFluidEqual(tFluid)) { + if (aDontCheckStackSizes) { + temp = false; + break; + } + amt -= aFluid.amount; + if (amt < 1) { + temp = false; + break; + } + } + } + if (temp) { + return false; + } + } + } + + if (requiredInputs.length > 0 && givenInputs == null) { + return false; + } + for (ItemStack tStack : requiredInputs) { + if (tStack != null) { + amt = tStack.stackSize; + boolean temp = true; + for (ItemStack aStack : givenInputs) { + if (GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) { + if (aDontCheckStackSizes) { + temp = false; + break; + } + amt -= aStack.stackSize; + if (amt < 1) { + temp = false; + break; + } + } + } + if (temp) { + return false; + } + } + } + + if (aDecreaseStacksizeBySuccess) { + if (givenFluidInputs != null) { + for (FluidStack tFluid : requiredFluidInputs) { + if (tFluid != null) { + amt = tFluid.amount; + for (FluidStack aFluid : givenFluidInputs) { + if (aFluid != null && aFluid.isFluidEqual(tFluid)) { + if (aDontCheckStackSizes) { + aFluid.amount -= amt; + break; + } + if (aFluid.amount < amt) { + amt -= aFluid.amount; + aFluid.amount = 0; + } else { + aFluid.amount -= amt; + break; + } + } + } + } + } + } + + if (givenInputs != null) { + for (ItemStack tStack : requiredInputs) { + if (tStack != null) { + amt = tStack.stackSize; + for (ItemStack aStack : givenInputs) { + if (GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) { + if (aDontCheckStackSizes) { + aStack.stackSize -= amt; + break; + } + if (aStack.stackSize < amt) { + amt -= aStack.stackSize; + aStack.stackSize = 0; + } else { + aStack.stackSize -= amt; + break; + } + } + } + } + } + } + } + + return true; + } + + public static String getUniqueIdentifier(ItemStack is) { + return GameRegistry.findUniqueIdentifierFor(is.getItem()).modId + ':' + is.getUnlocalizedName(); + } + + public static byte getTier(long l) { + byte b = -1; + + do { + ++b; + if (b >= CommonValues.V.length) { + return b; + } + } while (l > CommonValues.V[b]); + + return b; + } + + 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) { + 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; + } + + public static class ItemStack_NoNBT implements Comparable<ItemStack_NoNBT> { + public final Item mItem; + public final int mStackSize; + public final int mMetaData; + + public ItemStack_NoNBT(Item aItem, long aStackSize, long aMetaData) { + this.mItem = aItem; + this.mStackSize = (byte) ((int) aStackSize); + this.mMetaData = (short) ((int) aMetaData); + } + + public ItemStack_NoNBT(ItemStack aStack) { + if (aStack == null) { + mItem = null; + mStackSize = mMetaData = 0; + } else { + mItem = aStack.getItem(); + mStackSize = aStack.stackSize; + mMetaData = Items.feather.getDamage(aStack); + } + } + + @Override + public int compareTo(ItemStack_NoNBT o) { + if (mMetaData > o.mMetaData) return 1; + if (mMetaData < o.mMetaData) return -1; + if (mStackSize > o.mStackSize) return 1; + if (mStackSize < o.mStackSize) return -1; + if (mItem != null && o.mItem != null) + return mItem.getUnlocalizedName().compareTo(o.mItem.getUnlocalizedName()); + if (mItem == null && o.mItem == null) return 0; + if (mItem != null) return 1; + return -1; + } + + @Override + public boolean equals(Object aStack) { + return aStack == this || + (aStack instanceof ItemStack_NoNBT && + ((mItem == ((ItemStack_NoNBT) aStack).mItem) || ((ItemStack_NoNBT) aStack).mItem.getUnlocalizedName().equals(this.mItem.getUnlocalizedName())) && + ((ItemStack_NoNBT) aStack).mStackSize == this.mStackSize && + ((ItemStack_NoNBT) aStack).mMetaData == this.mMetaData); + } + + @Override + public int hashCode() { + return (mItem != null ? mItem.getUnlocalizedName().hashCode() : 0) ^ (mMetaData << 16) ^ (mStackSize << 24); + } + + @Override + public String toString() { + return Integer.toString(hashCode()) + ' ' + (mItem == null ? "null" : mItem.getUnlocalizedName()) + ' ' + mMetaData + ' ' + mStackSize; + } + } + + public static void setTier(int tier,Object me){ + try{ + Field field=GT_MetaTileEntity_TieredMachineBlock.class.getField("mTier"); + field.setAccessible(true); + field.set(me,(byte)tier); + }catch (Exception e){ + //e.printStackTrace(); + } + } + + public static StringBuilder receiveString(StringBuilder previousValue, int startIndex, int index, int value){ + int sizeReq=index-startIndex; + if(value==0){ + previousValue.setLength(Math.min(previousValue.length(),sizeReq)); + }else { + previousValue.setLength(Math.max(previousValue.length(),sizeReq)); + previousValue.setCharAt(sizeReq,(char)value); + } + return previousValue; + } + + @Deprecated + public static double receiveDouble(double previousValue, int startIndex, int index, int value){ + return Double.longBitsToDouble(receiveLong(Double.doubleToLongBits(previousValue),startIndex,index,value)); + } + + public static long receiveLong(long previousValue, int startIndex, int index, int value){ + value &=0xFFFF; + switch (index-startIndex){ + case 0: + previousValue&= 0xFFFF_FFFF_FFFF_0000L; + previousValue|=value; + break; + case 1: + previousValue&=0xFFFF_FFFF_0000_FFFFL; + previousValue|=value<<16; + break; + case 2: + previousValue&=0xFFFF_0000_FFFF_FFFFL; + previousValue|=(long)value<<32; + break; + case 3: + previousValue&=0x0000_FFFF_FFFF_FFFFL; + previousValue|=(long)value<<48; + break; + } + return previousValue; + } + + public static void sendString(StringBuilder string,Container container, ICrafting crafter,int startIndex){ + for (int i = 0; i < string.length(); i++) { + crafter.sendProgressBarUpdate(container,startIndex++,string.charAt(i)); + } + crafter.sendProgressBarUpdate(container,startIndex,0); + } + + public static void sendDouble(double value,Container container, ICrafting crafter,int startIndex){ + sendLong(Double.doubleToLongBits(value),container,crafter,startIndex); + } + + public static void sendLong(long value,Container container, ICrafting crafter,int startIndex){ + crafter.sendProgressBarUpdate(container, startIndex++, (int)(value & 0xFFFFL)); + crafter.sendProgressBarUpdate(container, startIndex++, (int)((value & 0xFFFF0000L)>>>16)); + crafter.sendProgressBarUpdate(container, startIndex++, (int)((value & 0xFFFF00000000L)>>>32)); + crafter.sendProgressBarUpdate(container, startIndex, (int)((value & 0xFFFF000000000000L)>>>48)); + } + + @Deprecated + public static float receiveFloat(float previousValue, int startIndex, int index, int value){ + return Float.intBitsToFloat(receiveInteger(Float.floatToIntBits(previousValue),startIndex,index,value)); + } + + public static int receiveInteger(int previousValue, int startIndex, int index, int value){ + value &=0xFFFF; + switch (index-startIndex){ + case 0: + previousValue&= 0xFFFF_0000; + previousValue|=value; + break; + case 1: + previousValue&=0x0000_FFFF; + previousValue|=value<<16; + break; + } + return previousValue; + } + + public static void sendFloat(float value,Container container, ICrafting crafter,int startIndex){ + sendInteger(Float.floatToIntBits(value),container,crafter,startIndex); + } + + public static void sendInteger(int value,Container container, ICrafting crafter,int startIndex){ + crafter.sendProgressBarUpdate(container, startIndex++, (int)(value & 0xFFFFL)); + crafter.sendProgressBarUpdate(container, startIndex, (value & 0xFFFF0000)>>>16); + } + + public static String doubleToString(double value){ + if(value==(long)value){ + return Long.toString((long)value); + } + return Double.toString(value); + } + + public static boolean checkChunkExist(World world, ChunkCoordIntPair chunk){ + int x=chunk.getCenterXPos(); + int z=chunk.getCenterZPosition(); + return world.checkChunksExist(x, 0, z, x, 0, z); + } + + public static NBTTagCompound getPlayerData(UUID uuid1,UUID uuid2,String extension) { + try { + if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + if (uuid1 != null && uuid2!=null) { + IPlayerFileData playerNBTManagerObj = MinecraftServer.getServer().worldServerForDimension(0).getSaveHandler().getSaveHandler(); + SaveHandler sh = (SaveHandler)playerNBTManagerObj; + File dir = ObfuscationReflectionHelper.getPrivateValue(SaveHandler.class, sh, new String[]{"playersDirectory", "field_75771_c"}); + String id1=uuid1.toString(); + NBTTagCompound tagCompound=read(new File(dir, id1 + "."+extension)); + if(tagCompound!=null){ + return tagCompound; + } + tagCompound=readBackup(new File(dir, id1 + "."+extension+"_bak")); + if(tagCompound!=null){ + return tagCompound; + } + String id2=uuid2.toString(); + tagCompound=read(new File(dir, id2 + "."+extension)); + if(tagCompound!=null){ + return tagCompound; + } + tagCompound=readBackup(new File(dir, id2 + "."+extension+"_bak")); + if(tagCompound!=null){ + return tagCompound; + } + } + } + } catch (Exception ignored) {} + return new NBTTagCompound(); + } + + public static void savePlayerFile(EntityPlayer player,String extension, NBTTagCompound data) { + try { + if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + if (player != null) { + IPlayerFileData playerNBTManagerObj = MinecraftServer.getServer().worldServerForDimension(0).getSaveHandler().getSaveHandler(); + SaveHandler sh = (SaveHandler)playerNBTManagerObj; + File dir = ObfuscationReflectionHelper.getPrivateValue(SaveHandler.class, sh, new String[]{"playersDirectory", "field_75771_c"}); + String id1=player.getUniqueID().toString(); + write(new File(dir, id1 + "."+extension),data); + write(new File(dir, id1 + "."+extension+"_bak"),data); + String id2=UUID.nameUUIDFromBytes(player.getCommandSenderName().getBytes(StandardCharsets.UTF_8)).toString(); + write(new File(dir, id2 + "."+extension),data); + write(new File(dir, id2 + "."+extension+"_bak"),data); + } + } + } catch (Exception ignored) {} + } + + private static NBTTagCompound read(File file){ + if (file != null && file.exists()) { + try(FileInputStream fileInputStream= new FileInputStream(file)) { + return CompressedStreamTools.readCompressed(fileInputStream); + } catch (Exception var9) { + TecTech.LOGGER.error("Cannot read NBT File: "+file.getAbsolutePath()); + } + } + return null; + } + + private static NBTTagCompound readBackup(File file){ + if (file != null && file.exists()) { + try(FileInputStream fileInputStream= new FileInputStream(file)) { + return CompressedStreamTools.readCompressed(fileInputStream); + } catch (Exception var9) { + TecTech.LOGGER.error("Cannot read NBT File: "+file.getAbsolutePath()); + return new NBTTagCompound(); + } + } + return null; + } + + private static void write(File file,NBTTagCompound tagCompound){ + if (file != null) { + if(tagCompound==null){ + if(file.exists()) file.delete(); + }else { + try(FileOutputStream fileOutputStream= new FileOutputStream(file)) { + CompressedStreamTools.writeCompressed(tagCompound,fileOutputStream); + } catch (Exception var9) { + TecTech.LOGGER.error("Cannot write NBT File: "+file.getAbsolutePath()); + } + } + } + } + + public static AxisAlignedBB fromChunkCoordIntPair(ChunkCoordIntPair chunkCoordIntPair){ + int x=chunkCoordIntPair.chunkXPos<<4; + int z=chunkCoordIntPair.chunkZPos<<4; + return AxisAlignedBB.getBoundingBox(x,-128,z,x+16,512,z+16); + } + + public static AxisAlignedBB fromChunk(Chunk chunk){ + int x=chunk.xPosition<<4; + int z=chunk.zPosition<<4; + return AxisAlignedBB.getBoundingBox(x,-128,z,x+16,512,z+16); + } + + public static String getConcated(String[] strings,String separator){ + StringBuilder stringBuilder = new StringBuilder(); + for (String string : strings) { + stringBuilder.append(string).append(separator); + } + int length = stringBuilder.length(); + if(length >=separator.length()){ + stringBuilder.setLength(length -separator.length()); + } + return stringBuilder.toString(); + } +} diff --git a/src/main/java/com/github/technus/tectech/XSTR.java b/src/main/java/com/github/technus/tectech/util/XSTR.java index f5ff457fe1..31c9b6a65c 100644 --- a/src/main/java/com/github/technus/tectech/XSTR.java +++ b/src/main/java/com/github/technus/tectech/util/XSTR.java @@ -1,4 +1,4 @@ -package com.github.technus.tectech; +package com.github.technus.tectech.util; /* A subclass of java.util.random that implements the Xorshift random number generator diff --git a/src/main/resources/META-INF/tectech_at.cfg b/src/main/resources/META-INF/tectech_at.cfg new file mode 100644 index 0000000000..fa76d13c1f --- /dev/null +++ b/src/main/resources/META-INF/tectech_at.cfg @@ -0,0 +1,17 @@ +public net.minecraft.block.Block field_149781_w #blockResistance +public net.minecraft.block.Block field_149782_v #blockHardness +protected net.minecraft.client.gui.FontRenderer field_111274_c #unicodePageLocations +protected net.minecraft.client.gui.FontRenderer field_78285_g #colorCode +protected net.minecraft.client.gui.FontRenderer field_78298_i #renderEngine +protected net.minecraft.client.gui.FontRenderer field_78293_l #unicodeFlag +protected net.minecraft.client.gui.FontRenderer field_78294_m #bidiFlag +protected net.minecraft.client.gui.FontRenderer field_78291_n #red +protected net.minecraft.client.gui.FontRenderer field_78292_o #blue +protected net.minecraft.client.gui.FontRenderer field_78306_p #green +protected net.minecraft.client.gui.FontRenderer field_78305_q #alpha +protected net.minecraft.client.gui.FontRenderer field_78304_r #textColor +protected net.minecraft.client.gui.FontRenderer field_78303_s #randomStyle +protected net.minecraft.client.gui.FontRenderer field_78302_t #boldStyle +protected net.minecraft.client.gui.FontRenderer field_78301_u #italicStyle +protected net.minecraft.client.gui.FontRenderer field_78300_v #underlineStyle +protected net.minecraft.client.gui.FontRenderer field_78299_w #strikethroughStyle diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png Binary files differnew file mode 100644 index 0000000000..010bc0888d --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png.mcmeta new file mode 100644 index 0000000000..5e86a7cd5f --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/ENDERFLUIDLINK_OVERLAY.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":8 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLAUTOMAINTENANCE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLAUTOMAINTENANCE.png Binary files differnew file mode 100644 index 0000000000..6b554f2031 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLAUTOMAINTENANCE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLAUTOMAINTENANCE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLAUTOMAINTENANCE.png.mcmeta new file mode 100644 index 0000000000..24f863c95e --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FULLAUTOMAINTENANCE.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":3 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/POWERPASSUPGRADE_OVERLAY.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/POWERPASSUPGRADE_OVERLAY.png Binary files differnew file mode 100644 index 0000000000..a623e9f1d5 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/POWERPASSUPGRADE_OVERLAY.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_6.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_6.png Binary files differnew file mode 100644 index 0000000000..833597130b --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_SIDES_6.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_6.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_6.png Binary files differnew file mode 100644 index 0000000000..de4ce136e7 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TM_TESLA_WINDING_PRIMARY_TOP_BOTTOM_6.png diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 483174e2f3..79c46b07a2 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -1,28 +1,103 @@ #Creative Tab Name itemGroup.TecTech=TecTech Interdimensional +itemGroup.EM=TecTech Elemental Matter + #Blocks -tile.quantumGlass.name=Quantum Glass tile.quantumStuff.name=Quantum Stuff + +tile.quantumGlass.name=Quantum Glass +tile.quantumGlass.desc.0=Dense yet transparent +tile.quantumGlass.desc.1=Glassy & Classy + +tile.reactorSim.name=Reactor Simulator +tile.reactorSim.desc.0=Fission Reaction Uncertainty Resolver 9001 +tile.reactorSim.desc.1=Explodes, but not as much... + #Items +item.em.programmer.name=AVR programmer +item.em.programmer.desc.0=Current PC +item.em.programmer.desc.1=Awoken +item.em.programmer.desc.2=Active +item.em.programmer.desc.3=Debug +item.em.programmer.desc.4=Delay + item.em.debugContainer.name=Debug EM Container +item.em.debugContainer.desc.0=Contains +item.em.debugContainer.desc.1=Container for elemental matter +item.em.debugContainer.desc.2=Right click on elemental hatches +item.em.debugContainer.desc.3=---Unexpected Termination--- + item.em.definitionContainer.name=EM Recipe Hint +item.em.definitionContainer.desc.0=Should Contain +item.em.definitionContainer.desc.1=Recipe Hint +item.em.definitionContainer.desc.2=---Unexpected Termination--- + item.em.definitionScanStorage.name=EM Scan Storage +item.em.definitionScanStorage.desc.0=Contains scan result +item.em.definitionScanStorage.desc.1=Use to read +item.em.definitionScanStorage.desc.2=Storage for matter scan data +item.em.definitionScanStorage.desc.3=---Unexpected Termination--- + item.em.constructable.name=Multiblock Machine Blueprint +item.em.constructable.desc.0=Triggers Constructable Interface +item.em.constructable.desc.1=Shows multiblock construction details, +item.em.constructable.desc.2=just Use on a multiblock controller. +item.em.constructable.desc.3=(Sneak Use in creative to build) +item.em.constructable.desc.4=Quantity affects tier/mode/type + +item.em.EuMeterGT.name=GT EU meter +item.em.EuMeterGT.desc.0=Measures basic EU related stuff +item.em.EuMeterGT.desc.1=Just right click on blocks. + item.em.frontRotate.name=Front Rotation Scrench +item.em.frontRotate.desc.0=Triggers Front Rotation Interface +item.em.frontRotate.desc.1=Rotates only the front panel, +item.em.frontRotate.desc.2=which allows structure rotation. + item.em.parametrizerMemoryCard.name=Parametrizer Memory Card -item.em.EuMeterGT.name=GT EU meter -item.tm.teslaCover.0.name=Tesla Coil Cover -item.tm.teslaCover.1.name=Tesla Coil Cover Rich Edition -item.tm.teslaStaff.name=Tesla Staff +item.em.parametrizerMemoryCard.desc.0=Stores Parameters +item.em.parametrizerMemoryCard.desc.1=Use on Parametrizer/Controller to configure it +item.em.parametrizerMemoryCard.desc.2=Use on Parametrizer to store parameters +item.em.parametrizerMemoryCard.desc.3=Sneak right click to lock/unlock item.tm.teslaCoilCapacitor.0.name=LV Tesla Capacitor item.tm.teslaCoilCapacitor.1.name=MV Tesla Capacitor item.tm.teslaCoilCapacitor.2.name=HV Tesla Capacitor item.tm.teslaCoilCapacitor.3.name=EV Tesla Capacitor item.tm.teslaCoilCapacitor.4.name=IV Tesla Capacitor +item.tm.teslaCoilCapacitor.5.name=LuV Tesla Capacitor +item.tm.teslaCoilCapacitor.6.name=ZPM Tesla Capacitor +item.tm.teslaCoilCapacitor.desc.0=Stores +item.tm.teslaCoilCapacitor.desc.1=EU in a tesla tower at +item.tm.teslaCoilCapacitor.desc.2=Yeet this broken item into some spicy water! +item.tm.teslaCoilCapacitor.desc.3=Insert into a Capacitor hatch of a Tesla Tower +item.tm.teslaCoilCapacitor.desc.4=Capacitors are the same thing as batteries, right? item.tm.itemTeslaComponent.0.name=Electrum Tesla Windings item.tm.itemTeslaComponent.1.name=Superconductive Tesla Windings +item.tm.itemTeslaComponent.desc=Tesla bois need these! + +item.tm.teslaCover.0.name=Tesla Coil Cover +item.tm.teslaCover.1.name=Tesla Coil Cover Rich Edition +item.tm.teslaCover.desc.0=Tesla-Enables Machines! +item.tm.teslaCover.desc.1=Tesla-Enables Machines! (BUT LOUDER!!) +item.tm.teslaCover.desc.2=Yeet this broken item into some spicy water! +item.tm.teslaCover.desc.3=Use on top of a machine to enable Tesla capabilities +item.tm.teslaCover.desc.4=Who the hell uses cables anyway? + +item.tm.teslaStaff.name=Tesla Staff +item.tm.teslaStaff.desc=Power of the gods, at the whim of a mortal! + +item.tm.enderfluidlinkcover.name=Ender Fluid Link Cover +item.tm.enderfluidlinkcover.desc.0=Ender-Fluid-Enables Machines! +item.tm.enderfluidlinkcover.desc.1=Use on any side of a fluid tank to link it to the Ender +item.tm.enderfluidlinkcover.desc.2=Ender Tanks so are laggy -Bot from the Chads of NH + +item.tm.powerpassupgradecover.name=Power Pass Upgrade Cover +item.tm.powerpassupgradecover.desc.0=Add power pass functionality to TecTech Multiblocks +item.tm.powerpassupgradecover.desc.1=Active transformer in a can?? +item.tm.powerpassupgradecover.desc.2=Chain them up like Christmas lights! + #Death Messages death.attack.microwaving=%1$s was dehydrated by radiation. death.attack.microwaving.player=%1$s was dehydrated by radiation while fighting %2$s. @@ -30,6 +105,7 @@ death.attack.elementalPollution=%1$s was vaping from the wrong hole. death.attack.elementalPollution.player=%1$s was vaping from the wrong hole while fighting %2$s. death.attack.subspace=%1$s was N-th dimensionally displeased. death.attack.subspace.player=%1$s N-th dimensionally displeased while fighting %2$s. + #Machine hulls gt.blockmachines.hull.tier.10.name=UEV Machine Hull gt.blockmachines.hull.tier.11.name=UIV Machine Hull @@ -37,6 +113,7 @@ gt.blockmachines.hull.tier.12.name=UMV Machine Hull gt.blockmachines.hull.tier.13.name=UXV Machine Hull gt.blockmachines.hull.tier.14.name=OPV Machine Hull gt.blockmachines.hull.tier.15.name=MAX Machine Hull + #Transformers gt.blockmachines.wetransformer.tier.00.name=Ultra Low Voltage Power Transformer gt.blockmachines.wetransformer.tier.00.desc=LV -> ULV (Use Soft Mallet to invert) @@ -94,6 +171,7 @@ gt.blockmachines.transformer.ha.tier.13.name=Extended Mega Ultimate Hi-Amp Trans gt.blockmachines.transformer.ha.tier.13.desc=OPV -> UXV (Use Soft Mallet to invert) gt.blockmachines.transformer.ha.tier.14.name=Overpowered Hi-Amp Transformer gt.blockmachines.transformer.ha.tier.14.desc=MAX -> OPV (Use Soft Mallet to invert) + #Hatches tt.base.emhatch.desc.0=Max stacks amount: tt.base.emhatch.desc.1=Stack capacity: @@ -145,69 +223,69 @@ gt.blockmachines.hatch.energymulti64.tier.13.name=UXV 64A Energy Hatch gt.blockmachines.hatch.energymulti.desc.0=Multiple Ampere Energy Injector for Multiblocks gt.blockmachines.hatch.energymulti.desc.1=Amperes In -gt.blockmachines.hatch.energytunnel1.tier.05.name=IV 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.05.name=IV 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.05.name=IV 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.05.name=IV 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.05.name=IV 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.05.name=IV 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.05.name=IV 1048576/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.06.name=LuV 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.06.name=LuV 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.06.name=LuV 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.06.name=LuV 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.06.name=LuV 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.06.name=LuV 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.06.name=LuV 1048576/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.07.name=ZPM 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.07.name=ZPM 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.07.name=ZPM 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.07.name=ZPM 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.07.name=ZPM 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.07.name=ZPM 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.07.name=ZPM 1048576/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.08.name=UV 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.08.name=UV 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.08.name=UV 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.08.name=UV 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.08.name=UV 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.08.name=UV 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.08.name=UV 1048576/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.09.name=UHV 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.09.name=UHV 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.09.name=UHV 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.09.name=UHV 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.09.name=UHV 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.09.name=UHV 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.09.name=UHV 1048576/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.10.name=UEV 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.10.name=UEV 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.10.name=UEV 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.10.name=UEV 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.10.name=UEV 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.10.name=UEV 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.10.name=UEV 1048576/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.11.name=UIV 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.11.name=UIV 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.11.name=UIV 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.11.name=UIV 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.11.name=UIV 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.11.name=UIV 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.11.name=UIV 1048576/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.12.name=UMV 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.12.name=UMV 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.12.name=UMV 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.12.name=UMV 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.12.name=UMV 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.12.name=UMV 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.12.name=UMV 1048576/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel1.tier.13.name=UXV 256/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel2.tier.13.name=UXV 1024/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel3.tier.13.name=UXV 4096/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel4.tier.13.name=UXV 16384/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel5.tier.13.name=UXV 65536/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel6.tier.13.name=UXV 262144/t Laser Target Hatch -gt.blockmachines.hatch.energytunnel7.tier.13.name=UXV 1048576/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.05.name=IV 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.05.name=IV 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.05.name=IV 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.05.name=IV 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.05.name=IV 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.05.name=IV 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.05.name=IV 1048576A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.06.name=LuV 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.06.name=LuV 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.06.name=LuV 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.06.name=LuV 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.06.name=LuV 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.06.name=LuV 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.06.name=LuV 1048576A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.07.name=ZPM 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.07.name=ZPM 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.07.name=ZPM 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.07.name=ZPM 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.07.name=ZPM 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.07.name=ZPM 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.07.name=ZPM 1048576A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.08.name=UV 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.08.name=UV 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.08.name=UV 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.08.name=UV 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.08.name=UV 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.08.name=UV 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.08.name=UV 1048576A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.09.name=UHV 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.09.name=UHV 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.09.name=UHV 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.09.name=UHV 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.09.name=UHV 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.09.name=UHV 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.09.name=UHV 1048576A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.10.name=UEV 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.10.name=UEV 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.10.name=UEV 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.10.name=UEV 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.10.name=UEV 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.10.name=UEV 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.10.name=UEV 1048576A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.11.name=UIV 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.11.name=UIV 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.11.name=UIV 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.11.name=UIV 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.11.name=UIV 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.11.name=UIV 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.11.name=UIV 1048576A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.12.name=UMV 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.12.name=UMV 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.12.name=UMV 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.12.name=UMV 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.12.name=UMV 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.12.name=UMV 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.12.name=UMV 1048576A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel1.tier.13.name=UXV 256A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel2.tier.13.name=UXV 1024A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel3.tier.13.name=UXV 4096A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel4.tier.13.name=UXV 16384A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel5.tier.13.name=UXV 65536A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel6.tier.13.name=UXV 262144A/t Laser Target Hatch +gt.blockmachines.hatch.energytunnel7.tier.13.name=UXV 1048576A/t Laser Target Hatch gt.blockmachines.hatch.energytunnel.tier.14.name=Legendary Laser Target Hatch gt.blockmachines.hatch.energytunnel.desc.0=Energy injecting terminal for Multiblocks gt.blockmachines.hatch.energytunnel.desc.1=Throughput @@ -236,76 +314,76 @@ gt.blockmachines.hatch.dynamomulti64.tier.11.name=UIV 64A Dynamo Hatch gt.blockmachines.hatch.dynamomulti04.tier.12.name=UMV 4A Dynamo Hatch gt.blockmachines.hatch.dynamomulti16.tier.12.name=UMV 16A Dynamo Hatch gt.blockmachines.hatch.dynamomulti64.tier.12.name=UMV 64A Dynamo Hatch -gt.blockmachines.hatch.dynamomulti04.tier.13.name=IV 4A Dynamo Hatch -gt.blockmachines.hatch.dynamomulti16.tier.13.name=IV 16A Dynamo Hatch -gt.blockmachines.hatch.dynamomulti64.tier.13.name=IV 64A Dynamo Hatch +gt.blockmachines.hatch.dynamomulti04.tier.13.name=UXV 4A Dynamo Hatch +gt.blockmachines.hatch.dynamomulti16.tier.13.name=UXV 16A Dynamo Hatch +gt.blockmachines.hatch.dynamomulti64.tier.13.name=UXV 64A Dynamo Hatch gt.blockmachines.hatch.dynamomulti.desc.0=Multiple Ampere Energy Extractor for Multiblocks gt.blockmachines.hatch.dynamomulti.desc.1=Amperes Out -gt.blockmachines.hatch.dynamotunnel1.tier.05=IV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.05=IV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.05=IV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.05=IV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.05=IV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.05=IV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.05=IV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.06=LuV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.06=LuV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.06=LuV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.06=LuV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.06=LuV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.06=LuV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.06=LuV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.07=ZPM 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.07=ZPM 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.07=ZPM 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.07=ZPM 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.07=ZPM 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.07=ZPM 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.07=ZPM 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.08=UV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.08=UV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.08=UV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.08=UV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.08=UV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.08=UV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.08=UV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.09=UHV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.09=UHV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.09=UHV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.09=UHV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.09=UHV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.09=UHV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.09=UHV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.10=UEV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.10=UEV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.10=UEV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.10=UEV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.10=UEV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.10=UEV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.10=UEV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.11=UIV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.11=UIV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.11=UIV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.11=UIV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.11=UIV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.11=UIV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.11=UIV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.12=UMV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.12=UMV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.12=UMV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.12=UMV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.12=UMV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.12=UMV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.12=UMV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.13=UXV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.13=UXV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.13=UXV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.13=UXV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.13=UXV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.13=UXV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.13=UXV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel.tier.14=Legendary Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.05.name=IV 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.05.name=IV 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.05.name=IV 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.05.name=IV 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.05.name=IV 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.05.name=IV 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.05.name=IV 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.06.name=LuV 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.06.name=LuV 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.06.name=LuV 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.06.name=LuV 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.06.name=LuV 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.06.name=LuV 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.06.name=LuV 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.07.name=ZPM 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.07.name=ZPM 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.07.name=ZPM 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.07.name=ZPM 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.07.name=ZPM 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.07.name=ZPM 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.07.name=ZPM 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.08.name=UV 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.08.name=UV 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.08.name=UV 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.08.name=UV 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.08.name=UV 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.08.name=UV 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.08.name=UV 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.09.name=UHV 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.09.name=UHV 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.09.name=UHV 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.09.name=UHV 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.09.name=UHV 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.09.name=UHV 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.09.name=UHV 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.10.name=UEV 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.10.name=UEV 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.10.name=UEV 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.10.name=UEV 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.10.name=UEV 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.10.name=UEV 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.10.name=UEV 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.11.name=UIV 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.11.name=UIV 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.11.name=UIV 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.11.name=UIV 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.11.name=UIV 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.11.name=UIV 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.11.name=UIV 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.12.name=UMV 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.12.name=UMV 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.12.name=UMV 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.12.name=UMV 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.12.name=UMV 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.12.name=UMV 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.12.name=UMV 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel1.tier.13.name=UXV 256A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel2.tier.13.name=UXV 1024A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel3.tier.13.name=UXV 4096A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel4.tier.13.name=UXV 16384A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel5.tier.13.name=UXV 65536A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel6.tier.13.name=UXV 262144A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel7.tier.13.name=UXV 1048576A/t Laser Source Hatch +gt.blockmachines.hatch.dynamotunnel.tier.14.name=Legendary Laser Source Hatch gt.blockmachines.hatch.dynamotunnel.desc.0=Energy extracting terminal for Multiblocks gt.blockmachines.hatch.dynamotunnel.desc.1=Throughput @@ -325,12 +403,153 @@ gt.blockmachines.emout.tier.12.name=UMV Elemental Output Hatch gt.blockmachines.emout.tier.13.name=UXV Elemental Output Hatch gt.blockmachines.emout.desc=Elemental Output for Multiblocks +#TODO change tier.05 to tier.04 +gt.blockmachines.hatch.param.tier.05.name=Parametrizer +gt.blockmachines.hatch.param.tier.07.name=Parametrizer X +gt.blockmachines.hatch.param.tier.10.name=Parametrizer tXt +gt.blockmachines.hatch.param.desc.0=For parametrization of Multiblocks +gt.blockmachines.hatch.param.desc.1=E=mine*craft + +gt.blockmachines.hatch.certain.tier.07.name=Uncertainty Resolver +gt.blockmachines.hatch.certain.tier.10.name=Uncertainty Resolver X +gt.blockmachines.hatch.certain.desc.0=Feeling certain, or not? +gt.blockmachines.hatch.certain.desc.1=Schrödinger equation in a box + +gt.blockmachines.hatch.datain.tier.07.name=Optical Slave Connector +gt.blockmachines.hatch.datain.desc.0=Quantum Data Input for Multiblocks +gt.blockmachines.hatch.datain.desc.1=High speed fibre optics connector. +gt.blockmachines.hatch.datain.desc.2=Must be painted to work + +gt.blockmachines.hatch.dataout.tier.07.name=Optical Master Connector +gt.blockmachines.hatch.dataout.desc.0=Quantum Data Output for Multiblocks +gt.blockmachines.hatch.dataout.desc.1=High speed fibre optics connector. +gt.blockmachines.hatch.dataout.desc.2=Must be painted to work + +gt.blockmachines.hatch.datainass.tier.07.name=Assembly line Slave Connector +gt.blockmachines.hatch.datainass.desc.0=ItemStack Data Input for Multiblocks +gt.blockmachines.hatch.datainass.desc.1=High speed fibre optics connector. +gt.blockmachines.hatch.datainass.desc.2=Must be painted to work + +gt.blockmachines.hatch.dataoutass.tier.07.name=Data Bank Master Connector +gt.blockmachines.hatch.dataoutass.desc.0=ItemStack Data Output for Multiblocks +gt.blockmachines.hatch.dataoutass.desc.1=High speed fibre optics connector. +gt.blockmachines.hatch.dataoutass.desc.2=Must be painted to work + +gt.blockmachines.hatch.rack.tier.08.name=Computer Rack +gt.blockmachines.hatch.rack.desc.0=4 Slot Rack +gt.blockmachines.hatch.rack.desc.1=Holds Computer Components +gt.blockmachines.hatch.holder.tier.09.name=Object Holder +gt.blockmachines.hatch.holder.desc.0=For Research Station +gt.blockmachines.hatch.holder.desc.1=Advanced Holding Mechanism! +gt.blockmachines.hatch.capacitor.tier.03.name=Capacitor Hatch +gt.blockmachines.hatch.capacitor.desc.0=For Tesla Tower +gt.blockmachines.hatch.capacitor.desc.1=Stores 'nergy! (for a while) + +#Casings +gt.blockcasingsNH.10.name=UEV Machine Casing +gt.blockcasingsNH.11.name=UIV Machine Casing +gt.blockcasingsNH.12.name=UMV Machine Casing +gt.blockcasingsNH.13.name=UXV Machine Casing +gt.blockcasingsNH.14.name=OPV Machine Casing +gt.blockcasingsNH.15.name=MAX Machine Casing + +gt.blockhintTT.desc.0=Helps while building +gt.blockhintTT.0.name=Hint 1 dot +gt.blockhintTT.1.name=Hint 2 dot +gt.blockhintTT.2.name=Hint 3 dot +gt.blockhintTT.3.name=Hint 4 dot +gt.blockhintTT.4.name=Hint 5 dot +gt.blockhintTT.5.name=Hint 6 dot +gt.blockhintTT.6.name=Hint 7 dot +gt.blockhintTT.7.name=Hint 8 dot +gt.blockhintTT.8.name=Hint 9 dot +gt.blockhintTT.9.name=Hint 10 dot +gt.blockhintTT.10.name=Hint 11 dot +gt.blockhintTT.11.name=Hint 12 dot +gt.blockhintTT.desc.1=Placeholder for a certain group. +gt.blockhintTT.12.name=Hint general +gt.blockhintTT.desc.2=General placeholder. +gt.blockhintTT.13.name=Hint air +gt.blockhintTT.desc.3=Make sure it contains Air material. +gt.blockhintTT.14.name=Hint no air +gt.blockhintTT.desc.4=Make sure it does not contain Air material. +gt.blockhintTT.15.name=Hint error +gt.blockhintTT.desc.5=ERROR, what did u expect? + +gt.blockcasingsTT.0.name=High Power Casing +gt.blockcasingsTT.0.desc.0=Well suited for high power applications. +gt.blockcasingsTT.0.desc.1=The power levels are rising! +gt.blockcasingsTT.1.name=Computer Casing +gt.blockcasingsTT.1.desc.0=Nice and clean casing. +gt.blockcasingsTT.1.desc.1=Dust can break it!? +gt.3blockcasingsTT.2.name=Computer Heat Vent +gt.blockcasingsTT.2.desc.0=Air vent with a filter. +gt.blockcasingsTT.2.desc.1=Perfectly muffled sound! +gt.blockcasingsTT.3.name=Advanced Computer Casing +gt.blockcasingsTT.3.desc.0=Contains high bandwidth bus +gt.blockcasingsTT.3.desc.1=couple thousand qubits wide. +gt.blockcasingsTT.4.name=Molecular Casing +gt.blockcasingsTT.4.desc.0=Stops elemental things. +gt.blockcasingsTT.4.desc.1=Radiation and emotions too... +gt.blockcasingsTT.5.name=Advanced Molecular Casing +gt.blockcasingsTT.5.desc.0=Cooling and stabilization. +gt.blockcasingsTT.5.desc.1=A comfortable machine bed. +gt.blockcasingsTT.6.name=Containment Field Generator +gt.blockcasingsTT.6.desc.0=Creates a field that... +gt.blockcasingsTT.6.desc.1=can stop even force carriers. +gt.blockcasingsTT.7.name=Molecular Coil +gt.blockcasingsTT.7.desc.0=Well it does things too... +gt.blockcasingsTT.7.desc.1=[Use this coil!] +gt.blockcasingsTT.8.name=Hollow Casing +gt.blockcasingsTT.8.desc.0=Reinforced accelerator tunnel. +gt.blockcasingsTT.8.desc.1=Most advanced pipe ever. +gt.blockcasingsTT.9.name=Spacetime Altering Casing +gt.blockcasingsTT.9.desc.0=c is no longer the limit. +gt.blockcasingsTT.9.desc.1=Wibbly wobbly timey wimey stuff. +gt.blockcasingsTT.10.name=Teleportation Casing +gt.blockcasingsTT.10.desc.0=Remote connection. +gt.blockcasingsTT.10.desc.1=Better touch with a stick. +gt.blockcasingsTT.11.name=Dimensional Bridge Generator +gt.blockcasingsTT.11.desc.0=Interdimensional Operations. +gt.blockcasingsTT.11.desc.1=Around the universe and other places too. +gt.blockcasingsTT.12.name=Ultimate Molecular Casing +gt.blockcasingsTT.12.desc.0=Ultimate in every way. +gt.blockcasingsTT.12.desc.1=I don't know what it can't do. +gt.blockcasingsTT.13.name=Ultimate Advanced Molecular Casing +gt.blockcasingsTT.13.desc.0=More Ultimate in every way. +gt.blockcasingsTT.13.desc.1=I don't know what I am doing! +gt.blockcasingsTT.14.name=Ultimate Containment Field Generator +gt.blockcasingsTT.14.desc.0=Black Hole... +gt.blockcasingsTT.14.desc.1=Meh... +gt.blockcasingsTT.15.name=Debug Sides +gt.blockcasingsTT.15.desc.0=Lazy man way of determining sides. +gt.blockcasingsTT.15.desc.1=0, 1, 2, 3, 4, 5, 6?! + +gt.blockcasingsBA0.0.name=Redstone Alloy Primary Tesla Windings +gt.blockcasingsBA0.1.name=MV Superconductor Primary Tesla Windings +gt.blockcasingsBA0.2.name=HV Superconductor Primary Tesla Windings +gt.blockcasingsBA0.3.name=EV Superconductor Primary Tesla Windings +gt.blockcasingsBA0.4.name=IV Superconductor Primary Tesla Windings +gt.blockcasingsBA0.5.name=LuV Superconductor Primary Tesla Windings +gt.blockcasingsBA0.9.name=ZPM Superconductor Primary Tesla Windings +gt.blockcasingsBA0.0.desc.0=Handles up to +gt.blockcasingsBA0.0.desc.1=What one man calls God, another calls the laws of physics. +gt.blockcasingsBA0.6.name=Tesla Base Casing +gt.blockcasingsBA0.6.desc.0=The base of a wondrous contraption +gt.blockcasingsBA0.6.desc.1=it's alive, IT'S ALIVE! +gt.blockcasingsBA0.7.name=Tesla Toroid Casing +gt.blockcasingsBA0.7.desc.0=Made out of the finest tin foil! +gt.blockcasingsBA0.7.desc.1=Faraday suits might come later +gt.blockcasingsBA0.8.name=Tesla Secondary Windings +gt.blockcasingsBA0.8.desc.0=Picks up power from a primary coil +gt.blockcasingsBA0.8.desc.1=Who wouldn't want a 32k epoxy multi? + #Multiblocks gt.blockmachines.multimachine.em.transformer.name=Active Transformer gt.blockmachines.multimachine.em.transformer.hint=1 - Energy IO Hatches or High Power Casing gt.blockmachines.multimachine.em.transformer.desc.0=Power substation gt.blockmachines.multimachine.em.transformer.desc.1=All the transformation! -gt.blockmachines.multimachine.em.transformer.desc.2=Only 0.78125% power loss, HAYO! +gt.blockmachines.multimachine.em.transformer.desc.2=Only 0.004% power loss, HAYO! gt.blockmachines.multimachine.tm.microwave.name=Microwave Grinder gt.blockmachines.multimachine.tm.microwave.hint.0=1 - Classic Hatches or Clean Stainless Steel Casing @@ -433,7 +652,7 @@ gt.blockmachines.multimachine.em.scanner.hint.3=4 - Elemental Overflow Hatches o gt.blockmachines.multimachine.em.scanner.desc.0=What is existing here? gt.blockmachines.multimachine.em.scanner.desc.1=I HAVE NO IDEA (yet)! -gt.blockmachines.multimachine.em.research.name=Research station +gt.blockmachines.multimachine.em.research.name=Research Station gt.blockmachines.multimachine.em.research.hint.0=1 - Classic/Data Hatches or Computer casing gt.blockmachines.multimachine.em.research.hint.1=2 - Holder Hatch gt.blockmachines.multimachine.em.research.desc.0=Philosophers didn't even... @@ -502,25 +721,95 @@ gt.blockmachines.multimachine.em.blackholegenerator.hint.1=2 - Elemental Hatches gt.blockmachines.multimachine.em.blackholegenerator.desc.0=Singularity based power generation. gt.blockmachines.multimachine.em.blackholegenerator.desc.1=Super unstable!!! +#Pipes +gt.blockmachines.pipe.elementalmatter.name=Quantum "Tunnel" +gt.blockmachines.pipe.elementalmatter.desc.0=Quantum tunneling device. +gt.blockmachines.pipe.elementalmatter.desc.1=Not a portal!!! +gt.blockmachines.pipe.elementalmatter.desc.2=Must be painted to work +gt.blockmachines.pipe.elementalmatter.desc.3=Do not cross, split or turn + +gt.blockmachines.pipe.energystream.name=Laser Vacuum Pipe +gt.blockmachines.pipe.energystream.desc.0=Laser tunneling device. +gt.blockmachines.pipe.energystream.desc.1=Bright Vacuum!!! +gt.blockmachines.pipe.energystream.desc.2=Must be painted to work +gt.blockmachines.pipe.energystream.desc.3=Do not split or turn + +gt.blockmachines.pipe.datastream.name=Optical Fiber Cable +gt.blockmachines.pipe.datastream.desc.0=Advanced data transmission +gt.blockmachines.pipe.datastream.desc.1=Don't stare at the beam! +gt.blockmachines.pipe.datastream.desc.2=Must be painted to work +gt.blockmachines.pipe.datastream.desc.3=Do not cross or split + +#Single blocks +gt.blockmachines.machine.tt.ownerdetector.name=Owner detector +gt.blockmachines.machine.tt.ownerdetector.desc.0=Screwdrive to change mode +gt.blockmachines.machine.tt.ownerdetector.desc.1=Looks for his pa +gt.blockmachines.machine.tt.ownerdetector.desc.2=Emits signal when happy + +gt.blockmachines.machine.tt.datareader.name=Data Reader +gt.blockmachines.machine.tt.datareader.desc.0=Reads Data Sticks and Orbs +gt.blockmachines.machine.tt.datareader.desc.1=Power it up and +gt.blockmachines.machine.tt.datareader.desc.2=Put the data storage in + +gt.blockmachines.machine.tt.buck.05.name=Insane Buck Converter +gt.blockmachines.machine.tt.buck.06.name=Ludicrous Buck Converter +gt.blockmachines.machine.tt.buck.07.name=ZPM Voltage Buck Converter +gt.blockmachines.machine.tt.buck.08.name=Ultimate Power Buck Converter +gt.blockmachines.machine.tt.buck.09.name=Highly Ultimate Buck Converter +gt.blockmachines.machine.tt.buck.10.name=Extremely Ultimate Buck Converter +gt.blockmachines.machine.tt.buck.11.name=Insanely Ultimate Buck Converter +gt.blockmachines.machine.tt.buck.12.name=Mega Ultimate Buck Converter +gt.blockmachines.machine.tt.buck.13.name=Extended Mega Ultimate Buck Converter +gt.blockmachines.machine.tt.buck.desc.0=Electronic voltage regulator +gt.blockmachines.machine.tt.buck.desc.1=Adjustable step down transformer +gt.blockmachines.machine.tt.buck.desc.2=Switching power supply... + +gt.blockmachines.machine.tt.tesla.01.name=Basic Tesla Transceiver +gt.blockmachines.machine.tt.tesla.02.name=Advanced Tesla Transceiver +gt.blockmachines.machine.tt.tesla.03.name=Epyc Tesla Transceiver +gt.blockmachines.machine.tt.tesla.04.name=Ultimate Power Tesla Transceiver +gt.blockmachines.machine.tt.tesla.05.name=Insane Tesla Transceiver +gt.blockmachines.machine.tt.tesla.desc.0=Your Tesla I/O machine of choice +gt.blockmachines.machine.tt.tesla.desc.1=Lightning stoves for the rich + +#Debug blocks +gt.blockmachines.debug.tt.pollutor.name=Debug Pollution Generator +gt.blockmachines.debug.tt.pollutor.desc.0=Shit genny broke! +gt.blockmachines.debug.tt.pollutor.desc.1=Infinite Producer/Consumer +gt.blockmachines.debug.tt.pollutor.desc.2=Since i wanted one? +gt.blockmachines.debug.tt.data.name=Debug Data Hatch +gt.blockmachines.debug.tt.data.desc.0=Quantum Data Output +gt.blockmachines.debug.tt.data.desc.1=High speed fibre optics connector. +gt.blockmachines.debug.tt.data.desc.2=Must be painted to work +gt.blockmachines.debug.tt.maintenance.name=Auto-Taping Maintenance Hatch +gt.blockmachines.debug.tt.maintenance.desc.0=For automatically maintaining Multiblocks +gt.blockmachines.debug.tt.maintenance.desc.1=Does fix everything but itself. +gt.blockmachines.debug.tt.maintenance.desc.2=Fixing is for plebs! +gt.blockmachines.debug.tt.genny.name=Debug Power Generator +gt.blockmachines.debug.tt.genny.desc.0=Power from nothing +gt.blockmachines.debug.tt.genny.desc.1=Infinite Producer/Consumer +gt.blockmachines.debug.tt.genny.desc.2=Since i wanted one... +gt.blockmachines.debug.tt.writer.name=Debug Structure Writer +gt.blockmachines.debug.tt.writer.desc.0=Scans Blocks Around +gt.blockmachines.debug.tt.writer.desc.1=Prints Multiblock NonTE structure check code +gt.blockmachines.debug.tt.writer.desc.2=ABC axises aligned to machine front + #Keywords and phrases #Example: ID:3 tt.keyword.ID=ID #Example: 32EU at 1A tt.keyword.at=at -#These are Thaumcraft aspects -tt.keyword.Air=Air -tt.keyword.Earth=Earth -tt.keyword.Fire=Fire -tt.keyword.Water=Water -tt.keyword.Order=Order -tt.keyword.Entropy=Entropy -tt.keyword.Primal=Primal -tt.keyword.Aspect=Aspect +#EM scan result tt.keyword.CLASS=CLASS tt.keyword.NAME=NAME tt.keyword.CHARGE=CHARGE tt.keyword.COLORLESS=COLORLESS tt.keyword.MASS=MASS +tt.keyphrase.LIFE_TIME=LIFE TIME +tt.keyphrase.CARRIES_COLOR=CARRIES COLOR +tt.keyphrase.Hint_Details=Hint Details +tt.keyphrase.At_current_energy_level=At current energy level +#debug boom tt.keyword.BOOM=BOOM! tt.keyword.Destination=Destination tt.keyword.Weight=Weight @@ -534,11 +823,15 @@ tt.keyword.Efficiency=Efficiency tt.keyword.PowerPass=PowerPass #Button that vents EM tt.keyword.SafeVoid=SafeVoid +tt.keyword.Parametrizer=Parametrizer +tt.keyword.Value=Value +tt.keyword.Input=Input +tt.keyword.input=input +tt.keyword.output=output +tt.keyword.Status=Status +tt.keyword.Content=Content +tt.keyword.PacketHistory=PacketHistory -tt.keyphrase.LIFE_TIME=LIFE TIME -tt.keyphrase.CARRIES_COLOR=CARRIES COLOR -tt.keyphrase.Hint_Details=Hint Details -tt.keyphrase.At_current_energy_level=At current energy level #Used when 0 Elemental Matter Stacks tt.keyphrase.No_Stacks=No Stacks tt.keyphrase.Contains_EM=Contains EM @@ -552,7 +845,369 @@ tt.keyphrase.Tier_Rating=Tier Rating tt.keyphrase.Amp_Rating=Amp Rating tt.keyphrase.Computation_Available=Computation Available tt.keyphrase.Computation_Remaining=Computation Remaining +tt.keyphrase.Content_Stack_Count=Content: Stack Count +tt.keyphrase.Base_computation=Base computation +tt.keyphrase.After_overclocking=After overclocking +tt.keyphrase.Heat_Accumulated=Heat Accumulated +tt.keyphrase.Running_interdimensional_scan=Running interdimensional scan +tt.keyphrase.Running_local_dimension_scan=Running local dimension scan +tt.keyphrase.Overdrive_disengaged=Overdrive disengaged +tt.keyphrase.Overdrive_engaged=Overdrive engaged +tt.keyphrase.Hysteresis_high_set_to=Hysteresis high set to +tt.keyphrase.Hysteresis_low_set_to=Hysteresis low set to +tt.keyphrase.Tesla_radius_set_to=Tesla radius set to +tt.keyphrase.Sending_power=Sending power +tt.keyphrase.Receiving_power=Receiving power +tt.keyphrase.Stored_energy=Stored energy +tt.keyphrase.Stored_EU=Stored EU +tt.keyphrase.Average_IO=Average I/O +tt.keyphrase.Average_IO_(max)=Voltage I/O (max) +tt.keyphrase.Average_IO_max=Voltage I/O max +tt.keyphrase.Amperage_IO_(max)=Amperage I/O (max) +tt.keyphrase.Side_capabilities=Side capabilities #OpenTurrets compatibility tile.turretHeadEM.name=Elemental Matter Turret -tile.turretBaseEM.name=Elemental Turret Base
\ No newline at end of file +tile.turretBaseEM.name=Elemental Turret Base + +tt.keyword.mol=mol +tt.keyword.itemMols=items +tt.keyword.mbMols=mb +#EM types +tt.keyword.Primitive=Primitive +tt.keyword.Element=Element +tt.keyword.Atom=Atom +tt.keyword.Isotope=Isotope +tt.keyword.Boson=Boson +tt.keyword.Fermion=Fermion +tt.keyword.GaugeBoson=Gauge boson +tt.keyword.Meson=Meson +tt.keyword.Baryon=Baryon +tt.keyword.Tetraquark=Tetraquark +tt.keyword.Pentaquark=Pentaquark +tt.keyword.Hexaquark=Hexaquark +tt.keyword.Hadron=Hadron +tt.keyword.Neutrino=Neutrino +tt.keyword.Quark=Quark +tt.keyword.ScalarBoson=Scalar boson +#em definitions +tt.keyword.PrimitiveNBTERROR=NBT ERROR +tt.keyword.PrimitiveNULLPOINTER=NULL POINTER +tt.keyword.PrimitiveSpace=Space +tt.keyword.PrimitivePresence=Presence +tt.keyword.PrimitiveMass=Mass +tt.keyword.PrimitiveDarkMass=DarkMass +tt.keyword.PrimitiveEnergy=Energy +tt.keyword.PrimitiveDarkEnergy=DarkEnergy +tt.keyword.PrimitiveMagic=Magic +tt.keyword.PrimitiveAntimagic=Antimagic +tt.keyword.Gluon=Gluon +tt.keyword.Photon=Photon +tt.keyword.Weak0=Weak +tt.keyword.WeakPlus=Weak+ +tt.keyword.WeakMinus=Weak- +tt.keyword.Proton=Proton +tt.keyword.AntiProton=Antiproton +tt.keyword.Neutron=Neutron +tt.keyword.AntiNeutron=Antineutron +tt.keyword.Lepton=Lepton +tt.keyword.Electron=Electron +tt.keyword.Muon=Muon +tt.keyword.Tauon=Tauon +tt.keyword.Positron=Positron +tt.keyword.Antimuon=Antimuon +tt.keyword.Antitauon=Antitauon +tt.keyword.ElectronNeutrino=Electron neutrino +tt.keyword.MuonNeutrino=Muon neutrino +tt.keyword.TauonNeutrino=Tauon neutrino +tt.keyword.PositronNeutrino=Positron neutrino +tt.keyword.AntimuonNeutrino=Antimuon neutrino +tt.keyword.AntitauonNeutrino=Antitauon neutrino +tt.keyword.QuarkUp=Up +tt.keyword.QuarkCharm=Charm +tt.keyword.QuarkTop=Top +tt.keyword.QuarkDown=Down +tt.keyword.QuarkStrange=Strange +tt.keyword.QuarkBottom=Bottom +tt.keyword.QuarkAntiUp=Antiup +tt.keyword.QuarkAntiCharm=Anticharm +tt.keyword.QuarkAntiTop=Antitop +tt.keyword.QuarkAntiDown=Antidown +tt.keyword.QuarkAntiStrange=Antistrange +tt.keyword.QuarkAntiBottom=Antibottom +tt.keyword.Higgs=Higgs +#These are Thaumcraft aspects +tt.keyword.Air=Air +tt.keyword.Earth=Earth +tt.keyword.Fire=Fire +tt.keyword.Water=Water +tt.keyword.Order=Order +tt.keyword.Entropy=Entropy +tt.keyword.Chaos=Chaos + +tt.keyword.Primal=Primal +tt.keyword.Aspect=Aspect + +tt.element.Neutronium=Neutronium +tt.element.Hydrogen=Hydrogen +tt.element.Helium=Helium +tt.element.Lithium=Lithium +tt.element.Beryllium=Beryllium +tt.element.Boron=Boron +tt.element.Carbon=Carbon +tt.element.Nitrogen=Nitrogen +tt.element.Oxygen=Oxygen +tt.element.Fluorine=Fluorine +tt.element.Neon=Neon +tt.element.Sodium=Sodium +tt.element.Magnesium=Magnesium +tt.element.Aluminium=Aluminium +tt.element.Silicon=Silicon +tt.element.Phosphorus=Phosphorus +tt.element.Sulfur=Sulfur +tt.element.Chlorine=Chlorine +tt.element.Argon=Argon +tt.element.Potassium=Potassium +tt.element.Calcium=Calcium +tt.element.Scandium=Scandium +tt.element.Titanium=Titanium +tt.element.Vanadium=Vanadium +tt.element.Chromium=Chromium +tt.element.Manganese=Manganese +tt.element.Iron=Iron +tt.element.Cobalt=Cobalt +tt.element.Nickel=Nickel +tt.element.Copper=Copper +tt.element.Zinc=Zinc +tt.element.Gallium=Gallium +tt.element.Germanium=Germanium +tt.element.Arsenic=Arsenic +tt.element.Selenium=Selenium +tt.element.Bromine=Bromine +tt.element.Krypton=Krypton +tt.element.Rubidium=Rubidium +tt.element.Strontium=Strontium +tt.element.Yttrium=Yttrium +tt.element.Zirconium=Zirconium +tt.element.Niobium=Niobium +tt.element.Molybdenum=Molybdenum +tt.element.Technetium=Technetium +tt.element.Ruthenium=Ruthenium +tt.element.Rhodium=Rhodium +tt.element.Palladium=Palladium +tt.element.Silver=Silver +tt.element.Cadmium=Cadmium +tt.element.Indium=Indium +tt.element.Tin=Tin +tt.element.Antimony=Antimony +tt.element.Tellurium=Tellurium +tt.element.Iodine=Iodine +tt.element.Xenon=Xenon +tt.element.Caesium=Caesium +tt.element.Barium=Barium +tt.element.Lanthanum=Lanthanum +tt.element.Cerium=Cerium +tt.element.Praseodymium=Praseodymium +tt.element.Neodymium=Neodymium +tt.element.Promethium=Promethium +tt.element.Samarium=Samarium +tt.element.Europium=Europium +tt.element.Gadolinium=Gadolinium +tt.element.Terbium=Terbium +tt.element.Dysprosium=Dysprosium +tt.element.Holmium=Holmium +tt.element.Erbium=Erbium +tt.element.Thulium=Thulium +tt.element.Ytterbium=Ytterbium +tt.element.Lutetium=Lutetium +tt.element.Hafnium=Hafnium +tt.element.Tantalum=Tantalum +tt.element.Tungsten=Tungsten +tt.element.Rhenium=Rhenium +tt.element.Osmium=Osmium +tt.element.Iridium=Iridium +tt.element.Platinum=Platinum +tt.element.Gold=Gold +tt.element.Mercury=Mercury +tt.element.Thallium=Thallium +tt.element.Lead=Lead +tt.element.Bismuth=Bismuth +tt.element.Polonium=Polonium +tt.element.Astatine=Astatine +tt.element.Radon=Radon +tt.element.Francium=Francium +tt.element.Radium=Radium +tt.element.Actinium=Actinium +tt.element.Thorium=Thorium +tt.element.Protactinium=Protactinium +tt.element.Uranium=Uranium +tt.element.Neptunium=Neptunium +tt.element.Plutonium=Plutonium +tt.element.Americium=Americium +tt.element.Curium=Curium +tt.element.Berkelium=Berkelium +tt.element.Californium=Californium +tt.element.Einsteinium=Einsteinium +tt.element.Fermium=Fermium +tt.element.Mendelevium=Mendelevium +tt.element.Nobelium=Nobelium +tt.element.Lawrencium=Lawrencium +tt.element.Rutherfordium=Rutherfordium +tt.element.Dubnium=Dubnium +tt.element.Seaborgium=Seaborgium +tt.element.Bohrium=Bohrium +tt.element.Hassium=Hassium +tt.element.Meitnerium=Meitnerium +tt.element.Darmstadtium=Darmstadtium +tt.element.Roentgenium=Roentgenium +tt.element.Copernicium=Copernicium +tt.element.Nihonium=Nihonium +tt.element.Flerovium=Flerovium +tt.element.Moscovium=Moscovium +tt.element.Livermorium=Livermorium +tt.element.Tennessine=Tennessine +tt.element.Oganesson=Oganesson + +tt.element.AntiNeutronium=Antineutronium +tt.element.AntiHydrogen=Antihydrogen +tt.element.AntiHelium=Antihelium +tt.element.AntiLithium=Antilithium +tt.element.AntiBeryllium=Antiberyllium +tt.element.AntiBoron=Antiboron +tt.element.AntiCarbon=Anticarbon +tt.element.AntiNitrogen=Antinitrogen +tt.element.AntiOxygen=Antioxygen +tt.element.AntiFluorine=Antifluorine +tt.element.AntiNeon=Antineon +tt.element.AntiSodium=Antisodium +tt.element.AntiMagnesium=Antimagnesium +tt.element.AntiAluminium=Antialuminium +tt.element.AntiSilicon=Antisilicon +tt.element.AntiPhosphorus=Antiphosphorus +tt.element.AntiSulfur=Antisulfur +tt.element.AntiChlorine=Antichlorine +tt.element.AntiArgon=Antiargon +tt.element.AntiPotassium=Antipotassium +tt.element.AntiCalcium=Anticalcium +tt.element.AntiScandium=Antiscandium +tt.element.AntiTitanium=Antititanium +tt.element.AntiVanadium=Antivanadium +tt.element.AntiChromium=Antichromium +tt.element.AntiManganese=Antimanganese +tt.element.AntiIron=Antiiron +tt.element.AntiCobalt=Anticobalt +tt.element.AntiNickel=Antinickel +tt.element.AntiCopper=Anticopper +tt.element.AntiZinc=Antizinc +tt.element.AntiGallium=Antigallium +tt.element.AntiGermanium=Antigermanium +tt.element.AntiArsenic=Antiarsenic +tt.element.AntiSelenium=Antiselenium +tt.element.AntiBromine=Antibromine +tt.element.AntiKrypton=Antikrypton +tt.element.AntiRubidium=Antirubidium +tt.element.AntiStrontium=Antistrontium +tt.element.AntiYttrium=Antiyttrium +tt.element.AntiZirconium=Antizirconium +tt.element.AntiNiobium=Antiniobium +tt.element.AntiMolybdenum=Antimolybdenum +tt.element.AntiTechnetium=Antitechnetium +tt.element.AntiRuthenium=Antiruthenium +tt.element.AntiRhodium=Antirhodium +tt.element.AntiPalladium=Antipalladium +tt.element.AntiSilver=Antisilver +tt.element.AntiCadmium=Anticadmium +tt.element.AntiIndium=Antiindium +tt.element.AntiTin=Antitin +tt.element.AntiAntimony=Antiantimony +tt.element.AntiTellurium=Antitellurium +tt.element.AntiIodine=Antiiodine +tt.element.AntiXenon=Antixenon +tt.element.AntiCaesium=Anticaesium +tt.element.AntiBarium=Antibarium +tt.element.AntiLanthanum=Antilanthanum +tt.element.AntiCerium=Anticerium +tt.element.AntiPraseodymium=Antipraseodymium +tt.element.AntiNeodymium=Antineodymium +tt.element.AntiPromethium=Antipromethium +tt.element.AntiSamarium=Antisamarium +tt.element.AntiEuropium=Antieuropium +tt.element.AntiGadolinium=Antigadolinium +tt.element.AntiTerbium=Antiterbium +tt.element.AntiDysprosium=Antidysprosium +tt.element.AntiHolmium=Antiholmium +tt.element.AntiErbium=Antierbium +tt.element.AntiThulium=Antithulium +tt.element.AntiYtterbium=Antiytterbium +tt.element.AntiLutetium=Antilutetium +tt.element.AntiHafnium=Antihafnium +tt.element.AntiTantalum=Antitantalum +tt.element.AntiTungsten=Antitungsten +tt.element.AntiRhenium=Antirhenium +tt.element.AntiOsmium=Antiosmium +tt.element.AntiIridium=Antiiridium +tt.element.AntiPlatinum=Antiplatinum +tt.element.AntiGold=Antigold +tt.element.AntiMercury=Antimercury +tt.element.AntiThallium=Antithallium +tt.element.AntiLead=Antilead +tt.element.AntiBismuth=Antibismuth +tt.element.AntiPolonium=Antipolonium +tt.element.AntiAstatine=Antiastatine +tt.element.AntiRadon=Antiradon +tt.element.AntiFrancium=Antifrancium +tt.element.AntiRadium=Antiradium +tt.element.AntiActinium=Antiactinium +tt.element.AntiThorium=Antithorium +tt.element.AntiProtactinium=Antiprotactinium +tt.element.AntiUranium=Antiuranium +tt.element.AntiNeptunium=Antineptunium +tt.element.AntiPlutonium=Antiplutonium +tt.element.AntiAmericium=Antiamericium +tt.element.AntiCurium=Anticurium +tt.element.AntiBerkelium=Antiberkelium +tt.element.AntiCalifornium=Antibalifornium +tt.element.AntiEinsteinium=Antieinsteinium +tt.element.AntiFermium=Antifermium +tt.element.AntiMendelevium=Antimendelevium +tt.element.AntiNobelium=Antinobelium +tt.element.AntiLawrencium=Antilawrencium +tt.element.AntiRutherfordium=Antirutherfordium +tt.element.AntiDubnium=Antidubnium +tt.element.AntiSeaborgium=Antiseaborgium +tt.element.AntiBohrium=Antibohrium +tt.element.AntiHassium=Antihassium +tt.element.AntiMeitnerium=Antimeitnerium +tt.element.AntiDarmstadtium=Antidarmstadtium +tt.element.AntiRoentgenium=Antiroentgenium +tt.element.AntiCopernicium=Anticopernicium +tt.element.AntiNihonium=Antinihonium +tt.element.AntiFlerovium=Antiflerovium +tt.element.AntiMoscovium=Antimoscovium +tt.element.AntiLivermorium=Antilivermorium +tt.element.AntiTennessine=Antitennessine +tt.element.AntiOganesson=Antioganesson + +tt.IUPAC.n=nil +tt.IUPAC.u=un +tt.IUPAC.b=bi +tt.IUPAC.t=tri +tt.IUPAC.q=quad +tt.IUPAC.p=pent +tt.IUPAC.h=hex +tt.IUPAC.s=sept +tt.IUPAC.o=oct +tt.IUPAC.e=enn +tt.IUPAC.N=Nil +tt.IUPAC.U=Un +tt.IUPAC.B=Bi +tt.IUPAC.T=Tri +tt.IUPAC.Q=Quad +tt.IUPAC.P=Pent +tt.IUPAC.H=Hex +tt.IUPAC.S=Sept +tt.IUPAC.O=Oct +tt.IUPAC.E=Enn +tt.IUPAC.ium=ium +tt.IUPAC.Anti=Anti +tt.keyword.Weird=*
\ No newline at end of file diff --git a/src/main/resources/assets/tectech/lang/zh_CN.lang b/src/main/resources/assets/tectech/lang/zh_CN.lang index 5359f04e9b..2d594ffb8e 100644 --- a/src/main/resources/assets/tectech/lang/zh_CN.lang +++ b/src/main/resources/assets/tectech/lang/zh_CN.lang @@ -1,13 +1,877 @@ -itemGroup.TecTech=泛次元钛克科技黑洞研究所 -tile.quantumGlass.name=量子玻璃 +#Creative Tab Name +itemGroup.TecTech=泛银河泰克科技有限公司 + +#Blocks tile.quantumStuff.name=量子物质 -item.em.debugContainer.name=调试用 EM容器 -item.em.definitionContainer.name=EM配方指引 -item.em.debugBuilder.name=多方块机器蓝图 -item.em.parametrizerMemoryCard.name=参量机记忆卡 -death.attack.microwaving=%1$s 被辐射脱水 -death.attack.microwaving.player=%1$s 在与 %2$s 战斗中被辐射脱水 +tile.quantumGlass.name=量子玻璃 +tile.quantumGlass.desc.0=致密但透明 +tile.quantumGlass.desc.1=玻璃&优雅(Glassy & Classy) + +tile.reactorSim.name=反应堆模拟器 +tile.reactorSim.desc.0=裂变反应不确定度解析器9001 +tile.reactorSim.desc.1=爆炸,但没有那么多... + +#Items +item.em.programmer.name=AVR编程器 +item.em.programmer.desc.0=当前PC +item.em.programmer.desc.1=唤醒 +item.em.programmer.desc.2=激活 +item.em.programmer.desc.3=Debug +item.em.programmer.desc.4=延迟 + +item.em.debugContainer.name=调试元物质容器 +item.em.debugContainer.desc.0=包含 +item.em.debugContainer.desc.1=元物质的容器 +item.em.debugContainer.desc.2=右键元物质仓室 +item.em.debugContainer.desc.3=---意外终止--- + +item.em.definitionContainer.name=元物质配方提示 +item.em.definitionContainer.desc.0=需要包含 +item.em.definitionContainer.desc.1=配方提示 +item.em.definitionContainer.desc.2=---意外终止--- + +item.em.definitionScanStorage.name=元物质容器扫描 +item.em.definitionScanStorage.desc.0=包含扫描结果 +item.em.definitionScanStorage.desc.1=用于阅读 +item.em.definitionScanStorage.desc.2=存储元物质扫描数据 +item.em.definitionScanStorage.desc.3=---意外终止--- + +item.em.constructable.name=多方块机器蓝图 +item.em.constructable.desc.0=触发可构造界面 +item.em.constructable.desc.1=显示多方块结构细节, +item.em.constructable.desc.2=只可在多方块控制器上使用. +item.em.constructable.desc.3=(在创造模式下潜行右键可直接构造) +item.em.constructable.desc.4=堆叠数量影响等级/模式/类型 + +item.em.EuMeterGT.name=GT EU电表 +item.em.EuMeterGT.desc.0=测量EU相关的基本内容 +item.em.EuMeterGT.desc.1=只需右键方块. + +item.em.frontRotate.name=正面旋转扳手 +item.em.frontRotate.desc.0=触发正面旋转界面 +item.em.frontRotate.desc.1=可以旋转多方块控制器, +item.em.frontRotate.desc.2=从而使整个结构可以旋转. + +item.em.parametrizerMemoryCard.name=数据化储存卡 +item.em.parametrizerMemoryCard.desc.0=存储参数 +item.em.parametrizerMemoryCard.desc.1=在参数仪/控制器上使用以对其进行配置 +item.em.parametrizerMemoryCard.desc.2=在参数仪上使用以存储参数 +item.em.parametrizerMemoryCard.desc.3=潜行右键以锁定/解锁 + +item.tm.teslaCoilCapacitor.0.name=LV特斯拉电容 +item.tm.teslaCoilCapacitor.1.name=MV特斯拉电容 +item.tm.teslaCoilCapacitor.2.name=HV特斯拉电容 +item.tm.teslaCoilCapacitor.3.name=EV特斯拉电容 +item.tm.teslaCoilCapacitor.4.name=IV特斯拉电容 +item.tm.teslaCoilCapacitor.5.name=LuV特斯拉电容 +item.tm.teslaCoilCapacitor.6.name=ZPM特斯拉电容 +item.tm.teslaCoilCapacitor.desc.0=存储量: +item.tm.teslaCoilCapacitor.desc.1=EU;充能速度: +item.tm.teslaCoilCapacitor.desc.2=把这个破碎的东西浸入某种辛辣的水中! +item.tm.teslaCoilCapacitor.desc.3=插入特斯拉电塔的电容仓中 +item.tm.teslaCoilCapacitor.desc.4=电容器就像电池一样,对吗? + +item.tm.itemTeslaComponent.0.name=琥珀金特斯拉绕组 +item.tm.itemTeslaComponent.1.name=超导特斯拉绕组 +item.tm.itemTeslaComponent.desc=特斯拉需要这些! + +item.tm.teslaCover.0.name=特斯拉线圈帽 +item.tm.teslaCover.1.name=加强特斯拉线圈帽 +item.tm.teslaCover.desc.0=特斯拉使能机器! +item.tm.teslaCover.desc.1=特斯拉使能机器! (但非常吵!!) +item.tm.teslaCover.desc.2=把这个破碎的东西浸入某种辛辣的水中! +item.tm.teslaCover.desc.3=对机器顶部右键使用,启用机器的特斯拉供电功能 +item.tm.teslaCover.desc.4=到底谁在用电缆? + +item.tm.teslaStaff.name=特斯拉权杖 +item.tm.teslaStaff.desc=狂妄之人窃取了众神的权柄! + +item.tm.enderfluidlinkcover.name=末影流体覆盖板 +item.tm.enderfluidlinkcover.desc.0=在机器间无线传输流体! +item.tm.enderfluidlinkcover.desc.1=可贴在储罐/机器/管道的任意面以将其与末影相连 +item.tm.enderfluidlinkcover.desc.2=末影储罐太逊了! -来自Chads-of-NH的Bot + +item.tm.powerpassupgradecover.name=导能升级覆盖板 +item.tm.powerpassupgradecover.desc.0=为TecTech多方块机器添加导能功能 +item.tm.powerpassupgradecover.desc.1=罐中的有源变压器?? +item.tm.powerpassupgradecover.desc.2=将它们像圣诞彩灯一样串起来! + +#Death Messages +death.attack.microwaving=%1$s被辐射脱水。 +death.attack.microwaving.player=%1$s在与%2$s的战斗中被辐射脱水。 +death.attack.elementalPollution=%1$s在错误的空洞中被汽化。 +death.attack.elementalPollution.player=%1$s在与%2$s的战斗中被错误的空洞汽化。 +death.attack.subspace=%1$s受到了降维打击。 +death.attack.subspace.player=%1$s在与%2$s的战斗中受到了降维打击。 + +#Machine hulls +gt.blockmachines.hull.tier.10.name=UEV机器外壳 +gt.blockmachines.hull.tier.11.name=UIV机器外壳 +gt.blockmachines.hull.tier.12.name=UMV机器外壳 +gt.blockmachines.hull.tier.13.name=UXV机器外壳 +gt.blockmachines.hull.tier.14.name=OPV机器外壳 +gt.blockmachines.hull.tier.15.name=MAX机器外壳 + +#Transformers +gt.blockmachines.wetransformer.tier.00.name=ULV高能变压器 +gt.blockmachines.wetransformer.tier.00.desc=LV -> ULV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.01.name=LV高能变压器 +gt.blockmachines.wetransformer.tier.01.desc=MV -> LV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.02.name=MV高能变压器 +gt.blockmachines.wetransformer.tier.02.desc=HV -> MV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.03.name=HV高能变压器 +gt.blockmachines.wetransformer.tier.03.desc=EV -> HV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.04.name=EV高能变压器 +gt.blockmachines.wetransformer.tier.04.desc=IV -> EV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.05.name=IV高能变压器 +gt.blockmachines.wetransformer.tier.05.desc=LuV -> IV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.06.name=LuV高能变压器 +gt.blockmachines.wetransformer.tier.06.desc=ZPM -> LuV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.07.name=ZPM高能变压器 +gt.blockmachines.wetransformer.tier.07.desc=UV -> ZPM (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.08.name=UV高能变压器 +gt.blockmachines.wetransformer.tier.08.desc=UHV -> UV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.09.name=UHV高能变压器 +gt.blockmachines.wetransformer.tier.09.desc=UEV -> UHV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.10.name=UEV高能变压器 +gt.blockmachines.wetransformer.tier.10.desc=UIV -> UEV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.11.name=UIV高能变压器 +gt.blockmachines.wetransformer.tier.11.desc=UMV -> UIV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.12.name=UMV高能变压器 +gt.blockmachines.wetransformer.tier.12.desc=UXV -> UMV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.13.name=UXV高能变压器 +gt.blockmachines.wetransformer.tier.13.desc=OPV -> UXV (用软锤右击以反转) +gt.blockmachines.wetransformer.tier.14.name=OpV高能变压器 +gt.blockmachines.wetransformer.tier.14.desc=MAX -> OPV (用软锤右击以反转) + +gt.blockmachines.tt.transformer.tier.09.name=UHV变压器 +gt.blockmachines.tt.transformer.tier.09.desc=UEV -> UHV (用软锤右击以反转) +gt.blockmachines.tt.transformer.tier.10.name=UEV变压器 +gt.blockmachines.tt.transformer.tier.10.desc=UIV -> UEV (用软锤右击以反转) +gt.blockmachines.tt.transformer.tier.11.name=UIV变压器 +gt.blockmachines.tt.transformer.tier.11.desc=UMV -> UIV (用软锤右击以反转) +gt.blockmachines.tt.transformer.tier.12.name=UMV变压器 +gt.blockmachines.tt.transformer.tier.12.desc=UXV -> UMV (用软锤右击以反转) +gt.blockmachines.tt.transformer.tier.13.name=UXV变压器 +gt.blockmachines.tt.transformer.tier.13.desc=OPV -> UXV (用软锤右击以反转) +gt.blockmachines.tt.transformer.tier.14.name=OpV变压器 +gt.blockmachines.tt.transformer.tier.14.desc=MAX -> OPV (用软锤右击以反转) + +gt.blockmachines.transformer.ha.tier.09.name=UHV高电流变压器 +gt.blockmachines.transformer.ha.tier.09.desc=UEV -> UHV (用软锤右击以反转 +gt.blockmachines.transformer.ha.tier.10.name=UEV高电流变压器 +gt.blockmachines.transformer.ha.tier.10.desc=UIV -> UEV (用软锤右击以反转) +gt.blockmachines.transformer.ha.tier.11.name=UIV高电流变压器 +gt.blockmachines.transformer.ha.tier.11.desc=UMV -> UIV (用软锤右击以反转) +gt.blockmachines.transformer.ha.tier.12.name=UMV高电流变压器 +gt.blockmachines.transformer.ha.tier.12.desc=UXV -> UMV (用软锤右击以反转) +gt.blockmachines.transformer.ha.tier.13.name=UXV高电流变压器 +gt.blockmachines.transformer.ha.tier.13.desc=OPV -> UXV (用软锤右击以反转) +gt.blockmachines.transformer.ha.tier.14.name=OpV高电流变压器 +gt.blockmachines.transformer.ha.tier.14.desc=MAX -> OPV (用软锤右击以反转) + +#Hatches +tt.base.emhatch.desc.0=最大元物质组数: +tt.base.emhatch.desc.1=最大容量: +tt.base.emhatch.desc.2=在这个仓室不处于多方块结构 +tt.base.emhatch.desc.3=中时,在后侧、上侧或下侧放 +tt.base.emhatch.desc.4=置溢流仓以提供过载保护。 +tt.base.emhatch.desc.5=使用量子隧道时,传输距离 +tt.base.emhatch.desc.6=可以沿直线拓展至最多15格 +tt.base.emhatch.desc.7=启用前必须涂色 + +gt.blockmachines.hatch.emmuffler.tier.08.name=UV溢流仓 +gt.blockmachines.hatch.emmuffler.tier.09.name=UHV溢流仓 +gt.blockmachines.hatch.emmuffler.tier.10.name=UEV溢流仓 +gt.blockmachines.hatch.emmuffler.tier.11.name=UIV溢流仓 +gt.blockmachines.hatch.emmuffler.tier.12.name=UMV溢流仓 +gt.blockmachines.hatch.emmuffler.tier.13.name=UXV溢流仓 +gt.blockmachines.hatch.emmuffler.desc.0=清理过剩的元物质 +gt.blockmachines.hatch.emmuffler.desc.1=物质缓存 +gt.blockmachines.hatch.emmuffler.desc.2=清理速度 +gt.blockmachines.hatch.emmuffler.desc.3=请勿阻塞输出! + +gt.blockmachines.hatch.energymulti04.tier.05.name=4安IV能源仓 +gt.blockmachines.hatch.energymulti16.tier.05.name=16安IV能源仓 +gt.blockmachines.hatch.energymulti64.tier.05.name=64安IV能源仓 +gt.blockmachines.hatch.energymulti04.tier.06.name=4安LuV能源仓 +gt.blockmachines.hatch.energymulti16.tier.06.name=16安LuV能源仓 +gt.blockmachines.hatch.energymulti64.tier.06.name=64安LuV能源仓 +gt.blockmachines.hatch.energymulti04.tier.07.name=4安ZPM能源仓 +gt.blockmachines.hatch.energymulti16.tier.07.name=16安ZPM能源仓 +gt.blockmachines.hatch.energymulti64.tier.07.name=64安ZPM能源仓 +gt.blockmachines.hatch.energymulti04.tier.08.name=4安UV能源仓 +gt.blockmachines.hatch.energymulti16.tier.08.name=16安UV能源仓 +gt.blockmachines.hatch.energymulti64.tier.08.name=64安UV能源仓 +gt.blockmachines.hatch.energymulti04.tier.09.name=4安UHV能源仓 +gt.blockmachines.hatch.energymulti16.tier.09.name=16安UHV能源仓 +gt.blockmachines.hatch.energymulti64.tier.09.name=64安UHV能源仓 +gt.blockmachines.hatch.energymulti04.tier.10.name=4安UEV能源仓 +gt.blockmachines.hatch.energymulti16.tier.10.name=16安UEV能源仓 +gt.blockmachines.hatch.energymulti64.tier.10.name=64安UEV能源仓 +gt.blockmachines.hatch.energymulti04.tier.11.name=4安UIV能源仓 +gt.blockmachines.hatch.energymulti16.tier.11.name=16安UIV能源仓 +gt.blockmachines.hatch.energymulti64.tier.11.name=64安UIV能源仓 +gt.blockmachines.hatch.energymulti04.tier.12.name=4安UMV能源仓 +gt.blockmachines.hatch.energymulti16.tier.12.name=16安UMV能源仓 +gt.blockmachines.hatch.energymulti64.tier.12.name=64安UMV能源仓 +gt.blockmachines.hatch.energymulti04.tier.13.name=4安UXV能源仓 +gt.blockmachines.hatch.energymulti16.tier.13.name=16安UXV能源仓 +gt.blockmachines.hatch.energymulti64.tier.13.name=64安UXV能源仓 +gt.blockmachines.hatch.energymulti.desc.0=为多方块机器以高电流输入能源 +gt.blockmachines.hatch.energymulti.desc.1=输入电流 + +gt.blockmachines.hatch.energytunnel1.tier.05.name=IV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.05.name=IV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.05.name=IV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.05.name=IV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.05.name=IV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.05.name=IV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.05.name=IV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.06.name=LuV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.06.name=LuV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.06.name=LuV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.06.name=LuV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.06.name=LuV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.06.name=LuV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.06.name=LuV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.07.name=ZPM 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.07.name=ZPM 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.07.name=ZPM 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.07.name=ZPM 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.07.name=ZPM 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.07.name=ZPM 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.07.name=ZPM 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.08.name=UV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.08.name=UV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.08.name=UV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.08.name=UV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.08.name=UV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.08.name=UV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.08.name=UV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.09.name=UHV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.09.name=UHV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.09.name=UHV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.09.name=UHV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.09.name=UHV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.09.name=UHV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.09.name=UHV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.10.name=UEV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.10.name=UEV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.10.name=UEV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.10.name=UEV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.10.name=UEV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.10.name=UEV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.10.name=UEV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.11.name=UIV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.11.name=UIV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.11.name=UIV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.11.name=UIV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.11.name=UIV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.11.name=UIV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.11.name=UIV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.12.name=UMV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.12.name=UMV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.12.name=UMV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.12.name=UMV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.12.name=UMV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.12.name=UMV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.12.name=UMV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel1.tier.13.name=UXV 256A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel2.tier.13.name=UXV 1024A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel3.tier.13.name=UXV 4096A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel4.tier.13.name=UXV 16384A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel5.tier.13.name=UXV 65536A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel6.tier.13.name=UXV 262144A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel7.tier.13.name=UXV 1048576A/t 激光靶仓 +gt.blockmachines.hatch.energytunnel.tier.14.name=传奇激光靶仓 +gt.blockmachines.hatch.energytunnel.desc.0=多方块机器的能量输入端 +gt.blockmachines.hatch.energytunnel.desc.1=通量 + +gt.blockmachines.hatch.dynamomulti04.tier.05.name=4安IV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.05.name=16安IV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.05.name=64安IV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.06.name=4安LuV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.06.name=16安LuV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.06.name=64安LuV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.07.name=4安ZPM动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.07.name=16安ZPM动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.07.name=64安ZPM动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.08.name=4安UV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.08.name=16安UV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.08.name=64安UV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.09.name=4安UHV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.09.name=16安UHV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.09.name=64安UHV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.10.name=4安UEV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.10.name=16安UEV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.10.name=64安UEV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.11.name=4安UIV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.11.name=16安UIV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.11.name=64安UIV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.12.name=4安UMV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.12.name=16安UMV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.12.name=64安UMV动力仓 +gt.blockmachines.hatch.dynamomulti04.tier.13.name=4安UXV动力仓 +gt.blockmachines.hatch.dynamomulti16.tier.13.name=16安UXV动力仓 +gt.blockmachines.hatch.dynamomulti64.tier.13.name=64安UXV动力仓 +gt.blockmachines.hatch.dynamomulti.desc.0=从多方块机器以高电流输出能源 +gt.blockmachines.hatch.dynamomulti.desc.1=输出电流 + +gt.blockmachines.hatch.dynamotunnel1.tier.05.name=IV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.05.name=IV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.05.name=IV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.05.name=IV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.05.name=IV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.05.name=IV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.05.name=IV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.06.name=LuV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.06.name=LuV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.06.name=LuV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.06.name=LuV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.06.name=LuV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.06.name=LuV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.06.name=LuV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.07.name=ZPM 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.07.name=ZPM 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.07.name=ZPM 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.07.name=ZPM 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.07.name=ZPM 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.07.name=ZPM 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.07.name=ZPM 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.08.name=UV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.08.name=UV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.08.name=UV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.08.name=UV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.08.name=UV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.08.name=UV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.08.name=UV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.09.name=UHV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.09.name=UHV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.09.name=UHV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.09.name=UHV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.09.name=UHV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.09.name=UHV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.09.name=UHV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.10.name=UEV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.10.name=UEV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.10.name=UEV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.10.name=UEV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.10.name=UEV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.10.name=UEV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.10.name=UEV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.11.name=UIV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.11.name=UIV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.11.name=UIV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.11.name=UIV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.11.name=UIV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.11.name=UIV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.11.name=UIV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.12.name=UMV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.12.name=UMV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.12.name=UMV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.12.name=UMV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.12.name=UMV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.12.name=UMV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.12.name=UMV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel1.tier.13.name=UXV 256A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel2.tier.13.name=UXV 1024A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel3.tier.13.name=UXV 4096A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel4.tier.13.name=UXV 16384A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel5.tier.13.name=UXV 65536A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel6.tier.13.name=UXV 262144A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel7.tier.13.name=UXV 1048576A/t 激光源仓 +gt.blockmachines.hatch.dynamotunnel.tier.14.name=传奇激光源仓 +gt.blockmachines.hatch.dynamotunnel.desc.0=多方块机器的能量输出端 +gt.blockmachines.hatch.dynamotunnel.desc.1=通量 + +gt.blockmachines.emin.tier.08.name=UV元物质输入仓 +gt.blockmachines.emin.tier.09.name=UHV元物质输入仓 +gt.blockmachines.emin.tier.10.name=UEV元物质输入仓 +gt.blockmachines.emin.tier.11.name=UIV元物质输入仓 +gt.blockmachines.emin.tier.12.name=UMV元物质输入仓 +gt.blockmachines.emin.tier.13.name=UXV元物质输入仓 +gt.blockmachines.emin.desc=多方块机器的元物质输入 + +gt.blockmachines.emout.tier.08.name=UV元物质输出仓 +gt.blockmachines.emout.tier.09.name=UHV元物质输出仓 +gt.blockmachines.emout.tier.10.name=UEV元物质输出仓 +gt.blockmachines.emout.tier.11.name=UIV元物质输出仓 +gt.blockmachines.emout.tier.12.name=UMV元物质输出仓 +gt.blockmachines.emout.tier.13.name=UXV元物质输出仓 +gt.blockmachines.emout.desc=多方块机器的元物质输出 + +#TODO change tier.05 to tier.04 +gt.blockmachines.hatch.param.tier.05.name=参数仪 +gt.blockmachines.hatch.param.tier.07.name=参数仪 X +gt.blockmachines.hatch.param.tier.10.name=参数仪 tXt +gt.blockmachines.hatch.param.desc.0=多方块机器的参数化 +gt.blockmachines.hatch.param.desc.1=E=mine*craft² + +gt.blockmachines.hatch.certain.tier.07.name=未定元解析器 +gt.blockmachines.hatch.certain.tier.10.name=未定元解析器 X +gt.blockmachines.hatch.certain.desc.0=你真的很确定吗? +gt.blockmachines.hatch.certain.desc.1=盒子里的薛定谔方程 + +gt.blockmachines.hatch.datain.tier.07.name=副光学接口 +gt.blockmachines.hatch.datain.desc.0=多方块机器的数据输入 +gt.blockmachines.hatch.datain.desc.1=高速光纤接口 +gt.blockmachines.hatch.datain.desc.2=启用前必须涂色 + +gt.blockmachines.hatch.dataout.tier.07.name=主光学接口 +gt.blockmachines.hatch.dataout.desc.0=多方块机器的数据输出 +gt.blockmachines.hatch.dataout.desc.1=高速光纤接口 +gt.blockmachines.hatch.dataout.desc.2=启用前必须涂色 + +gt.blockmachines.hatch.datainass.tier.07.name=装配线数据库接口 +gt.blockmachines.hatch.datainass.desc.0=多方块机器的数据输入 +gt.blockmachines.hatch.datainass.desc.1=高速光纤接口 +gt.blockmachines.hatch.datainass.desc.2=启用前必须涂色 + +gt.blockmachines.hatch.dataoutass.tier.07.name=数据库主接口 +gt.blockmachines.hatch.dataoutass.desc.0=多方块机器的数据输出 +gt.blockmachines.hatch.dataoutass.desc.1=高速光纤接口 +gt.blockmachines.hatch.dataoutass.desc.2=启用前必须涂色 + +gt.blockmachines.hatch.rack.tier.08.name=计算机箱 +gt.blockmachines.hatch.rack.desc.0=4插槽机箱 +gt.blockmachines.hatch.rack.desc.1=容纳计算机组件 +gt.blockmachines.hatch.holder.tier.09.name=物品固定容器 +gt.blockmachines.hatch.holder.desc.0=用于研究站 +gt.blockmachines.hatch.holder.desc.1=先进的固定机制! +gt.blockmachines.hatch.capacitor.tier.03.name=电容仓 +gt.blockmachines.hatch.capacitor.desc.0=用于特斯拉电塔 +gt.blockmachines.hatch.capacitor.desc.1=存储'䏍量! (就一会儿) 原文:store 'nergy'(for a while) + +#Casings +gt.blockcasingsNH.10.name=UEV机械方块 +gt.blockcasingsNH.11.name=UIV机械方块 +gt.blockcasingsNH.12.name=UMV机械方块 +gt.blockcasingsNH.13.name=UXV机械方块 +gt.blockcasingsNH.14.name=OPV机械方块 +gt.blockcasingsNH.15.name=MAX机械方块 + +gt.blockhintTT.desc.0=构造时的帮助 +gt.blockhintTT.0.name=提示方块:1号 +gt.blockhintTT.1.name=提示方块:2号 +gt.blockhintTT.2.name=提示方块:3号 +gt.blockhintTT.3.name=提示方块:4号 +gt.blockhintTT.4.name=提示方块:5号 +gt.blockhintTT.5.name=提示方块:6号 +gt.blockhintTT.6.name=提示方块:7号 +gt.blockhintTT.7.name=提示方块:8号 +gt.blockhintTT.8.name=提示方块:9号 +gt.blockhintTT.9.name=提示方块:10号 +gt.blockhintTT.10.name=提示方块:11号 +gt.blockhintTT.11.name=提示方块:12号 +gt.blockhintTT.desc.1=特定组的占位符. +gt.blockhintTT.12.name=提示方块:一般 +gt.blockhintTT.desc.2=一般占位符. +gt.blockhintTT.13.name=提示方块:空气 +gt.blockhintTT.desc.3=确保其中包含空气方块. +gt.blockhintTT.14.name=提示方块:非空气 +gt.blockhintTT.desc.4=确保其中不含空气方块. +gt.blockhintTT.15.name=提示方块:错误 +gt.blockhintTT.desc.5=错误,你希望做什么? + +gt.blockcasingsTT.0.name=超能机械方块 +gt.blockcasingsTT.0.desc.0=非常适合高能应用. +gt.blockcasingsTT.0.desc.1=能量等级正在上升! +gt.blockcasingsTT.1.name=电子计算机械方块 +gt.blockcasingsTT.1.desc.0=又好又干净的外壳. +gt.blockcasingsTT.1.desc.1=灰尘会破坏它!? +gt.3blockcasingsTT.2.name=计算机散热风扇 +gt.blockcasingsTT.2.desc.0=带过滤器的散热风扇. +gt.blockcasingsTT.2.desc.1=完美静音! +gt.blockcasingsTT.3.name=进阶电子计算机械方块 +gt.blockcasingsTT.3.desc.0=包含高带宽总线 +gt.blockcasingsTT.3.desc.1=带宽数千量子比特. +gt.blockcasingsTT.4.name=分子机械方块 +gt.blockcasingsTT.4.desc.0=阻止元物质. +gt.blockcasingsTT.4.desc.1=也阻止了辐射和情绪... +gt.blockcasingsTT.5.name=进阶分子机械方块 +gt.blockcasingsTT.5.desc.0=冷却并稳定. +gt.blockcasingsTT.5.desc.1=舒适的机器基础. +gt.blockcasingsTT.6.name=遏制场发生器 +gt.blockcasingsTT.6.desc.0=产生一个场... +gt.blockcasingsTT.6.desc.1=甚至可以阻止高能粒子. +gt.blockcasingsTT.7.name=分子线圈 +gt.blockcasingsTT.7.desc.0=好吧,它太... +gt.blockcasingsTT.7.desc.1=[用这个线圈!] +gt.blockcasingsTT.8.name=中空机械方块 +gt.blockcasingsTT.8.desc.0=强化加速器通道. +gt.blockcasingsTT.8.desc.1=有史以来最先进的管道. +gt.blockcasingsTT.9.name=时空扭曲机械方块 +gt.blockcasingsTT.9.desc.0=光速不再是限制. +gt.blockcasingsTT.9.desc.1=Wibbly wobbly timey wimey stuff.(欣赏原文吧,表示给跪了,大意是时空摇摆不定) +gt.blockcasingsTT.10.name=传输机械方块 +gt.blockcasingsTT.10.desc.0=远程连接. +gt.blockcasingsTT.10.desc.1=最好别用手碰它. +gt.blockcasingsTT.11.name=维度联络机械方块 +gt.blockcasingsTT.11.desc.0=多维运算. +gt.blockcasingsTT.11.desc.1=宇宙或别的地方. +gt.blockcasingsTT.12.name=终极分子机械方块 +gt.blockcasingsTT.12.desc.0=各方面的终极. +gt.blockcasingsTT.12.desc.1=我不知道它不能做什么. +gt.blockcasingsTT.13.name=究极分子机械方块 +gt.blockcasingsTT.13.desc.0=各方面的究极. +gt.blockcasingsTT.13.desc.1=我不知道自己在做什么! +gt.blockcasingsTT.14.name=终极遏制场发生器 +gt.blockcasingsTT.14.desc.0=黑洞... +gt.blockcasingsTT.14.desc.1=嗯... +gt.blockcasingsTT.15.name=[调试方块] +gt.blockcasingsTT.15.desc.0=懒人确定边的方式. +gt.blockcasingsTT.15.desc.1=0, 1, 2, 3, 4, 5, 6?! + +gt.blockcasingsBA0.0.name=红石合金初级特斯拉绕组 +gt.blockcasingsBA0.1.name=MV超导初级特斯拉绕组 +gt.blockcasingsBA0.2.name=HV超导初级特斯拉绕组 +gt.blockcasingsBA0.3.name=EV超导初级特斯拉绕组 +gt.blockcasingsBA0.4.name=IV超导初级特斯拉绕组 +gt.blockcasingsBA0.5.name=LuV超导初级特斯拉绕组 +gt.blockcasingsBA0.9.name=ZPM超导初级特斯拉绕组 +gt.blockcasingsBA0.0.desc.0=最高电圧 +gt.blockcasingsBA0.0.desc.1=有的人称这为神迹,另一些人把这叫做物理. +gt.blockcasingsBA0.6.name=特斯拉基座机械方块 +gt.blockcasingsBA0.6.desc.0=一种奇妙机器的基础 +gt.blockcasingsBA0.6.desc.1=它是活的,它是活的! +gt.blockcasingsBA0.7.name=特斯拉线圈机械方块 +gt.blockcasingsBA0.7.desc.0=用最好的铝箔制成! +gt.blockcasingsBA0.7.desc.1=法拉第套装稍晚到来 +gt.blockcasingsBA0.8.name=特斯拉次级绕组 +gt.blockcasingsBA0.8.desc.0=从初级绕组获取能量 +gt.blockcasingsBA0.8.desc.1=谁不想要32k的环氧树脂? + +#Multiblocks +gt.blockmachines.multimachine.em.transformer.name=有源变压器 +gt.blockmachines.multimachine.em.transformer.hint=1 - 能源仓、动力仓或超能机械方块 +gt.blockmachines.multimachine.em.transformer.desc.0=变电站 +gt.blockmachines.multimachine.em.transformer.desc.1=任意电压间的相互转换! +gt.blockmachines.multimachine.em.transformer.desc.2=只有0.004%的能量损失, HAYO! + +gt.blockmachines.multimachine.tm.microwave.name=微波发生仪 +gt.blockmachines.multimachine.tm.microwave.hint.0=1 - 基础仓室或洁净不锈钢机械方块 +gt.blockmachines.multimachine.tm.microwave.hint.1=也像个漏斗,所以给它个输出总线吧 +gt.blockmachines.multimachine.tm.microwave.desc.0=高频烤炉 +gt.blockmachines.multimachine.tm.microwave.desc.1=从生物到食物,只在转瞬之间! +gt.blockmachines.multimachine.tm.microwave.desc.2=我说用核弹...我的意思是把晚餐放进微波炉! +gt.blockmachines.multimachine.tm.microwave.cfgi.0=功率设置 +gt.blockmachines.multimachine.tm.microwave.cfgi.1=时间设置 +gt.blockmachines.multimachine.tm.microwave.cfgo.0=时间 +gt.blockmachines.multimachine.tm.microwave.cfgo.1=剩余时间 + +gt.blockmachines.multimachine.tm.teslaCoil.name=特斯拉电塔 +gt.blockmachines.multimachine.tm.teslaCoil.hint.0=1 - 基础仓室, 电容仓或特斯拉基座机械方块 +gt.blockmachines.multimachine.tm.teslaCoil.hint.1=2 - 钛框架 +gt.blockmachines.multimachine.tm.teslaCoil.desc.0=无线电源塔 +gt.blockmachines.multimachine.tm.teslaCoil.desc.1=讨厌的线缆不见啦! +gt.blockmachines.multimachine.tm.teslaCoil.desc.2=可能会影响生存几率 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.0=迟滞低设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.1=迟滞高设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.2=特斯拉电塔传输半径设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.3=特斯拉收发器传输半径设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.4=加强特斯拉线圈帽传输半径设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.5=输出电压设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.6=输出电流设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.7=最小扫描时间设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.8=过载设置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgi.9=闲置 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.0=特斯拉电塔传输半径显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.1=特斯拉收发器传输半径显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.2=加强特斯拉线圈帽传输半径显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.3=输出电压显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.4=输出电流显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.5=能量容量显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.6=已存储能量显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.7=充能进度显示 +gt.blockmachines.multimachine.tm.teslaCoil.cfgo.8=扫描时间显示 + +gt.blockmachines.multimachine.em.switch.name=QoS网络交换机 +gt.blockmachines.multimachine.em.switch.hint=1 - 基础仓室、光学接口或电子计算机机械方块 +gt.blockmachines.multimachine.em.switch.desc.0=用户控制的计算力路由 +gt.blockmachines.multimachine.em.switch.desc.1=服务质量是必须的 + +gt.blockmachines.multimachine.em.computer.name=量子计算机 +gt.blockmachines.multimachine.em.computer.hint.0=1 - 基础仓室、光学接口或电子计算机机械方块 +gt.blockmachines.multimachine.em.computer.hint.1=2 - 计算机箱或进阶电子计算机械方块 +gt.blockmachines.multimachine.em.computer.desc=你需要它来处理上面的这串数字 +gt.blockmachines.multimachine.em.computer.cfgi.0=超频比 +gt.blockmachines.multimachine.em.computer.cfgi.1=过压比 +gt.blockmachines.multimachine.em.computer.cfgo.0=当前最大热量 +gt.blockmachines.multimachine.em.computer.cfgo.1=生成算力 + +gt.blockmachines.multimachine.em.databank.name=数据库 +gt.blockmachines.multimachine.em.databank.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.databank.hint.1=2 - 数据访问仓、数据库主接口或电子计算机械方块 +gt.blockmachines.multimachine.em.databank.desc.0=远程装配数据传递 +gt.blockmachines.multimachine.em.databank.desc.1=直接应用于前部 + +gt.blockmachines.multimachine.em.junction.name=物质流枢纽 +gt.blockmachines.multimachine.em.junction.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.junction.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.junction.desc.0=中转物质流 +gt.blockmachines.multimachine.em.junction.desc.1=沿轴运动! + +gt.blockmachines.multimachine.em.mattertoem.name=物质量子化仪 +gt.blockmachines.multimachine.em.mattertoem.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.mattertoem.hint.1=2 - 元物质输出仓 +gt.blockmachines.multimachine.em.mattertoem.hint.2=3 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.mattertoem.desc.0=方便地将常规物品转换为量子形态 +gt.blockmachines.multimachine.em.mattertoem.desc.1=使得它们更...不方便 + +gt.blockmachines.multimachine.em.emtomatter.name=物质反量子化仪 +gt.blockmachines.multimachine.em.emtomatter.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.emtomatter.hint.1=2 - 元物质输入仓 +gt.blockmachines.multimachine.em.emtomatter.hint.2=3 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.emtomatter.desc.0=将量子转化回 +gt.blockmachines.multimachine.em.emtomatter.desc.1=它们的常规形态...但为什么要这么做? + +gt.blockmachines.multimachine.em.emtoessentia.name=源质反量子化仪 +gt.blockmachines.multimachine.em.emtoessentia.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.emtoessentia.hint.1=2 - 元物质输入仓 +gt.blockmachines.multimachine.em.emtoessentia.hint.2=3 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.emtoessentia.hint.3=通用 - 某种源质的储存方块 +gt.blockmachines.multimachine.em.emtoessentia.desc.0=将量子转化回 +gt.blockmachines.multimachine.em.emtoessentia.desc.1=它们的常规形态...但为什么要这么做? + +gt.blockmachines.multimachine.em.essentiatoem.name=源质量子化仪 +gt.blockmachines.multimachine.em.essentiatoem.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.essentiatoem.hint.1=2 - 元物质输出仓 +gt.blockmachines.multimachine.em.essentiatoem.hint.2=3 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.essentiatoem.hint.3=通用 - 某种源质的储存方块 +gt.blockmachines.multimachine.em.essentiatoem.desc.0=方便地将常规物品转换为量子形态 +gt.blockmachines.multimachine.em.essentiatoem.desc.1=使得它们更...不方便 + +gt.blockmachines.multimachine.em.scanner.name=元物质扫描仪 +gt.blockmachines.multimachine.em.scanner.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.scanner.hint.1=2 - 元物质输入仓或分子机械方块 +gt.blockmachines.multimachine.em.scanner.hint.2=3 - 元物质输出仓或分子机械方块 +gt.blockmachines.multimachine.em.scanner.hint.3=4 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.scanner.desc.0=它是如何存在的? +gt.blockmachines.multimachine.em.scanner.desc.1=我!不!知!道!(至少暂时是这样) + +gt.blockmachines.multimachine.em.research.name=研究站 +gt.blockmachines.multimachine.em.research.hint.0=1 - 基础仓室、光学接口或电子计算机械方块 +gt.blockmachines.multimachine.em.research.hint.1=2 - 物品固定容器 +gt.blockmachines.multimachine.em.research.desc.0=哲学家们甚至... +gt.blockmachines.multimachine.em.research.desc.1=从来不曾梦见它! + +gt.blockmachines.multimachine.em.collider.name=物质对撞机 +gt.blockmachines.multimachine.em.collider.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.collider.hint.1=2 - 元物质输入仓或分子机械方块 +gt.blockmachines.multimachine.em.collider.hint.2=3 - 元物质输出仓或分子机械方块 +gt.blockmachines.multimachine.em.collider.hint.3=4 - 元物质溢流仓或分子机械方块 +gt.blockmachines.multimachine.em.collider.hint.4=通用 - 另一个控制器面向相反的方向 +gt.blockmachines.multimachine.em.collider.desc.0=以极高的速度使物质相碰撞 +gt.blockmachines.multimachine.em.collider.desc.1=比光*还快!!! +gt.blockmachines.multimachine.em.collider.mode.0=模式:聚变 +gt.blockmachines.multimachine.em.collider.mode.1=模式:对撞 +gt.blockmachines.multimachine.em.collider.mode.2=模式:未定义 +gt.blockmachines.multimachine.em.collider.mode.3=从属于其他控制器 + +gt.blockmachines.multimachine.em.infuser.name=能量注入仪 +gt.blockmachines.multimachine.em.infuser.hint=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.infuser.desc.0=急速的能量转移! +gt.blockmachines.multimachine.em.infuser.desc.1=瞬间满电! +gt.blockmachines.multimachine.em.infuser.desc.2=但坏掉的时候不会工作! +gt.blockmachines.multimachine.em.infuser.desc.3=以及你需要考虑一下损耗... + +gt.blockmachines.multimachine.em.processing.name=量子加工机 +gt.blockmachines.multimachine.em.processing.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.processing.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.processing.desc.0=从你最启用它开始... +gt.blockmachines.multimachine.em.processing.desc.1=为你处理量子物质 + +gt.blockmachines.multimachine.em.crafter.name=物质组装机 +gt.blockmachines.multimachine.em.crafter.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.crafter.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.crafter.desc.0=以最精确的方法制造物品。 +gt.blockmachines.multimachine.em.crafter.desc.1=(跨过普朗克尺度的过程) + +gt.blockmachines.multimachine.em.stabilizer.name=元物质稳定器 +gt.blockmachines.multimachine.em.stabilizer.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.stabilizer.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.stabilizer.desc.0=扭曲时间以稳定物质 +gt.blockmachines.multimachine.em.stabilizer.desc.1=Wibbly wobbly timey wimey stuff.(欣赏原文吧,表示给跪了,大意是时空摇摆不定) + +gt.blockmachines.multimachine.em.wormhole.name=虫洞 +gt.blockmachines.multimachine.em.wormhole.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.wormhole.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.wormhole.desc.0=它并没有充满虫子。 +gt.blockmachines.multimachine.em.wormhole.desc.1=它充满了反虫子!!! + +gt.blockmachines.multimachine.em.decay.name=衰变发生器 +gt.blockmachines.multimachine.em.decay.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.decay.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.decay.desc.0=它的周期太长了吗? +gt.blockmachines.multimachine.em.decay.desc.1=那么就用它的半衰期(3)代替! +gt.blockmachines.multimachine.em.decay.conf=分流器 + +gt.blockmachines.multimachine.em.annihilation.name=湮灭发电机 +gt.blockmachines.multimachine.em.annihilation.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.annihilation.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.annihilation.desc.0=物质和反物质并不是那么喜欢对方。 +gt.blockmachines.multimachine.em.annihilation.desc.1=质能转换! + +gt.blockmachines.multimachine.em.blackholegenerator.name=黑洞发生器 +gt.blockmachines.multimachine.em.blackholegenerator.hint.0=1 - 基础仓室或超能机械方块 +gt.blockmachines.multimachine.em.blackholegenerator.hint.1=2 - 元物质输入/出仓或分子机械方块 +gt.blockmachines.multimachine.em.blackholegenerator.desc.0=基于奇点的能量获取 +gt.blockmachines.multimachine.em.blackholegenerator.desc.1=极端不稳定!!! + +#Pipes +gt.blockmachines.pipe.elementalmatter.name=量子隧道 +gt.blockmachines.pipe.elementalmatter.desc.0=量子隧道设备. +gt.blockmachines.pipe.elementalmatter.desc.1=不是传送门!!! +gt.blockmachines.pipe.elementalmatter.desc.2=启用前必须涂色 +gt.blockmachines.pipe.elementalmatter.desc.3=请勿交叉、分流或转弯 + +gt.blockmachines.pipe.energystream.name=激光真空管 +gt.blockmachines.pipe.energystream.desc.0=激光隧道设备. +gt.blockmachines.pipe.energystream.desc.1=要有光!!! +gt.blockmachines.pipe.energystream.desc.2=启用前必须涂色 +gt.blockmachines.pipe.energystream.desc.3=请勿分流或转弯 + +gt.blockmachines.pipe.datastream.name=光缆 +gt.blockmachines.pipe.datastream.desc.0=高级数据传输设备 +gt.blockmachines.pipe.datastream.desc.1=请勿直视激光! +gt.blockmachines.pipe.datastream.desc.2=启用前必须涂色 +gt.blockmachines.pipe.datastream.desc.3=请勿交叉或分流 + +#Single blocks +gt.blockmachines.machine.tt.ownerdetector.name=所有者检测机 +gt.blockmachines.machine.tt.ownerdetector.desc.0=使用螺丝刀以变更模式 +gt.blockmachines.machine.tt.ownerdetector.desc.1=寻找他的PaPa +gt.blockmachines.machine.tt.ownerdetector.desc.2=高兴时发出信号 + +gt.blockmachines.machine.tt.datareader.name=数据读取机 +gt.blockmachines.machine.tt.datareader.desc.0=读取闪存和数据球 +gt.blockmachines.machine.tt.datareader.desc.1=给它通电,然后 +gt.blockmachines.machine.tt.datareader.desc.2=将数据存储物放进去 + +gt.blockmachines.machine.tt.buck.05.name=IV降压变压器 +gt.blockmachines.machine.tt.buck.06.name=LuV降压变压器 +gt.blockmachines.machine.tt.buck.07.name=ZPM降压变压器 +gt.blockmachines.machine.tt.buck.08.name=UV降压变压器 +gt.blockmachines.machine.tt.buck.09.name=UHV降压变压器 +gt.blockmachines.machine.tt.buck.10.name=UEV降压变压器 +gt.blockmachines.machine.tt.buck.11.name=UIV降压变压器 +gt.blockmachines.machine.tt.buck.12.name=UMV降压变压器 +gt.blockmachines.machine.tt.buck.13.name=UXV降压变压器 +gt.blockmachines.machine.tt.buck.desc.0=电压调节器 +gt.blockmachines.machine.tt.buck.desc.1=可调降压变压器 +gt.blockmachines.machine.tt.buck.desc.2=开关电源... + +gt.blockmachines.machine.tt.tesla.01.name=基础特斯拉收发器 +gt.blockmachines.machine.tt.tesla.02.name=进阶特斯拉收发器 +gt.blockmachines.machine.tt.tesla.03.name=霄龙特斯拉收发器 +gt.blockmachines.machine.tt.tesla.04.name=极限特斯拉收发器 +gt.blockmachines.machine.tt.tesla.05.name=疯狂特斯拉收发器 +gt.blockmachines.machine.tt.tesla.desc.0=你选择的特斯拉I/O机器 +gt.blockmachines.machine.tt.tesla.desc.1=富人的闪电洪炉 + +#Debug blocks +gt.blockmachines.debug.tt.pollutor.name=Debug污染生成机 +gt.blockmachines.debug.tt.pollutor.desc.0=该死的genny破产了! +gt.blockmachines.debug.tt.pollutor.desc.1=无限的生产者/消费者 +gt.blockmachines.debug.tt.pollutor.desc.2=因为我需要一个? +gt.blockmachines.debug.tt.data.name=Debug数据仓 +gt.blockmachines.debug.tt.data.desc.0=量子数据输出 +gt.blockmachines.debug.tt.data.desc.1=高速光纤接口 +gt.blockmachines.debug.tt.data.desc.2=启用前必须涂色 +gt.blockmachines.debug.tt.maintenance.name=Debug维护仓 +gt.blockmachines.debug.tt.maintenance.desc.0=自动维护多方块机器 +gt.blockmachines.debug.tt.maintenance.desc.1=它能修好一切,除了自己. +gt.blockmachines.debug.tt.maintenance.desc.2=为人民服务! +gt.blockmachines.debug.tt.genny.name=Debug发电机 +gt.blockmachines.debug.tt.genny.desc.0=凭空而生的能量 +gt.blockmachines.debug.tt.genny.desc.1=一个无限的能源生产/消耗设备 +gt.blockmachines.debug.tt.genny.desc.2=我只是想要一个... +gt.blockmachines.debug.tt.writer.name=Debug结构打印机 +gt.blockmachines.debug.tt.writer.desc.0=扫描周围的方块 +gt.blockmachines.debug.tt.writer.desc.1=打印多方块非实体的结构样式编码 +gt.blockmachines.debug.tt.writer.desc.2=ABC轴沿机器正面确定 + +#Keywords and phrases +#Example: ID:3 +tt.keyword.ID=ID +#Example: 32EU at 1A +tt.keyword.at= +#These are Thaumcraft aspects +tt.keyword.Air=风 +tt.keyword.Earth=地 +tt.keyword.Fire=火 +tt.keyword.Water=水 +tt.keyword.Order=秩序 +tt.keyword.Entropy=混沌 +tt.keyword.Primal=元始 +tt.keyword.Aspect=要素 +tt.keyword.CLASS=CLASS +tt.keyword.NAME=名字 +tt.keyword.CHARGE=充能 +tt.keyword.COLORLESS=无色 +tt.keyword.MASS=物质 +tt.keyword.BOOM=BOOM! +tt.keyword.Destination=目标 +tt.keyword.Weight=质量 +tt.keyword.Source=来源 +tt.keyword.Progress=过程 +tt.keyword.Computation=算力 +#Problemns as in maintanance issues +tt.keyword.Problems=故障 +tt.keyword.Efficiency=效率 +#Button that allows to pass power to other machines +tt.keyword.PowerPass=导能 +#Button that vents EM +tt.keyword.SafeVoid=安全销毁 +tt.keyword.Parametrizer=参数仪 +tt.keyword.Value=值 +tt.keyword.Input=输入 +tt.keyword.input=输入 +tt.keyword.output=输出 +tt.keyword.Status=状态 +tt.keyword.Content=内含 +tt.keyword.PacketHistory=封包记录 + +tt.keyphrase.LIFE_TIME=寿命 +tt.keyphrase.CARRIES_COLOR=有色 +tt.keyphrase.Hint_Details=提示细节 +tt.keyphrase.At_current_energy_level=在当前能级 +#Used when 0 Elemental Matter Stacks +tt.keyphrase.No_Stacks=空 +tt.keyphrase.Contains_EM=存储元物质 +tt.keyphrase.Contained_mass=存储物质 +tt.keyphrase.Mass_Disposal_speed=清理速度 +tt.keyphrase.Muffler_BOOM=溢流BOOM! +tt.keyphrase.Energy_Hatches=能源仓 +tt.keyphrase.Probably_uses=可能用到 +tt.keyphrase.Probably_makes=可能制作 +tt.keyphrase.Tier_Rating=等级 +tt.keyphrase.Amp_Rating=电流 +tt.keyphrase.Computation_Available=可用算力 +tt.keyphrase.Computation_Remaining=剩余算力 +tt.keyphrase.Content_Stack_Count=内含:堆数 +tt.keyphrase.Base_computation=基础算力 +tt.keyphrase.After_overclocking=超频后 +tt.keyphrase.Heat_Accumulated=热量累积 +tt.keyphrase.Running_interdimensional_scan=多维度扫描进行中 +tt.keyphrase.Running_local_dimension_scan=本维度扫描进行中 +tt.keyphrase.Overdrive_disengaged=过载未占用 +tt.keyphrase.Overdrive_engaged=过载已占用 +tt.keyphrase.Hysteresis_high_set_to=滞后高通设置为 +tt.keyphrase.Hysteresis_low_set_to=滞后低通设置为 +tt.keyphrase.Tesla_radius_set_to=特斯拉半径设置为 +tt.keyphrase.Sending_power=发送功率 +tt.keyphrase.Receiving_power=接收功率 +tt.keyphrase.Stored_energy=已存储能量 +tt.keyphrase.Stored_EU=已存储EU +tt.keyphrase.Average_IO=平均I/O +tt.keyphrase.Average_IO_(max)=电压I/O(最大) +tt.keyphrase.Average_IO_max=电压I/O 最大 +tt.keyphrase.Amperage_IO_(max)=电流I/O(最大) +tt.keyphrase.Side_capabilities=辅助功能 -death.attack.elementalPollution=%1$s 被蒸发了 -death.attack.elementalPollution.player=%1$s 在与 %2$s 战斗中被蒸发了 +#OpenTurrets compatibility +tile.turretHeadEM.name=元物质炮塔 +tile.turretBaseEM.name=元物质炮塔基座 diff --git a/src/main/resources/assets/tectech/sounds/fx_lo_freq.ogg b/src/main/resources/assets/tectech/sounds/fx_lo_freq.ogg Binary files differindex 8eab2d92e2..f02581ae56 100644 --- a/src/main/resources/assets/tectech/sounds/fx_lo_freq.ogg +++ b/src/main/resources/assets/tectech/sounds/fx_lo_freq.ogg diff --git a/src/main/resources/assets/tectech/sounds/fx_mid_freq.ogg b/src/main/resources/assets/tectech/sounds/fx_mid_freq.ogg Binary files differindex b16d1297f4..10ac371e19 100644 --- a/src/main/resources/assets/tectech/sounds/fx_mid_freq.ogg +++ b/src/main/resources/assets/tectech/sounds/fx_mid_freq.ogg diff --git a/src/main/resources/assets/tectech/textures/items/itemCapacitorLuV.png b/src/main/resources/assets/tectech/textures/items/itemCapacitorLuV.png Binary files differnew file mode 100644 index 0000000000..0801e3f0d7 --- /dev/null +++ b/src/main/resources/assets/tectech/textures/items/itemCapacitorLuV.png diff --git a/src/main/resources/assets/tectech/textures/items/itemCapacitorZPM.png b/src/main/resources/assets/tectech/textures/items/itemCapacitorZPM.png Binary files differnew file mode 100644 index 0000000000..29b30dc63e --- /dev/null +++ b/src/main/resources/assets/tectech/textures/items/itemCapacitorZPM.png diff --git a/src/main/resources/assets/tectech/textures/items/itemEnderFluidLinkCover.png b/src/main/resources/assets/tectech/textures/items/itemEnderFluidLinkCover.png Binary files differnew file mode 100644 index 0000000000..201f7e4090 --- /dev/null +++ b/src/main/resources/assets/tectech/textures/items/itemEnderFluidLinkCover.png diff --git a/src/main/resources/assets/tectech/textures/items/itemPowerPassUpgradeCover.png b/src/main/resources/assets/tectech/textures/items/itemPowerPassUpgradeCover.png Binary files differnew file mode 100644 index 0000000000..85f8a77b77 --- /dev/null +++ b/src/main/resources/assets/tectech/textures/items/itemPowerPassUpgradeCover.png diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index f7fc68f278..21ecee23f8 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,10 +1,10 @@ [ { - "modid": "tectech", - "name": "TecTech", + "modid": "${modId}", + "name": "${modName}", "description": "TecTech - Tec Technology Interdimensional! Replace UUMatter with something overly complicated and annoying! (GT5u Addon)", - "version": "${version}", - "mcversion": "${mcversion}", + "version": "${modVersion}", + "mcversion": "${minecraftVersion}", "url": "", "updateUrl": "", "authorList": ["_Technus_"], |