diff options
223 files changed, 8448 insertions, 5064 deletions
diff --git a/.gitignore b/.gitignore index e97facd823..02507f643c 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,9 @@ GregTech.lang mods/ classes/ logs/ +libs/AsieLib-1.7.10-0.4.9-deobf.jar +libs/Computronics-1.7.10-1.6.6-deobf.jar +libs/Galacticraft-API-1.7-3.0.12.504.jar +libs/GTNewHorizonsCoreMod-1.7.10-1.6.10.jar +libs/MicdoodleCore-1.7-3.0.12.504.jar +libs/worldedit-forge-mc1.7.10-6.1.1-dist.jar diff --git a/AVRcore b/AVRcore -Subproject 3bdcf87f6ed02b9e5f9a291b3e534c5d515e573 +Subproject 27bf45ba7b08a0e3751b3e119e73441430bda49 diff --git a/build.gradle b/build.gradle index 9040ae0d8a..ca8da27742 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,9 @@ buildscript { repositories { + maven { + name = "mavenLocal" + url = "mavenLocal" + } mavenCentral() maven { name = "forge" @@ -11,7 +15,7 @@ buildscript { } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.2-SNAPSHOT' classpath "de.undercouch:gradle-download-task:3.1.2" } } @@ -20,6 +24,20 @@ plugins { id 'org.ajoberstar.grgit' version '3.1.1' } +file "build.properties" withReader { + def prop = new Properties() + prop.load(it) + ext.config = new ConfigSlurper().parse prop +} + +def getVersionAppendage() { + def proc = "git rev-parse --short HEAD".execute() + proc.waitFor() + return "DEV." + proc.exitValue() ? proc.text.trim() : "GITBORK" +} + +ext.set("minecraftVersion","${config.minecraft.version}-${config.forge.version}-${config.minecraft.version}") + import de.undercouch.gradle.tasks.download.Download apply plugin: 'forge' apply plugin: 'signing' @@ -39,23 +57,14 @@ sourceSets { } } -file "build.properties" withReader { - def prop = new Properties() - prop.load(it) - ext.config = new ConfigSlurper().parse prop -} - -version = "${config.minecraft.version}-${config.tectech.version}" +version = "${config.minecraft.version}-${config.tectech.version}-"+getVersionAppendage() group = "com.github.technus" archivesBaseName = "TecTech" -minecraft { - version = "${config.minecraft.version}-${config.forge.version}-${config.minecraft.version}" - runDir = "eclipse" - - replaceIn "src/main/java/com/github/technus/tectech/auxiliary/Reference.java" - replace "GRADLETOKEN_VERSION", "${config.tectech.version}" -} +minecraft.version = ext.get("minecraftVersion") +minecraft.runDir = "eclipse" +minecraft.replaceIn "src/main/java/com/github/technus/tectech/Reference.java" +minecraft.replace "GRADLETOKEN_VERSION", "${config.tectech.version}" configurations { provided @@ -88,10 +97,14 @@ repositories { name "Tterrag maven" url "https://maven.tterrag.com/" } - ivy { //CoFHCore - name 'gtnh_download_source' - artifactPattern "http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]" + maven { + name = "Curse Maven" + url = "https://www.cursemaven.com" } + //ivy { //CoFHCore + // name 'gtnh_download_source' + // artifactPattern "http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]" + //} } dependencies { @@ -116,8 +129,13 @@ dependencies { compile "micdoodle8.mods:GalacticraftCore:${config.galacticraft.version}:Dev" compile "micdoodle8.mods:Galacticraft-Planets:${config.galacticraft.version}:Dev" compile "micdoodle8.mods:Galacticraft:${config.galacticraft.version}:API" + compile "com.mod-buildcraft:buildcraft:${config.buildcraft.version}:dev" + + //TODO Re-work the formatting and add documentation + runtime "curse.maven:cofh-core:${config.cofh_core_version}" //Ivy - compile name: 'CoFHCore', version: config.cofhcore.version, ext: 'jar' + //compile name: 'CoFHCore', version: config.cofhcore.version, ext: 'jar' + } task getGregTech(type: Download) { @@ -172,6 +190,15 @@ processResources } } +task devJar(type: Jar) { + from sourceSets.main.output + classifier = 'dev' +} + +artifacts { + archives devJar +} + task signJar(dependsOn: 'reobf') { doLast { ant.signjar( @@ -185,4 +212,11 @@ task signJar(dependsOn: 'reobf') { verbose: true ) } -}
\ No newline at end of file +} + +jar { + manifest + { + attributes "FMLAT": "tectech_at.cfg" + } +} diff --git a/build.properties b/build.properties index 9d848971d8..16de85d897 100644 --- a/build.properties +++ b/build.properties @@ -1,14 +1,15 @@ minecraft.version=1.7.10 forge.version=10.13.4.1614 -tectech.version=3.7.3 +tectech.version=4.9.0 ic2.version=2.2.790-experimental codechickenlib.version=1.1.3.140 codechickencore.version=1.0.7.47 nei.version=1.0.5.120 -gregtech.jenkinsbuild=370 -gregtech.version=5.09.33.25 -cofhcore.version=[1.7.10]3.1.4-329-dev +gregtech.jenkinsbuild=778 +gregtech.version=5.09.33.57 +#cofhcore.version=[1.7.10]3.1.4-329-dev +cofh_core_version=2388751 yamcore.version=0.5.79 baubles.version=1.0.1.10 thaumcraft.version=4.2.3.5 @@ -19,3 +20,4 @@ forestry.version=4.2.16.64 enderio.version=2.3.0.429_beta endercore.version=0.2.0.39_beta waila.version=1.5.10 +buildcraft.version=7.1.23 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 39c1bb6d1b..7b33d51c2f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sun Jul 21 17:13:31 CEST 2019 +#Sun Apr 19 08:14:01 CEST 2020 +distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/mavenLocal/net/minecraftforge/gradle/ForgeGradle/1.2.2-SNAPSHOT/ForgeGradle-1.2.2-SNAPSHOT-javadoc.jar b/mavenLocal/net/minecraftforge/gradle/ForgeGradle/1.2.2-SNAPSHOT/ForgeGradle-1.2.2-SNAPSHOT-javadoc.jar Binary files differnew file mode 100644 index 0000000000..a8cb73b1ec --- /dev/null +++ b/mavenLocal/net/minecraftforge/gradle/ForgeGradle/1.2.2-SNAPSHOT/ForgeGradle-1.2.2-SNAPSHOT-javadoc.jar diff --git a/mavenLocal/net/minecraftforge/gradle/ForgeGradle/1.2.2-SNAPSHOT/ForgeGradle-1.2.2-SNAPSHOT.jar b/mavenLocal/net/minecraftforge/gradle/ForgeGradle/1.2.2-SNAPSHOT/ForgeGradle-1.2.2-SNAPSHOT.jar Binary files differnew file mode 100644 index 0000000000..83af8431bb --- /dev/null +++ b/mavenLocal/net/minecraftforge/gradle/ForgeGradle/1.2.2-SNAPSHOT/ForgeGradle-1.2.2-SNAPSHOT.jar diff --git a/mavenLocal/net/minecraftforge/gradle/ForgeGradle/1.2.2-SNAPSHOT/ForgeGradle-1.2.2-SNAPSHOT.pom b/mavenLocal/net/minecraftforge/gradle/ForgeGradle/1.2.2-SNAPSHOT/ForgeGradle-1.2.2-SNAPSHOT.pom new file mode 100644 index 0000000000..143732d174 --- /dev/null +++ b/mavenLocal/net/minecraftforge/gradle/ForgeGradle/1.2.2-SNAPSHOT/ForgeGradle-1.2.2-SNAPSHOT.pom @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <groupId>net.minecraftforge.gradle</groupId> + <artifactId>ForgeGradle</artifactId> + <version>1.2.2-SNAPSHOT</version> + <dependencies> + <dependency> + <groupId>org.ow2.asm</groupId> + <artifactId>asm-debug-all</artifactId> + <version>5.0.3</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>18.0</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>net.sf.opencsv</groupId> + <artifactId>opencsv</artifactId> + <version>2.3</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.cloudbees</groupId> + <artifactId>diff4j</artifactId> + <version>1.1</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.github.abrarsyed.jastyle</groupId> + <artifactId>jAstyle</artifactId> + <version>1.2</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>net.sf.trove4j</groupId> + <artifactId>trove4j</artifactId> + <version>2.1.0</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.github.jponge</groupId> + <artifactId>lzma-java</artifactId> + <version>1.3</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.nothome</groupId> + <artifactId>javaxdelta</artifactId> + <version>2.0.1</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <version>2.2.4</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.github.tony19</groupId> + <artifactId>named-regexp</artifactId> + <version>0.2.3</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>net.md-5</groupId> + <artifactId>SpecialSource</artifactId> + <version>1.7.3</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>4.3.3</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpmime</artifactId> + <version>4.3.3</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>de.oceanlabs.mcp</groupId> + <artifactId>RetroGuard</artifactId> + <version>3.6.6</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>de.oceanlabs.mcp</groupId> + <artifactId>mcinjector</artifactId> + <version>3.2-SNAPSHOT</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>net.minecraftforge.srg2source</groupId> + <artifactId>Srg2Source</artifactId> + <version>3.2-SNAPSHOT</version> + <scope>compile</scope> + </dependency> + </dependencies> +</project> diff --git a/mavenLocal/net/minecraftforge/gradle/ForgeGradle/1.2.2-SNAPSHOT/maven-metadata-local.xml b/mavenLocal/net/minecraftforge/gradle/ForgeGradle/1.2.2-SNAPSHOT/maven-metadata-local.xml new file mode 100644 index 0000000000..87ed94ad22 --- /dev/null +++ b/mavenLocal/net/minecraftforge/gradle/ForgeGradle/1.2.2-SNAPSHOT/maven-metadata-local.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<metadata> + <groupId>net.minecraftforge.gradle</groupId> + <artifactId>ForgeGradle</artifactId> + <version>1.2.2-SNAPSHOT</version> + <versioning> + <snapshot> + <localCopy>true</localCopy> + </snapshot> + <lastUpdated>20200419091233</lastUpdated> + </versioning> +</metadata> diff --git a/mavenLocal/net/minecraftforge/gradle/ForgeGradle/maven-metadata-local.xml b/mavenLocal/net/minecraftforge/gradle/ForgeGradle/maven-metadata-local.xml new file mode 100644 index 0000000000..4f9586c58a --- /dev/null +++ b/mavenLocal/net/minecraftforge/gradle/ForgeGradle/maven-metadata-local.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<metadata> + <groupId>net.minecraftforge.gradle</groupId> + <artifactId>ForgeGradle</artifactId> + <versioning> + <versions> + <version>1.2.2-SNAPSHOT</version> + </versions> + <lastUpdated>20200419091233</lastUpdated> + </versioning> +</metadata> diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 79defc0a1a..809a7e877d 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -12,6 +12,7 @@ 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.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; @@ -77,7 +78,7 @@ 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(); @@ -98,7 +99,6 @@ public class TecTech { public void Load(FMLInitializationEvent event) { hasCOFH = Loader.isModLoaded(Reference.COFHCORE); - if(configTecTech.DISABLE_MATERIAL_LOADING_FFS){ try { Field modifiersField = Field.class.getDeclaredField( "modifiers" ); 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 30b2b0e7ff..0cfd8242ce 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 @@ -30,9 +30,11 @@ import static com.github.technus.tectech.loader.recipe.RecipeLoader.getOrDefault */ public class DreamCraftRecipeLoader implements Runnable { //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,7 +43,7 @@ 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 @@ -222,7 +224,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,11 +260,23 @@ 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); + 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(8000), 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(8000), 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(8000), 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); - //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(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); @@ -270,10 +289,20 @@ public class DreamCraftRecipeLoader implements Runnable { 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.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_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(8000), 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(8000), 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(8000), 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); @@ -433,7 +462,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 +488,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), @@ -876,6 +933,8 @@ public class DreamCraftRecipeLoader implements Runnable { 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 +954,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), @@ -959,10 +1020,10 @@ public class DreamCraftRecipeLoader implements Runnable { 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), @@ -977,10 +1038,10 @@ public class DreamCraftRecipeLoader implements Runnable { 48000, 128, 500000, 8, new ItemStack[]{ 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), @@ -997,10 +1058,10 @@ public class DreamCraftRecipeLoader implements Runnable { 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), @@ -1016,10 +1077,10 @@ public class DreamCraftRecipeLoader implements Runnable { 192000, 512, 2000000, 32, new ItemStack[]{ 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), @@ -1027,7 +1088,7 @@ public class DreamCraftRecipeLoader implements Runnable { GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 64), 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 +1099,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); @@ -1057,17 +1118,17 @@ public class DreamCraftRecipeLoader implements Runnable { 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), + 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); @@ -1129,6 +1190,26 @@ public class DreamCraftRecipeLoader implements Runnable { Materials.Concrete.getMolten(73728L) }, getItemContainer("StargateFramePart").get(1L), 72000, 2000000); + //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); + //Batteries TT_recipeAdder.addResearchableAssemblylineRecipe(ItemList.Energy_Cluster.get(1L), 12000, 16, 100000, 3, new Object[]{ @@ -1141,7 +1222,7 @@ public class DreamCraftRecipeLoader implements Runnable { ItemList.Field_Generator_UV.get(2), ItemList.Circuit_Wafer_HPIC.get(64), ItemList.Circuit_Wafer_HPIC.get(64), - ItemList.Circuit_Parts_DiodeSMD.get(64), + ItemList.Circuit_Parts_DiodeASMD.get(32), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorUHV, 32), }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(2880), @@ -1160,8 +1241,8 @@ public class DreamCraftRecipeLoader implements Runnable { 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), + ItemList.Circuit_Parts_DiodeASMD.get(64), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 64), }, new FluidStack[]{ Materials.SolderingAlloy.getMolten(3760), Materials.Naquadria.getMolten(9216), @@ -1547,6 +1628,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), @@ -1611,6 +1706,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..32db2caed9 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 @@ -6,6 +6,7 @@ import net.minecraftforge.fluids.FluidStack; import java.lang.reflect.Method; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.*; public class GtppAtomLoader implements Runnable{ @@ -57,34 +58,34 @@ public class GtppAtomLoader implements Runnable{ } //endregion - transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), 144), getFluid("NEON",144)); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144), 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); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("GERMANIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144), OrePrefixes.dust, getUnlocalizedName("SELENIUM"),1); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144), getFluid("BROMINE",144)); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144), getFluid("KRYPTON",144)); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ZIRCONIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("TECHNETIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RUTHENIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHODIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("IODINE"),1); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),getFluid("XENON",144)); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("HAFNIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RHENIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),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); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("POLONIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(85), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ASTATINE"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("FRANCIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("RADIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("ACTINIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("PROTACTINIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93), AVOGADRO_CONSTANT_144),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); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(96), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CURIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(97), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("BERKELIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(98), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("CALIFORNIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(99), AVOGADRO_CONSTANT_144),OrePrefixes.dust, getUnlocalizedName("EINSTEINIUM"),1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(100), AVOGADRO_CONSTANT_144),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..2842a71df3 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; 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/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..702ed77315 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 @@ -59,7 +59,7 @@ public class projectileEM extends LaserProjectile { avalableEM.clear(); } else { cElementalInstanceStack consumeFromThis=avalableEM.get(TecTech.RANDOM.nextInt(avalableEM.size())); - massFactor =consumeFromThis.definition.getMass()/ dHadronDefinition.hadron_n_.getMass(); + massFactor =(float) (consumeFromThis.definition.getMass()/ dHadronDefinition.hadron_n_.getMass()); if(consumeFromThis.definition.getType()>1 || consumeFromThis.definition.getType()<-1) { exotic = true; 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..3fabfd67b2 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 @@ -7,13 +7,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,8 +19,6 @@ 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; /** 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 index 8961215354..ddef29b214 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/elementalMatter/definitions/dComplexAspectDefinition.java @@ -1,7 +1,7 @@ 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.util.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; @@ -26,7 +26,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ public final class dComplexAspectDefinition extends cElementalDefinition implements iElementalAspect { private final int hash; - public final float mass; + public final double mass; private static final byte nbtType = (byte) 'c'; @@ -74,6 +74,9 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme if (!(aspects.definition instanceof dComplexAspectDefinition) && !(aspects.definition instanceof ePrimalAspectDefinition)) { return false; } + if((int)aspects.amount!=aspects.amount){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } amount += aspects.amount; } return amount == 2; @@ -160,7 +163,7 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme } @Override - public float getRawTimeSpan(long currentEnergy) { + public double getRawTimeSpan(long currentEnergy) { return -1; } @@ -195,7 +198,7 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme } @Override - public float getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * (newEnergyLevel - currentEnergyLevel); } @@ -230,7 +233,7 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme } @Override - public float getMass() { + public double getMass() { return mass; } 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 index bcb6e3f6fc..02e7d2fe21 100644 --- 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 @@ -10,14 +10,14 @@ import static net.minecraft.util.StatCollector.translateToLocal; */ 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) { + magic_air = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Air"), "a`", 1e1D, 35), + magic_earth = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Earth"), "e`", 1e9D, 34), + magic_fire = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Fire"), "f`", 1e3D, 33), + magic_water = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Water"), "w`", 1e7D, 32), + magic_order = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Order"), "o`", 1e5D, 30), + magic_entropy = new ePrimalAspectDefinition(translateToLocal("tt.keyword.Entropy"), "e`", 1e5D, 31); + + private ePrimalAspectDefinition(String name, String symbol, double mass, int ID) { super(name, symbol, 0, mass, 0, -1, ID); } 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..87e2660e01 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,16 +1,17 @@ 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.constructable.IConstructable; 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.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; 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 cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -23,11 +24,11 @@ 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.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.github.technus.tectech.util.CommonValues.V; import static gregtech.api.enums.GT_Values.E; import static net.minecraft.util.StatCollector.translateToLocal; @@ -46,10 +47,10 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ }; 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 IHatchAdder<GT_MetaTileEntity_EM_essentiaDequantizer>[] addingMethods = adders( + GT_MetaTileEntity_EM_essentiaDequantizer::addClassicToMachineList, + GT_MetaTileEntity_EM_essentiaDequantizer::addElementalInputToMachineList, + GT_MetaTileEntity_EM_essentiaDequantizer::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}; @@ -123,7 +124,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ } @Override - public void construct(int stackSize, boolean hintsOnly) { + public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; @@ -139,11 +140,11 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ 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); + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), 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/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..a716420e81 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,16 +1,17 @@ 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.constructable.IConstructable; 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.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; 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 cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -23,11 +24,11 @@ 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.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.github.technus.tectech.util.CommonValues.V; import static gregtech.api.enums.GT_Values.E; import static net.minecraft.util.StatCollector.translateToLocal; @@ -46,10 +47,10 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu }; 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 IHatchAdder<GT_MetaTileEntity_EM_essentiaQuantizer>[] addingMethods = adders( + GT_MetaTileEntity_EM_essentiaQuantizer::addClassicToMachineList, + GT_MetaTileEntity_EM_essentiaQuantizer::addElementalOutputToMachineList, + GT_MetaTileEntity_EM_essentiaQuantizer::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}; @@ -127,7 +128,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu } @Override - public void construct(int stackSize, boolean hintsOnly) { + public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; @@ -143,11 +144,11 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu 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); + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), 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/entity/fx/BlockHint.java b/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java index ab075f7ffd..dd5cd59ac7 100644 --- a/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java +++ b/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java @@ -3,6 +3,7 @@ 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 gregtech.api.enums.Dyes; import net.minecraft.block.Block; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.Tessellator; @@ -14,11 +15,31 @@ import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class BlockHint extends EntityFX { private IIcon[] icons = new IIcon[6]; + private short[] mRGBa = Dyes._NULL.mRGBa; public BlockHint(World world){ this(world,0,0,0, Blocks.stone,0); } + /** + * + * @param world + * @param x + * @param y + * @param z + * @param icons DOWN, UP, NORTH, SOUTH, WEST, EAST + */ + public BlockHint(World world, int x, int y, int z, IIcon[] icons) { + super(world, x + .25, y + .5, z + .25); + particleGravity = 0; + prevPosX = posX; + prevPosY = posY; + prevPosZ = posZ; + noClip = true; + particleMaxAge = 2000 + TecTech.RANDOM.nextInt(200); + this.icons=icons; + } + public BlockHint(World world, int x, int y, int z, Block block, int meta) { super(world, x+.25, y+.5, z+.25); particleGravity = 0; @@ -32,6 +53,11 @@ public class BlockHint extends EntityFX { } } + public BlockHint withColorTint(short[] coloure){ + this.mRGBa =coloure; + return this; + } + @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; @@ -40,7 +66,7 @@ public class BlockHint extends EntityFX { 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); + tes.setColorRGBA((int) (mRGBa[0] * .9F), (int) (mRGBa[1] * .95F), (int) (mRGBa[2] * 1F), 192); //var8, var9 - X U //var 10, var 11 - Y V diff --git a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java new file mode 100644 index 0000000000..dc282ec0b6 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java @@ -0,0 +1,57 @@ +package com.github.technus.tectech.loader; + +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.StructureDefinition; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ElectricBlastFurnace; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import static com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer.registerMetaClass; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofBlock; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofHint; +import static gregtech.api.GregTech_API.sBlockCasings1; + +public class ConstructableLoader implements Runnable { + + @Override + public void run() { + registerMetaClass(GT_MetaTileEntity_ElectricBlastFurnace.class, new IMultiblockInfoContainer<GT_MetaTileEntity_ElectricBlastFurnace>() { + //region Structure + private final IStructureDefinition<GT_MetaTileEntity_ElectricBlastFurnace> definition= + StructureDefinition.<GT_MetaTileEntity_ElectricBlastFurnace>builder() + .addShapeOldApi("main",new String[][]{ + {"000","\"\"\"","\"\"\""," . ",}, + {"0!0","\"A\"","\"A\""," ",}, + {"000","\"\"\"","\"\"\""," ",}, + }) + .addElement('0', ofBlock(sBlockCasings1,11)) + .addElement('\"', ofHint(3)) + .addElement('!', ofHint(2)) + .addElement(' ', ofHint(1)) + .build(); + 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(ItemStack stackSize, boolean hintsOnly, GT_MetaTileEntity_ElectricBlastFurnace tileEntity, ExtendedFacing aSide) { + IGregTechTileEntity base = tileEntity.getBaseMetaTileEntity(); + definition.buildOrHints(tileEntity, stackSize, "main", base.getWorld(), + aSide, base.getXCoord(), base.getYCoord(), + base.getZCoord(), 1, 3, 0, hintsOnly); + } + + @Override + public String[] getDescription(ItemStack stackSize) { + return desc; + } + }); + } +} 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..b481b82646 100644 --- a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java @@ -4,8 +4,8 @@ import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.defin 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.mechanics.elementalMatter.definitions.complex.iaeaNuclide; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.*; /** 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..d473da6b07 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -38,7 +38,7 @@ 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.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; @@ -121,12 +121,12 @@ public final class MainLoader { } public static void postLoad() { - ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 5); + ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 6); 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){ @@ -153,9 +153,18 @@ public final class MainLoader { 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"); + } + + progressBarPostLoad.step("Constructable stuff"); + new ConstructableLoader().run(); + TecTech.LOGGER.info("Constructable initialized"); ProgressManager.pop(progressBarPostLoad); } @@ -323,6 +332,7 @@ public final class MainLoader { "DraconicEvolution", "IC2NuclearControl", "IronChest", + "irontank", "opensecurity", "openmodularturrets", "Railcraft", @@ -338,23 +348,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..581c81d15f 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.spark.RendererMessage; +import com.github.technus.tectech.mechanics.alignment.AlignmentMessage; +import com.github.technus.tectech.thing.metaTileEntity.hatch.TextParametersMessage; +import com.github.technus.tectech.mechanics.pipe.PipeActivityMessage; import static com.github.technus.tectech.Reference.MODID; @@ -23,8 +23,8 @@ 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(AlignmentMessage.ServerHandler.class, AlignmentMessage.AlignmentQuery.class); + registerMessage(AlignmentMessage.ClientHandler.class, AlignmentMessage.AlignmentData.class); registerMessage(ChunkDataMessage.ServerHandler.class, ChunkDataMessage.ChunkDataQuery.class); registerMessage(ChunkDataMessage.ClientHandler.class, ChunkDataMessage.ChunkDataData.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/recipe/BloodyRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java index a1d400ed54..7b8cc14f4d 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 @@ -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/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 2c0b59632c..8a46732e66 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -15,8 +15,7 @@ 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.CommonValues.VOLTAGE_NAMES; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.CustomItemList.*; /** @@ -199,141 +198,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 @@ -407,141 +406,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 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..7b432dbcb4 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,11 +24,11 @@ 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(); diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentLimits.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentLimits.java new file mode 100644 index 0000000000..26a6d80dd8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentLimits.java @@ -0,0 +1,183 @@ +package com.github.technus.tectech.mechanics.alignment; + +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; +import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.Arrays; +import java.util.Optional; +import java.util.Random; +import java.util.function.Function; + +import static com.github.technus.tectech.mechanics.alignment.IAlignment.STATES_COUNT; + +public class AlignmentLimits implements IAlignmentLimits { + + protected final boolean[] validStates=new boolean[STATES_COUNT]; + + public AlignmentLimits() { + allowAll(); + } + + AlignmentLimits allowAll(){ + Arrays.fill(validStates,true); + return this; + } + + AlignmentLimits denyAll(){ + Arrays.fill(validStates,false); + return this; + } + + AlignmentLimits randomAll(Random random){ + for (int i = 0; i < validStates.length; i++) { + validStates[i]=random.nextBoolean(); + } + return this; + } + + AlignmentLimits deny(ExtendedFacing... deny){ + if(deny!=null){ + for (ExtendedFacing extendedFacing : deny) { + validStates[extendedFacing.getIndex()]=false; + } + } + return this; + } + + AlignmentLimits allow(ExtendedFacing... allow){ + if(allow!=null){ + for (ExtendedFacing extendedFacing : allow) { + validStates[extendedFacing.getIndex()]=false; + } + } + return this; + } + + AlignmentLimits deny(ForgeDirection... deny){ + if(deny!=null){ + for (ExtendedFacing value : ExtendedFacing.VALUES) { + for (ForgeDirection direction : deny) { + if (value.getDirection() == direction) { + validStates[value.getIndex()] = false; + break; + } + } + } + } + return this; + } + + AlignmentLimits allow(ForgeDirection... allow){ + if(allow!=null){ + for (ExtendedFacing value : ExtendedFacing.VALUES) { + for (ForgeDirection direction : allow) { + if (value.getDirection() == direction) { + validStates[value.getIndex()] = true; + break; + } + } + } + } + return this; + } + + AlignmentLimits deny(Rotation... deny){ + if(deny!=null){ + for (ExtendedFacing value : ExtendedFacing.VALUES) { + for (Rotation rotation : deny) { + if (value.getRotation() == rotation) { + validStates[value.getIndex()] = false; + break; + } + } + } + } + return this; + } + + AlignmentLimits allow(Rotation... allow){ + if(allow!=null){ + for (ExtendedFacing value : ExtendedFacing.VALUES) { + for (Rotation rotation : allow) { + if (value.getRotation() == rotation) { + validStates[value.getIndex()] = true; + break; + } + } + } + } + return this; + } + + AlignmentLimits deny(Flip... deny){ + if(deny!=null){ + for (ExtendedFacing value : ExtendedFacing.VALUES) { + for (Flip flip : deny) { + if (value.getFlip() == flip) { + validStates[value.getIndex()] = false; + break; + } + } + } + } + return this; + } + + AlignmentLimits allow(Flip... allow){ + if(allow!=null){ + for (ExtendedFacing value : ExtendedFacing.VALUES) { + for (Flip flip : allow) { + if (value.getFlip() == flip) { + validStates[value.getIndex()] = true; + break; + } + } + } + } + return this; + } + + AlignmentLimits predicateApply(Function<ExtendedFacing,Optional<Boolean>> predicate){ + for (ExtendedFacing value : ExtendedFacing.VALUES) { + predicate.apply(value).ifPresent(bool->validStates[value.getIndex()]=bool); + } + return this; + } + + AlignmentLimits ensureDuplicates(){ + for (ExtendedFacing value : ExtendedFacing.VALUES) { + if(validStates[value.getIndex()]){ + validStates[value.getDuplicate().getIndex()]=true; + } + } + return this; + } + + /** + * Prefers rotation over flip, so both flip will get translated to opposite rotation and no flip + * @param flip the preferred flip to be used Horizontal or vertical + * @return this + */ + AlignmentLimits ensureNoDuplicates(Flip flip){ + if(flip==Flip.BOTH||flip==Flip.NONE){ + throw new IllegalArgumentException("Preffered Flip must be Horizontal or Vertical"); + } + flip=flip.getOpposite(); + for (ExtendedFacing value : ExtendedFacing.VALUES) { + if(validStates[value.getIndex()]){ + if(value.getFlip()==Flip.BOTH || value.getFlip()==flip){ + validStates[value.getIndex()]=false; + validStates[value.getDuplicate().getIndex()]=true; + } + } + } + return this; + } + + @Override + public boolean isNewExtendedFacingValid(ForgeDirection direction, Rotation rotation, Flip flip) { + return validStates[IAlignment.getAlignmentIndex(direction,rotation,flip)]; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/RotationMessage.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentMessage.java index 92b38e68ea..07a3e02c1f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/RotationMessage.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentMessage.java @@ -1,5 +1,6 @@ -package com.github.technus.tectech.thing.metaTileEntity; +package com.github.technus.tectech.mechanics.alignment; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; 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; @@ -15,31 +16,31 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; -public class RotationMessage implements IMessage { +public class AlignmentMessage implements IMessage { int mPosX; int mPosY; int mPosZ; int mPosD; - int mRotF; + int mAlign; - public RotationMessage() { + public AlignmentMessage() { } - private RotationMessage(GT_MetaTileEntity_MultiblockBase_EM metaTile) { + private AlignmentMessage(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(); + mAlign =metaTile.getExtendedFacing().getIndex(); } - private RotationMessage(World world, int x,int y,int z, IFrontRotation front) { + private AlignmentMessage(World world, int x, int y, int z, IAlignment front) { mPosX=x; mPosY=y; mPosZ=z; mPosD=world.provider.dimensionId; - mRotF=front.getFrontRotation(); + mAlign =front.getExtendedFacing().getIndex(); } @Override @@ -49,7 +50,7 @@ public class RotationMessage implements IMessage { mPosY = tTag.getInteger("posy"); mPosZ = tTag.getInteger("posz"); mPosD = tTag.getInteger("posd"); - mRotF = tTag.getInteger("rotf"); + mAlign = tTag.getInteger("rotf"); } @Override @@ -59,78 +60,78 @@ public class RotationMessage implements IMessage { tFXTag.setInteger("posy", mPosY); tFXTag.setInteger("posz", mPosZ); tFXTag.setInteger("posd", mPosD); - tFXTag.setInteger("rotf", mRotF); + tFXTag.setInteger("rotf", mAlign); ByteBufUtils.writeTag(pBuffer, tFXTag); } - public static class RotationQuery extends RotationMessage{ - public RotationQuery() { + public static class AlignmentQuery extends AlignmentMessage { + public AlignmentQuery() { } - public RotationQuery(GT_MetaTileEntity_MultiblockBase_EM metaTile) { + public AlignmentQuery(GT_MetaTileEntity_MultiblockBase_EM metaTile) { super(metaTile); } - public RotationQuery(World world, int x,int y,int z, IFrontRotation front) { + public AlignmentQuery(World world, int x, int y, int z, IAlignment front) { super(world,x,y,z,front); } } - public static class RotationData extends RotationMessage{ - public RotationData() { + public static class AlignmentData extends AlignmentMessage { + public AlignmentData() { } - private RotationData(RotationQuery query){ + private AlignmentData(AlignmentQuery query){ mPosX=query.mPosX; mPosY=query.mPosY; mPosZ=query.mPosZ; mPosD=query.mPosD; - mRotF=query.mRotF; + mAlign =query.mAlign; } - public RotationData(GT_MetaTileEntity_MultiblockBase_EM metaTile) { + public AlignmentData(GT_MetaTileEntity_MultiblockBase_EM metaTile) { super(metaTile); } - public RotationData(World world, int x,int y,int z, IFrontRotation front) { + public AlignmentData(World world, int x, int y, int z, IAlignment front) { super(world,x,y,z,front); } } - public static class ClientHandler extends AbstractClientMessageHandler<RotationData> { + public static class ClientHandler extends AbstractClientMessageHandler<AlignmentData> { @Override - public IMessage handleClientMessage(EntityPlayer pPlayer, RotationData pMessage, MessageContext pCtx) { + public IMessage handleClientMessage(EntityPlayer pPlayer, AlignmentData 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); + if(meta instanceof IAlignment){ + ((IAlignment) meta).setExtendedFacing(ExtendedFacing.byIndex(pMessage.mAlign)); } - }else if (te instanceof IFrontRotation){ - ((IFrontRotation) te).forceSetRotationDoRender((byte)pMessage.mRotF); + }else if (te instanceof IAlignment){ + ((IAlignment) te).setExtendedFacing(ExtendedFacing.byIndex(pMessage.mAlign)); } } return null; } } - public static class ServerHandler extends AbstractServerMessageHandler<RotationQuery> { + public static class ServerHandler extends AbstractServerMessageHandler<AlignmentQuery> { @Override - public IMessage handleServerMessage(EntityPlayer pPlayer, RotationQuery pMessage, MessageContext pCtx) { + public IMessage handleServerMessage(EntityPlayer pPlayer, AlignmentQuery 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); + if (meta instanceof IAlignment) { + pMessage.mAlign =((IAlignment) meta).getExtendedFacing().getIndex(); + return new AlignmentData(pMessage); } - } else if (te instanceof IFrontRotation) { - pMessage.mRotF=((IFrontRotation) te).getFrontRotation(); - return new RotationData(pMessage); + } else if (te instanceof IAlignment) { + pMessage.mAlign =((IAlignment) te).getExtendedFacing().getIndex(); + return new AlignmentData(pMessage); } } return null; diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentUtility.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentUtility.java new file mode 100644 index 0000000000..68e11b77af --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/AlignmentUtility.java @@ -0,0 +1,45 @@ +package com.github.technus.tectech.mechanics.alignment; + +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.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.FakePlayer; + +public class AlignmentUtility { + private AlignmentUtility(){ + + } + + public static boolean handle(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ){ + 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 IAlignmentProvider) { + IAlignment alignment = ((IAlignmentProvider) metaTE).getAlignment(); + if(aPlayer.isSneaking()){ + alignment.toolSetFlip(null); + }else { + alignment.toolSetRotation(null); + } + return true; + } + } else if (tTileEntity instanceof IAlignmentProvider) { + IAlignment alignment = ((IAlignmentProvider) tTileEntity).getAlignment(); + if(aPlayer.isSneaking()){ + alignment.toolSetFlip(null); + }else { + alignment.toolSetRotation(null); + } + return true; + } + } + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java new file mode 100644 index 0000000000..a2a6301070 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignment.java @@ -0,0 +1,187 @@ +package com.github.technus.tectech.mechanics.alignment; + +import com.github.technus.tectech.mechanics.alignment.enumerable.Direction; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; +import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.Arrays; + +public interface IAlignment extends IAlignmentLimits,IAlignmentProvider { + int DIRECTIONS_COUNT= Direction.VALUES.length; + int ROTATIONS_COUNT= Rotation.VALUES.length; + int FLIPS_COUNT= Flip.VALUES.length; + int STATES_COUNT = ExtendedFacing.VALUES.length; + + ExtendedFacing getExtendedFacing(); + + void setExtendedFacing(ExtendedFacing alignment); + + IAlignmentLimits getAlignmentLimits(); + + void setAlignmentLimits(IAlignmentLimits limits); + + @Override + default IAlignment getAlignment(){ + return this; + } + + static int getAlignmentIndex(ForgeDirection direction, Rotation rotation, Flip flip){ + return (direction.ordinal()*ROTATIONS_COUNT+rotation.getIndex())*FLIPS_COUNT+flip.getIndex(); + } + + default ForgeDirection getDirection(){ + return getExtendedFacing().getDirection(); + } + + default void setDirection(ForgeDirection direction){ + setExtendedFacing(getExtendedFacing().with(direction)); + } + + default Rotation getRotation(){ + return getExtendedFacing().getRotation(); + } + + default void setRotation(Rotation rotation){ + setExtendedFacing(getExtendedFacing().with(rotation)); + } + + default Flip getFlip(){ + return getExtendedFacing().getFlip(); + } + + default void setFlip(Flip flip){ + setExtendedFacing(getExtendedFacing().with(flip)); + } + + default boolean toolSetDirection(ForgeDirection direction){ + if(direction==null || direction==ForgeDirection.UNKNOWN){ + for (int i = 0,j=getDirection().ordinal()+1, valuesLength = Direction.VALUES.length; i < valuesLength; i++) { + if(toolSetDirection(Direction.VALUES[j%valuesLength].getForgeDirection())){ + return true; + } + } + }else { + for (ExtendedFacing extendedFacing : ExtendedFacing.FOR_FACING.get(direction)) { + if(checkedSetExtendedFacing(extendedFacing)){ + return true; + } + } + } + return false; + } + + default boolean checkedSetDirection(ForgeDirection direction){ + if (isNewDirectionValid(direction)){ + setDirection(direction); + return true; + } + return false; + } + + default boolean canSetToDirectionAny(ForgeDirection direction){ + for (ExtendedFacing extendedFacing : ExtendedFacing.FOR_FACING.get(direction)) { + if(isNewExtendedFacingValid(extendedFacing)){ + return true; + } + } + return false; + } + + default boolean toolSetRotation(Rotation rotation) { + if(rotation==null){ + int flips = Flip.VALUES.length; + int rotations = Rotation.VALUES.length; + for (int ii = 0,jj=getFlip().ordinal(); ii < flips; ii++) { + for (int i = 0,j=getRotation().ordinal()+1; i < rotations; i++) { + if(checkedSetExtendedFacing(ExtendedFacing.of(getDirection(),Rotation.VALUES[j%rotations],Flip.VALUES[jj%flips]))){ + return true; + } + } + } + return false; + }else { + return checkedSetRotation(rotation); + } + } + + default boolean checkedSetRotation(Rotation rotation){ + if (isNewRotationValid(rotation)){ + setRotation(rotation); + return true; + } + return false; + } + + default boolean toolSetFlip(Flip flip){ + if(flip==null){ + for (int i = 0,j=getFlip().ordinal()+1, valuesLength = Flip.VALUES.length; i < valuesLength; i++) { + if(toolSetFlip(Flip.VALUES[j%valuesLength])){ + return true; + } + } + return false; + }else { + return checkedSetFlip(flip); + } + } + + default boolean checkedSetFlip(Flip flip){ + if (isNewFlipValid(flip)){ + setFlip(flip); + return true; + } + return false; + } + + default boolean toolSetExtendedFacing(ExtendedFacing extendedFacing){ + if(extendedFacing==null){ + for (int i = 0,j=getExtendedFacing().ordinal()+1, valuesLength = ExtendedFacing.VALUES.length; i < valuesLength; i++) { + if(toolSetExtendedFacing(ExtendedFacing.VALUES[j%valuesLength])){ + return true; + } + } + return false; + }else { + return checkedSetExtendedFacing(extendedFacing); + } + } + + default boolean checkedSetExtendedFacing(ExtendedFacing alignment){ + if (isNewExtendedFacingValid(alignment)){ + setExtendedFacing(alignment); + return true; + } + return false; + } + + default boolean isNewDirectionValid(ForgeDirection direction) { + return isNewExtendedFacingValid(direction,getRotation(),getFlip()); + } + + default boolean isNewRotationValid(Rotation rotation){ + return isNewExtendedFacingValid(getDirection(),rotation,getFlip()); + } + + default boolean isNewFlipValid(Flip flip){ + return isNewExtendedFacingValid(getDirection(),getRotation(),flip); + } + + default boolean isExtendedFacingValid() { + return isNewExtendedFacingValid(getDirection(),getRotation(),getFlip()); + } + + @Override + default boolean isNewExtendedFacingValid(ForgeDirection direction, Rotation rotation, Flip flip){ + return getAlignmentLimits().isNewExtendedFacingValid(direction, rotation, flip); + } + + @Override + default boolean isNewExtendedFacingValid(ExtendedFacing alignment){ + return getAlignmentLimits().isNewExtendedFacingValid( + alignment.getDirection(), + alignment.getRotation(), + alignment.getFlip()); + } +}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentLimits.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentLimits.java new file mode 100644 index 0000000000..68b4d84dab --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentLimits.java @@ -0,0 +1,19 @@ +package com.github.technus.tectech.mechanics.alignment; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; +import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; +import net.minecraftforge.common.util.ForgeDirection; + +public interface IAlignmentLimits { + + IAlignmentLimits UNLIMITED= (direction, rotation, flip) -> true; + + boolean isNewExtendedFacingValid(ForgeDirection direction, Rotation rotation, Flip flip); + + default boolean isNewExtendedFacingValid(ExtendedFacing alignment){ + return isNewExtendedFacingValid( + alignment.getDirection(), + alignment.getRotation(), + alignment.getFlip()); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentProvider.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentProvider.java new file mode 100644 index 0000000000..07dc972aac --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/IAlignmentProvider.java @@ -0,0 +1,5 @@ +package com.github.technus.tectech.mechanics.alignment; + +public interface IAlignmentProvider { + IAlignment getAlignment(); +}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java new file mode 100644 index 0000000000..1c44164731 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/IntegerAxisSwap.java @@ -0,0 +1,84 @@ +package com.github.technus.tectech.mechanics.alignment; + +import com.github.technus.tectech.util.Vec3Impl; +import net.minecraft.util.Vec3; +import net.minecraftforge.common.util.ForgeDirection; + +import static com.github.technus.tectech.mechanics.alignment.enumerable.Direction.getAxisVector; +import static java.lang.Math.abs; + +public class IntegerAxisSwap { + private final Vec3Impl forFirstAxis; + private final Vec3Impl forSecondAxis; + private final Vec3Impl forThirdAxis; + + public IntegerAxisSwap(ForgeDirection forFirstAxis, ForgeDirection forSecondAxis, ForgeDirection forThirdAxis) { + this.forFirstAxis = getAxisVector(forFirstAxis); + this.forSecondAxis = getAxisVector(forSecondAxis); + this.forThirdAxis = getAxisVector(forThirdAxis); + if(abs(this.forFirstAxis.get0())+abs(this.forSecondAxis.get0())+abs(this.forThirdAxis.get0())!=1 || + abs(this.forFirstAxis.get1())+abs(this.forSecondAxis.get1())+abs(this.forThirdAxis.get1())!=1 || + abs(this.forFirstAxis.get2())+abs(this.forSecondAxis.get2())+abs(this.forThirdAxis.get2())!=1){ + throw new IllegalArgumentException("Axis are overlapping/missing! "+ + forFirstAxis.name()+" "+ + forSecondAxis.name()+" "+ + forThirdAxis.name()); + } + } + + public Vec3Impl translate(Vec3Impl point){ + return new Vec3Impl( + forFirstAxis.get0()*point.get0() +forFirstAxis.get1()*point.get1() +forFirstAxis.get2()*point.get2(), + forSecondAxis.get0()*point.get0()+forSecondAxis.get1()*point.get1()+forSecondAxis.get2()*point.get2(), + forThirdAxis.get0()*point.get0() +forThirdAxis.get1()*point.get1() +forThirdAxis.get2()*point.get2() + ); + } + + public Vec3Impl inverseTranslate(Vec3Impl point){ + return new Vec3Impl( + forFirstAxis.get0()*point.get0()+forSecondAxis.get0()*point.get1()+forThirdAxis.get0()*point.get2(), + forFirstAxis.get1()*point.get0()+forSecondAxis.get1()*point.get1()+forThirdAxis.get1()*point.get2(), + forFirstAxis.get2()*point.get0()+forSecondAxis.get2()*point.get1()+forThirdAxis.get2()*point.get2() + ); + } + + public Vec3 translate(Vec3 point){ + return Vec3.createVectorHelper( + forFirstAxis.get0()*point.xCoord +forFirstAxis.get1()*point.yCoord +forFirstAxis.get2()*point.zCoord, + forSecondAxis.get0()*point.xCoord+forSecondAxis.get1()*point.yCoord+forSecondAxis.get2()*point.zCoord, + forThirdAxis.get0()*point.xCoord +forThirdAxis.get1()*point.yCoord +forThirdAxis.get2()*point.zCoord + ); + } + + public Vec3 inverseTranslate(Vec3 point){ + return Vec3.createVectorHelper( + forFirstAxis.get0()*point.xCoord+forSecondAxis.get0()*point.yCoord+forThirdAxis.get0()*point.zCoord, + forFirstAxis.get1()*point.xCoord+forSecondAxis.get1()*point.yCoord+forThirdAxis.get1()*point.zCoord, + forFirstAxis.get2()*point.xCoord+forSecondAxis.get2()*point.yCoord+forThirdAxis.get2()*point.zCoord + ); + } + + public void translate(int[] point,int[] out){ + out[0]=forFirstAxis.get0()*point[0] +forFirstAxis.get1()*point[1] +forFirstAxis.get2()*point[2]; + out[1]=forSecondAxis.get0()*point[0]+forSecondAxis.get1()*point[1]+forSecondAxis.get2()*point[2]; + out[2]=forThirdAxis.get0()*point[0] +forThirdAxis.get1()*point[1] +forThirdAxis.get2()*point[2]; + } + + public void inverseTranslate(int[] point,int[] out){ + out[0]=forFirstAxis.get0()*point[0]+forSecondAxis.get0()*point[1]+forThirdAxis.get0()*point[2]; + out[1]=forFirstAxis.get1()*point[0]+forSecondAxis.get1()*point[1]+forThirdAxis.get1()*point[2]; + out[2]=forFirstAxis.get2()*point[0]+forSecondAxis.get2()*point[1]+forThirdAxis.get2()*point[2]; + } + + public void translate(double[] point,double[] out){ + out[0]=forFirstAxis.get0()*point[0] +forFirstAxis.get1()*point[1] +forFirstAxis.get2()*point[2]; + out[1]=forSecondAxis.get0()*point[0]+forSecondAxis.get1()*point[1]+forSecondAxis.get2()*point[2]; + out[2]=forThirdAxis.get0()*point[0] +forThirdAxis.get1()*point[1] +forThirdAxis.get2()*point[2]; + } + + public void inverseTranslate(double[] point,double[] out){ + out[0]=forFirstAxis.get0()*point[0]+forSecondAxis.get0()*point[1]+forThirdAxis.get0()*point[2]; + out[1]=forFirstAxis.get1()*point[0]+forSecondAxis.get1()*point[1]+forThirdAxis.get1()*point[2]; + out[2]=forFirstAxis.get2()*point[0]+forSecondAxis.get2()*point[1]+forThirdAxis.get2()*point[2]; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Direction.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Direction.java new file mode 100644 index 0000000000..cc3971fedb --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Direction.java @@ -0,0 +1,34 @@ +package com.github.technus.tectech.mechanics.alignment.enumerable; + +import com.github.technus.tectech.util.Vec3Impl; +import net.minecraftforge.common.util.ForgeDirection; + +public enum Direction { + DOWN(ForgeDirection.DOWN), + UP(ForgeDirection.UP), + NORTH(ForgeDirection.NORTH), + SOUTH(ForgeDirection.SOUTH), + WEST(ForgeDirection.WEST), + EAST(ForgeDirection.EAST); + + private final ForgeDirection forgeDirection; + private final Vec3Impl axisVector; + public static final Direction[] VALUES=values(); + + Direction(ForgeDirection forgeDirection) { + this.forgeDirection = forgeDirection; + axisVector=new Vec3Impl(forgeDirection.offsetX,forgeDirection.offsetY,forgeDirection.offsetZ); + } + + public ForgeDirection getForgeDirection() { + return forgeDirection; + } + + public Vec3Impl getAxisVector() { + return axisVector; + } + + public static Vec3Impl getAxisVector(ForgeDirection forgeDirection){ + return VALUES[forgeDirection.ordinal()].axisVector; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java new file mode 100644 index 0000000000..5949b432df --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java @@ -0,0 +1,358 @@ +package com.github.technus.tectech.mechanics.alignment.enumerable; + +import com.github.technus.tectech.mechanics.alignment.IAlignment; +import com.github.technus.tectech.mechanics.alignment.IntegerAxisSwap; +import com.github.technus.tectech.util.Vec3Impl; +import net.minecraft.util.Vec3; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.*; + +import static com.github.technus.tectech.mechanics.alignment.IAlignment.FLIPS_COUNT; +import static com.github.technus.tectech.mechanics.alignment.IAlignment.ROTATIONS_COUNT; +import static java.lang.Math.abs; +import static java.util.Arrays.stream; +import static java.util.stream.Collectors.toMap; + +public enum ExtendedFacing { + DOWN_NORMAL_NONE("down normal none"), + DOWN_NORMAL_HORIZONTAL("down normal horizontal"), + DOWN_NORMAL_VERTICAL("down normal vertical"), + DOWN_NORMAL_BOTH("down normal both"), + DOWN_CLOCKWISE_NONE("down clockwise none"), + DOWN_CLOCKWISE_HORIZONTAL("down clockwise horizontal"), + DOWN_CLOCKWISE_VERTICAL("down clockwise vertical"), + DOWN_CLOCKWISE_BOTH("down clockwise both"), + DOWN_UPSIDE_DOWN_NONE("down upside down none"), + DOWN_UPSIDE_DOWN_HORIZONTAL("down upside down horizontal"), + DOWN_UPSIDE_DOWN_VERTICAL("down upside down vertical"), + DOWN_UPSIDE_DOWN_BOTH("down upside down both"), + DOWN_COUNTER_CLOCKWISE_NONE("down counter clockwise none"), + DOWN_COUNTER_CLOCKWISE_HORIZONTAL("down counter clockwise horizontal"), + DOWN_COUNTER_CLOCKWISE_VERTICAL("down counter clockwise vertical"), + DOWN_COUNTER_CLOCKWISE_BOTH("down counter clockwise both"), + UP_NORMAL_NONE("up normal none"), + UP_NORMAL_HORIZONTAL("up normal horizontal"), + UP_NORMAL_VERTICAL("up normal vertical"), + UP_NORMAL_BOTH("up normal both"), + UP_CLOCKWISE_NONE("up clockwise none"), + UP_CLOCKWISE_HORIZONTAL("up clockwise horizontal"), + UP_CLOCKWISE_VERTICAL("up clockwise vertical"), + UP_CLOCKWISE_BOTH("up clockwise both"), + UP_UPSIDE_DOWN_NONE("up upside down none"), + UP_UPSIDE_DOWN_HORIZONTAL("up upside down horizontal"), + UP_UPSIDE_DOWN_VERTICAL("up upside down vertical"), + UP_UPSIDE_DOWN_BOTH("up upside down both"), + UP_COUNTER_CLOCKWISE_NONE("up counter clockwise none"), + UP_COUNTER_CLOCKWISE_HORIZONTAL("up counter clockwise horizontal"), + UP_COUNTER_CLOCKWISE_VERTICAL("up counter clockwise vertical"), + UP_COUNTER_CLOCKWISE_BOTH("up counter clockwise both"), + NORTH_NORMAL_NONE("north normal none"), + NORTH_NORMAL_HORIZONTAL("north normal horizontal"), + NORTH_NORMAL_VERTICAL("north normal vertical"), + NORTH_NORMAL_BOTH("north normal both"), + NORTH_CLOCKWISE_NONE("north clockwise none"), + NORTH_CLOCKWISE_HORIZONTAL("north clockwise horizontal"), + NORTH_CLOCKWISE_VERTICAL("north clockwise vertical"), + NORTH_CLOCKWISE_BOTH("north clockwise both"), + NORTH_UPSIDE_DOWN_NONE("north upside down none"), + NORTH_UPSIDE_DOWN_HORIZONTAL("north upside down horizontal"), + NORTH_UPSIDE_DOWN_VERTICAL("north upside down vertical"), + NORTH_UPSIDE_DOWN_BOTH("north upside down both"), + NORTH_COUNTER_CLOCKWISE_NONE("north counter clockwise none"), + NORTH_COUNTER_CLOCKWISE_HORIZONTAL("north counter clockwise horizontal"), + NORTH_COUNTER_CLOCKWISE_VERTICAL("north counter clockwise vertical"), + NORTH_COUNTER_CLOCKWISE_BOTH("north counter clockwise both"), + SOUTH_NORMAL_NONE("south normal none"), + SOUTH_NORMAL_HORIZONTAL("south normal horizontal"), + SOUTH_NORMAL_VERTICAL("south normal vertical"), + SOUTH_NORMAL_BOTH("south normal both"), + SOUTH_CLOCKWISE_NONE("south clockwise none"), + SOUTH_CLOCKWISE_HORIZONTAL("south clockwise horizontal"), + SOUTH_CLOCKWISE_VERTICAL("south clockwise vertical"), + SOUTH_CLOCKWISE_BOTH("south clockwise both"), + SOUTH_UPSIDE_DOWN_NONE("south upside down none"), + SOUTH_UPSIDE_DOWN_HORIZONTAL("south upside down horizontal"), + SOUTH_UPSIDE_DOWN_VERTICAL("south upside down vertical"), + SOUTH_UPSIDE_DOWN_BOTH("south upside down both"), + SOUTH_COUNTER_CLOCKWISE_NONE("south counter clockwise none"), + SOUTH_COUNTER_CLOCKWISE_HORIZONTAL("south counter clockwise horizontal"), + SOUTH_COUNTER_CLOCKWISE_VERTICAL("south counter clockwise vertical"), + SOUTH_COUNTER_CLOCKWISE_BOTH("south counter clockwise both"), + WEST_NORMAL_NONE("west normal none"), + WEST_NORMAL_HORIZONTAL("west normal horizontal"), + WEST_NORMAL_VERTICAL("west normal vertical"), + WEST_NORMAL_BOTH("west normal both"), + WEST_CLOCKWISE_NONE("west clockwise none"), + WEST_CLOCKWISE_HORIZONTAL("west clockwise horizontal"), + WEST_CLOCKWISE_VERTICAL("west clockwise vertical"), + WEST_CLOCKWISE_BOTH("west clockwise both"), + WEST_UPSIDE_DOWN_NONE("west upside down none"), + WEST_UPSIDE_DOWN_HORIZONTAL("west upside down horizontal"), + WEST_UPSIDE_DOWN_VERTICAL("west upside down vertical"), + WEST_UPSIDE_DOWN_BOTH("west upside down both"), + WEST_COUNTER_CLOCKWISE_NONE("west counter clockwise none"), + WEST_COUNTER_CLOCKWISE_HORIZONTAL("west counter clockwise horizontal"), + WEST_COUNTER_CLOCKWISE_VERTICAL("west counter clockwise vertical"), + WEST_COUNTER_CLOCKWISE_BOTH("west counter clockwise both"), + EAST_NORMAL_NONE("east normal none"), + EAST_NORMAL_HORIZONTAL("east normal horizontal"), + EAST_NORMAL_VERTICAL("east normal vertical"), + EAST_NORMAL_BOTH("east normal both"), + EAST_CLOCKWISE_NONE("east clockwise none"), + EAST_CLOCKWISE_HORIZONTAL("east clockwise horizontal"), + EAST_CLOCKWISE_VERTICAL("east clockwise vertical"), + EAST_CLOCKWISE_BOTH("east clockwise both"), + EAST_UPSIDE_DOWN_NONE("east upside down none"), + EAST_UPSIDE_DOWN_HORIZONTAL("east upside down horizontal"), + EAST_UPSIDE_DOWN_VERTICAL("east upside down vertical"), + EAST_UPSIDE_DOWN_BOTH("east upside down both"), + EAST_COUNTER_CLOCKWISE_NONE("east counter clockwise none"), + EAST_COUNTER_CLOCKWISE_HORIZONTAL("east counter clockwise horizontal"), + EAST_COUNTER_CLOCKWISE_VERTICAL("east counter clockwise vertical"), + EAST_COUNTER_CLOCKWISE_BOTH("east counter clockwise both"); + + public static final ExtendedFacing DEFAULT=NORTH_NORMAL_NONE; + public static final ExtendedFacing[] VALUES = values(); + public static final Map<ForgeDirection, List<ExtendedFacing>> FOR_FACING=new HashMap<>(); + static { + stream(values()).forEach(extendedFacing -> + FOR_FACING.compute(extendedFacing.direction,((forgeDirection, extendedFacings) -> { + if(extendedFacings==null){ + extendedFacings = new ArrayList<>(); + } + extendedFacings.add(extendedFacing); + return extendedFacings; + }))); + } + private static final Map<String, ExtendedFacing> NAME_LOOKUP = stream(VALUES).collect(toMap(ExtendedFacing::getName2, (extendedFacing) -> extendedFacing)); + + private final ForgeDirection direction; + private final ForgeDirection a,b,c; + private final Rotation rotation; + private final Flip flip; + + private final String name; + private final IntegerAxisSwap integerAxisSwap; + + ExtendedFacing(String name) { + this.name = name; + direction= Direction.VALUES[ordinal()/(ROTATIONS_COUNT*FLIPS_COUNT)].getForgeDirection(); + rotation=Rotation.VALUES[ordinal()/FLIPS_COUNT-direction.ordinal()*ROTATIONS_COUNT]; + flip=Flip.VALUES[ordinal()%FLIPS_COUNT]; + ForgeDirection a,b,c; + switch (direction){ + case DOWN: + a= ForgeDirection.WEST; + b= ForgeDirection.SOUTH; + c= ForgeDirection.UP; + break; + case UP: + a= ForgeDirection.EAST; + b= ForgeDirection.SOUTH; + c= ForgeDirection.DOWN; + break; + case NORTH: + a= ForgeDirection.WEST; + b= ForgeDirection.DOWN; + c= ForgeDirection.SOUTH; + break; + case SOUTH: + a= ForgeDirection.EAST; + b= ForgeDirection.DOWN; + c= ForgeDirection.NORTH; + break; + case WEST: + a= ForgeDirection.SOUTH; + b= ForgeDirection.DOWN; + c= ForgeDirection.EAST; + break; + case EAST: + a= ForgeDirection.NORTH; + b= ForgeDirection.DOWN; + c= ForgeDirection.WEST; + break; + default:throw new RuntimeException("Is impossible..."); + } + switch (flip){//This duplicates some axis swaps since flip boolean would do, but seems more convenient to use + case HORIZONTAL: + a=a.getOpposite(); + break; + case BOTH: + a=a.getOpposite(); + case VERTICAL: + b=b.getOpposite(); + break; + case NONE: break; + default:throw new RuntimeException("Even more impossible..."); + } + switch (rotation) { + case CLOCKWISE: { + ForgeDirection _a=a; + a =b; + b =_a.getOpposite(); + break; + } + case UPSIDE_DOWN: + a=a.getOpposite(); + b=b.getOpposite(); + break; + case COUNTER_CLOCKWISE: { + ForgeDirection _a=a; + a =b.getOpposite(); + b =_a; + break; + } + case NORMAL: break; + default: + throw new RuntimeException("More impossible..."); + } + this.a=a; + this.b=b; + this.c=c; + integerAxisSwap =new IntegerAxisSwap(a,b,c); + } + + public static ExtendedFacing of(ForgeDirection direction, Rotation rotation, Flip flip){ + if(direction==ForgeDirection.UNKNOWN){ + return VALUES[IAlignment.getAlignmentIndex(ForgeDirection.NORTH, rotation, flip)]; + } + return VALUES[IAlignment.getAlignmentIndex(direction, rotation, flip)]; + } + + public static ExtendedFacing of(ForgeDirection direction){ + if(direction==ForgeDirection.UNKNOWN){ + return DEFAULT; + } + return VALUES[IAlignment.getAlignmentIndex(direction, Rotation.NORMAL, Flip.NONE)]; + } + + public ExtendedFacing with(ForgeDirection direction){ + return of(direction,rotation,flip); + } + + public ExtendedFacing with(Rotation rotation){ + return of(direction,rotation,flip); + } + + public ExtendedFacing with(Flip flip){ + return of(direction,rotation,flip); + } + + public ExtendedFacing getOppositeDirection() { + return of(direction.getOpposite(),rotation,flip); + } + + public ExtendedFacing getOppositeRotation() { + return of(direction,rotation.getOpposite(),flip); + } + + public ExtendedFacing getOppositeFlip() { + return of(direction,rotation,flip.getOpposite()); + } + + /** + * Gets the same effective facing achieved by different rot/flip combo + * @return same effective facing, but different enum value + */ + public ExtendedFacing getDuplicate(){ + return of(direction,rotation.getOpposite(),flip.getOpposite()); + } + + public int getIndex(){ + return ordinal(); + } + + public String getName2() { + return this.name; + } + + public static ExtendedFacing byName(String name) { + return name == null ? null : NAME_LOOKUP.get(name.toLowerCase(Locale.ROOT)); + } + + public static ExtendedFacing byIndex(int index) { + return VALUES[abs(index % VALUES.length)]; + } + + public static ExtendedFacing random(Random rand) { + return VALUES[rand.nextInt(VALUES.length)]; + } + + public ForgeDirection getDirection() { + return direction; + } + + public Rotation getRotation() { + return rotation; + } + + public Flip getFlip() { + return flip; + } + + /** + * Translates relative to front facing offset to world offset + * @param abcOffset A,B,C offset (facing relative L-->R,U-->D,F-->B) + * @return X,Y,Z offset in world + */ + public Vec3 getWorldOffset(Vec3 abcOffset) { + return integerAxisSwap.inverseTranslate(abcOffset); + } + public Vec3Impl getWorldOffset(Vec3Impl abcOffset) { + return integerAxisSwap.inverseTranslate(abcOffset); + } + public void getWorldOffset(int[] point,int[] out){ + integerAxisSwap.inverseTranslate(point,out); + } + public void getWorldOffset(double[] point,double[] out){ + integerAxisSwap.inverseTranslate(point,out); + } + + + /** + * Translates world offset to relative front facing offset + * @param xyzOffset X,Y,Z offset in world + * @return A,B,C offset (facing relative L-->R,U-->D,F-->B) + */ + public Vec3 getOffsetABC(Vec3 xyzOffset){ + return integerAxisSwap.translate(xyzOffset); + } + public Vec3Impl getOffsetABC(Vec3Impl xyzOffset){ + return integerAxisSwap.translate(xyzOffset); + } + public void getOffsetABC(int[] point,int[] out){ + integerAxisSwap.translate(point,out); + } + public void getOffsetABC(double[] point,double[] out){ + integerAxisSwap.translate(point,out); + } + + public IntegerAxisSwap getIntegerAxisSwap() { + return integerAxisSwap; + } + + public ForgeDirection getRelativeLeftInWorld() { + return a; + } + + public ForgeDirection getRelativeRightInWorld() { + return a.getOpposite(); + } + + public ForgeDirection getRelativeDownInWorld() { + return b; + } + + public ForgeDirection getRelativeUpInWorld() { + return b.getOpposite(); + } + + public ForgeDirection getRelativeBackInWorld() { + return c; + } + + public ForgeDirection getRelativeForwardInWorld() { + return c.getOpposite(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java new file mode 100644 index 0000000000..4b1dff70ec --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java @@ -0,0 +1,76 @@ +package com.github.technus.tectech.mechanics.alignment.enumerable; + +import javax.annotation.Nonnull; +import java.util.Locale; +import java.util.Map; +import java.util.Random; + +import static java.lang.Math.abs; +import static java.util.Arrays.stream; +import static java.util.stream.Collectors.toMap; + +public enum Flip { + NONE(3, "none"), + HORIZONTAL(2, "horizontal"), + VERTICAL(1, "vertical"), + BOTH(0, "both"); + + private final int opposite; + private final String name; + + public static final Flip[] VALUES = values(); + private static final Map<String, Flip> NAME_LOOKUP = stream(VALUES).collect(toMap(Flip::getName2, (flip) -> flip)); + + Flip(int oppositeIn, String nameIn) { + this.opposite = oppositeIn; + this.name = nameIn; + } + + public int getIndex(){ + return ordinal(); + } + + public Flip getOpposite() { + return VALUES[opposite]; + } + + public String getName2() { + return this.name; + } + + public static Flip byName(String name) { + return name == null ? null : NAME_LOOKUP.get(name.toLowerCase(Locale.ROOT)); + } + + public static Flip byIndex(int index) { + return VALUES[abs(index % VALUES.length)]; + } + + public static Flip random(@Nonnull Random rand) { + return VALUES[rand.nextInt(VALUES.length)]; + } + + public String toString() { + return this.name; + } + + public String getName() { + return this.name; + } + + public boolean isNotFlipped(){ + return this==NONE; + } + + public boolean isBothFlipped(){ + return this==BOTH; + } + + public boolean isHorizontallyFlipped() { + return this==HORIZONTAL || isBothFlipped(); + } + + public boolean isVerticallyFliped() { + return this==VERTICAL || isBothFlipped(); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java new file mode 100644 index 0000000000..5d41f54a11 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java @@ -0,0 +1,76 @@ +package com.github.technus.tectech.mechanics.alignment.enumerable; + +import javax.annotation.Nonnull; +import java.util.Locale; +import java.util.Map; +import java.util.Random; + +import static java.lang.Math.abs; +import static java.util.Arrays.stream; +import static java.util.stream.Collectors.toMap; + +public enum Rotation { + NORMAL(2, "normal"), + CLOCKWISE(3, "clockwise"), + UPSIDE_DOWN(0, "upside down"), + COUNTER_CLOCKWISE(1, "counter clockwise"); + + private final int opposite; + private final String name; + + public static final Rotation[] VALUES = values(); + private static final Map<String, Rotation> NAME_LOOKUP = stream(VALUES).collect(toMap(Rotation::getName2, (rotation) -> rotation)); + + Rotation(int oppositeIn, String nameIn) { + this.opposite = oppositeIn; + this.name = nameIn; + } + + public int getIndex(){ + return ordinal(); + } + + public Rotation getOpposite() { + return VALUES[opposite]; + } + + public String getName2() { + return this.name; + } + + public static Rotation byName(String name) { + return name == null ? null : NAME_LOOKUP.get(name.toLowerCase(Locale.ROOT)); + } + + public static Rotation byIndex(int index) { + return VALUES[abs(index % VALUES.length)]; + } + + public static Rotation random(@Nonnull Random rand) { + return VALUES[rand.nextInt(VALUES.length)]; + } + + public String toString() { + return this.name; + } + + public String getName() { + return this.name; + } + + public boolean isNotRotated(){ + return this==NORMAL; + } + + public boolean isClockwise(){ + return this==CLOCKWISE; + } + + public boolean isCounterClockwise(){ + return this==COUNTER_CLOCKWISE; + } + + public boolean isUpsideDown(){ + return this==UPSIDE_DOWN; + } +} 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 2a770ea332..0beb5e0af8 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,7 +1,7 @@ package com.github.technus.tectech.mechanics.anomaly; 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.MainLoader; import com.github.technus.tectech.loader.NetworkDispatcher; import com.github.technus.tectech.mechanics.data.ChunkDataHandler; @@ -243,7 +243,9 @@ public class AnomalyHandler implements IChunkMetaDataHandler { player.attackEntityFrom(MainLoader.subspace,Math.max(1,badness/8f)); } } else if (playerTag.getDouble(SPACE_CANCER) > 0 && !player.isDead) { - playerTag.setDouble(SPACE_CANCER, Math.max(0, playerTag.getDouble(SPACE_CANCER) - 7.6293945E-6f)); + if (playerTag.getDouble(SPACE_CANCER) == 0 || player.ticksExisted % 10 != 0) + return; + playerTag.setDouble(SPACE_CANCER, Math.max(0, playerTag.getDouble(SPACE_CANCER) - 7.6293945E-5f)); } } TecTech.playerPersistence.saveData(player); 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/constructable/ConstructableUtility.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/ConstructableUtility.java new file mode 100644 index 0000000000..2dc74330f9 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/ConstructableUtility.java @@ -0,0 +1,114 @@ +package com.github.technus.tectech.mechanics.constructable; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.alignment.IAlignment; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +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.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.FakePlayer; +import net.minecraftforge.common.util.ForgeDirection; + +public class ConstructableUtility { + private ConstructableUtility(){ + + } + + public static boolean handle(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide) { + 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, false); + } else if (IMultiblockInfoContainer.contains(metaTE.getClass())) { + IMultiblockInfoContainer<IMetaTileEntity> iMultiblockInfoContainer =IMultiblockInfoContainer.get(metaTE.getClass()); + if(metaTE instanceof IAlignment){ + iMultiblockInfoContainer.construct(aStack, false, metaTE, ( + (IAlignment) metaTE).getExtendedFacing()); + }else { + iMultiblockInfoContainer.construct(aStack, false, metaTE, + ExtendedFacing.of(ForgeDirection.getOrientation(((IGregTechTileEntity) tTileEntity).getFrontFacing()))); + } + } + } else if (tTileEntity instanceof IConstructable) { + ((IConstructable) tTileEntity).construct(aStack, false); + } else if (IMultiblockInfoContainer.contains(tTileEntity.getClass())) { + IMultiblockInfoContainer<TileEntity> iMultiblockInfoContainer =IMultiblockInfoContainer.get(tTileEntity.getClass()); + if(tTileEntity instanceof IAlignment){ + iMultiblockInfoContainer.construct(aStack, false, tTileEntity, + ((IAlignment) tTileEntity).getExtendedFacing()); + }else { + iMultiblockInfoContainer.construct(aStack, false, tTileEntity, + ExtendedFacing.of(ForgeDirection.getOrientation(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, true); + TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack)); + return false; + } else if(IMultiblockInfoContainer.contains(metaTE.getClass())){ + IMultiblockInfoContainer<IMetaTileEntity> iMultiblockInfoContainer =IMultiblockInfoContainer.get(metaTE.getClass()); + if(metaTE instanceof IAlignment){ + iMultiblockInfoContainer.construct(aStack, true, metaTE, + ((IAlignment) metaTE).getExtendedFacing()); + }else { + iMultiblockInfoContainer.construct(aStack, true, metaTE, + ExtendedFacing.of(ForgeDirection.getOrientation(((IGregTechTileEntity) tTileEntity).getFrontFacing()))); + } + TecTech.proxy.printInchat(IMultiblockInfoContainer.get(metaTE.getClass()).getDescription(aStack)); + return false; + } + } else if(tTileEntity instanceof IConstructable){ + ((IConstructable) tTileEntity).construct(aStack,true); + TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack)); + return false; + } else if(IMultiblockInfoContainer.contains(tTileEntity.getClass())){ + IMultiblockInfoContainer<TileEntity> iMultiblockInfoContainer = IMultiblockInfoContainer.get(tTileEntity.getClass()); + if(tTileEntity instanceof IAlignment){ + iMultiblockInfoContainer.construct(aStack, true, tTileEntity, + ((IAlignment) tTileEntity).getExtendedFacing()); + }else { + iMultiblockInfoContainer.construct(aStack, true, tTileEntity, + ExtendedFacing.of(ForgeDirection.getOrientation(aSide))); + } + TecTech.proxy.printInchat(IMultiblockInfoContainer.get(tTileEntity.getClass()).getDescription(aStack)); + 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; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java new file mode 100644 index 0000000000..1de0381f1f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java @@ -0,0 +1,16 @@ +package com.github.technus.tectech.mechanics.constructable; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.item.ItemStack; + +/** + * Created by Tec on 24.03.2017. + */ +public interface IConstructable { + void construct(ItemStack stackSize, boolean hintsOnly); + + @SideOnly(Side.CLIENT) + String[] getStructureDescription(ItemStack stackSize); +} + diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java new file mode 100644 index 0000000000..173e0d16ec --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java @@ -0,0 +1,39 @@ +package com.github.technus.tectech.mechanics.constructable; + +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +import java.util.HashMap; + +/** + * To implement IConstructable on not own TileEntities + */ +public interface IMultiblockInfoContainer<T> { + HashMap<String, IMultiblockInfoContainer<?>> MULTIBLOCK_MAP = new HashMap<>(); + + static <T extends TileEntity> void registerTileClass(Class<T> clazz, IMultiblockInfoContainer<?> info){ + MULTIBLOCK_MAP.put(clazz.getCanonicalName(),info); + } + + static <T extends IMetaTileEntity> void registerMetaClass(Class<T> clazz, IMultiblockInfoContainer<?> info){ + MULTIBLOCK_MAP.put(clazz.getCanonicalName(),info); + } + + @SuppressWarnings("unchecked") + static <T> IMultiblockInfoContainer<T> get(Class<?> tClass){ + return (IMultiblockInfoContainer<T>)MULTIBLOCK_MAP.get(tClass.getCanonicalName()); + } + + static boolean contains(Class<?> tClass){ + return MULTIBLOCK_MAP.containsKey(tClass.getCanonicalName()); + } + + void construct(ItemStack stackSize, boolean hintsOnly, T tileEntity, ExtendedFacing aSide); + + @SideOnly(Side.CLIENT) + String[] getDescription(ItemStack stackSize); +} 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..990a48ac70 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.github.technus.tectech.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..268de6f71c 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.github.technus.tectech.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/core/cElementalDecay.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecay.java index 7d5e079876..e67f773a86 100644 --- 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 @@ -4,6 +4,8 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElement import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition; +import static com.github.technus.tectech.util.DoubleCount.add; + /** * Created by danie_000 on 22.10.2016. */ @@ -15,50 +17,50 @@ public final class cElementalDecay { 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 final double probability; public cElementalDecay(iElementalDefinition... outSafe) { - this(2F, outSafe); + this(1D, outSafe); } - public cElementalDecay(float probability, iElementalDefinition... outSafe) { + public cElementalDecay(double probability, iElementalDefinition... outSafe) { cElementalDefinitionStack[] outArr = new cElementalDefinitionStack[outSafe.length]; for (int i = 0; i < outArr.length; i++) { - outArr[i] = new cElementalDefinitionStack(outSafe[i], 1); + outArr[i] = new cElementalDefinitionStack(outSafe[i], 1D); } outputStacks = new cElementalDefinitionStackMap(outArr); this.probability = probability; } public cElementalDecay(cElementalDefinitionStack... outSafe) { - this(2F, outSafe); + this(1D, outSafe); } - public cElementalDecay(float probability, cElementalDefinitionStack... out) { + public cElementalDecay(double probability, cElementalDefinitionStack... out) { outputStacks = new cElementalDefinitionStackMap(out); this.probability = probability; } public cElementalDecay(cElementalDefinitionStackMap tree) { - this(2F, tree); + this(1D, tree); } - public cElementalDecay(float probability, cElementalDefinitionStackMap tree) { + public cElementalDecay(double probability, cElementalDefinitionStackMap tree) { outputStacks = tree; this.probability = probability; } - public cElementalInstanceStackMap getResults(float lifeMult, long age, long energyTotalForProducts, long amountDecaying) { + public cElementalInstanceStackMap getResults(double lifeMult, double age, long energyTotalForProducts, double amountDecaying) { cElementalInstanceStackMap decayResult = new cElementalInstanceStackMap(); if (outputStacks == null) { return decayResult;//This is to prevent null pointer exceptions. } //Deny decay code is in instance! - long qtty = 0; + double qtty = 0D; for (cElementalDefinitionStack stack : outputStacks.values()) { - qtty += stack.amount; + qtty= add(qtty,stack.amount); } - if (qtty <= 0) { + if (qtty <= 0D) { return decayResult; } //energyTotalForProducts /= qtty; @@ -66,7 +68,7 @@ public final class cElementalDecay { 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 + lifeMult, age/*new products*/, (long)(energyTotalForProducts / Math.max(1D, Math.abs(stack.amount)))));//get instances from stack } return decayResult; } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecayResult.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecayResult.java new file mode 100644 index 0000000000..4ca63d14fe --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDecayResult.java @@ -0,0 +1,41 @@ +package com.github.technus.tectech.mechanics.elementalMatter.core; + +public class cElementalDecayResult { + private final cElementalInstanceStackMap output; + private double massAffected; + private double massDiff; + + public cElementalDecayResult(cElementalInstanceStackMap output, double massAffected, double massDiff) { + this.output = output; + this.massAffected = massAffected; + this.massDiff = massDiff; + } + + public cElementalInstanceStackMap 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/cElementalDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/cElementalDefinitionStackMap.java index 294acfc479..ce0840bc8b 100644 --- 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 @@ -13,7 +13,7 @@ import static com.github.technus.tectech.mechanics.elementalMatter.definitions.p */ 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(); + public static final cElementalDefinitionStackMap EMPTY = new cElementalDefinitionStackMap(); private cElementalDefinitionStackMap() { map = new TreeMap<>(); 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 index 5893ac1a1f..e1fdc6a553 100644 --- 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 @@ -9,7 +9,11 @@ import net.minecraft.util.EnumChatFormatting; import java.util.*; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_UNCERTAINTY; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.util.DoubleCount.add; +import static com.github.technus.tectech.util.DoubleCount.sub; /** * Created by danie_000 on 22.01.2017. @@ -95,6 +99,11 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn return map; } + public Set<Map.Entry<iElementalDefinition, cElementalInstanceStack>> getEntrySet() { + return map.entrySet(); + } + + //Removers public void clear() { map.clear(); @@ -131,7 +140,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn if (testOnly) { return target.amount >= instance.amount; } else { - long diff = target.amount - instance.amount; + double diff = sub(target.amount,instance.amount); if (diff > 0) { target.amount = diff; return true; @@ -151,7 +160,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn if (testOnly) { return target.amount >= stack.getAmount(); } else { - long diff = target.amount - stack.getAmount(); + double diff = sub(target.amount,stack.getAmount()); if (diff > 0) { target.amount = diff; return true; @@ -165,7 +174,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn @Deprecated public boolean removeAmount(boolean testOnly, iElementalDefinition def) { - return removeAmount(testOnly, new cElementalDefinitionStack(def, 1)); + return removeAmount(testOnly, new cElementalDefinitionStack(def, 1D)); } public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStack... instances) { @@ -234,8 +243,8 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn } //Remove overflow - public float removeOverflow(int stacksCount, long stackCapacity) { - float massRemoved = 0; + public double removeOverflow(int stacksCount, double stackCapacity) { + double massRemoved = 0; if (map.size() > stacksCount) { iElementalDefinition[] keys = keys(); @@ -326,14 +335,14 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn } public String[] getElementalInfo() { - String[] info = new String[map.size() * 4]; + String[] info = new String[map.size()]; 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; + info[i++] = EnumChatFormatting.BLUE + instance.definition.getName()+ + " "+ EnumChatFormatting.AQUA + instance.definition.getSymbol()+ EnumChatFormatting.RESET+ + " #: " + EnumChatFormatting.GREEN + String.format("%.3E",instance.amount/ AVOGADRO_CONSTANT) +" mol"+ EnumChatFormatting.RESET+ + " E: " + EnumChatFormatting.GREEN + instance.getEnergy() + EnumChatFormatting.RESET+ + " T: " + EnumChatFormatting.GREEN + (instance.getLifeTime()<0?"STABLE":String.format("%.3E",instance.getLifeTime())); } return info; } @@ -364,26 +373,26 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn return var.toArray(new iElementalDefinition[0]); } - public float getMass() { - float mass = 0; + public double getMass() { + double mass = 0; for (cElementalInstanceStack stack : map.values()) { mass += stack.getMass(); } return mass; } - public long getCharge() { - long charge = 0; + public double getCharge() { + double charge = 0; for (cElementalInstanceStack stack : map.values()) { charge += stack.getCharge(); } return charge; } - public long getCountOfAllAmounts(){ - long sum=0; + public double getCountOfAllAmounts(){ + double sum=0; for(cElementalInstanceStack stack:map.values()){ - sum+=stack.amount; + sum= add(sum,stack.amount); } return sum; } @@ -410,22 +419,24 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn } //Tick Content - public void tickContentByOneSecond(float lifeTimeMult, int postEnergize) { - tickContent(lifeTimeMult,postEnergize,1); + public double tickContentByOneSecond(double lifeTimeMult, int postEnergize) { + return tickContent(lifeTimeMult,postEnergize,1D); } - public void tickContent(float lifeTimeMult, int postEnergize, int seconds){ + public double tickContent(double lifeTimeMult, int postEnergize, double seconds){ + cleanUp(); + double diff=0; for (cElementalInstanceStack instance : values()) { - cElementalInstanceStackMap newInstances = instance.decay(lifeTimeMult, instance.age += seconds, postEnergize); + cElementalDecayResult newInstances = instance.decay(lifeTimeMult, instance.age += seconds, postEnergize); if (newInstances == null) { instance.nextColor(); } else { + diff=add(diff,newInstances.getMassDiff()); removeAmount(false,instance); - for (cElementalInstanceStack newInstance : newInstances.values()) { - putUnify(newInstance); - } + putUnifyAll(newInstances.getOutput()); } } + return diff; } //NBT @@ -549,10 +560,6 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn } public void cleanUp(){ - for(Map.Entry<iElementalDefinition, cElementalInstanceStack> entry:map.entrySet()){ - if(entry.getValue().amount<=0) { - map.remove(entry.getKey()); - } - } + map.entrySet().removeIf(entry -> entry.getValue().amount < AVOGADRO_CONSTANT_UNCERTAINTY); } } 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 index 829af20ca6..020f5a5f8c 100644 --- 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 @@ -10,6 +10,7 @@ import java.util.Map; import java.util.TreeMap; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; +import static com.github.technus.tectech.util.DoubleCount.sub; /** * Created by danie_000 on 22.01.2017. @@ -100,7 +101,7 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa if (testOnly) { return target.amount >= instance.amount; } else { - long diff = target.amount - instance.amount; + double diff = sub(target.amount,instance.amount); if (diff > 0) { map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); return true; @@ -120,7 +121,7 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa if (testOnly) { return target.amount >= stack.getAmount(); } else { - long diff = target.amount - stack.getAmount(); + double diff = sub(target.amount,stack.getAmount()); if (diff > 0) { map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); return true; 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 index dbbfa7bf66..f8e7aa39e4 100644 --- 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 @@ -9,6 +9,8 @@ import java.util.Collection; import java.util.Set; import java.util.TreeMap; +import static com.github.technus.tectech.util.DoubleCount.add; + /** * Created by Tec on 12.05.2017. */ @@ -65,10 +67,10 @@ abstract class cElementalStackMap implements Comparable<cElementalStackMap> { return var.toArray(new iElementalDefinition[0]); } - public long getCountOfAllAmounts(){ - long sum=0; + public double getCountOfAllAmounts(){ + double sum=0; for(cElementalDefinitionStack stack:map.values()){ - sum+=stack.amount; + sum= add(sum,stack.amount); } return sum; } 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 index de1934fed7..912d44ff43 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/commands/GiveEM.java @@ -50,7 +50,7 @@ public class GiveEM implements ICommand { cElementalDefinitionStack def= getDefinitionStack(list); if(def!=null) { - cElementalInstanceStack instanceStack = new cElementalInstanceStack(def, 1, 0, Long.parseLong(energy)); + cElementalInstanceStack instanceStack = new cElementalInstanceStack(def, 1D, 0D, Long.parseLong(energy)); sender.addChatMessage(new ChatComponentText(instanceStack.definition.getSymbol() + " - " + instanceStack.definition.getName())); @@ -73,7 +73,7 @@ public class GiveEM implements ICommand { args.remove(0); return null; } - long amount=Long.parseLong(args.remove(0)); + double amount=Double.parseDouble(args.remove(0)); try{ int id=Integer.parseInt(args.get(0)); args.remove(0); 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 index 6b6fe35b41..a2d22c30ed 100644 --- 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 @@ -5,15 +5,16 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElem import net.minecraft.nbt.NBTTagCompound; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; +import static com.github.technus.tectech.util.DoubleCount.add; /** * Created by danie_000 on 20.11.2016. */ public final class cElementalDefinitionStack implements iHasElementalDefinition { public final iElementalDefinition definition; - public final long amount; + public final double amount; - public cElementalDefinitionStack(iElementalDefinition def, long amount) { + public cElementalDefinitionStack(iElementalDefinition def, double amount) { definition = def == null ? null__ : def; this.amount = amount; } @@ -29,47 +30,47 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition } @Override - public long getAmount() { + public double getAmount() { return amount; } @Override - public long getCharge() { + public double getCharge() { return definition.getCharge() * amount; } @Override - public float getMass() { + public double getMass() { return definition.getMass() * amount; } public NBTTagCompound toNBT() { NBTTagCompound nbt = new NBTTagCompound(); nbt.setTag("d", definition.toNBT()); - nbt.setLong("q", amount); + nbt.setDouble("Q", amount); return nbt; } public static cElementalDefinitionStack fromNBT(NBTTagCompound nbt) { return new cElementalDefinitionStack( cElementalDefinition.fromNBT(nbt.getCompoundTag("d")), - nbt.getLong("q")); + nbt.getLong("q")+nbt.getDouble("Q")); } - public cElementalDefinitionStack addAmountIntoNewInstance(long amount) { + public cElementalDefinitionStack addAmountIntoNewInstance(double amount) { if(amount==0) { return this; } - return new cElementalDefinitionStack(definition, amount + this.amount); + return new cElementalDefinitionStack(definition, add(amount,this.amount)); } public cElementalDefinitionStack addAmountIntoNewInstance(cElementalDefinitionStack... other) { if (other == null || other.length == 0) { return this; } - long l = 0; + double l = 0; for (cElementalDefinitionStack stack : other) { - l += stack.amount; + l= add(l,stack.amount); } return addAmountIntoNewInstance(l); } 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 index ba3c8f909c..559d7ab8d9 100644 --- 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 @@ -1,49 +1,56 @@ 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.cElementalDecayResult; 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.util.Util; +import net.minecraft.client.Minecraft; +import net.minecraft.crash.CrashReport; import net.minecraft.nbt.NBTTagCompound; import java.util.ArrayList; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static com.github.technus.tectech.util.DoubleCount.*; +import static java.lang.Math.*; /** * Created by danie_000 on 22.10.2016. */ public final class cElementalInstanceStack implements iHasElementalDefinition { - public static int MIN_MULTIPLE_DECAY_CALLS=4,MAX_MULTIPLE_DECAY_CALLS=16,DECAY_CALL_PER=144; + public static int MIN_MULTIPLE_DECAY_CALLS=4,MAX_MULTIPLE_DECAY_CALLS=16; + public static double DECAY_CALL_PER=AVOGADRO_CONSTANT;//todo public final iElementalDefinition definition; //energy - if positive then particle should try to decay private long energy; //byte color; 0=Red 1=Green 2=Blue 0=Cyan 1=Magenta 2=Yellow, else ignored (-1 - uncolorable) private byte color; - public long age; - public long amount; - private float lifeTime; - private float lifeTimeMult; + public double age; + public double amount; + private double lifeTime; + private double lifeTimeMult; public cElementalInstanceStack(cElementalDefinitionStack stackSafe) { - this(stackSafe.definition, stackSafe.amount, 1F, 0, 0); + this(stackSafe.definition, stackSafe.amount, 1D, 0D, 0); } - public cElementalInstanceStack(cElementalDefinitionStack stackSafe, float lifeTimeMult, long age, long energy) { + public cElementalInstanceStack(cElementalDefinitionStack stackSafe, double lifeTimeMult, double 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, double amount) { + this(defSafe, amount, 1D, 0D, 0); } - public cElementalInstanceStack(iElementalDefinition defSafe, long amount, float lifeTimeMult, long age, long energy) { + public cElementalInstanceStack(iElementalDefinition defSafe, double amount, double lifeTimeMult, double age, long energy) { definition = defSafe == null ? null__ : defSafe; byte bColor = definition.getColor(); if (bColor < 0 || bColor > 2) {//transforms colorable??? into proper color @@ -75,17 +82,17 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } @Override - public long getAmount() { + public double getAmount() { return amount; } @Override - public long getCharge() { + public double getCharge() { return definition.getCharge() * amount; } @Override - public float getMass() { + public double getMass() { return definition.getMass() * amount; } @@ -98,11 +105,11 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { setLifeTimeMultiplier(getLifeTimeMultiplier()); } - public float getEnergySettingCost(long currentEnergyLevel, long newEnergyLevel){ + public double getEnergySettingCost(long currentEnergyLevel, long newEnergyLevel){ return definition.getEnergyDiffBetweenStates(currentEnergyLevel,newEnergyLevel)*amount; } - public float getEnergySettingCost(long newEnergyLevel){ + public double getEnergySettingCost(long newEnergyLevel){ return definition.getEnergyDiffBetweenStates(energy,newEnergyLevel)*amount; } @@ -133,11 +140,11 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { return color = (byte) TecTech.RANDOM.nextInt(3); } - public float getLifeTime() { + public double getLifeTime() { return lifeTime; } - public float setLifeTimeMultiplier(float mult) { + public double setLifeTimeMultiplier(double mult) { if(mult<=0) //since infinity*0=nan { throw new IllegalArgumentException("multiplier must be >0"); @@ -150,90 +157,94 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { return lifeTime; } - public float getLifeTimeMultiplier() { + public double getLifeTimeMultiplier() { return lifeTimeMult; } - public cElementalInstanceStackMap tickStackByOneSecond(float lifeTimeMult, int postEnergize){ - return tickStack(lifeTimeMult,postEnergize,1); + public cElementalDecayResult tickStackByOneSecond(double lifeTimeMult, int postEnergize){ + return tickStack(lifeTimeMult,postEnergize,1D); } - public cElementalInstanceStackMap tickStack(float lifeTimeMult, int postEnergize, int seconds){ - cElementalInstanceStackMap newInstances = decay(lifeTimeMult, age += seconds, postEnergize); + public cElementalDecayResult tickStack(double lifeTimeMult, int postEnergize, double seconds){ + cElementalDecayResult newInstances = decay(lifeTimeMult, age += seconds, postEnergize); if (newInstances == null) { nextColor(); } else { - for (cElementalInstanceStack newInstance : newInstances.values()) { + for (cElementalInstanceStack newInstance : newInstances.getOutput().values()) { newInstance.nextColor(); } } return newInstances; } - public cElementalInstanceStackMap decay() { - return decay(1F, age, 0);//try to decay without changes + public cElementalDecayResult decay() { + return decay(1D, age, 0);//try to decay without changes } - public cElementalInstanceStackMap decay(long apparentAge, long postEnergize) { - return decay(1F,apparentAge,postEnergize); + public cElementalDecayResult decay(double apparentAge, long postEnergize) { + return decay(1D,apparentAge,postEnergize); } - public cElementalInstanceStackMap decay(float lifeTimeMult, long apparentAge, long postEnergize) { + public cElementalDecayResult decay(double lifeTimeMult, double apparentAge, long postEnergize) { long newEnergyLevel = postEnergize + energy; if (newEnergyLevel > 0) { newEnergyLevel -= 1; } else if (newEnergyLevel < 0) { newEnergyLevel += 1; } + cElementalDecayResult output; if(definition.usesMultipleDecayCalls(energy)){ - 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); + double amountTemp=amount; + int decayCnt=(int) min(MAX_MULTIPLE_DECAY_CALLS,max(amount/DECAY_CALL_PER,MIN_MULTIPLE_DECAY_CALLS)); + amount= div(amount,decayCnt); + decayCnt--; + + output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); if(output==null){ amount=amountTemp; return null; } - if(amountPer>0){ - amount=amountPer; - for(int i=0;i<decayCnt;i++){ - cElementalInstanceStackMap map=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); - if(map!=null){ - output.putUnifyAll(map); - } + + for(int i=0;i<decayCnt;i++){ + cElementalDecayResult map=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); + if(map!=null){ + output.getOutput().putUnifyAll(map.getOutput()); + output.setMassDiff(add(output.getMassDiff(),map.getMassDiff())); + output.setMassAffected(output.getMassDiff()+map.getMassDiff()); } } amount=amountTemp; - return output; }else{ - return decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); + output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel); + } + if(output!=null){ + output.getOutput().cleanUp(); } + return output; } - private cElementalInstanceStackMap decayMechanics(float lifeTimeMult, long apparentAge, long newEnergyLevel) { + private cElementalDecayResult decayMechanics(double lifeTimeMult, double apparentAge, long newEnergyLevel) { if (energy > 0 && !definition.usesSpecialEnergeticDecayHandling()) { setLifeTimeMultiplier(getLifeTimeMultiplier()); - return decayCompute(definition.getEnergyInducedDecay(energy), lifeTimeMult, -1, newEnergyLevel); + return decayCompute(definition.getEnergyInducedDecay(energy), lifeTimeMult, -1D, newEnergyLevel); } else if (definition.getRawTimeSpan(energy) < 0) { return null;//return null, decay cannot be achieved } else if (definition.isTimeSpanHalfLife()) { - return exponentialDecayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getDecayArray(), lifeTimeMult, -1, newEnergyLevel); + return exponentialDecayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getDecayArray(), lifeTimeMult, -1D, 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); + if (1 > lifeTime) { + return decayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getNaturalDecayInstant(), lifeTimeMult, 0D, newEnergyLevel); + } else if (apparentAge > lifeTime) { + return decayCompute(energy > 0 ? definition.getEnergyInducedDecay(energy) : definition.getDecayArray(), lifeTimeMult, 0D, newEnergyLevel); } } return null;//return null since decay cannot be achieved } //Use to get direct decay output providing correct decay array - private 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); + private cElementalDecayResult exponentialDecayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { + double newAmount= div(amount,Math.pow(2D,1D/* 1 second *//lifeTime)); + //if(definition.getSymbol().startsWith("U ")) { // System.out.println("newAmount = " + newAmount); // System.out.println("amountRemaining = " + amountRemaining); @@ -244,124 +255,137 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { // } // } //} - if(amountRemaining==amount) { - return null;//nothing decayed - } else if(amountRemaining<=0) { + if(newAmount==amount) { + newAmount-=ulp(newAmount); + } else if(newAmount<1) { 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()); + double amount=this.amount; + this.amount-=newAmount; + cElementalDecayResult products=decayCompute(decays,lifeTimeMult,newProductsAge,newEnergyLevel); + this.amount=newAmount; + if(products!=null){ + products.getOutput().putUnify(clone()); + } this.amount=amount; return products; } //Use to get direct decay output providing correct decay array - private cElementalInstanceStackMap decayCompute(cElementalDecay[] decays, float lifeTimeMult, long newProductsAge, long newEnergyLevel) { + private cElementalDecayResult decayCompute(cElementalDecay[] decays, double lifeTimeMult, double newProductsAge, long newEnergyLevel) { if (decays == null) { return null;//Can not decay so it wont } + boolean makesEnergy=definition.decayMakesEnergy(energy); + double mass=getMass(); if (decays.length == 0) { - if(definition.decayMakesEnergy(this.energy)) { - return null; - } - return new cElementalInstanceStackMap();//provide non null 0 length array for annihilation + return makesEnergy ? null : new cElementalDecayResult(new cElementalInstanceStackMap(), mass, 0); + //provide non null 0 length array for annihilation } else if (decays.length == 1) {//only one type of decay :D, doesn't need dead end - if(decays[0]==deadEnd && definition.decayMakesEnergy(this.energy)) { - return null;//no extra photons + if(decays[0]==deadEnd) { + return makesEnergy ? null : new cElementalDecayResult(decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, amount), mass, 0); } - cElementalInstanceStackMap products=decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, amount); + cElementalInstanceStackMap output = 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; + if(output.size()==1) { + if(output.size()==1 && output.get(0).definition.equals(definition)) { + output.get(0).setEnergy(energy); + output.get(0).age=age; } }else { - for (cElementalInstanceStack stack : products.values()) { + for (cElementalInstanceStack stack : output.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(output.size()==1 && output.get(0).definition.equals(definition)) { + output.get(0).setEnergy(energy); } } - if(this.energy <= 0 && products.getMass() > getMass()){ + if(energy <= 0 && output.getMass() > mass){ return null;//no energy usage to decay } - return products; + return new cElementalDecayResult(new cElementalInstanceStackMap(), mass, makesEnergy ? output.getMass()-mass:0); } else { - cElementalInstanceStackMap output = new cElementalInstanceStackMap(); + cElementalDecayResult totalOutput = new cElementalDecayResult(new cElementalInstanceStackMap(),getMass(),0); + cElementalInstanceStackMap output=totalOutput.getOutput(),results; 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; - } + double[] probabilities=new double[differentDecays]; + for (int i = 0; i < probabilities.length; i++) { + probabilities[i]=decays[i].probability; } - - 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; - } - } + double[] qttyOfDecay; + try{ + qttyOfDecay = distribute(amount, probabilities); + }catch (ArithmeticException e){ + Minecraft.getMinecraft().crashed(new CrashReport("Decay failed for: "+this.toString(),e)); + return null; } - - 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])); - } + //long amountRemaining = this.amount, amount = this.amount; + //float remainingProbability = 1D; +// + //for (int i = 0; i < differentDecays; i++) { + // if (decays[i].probability >= 1D) { + // long thisDecayAmount = (long) Math.floor(remainingProbability * (double) amount); + // if (thisDecayAmount > 0) { + // if (thisDecayAmount <= amountRemaining) { + // amountRemaining -= thisDecayAmount; + // qttyOfDecay[i] += thisDecayAmount; + // }else {//in case too much was made + // qttyOfDecay[i] += amountRemaining; + // amountRemaining = 0; + // //remainingProbability=0; + // } + // } + // break; + // } + // long thisDecayAmount = (long) Math.floor(decays[i].probability * (double) amount); + // if (thisDecayAmount <= amountRemaining && thisDecayAmount > 0) {//some was made + // amountRemaining -= thisDecayAmount; + // qttyOfDecay[i] += thisDecayAmount; + // } else if (thisDecayAmount > amountRemaining) {//too much was made + // qttyOfDecay[i] += amountRemaining; + // amountRemaining = 0; + // //remainingProbability=0; + // break; + // } + // remainingProbability -= decays[i].probability; + // if(remainingProbability<=0) { + // break; + // } + //} + + //for (int i = 0; i < amountRemaining; i++) { + // double rand = TecTech.RANDOM.nextDouble(); + // for (int j = 0; j < differentDecays; j++) {//looking for the thing it decayed into + // rand -= decays[j].probability; + // if (rand <= 0D) { + // qttyOfDecay[j]++; + // break; + // } + // } + //} + + if(definition.decayMakesEnergy(energy)){ + for (int i = differentDecays - 1; i >= 0; i--) { + if(decays[i]==deadEnd){ + cElementalInstanceStack clone=clone(); + clone.amount=qttyOfDecay[i]; + output.putUnify(clone); + }else { + results=decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]); + output.putUnifyAll(results); + totalOutput.setMassDiff(add(totalOutput.getMassDiff(),results.getMass()-mass)); } } }else{ - for (int i = 0; i < differentDecays; i++) { - if (qttyOfDecay[i] > 0) { - output.putUnifyAll(decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i])); - } + for (int i = differentDecays - 1; i >= 0; i--) { + results=decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]); + output.putUnifyAll(results); } } @@ -382,10 +406,10 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { output.get(0).age=age; } } - if(this.energy <= 0 && output.getMass() > getMass()){ + if(energy <= 0 && output.getMass() > getMass()){ return null;//no energy usage to decay } - return output; + return totalOutput; } } @@ -394,29 +418,33 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { return this; } //returns with the definition from the first object passed - double energy = this.energy * amount; + double energyTotal = this.energy * amount; long maxEnergy=this.energy; - float lifeTimeMul = lifeTimeMult; + double lifeTimeMul = lifeTimeMult; for (cElementalInstanceStack instance : instances) { if (instance != null && compareTo(instance) == 0) { - amount += instance.amount; - energy += instance.energy * instance.amount; + amount= add(amount,instance.amount); + energyTotal += instance.energy * instance.amount; if(instance.energy>maxEnergy){ maxEnergy=instance.energy; } - lifeTimeMul = Math.min(lifeTimeMul, instance.lifeTimeMult); - age = Math.max(age, instance.age); + lifeTimeMul = min(lifeTimeMul, instance.lifeTimeMult); + age = max(age, instance.age); } } if (amount != 0) { - energy /= Math.abs(amount); + energyTotal /= 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))); + double wholeParts=Math.floor(energyTotal); + energyTotal= min(energyTotal-wholeParts,1D)+(wholeParts>=0?-0.11709966304863834D:0.11709966304863834D); + long energy=(long) wholeParts + ((energyTotal > TecTech.RANDOM.nextDouble()) ? 1 : 0); + if(energy*energyTotal<0){ + energy=0; + } + setEnergy(min(maxEnergy,energy)); return this; } @@ -458,7 +486,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { lines.add("ENERGY = " + energy); } if(Util.areBitsSet(SCAN_GET_AMOUNT,capabilities)) { - lines.add("AMOUNT = " + amount); + lines.add("AMOUNT = " + amount/ AVOGADRO_CONSTANT +" mol"); } scanContents(lines,definition.getSubParticles(),1,detailsOnDepthLevels); } @@ -483,11 +511,11 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { public NBTTagCompound toNBT() { NBTTagCompound nbt = new NBTTagCompound(); nbt.setTag("d", definition.toNBT()); - nbt.setLong("q", amount); + nbt.setDouble("Q", amount); nbt.setLong("e", energy); nbt.setByte("c", color); - nbt.setLong("a", age); - nbt.setFloat("m", lifeTimeMult); + nbt.setDouble("A", age); + nbt.setDouble("M", lifeTimeMult); return nbt; } @@ -495,9 +523,9 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { NBTTagCompound definition = nbt.getCompoundTag("d"); cElementalInstanceStack instance = new cElementalInstanceStack( cElementalDefinition.fromNBT(definition), - nbt.getLong("q"), - nbt.getFloat("m"), - nbt.getLong("a"), + nbt.getLong("q")+nbt.getDouble("Q"), + nbt.getFloat("m")+nbt.getDouble("M"), + nbt.getLong("a")+nbt.getDouble("A"), nbt.getLong("e")); instance.setColor(nbt.getByte("c")); return instance; @@ -527,6 +555,6 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { @Override public String toString() { - return definition.getName()+ '\n' + definition.getSymbol() + '\n' + amount + '\n' + getMass(); + return definition.toString() + '\n' + amount/ AVOGADRO_CONSTANT + " mol\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 index 480707d570..1d8af7bab7 100644 --- 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 @@ -8,11 +8,11 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElem public interface iHasElementalDefinition extends Comparable<iHasElementalDefinition>,Cloneable { iElementalDefinition getDefinition(); - long getAmount(); + double getAmount(); - long getCharge(); + double getCharge(); - float getMass(); + double getMass(); iHasElementalDefinition clone(); } 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 index de8ccb7b2b..51025148a7 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalDefinition.java @@ -100,8 +100,8 @@ public abstract class cElementalDefinition extends iElementalDefinition { } @Override - public final cElementalDefinitionStack getStackForm(long i) { - return new cElementalDefinitionStack(this,i); + public final cElementalDefinitionStack getStackForm(double amount) { + return new cElementalDefinitionStack(this, amount); } @Override @@ -122,8 +122,14 @@ public abstract class cElementalDefinition extends iElementalDefinition { 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(); + int amount=(int)stack.amount; + hash += ((amount & 0x1) == 0 ? -amount : amount) + stack.definition.hashCode(); } return hash; } + + @Override + public String toString() { + return getName()+ '\n' + getSymbol(); + } } diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java index 24033ba945..6ee8591c58 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/templates/cElementalPrimitive.java @@ -11,11 +11,9 @@ 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 java.util.*; -import static com.github.technus.tectech.Util.areBitsSet; +import static com.github.technus.tectech.util.Util.areBitsSet; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.null__; import static com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM.STACKS_REGISTERED; @@ -37,7 +35,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { public final String name; public final String symbol; //float-mass in eV/c^2 - public final float mass; + public final double 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) @@ -49,7 +47,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { private cElementalDecay[] elementalDecays; private byte naturalDecayInstant; private byte energeticDecayInstant; - private float rawLifeTime; + private double rawLifeTime; public final int ID; @@ -57,7 +55,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { // _ 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) { + protected cElementalPrimitive(String name, String symbol, int type, double mass, int charge, int color, int ID) { this.name = name; this.symbol = symbol; this.type = (byte) type; @@ -72,12 +70,12 @@ public abstract class cElementalPrimitive extends cElementalDefinition { } // - protected void init(cElementalPrimitive antiParticle, float rawLifeTime, int naturalInstant, int energeticInstant, cElementalDecay... elementalDecaysArray) { + protected void init(cElementalPrimitive antiParticle, double rawLifeTime, int naturalInstant, int energeticInstant, cElementalDecay... elementalDecaysArray) { anti = antiParticle; this.rawLifeTime = rawLifeTime; naturalDecayInstant = (byte) naturalInstant; energeticDecayInstant = (byte) energeticInstant; - elementalDecays = elementalDecaysArray; + elementalDecays =elementalDecaysArray; } @Override @@ -111,7 +109,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { } @Override - public float getMass() { + public double getMass() { return mass; } @@ -136,7 +134,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { } @Override - public float getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); } @@ -166,7 +164,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { } @Override - public float getRawTimeSpan(long currentEnergy) { + public double getRawTimeSpan(long currentEnergy) { return rawLifeTime; } @@ -234,7 +232,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { lines.add("SYMBOL = "+getSymbol()); } if(areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3f + " e"); + lines.add("CHARGE = " + getCharge() / 3D + " e"); } if(areBitsSet(SCAN_GET_COLOR,capabilities)) { lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); 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 index 08be835cdf..90ac2eb339 100644 --- 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 @@ -14,10 +14,10 @@ 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 double STABLE_RAW_LIFE_TIME =1.5e36D; + public static final double NO_DECAY_RAW_LIFE_TIME=-1D; public static final long DEFAULT_ENERGY_LEVEL=0; - public static final float DEFAULT_ENERGY_REQUIREMENT=25000;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels + public static final double DEFAULT_ENERGY_REQUIREMENT=25000D;//legit cuz normal atoms should only emit a gamma if they don't have defined energy levels //Nomenclature public abstract String getName(); @@ -43,24 +43,24 @@ public abstract class iElementalDefinition implements Comparable<iElementalDefin public abstract cElementalDecay[] getEnergyInducedDecay(long energyLevel);//energetic decay - public abstract boolean usesSpecialEnergeticDecayHandling(); + public abstract boolean usesSpecialEnergeticDecayHandling(); public abstract boolean usesMultipleDecayCalls(long energyLevel); public abstract boolean decayMakesEnergy(long energyLevel); - public abstract boolean fusionMakesEnergy(long energyLevel); + public abstract boolean fusionMakesEnergy(long energyLevel); - public abstract float getEnergyDiffBetweenStates(long currentEnergy, long newEnergyLevel);//positive or negative + public abstract double getEnergyDiffBetweenStates(long currentEnergy, long newEnergyLevel);//positive or negative - public abstract float getMass();//mass... MeV/c^2 + public abstract double getMass();//mass... MeV/c^2 public abstract int getCharge();//charge 1/3 electron charge //dynamically changing stuff public abstract byte getColor();//-1 nope cannot 0 it can but undefined - public abstract float getRawTimeSpan(long currentEnergy);//defined in static fields or generated + public abstract double getRawTimeSpan(long currentEnergy);//defined in static fields or generated public abstract boolean isTimeSpanHalfLife(); @@ -74,7 +74,7 @@ public abstract class iElementalDefinition implements Comparable<iElementalDefin public abstract NBTTagCompound toNBT(); - public abstract cElementalDefinitionStack getStackForm(long i); + public abstract cElementalDefinitionStack getStackForm(double amount); @Override public abstract iElementalDefinition clone(); 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 index 057d9cdb36..3d8b7a881f 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aFluidDequantizationInfo.java @@ -7,7 +7,7 @@ import net.minecraftforge.fluids.FluidStack; /** * Created by Tec on 23.05.2017. */ -public class aFluidDequantizationInfo implements iExchangeInfo { +public class aFluidDequantizationInfo implements iExchangeInfo<iHasElementalDefinition,FluidStack> { private final iHasElementalDefinition in; private final FluidStack out; @@ -16,12 +16,6 @@ public class aFluidDequantizationInfo implements iExchangeInfo { 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); 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/aFluidQuantizationInfo.java index 57ce67bf6d..563b87f8ee 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/aFluidQuantizationInfo.java @@ -7,7 +7,7 @@ import net.minecraftforge.fluids.FluidStack; /** * Created by Tec on 23.05.2017. */ -public class aFluidQuantizationInfo implements iExchangeInfo { +public class aFluidQuantizationInfo implements iExchangeInfo<FluidStack,iHasElementalDefinition> { private final FluidStack in; private final iHasElementalDefinition out; @@ -16,12 +16,6 @@ public class aFluidQuantizationInfo implements iExchangeInfo { 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){ in=new FluidStack(fluid,fluidAmount); out=emOut; 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 index b764f59863..8b42c61d6c 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aItemDequantizationInfo.java @@ -9,7 +9,7 @@ import net.minecraft.item.ItemStack; /** * Created by Tec on 23.05.2017. */ -public class aItemDequantizationInfo implements iExchangeInfo { +public class aItemDequantizationInfo implements iExchangeInfo<iHasElementalDefinition,ItemStack> { private final iHasElementalDefinition in; private final ItemStack out; 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/aItemQuantizationInfo.java index 80179e1eb8..8f33f5096d 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/aItemQuantizationInfo.java @@ -11,7 +11,7 @@ import net.minecraftforge.oredict.OreDictionary; /** * Created by Tec on 23.05.2017. */ -public class aItemQuantizationInfo implements iExchangeInfo { +public class aItemQuantizationInfo implements iExchangeInfo<ItemStack,iHasElementalDefinition> { private final ItemStack in; private final boolean skipNBT; private final iHasElementalDefinition out; 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 index 51b1a6806d..bbf94682b4 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/aOredictDequantizationInfo.java @@ -3,37 +3,30 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformation 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 { +public class aOredictDequantizationInfo implements iExchangeInfo<iHasElementalDefinition,String> { private final iHasElementalDefinition in; - public final int out; + public final String 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); + out =name; amount = qty; } public aOredictDequantizationInfo(iHasElementalDefinition emIn, OrePrefixes prefix, Materials material, int qty) { in = emIn; - out = OreDictionary.getOreID(prefix.name() + material.mName); + out = prefix.name() + material.mName; amount = qty; } public aOredictDequantizationInfo(iHasElementalDefinition emIn, OrePrefixes prefix, String materialName, int qty) { in = emIn; - out = OreDictionary.getOreID(prefix.name() + materialName); + out = prefix.name() + materialName; amount = qty; } @@ -43,7 +36,7 @@ public class aOredictDequantizationInfo implements iExchangeInfo { } @Override - public Integer output() { + public String output() { return out; } 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 index 99e8589060..964d317b80 100644 --- 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 @@ -3,42 +3,35 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformation 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 class aOredictQuantizationInfo implements iExchangeInfo<String,iHasElementalDefinition> { + public final String 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); + in=name; amount=qty; out=emOut; } - public aOredictQuantizationInfo( OrePrefixes prefix, Materials material, int qty, iHasElementalDefinition emOut){ - in=OreDictionary.getOreID(prefix.name() + material.mName); + public aOredictQuantizationInfo(OrePrefixes prefix, Materials material, int qty, iHasElementalDefinition emOut){ + in=prefix.name() + material.mName; amount=qty; out=emOut; } - public aOredictQuantizationInfo( OrePrefixes prefix, String materialName, int qty, iHasElementalDefinition emOut){ - in=OreDictionary.getOreID(prefix.name() + materialName); + public aOredictQuantizationInfo(OrePrefixes prefix, String materialName, int qty, iHasElementalDefinition emOut){ + in=prefix.name() + materialName; amount=qty; out=emOut; } @Override - public Integer input() { + public String input() { return in; } @@ -49,7 +42,7 @@ public class aOredictQuantizationInfo implements iExchangeInfo { @Override public int hashCode() { - return in; + return in.hashCode(); } @Override 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 index c23894d6b1..c9ac204554 100644 --- 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 @@ -17,13 +17,18 @@ import static com.github.technus.tectech.thing.item.DebugElementalInstanceContai * Created by Tec on 26.05.2017. */ public class bTransformationInfo { + public static final double AVOGADRO_CONSTANT =6.02214076e23D; + public static final double AVOGADRO_CONSTANT_UNCERTAINTY =(144*1000)/6.02214076e23D; + public static final double AVOGADRO_CONSTANT_144 = AVOGADRO_CONSTANT *144D; + public static final HashMap<Integer,aFluidQuantizationInfo> fluidQuantization=new HashMap<>(32); + public static final HashMap<aItemQuantizationInfo,aItemQuantizationInfo> itemQuantization=new HashMap<>(32); + public static final HashMap<Integer,aOredictQuantizationInfo> oredictQuantization=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){ @@ -45,13 +50,6 @@ public class bTransformationInfo { 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)); @@ -77,13 +75,6 @@ public class bTransformationInfo { 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)); 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 index f4e77bfe2b..2e8ef92073 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/transformations/iExchangeInfo.java @@ -3,9 +3,9 @@ package com.github.technus.tectech.mechanics.elementalMatter.core.transformation /** * 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. +public interface iExchangeInfo<IN,OUT> { + OUT output();//what should be given - ItemStack,FluidStack,AspectStack, (EM definitionStack->)EM instance stack - etc. //This must return new Object! - if obj is immutable don't care that much (applies to defStacks) - Object input();//same as above but for input + IN input();//same as above but for input } 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 index ea8f6bc201..965c46cef6 100644 --- 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 @@ -2,8 +2,6 @@ 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; @@ -19,18 +17,21 @@ 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.eLeptonDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition; +import com.github.technus.tectech.util.Util; +import com.github.technus.tectech.util.XSTR; import cpw.mods.fml.common.Loader; import gregtech.api.enums.Materials; import net.minecraft.nbt.NBTTagCompound; import java.util.*; -import static com.github.technus.tectech.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.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.deadEnd; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_scanner.*; +import static com.github.technus.tectech.util.XSTR.XSTR_INSTANCE; import static gregtech.api.enums.OrePrefixes.dust; /** @@ -41,17 +42,17 @@ public final class dAtomDefinition extends cElementalDefinition { 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; + public static final bTransformationInfo TRANSFORMATION_INFO = new bTransformationInfo(16,0,64); + public static double refMass, refUnstableMass; private static final byte nbtType = (byte) 'a'; private static final Random xstr = new XSTR();//NEEDS SEPARATE! private static Map<Integer, TreeSet<Integer>> stableIsotopes = new HashMap<>(); private static final Map<Integer, dAtomDefinition> stableAtoms = new HashMap<>(); - private static Map<Integer, TreeMap<Float, Integer>> mostStableUnstableIsotopes = new HashMap<>(); + private static Map<Integer, TreeMap<Double, Integer>> mostStableUnstableIsotopes = new HashMap<>(); private static final Map<Integer, dAtomDefinition> unstableAtoms = new HashMap<>(); private static cElementalDefinitionStack alpha,deuterium,tritium,helium_3,beryllium_8,carbon_14,neon_24,silicon_34; - private static final HashMap<dAtomDefinition,Float> lifetimeOverrides = new HashMap<>(); + private static final HashMap<dAtomDefinition,Double> lifetimeOverrides = new HashMap<>(); public final iaeaNuclide iaea; @@ -61,17 +62,17 @@ public final class dAtomDefinition extends cElementalDefinition { } private static final ArrayList<Runnable> overrides = new ArrayList<>(); - public static void addOverride(dAtomDefinition atom, float rawLifeTime){ + public static void addOverride(dAtomDefinition atom, double rawLifeTime){ lifetimeOverrides.put(atom,rawLifeTime); } //float-mass in eV/c^2 - public final float mass; + public final double mass; //public final int charge; public final int charge; //int -electric charge in 1/3rds of electron charge for optimization public final int chargeLeptons; - private float rawLifeTime; + private double rawLifeTime; //generation max present inside - minus if contains any anti quark public final byte type; @@ -115,7 +116,7 @@ public final class dAtomDefinition extends cElementalDefinition { } elementalStacks = things; - float mass = 0; + double mass = 0; int cLeptons = 0; int cNucleus = 0; int neutralCount = 0, element = 0; @@ -124,6 +125,9 @@ public final class dAtomDefinition extends cElementalDefinition { for (cElementalDefinitionStack stack : elementalStacks.values()) { iElementalDefinition def = stack.definition; int amount = (int)stack.amount; + if((int)stack.amount!=stack.amount){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } mass += stack.getMass(); if (def.getType() < 0) { containsAnti = true; @@ -160,36 +164,36 @@ public final class dAtomDefinition extends cElementalDefinition { xstr.setSeed((element + 1L) * (neutralCount + 100L)); iaea =iaeaNuclide.get(element,neutralCount); if(iaea!=null){ - if(Float.isNaN(iaea.mass)) { + if(Double.isNaN(iaea.mass)) { this.mass = mass; } else { this.mass = iaea.mass; } - if(Float.isNaN(iaea.halfTime)) { - Float overriddenLifeTime= lifetimeOverrides.get(this); - float rawLifeTimeTemp; + if(Double.isNaN(iaea.halfTime)) { + Double overriddenLifeTime= lifetimeOverrides.get(this); + double rawLifeTimeTemp; if(overriddenLifeTime!=null) { rawLifeTimeTemp = overriddenLifeTime; } else { rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); } - rawLifeTime =rawLifeTimeTemp> iElementalDefinition.STABLE_RAW_LIFE_TIME ? iElementalDefinition.STABLE_RAW_LIFE_TIME :rawLifeTimeTemp; + rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); }else { - rawLifeTime = containsAnti ? iaea.halfTime * 1.5514433E-21f * (1f + xstr.nextFloat() * 9f) : iaea.halfTime; + rawLifeTime = containsAnti ? iaea.halfTime * 1.5514433E-21d * (1d + xstr.nextDouble() * 9d) : iaea.halfTime; } iaeaDefinitionExistsAndHasEnergyLevels =iaea.energeticStatesArray.length>1; }else{ this.mass=mass; - Float overriddenLifeTime= lifetimeOverrides.get(this); - float rawLifeTimeTemp; + Double overriddenLifeTime= lifetimeOverrides.get(this); + double 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; + rawLifeTime = Math.min(rawLifeTimeTemp, STABLE_RAW_LIFE_TIME); iaeaDefinitionExistsAndHasEnergyLevels =false; } @@ -204,55 +208,54 @@ public final class dAtomDefinition extends cElementalDefinition { 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); + 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 float calculateLifeTime(int izoDiff, int izoDiffAbs, int element, int isotope, boolean containsAnti) { - float rawLifeTime; + 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 = containsAnti ? 2.381e4f * (1f + xstr.nextFloat() * 9f) : (1f + xstr.nextFloat() * 9f) * 1.5347e25F; + rawLifeTime = (1D + xstr.nextDouble() * 9D) * (containsAnti ? 2.381e4D : 1.5347e25D); } else { //Y = (X-A)/(B-A) * (D-C) + C - float unstabilityEXP; + double unstabilityEXP; if (element == 0) { - return 1e-35f; + return 1e-35D; } else if (element == 1) { - unstabilityEXP = 1.743f - Math.abs(izoDiff - 1) * 9.743f; + unstabilityEXP = 1.743D - Math.abs(izoDiff - 1) * 9.743D; } else if (element == 2) { switch (isotope) { case 4: - unstabilityEXP = 1.61f; + unstabilityEXP = 1.61D; break; case 5: - unstabilityEXP = -7.523F; + unstabilityEXP = -7.523D; break; case 6: - unstabilityEXP = -1.51f; + unstabilityEXP = -1.51D; break; default: - unstabilityEXP = -(izoDiffAbs * 6.165F); + unstabilityEXP = -(izoDiffAbs * 6.165D); break; } } else if (element <= 83 || isotope <= 127 && element <= 120) { - float elementPow4 = (float) Math.pow(element, 4f); + double elementPow4 = Math.pow(element, 4); - 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); + unstabilityEXP = Math.min(element / 2.4D, 6 + ((element + 1) % 2) * 3e6D / elementPow4) + -izoDiff * elementPow4 / 1e8D - Math.abs(izoDiff - 1 + element / 60D) * (3D - element / 12.5D + element * element / 1500D); } else if (element < 180) { - unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5F - (element - 85) / 3F) - Math.abs(izoDiff) * (3f - element / 13f + element * element / 1600f); + unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5D - (element - 85) / 3D) - Math.abs(izoDiff) * (3D - element / 13D + element * element / 1600D); } else { return -1; } if ((isotope == 127 || isotope == 128) && element < 120 && element > 83) { - unstabilityEXP -= 1.8f; + unstabilityEXP -= 1.8D; } if (element > 83 && element < 93 && isotope % 2 == 0 && izoDiff == 3) { unstabilityEXP += 6; @@ -260,14 +263,14 @@ public final class dAtomDefinition extends cElementalDefinition { 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); + rawLifeTime = (containsAnti ? 1e-8D : 1) * Math.pow(10D, unstabilityEXP) * (1D + xstr.nextDouble() * 9D); } - if (rawLifeTime < 8e-15) { - return 1e-35f; + if (rawLifeTime < 8e-15D) { + return 1e-35D; } - if (rawLifeTime > 8e28) { - return 8e30f; + if (rawLifeTime > 8e28D) { + return 8e30D; } return rawLifeTime; } @@ -284,6 +287,9 @@ public final class dAtomDefinition extends cElementalDefinition { } else if (!(stack.definition instanceof eLeptonDefinition)) { return false; } + if((int)stack.amount!=stack.amount){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } qty+=stack.amount; } return nuclei && qty<ATOM_COMPLEXITY_LIMIT; @@ -307,7 +313,7 @@ public final class dAtomDefinition extends cElementalDefinition { } @Override - public float getMass() { + public double getMass() { return mass; } @@ -317,7 +323,7 @@ public final class dAtomDefinition extends cElementalDefinition { } @Override - public float getRawTimeSpan(long currentEnergy) { + public double getRawTimeSpan(long currentEnergy) { if(currentEnergy<=0) { return rawLifeTime; } @@ -346,9 +352,9 @@ public final class dAtomDefinition extends cElementalDefinition { boolean negative = this.element < 0; try { if (Math.abs(type) != 1) { - return (negative ? "~? " : "? ") + nomenclature.Name[element]; + return (negative ? "~? " : "? ") + Nomenclature.NAME[element]; } - return negative ? '~' + nomenclature.Name[element] : nomenclature.Name[element]; + return negative ? '~' + Nomenclature.NAME[element] : Nomenclature.NAME[element]; } catch (Exception e) { if (DEBUG_MODE) { e.printStackTrace(); @@ -362,14 +368,14 @@ public final class dAtomDefinition extends cElementalDefinition { int element = Math.abs(this.element); boolean negative = this.element < 0; try { - return (negative ? "~" : "") + nomenclature.Symbol[element] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C:" + getCharge(); + 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(); + return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C:" + getCharge(); } catch (Exception E) { if (DEBUG_MODE) { e.printStackTrace(); @@ -384,14 +390,14 @@ public final class dAtomDefinition extends cElementalDefinition { int element = Math.abs(this.element); boolean negative = this.element < 0; try { - return (negative ? "~" : "") + nomenclature.Symbol[element]; + 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]; + return (negative ? "~" : "") + Nomenclature.SYMBOL_IUPAC[10 + s100] + Nomenclature.SYMBOL_IUPAC[s10] + Nomenclature.SYMBOL_IUPAC[s1]; } catch (Exception E) { if (DEBUG_MODE) { e.printStackTrace(); @@ -412,7 +418,7 @@ public final class dAtomDefinition extends cElementalDefinition { return getDecayArray(decaysList,decayMode,true); } - private cElementalDecay[] getDecayArray(ArrayList<cElementalDecay> decaysList,int decayMode,boolean tryAnti) { + private cElementalDecay[] getDecayArray(ArrayList<cElementalDecay> decaysList,int decayMode,boolean tryAnti) {//todo? if (type == 1) { switch (decayMode) { case -2: @@ -981,14 +987,13 @@ public final class dAtomDefinition extends cElementalDefinition { 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; } + return true; } //break; case "IT+EC+B+": { if (withThis.removeAllAmounts(false, dHadronDefinition.hadron_p2,eLeptonDefinition.lepton_e1)){ @@ -1022,7 +1027,7 @@ public final class dAtomDefinition extends cElementalDefinition { 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)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), emit)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1037,7 +1042,7 @@ public final class dAtomDefinition extends cElementalDefinition { 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)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), alpha)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1053,7 +1058,7 @@ public final class dAtomDefinition extends cElementalDefinition { 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)); + decaysList.add(new cElementalDecay(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) { @@ -1069,7 +1074,7 @@ public final class dAtomDefinition extends cElementalDefinition { 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)); + decaysList.add(new cElementalDecay(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) { @@ -1085,7 +1090,7 @@ public final class dAtomDefinition extends cElementalDefinition { 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)); + decaysList.add(new cElementalDecay(1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_optimized_unsafeLeavesExposedElementalTree()), 1), eNeutrinoDefinition.lepton_Ve1)); return true; } catch (Exception e) { if (DEBUG_MODE) { @@ -1096,7 +1101,7 @@ public final class dAtomDefinition extends cElementalDefinition { return false; } - private boolean Fission(ArrayList<cElementalDecay> decaysList, cElementalMutableDefinitionStackMap fissile, cElementalMutableDefinitionStackMap particles,float probability,boolean spontaneousCheck) { + private boolean Fission(ArrayList<cElementalDecay> decaysList, cElementalMutableDefinitionStackMap fissile, cElementalMutableDefinitionStackMap particles,double probability,boolean spontaneousCheck) { cElementalMutableDefinitionStackMap heavy = new cElementalMutableDefinitionStackMap(); double[] liquidDrop= liquidDropFunction(Math.abs(element)<=97); @@ -1124,7 +1129,7 @@ public final class dAtomDefinition extends cElementalDefinition { //} }else{ int heavy_cnt=(int)Math.ceil(stack.amount*liquidDrop[0]); - if(heavy_cnt%2==1 && XSTR_INSTANCE.nextFloat()>0.05f) { + if(heavy_cnt%2==1 && XSTR_INSTANCE.nextDouble()>0.05D) { heavy_cnt--; } cElementalDefinitionStack new_stack=new cElementalDefinitionStack(stack.definition, heavy_cnt); @@ -1198,9 +1203,9 @@ public final class dAtomDefinition extends cElementalDefinition { } @Override - public float getEnergyDiffBetweenStates(long currentEnergyLevel,long newEnergyLevel) { + public double getEnergyDiffBetweenStates(long currentEnergyLevel,long newEnergyLevel) { if(iaeaDefinitionExistsAndHasEnergyLevels){ - float result=0; + double result=0; boolean backwards=newEnergyLevel<currentEnergyLevel; if(backwards){ long temp=currentEnergyLevel; @@ -1278,7 +1283,7 @@ public final class dAtomDefinition extends cElementalDefinition { decaysInto.add(new cElementalDefinitionStack(boson_Y__, 2)); } } - return new cElementalDecay[]{new cElementalDecay(0.75F, decaysInto.toArray(new cElementalDefinitionStack[0])), deadEnd}; + return new cElementalDecay[]{new cElementalDecay(0.75D, decaysInto.toArray(new cElementalDefinitionStack[0])), deadEnd}; } //@Override @@ -1314,23 +1319,23 @@ public final class dAtomDefinition extends cElementalDefinition { @Override public aFluidDequantizationInfo someAmountIntoFluidStack() { - return transformation.fluidDequantization.get(this); + return TRANSFORMATION_INFO.fluidDequantization.get(this); } @Override public aItemDequantizationInfo someAmountIntoItemsStack() { - return null; + return TRANSFORMATION_INFO.itemDequantization.get(this); } @Override public aOredictDequantizationInfo someAmountIntoOredictStack() { - return transformation.oredictDequantization.get(this); + return TRANSFORMATION_INFO.oredictDequantization.get(this); } - private static final class nomenclature { - private static final String[] Symbol = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; - private static final String[] Name = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; - private static final String[] SymbolIUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; + private static final class Nomenclature { + private static final String[] SYMBOL = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; + private static final String[] NAME = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; + private static final String[] SYMBOL_IUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; } @Override @@ -1358,7 +1363,7 @@ public final class dAtomDefinition extends cElementalDefinition { r.run(); } - for(Map.Entry<dAtomDefinition,Float> entry:lifetimeOverrides.entrySet()){ + for(Map.Entry<dAtomDefinition,Double> entry:lifetimeOverrides.entrySet()){ try { lifetimeOverrides.put(new dAtomDefinition(entry.getKey().elementalStacks), entry.getValue()); }catch (tElementalException e){ @@ -1375,7 +1380,7 @@ public final class dAtomDefinition extends cElementalDefinition { int StableIsotope = stableIzoCurve(element); int izoDiff = isotope - StableIsotope; int izoDiffAbs = Math.abs(izoDiff); - float rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); iaeaNuclide nuclide = iaeaNuclide.get(element, isotope); if (rawLifeTime >= STABLE_RAW_LIFE_TIME || nuclide != null && nuclide.halfTime >= STABLE_RAW_LIFE_TIME) { TreeSet<Integer> isotopes = stableIsotopes.computeIfAbsent(element, k -> new TreeSet<>()); @@ -1392,8 +1397,8 @@ public final class dAtomDefinition extends cElementalDefinition { 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<>()); + double rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + TreeMap<Double, Integer> isotopes = mostStableUnstableIsotopes.computeIfAbsent(element, k -> new TreeMap<>()); isotopes.put(rawLifeTime, isotope); } } @@ -1408,7 +1413,7 @@ public final class dAtomDefinition extends cElementalDefinition { 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()) { + for (Map.Entry<Integer, TreeMap<Double, Integer>> integerTreeMapEntry : mostStableUnstableIsotopes.entrySet()) { unstableAtoms.put(integerTreeMapEntry.getKey(), new dAtomDefinition( new cElementalDefinitionStack(dHadronDefinition.hadron_p, integerTreeMapEntry.getKey()), new cElementalDefinitionStack(dHadronDefinition.hadron_n, integerTreeMapEntry.getValue().lastEntry().getValue()), @@ -1468,131 +1473,130 @@ public final class dAtomDefinition extends cElementalDefinition { 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); + refMass = getFirstStableIsotope(1).getMass() * AVOGADRO_CONSTANT_144; + + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(1), AVOGADRO_CONSTANT_144),Materials.Hydrogen.mGas,144); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(2), AVOGADRO_CONSTANT_144),Materials.Helium.mGas, 144); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(3), AVOGADRO_CONSTANT_144), dust, Materials.Lithium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(4), AVOGADRO_CONSTANT_144), dust, Materials.Beryllium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(5), AVOGADRO_CONSTANT_144), dust, Materials.Boron,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(6), AVOGADRO_CONSTANT_144), dust, Materials.Carbon,1); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(7), AVOGADRO_CONSTANT_144),Materials.Nitrogen.mGas, 144); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(8), AVOGADRO_CONSTANT_144),Materials.Oxygen.mGas, 144); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(9), AVOGADRO_CONSTANT_144),Materials.Fluorine.mGas, 144); + //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(10), AVOGADRO_CONSTANT_144),Materials.Neon.mGas.getID(), 144); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(11), AVOGADRO_CONSTANT_144), dust, Materials.Sodium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(12), AVOGADRO_CONSTANT_144), dust, Materials.Magnesium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(13), AVOGADRO_CONSTANT_144), dust, Materials.Aluminium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(14), AVOGADRO_CONSTANT_144), dust, Materials.Silicon,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(15), AVOGADRO_CONSTANT_144), dust, Materials.Phosphorus,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(16), AVOGADRO_CONSTANT_144), dust, Materials.Sulfur,1); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(17), AVOGADRO_CONSTANT_144),Materials.Argon.mGas, 144); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(19), AVOGADRO_CONSTANT_144), dust, Materials.Potassium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(20), AVOGADRO_CONSTANT_144), dust, Materials.Calcium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(21), AVOGADRO_CONSTANT_144), dust, Materials.Scandium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(22), AVOGADRO_CONSTANT_144), dust, Materials.Titanium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(23), AVOGADRO_CONSTANT_144), dust, Materials.Vanadium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(24), AVOGADRO_CONSTANT_144), dust, Materials.Chrome,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(25), AVOGADRO_CONSTANT_144), dust, Materials.Manganese,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(26), AVOGADRO_CONSTANT_144), dust, Materials.Iron,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(27), AVOGADRO_CONSTANT_144), dust, Materials.Cobalt,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(28), AVOGADRO_CONSTANT_144), dust, Materials.Nickel,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(29), AVOGADRO_CONSTANT_144), dust, Materials.Copper,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(30), AVOGADRO_CONSTANT_144), dust, Materials.Zinc,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(31), AVOGADRO_CONSTANT_144), dust, Materials.Gallium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(32), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Germanium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(33), AVOGADRO_CONSTANT_144), dust, Materials.Arsenic,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(34), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Selenium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(35), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Bromine,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(36), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Krypton,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(37), AVOGADRO_CONSTANT_144), dust, Materials.Rubidium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(38), AVOGADRO_CONSTANT_144), dust, Materials.Strontium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(39), AVOGADRO_CONSTANT_144), dust, Materials.Yttrium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(40), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Zirconium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(41), AVOGADRO_CONSTANT_144), dust, Materials.Niobium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(42), AVOGADRO_CONSTANT_144), dust, Materials.Molybdenum,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(43), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Technetium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(44), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Ruthenium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(45), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhodium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(46), AVOGADRO_CONSTANT_144), dust, Materials.Palladium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(47), AVOGADRO_CONSTANT_144), dust, Materials.Silver,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(48), AVOGADRO_CONSTANT_144), dust, Materials.Cadmium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(49), AVOGADRO_CONSTANT_144), dust, Materials.Indium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(50), AVOGADRO_CONSTANT_144), dust, Materials.Tin,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(51), AVOGADRO_CONSTANT_144), dust, Materials.Antimony,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(52), AVOGADRO_CONSTANT_144), dust, Materials.Tellurium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(53), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Iodine,1); + //transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(54), AVOGADRO_CONSTANT_144),Materials.Xenon.mGas.getID(), 144); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(55), AVOGADRO_CONSTANT_144), dust, Materials.Caesium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(56), AVOGADRO_CONSTANT_144), dust, Materials.Barium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(57), AVOGADRO_CONSTANT_144), dust, Materials.Lanthanum,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(58), AVOGADRO_CONSTANT_144), dust, Materials.Cerium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(59), AVOGADRO_CONSTANT_144), dust, Materials.Praseodymium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(60), AVOGADRO_CONSTANT_144), dust, Materials.Neodymium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(61), AVOGADRO_CONSTANT_144), dust, Materials.Promethium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(62), AVOGADRO_CONSTANT_144), dust, Materials.Samarium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(63), AVOGADRO_CONSTANT_144), dust, Materials.Europium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(64), AVOGADRO_CONSTANT_144), dust, Materials.Gadolinium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(65), AVOGADRO_CONSTANT_144), dust, Materials.Terbium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(66), AVOGADRO_CONSTANT_144), dust, Materials.Dysprosium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(67), AVOGADRO_CONSTANT_144), dust, Materials.Holmium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(68), AVOGADRO_CONSTANT_144), dust, Materials.Erbium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(69), AVOGADRO_CONSTANT_144), dust, Materials.Thulium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(70), AVOGADRO_CONSTANT_144), dust, Materials.Ytterbium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(71), AVOGADRO_CONSTANT_144), dust, Materials.Lutetium,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(72), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Hafnum,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(73), AVOGADRO_CONSTANT_144), dust, Materials.Tantalum,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(74), AVOGADRO_CONSTANT_144), dust, Materials.Tungsten,1); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(75), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Rhenium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(76), AVOGADRO_CONSTANT_144), dust, Materials.Osmium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(77), AVOGADRO_CONSTANT_144), dust, Materials.Iridium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(78), AVOGADRO_CONSTANT_144), dust, Materials.Platinum,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(79), AVOGADRO_CONSTANT_144), dust, Materials.Gold,1); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(80), AVOGADRO_CONSTANT_144),Materials.Mercury.mFluid, 144); + //transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Thallium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(82), AVOGADRO_CONSTANT_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); + refUnstableMass = getFirstStableIsotope(82).getMass() * AVOGADRO_CONSTANT_144; + + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(83), AVOGADRO_CONSTANT_144), dust, Materials.Bismuth,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Polonium,1); + //transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),AVOGADRO_CONSTANT_144),Materials.Astatine.mPlasma.getID(), 144); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86), AVOGADRO_CONSTANT_144),Materials.Radon.mGas, 144); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(87),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Francium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(88),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Radium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(89),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Actinium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(90), AVOGADRO_CONSTANT_144), dust, Materials.Thorium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(91),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Protactinium,1); + ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(92),AVOGADRO_CONSTANT_144), dust, Materials.Uranium,1); + //transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(93),AVOGADRO_CONSTANT_144),OrePrefixes.dust, Materials.Neptunium,1); + ////transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(94),AVOGADRO_CONSTANT_144), dust, Materials.Plutonium,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(95), AVOGADRO_CONSTANT_144), dust, Materials.Americium,1); try { dAtomDefinition temp; - transformation.addFluid(new cElementalDefinitionStack(deuterium.definition, 144),Materials.Deuterium.mGas.getID(), 144); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(deuterium.definition, AVOGADRO_CONSTANT_144),Materials.Deuterium.mGas, 144); - transformation.addFluid(new cElementalDefinitionStack(tritium.definition, 144),Materials.Tritium.mGas.getID(), 144); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(tritium.definition, AVOGADRO_CONSTANT_144),Materials.Tritium.mGas, 144); - transformation.addFluid(new cElementalDefinitionStack(helium_3.definition, 144),Materials.Helium_3.mGas.getID(), 144); + TRANSFORMATION_INFO.addFluid(new cElementalDefinitionStack(helium_3.definition, AVOGADRO_CONSTANT_144),Materials.Helium_3.mGas, 144); temp=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 146) ); - transformation.addOredict(new cElementalDefinitionStack(temp, 144), dust, Materials.Uranium/*238*/,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium/*238*/,1); - float tempMass=temp.getMass(); + double tempMass=temp.getMass(); temp=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 143) ); - transformation.addOredict(new cElementalDefinitionStack(temp, 144), dust, Materials.Uranium235,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Uranium235,1); TecTech.LOGGER.info("Diff Mass U : "+(tempMass-temp.getMass())); @@ -1601,14 +1605,14 @@ public final class dAtomDefinition extends cElementalDefinition { new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 145) ); - transformation.addOredict(new cElementalDefinitionStack(temp, 144), dust, Materials.Plutonium/*239*/,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(temp, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium/*239*/,1); somethingHeavy=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 147) ); - transformation.addOredict(new cElementalDefinitionStack(somethingHeavy, 144), dust, Materials.Plutonium241,1); + TRANSFORMATION_INFO.addOredict(new cElementalDefinitionStack(somethingHeavy, AVOGADRO_CONSTANT_144), dust, Materials.Plutonium241,1); TecTech.LOGGER.info("Diff Mass Pu: "+(somethingHeavy.getMass()-temp.getMass())); @@ -1664,7 +1668,7 @@ public final class dAtomDefinition extends cElementalDefinition { lines.add("SYMBOL = "+getSymbol()); } if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3f + " e"); + lines.add("CHARGE = " + getCharge() / 3D + " e"); } if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); 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 index 404f116adf..c5efaf1403 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/complex/dHadronDefinition.java @@ -1,7 +1,6 @@ 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; @@ -13,6 +12,7 @@ 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 com.github.technus.tectech.util.Util; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import net.minecraft.nbt.NBTTagCompound; @@ -21,11 +21,11 @@ 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.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.TRANSFORMATION_INFO; 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; @@ -42,17 +42,17 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi 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; + private static double protonMass = 0D; + private static double neutronMass = 0D; + private static final double actualProtonMass=938272081.3D; + private static final double actualNeutronMass=939565413.3D; //float-mass in eV/c^2 - public final float mass; + public final double mass; //int -electric charge in 1/3rds of electron charge for optimization public final int charge; - public final float rawLifeTime; - public final byte amount; + public final double rawLifeTime; + public final int amount; //generation max present inside - minus if contains any antiquark public final byte type; //private final FluidStack fluidThing; @@ -88,13 +88,16 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi } quarkStacks = quarks; - byte amount = 0; + int amount = 0; int charge = 0; int type = 0; boolean containsAnti = false; - float mass = 0; + double mass = 0; for (cElementalDefinitionStack quarkStack : quarkStacks.values()) { amount += quarkStack.amount; + if((int)quarkStack.amount!=quarkStack.amount){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } mass += quarkStack.getMass(); charge += quarkStack.getCharge(); type = Math.max(Math.abs(quarkStack.definition.getType()), type); @@ -105,22 +108,22 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi 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 + long mult = this.amount * this.amount * (this.amount - 1); + mass = mass * 5.543D * 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; + rawLifeTime = 882D; mass=actualNeutronMass; } else { if (this.amount == 3) { - rawLifeTime = 1.34F / mass * (float) Math.pow(9.81, charge); + rawLifeTime = 1.34D / mass * Math.pow(9.81, charge); } else if (this.amount == 2) { - rawLifeTime = 1.21F / mass / (float) Math.pow(19.80, charge); + rawLifeTime = 1.21D / mass / Math.pow(19.80, charge); } else { - rawLifeTime = 1.21F / mass / (float) Math.pow(9.80, charge); + rawLifeTime = 1.21D / mass / Math.pow(9.80, charge); } } this.mass=mass; @@ -134,6 +137,9 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi if (!(quarks.definition instanceof eQuarkDefinition)) { return false; } + if((int)quarks.amount!=quarks.amount){ + throw new ArithmeticException("Amount cannot be safely converted to int!"); + } amount += quarks.amount; } return amount >= 2 && amount <= 12; @@ -148,7 +154,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi name.append(' ').append(sym); }else { for (cElementalDefinitionStack quark : quarkStacks.values()) { - name.append(' ').append(quark.definition.getSymbol()).append(quark.amount); + name.append(' ').append(quark.definition.getSymbol()).append((int)quark.amount); } } return name.toString(); @@ -230,7 +236,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi } } return new cElementalDecay[]{ - new cElementalDecay(0.75F, decaysInto.toArray(new cElementalDefinitionStack[0])), + new cElementalDecay(0.75D, decaysInto.toArray(new cElementalDefinitionStack[0])), eBosonDefinition.deadEnd }; } @@ -241,11 +247,11 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi 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 + return new cElementalDecay[]{new cElementalDecay(0.75D, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks } @Override - public float getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { + public double getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); } @@ -272,10 +278,12 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi @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()) { + 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 + return new cElementalDecay[]{new cElementalDecay(0.95D, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks } else { ArrayList<eQuarkDefinition> newBaryon = new ArrayList<>(); iElementalDefinition[] Particles = new iElementalDefinition[2]; @@ -287,24 +295,22 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi //remove last eQuarkDefinition lastQuark = newBaryon.remove(2); + cElementalDefinitionStack[] decay; 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; + decay = lastQuark.getDecayArray()[1].outputStacks.values(); } else { - cElementalDefinitionStack[] decay = lastQuark.getDecayArray()[0].outputStacks.values(); - newBaryon.add((eQuarkDefinition) decay[0].definition); - Particles[0] = decay[1].definition; - Particles[1] = decay[2].definition; + decay = lastQuark.getDecayArray()[2].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__), + new cElementalDecay(0.001D, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1], boson_Y__), + new cElementalDecay(0.99D, new dHadronDefinition(false, contentOfBaryon), Particles[0], Particles[1]), eBosonDefinition.deadEnd}; } catch (tElementalException e) { if (DEBUG_MODE) { @@ -316,7 +322,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi } @Override - public float getMass() { + public double getMass() { return mass; } @@ -326,7 +332,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi } @Override - public float getRawTimeSpan(long currentEnergy) { + public double getRawTimeSpan(long currentEnergy) { return rawLifeTime; } @@ -437,13 +443,13 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi 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); + hadron_p1 = new cElementalDefinitionStack(hadron_p, 1D); + hadron_n1 = new cElementalDefinitionStack(hadron_n, 1D); + hadron_p2 = new cElementalDefinitionStack(hadron_p, 2D); + hadron_n2 = new cElementalDefinitionStack(hadron_n, 2D); + hadron_p3 = new cElementalDefinitionStack(hadron_p, 3D); + hadron_n3 = new cElementalDefinitionStack(hadron_n, 3D); + hadron_p5 = new cElementalDefinitionStack(hadron_p, 5D); try { cElementalDefinition.addCreatorFromNBT(nbtType, dHadronDefinition.class.getMethod("fromNBT", NBTTagCompound.class),(byte)-64); @@ -459,8 +465,8 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi public static void setTransformations(){ //Added to atom map, but should be in its own - cElementalDefinitionStack neutrons=new cElementalDefinitionStack(hadron_n, 100000); - transformation.oredictDequantization.put(neutrons.definition,new aOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1)); + cElementalDefinitionStack neutrons=new cElementalDefinitionStack(hadron_n, 1000* AVOGADRO_CONSTANT_144); + TRANSFORMATION_INFO.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) @@ -498,7 +504,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi //lines.add("SYMBOL = "+getSymbol()); } if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)) { - lines.add("CHARGE = " + getCharge() / 3f + " e"); + lines.add("CHARGE = " + getCharge() / 3D + " e"); } if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)) { lines.add(getColor() < 0 ? "COLORLESS" : "CARRIES COLOR"); 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/iaeaNuclide.java index 8b54bdd306..8b09bfd2e0 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/iaeaNuclide.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; @@ -10,6 +8,7 @@ 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.util.Util.splitButDifferent; public final class iaeaNuclide { public static final double AMU_TO_EV_DIV_C_C=9.31494061E08D,MICRO_AMU_TO_EV_DIV_C_C=9.31494061E02D; @@ -28,7 +27,7 @@ public final class iaeaNuclide { BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.class.getResourceAsStream("nuclides.csv"))); ArrayList<String[]> blockOfData=new ArrayList<>(4); while((line=reader.readLine())!=null) { - String[] split= Util.splitButDifferent(line,","); + String[] split= splitButDifferent(line,","); if(split.length!=19) { throw new Error("Invalid count (" + split.length + ") of separators in IAEA nuclides database " + line); } @@ -51,9 +50,9 @@ public final class iaeaNuclide { try { BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.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); } @@ -66,7 +65,7 @@ public final class iaeaNuclide { try { BufferedReader reader = new BufferedReader(new InputStreamReader(iaeaNuclide.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); } @@ -88,10 +87,10 @@ public final class iaeaNuclide { } public final short N,Z; - public final float halfTime;//sec - public final float mass;//eV/c^2 + public final double halfTime;//sec + public final double mass;//eV/c^2 public final short discovery;//year - private TreeMap<Float,energeticState> energeticStates; + private TreeMap<Double,energeticState> energeticStates; public energeticState[] energeticStatesArray; @@ -100,14 +99,14 @@ public final class iaeaNuclide { Z=Short.parseShort(rows[1][0]); NUCLIDES.put(((int)Z <<16)+N,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 +114,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,7 +125,13 @@ 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, halfTime, getDecaysFixed( + cells[14], + doubleOrNaN(cells[15],"chance1"), + cells[17], + doubleOrNaN(cells[18],"chance1"), + cells[20], + doubleOrNaN(cells[21],"chance1"))); } private static final energeticState[] empty=new energeticState[0]; @@ -135,6 +140,14 @@ public final class iaeaNuclide { energeticStatesArray = empty; } else { energeticStatesArray = energeticStates.values().toArray(new energeticState[0]); + double life=halfTime; + for (energeticState energeticState : energeticStatesArray) { + if(Double.isNaN(energeticState.Thalf)){ + energeticState.Thalf=life; + }else { + life=energeticState.Thalf; + } + } } } @@ -156,11 +169,11 @@ public final class iaeaNuclide { } 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(iaeaNuclide nuclide,double Thalf,iaeaDecay[] decaymodes){ energy=0; this.Thalf=Thalf; this.decaymodes=decaymodes; @@ -175,11 +188,11 @@ public final class iaeaNuclide { 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]); } - 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(); nuclide.energeticStates = new TreeMap<>(); @@ -190,7 +203,13 @@ 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){ @@ -231,40 +250,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 +296,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/primitive/cPrimitiveDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/definitions/primitive/cPrimitiveDefinition.java index a09fc60835..a3efe12b7e 100644 --- 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 @@ -9,13 +9,13 @@ import static com.github.technus.tectech.mechanics.elementalMatter.core.cElement */ 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); + nbtE__ = new cPrimitiveDefinition("NBT ERROR", "!", 0, 0D, Integer.MIN_VALUE, Integer.MIN_VALUE+10_000), + null__ = new cPrimitiveDefinition("NULL POINTER", ".", 0, 0D, -3, Integer.MAX_VALUE-10_000), + space__ = new cPrimitiveDefinition("Space", "_", 0, 0D, -4, 0), + magic = new cPrimitiveDefinition("Magic", "Ma", 4, 1e5D, 0, 1), + magic_ = new cPrimitiveDefinition("Antimagic", "~Ma", -4, 1e5D, 0, 2); - private cPrimitiveDefinition(String name, String symbol, int type, float mass, int color, int ID) { + private cPrimitiveDefinition(String name, String symbol, int type, double mass, int color, int ID) { super(name, symbol, type, mass, 0, color, ID); } 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 index 3f314151f3..9a82cdd6c0 100644 --- 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 @@ -4,28 +4,32 @@ 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; +import static com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition.*; + /** * Created by danie_000 on 22.10.2016. */ public final class eBosonDefinition extends cElementalPrimitive { public static final eBosonDefinition - boson_Y__ = new eBosonDefinition("Photon", "\u03b3", 1e-18F, -1, 27), - boson_H__ = new eBosonDefinition("Higgs", "\u0397", 126.09e9F, -2, 28); + boson_Y__ = new eBosonDefinition("Photon", "\u03b3", 1e-18D, -1, 27), + boson_H__ = new eBosonDefinition("Higgs", "\u0397", 126.09e9D, -2, 28); //deadEnd public static final cElementalDecay deadEnd = new cElementalDecay(boson_Y__, boson_Y__); public static final cElementalDecay deadEndHalf = new cElementalDecay(boson_Y__); public static final cElementalDefinitionStack boson_Y__1=new cElementalDefinitionStack(boson_Y__,1); - private eBosonDefinition(String name, String symbol, float mass, int color, int ID) { + private eBosonDefinition(String name, String symbol, double mass, int color, int ID) { super(name, symbol, 0, mass, 0, color, ID); } public static void run() { - boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, 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_), + boson_Y__.init(null, NO_DECAY_RAW_LIFE_TIME, -1, -1, noDecay); + boson_H__.init(null, 1.56e-22D, 2, 2, + new cElementalDecay(0.01D, quark_b, quark_b_), + new cElementalDecay(0.02D, lepton_t, lepton_t_), + new cElementalDecay(0.96D, new cElementalDefinitionStack(boson_Y__, 4)), deadEnd); } 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 index 20132e2095..1e3b7189a8 100644 --- 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 @@ -4,24 +4,28 @@ 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; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.boson_Y__; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition.*; + /** * Created by danie_000 on 22.10.2016. */ public final class eLeptonDefinition extends cElementalPrimitive { public static final eLeptonDefinition - lepton_e = new eLeptonDefinition("Electron", "\u03b2-", 1, 0.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); + lepton_e = new eLeptonDefinition("Electron", "\u03b2-", 1, 0.511e6D, -3, 15), + lepton_m = new eLeptonDefinition("Muon", "\u03bc-", 2, 105.658e6D, -3, 17), + lepton_t = new eLeptonDefinition("Tauon", "\u03c4-", 3, 1776.83e6D, -3, 19), + lepton_e_ = new eLeptonDefinition("Positron", "\u03b2+", -1, 0.511e6D, 3, 16), + lepton_m_ = new eLeptonDefinition("Antimuon", "\u03bc+", -2, 105.658e6D, 3, 18), + lepton_t_ = new eLeptonDefinition("Antitauon", "\u03c4+", -3, 1776.83e6D, 3, 20); public static final cElementalDefinitionStack lepton_e1 = new cElementalDefinitionStack(lepton_e, 1); public static final cElementalDefinitionStack lepton_e2 = new cElementalDefinitionStack(lepton_e, 2); public static final cElementalDefinitionStack lepton_e_1 = new cElementalDefinitionStack(lepton_e_, 1); public static final cElementalDefinitionStack lepton_e_2 = new cElementalDefinitionStack(lepton_e_, 2); - private eLeptonDefinition(String name, String symbol, int type, float mass, int charge, int ID) { + private eLeptonDefinition(String name, String symbol, int type, double mass, int charge, int ID) { super(name, symbol, type, mass, charge, -1, ID); //this.itemThing=null; //this.fluidThing=null; @@ -29,28 +33,28 @@ public final class eLeptonDefinition extends cElementalPrimitive { 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 + deadEnd, + new cElementalDecay(lepton_e,boson_Y__)); + lepton_m.init(lepton_m_, 2.197019e-6D, 0, 1, + new cElementalDecay(0.9D, lepton_e, lepton_Ve_, lepton_Vm), + deadEnd);//makes photons and don't care + lepton_t.init(lepton_t_, 2.906e-13D, 1, 3, + new cElementalDecay(0.05F, lepton_m, lepton_Vm_, lepton_Vt, boson_H__), + new cElementalDecay(0.1D, lepton_e, lepton_Ve_, lepton_Vm), + new cElementalDecay(0.8D, lepton_m, lepton_Vm_, lepton_Vt, boson_Y__), + deadEnd);//makes photons and don't care lepton_e_.init(lepton_e, STABLE_RAW_LIFE_TIME, 0, 1, - eBosonDefinition.deadEnd,//makes photons and don't care - new cElementalDecay(lepton_e_, eBosonDefinition.boson_Y__)); + deadEnd, + new cElementalDecay(lepton_e,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 + new cElementalDecay(0.9F, lepton_e_, lepton_Ve, lepton_Vm_), + deadEnd);//makes photons and don't care lepton_t_.init(lepton_t, 2.906e-13F, 1, 3, - new cElementalDecay(0.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 + new cElementalDecay(0.05F, lepton_m_, lepton_Vm, lepton_Vt_, boson_H__), + new cElementalDecay(0.1F, lepton_e_, lepton_Ve, lepton_Vm_), + new cElementalDecay(0.8F, lepton_m_, lepton_Vm, lepton_Vt_, boson_Y__), + deadEnd);//makes photons and don't care } @Override 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 index 5f6a4a7b5e..c55e7f6364 100644 --- 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 @@ -4,45 +4,47 @@ 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; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eBosonDefinition.*; + /** * Created by danie_000 on 22.10.2016. */ public final class eNeutrinoDefinition extends cElementalPrimitive { public static final eNeutrinoDefinition - lepton_Ve = new eNeutrinoDefinition("Electron neutrino", "\u03bd\u03b2", 1, 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); + lepton_Ve = new eNeutrinoDefinition("Electron neutrino", "\u03bd\u03b2", 1, 2e0D, 21), + lepton_Vm = new eNeutrinoDefinition("Muon neutrino", "\u03bd\u03bc", 2, 0.15e6D, 23), + lepton_Vt = new eNeutrinoDefinition("Tauon neutrino", "\u03bd\u03c4", 3, 15e6D, 25), + lepton_Ve_ = new eNeutrinoDefinition("Positron neutrino", "~\u03bd\u03b2", -1, 2e0D, 22), + lepton_Vm_ = new eNeutrinoDefinition("Antimuon neutrino", "~\u03bd\u03bc", -2, 0.15e6D, 24), + lepton_Vt_ = new eNeutrinoDefinition("Antitauon neutrino", "~\u03bd\u03c4", -3, 15e6D, 26); public static final cElementalDefinitionStack lepton_Ve1 = new cElementalDefinitionStack(lepton_Ve, 1); public static final cElementalDefinitionStack lepton_Ve2 = new cElementalDefinitionStack(lepton_Ve, 2); public static final cElementalDefinitionStack lepton_Ve_1 = new cElementalDefinitionStack(lepton_Ve_, 1); public static final cElementalDefinitionStack lepton_Ve_2 = new cElementalDefinitionStack(lepton_Ve_, 2); - private eNeutrinoDefinition(String name, String symbol, int type, float mass, int ID) { + private eNeutrinoDefinition(String name, String symbol, int type, double mass, int ID) { super(name, symbol, type, mass, 0, -1, ID); } public static void run() { - lepton_Ve.init(lepton_Ve_, 1F, -1, -1, + lepton_Ve.init(lepton_Ve_, 1D, -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, + lepton_Vm.init(lepton_Vm_, 1D, 1, 0, + new cElementalDecay(0.825D, nothing), + deadEndHalf); + lepton_Vt.init(lepton_Vt_, 1, 1, 0, new cElementalDecay(0.75F, nothing), - eBosonDefinition.deadEnd); + deadEnd); - lepton_Ve_.init(lepton_Ve, 1F, -1, -1, + lepton_Ve_.init(lepton_Ve, 1, -1, -1, cElementalDecay.noProduct); - lepton_Vm_.init(lepton_Vm, 1F, 1, 0, + lepton_Vm_.init(lepton_Vm, 1, 1, 0, new cElementalDecay(0.825F, nothing), - eBosonDefinition.deadEndHalf); - lepton_Vt_.init(lepton_Vt, 1F, 1, 0, + deadEndHalf); + lepton_Vt_.init(lepton_Vt, 1, 1, 0, new cElementalDecay(0.75F, nothing), - eBosonDefinition.deadEnd); + deadEnd); } @Override 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 index be6879d435..9e5b2e66bb 100644 --- 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 @@ -3,91 +3,94 @@ package com.github.technus.tectech.mechanics.elementalMatter.definitions.primiti import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalPrimitive; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eLeptonDefinition.*; +import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eNeutrinoDefinition.*; + /** * Created by danie_000 on 22.10.2016. */ public final class eQuarkDefinition extends cElementalPrimitive { public static final eQuarkDefinition - quark_u = new eQuarkDefinition("Up", "u", 1, 2.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); + quark_u = new eQuarkDefinition("Up", "u", 1, 2.3e6D, 2, 3), + quark_c = new eQuarkDefinition("Charm", "c", 2, 1.29e9D, 2, 9), + quark_t = new eQuarkDefinition("Top", "t", 3, 172.44e9D, 2, 13), + quark_d = new eQuarkDefinition("Down", "d", 1, 4.8e6D, -1, 5), + quark_s = new eQuarkDefinition("Strange", "s", 2, 95e6D, -1, 7), + quark_b = new eQuarkDefinition("Bottom", "b", 3, 4.65e9D, -1, 11), + quark_u_ = new eQuarkDefinition("AntiUp", "~u", -1, 2.3e6D, -2, 4), + quark_c_ = new eQuarkDefinition("AntiCharm", "~c", -2, 1.29e9D, -2, 10), + quark_t_ = new eQuarkDefinition("AntiTop", "~t", -3, 172.44e9D, -2, 14), + quark_d_ = new eQuarkDefinition("AntiDown", "~d", -1, 4.8e6D, 1, 6), + quark_s_ = new eQuarkDefinition("AntiStrange", "~s", -2, 95e6D, 1, 8), + quark_b_ = new eQuarkDefinition("AntiBottom", "~b", -3, 4.65e9D, 1, 12); - private eQuarkDefinition(String name, String symbol, int type, float mass, int charge, int ID) { + private eQuarkDefinition(String name, String symbol, int type, double mass, int charge, int ID) { super(name, symbol, type, mass, charge, 0, ID); } public static void run() { quark_u.init(quark_u_, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(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*/), + new cElementalDecay(1.23201e-5D, quark_b/*,lepton_t_,lepton_Vt*/), + new cElementalDecay(0.050778116D, quark_s/*,lepton_m_,lepton_Vm*/), + new cElementalDecay(0.9D, quark_d, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care - quark_c.init(quark_c_, 0.5e-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*/), + quark_c.init(quark_c_, 0.5e-13D, 1, -1, + new cElementalDecay(0.00169744D, quark_b/*,lepton_t_,lepton_Vt*/), + new cElementalDecay(0.05071504D, quark_d, lepton_m_, lepton_Vm), + new cElementalDecay(0.9D, quark_s, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care - quark_t.init(quark_t_, 2.5e-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), + quark_t.init(quark_t_, 2.5e-26D, 0, -1, + new cElementalDecay(7.51689e-5D, quark_d, lepton_t_, lepton_Vt), + new cElementalDecay(0.00163216D, quark_s, lepton_m_, lepton_Vm), + new cElementalDecay(0.9D, quark_b, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care quark_d.init(quark_d_, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(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_*/), + new cElementalDecay(7.51689e-5D, quark_t/*,lepton_t,lepton_Vt_*/), + new cElementalDecay(0.05071504D, quark_c/*,lepton_m,lepton_Vm_*/), + new cElementalDecay(0.9D, quark_u, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care - quark_s.init(quark_s_, 0.6e-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_*/), + quark_s.init(quark_s_, 0.6e-9D, 1, -1, + new cElementalDecay(0.00163216D, quark_t/*,lepton_t,lepton_Vt_*/), + new cElementalDecay(0.050778116D, quark_u, lepton_m, lepton_Vm_), + new cElementalDecay(0.9D, quark_c, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care - quark_b.init(quark_b_, 0.7e-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_), + quark_b.init(quark_b_, 0.7e-13D, 0, -1, + new cElementalDecay(1.23201e-5D, quark_u, lepton_t, lepton_Vt_), + new cElementalDecay(0.00169744D, quark_c, lepton_m, lepton_Vm_), + new cElementalDecay(0.9D, quark_t, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care quark_u_.init(quark_u, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(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_*/), + new cElementalDecay(1.23201e-5D, quark_b_/*,lepton_t,lepton_Vt_*/), + new cElementalDecay(0.050778116D, quark_s_/*,lepton_m,lepton_Vm_*/), + new cElementalDecay(0.9D, quark_d_, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care - quark_c_.init(quark_c, 0.5e-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_), + quark_c_.init(quark_c, 0.5e-13D, 1, -1, new cElementalDecay(0.00169744F, quark_b_/*,lepton_t,lepton_Vt_*/), + new cElementalDecay(0.05071504F, quark_d_, lepton_m, lepton_Vm_), + new cElementalDecay(0.9F, quark_s_, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care - quark_t_.init(quark_t, 2.5e-26F, 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_), + quark_t_.init(quark_t, 2.5e-26F, 0, -1, + new cElementalDecay(7.51689e-5F, quark_d_, lepton_t, lepton_Vt_), + new cElementalDecay(0.00163216F, quark_s_, lepton_m, lepton_Vm_), + new cElementalDecay(0.9F, quark_b_, lepton_e, lepton_Ve_), eBosonDefinition.deadEnd);//makes photons and don't care quark_d_.init(quark_d, STABLE_RAW_LIFE_TIME, 3, -1, - new cElementalDecay(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*/), + new cElementalDecay(0.05071504F, quark_c_/*,lepton_m_,lepton_Vm*/), + new cElementalDecay(0.9F, quark_u_, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care quark_s_.init(quark_s, 0.6e-9F, 1, -1, - new cElementalDecay(0.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*/), + new cElementalDecay(0.050778116F, quark_u_, lepton_m_, lepton_Vm), + new cElementalDecay(0.9F, quark_c_, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care - quark_b_.init(quark_b, 0.7e-13F, 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), + quark_b_.init(quark_b, 0.7e-13F, 0, -1, + new cElementalDecay(1.23201e-5F, quark_u_, lepton_t_, lepton_Vt), + new cElementalDecay(0.00169744F, quark_c_, lepton_m_, lepton_Vm), + new cElementalDecay(0.9F, quark_t_, lepton_e_, lepton_Ve), eBosonDefinition.deadEnd);//makes photons and don't care } 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..58caed7951 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,11 @@ -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 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; @@ -71,12 +72,14 @@ public class RendererMessage implements IMessage { 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..e31e63f250 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,57 @@ -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.github.technus.tectech.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/structure/IBlockPosConsumer.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockPosConsumer.java new file mode 100644 index 0000000000..c3ea2d3e3f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IBlockPosConsumer.java @@ -0,0 +1,7 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.world.World; + +public interface IBlockPosConsumer { + void consume(World world, int x, int y, int z); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomBlockSetting.java b/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomBlockSetting.java new file mode 100644 index 0000000000..b70e76fbac --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/ICustomBlockSetting.java @@ -0,0 +1,17 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.block.Block; +import net.minecraft.world.World; + +public interface ICustomBlockSetting { + /** + * Default block setting calls {@link World#setBlock(int x, int y, int z, Block block, int meta, int updateType)} like: + * {@code world.setBlock(x,y,z,this/block,meta,2)} where updateType 2 means to update lighting and stuff + * @param world world that should be affected + * @param x x position to set + * @param y y position to set + * @param z z position to set + * @param meta required meta + */ + void setBlock(World world, int x, int y, int z, int meta); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java new file mode 100644 index 0000000000..c8488d5cea --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureDefinition.java @@ -0,0 +1,167 @@ +package com.github.technus.tectech.mechanics.structure; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +import java.util.Arrays; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; + +public interface IStructureDefinition<T> { + /** + * Used internally + * @param name same name as for other methods here + * @return the array of elements to process + */ + IStructureElement<T>[] getStructureFor(String name); + + default boolean check(T object,String piece, World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC, + boolean forceCheckAllBlocks){ + return iterate(object, null, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, + basePositionA, basePositionB, basePositionC,false,forceCheckAllBlocks); + } + + default boolean hints(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC) { + return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, + basePositionA, basePositionB, basePositionC,true,null); + } + + default boolean build(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC) { + return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, + basePositionA, basePositionB, basePositionC,false,null); + } + + default boolean buildOrHints(T object, ItemStack trigger,String piece, World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC, + boolean hintsOnly){ + return iterate(object, trigger, getStructureFor(piece), world, extendedFacing, basePositionX, basePositionY, basePositionZ, + basePositionA, basePositionB, basePositionC,hintsOnly,null); + } + + static <T> boolean iterate(T object, ItemStack trigger, IStructureElement<T>[] elements, World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC, + boolean hintsOnly, Boolean checkBlocksIfNotNullForceCheckAllIfTrue){ + if(world.isRemote ^ hintsOnly){ + return false; + } + + //change base position to base offset + basePositionA=-basePositionA; + basePositionB=-basePositionB; + basePositionC=-basePositionC; + + int[] abc = new int[]{basePositionA,basePositionB,basePositionC}; + int[] xyz = new int[3]; + + if(checkBlocksIfNotNullForceCheckAllIfTrue!=null){ + if(checkBlocksIfNotNullForceCheckAllIfTrue){ + for (IStructureElement<T> element : elements) { + if(element.isNavigating()) { + abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); + abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); + }else { + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ + if(DEBUG_MODE){ + TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] failed @ "+ + Arrays.toString(xyz)+" "+Arrays.toString(abc)); + } + return false; + } + } else { + if(DEBUG_MODE){ + TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] !blockExists @ "+ + Arrays.toString(xyz)+" "+Arrays.toString(abc)); + } + return false; + } + abc[0]+=1; + } + } + } else { + for (IStructureElement<T> element : elements) { + if(element.isNavigating()) { + abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); + abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); + }else { + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + if(!element.check(object, world, xyz[0], xyz[1], xyz[2])){ + if(DEBUG_MODE){ + TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] failed @ "+ + Arrays.toString(xyz)+" "+Arrays.toString(abc)); + } + return false; + } + } else { + if(DEBUG_MODE){ + TecTech.LOGGER.info("Multi ["+basePositionX+", "+basePositionY+", "+basePositionZ+"] !blockExists @ "+ + Arrays.toString(xyz)+" "+Arrays.toString(abc)); + } + } + abc[0]+=1; + } + } + } + }else { + if(hintsOnly) { + for (IStructureElement<T> element : elements) { + if(element.isNavigating()) { + abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); + abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); + }else { + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + + element.spawnHint(object, world, xyz[0], xyz[1], xyz[2], trigger); + + abc[0]+=1; + } + } + } else { + for (IStructureElement<T> element : elements) { + if(element.isNavigating()) { + abc[0] = (element.resetA() ? basePositionA : abc[0]) + element.getStepA(); + abc[1] = (element.resetB() ? basePositionB : abc[1]) + element.getStepB(); + abc[2] = (element.resetC() ? basePositionC : abc[2]) + element.getStepC(); + }else { + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += basePositionX; + xyz[1] += basePositionY; + xyz[2] += basePositionZ; + + if (world.blockExists(xyz[0], xyz[1], xyz[2])) { + element.placeBlock(object, world, xyz[0], xyz[1], xyz[2], trigger); + } + abc[0]+=1; + } + } + } + } + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java new file mode 100644 index 0000000000..f946e71f91 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElement.java @@ -0,0 +1,43 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * Use StructureUtility to instantiate + */ +public interface IStructureElement<T> { + boolean check(T t,World world,int x,int y,int z); + + boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger); + + boolean placeBlock(T t,World world,int x,int y,int z, ItemStack trigger); + + default int getStepA(){ + return 1; + } + + default int getStepB(){ + return 0; + } + + default int getStepC(){ + return 0; + } + + default boolean resetA(){ + return false; + } + + default boolean resetB(){ + return false; + } + + default boolean resetC(){ + return false; + } + + default boolean isNavigating(){ + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java new file mode 100644 index 0000000000..f9593ee1c5 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementChain.java @@ -0,0 +1,41 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * Use StructureUtility to instantiate + */ +public interface IStructureElementChain<T> extends IStructureElement<T> { + IStructureElement<T>[] fallbacks(); + + @Override + default boolean check(T t, World world, int x, int y, int z){ + for (IStructureElement<T> fallback : fallbacks()) { + if (fallback.check(t, world, x, y, z)) { + return true; + } + } + return false; + } + + @Override + default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + for (IStructureElement<T> fallback : fallbacks()) { + if (fallback.spawnHint(t, world, x, y, z, trigger)) { + return true; + } + } + return false; + } + + @Override + default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + for (IStructureElement<T> fallback : fallbacks()) { + if (fallback.placeBlock(t, world, x, y, z, trigger)) { + return true; + } + } + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java new file mode 100644 index 0000000000..ec15aea53b --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementCheckOnly.java @@ -0,0 +1,16 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public interface IStructureElementCheckOnly<T> extends IStructureElement<T> { + @Override + default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger){ + return false; + } + + @Override + default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger){ + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java new file mode 100644 index 0000000000..dbb74312a8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementDeferred.java @@ -0,0 +1,7 @@ +package com.github.technus.tectech.mechanics.structure; + +/** + * Use StructureUtility to instantiate + */ +public interface IStructureElementDeferred<T> extends IStructureElement<T> { +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java new file mode 100644 index 0000000000..47e6060878 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureElementNoPlacement.java @@ -0,0 +1,11 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public interface IStructureElementNoPlacement<T> extends IStructureElement<T> { + @Override + default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger){ + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java new file mode 100644 index 0000000000..d3f4134cea --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/IStructureNavigate.java @@ -0,0 +1,28 @@ +package com.github.technus.tectech.mechanics.structure; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * Use StructureUtility to instantiate + */ +interface IStructureNavigate<T> extends IStructureElement<T> { + @Override + default boolean check(T t, World world, int x, int y, int z){ + return true; + } + + @Override + default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return true; + } + + @Override + default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return true; + } + + default boolean isNavigating(){ + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java new file mode 100644 index 0000000000..83951372a2 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/Structure.java @@ -0,0 +1,262 @@ +package com.github.technus.tectech.mechanics.structure; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.thing.casing.TT_Container_Casings; +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.init.Blocks; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; + +@Deprecated +public class Structure { + private Structure() { + } + + @Deprecated + @SafeVarargs + public static <T> IHatchAdder<T>[] adders(IHatchAdder<T>... iHatchAdder) { + return iHatchAdder; + } + + //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller + //This only checks for REGULAR BLOCKS! + @Deprecated + public static <T extends IMetaTileEntity> boolean checker( + 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<T>[] 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, + T metaTile, + ExtendedFacing extendedFacing, + boolean forceCheck) { + IGregTechTileEntity aBaseMetaTileEntity = metaTile.getBaseMetaTileEntity(); + World world = aBaseMetaTileEntity.getWorld(); + if (world.isRemote) { + return false; + } + //TE Rotation + if (extendedFacing == null) { + extendedFacing = ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())); + } + + IGregTechTileEntity igt; + + int[] xyz = new int[3]; + int[] abc = new int[3]; + int 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 + abc[2] = -depthOffset; + for (String[] _structure : structure) {//front to back + abc[1] = -verticalOffset; + for (String __structure : _structure) {//top to bottom + abc[0] = -horizontalOffset; + for (char block : __structure.toCharArray()) {//left to right + if (block < ' ') { + //Control chars allow skipping + abc[1] += block; + break; + } else if (block > '@') { + //characters allow to skip check A-1 skip, B-2 skips etc. + abc[0] += block - '@'; + }//else if (block < '+')//used to mark THINGS + // a++; + else if (block == '.') { + abc[0]++; + } else { + //get x y z from rotation + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += baseX; + xyz[1] += baseY; + xyz[2] += baseZ; + + //that must be here since in some cases other axis (b,c) controls y + if (xyz[1] < 0 || xyz[1] >= 256) { + return false; + } + + //Check block + if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded at this pos + switch (block) { + case '-'://must be air + if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() != Material.air) { + return false; + } + break; + case '+'://must not be air + if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() == Material.air) { + return false; + } + break; + default://check for block (countable) + Block worldblock = world.getBlock(xyz[0], xyz[1], xyz[2]); + int dmg = worldblock.getDamageValue(world, xyz[0], xyz[1], xyz[2]); + if ((pointer = block - '0') >= 0) { + //countable air -> net.minecraft.block.BlockAir + if (worldblock != blockType[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + worldblock.getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); + } + return false; + } + if (dmg != blockMeta[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + dmg + ' ' + blockMeta[pointer]); + } + return false; + } + } else if ((pointer = block - ' ') >= 0) { + igt = aBaseMetaTileEntity.getIGregTechTileEntity(xyz[0], xyz[1], xyz[2]); + if (igt == null || !addingMethods[pointer].apply(metaTile, igt, casingTextures[pointer])) { + if (worldblock != blockTypeFallback[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Fallback-struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + worldblock.getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); + } + return false; + } + if (dmg != blockMetaFallback[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + dmg + ' ' + blockMetaFallback[pointer]); + } + return false; + } + } + } + } + } else if (forceCheck) { + return false; + } + abc[0]++;//block in horizontal layer + } + } + abc[1]++;//horizontal layer + } + abc[2]++;//depth + } + return true; + } + + @Deprecated + public static boolean builder(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 tileEntity, ExtendedFacing extendedFacing, boolean hintsOnly) { + World world = tileEntity.getWorld(); + int baseX = tileEntity.getXCoord(); + int baseY = tileEntity.getYCoord(); + int baseZ = tileEntity.getZCoord(); + if (world == null || (!world.isRemote && hintsOnly)) { + return false; + } + + //TE Rotation + int[] xyz = new int[3]; + int[] abc = new int[3]; + int pointer; + + //a,b,c - relative to block face! + //x,y,z - relative to block position on map! + + //perform your duties + abc[2] = -depthOffset; + for (String[] _structure : structure) {//front to back + abc[1] = -verticalOffset; + for (String __structure : _structure) {//top to bottom + abc[0] = -horizontalOffset; + for (char block : __structure.toCharArray()) {//left to right + if (block < ' ') {//Control chars allow skipping + abc[1] += block; + break; + } + if (block > '@')//characters allow to skip check a-1 skip, b-2 skips etc. + { + abc[0] += block - '@'; + }//else if (block < '+')//used to mark THINGS + // a++; + else if (block == '.')// this TE + { + abc[0]++; + } else { + //get x y z from rotation + extendedFacing.getWorldOffset(abc, xyz); + xyz[0] += baseX; + xyz[1] += baseY; + xyz[2] += baseZ; + + //that must be here since in some cases other axis (b,c) controls y + if (xyz[1] < 0 || xyz[1] >= 256) { + return false; + } + + //Check block + if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded + if (hintsOnly) { + switch (block) { + case '-'://must be air + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 13); + break; + case '+'://must not be air + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 14); + break; + default: //check for block + if ((pointer = block - '0') >= 0) { + if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer] || blockType[pointer].getDamageValue(world, xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer]); + } + } else if ((pointer = block - ' ') >= 0) { + if (pointer < 12) { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, pointer); + } else { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 12); + } + } else { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 15); + } + } + } else { + switch (block) { + case '-'://must be air + world.setBlock(xyz[0], xyz[1], xyz[2], Blocks.air, 0, 2); + break; + case '+'://must not be air + world.setBlock(xyz[0], xyz[1], xyz[2], TT_Container_Casings.sBlockCasingsTT, 14, 2); + break; + default: //check for block + if ((pointer = block - '0') >= 0) { + if (blockType[pointer] instanceof ICustomBlockSetting) { + ((ICustomBlockSetting) blockType[pointer]).setBlock(world, xyz[0], xyz[1], xyz[2], blockMeta[pointer]); + } else { + world.setBlock(xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer], 2); + } + } + } + } + } + abc[0]++;//block in horizontal layer + } + } + abc[1]++;//horizontal layer + } + abc[2]++;//depth + } + return true; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java new file mode 100644 index 0000000000..9a1e94d98a --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureDefinition.java @@ -0,0 +1,288 @@ +package com.github.technus.tectech.mechanics.structure; + +import com.github.technus.tectech.util.Vec3Impl; + +import java.util.*; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; + +public class StructureDefinition<T> implements IStructureDefinition<T> { + private final Map<Character, IStructureElement<T>> elements; + private final Map<String, String> shapes; + private final Map<String, IStructureElement<T>[]> structures; + + public static <B> Builder<B> builder() { + return new Builder<>(); + } + + private StructureDefinition( + Map<Character, IStructureElement<T>> elements, + Map<String, String> shapes, + Map<String, IStructureElement<T>[]> structures) { + this.elements =elements; + this.shapes=shapes; + this.structures = structures; + } + + public static class Builder<T> { + private static final char A='\uA000'; + private static final char B='\uB000'; + private static final char C='\uC000'; + private char d ='\uD000'; + private final Map<Vec3Impl,Character> navigates; + private final Map<Character, IStructureElement<T>> elements; + private final Map<String, String> shapes; + + private Builder() { + navigates=new HashMap<>(); + elements = new HashMap<>(); + shapes = new HashMap<>(); + } + + public Map<Character, IStructureElement<T>> getElements() { + return elements; + } + + public Map<String, String> getShapes() { + return shapes; + } + + /** + * Casings go: 0 1 2 3 4 5 6 7 8 9 : ; < = > ? + * <br/> + * HatchAdders go: space ! " # $ % & ' ( ) * + * @param name + * @param structurePiece + * @return + */ + @Deprecated + public Builder<T> addShapeOldApi(String name, String[][] structurePiece) { + StringBuilder builder = new StringBuilder(); + if (structurePiece.length > 0) { + for (String[] strings : structurePiece) { + if (strings.length > 0) { + for (String string : strings) { + for (int i = 0; i < string.length(); i++) { + char ch = string.charAt(i); + if(ch<' '){ + for (int b = 0; b < ch; b++) { + builder.append(B); + } + }else if(ch>'@'){ + for (int a = '@'; a < ch; a++) { + builder.append(A); + } + }else if(ch=='.'){ + builder.append(A); + }else{ + builder.append(ch); + } + } + builder.append(B); + } + builder.setLength(builder.length() - 1); + } + builder.append(C); + } + builder.setLength(builder.length() - 1); + } + int a=0,b=0,c=0; + for (int i = 0; i < builder.length(); i++) { + char ch = builder.charAt(i); + if(ch==A){ + a++; + }else if(ch==B){ + a=0; + b++; + }else if(ch==C){ + a=0; + b=0; + c++; + }else if(a!=0 || b!=0 || c!=0){ + Vec3Impl vec3 = new Vec3Impl(a, b, c); + Character navigate = navigates.get(vec3); + if(navigate==null){ + navigate= d++; + navigates.put(vec3,navigate); + addElement(navigate,step(vec3)); + } + builder.setCharAt(i-1,navigate); + a=0; + b=0; + c=0; + } + } + + String built = builder.toString().replaceAll("[\\uA000\\uB000\\uC000]",""); + + if(built.contains("+")){ + addElement('+',notAir()); + } + if (built.contains("-")) { + addElement('-', isAir()); + } + shapes.put(name, built); + return this; + } + + /** + * Adds shape + * +- is air/no air checks + * space bar is skip + * ~ is also skip (but marks controller position, optional and logically it is a space...) + * rest needs to be defined + * + * next char is next block(a) + * next string is next line(b) + * next string[] is next slice(c) + * + * char A000-FFFF range is reserved for generated skips + * @param name unlocalized/code name + * @param structurePiece generated or written struct - DO NOT STORE IT ANYWHERE, or at least set them to null afterwards + * @return this builder + */ + public Builder<T> addShape(String name, String[][] structurePiece) { + StringBuilder builder = new StringBuilder(); + if (structurePiece.length > 0) { + for (String[] strings : structurePiece) { + if (strings.length > 0) { + for (String string : strings) { + builder.append(string).append(B); + } + builder.setLength(builder.length() - 1); + } + builder.append(C); + } + builder.setLength(builder.length() - 1); + } + int a=0,b=0,c=0; + for (int i = 0; i < builder.length(); i++) { + char ch = builder.charAt(i); + if(ch ==' ' || ch =='~'){ + builder.setCharAt(i,A); + ch=A; + } + if(ch==A){ + a++; + }else if(ch==B){ + a=0; + b++; + }else if(ch==C){ + a=0; + b=0; + c++; + }else if(a!=0 || b!=0 || c!=0){ + Vec3Impl vec3 = new Vec3Impl(a, b, c); + Character navigate = navigates.get(vec3); + if(navigate==null){ + navigate=d++; + navigates.put(vec3,navigate); + addElement(navigate,step(vec3)); + } + builder.setCharAt(i-1,navigate); + a=0; + b=0; + c=0; + } + } + + String built = builder.toString().replaceAll("[\\uA000\\uB000\\uC000]",""); + + if(built.contains("+")){ + addElement('+',notAir()); + } + if (built.contains("-")) { + addElement('-', isAir()); + } + shapes.put(name, built); + return this; + } + + public Builder<T> addElement(Character name, IStructureElement<T> structurePiece) { + elements.putIfAbsent(name, structurePiece); + return this; + } + + public IStructureDefinition<T> build() { + Map<String, IStructureElement<T>[]> structures = compileStructureMap(); + if(DEBUG_MODE){ + return new StructureDefinition<>(new HashMap<>(elements), new HashMap<>(shapes), structures); + }else { + return structures::get; + } + } + + @SuppressWarnings("unchecked") + private Map<String, IStructureElement<T>[]> compileElementSetMap() { + Set<Integer> missing = new HashSet<>(); + shapes.values().stream().map(CharSequence::chars).forEach(intStream -> intStream.forEach(c -> { + IStructureElement<T> iStructureElement = elements.get((char) c); + if (iStructureElement == null) { + missing.add(c); + } + })); + if (missing.isEmpty()) { + Map<String, IStructureElement<T>[]> map = new HashMap<>(); + shapes.forEach((key, value) -> { + Set<Character> chars=new HashSet<>(); + for (char c : value.toCharArray()) { + chars.add(c); + } + IStructureElement<T>[] compiled = new IStructureElement[chars.size()]; + int i=0; + for (Character aChar : chars) { + compiled[i++]=elements.get(aChar); + } + map.put(key, compiled); + }); + return map; + } else { + throw new RuntimeException("Missing Structure Element bindings for (chars as integers): " + + Arrays.toString(missing.toArray())); + } + } + + @SuppressWarnings("unchecked") + private Map<String, IStructureElement<T>[]> compileStructureMap() { + Set<Integer> mising = new HashSet<>(); + shapes.values().stream().map(CharSequence::chars).forEach(intStream -> intStream.forEach(c -> { + IStructureElement<T> iStructureElement = elements.get((char) c); + if (iStructureElement == null) { + mising.add(c); + } + })); + if (mising.isEmpty()) { + Map<String, IStructureElement<T>[]> map = new HashMap<>(); + shapes.forEach((key, value) -> { + IStructureElement<T>[] compiled = new IStructureElement[value.length()]; + for (int i = 0; i < value.length(); i++) { + compiled[i] = elements.get(value.charAt(i)); + } + map.put(key, compiled); + }); + return map; + } else { + throw new RuntimeException("Missing Structure Element bindings for (chars as integers): " + + Arrays.toString(mising.toArray())); + } + } + } + + public Map<Character, IStructureElement<T>> getElements(){ + return elements; + } + + public Map<String, String> getShapes() { + return shapes; + } + + public Map<String, IStructureElement<T>[]> getStructures() { + return structures; + } + + @Override + public IStructureElement<T>[] getStructureFor(String name) { + return structures.get(name); + } +}
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java new file mode 100644 index 0000000000..521b0e7645 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -0,0 +1,1395 @@ +package com.github.technus.tectech.mechanics.structure; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.structure.adders.IBlockAdder; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.adders.ITileAdder; +import com.github.technus.tectech.util.Vec3Impl; +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.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +import java.util.*; +import java.util.function.BiFunction; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.Supplier; + +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; +import static java.lang.Integer.MIN_VALUE; + +/** + * Fluent API for structure checking! + * + * (Just import static this class to have a nice fluent syntax while defining structure definitions) + */ +public class StructureUtility { + private static final String NICE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz=|!@#$%&()[]{};:<>/?_,.*^'`"; + @SuppressWarnings("rawtypes") + private static final Map<Vec3Impl, IStructureNavigate> STEP = new HashMap<>(); + @SuppressWarnings("rawtypes") + private static final IStructureElement AIR = new IStructureElement() { + @Override + public boolean check(Object t, World world, int x, int y, int z) { + return world.getBlock(x, y, z).getMaterial() == Material.air; + } + + @Override + public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 13); + return true; + } + + @Override + public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { + world.setBlock(x, y, z, Blocks.air, 0, 2); + return false; + } + }; + @SuppressWarnings("rawtypes") + private static final IStructureElement NOT_AIR = new IStructureElement() { + @Override + public boolean check(Object t, World world, int x, int y, int z) { + return world.getBlock(x, y, z).getMaterial() != Material.air; + } + + @Override + public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 14); + return true; + } + + @Override + public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { + world.setBlock(x, y, z, sHintCasingsTT, 14, 2); + return true; + } + }; + @SuppressWarnings("rawtypes") + private static final IStructureElement ERROR = new IStructureElement() { + @Override + public boolean check(Object t, World world, int x, int y, int z) { + return false; + } + + @Override + public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 15); + return true; + } + + @Override + public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) { + return true; + } + }; + + private StructureUtility() { + + } + + @SuppressWarnings("unchecked") + public static <T> IStructureElement<T> isAir() { + return AIR; + } + + @SuppressWarnings("unchecked") + public static <T> IStructureElement<T> notAir() { + return NOT_AIR; + } + + /** + * Check returns false. + * Placement is always handled by this and does nothing. + * Makes little to no use it in fallback chain. + * + * @param <T> + * @return + */ + @SuppressWarnings("unchecked") + public static <T> IStructureElement<T> error() { + return ERROR; + } + + //region hint only + + /** + * Check always returns: true. + * + * @param dots + * @param <T> + * @return + */ + public static <T> IStructureElementNoPlacement<T> ofHint(int dots) { + int meta = dots - 1; + return new IStructureElementNoPlacement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, sHintCasingsTT, meta); + return false; + } + }; + } + + /** + * Check always returns: true. + * + * @param icons + * @param <T> + * @return + */ + public static <T> IStructureElementNoPlacement<T> ofHintDeferred(Supplier<IIcon[]> icons) { + return new IStructureElementNoPlacement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, icons.get()); + return false; + } + }; + } + + /** + * Check always returns: true. + * + * @param icons + * @param RGBa + * @param <T> + * @return + */ + public static <T> IStructureElementNoPlacement<T> ofHintDeferred(Supplier<IIcon[]> icons, short[] RGBa) { + return new IStructureElementNoPlacement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle_tinted(world, x, y, z, icons.get(), RGBa); + return false; + } + }; + } + + //endregion + + //region block + + /** + * Does not allow Block duplicates (with different meta) + */ + public static <T> IStructureElementNoPlacement<T> ofBlocksFlatHint(Map<Block, Integer> blocsMap, Block hintBlock, int hintMeta) { + if (blocsMap == null || blocsMap.isEmpty() || hintBlock == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementNoPlacement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); + return true; + } + }; + } + + /** + * Allows block duplicates (with different meta) + */ + public static <T> IStructureElementNoPlacement<T> ofBlocksMapHint(Map<Block, Collection<Integer>> blocsMap, Block hintBlock, int hintMeta) { + if (blocsMap == null || blocsMap.isEmpty() || hintBlock == null) { + throw new IllegalArgumentException(); + } + for (Collection<Integer> value : blocsMap.values()) { + if (value.isEmpty()) { + throw new IllegalArgumentException(); + } + } + return new IStructureElementNoPlacement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); + return true; + } + }; + } + + public static <T> IStructureElementNoPlacement<T> ofBlockHint(Block block, int meta, Block hintBlock, int hintMeta) { + if (block == null || hintBlock == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementNoPlacement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); + return true; + } + }; + } + + public static <T> IStructureElementNoPlacement<T> ofBlockHint(Block block, int meta) { + return ofBlockHint(block, meta, block, meta); + } + + public static <T> IStructureElementNoPlacement<T> ofBlockAdderHint(IBlockAdder<T> iBlockAdder, Block hintBlock, int hintMeta) { + if (iBlockAdder == null || hintBlock == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementNoPlacement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); + return true; + } + }; + } + + /** + * Does not allow Block duplicates (with different meta) + */ + public static <T> IStructureElement<T> ofBlocksFlat(Map<Block, Integer> blocsMap, Block defaultBlock, int defaultMeta) { + if (blocsMap == null || blocsMap.isEmpty() || defaultBlock == null) { + throw new IllegalArgumentException(); + } + if(defaultBlock instanceof ICustomBlockSetting){ + return new IStructureElement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + }else { + return new IStructureElement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return blocsMap.getOrDefault(worldBlock, MIN_VALUE) == worldBlock.getDamageValue(world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + } + } + + /** + * Allows block duplicates (with different meta) + */ + public static <T> IStructureElement<T> ofBlocksMap(Map<Block, Collection<Integer>> blocsMap, Block defaultBlock, int defaultMeta) { + if (blocsMap == null || blocsMap.isEmpty() || defaultBlock == null) { + throw new IllegalArgumentException(); + } + for (Collection<Integer> value : blocsMap.values()) { + if (value.isEmpty()) { + throw new IllegalArgumentException(); + } + } + if(defaultBlock instanceof ICustomBlockSetting){ + return new IStructureElement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + }else { + return new IStructureElement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return blocsMap.getOrDefault(worldBlock, Collections.emptySet()).contains(worldBlock.getDamageValue(world, x, y, z)); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + } + } + + public static <T> IStructureElement<T> ofBlock(Block block, int meta, Block defaultBlock, int defaultMeta) { + if (block == null || defaultBlock == null) { + throw new IllegalArgumentException(); + } + if(block instanceof ICustomBlockSetting){ + return new IStructureElement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + } else { + return new IStructureElement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return block == worldBlock && meta == worldBlock.getDamageValue(world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + } + } + + /** + * Same as above but ignores target meta id + */ + public static <T> IStructureElement<T> ofBlockAnyMeta(Block block, Block defaultBlock, int defaultMeta) { + if (block == null || defaultBlock == null) { + throw new IllegalArgumentException(); + } + if(block instanceof ICustomBlockSetting){ + return new IStructureElement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return block == world.getBlock(x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + } else { + return new IStructureElement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return block == world.getBlock(x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + } + } + + public static <T> IStructureElement<T> ofBlock(Block block, int meta) { + return ofBlock(block, meta, block, meta); + } + + /** + * Same as above but ignores target meta id + */ + public static <T> IStructureElement<T> ofBlockAnyMeta(Block block) { + return ofBlockAnyMeta(block, block, 0); + } + + /** + * Same as above but allows to set hint particle render + */ + public static <T> IStructureElement<T> ofBlockAnyMeta(Block block,int defaultMeta) { + return ofBlockAnyMeta(block, block, defaultMeta); + } + + //endregion + + //region adders + + public static <T> IStructureElement<T> ofBlockAdder(IBlockAdder<T> iBlockAdder, Block defaultBlock, int defaultMeta) { + if (iBlockAdder == null || defaultBlock == null) { + throw new IllegalArgumentException(); + } + if(defaultBlock instanceof ICustomBlockSetting){ + return new IStructureElement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + ((ICustomBlockSetting) defaultBlock).setBlock(world, x, y, z, defaultMeta); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + }else { + return new IStructureElement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + return iBlockAdder.apply(t, worldBlock, worldBlock.getDamageValue(world, x, y, z)); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + world.setBlock(x, y, z, defaultBlock, defaultMeta, 2); + return true; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta); + return true; + } + }; + } + } + + public static <T> IStructureElement<T> ofBlockAdder(IBlockAdder<T> iBlockAdder, int dots) { + return ofBlockAdder(iBlockAdder, sHintCasingsTT, dots - 1); + } + + public static <T> IStructureElementNoPlacement<T> ofTileAdder(ITileAdder<T> iTileAdder, Block hintBlock, int hintMeta) { + if (iTileAdder == null || hintBlock == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementNoPlacement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + TileEntity tileEntity = world.getTileEntity(x, y, z); + return tileEntity instanceof IGregTechTileEntity && iTileAdder.apply(t, tileEntity); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); + return true; + } + }; + } + + public static <T> IStructureElementNoPlacement<T> ofHatchAdder(IHatchAdder<T> iHatchAdder, int textureIndex, int dots) { + return ofHatchAdder(iHatchAdder, textureIndex, sHintCasingsTT, dots - 1); + } + + public static <T> IStructureElementNoPlacement<T> ofHatchAdder(IHatchAdder<T> iHatchAdder, int textureIndex, Block hintBlock, int hintMeta) { + if (iHatchAdder == null || hintBlock == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementNoPlacement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + TileEntity tileEntity = world.getTileEntity(x, y, z); + return tileEntity instanceof IGregTechTileEntity && iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); + return true; + } + }; + } + + public static <T> IStructureElement<T> ofHatchAdderOptional(IHatchAdder<T> iHatchAdder, int textureIndex, int dots, Block placeCasing, int placeCasingMeta) { + return ofHatchAdderOptional(iHatchAdder, textureIndex, sHintCasingsTT, dots - 1, placeCasing, placeCasingMeta); + } + + public static <T> IStructureElement<T> ofHatchAdderOptional(IHatchAdder<T> iHatchAdder, int textureIndex, Block hintBlock, int hintMeta, Block placeCasing, int placeCasingMeta) { + if (iHatchAdder == null || hintBlock == null) { + throw new IllegalArgumentException(); + } + if(placeCasing instanceof ICustomBlockSetting){ + return new IStructureElement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + TileEntity tileEntity = world.getTileEntity(x, y, z); + Block worldBlock = world.getBlock(x, y, z); + return (tileEntity instanceof IGregTechTileEntity && + iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || + (worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); + return true; + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + ((ICustomBlockSetting) placeCasing).setBlock(world, x, y, z, placeCasingMeta); + return true; + } + }; + }else { + return new IStructureElement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + TileEntity tileEntity = world.getTileEntity(x, y, z); + Block worldBlock = world.getBlock(x, y, z); + return (tileEntity instanceof IGregTechTileEntity && + iHatchAdder.apply(t, (IGregTechTileEntity) tileEntity, (short) textureIndex)) || + (worldBlock == placeCasing && worldBlock.getDamageValue(world, x, y, z) == placeCasingMeta); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + TecTech.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta); + return true; + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + world.setBlock(x, y, z, placeCasing, placeCasingMeta, 2); + return true; + } + }; + } + } + + //endregion + + //region side effects + + public static <B extends IStructureElement<T>, T> IStructureElement<T> onElementPass(Consumer<T> onCheckPass, B element) { + return new IStructureElement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + boolean check = element.check(t, world, x, y, z); + if (check) { + onCheckPass.accept(t); + } + return check; + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return element.placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return element.spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static <B extends IStructureElement<T>, T> IStructureElement<T> onElementFail(Consumer<T> onFail, B element) { + return new IStructureElement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + boolean check = element.check(t, world, x, y, z); + if (!check) { + onFail.accept(t); + } + return check; + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return element.placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return element.spawnHint(t, world, x, y, z, trigger); + } + }; + } + + //endregion + + /** + * Take care while chaining, as it will try to call every structure element until it returns true. + * If none does it will finally return false. + * + * @param elementChain + * @param <T> + * @return + */ + @SafeVarargs + public static <T> IStructureElementChain<T> ofChain(IStructureElement<T>... elementChain) { + if (elementChain == null || elementChain.length == 0) { + throw new IllegalArgumentException(); + } + for (IStructureElement<T> iStructureElement : elementChain) { + if (iStructureElement == null) { + throw new IllegalArgumentException(); + } + } + return () -> elementChain; + } + + /** + * Take care while chaining, as it will try to call every structure element until it returns true. + * If none does it will finally return false. + * + * @param elementChain + * @param <T> + * @return + */ + @SuppressWarnings("unchecked") + public static <T> IStructureElementChain<T> ofChain(List<IStructureElement<T>> elementChain) { + return ofChain(elementChain.toArray(new IStructureElement[0])); + } + + //region defer + + public static <T> IStructureElementDeferred<T> defer(Supplier<IStructureElement<T>> to) { + if (to == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementDeferred<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return to.get().check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.get().placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.get().spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static <T> IStructureElementDeferred<T> defer(Function<T, IStructureElement<T>> to) { + if (to == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementDeferred<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return to.apply(t).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static <T, K> IStructureElementDeferred<T> defer(Function<T, K> keyExtractor, Map<K, IStructureElement<T>> map) { + if (keyExtractor == null || map == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementDeferred<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return map.get(keyExtractor.apply(t)).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t)).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t)).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static <T, K> IStructureElementDeferred<T> defer(Function<T, K> keyExtractor, Map<K, IStructureElement<T>> map, IStructureElement<T> defaultElem) { + if (keyExtractor == null || map == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementDeferred<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return map.getOrDefault(keyExtractor.apply(t), defaultElem).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t), defaultElem).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t), defaultElem).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + @SafeVarargs + public static <T> IStructureElementDeferred<T> defer(Function<T, Integer> keyExtractor, IStructureElement<T>... array) { + if (keyExtractor == null || array == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementDeferred<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return array[keyExtractor.apply(t)].check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t)].placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t)].spawnHint(t, world, x, y, z, trigger); + } + }; + } + + @SuppressWarnings("unchecked") + public static <T> IStructureElementDeferred<T> defer(Function<T, Integer> keyExtractor, List<IStructureElement<T>> array) { + return defer(keyExtractor, array.toArray(new IStructureElement[0])); + } + + public static <T> IStructureElementDeferred<T> defer(BiFunction<T, ItemStack, IStructureElement<T>> to) { + if (to == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementDeferred<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return to.apply(t, null).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t, trigger).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t, trigger).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static <T, K> IStructureElementDeferred<T> defer(BiFunction<T, ItemStack, K> keyExtractor, Map<K, IStructureElement<T>> map) { + if (keyExtractor == null || map == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementDeferred<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return map.get(keyExtractor.apply(t, null)).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t, trigger)).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t, trigger)).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static <T, K> IStructureElementDeferred<T> defer(BiFunction<T, ItemStack, K> keyExtractor, Map<K, IStructureElement<T>> map, IStructureElement<T> defaultElem) { + if (keyExtractor == null || map == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementDeferred<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return map.getOrDefault(keyExtractor.apply(t, null), defaultElem).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + @SafeVarargs + public static <T> IStructureElementDeferred<T> defer(BiFunction<T, ItemStack, Integer> keyExtractor, IStructureElement<T>... array) { + if (keyExtractor == null || array == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementDeferred<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return array[keyExtractor.apply(t, null)].check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t, trigger)].placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t, trigger)].spawnHint(t, world, x, y, z, trigger); + } + }; + } + + @SuppressWarnings("unchecked") + public static <T> IStructureElementDeferred<T> defer(BiFunction<T, ItemStack, Integer> keyExtractor, List<IStructureElement<T>> array) { + return defer(keyExtractor, array.toArray(new IStructureElement[0])); + } + + public static <T> IStructureElementDeferred<T> defer(Function<T, IStructureElement<T>> toCheck, BiFunction<T, ItemStack, IStructureElement<T>> to) { + if (to == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementDeferred<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return toCheck.apply(t).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t, trigger).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return to.apply(t, trigger).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static <T, K> IStructureElementDeferred<T> defer(Function<T, K> keyExtractorCheck, BiFunction<T, ItemStack, K> keyExtractor, Map<K, IStructureElement<T>> map) { + if (keyExtractor == null || map == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementDeferred<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return map.get(keyExtractorCheck.apply(t)).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t, trigger)).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.get(keyExtractor.apply(t, trigger)).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + public static <T, K> IStructureElementDeferred<T> defer(Function<T, K> keyExtractorCheck, BiFunction<T, ItemStack, K> keyExtractor, Map<K, IStructureElement<T>> map, IStructureElement<T> defaultElem) { + if (keyExtractor == null || map == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementDeferred<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return map.getOrDefault(keyExtractorCheck.apply(t), defaultElem).check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return map.getOrDefault(keyExtractor.apply(t, trigger), defaultElem).spawnHint(t, world, x, y, z, trigger); + } + }; + } + + @SafeVarargs + public static <T> IStructureElementDeferred<T> defer(Function<T, Integer> keyExtractorCheck, BiFunction<T, ItemStack, Integer> keyExtractor, IStructureElement<T>... array) { + if (keyExtractor == null || array == null) { + throw new IllegalArgumentException(); + } + return new IStructureElementDeferred<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return array[keyExtractorCheck.apply(t)].check(t, world, x, y, z); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t, trigger)].placeBlock(t, world, x, y, z, trigger); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return array[keyExtractor.apply(t, trigger)].spawnHint(t, world, x, y, z, trigger); + } + }; + } + + @SuppressWarnings("unchecked") + public static <T> IStructureElementDeferred<T> defer(Function<T, Integer> keyExtractorCheck, BiFunction<T, ItemStack, Integer> keyExtractor, List<IStructureElement<T>> array) { + return defer(keyExtractorCheck, keyExtractor, array.toArray(new IStructureElement[0])); + } + + //endregion + + /** + * Used internally, to generate skips for structure definitions + * + * @param a + * @param b + * @param c + * @param <T> + * @return + */ + public static <T> IStructureNavigate<T> step(int a, int b, int c) { + return step(new Vec3Impl(a, b, c)); + } + + /** + * Used internally, to generate skips for structure definitions + * + * @param step + * @param <T> + * @return + */ + @SuppressWarnings("unchecked") + public static <T> IStructureNavigate<T> step(Vec3Impl step) { + if (step == null || step.get0() < 0 || step.get1() < 0 || step.get2() < 0) { + throw new IllegalArgumentException(); + } + return STEP.computeIfAbsent(step, vec3 -> { + if (vec3.get2() > 0) { + return stepC(vec3.get0(), vec3.get1(), vec3.get2()); + } else if (vec3.get1() > 0) { + return stepB(vec3.get0(), vec3.get1(), vec3.get2()); + } else { + return stepA(vec3.get0(), vec3.get1(), vec3.get2()); + } + }); + } + + private static <T> IStructureNavigate<T> stepA(int a, int b, int c) { + return new IStructureNavigate<T>() { + @Override + public int getStepA() { + return a; + } + + @Override + public int getStepB() { + return b; + } + + @Override + public int getStepC() { + return c; + } + }; + } + + private static <T> IStructureNavigate<T> stepB(int a, int b, int c) { + return new IStructureNavigate<T>() { + @Override + public int getStepA() { + return a; + } + + @Override + public int getStepB() { + return b; + } + + @Override + public int getStepC() { + return c; + } + + @Override + public boolean resetA() { + return true; + } + }; + } + + private static <T> IStructureNavigate<T> stepC(int a, int b, int c) { + return new IStructureNavigate<T>() { + @Override + public int getStepA() { + return a; + } + + @Override + public int getStepB() { + return b; + } + + @Override + public int getStepC() { + return c; + } + + @Override + public boolean resetA() { + return true; + } + + @Override + public boolean resetB() { + return true; + } + }; + } + + /** + * Used only to get pseudo code in structure writer... + * + * @param world + * @return + */ + public static String getPseudoJavaCode(World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC, + int sizeA, int sizeB, int sizeC, boolean transpose) { + Map<Block, Set<Integer>> blocks = new TreeMap<>(Comparator.comparing(Block::getUnlocalizedName)); + Set<Class<? extends TileEntity>> tiles = new TreeSet<>(Comparator.comparing(Class::getCanonicalName)); + Set<Class<? extends IMetaTileEntity>> gtTiles = new TreeSet<>(Comparator.comparing(Class::getCanonicalName)); + iterate(world, extendedFacing, basePositionX, basePositionY, basePositionZ, + basePositionA, basePositionB, basePositionC, + sizeA, sizeB, sizeC, ((w, x, y, z) -> { + TileEntity tileEntity = w.getTileEntity(x, y, z); + if (tileEntity == null) { + Block block = w.getBlock(x, y, z); + if (block != null && block != Blocks.air) { + blocks.compute(block, (b, set) -> { + if (set == null) { + set = new TreeSet<>(); + } + set.add(block.getDamageValue(world, x, y, z)); + return set; + }); + } + } else { + if (tileEntity instanceof IGregTechTileEntity) { + IMetaTileEntity meta = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); + if (meta != null) { + gtTiles.add(meta.getClass()); + } else { + tiles.add(tileEntity.getClass()); + } + } else { + tiles.add(tileEntity.getClass()); + } + } + })); + Map<String, Character> map = new HashMap<>(); + StringBuilder builder = new StringBuilder(); + { + int i = 0; + char c; + builder.append("\n\nStructure:\n") + .append("\nBlocks:\n"); + for (Map.Entry<Block, Set<Integer>> entry : blocks.entrySet()) { + Block block = entry.getKey(); + Set<Integer> set = entry.getValue(); + for (Integer meta : set) { + c = NICE_CHARS.charAt(i++); + if (i > NICE_CHARS.length()) { + return "Too complicated for nice chars"; + } + map.put(block.getUnlocalizedName() + '\0' + meta, c); + builder.append(c).append(" -> ofBlock...(") + .append(block.getUnlocalizedName()).append(", ").append(meta).append(", ...);\n"); + } + } + builder.append("\nTiles:\n"); + for (Class<? extends TileEntity> tile : tiles) { + c = NICE_CHARS.charAt(i++); + if (i > NICE_CHARS.length()) { + return "Too complicated for nice chars"; + } + map.put(tile.getCanonicalName(), c); + builder.append(c).append(" -> ofTileAdder(") + .append(tile.getCanonicalName()).append(", ...);\n"); + } + builder.append("\nMeta:\n"); + for (Class<? extends IMetaTileEntity> gtTile : gtTiles) { + c = NICE_CHARS.charAt(i++); + if (i > NICE_CHARS.length()) { + return "Too complicated for nice chars"; + } + map.put(gtTile.getCanonicalName(), c); + builder.append(c).append(" -> ofHatchAdder(") + .append(gtTile.getCanonicalName()).append(", textureId, ...);\n"); + } + } + builder.append("\nOffsets:\n") + .append(basePositionA).append(' ').append(basePositionB).append(' ').append(basePositionC).append('\n'); + if (transpose) { + builder.append("\nTransposed Scan:\n") + .append("new String[][]{\n") + .append(" {\""); + iterate(world, extendedFacing, basePositionX, basePositionY, basePositionZ, + basePositionA, basePositionB, basePositionC, true, + sizeA, sizeB, sizeC, ((w, x, y, z) -> { + TileEntity tileEntity = w.getTileEntity(x, y, z); + if (tileEntity == null) { + Block block = w.getBlock(x, y, z); + if (block != null && block != Blocks.air) { + builder.append(map.get(block.getUnlocalizedName() + '\0' + block.getDamageValue(world, x, y, z))); + } else { + builder.append(' '); + } + } else { + if (tileEntity instanceof IGregTechTileEntity) { + IMetaTileEntity meta = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); + if (meta != null) { + builder.append(map.get(meta.getClass().getCanonicalName())); + } else { + builder.append(map.get(tileEntity.getClass().getCanonicalName())); + } + } else { + builder.append(map.get(tileEntity.getClass().getCanonicalName())); + } + } + }), + () -> builder.append("\",\""), + () -> { + builder.setLength(builder.length() - 2); + builder.append("},\n {\""); + }); + builder.setLength(builder.length() - 8); + builder.append("\n}\n\n"); + } else { + builder.append("\nNormal Scan:\n") + .append("new String[][]{{\n") + .append(" \""); + iterate(world, extendedFacing, basePositionX, basePositionY, basePositionZ, + basePositionA, basePositionB, basePositionC, false, + sizeA, sizeB, sizeC, ((w, x, y, z) -> { + TileEntity tileEntity = w.getTileEntity(x, y, z); + if (tileEntity == null) { + Block block = w.getBlock(x, y, z); + if (block != null && block != Blocks.air) { + builder.append(map.get(block.getUnlocalizedName() + '\0' + block.getDamageValue(world, x, y, z))); + } else { + builder.append(' '); + } + } else { + if (tileEntity instanceof IGregTechTileEntity) { + IMetaTileEntity meta = ((IGregTechTileEntity) tileEntity).getMetaTileEntity(); + if (meta != null) { + builder.append(map.get(meta.getClass().getCanonicalName())); + } else { + builder.append(map.get(tileEntity.getClass().getCanonicalName())); + } + } else { + builder.append(map.get(tileEntity.getClass().getCanonicalName())); + } + } + }), + () -> builder.append("\",\n").append(" \""), + () -> { + builder.setLength(builder.length() - 7); + builder.append("\n").append("},{\n").append(" \""); + }); + builder.setLength(builder.length() - 8); + builder.append("}\n\n"); + } + return (builder.toString().replaceAll("\"\"", "E")); + } + + public static void iterate(World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC, + int sizeA, int sizeB, int sizeC, + IBlockPosConsumer iBlockPosConsumer) { + sizeA -= basePositionA; + sizeB -= basePositionB; + sizeC -= basePositionC; + + int[] abc = new int[3]; + int[] xyz = new int[3]; + + for (abc[2] = -basePositionC; abc[2] < sizeC; abc[2]++) { + for (abc[1] = -basePositionB; abc[1] < sizeB; abc[1]++) { + for (abc[0] = -basePositionA; abc[0] < sizeA; abc[0]++) { + extendedFacing.getWorldOffset(abc, xyz); + iBlockPosConsumer.consume(world, xyz[0] + basePositionX, xyz[1] + basePositionY, xyz[2] + basePositionZ); + } + + } + } + } + + public static void iterate(World world, ExtendedFacing extendedFacing, + int basePositionX, int basePositionY, int basePositionZ, + int basePositionA, int basePositionB, int basePositionC, + boolean transpose, int sizeA, int sizeB, int sizeC, + IBlockPosConsumer iBlockPosConsumer, + Runnable nextB, + Runnable nextC) { + sizeA -= basePositionA; + sizeB -= basePositionB; + sizeC -= basePositionC; + + int[] abc = new int[3]; + int[] xyz = new int[3]; + if (transpose) { + for (abc[1] = -basePositionB; abc[1] < sizeB; abc[1]++) { + for (abc[2] = -basePositionC; abc[2] < sizeC; abc[2]++) { + for (abc[0] = -basePositionA; abc[0] < sizeA; abc[0]++) { + extendedFacing.getWorldOffset(abc, xyz); + iBlockPosConsumer.consume(world, xyz[0] + basePositionX, xyz[1] + basePositionY, xyz[2] + basePositionZ); + } + nextB.run(); + } + nextC.run(); + } + } else { + for (abc[2] = -basePositionC; abc[2] < sizeC; abc[2]++) { + for (abc[1] = -basePositionB; abc[1] < sizeB; abc[1]++) { + for (abc[0] = -basePositionA; abc[0] < sizeA; abc[0]++) { + extendedFacing.getWorldOffset(abc, xyz); + iBlockPosConsumer.consume(world, xyz[0] + basePositionX, xyz[1] + basePositionY, xyz[2] + basePositionZ); + } + nextB.run(); + } + nextC.run(); + } + } + } + + /** + * Transposes shape (swaps B and C axis, can be used to un-transpose transposed shape) + * WARNING! Do not use on old api... + * + * @param structurePiece shape (transposed shape) + * @return transposed shape (untransposed shape) + */ + public static String[][] transpose(String[][] structurePiece) { + String[][] shape = new String[structurePiece[0].length][structurePiece.length]; + for (int i = 0; i < structurePiece.length; i++) { + for (int j = 0; j < structurePiece[i].length; j++) { + shape[j][i] = structurePiece[i][j]; + } + } + return shape; + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java new file mode 100644 index 0000000000..908c4c4aca --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IBlockAdder.java @@ -0,0 +1,14 @@ +package com.github.technus.tectech.mechanics.structure.adders; + + +import net.minecraft.block.Block; + +public interface IBlockAdder<T> { + /** + * Callback on block added, needs to check if block is valid (and add it) + * @param block block attempted to add + * @param meta meta of block attempted to add + * @return is structure still valid + */ + boolean apply(T t,Block block, Integer meta); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java new file mode 100644 index 0000000000..a47befc2e8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/IHatchAdder.java @@ -0,0 +1,14 @@ +package com.github.technus.tectech.mechanics.structure.adders; + + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + +public interface IHatchAdder<T> { + /** + * Callback to add hatch, needs to check if hatch is valid (and add it) + * @param iGregTechTileEntity hatch + * @param aShort requested texture index, or null if not... + * @return managed to add hatch (structure still valid) + */ + boolean apply(T t,IGregTechTileEntity iGregTechTileEntity, Short aShort); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java new file mode 100644 index 0000000000..cc3c7dbb7a --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/adders/ITileAdder.java @@ -0,0 +1,12 @@ +package com.github.technus.tectech.mechanics.structure.adders; + +import net.minecraft.tileentity.TileEntity; + +public interface ITileAdder<T> { + /** + * Callback to add hatch, needs to check if tile is valid (and add it) + * @param tileEntity tile + * @return managed to add hatch (structure still valid) + */ + boolean apply(T t,TileEntity tileEntity); +} 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..e397c1dc5f --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java @@ -0,0 +1,123 @@ +package com.github.technus.tectech.mechanics.tesla; + +import com.github.technus.tectech.mechanics.spark.ThaumSpark; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Objects; + +import static com.github.technus.tectech.util.Util.entriesSortedByValues; +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 + HashMap<ITeslaConnectableSimple, Integer> teslaNodeMap = new HashMap<>(); + //ThaumCraft lighting coordinate pairs, so we can send them in bursts and save on lag + HashSet<ThaumSpark> sparkList = new HashSet<>(); + + //-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 { + public static final HashSet<ITeslaConnectableSimple> teslaNodeSet = new HashSet<>();//Targets for power transmission + + public static void generateTeslaNodeMap(ITeslaConnectable origin) { + origin.teslaNodeMap.clear(); + for (ITeslaConnectableSimple target : teslaNodeSet) { + //Sanity checks + if (target == null) { + //The Tesla Covers do not remove themselves from the list and this is the code that does + teslaNodeSet.remove(null); + continue; + } else if (origin.equals(target) || !origin.getTeslaDimension().equals(target.getTeslaDimension())) { + //Skip if looking at myself and skip if not in the same dimension + //TODO, INTERDIM? + continue; + } else if (origin.getTeslaTransmissionCapability() != 0 && origin.getTeslaReceptionCapability() != 0 && + origin.getTeslaTransmissionCapability() != origin.getTeslaReceptionCapability()) { + //Skip if incompatible + continue; + } + + //Range calc + int distance = (int) sqrt(origin.getTeslaPosition().distanceSq(target.getTeslaPosition())); + if (distance > origin.getTeslaTransmissionRange() * target.getTeslaReceptionCoefficient()) { + //Skip if the range is too vast + continue; + } + origin.teslaNodeMap.put(target, distance); + } + } + + public static void cleanTeslaNodeMap(ITeslaConnectable origin) { + //Wipes all null objects, in practice this is unloaded or improperly removed tesla objects + origin.teslaNodeMap.keySet().removeIf(Objects::isNull); + } + + public static long powerTeslaNodeMap(ITeslaConnectable origin) { + //Teslas can only send OR receive + if (origin.isTeslaReadyToReceive()) { + return 0L;//TODO Negative values to indicate charging? + } + long remainingAmperes = origin.getTeslaOutputCurrent(); + while (remainingAmperes > 0) { + long startingAmperes = remainingAmperes; + for (HashMap.Entry<ITeslaConnectableSimple, Integer> Rx : entriesSortedByValues(teslaNodeMap)) { + if (origin.getTeslaStoredEnergy() < (origin.isOverdriveEnabled() ? origin.getTeslaOutputVoltage() * 2 : origin.getTeslaOutputVoltage())) { + //Return and end the tick if we're out of energy to send + return origin.getTeslaOutputCurrent() - remainingAmperes; + } + + ITeslaConnectableSimple target = Rx.getKey(); + int distance = Rx.getValue(); + + //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(); + } + + //Skip the target if the cost is too high + if (origin.getTeslaStoredEnergy() < outputVoltageConsumption) { + continue; + } + + if (target.teslaInjectEnergy(outputVoltageInjectable)) { + origin.teslaDrainEnergy(outputVoltageConsumption); + sparkList.add(new ThaumSpark(origin.getTeslaPosition(), target.getTeslaPosition(), origin.getTeslaDimension())); + remainingAmperes--; + } + if (remainingAmperes == 0) { + return origin.getTeslaOutputCurrent(); + } + } + //End the tick after one iteration with no transmissions + if (remainingAmperes == startingAmperes) { + return origin.getTeslaOutputCurrent() - remainingAmperes; + } + } + 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..3b56b6968c --- /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.github.technus.tectech.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/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java index 720460d56b..9e693b7664 100644 --- a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java @@ -24,6 +24,7 @@ import net.minecraft.client.particle.EntityFX; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.util.ForgeDirection; @@ -46,6 +47,33 @@ public class ClientProxy extends CommonProxy { } @Override + public void hint_particle_tinted(World w,int x, int y, int z, IIcon[] icons,short[] RGBa) { + Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,icons).withColorTint(RGBa)); + + 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 hint_particle_tinted(World w,int x, int y, int z, Block block, int meta,short[] RGBa) { + Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,block,meta).withColorTint(RGBa)); + + 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 hint_particle(World w,int x, int y, int z, IIcon[] icons) { + Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w,x,y,z,icons)); + + 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 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)); 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..490cdf1092 100644 --- a/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java @@ -7,12 +7,16 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraft.world.WorldServer; public class CommonProxy implements IGuiHandler { public void registerRenderInfo() {} + public void hint_particle_tinted(World w,int x, int y, int z, IIcon[] icons,short[] RGBa){} + public void hint_particle_tinted(World w,int x, int y, int z, Block block, int meta,short[] RGBa){} + public void hint_particle(World w,int x, int y, int z, IIcon[] icons){} 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! 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..a86695ff4a 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, 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 05cbca7990..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,7 @@ 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; /** 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 14cb682c6f..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,7 @@ 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; /** 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..0d2f710ae9 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 @@ -23,8 +23,8 @@ import static com.github.technus.tectech.TecTech.tectechTexturePage1; * 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 + 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]; @@ -35,11 +35,12 @@ 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]; 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 + 16] = 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_Item_CasingsBA0.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java index 31ad485306..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,7 @@ 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 { @@ -45,6 +45,10 @@ public class GT_Item_CasingsBA0 extends GT_Item_Casings_Abstract { 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!?"); aList.add(EnumChatFormatting.BLUE.toString() + "From outer space... I guess..."); 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 9778b1f846..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,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.COSMIC_MARK; +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/thing/casing/GT_Item_HintTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_HintTT.java index 186510ff14..426e7d569b 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_HintTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_HintTT.java @@ -8,7 +8,7 @@ import net.minecraft.util.EnumChatFormatting; import java.util.List; -import static com.github.technus.tectech.CommonValues.TEC_MARK_GENERAL; +import static com.github.technus.tectech.util.CommonValues.TEC_MARK_GENERAL; import static net.minecraft.util.StatCollector.translateToLocal; /** 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..2efe2f3cbc 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,95 @@ package com.github.technus.tectech.thing.cover; +import com.github.technus.tectech.mechanics.tesla.ITeslaConnectableSimple; +import com.github.technus.tectech.util.Vec3Impl; import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; 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 class GT_Cover_TM_TeslaCoil extends GT_CoverBehavior implements ITeslaConnectableSimple { + private IGregTechTileEntity IGT; + 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) { + //Pull IGT onto the outside, should only execute first tick + if (IGT == null) { + IGT = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); + } + //Makes sure we're on the list + teslaNodeSet.add(this); + } + + 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; + } + + @Override + public byte getTeslaReceptionCapability() { + return 2; + } + + @Override + public float getTeslaReceptionCoefficient() { + return 1; + } + + @Override + public boolean isTeslaReadyToReceive() { + return true; + } + + @Override + public long getTeslaStoredEnergy() { + return IGT.getStoredEU(); + } + + @Override + public Vec3Impl getTeslaPosition() { + return new Vec3Impl(IGT); + } + + @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 + return IGT.injectEnergyUnits((byte) 1, teslaVoltageInjected, 1L) > 0L; + } +} 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..028ac3a4d6 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,33 @@ 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 + + @Override + public byte getTeslaReceptionCapability() { + return 1; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java index c578f322f6..752f2d1bcc 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java @@ -1,31 +1,18 @@ 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 com.github.technus.tectech.mechanics.constructable.ConstructableUtility; +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 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; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -34,8 +21,6 @@ import static net.minecraft.util.StatCollector.translateToLocal; 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"); @@ -44,69 +29,7 @@ public final class ConstructableTriggerItem extends Item { @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; + return ConstructableUtility.handle(aStack, aPlayer, aWorld, aX, aY, aZ, aSide); } @Override @@ -122,47 +45,5 @@ public final class ConstructableTriggerItem extends Item { 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 6ebfce328e..6850b24e0f 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,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.font.TecTechFontRender; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.iElementalInstanceContainer; @@ -31,6 +31,8 @@ import java.util.TreeSet; import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT_144; import static cpw.mods.fml.relauncher.Side.CLIENT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -140,10 +142,10 @@ public final class DebugElementalInstanceContainer_EM extends Item implements IE ItemStack that = new ItemStack(this, 1); that.setTagCompound(new NBTTagCompound()); list.add(that); - for(iElementalDefinition 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(iElementalDefinition definition: STACKS_REGISTERED){ + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 1 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 144 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT_144)))); + list.add(setContent(new ItemStack(this).setStackDisplayName(definition.getName()+" 1000 mol"),new cElementalInstanceStackMap(new cElementalInstanceStack(definition, AVOGADRO_CONSTANT *1000)))); } } 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 87c4409171..fa1c25cbf5 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,8 +1,8 @@ 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.util.Util; 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.thing.item.renderElemental.IElementalItem; 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 f9aafa1f7f..c951229c92 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,9 +1,9 @@ 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.TecTech; +import com.github.technus.tectech.util.Util; 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.thing.CustomItemList; 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 8f113c008b..f4531a248b 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; @@ -73,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; } diff --git a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java index e678dbd6cb..d71abb34b7 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/FrontRotationTriggerItem.java @@ -1,18 +1,13 @@ package com.github.technus.tectech.thing.item; -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.thing.metaTileEntity.IFrontRotation; +import com.github.technus.tectech.mechanics.alignment.AlignmentUtility; +import com.github.technus.tectech.util.CommonValues; 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; @@ -35,23 +30,7 @@ public final class FrontRotationTriggerItem extends Item { @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; + return AlignmentUtility.handle(aPlayer,aWorld,aX,aY,aZ); } @Override 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 e64ab1eaa6..1d1da74a7a 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; 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 8767982898..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,7 +14,7 @@ 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; @@ -22,7 +22,7 @@ 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); @@ -33,8 +33,8 @@ 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(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 + 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(translateToLocal("item.tm.teslaCoilCapacitor.desc.2"));//Yeet this broken item into some spicy water! } @@ -61,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 @@ -74,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; } @@ -81,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 2ba984c9cc..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; 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 cf08c03f38..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; 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 03afa1b66b..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; 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/hatch/GT_MetaTileEntity_Hatch_Capacitor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java index 4527a9d6ff..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,8 +23,8 @@ 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; @@ -38,7 +38,7 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { public GT_MetaTileEntity_Hatch_Capacitor(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 16, ""); - Util.setTier(aTier,this); + Util.setTier(aTier, this); } public GT_MetaTileEntity_Hatch_Capacitor(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -173,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> { @@ -206,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 3d18550d09..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,10 +1,10 @@ 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.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; @@ -13,7 +13,7 @@ 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; /** 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 6f5a9b377c..4e719f8ec8 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,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; 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 74564a7a57..6cbf1e801b 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; @@ -21,7 +21,7 @@ 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; @@ -114,7 +114,6 @@ public abstract class GT_MetaTileEntity_Hatch_DataConnector<T extends DataPacket } catch (Exception e) { clientLocale = "en_US"; } - aBaseMetaTileEntity.openGUI(aPlayer); return true; } 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..beacf26122 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,7 +78,7 @@ 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 @@ -148,13 +148,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 682c7536bf..c8606f68f0 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.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.bTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.util.CommonValues.*; import static gregtech.api.enums.Dyes.MACHINE_METAL; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; import static net.minecraft.util.StatCollector.translateToLocal; @@ -43,7 +44,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta protected cElementalInstanceStackMap content = new cElementalInstanceStackMap(); //float lifeTimeMult=1f; public int postEnergize = 0; - public float overflowMatter = 0f; + public double overflowMatter = 0f; public short id = -1; private byte deathDelay = 2; @@ -80,7 +81,8 @@ 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.setDouble("OverflowMatter", overflowMatter); + content.cleanUp(); aNBT.setTag("eM_Stacks", content.toNBT()); aNBT.setShort("eID", id); } @@ -90,7 +92,7 @@ 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")); @@ -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()); @@ -203,11 +206,11 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta } public int getMaxStacksCount() { - return mTier * 2; + return mTier * 128; } - public int getMaxStackSize() { - return mTier * (mTier - 7) * 1000; + public double getMaxStackSize() { + return mTier * (mTier - 7) * 64D * AVOGADRO_CONSTANT_144; } @Override @@ -239,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..4410372d47 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,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; @@ -10,7 +10,7 @@ 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; 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..2393f4f702 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,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.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 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 +39,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,7 +75,7 @@ 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 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 c7b0eb983e..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; 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 c628a92cb4..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,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.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; 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 97565e155e..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; @@ -20,7 +20,7 @@ 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; @@ -166,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<>(); 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 083a8ee1f1..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,10 +1,10 @@ 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.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; 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 d98675d0f2..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,10 +1,10 @@ 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.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; 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..a1e4f5a8a5 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; 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 362ba9f3c5..a5e6dc4d5d 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.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.Dyes; @@ -28,8 +28,8 @@ 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.util.CommonValues.DISPERSE_AT; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.loader.MainLoader.elementalPollution; import static gregtech.api.enums.Dyes.MACHINE_METAL; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity; @@ -44,13 +44,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 +58,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; @@ -124,13 +124,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 @@ -235,17 +235,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 b94836657d..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; 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 09f11710da..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; 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 47d7037946..d9d5f90593 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; @@ -28,8 +28,8 @@ 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; 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 80b7185ba4..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; 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..584e28a607 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,11 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -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 cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -17,7 +18,7 @@ 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.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -48,7 +49,9 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl }; 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 IHatchAdder<GT_MetaTileEntity_EM_annihilation>[] addingMethods = adders( + GT_MetaTileEntity_EM_annihilation::addClassicToMachineList, + GT_MetaTileEntity_EM_annihilation::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}; @@ -97,18 +100,18 @@ 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) { + Structure.builder(shape, blockType, blockMeta, 5, 5, 0, getBaseMetaTileEntity(), getExtendedFacing(), 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_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index 79ae424bcb..06476fb62e 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,23 +1,24 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.StructureDefinition; 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 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.mechanics.structure.StructureUtility.ofBlock; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofHatchAdderOptional; 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; @@ -34,6 +35,7 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; + //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 @@ -47,47 +49,95 @@ 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= StructureDefinition + .<GT_MetaTileEntity_EM_bhg>builder() + .addShapeOldApi("t1",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",}, + }) + .addShapeOldApi("t2",new String[][]{ + {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, + {"\u0008", "O0A0", "M550A055", "L5550A0555", "K55550A05555", "J5555111115555", "J5551101011555", "I000010010010000", "M1111111", "I000010010010000", "J5551101011555", "J5555111115555", "K55550A05555", "L5550A0555", "M550A055", "O0A0",}, + {"\u0006", "O0A0", "M550A055", "K55550A05555", "J555C1C555", "I555D1D555", "I55B1111111B55", "H55B11E11B55", "H55B1B222B1B55", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "H55B1B222B1B55", "H55B11E11B55", "I55B1111111B55", "I555D1D555", "J555C1C555", "K55550A05555", "M550A055", "O0A0",}, + {"\u0005", "O0A0", "L5550A0555", "J555C1C555", "I55E1E55", "H55M55", "H5O5", "G55O55", "G5Q5", "G5Q5", "F00Q00", "H11M11", "F00Q00", "G5Q5", "G5Q5", "G55O55", "H5O5", "H55M55", "I55E1E55", "J555C1C555", "L5550A0555", "O0A0",}, + {"\u0004", "O0A0", "K55500000555", "I555D1D555", "H55F4F55", "G55G4G55", "G5Q5", "F55Q55", "F5S5", "F5S5", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "F5S5", "F5S5", "F55Q55", "G5Q5", "G55G4G55", "H55F4F55", "I555D1D555", "K55500000555", "O0A0",}, + {"\u0003", "O0A0", "J555550A055555", "H555E1E555", "G55D2224222D55", "F55Q55", "F5S5", "E55S55", "E5U5", "E5U5", "E5A2Q2A5", "E5A2Q2A5", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "E5A2Q2A5", "E5A2Q2A5", "E5U5", "E5U5", "E55S55", "F5S5", "F55Q55", "G55D2224222D55", "H555E1E555", "J555550A055555", "O0A0",}, + {"\u0002", "O0A0", "K55500000555", "H555E1E555", "G55G4G55", "F5S5", "E55S55", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "E55S55", "F5S5", "G55G4G55", "H555E1E555", "K55500000555", "O0A0",}, + {"\u0001", "O0A0", "L5550A0555", "I555D1D555", "G55D2224222D55", "F5S5", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "C5Y5", "C5A2U2A5", "C5A2U2A5", "B00A2U2A00", "D14U41", "B00A2U2A00", "C5A2U2A5", "C5A2U2A5", "C5Y5", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "F5S5", "G55D2224222D55", "I555D1D555", "L5550A0555", "O0A0",}, + {"\u0001", "M550A055", "J555C1C555", "H55F4F55", "F55Q55", "E55S55", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B0[0", "C14W41", "B0[0", "B5[5", "B5[5", "C5Y5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "E55S55", "F55Q55", "H55F4F55", "J555C1C555", "M550A055",}, + {E, "O0A0", "K55550A05555", "I55E1E55", "G55G4G55", "F5S5", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "B5[5", "A00[00", "C14W41", "A00[00", "B5[5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "F5S5", "G55G4G55", "I55E1E55", "K55550A05555", "O0A0",}, + {E, "M550A055", "J555C1C555", "H55M55", "G5Q5", "E55S55", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "E55S55", "G5Q5", "H55M55", "J555C1C555", "M550A055",}, + {E, "L5550A0555", "I555D1D555", "H5O5", "F55Q55", "E5U5", "D5W5", "D5W5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "D5W5", "D5W5", "E5U5", "F55Q55", "H5O5", "I555D1D555", "L5550A0555",}, + {"O0A0", "K55550A05555", "I55B1111111B55", "G55O55", "F5S5", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "001[100", "B1[1", "001[100", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "F5S5", "G55O55", "I55B1111111B55", "K55550A05555", "O0A0",}, + {"O0A0", "J5555111115555", "H55B11E11B55", "G5Q5", "F5S5", "E5A2Q2A5", "D5W5", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D5W5", "E5A2Q2A5", "F5S5", "G5Q5", "H55B11E11B55", "J5555111115555", "O0A0",}, + {"O0A0", "J5551101011555", "H55B1B222B1B55", "G5Q5", "F0S0", "E5A2Q2A5", "D0W0", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D0W0", "E5A2Q2A5", "F0S0", "G5Q5", "H55B1B222B1B55", "J5551101011555", "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", "J5551101011555", "H55B1B222B1B55", "G5Q5", "F0S0", "E5A2Q2A5", "D0W0", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D0W0", "E5A2Q2A5", "F0S0", "G5Q5", "H55B1B222B1B55", "J5551101011555", "O0A0",}, + {"O0A0", "J5555111115555", "H55B11E11B55", "G5Q5", "F5S5", "E5A2Q2A5", "D5W5", "C5A2U2A5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5A2U2A5", "D5W5", "E5A2Q2A5", "F5S5", "G5Q5", "H55B11E11B55", "J5555111115555", "O0A0",}, + {"O0A0", "K55550A05555", "I55B1111111B55", "G55O55", "F5S5", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "A5]5", "A5]5", "A51[15", "A51[15", "001[100", "B1[1", "001[100", "A51[15", "A51[15", "A5]5", "A5]5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "F5S5", "G55O55", "I55B1111111B55", "K55550A05555", "O0A0",}, + {E, "L5550A0555", "I555D1D555", "H5O5", "F55Q55", "E5U5", "D5W5", "D5W5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "D5W5", "D5W5", "E5U5", "F55Q55", "H5O5", "I555D1D555", "L5550A0555",}, + {E, "M550A055", "J555C1C555", "H55M55", "G5Q5", "E55S55", "E5U5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "A5]5", "A5]5", "A0]0", "B1[1", "A0]0", "A5]5", "A5]5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "E5U5", "E55S55", "G5Q5", "H55M55", "J555C1C555", "M550A055",}, + {E, "O0A0", "K55550A05555", "I55E1E55", "G55G4G55", "F5S5", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B5[5", "B5[5", "A00[00", "C14W41", "A00[00", "B5[5", "B5[5", "B5[5", "B5[5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "F5S5", "G55G4G55", "I55E1E55", "K55550A05555", "O0A0",}, + {"\u0001", "M550A055", "J555C1C555", "H55F4F55", "F55Q55", "E55S55", "E5U5", "D5W5", "D5W5", "C5Y5", "C5Y5", "C5Y5", "B5[5", "B5[5", "B0[0", "C14W41", "B0[0", "B5[5", "B5[5", "C5Y5", "C5Y5", "C5Y5", "D5W5", "D5W5", "E5U5", "E55S55", "F55Q55", "H55F4F55", "J555C1C555", "M550A055",}, + {"\u0001", "O0A0", "L5550A0555", "I555D1D555", "G55D2224222D55", "F5S5", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "C5Y5", "C5A2U2A5", "C5A2U2A5", "B00A2U2A00", "D14U41", "B00A2U2A00", "C5A2U2A5", "C5A2U2A5", "C5Y5", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "F5S5", "G55D2224222D55", "I555D1D555", "L5550A0555", "O0A0",}, + {"\u0002", "O0A0", "K55500000555", "H555E1E555", "G55G4G55", "F5S5", "E55S55", "E5U5", "E5U5", "D5W5", "D5W5", "D5W5", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "D5W5", "D5W5", "D5W5", "E5U5", "E5U5", "E55S55", "F5S5", "G55G4G55", "H555E1E555", "K55500000555", "O0A0",}, + {"\u0003", "O0A0", "J555550A055555", "H555E1E555", "G55D2224222D55", "F55Q55", "F5S5", "E55S55", "E5U5", "E5U5", "E5A2Q2A5", "E5A2Q2A5", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "E5A2Q2A5", "E5A2Q2A5", "E5U5", "E5U5", "E55S55", "F5S5", "F55Q55", "G55D2224222D55", "H555E1E555", "J555550A055555", "O0A0",}, + {"\u0004", "O0A0", "K55500000555", "I555D1D555", "H55F4F55", "G55G4G55", "G5Q5", "F55Q55", "F5S5", "F5S5", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "F5S5", "F5S5", "F55Q55", "G5Q5", "G55G4G55", "H55F4F55", "I555D1D555", "K55500000555", "O0A0",}, + {"\u0005", "O0A0", "L5550A0555", "J555C1C555", "I55E1E55", "H55M55", "H5O5", "G55O55", "G5Q5", "G5Q5", "F00Q00", "H11M11", "F00Q00", "G5Q5", "G5Q5", "G55O55", "H5O5", "H55M55", "I55E1E55", "J555C1C555", "L5550A0555", "O0A0",}, + {"\u0006", "O0A0", "M550A055", "K55550A05555", "J555C1C555", "I555D1D555", "I55B1111111B55", "H55B11E11B55", "H55B1B222B1B55", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "H55B1B222B1B55", "H55B11E11B55", "I55B1111111B55", "I555D1D555", "J555C1C555", "K55550A05555", "M550A055", "O0A0",}, + {"\u0008", "O0A0", "M550A055", "L5550A0555", "K55550A05555", "J5555111115555", "J5551101011555", "I000010010010000", "M1111111", "I000010010010000", "J5551101011555", "J5555111115555", "K55550A05555", "L5550A0555", "M550A055", "O0A0",}, + {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, + }) + .addElement('0', ofBlock(sBlockCasingsTT,12)) + .addElement('1', ofBlock(sBlockCasingsTT,13)) + .addElement('2', ofBlock(sBlockCasingsTT,14)) + .addElement('3', ofBlock(sBlockCasingsTT,10)) + .addElement('4', ofBlock(sBlockCasingsTT,11)) + .addElement('5', ofBlock(QuantumGlassBlock.INSTANCE,0)) + .addElement(' ', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addClassicToMachineList, + textureOffset,1,sBlockCasingsTT,0)) + .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_bhg::addElementalToMachineList, + textureOffset + 4,2,sBlockCasingsTT,4)) + .build(); + + @Override + public IStructureDefinition<? extends GT_MetaTileEntity_MultiblockBase_EM> 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 +145,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 +269,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 +301,18 @@ 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) { + structureBuild_EM((stackSize.stackSize&1)==1?"t1":"t2", 16, 16, 0, hintsOnly,stackSize); } @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 index 2b0b0f8465..329b3cbc14 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -1,9 +1,10 @@ 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.constructable.IConstructable; +import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalDecayResult; 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; @@ -11,20 +12,23 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElem import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dHadronDefinition; import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.StructureDefinition; 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 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 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; @@ -33,11 +37,14 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; -import static com.github.technus.tectech.Util.StructureBuilderExtreme; +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; 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 net.minecraft.util.StatCollector.translateToLocal; /** @@ -277,7 +284,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } return STATUS_WRONG; } - return STATUS_UNUSED; + return STATUS_OK; }; private static final INameFunction<GT_MetaTileEntity_EM_collider> MODE_NAME = (base_EM, p) -> { if (base_EM.isMaster()) { @@ -295,47 +302,49 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB //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 IStructureDefinition<GT_MetaTileEntity_EM_collider> STRUCTURE_DEFINITION = StructureDefinition + .<GT_MetaTileEntity_EM_collider>builder() + .addShapeOldApi("main", 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",}, + }) + .addElement('0', ofBlock(sBlockCasingsTT, 4)) + .addElement('1', ofBlock(sBlockCasingsTT, 7)) + .addElement('2', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), + error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 5))) + .addElement('3', ofBlock(QuantumGlassBlock.INSTANCE, 0)) + .addElement('4', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), + error(), ofBlock(sBlockCasingsTT, 4), ofBlock(sBlockCasingsTT, 6))) + .addElement('5', defer(t -> (int) t.eTier, (t, item) -> 2 - (item.stackSize & 1), + error(), ofBlock(sBlockCasingsTT, 8), ofBlock(sBlockCasingsTT, 9))) + .addElement('&', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addClassicToMachineList, + textureOffset, 1, sBlockCasingsTT, 0)) + .addElement('!', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalInputToMachineList, + textureOffset + 4, 2, sBlockCasingsTT, 4)) + .addElement('$', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalOutputToMachineList, + textureOffset + 4, 3, sBlockCasingsTT, 4)) + .addElement('#', ofHatchAdderOptional(GT_MetaTileEntity_EM_collider::addElementalMufflerToMachineList, + textureOffset + 4, 4, sBlockCasingsTT, 4)) + .build(); 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 @@ -344,6 +353,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB 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 }; + + @Override + public IStructureDefinition<? extends GT_MetaTileEntity_MultiblockBase_EM> getStructure_EM() { + return STRUCTURE_DEFINITION; + } + //endregion public GT_MetaTileEntity_EM_collider(int aID, String aName, String aNameRegional) { @@ -355,19 +370,19 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } public static void setValues(int heliumPlasmaValue) { - double MASS_TO_EU_PARTIAL = heliumPlasmaValue / 1.75893000478707E07;//mass diff + double MASS_TO_EU_PARTIAL = heliumPlasmaValue / (1.75893000478707E07* AVOGADRO_CONSTANT);//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) { + protected double fuse(GT_MetaTileEntity_EM_collider partner) {///CAN MAKE EU if (partner.stack != null && stack != null) {//todo add single event mode as an option boolean check = stack.definition.fusionMakesEnergy(stack.getEnergy()) && partner.stack.definition.fusionMakesEnergy(partner.stack.getEnergy()); cElementalInstanceStack stack2 = partner.stack; - double preMass = stack2.getMass() + stack.getMass(); + double preMass = add(stack2.getMass(),stack.getMass()); //System.out.println("preMass = " + preMass); cElementalInstanceStackMap map = new cElementalInstanceStackMap(); @@ -388,8 +403,33 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB 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 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 + 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; + } + //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 Math.min(preMass - map.getMass(), 0); } return 0; } @@ -427,20 +467,23 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB private void makeEU(double massDiff) { plasmaEnergy += massDiff * MASS_TO_EU_INSTANT; - System.out.println("plasmaEnergy = " + plasmaEnergy); + if (DEBUG_MODE) { + System.out.println("plasmaEnergy = " + plasmaEnergy); + } } private cElementalInstanceStackMap tickStack() { if (stack == null) { return null; } - cElementalInstanceStackMap newInstances = stack.decay(1, stack.age += 1, 0); + cElementalDecayResult newInstances = stack.decay(1, stack.age += 1, 0); if (newInstances == null) { stack.nextColor(); + return null; } else { - stack = newInstances.remove(newInstances.getLast().definition); + stack = newInstances.getOutput().remove(newInstances.getOutput().getLast().definition); + return newInstances.getOutput(); } - return newInstances; } @Override @@ -465,20 +508,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB 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) { + if (structureCheck_EM("main", 11, 1, 18)) { return true; } eTier = 0; @@ -517,14 +547,13 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB mMaxProgresstime = 20; mEUt = KEEPUP_COST; eAmpereFlow = 2; - return true; } else { started = true; mMaxProgresstime = 20; mEUt = STARTUP_COST; eAmpereFlow = 10; - return true; } + return true; } @Override @@ -543,7 +572,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB makeEU(fuse(partner)); break; case COLLIDE_MODE: - //collide(partner);//todo + collide(partner);//todo break; default: { outputEM = new cElementalInstanceStackMap[2]; @@ -592,9 +621,9 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB 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)}; + 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_RenderedTexture(aActive ? ScreenON_Slave : ScreenOFF_Slave)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedExtendedFacingTexture(aActive ? ScreenON_Slave : ScreenOFF_Slave)}; } } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4]}; @@ -665,7 +694,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { + public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; @@ -676,20 +705,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB 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); } + structureBuild_EM("main", 11, 1, 18, hintsOnly, stackSize); } @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_computer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java index edb581179e..6a6a707399 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,18 @@ 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.constructable.IConstructable; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_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.github.technus.tectech.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -28,12 +30,13 @@ 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.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; 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 net.minecraft.util.StatCollector.translateToLocal; /** @@ -54,7 +57,9 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB 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 IHatchAdder<GT_MetaTileEntity_EM_computer>[] addingMethods = adders( + GT_MetaTileEntity_EM_computer::addToMachineList, + GT_MetaTileEntity_EM_computer::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}; @@ -138,7 +143,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB totalLen++; offset--; } - if (totalLen > 16) { + if (totalLen > 17) { return false; } if (!structureCheck_EM(cap, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, ++offset)) { @@ -157,6 +162,23 @@ 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; @@ -224,7 +246,7 @@ 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()); QuantumDataPacket pack = new QuantumDataPacket(eAvailableData / eOutputData.size()).unifyTraceWith(pos); if (pack == null) { return; @@ -265,7 +287,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 +357,22 @@ 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); + Structure.builder(front, blockType, blockMeta, 1, 2, 0, igt, getExtendedFacing(), hintsOnly); + Structure.builder(cap, blockType, blockMeta, 1, 2, -1, igt, getExtendedFacing(), 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--) { + Structure.builder(slice, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); } - StructureBuilderExtreme(cap, blockType, blockMeta, 1, 2, offset--, igt, this, hintsOnly); - StructureBuilderExtreme(terminator, blockType, blockMeta, 1, 2, offset, igt, this, hintsOnly); + Structure.builder(cap, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); + Structure.builder(terminator, blockType, blockMeta, 1, 2, offset, igt, getExtendedFacing(), 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_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java index 263a46a9d3..7d8204c07f 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,11 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -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 cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -17,7 +18,7 @@ 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.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -50,7 +51,9 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB }; 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 IHatchAdder<GT_MetaTileEntity_EM_crafting>[] addingMethods = adders( + GT_MetaTileEntity_EM_crafting::addClassicToMachineList, + GT_MetaTileEntity_EM_crafting::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}; @@ -99,18 +102,18 @@ 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) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), 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_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index f18fe57b6f..77647a0e20 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,17 @@ 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.constructable.IConstructable; import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_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 cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -27,12 +28,12 @@ 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.mechanics.structure.Structure.adders; 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 net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { @@ -49,7 +50,9 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB }; 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 IHatchAdder<GT_MetaTileEntity_EM_dataBank>[] addingMethods = adders( + GT_MetaTileEntity_EM_dataBank::addClassicToMachineList, + GT_MetaTileEntity_EM_dataBank::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}; @@ -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,12 @@ 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) { + Structure.builder(shape, blockType, blockMeta, 2, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), 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_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 90879f1b60..d534b41fec 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,18 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.mechanics.constructable.IConstructable; 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.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; 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 cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -26,13 +31,14 @@ 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.bTransformationInfo.AVOGADRO_CONSTANT; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; 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 net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -44,7 +50,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10; + public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10* AVOGADRO_CONSTANT; 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_MASS_TO_EU_INSTANT = URANIUM_MASS_TO_EU_PARTIAL * 20; @@ -65,7 +71,9 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase }; 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 IHatchAdder<GT_MetaTileEntity_EM_decay>[] addingMethods = adders( + GT_MetaTileEntity_EM_decay::addClassicToMachineList, + GT_MetaTileEntity_EM_decay::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}; @@ -124,28 +132,24 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase outputEM[0] = input; outputEM[1] = new cElementalInstanceStackMap(); - 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)) { + if (stack.getEnergy() == 0 && stack.definition.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); 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(); } @@ -214,7 +218,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]}; } @@ -243,12 +247,12 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase } @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) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), 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_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 27b770c88b..9814092710 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,16 +1,18 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.mechanics.constructable.IConstructable; 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.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.iExchangeInfo; +import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -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 cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -24,13 +26,13 @@ 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.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.github.technus.tectech.util.CommonValues.V; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -47,10 +49,10 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo }; 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 IHatchAdder<GT_MetaTileEntity_EM_dequantizer>[] addingMethods = adders( + GT_MetaTileEntity_EM_dequantizer::addClassicToMachineList, + GT_MetaTileEntity_EM_dequantizer::addElementalInputToMachineList, + GT_MetaTileEntity_EM_dequantizer::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}; @@ -73,8 +75,8 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo private void startRecipe(iHasElementalDefinition 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]; @@ -98,32 +100,36 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo 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; + { + aFluidDequantizationInfo info = stack.getDefinition().someAmountIntoFluidStack(); + if (info != null) { + if (map.removeAllAmounts(false, info.input())) { + mOutputFluids = new FluidStack[]{info.output()}; + startRecipe(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; + { + aItemDequantizationInfo info = stack.getDefinition().someAmountIntoItemsStack(); + if (info != null) { + if (map.removeAllAmounts(false, info.input())) { + mOutputItems = new ItemStack[]{info.output()}; + startRecipe(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); - if (items != null && !items.isEmpty()) { - mOutputItems = new ItemStack[]{items.get(0)}; - startRecipe((iHasElementalDefinition) info.input(), stack.getEnergy()); - return true; + { + aOredictDequantizationInfo info = stack.getDefinition().someAmountIntoOredictStack(); + if (info != null) { + if (map.removeAllAmounts(false, info.input())) { + ArrayList<ItemStack> items = OreDictionary.getOres(info.out); + if (items != null && !items.isEmpty()) { + mOutputItems = new ItemStack[]{items.get(0)}; + startRecipe(info.input(), stack.getEnergy()); + return true; + } } } } @@ -148,12 +154,12 @@ 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) { + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), 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_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index 4e8e8d27ec..152d110c8d 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,14 +1,15 @@ 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.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; 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 cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -22,8 +23,8 @@ 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.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static gregtech.api.GregTech_API.mEUtoRF; @@ -41,7 +42,8 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa }; 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 IHatchAdder<GT_MetaTileEntity_EM_infuser>[] addingMethods = adders( + GT_MetaTileEntity_EM_infuser::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}; @@ -182,12 +184,12 @@ 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) { + Structure.builder(shape, blockType, blockMeta, 1, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), 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_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index aba87eaf6b..b63079d2dc 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,10 +1,15 @@ 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.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_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 gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; @@ -12,11 +17,11 @@ 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.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.CommonValues.V; import static gregtech.api.enums.GT_Values.E; import static net.minecraft.util.StatCollector.translateToLocal; @@ -41,7 +46,9 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB }; 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 IHatchAdder<GT_MetaTileEntity_EM_junction>[] addingMethods = adders( + GT_MetaTileEntity_EM_junction::addClassicToMachineList, + GT_MetaTileEntity_EM_junction::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}; @@ -169,12 +176,12 @@ 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) { + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), 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_quantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java index 4d65b67ed0..d6ab35cd4b 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,8 +1,8 @@ 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.constructable.IConstructable; 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; @@ -10,10 +10,11 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations 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.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; 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 cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; @@ -28,18 +29,18 @@ 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.structure.Structure.adders; 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 net.minecraft.util.StatCollector.translateToLocal; /** @@ -56,10 +57,10 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock }; 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 IHatchAdder<GT_MetaTileEntity_EM_quantizer>[] addingMethods = adders( + GT_MetaTileEntity_EM_quantizer::addClassicToMachineList, + GT_MetaTileEntity_EM_quantizer::addElementalOutputToMachineList, + GT_MetaTileEntity_EM_quantizer::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}; @@ -154,8 +155,8 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock private void startRecipe(iHasElementalDefinition 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]; @@ -197,12 +198,12 @@ 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) { + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), 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_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index 93111e1f60..889b4cfec3 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,14 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.recipe.TT_recipe; -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 cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; @@ -35,15 +36,15 @@ 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.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; 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 com.github.technus.tectech.util.CommonValues.V; +import static com.github.technus.tectech.util.CommonValues.VN; import static gregtech.api.enums.GT_Values.E; import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -57,6 +58,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB 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; @@ -77,7 +79,9 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB }; 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 IHatchAdder<GT_MetaTileEntity_EM_research>[] addingMethods = adders( + GT_MetaTileEntity_EM_research::addClassicToMachineList, + GT_MetaTileEntity_EM_research::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}; @@ -236,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; } @@ -279,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; @@ -394,7 +399,7 @@ public class GT_MetaTileEntity_EM_research 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 ? 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]}; } @@ -466,6 +471,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; } } @@ -552,12 +558,12 @@ 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) { + Structure.builder(shape, blockType, blockMeta, 1, 3, 4, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } } 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 e03ea94928..b418ec0fa4 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.constructable.IConstructable; 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.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; 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 gregtech.api.enums.ItemList; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -32,17 +34,17 @@ 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.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; 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 net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; @@ -79,11 +81,11 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa }; 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 IHatchAdder<GT_MetaTileEntity_EM_scanner>[] addingMethods = adders( + GT_MetaTileEntity_EM_scanner::addClassicToMachineList, + GT_MetaTileEntity_EM_scanner::addElementalInputToMachineList, + GT_MetaTileEntity_EM_scanner::addElementalOutputToMachineList, + GT_MetaTileEntity_EM_scanner::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}; @@ -513,12 +515,12 @@ 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 stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), 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_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index b159827012..dcd85af99d 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,17 +1,18 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -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 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.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -30,7 +31,9 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc }; 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 IHatchAdder<GT_MetaTileEntity_EM_stabilizer>[] addingMethods = adders( + GT_MetaTileEntity_EM_stabilizer::addClassicToMachineList, + GT_MetaTileEntity_EM_stabilizer::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}; @@ -69,12 +72,12 @@ 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) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), 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_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index 795349c50c..5ade4ec965 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,14 +1,19 @@ 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.constructable.IConstructable; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_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.github.technus.tectech.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -20,12 +25,12 @@ 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.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; 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 net.minecraft.util.StatCollector.translateToLocal; /** @@ -40,7 +45,8 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas }; 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 IHatchAdder<GT_MetaTileEntity_EM_switch>[] addingMethods = adders( + GT_MetaTileEntity_EM_switch::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}; @@ -128,7 +134,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } } - Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); + Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity()); QuantumDataPacket pack = new QuantumDataPacket(0L).unifyTraceWith(pos); if (pack == null) { return; @@ -191,7 +197,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 +222,12 @@ 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) { + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), 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_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 1a3bebf59b..cdac772541 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,29 +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.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.StructureDefinition; 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 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.mechanics.structure.StructureUtility.*; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; import static gregtech.api.GregTech_API.sBlockCasings1; import static net.minecraft.util.StatCollector.translateToLocal; @@ -32,21 +33,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[]{ 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 = + StructureDefinition.<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,sHintCasingsTT,0), + 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 +87,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 +128,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 +159,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, hintsOnly, stackSize); } @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..fa51447e9f 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,11 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; -import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -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 cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -17,7 +18,7 @@ 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.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -49,7 +50,9 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB }; 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 IHatchAdder<GT_MetaTileEntity_EM_wormhole>[] addingMethods = adders( + GT_MetaTileEntity_EM_wormhole::addClassicToMachineList, + GT_MetaTileEntity_EM_wormhole::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}; @@ -98,18 +101,18 @@ 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) { + Structure.builder(shape, blockType, blockMeta, 4, 4, 0, getBaseMetaTileEntity(), getExtendedFacing(), 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_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 60a642ee95..543c09b72a 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,10 +1,13 @@ 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.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; 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.Vec3Impl; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -23,11 +26,12 @@ 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.mechanics.structure.Structure.adders; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static gregtech.api.GregTech_API.sBlockCasings4; +import static net.minecraft.util.AxisAlignedBB.getBoundingBox; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -50,7 +54,8 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock 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 IHatchAdder<GT_MetaTileEntity_TM_microwave>[] addingMethods = adders( + GT_MetaTileEntity_TM_microwave::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}; @@ -124,16 +129,14 @@ 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]; - } + 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) + @@ -169,8 +172,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); @@ -206,11 +209,11 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @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 +248,12 @@ 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) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), 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_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..189eae8205 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -0,0 +1,134 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +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.render.TT_RenderedExtendedFacingTexture; +import com.github.technus.tectech.util.CommonValues; +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_Utility; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import static com.github.technus.tectech.mechanics.structure.Structure.adders; +import static gregtech.api.GregTech_API.sBlockCasings4; +import static net.minecraft.util.StatCollector.translateToLocal; + +public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + //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, false, true, true); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, true, 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 13b9e72070..93f6e50c5a 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,22 +1,27 @@ 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.constructable.IConstructable; +import com.github.technus.tectech.mechanics.spark.RendererMessage; +import com.github.technus.tectech.mechanics.spark.ThaumSpark; +import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.tesla.ITeslaConnectable; 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.github.technus.tectech.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; @@ -27,55 +32,63 @@ 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.loader.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.mechanics.structure.Structure.adders; +import static com.github.technus.tectech.mechanics.tesla.ITeslaConnectable.TeslaUtil.*; 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 com.github.technus.tectech.util.CommonValues.V; import static gregtech.api.enums.GT_Values.E; +import static java.lang.Math.*; import static net.minecraft.util.StatCollector.translateToLocal; -public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { +public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable, ITeslaConnectable { //region variables - private final static HashSet<ThaumSpark> sparkList = new HashSet<>(); - + 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 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 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 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 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 final ArrayList<GT_MetaTileEntity_Hatch_Capacitor> eCapacitorHatches = new ArrayList<>(); //Capacitor hatches which determine the max voltage tier and count of amps - private int scanTime = 0; //Scan timer used for tesla search intervals + private int sortTime = 0; //Scan timer used for tesla search intervals 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 long outputCurrentMax = 0; //Tesla current output limited by capacitors - //Prevents unnecessary offset calculation + //outputVoltage and current after settings + private long outputVoltage; + private long outputCurrent; + + //Prevents unnecessary offset calculation, saving on lag private byte oldRotation = -1; private byte oldOrientation = -1; - - //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 + //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 @@ -95,8 +108,11 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock 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 byte[] blockMetaT6 = new byte[]{7, 9, 6, 8}; + private static final byte[][] blockMetas = new byte[][]{blockMetaT0, blockMetaT1, blockMetaT2, blockMetaT3, blockMetaT4, blockMetaT5, blockMetaT6}; + private static final IHatchAdder<GT_MetaTileEntity_TM_teslaCoil>[] addingMethods = adders( + GT_MetaTileEntity_TM_teslaCoil::addCapacitorToMachineList, + GT_MetaTileEntity_TM_teslaCoil::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}; @@ -108,8 +124,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock //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 @@ -153,17 +169,26 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock 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 > 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 > 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) -> { @@ -200,7 +225,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock 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) -> { @@ -234,60 +259,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 @@ -304,9 +333,12 @@ 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) { for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { @@ -316,37 +348,15 @@ 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(); //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(getBaseMetaTileEntity()); //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(getBaseMetaTileEntity()); } return true; } @@ -355,6 +365,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 || @@ -362,7 +374,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; @@ -379,10 +391,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; @@ -435,26 +443,23 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock @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]}; } @Override public void onRemoval() { + super.onRemoval(); + if (this.getBaseMetaTileEntity().isClientSide()) { + return; + } + teslaNodeSet.remove(this); for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { - try { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(cap)) { cap.getBaseMetaTileEntity().setActive(false); - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } } } - super.onRemoval(); - for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { - cap.getBaseMetaTileEntity().setActive(false); - } } @Override @@ -474,17 +479,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); @@ -497,15 +502,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); @@ -523,6 +528,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); energyCapacity = aNBT.getLong("eEnergyCapacity"); + teslaNodeSet.add(this); } @Override @@ -532,23 +538,29 @@ 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 void onFirstTick_EM(IGregTechTileEntity aBaseMetaTileEntity) { + super.onFirstTick_EM(aBaseMetaTileEntity); + if (!aBaseMetaTileEntity.isClientSide()) { + teslaNodeSet.add(this); + } + } + + @Override public boolean onRunningTick(ItemStack aStack) { IGregTechTileEntity mte = getBaseMetaTileEntity(); //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()) { @@ -557,236 +569,65 @@ 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; + //Create the teslaNodeMap + if (sortTime == sortTimeMinSetting.get()) { + sortTime = 0; + sortTimeDisplay.updateStatus(); + generateTeslaNodeMap(this); } - - scanTime++; - scanTimeDisplay.set(scanTime); + sortTime++; + sortTimeDisplay.set(sortTime); //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()) { - NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList), - mte.getWorld().provider.dimensionId, - mte.getXCoord(), - mte.getYCoord(), - mte.getZCoord(), - 256); - } - sparkList.clear(); - } else { - outputCurrentDisplay.set(0); + //Range calculation and display + int transferRadiusTower = getTeslaTransmissionRange(); + transferRadiusTowerDisplay.set(transferRadiusTower); + transferRadiusTransceiverDisplay.set(transferRadiusTower * 2); + transferRadiusCoverUltimateDisplay.set(transferRadiusTower); + + //Clean the teslaNodeMap + cleanTeslaNodeMap(this); + + //Power transfer + outputCurrentDisplay.set(powerTeslaNodeMap(this)); + + if (!sparkList.isEmpty()) { + NetworkDispatcher.INSTANCE.sendToAllAround(new RendererMessage.RendererData(sparkList), + mte.getWorld().provider.dimensionId, + posTop.get0(), + posTop.get1(), + posTop.get2(), + 256); } + sparkList.clear(); + 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) { @@ -825,6 +666,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; } @@ -833,12 +682,96 @@ 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 void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMetas[(stackSize.stackSize - 1) % 7], 3, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), 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 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..8086b70691 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; 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..8abb027d3f 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,25 @@ 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.loader.NetworkDispatcher; +import com.github.technus.tectech.mechanics.alignment.AlignmentLimits; +import com.github.technus.tectech.mechanics.alignment.AlignmentMessage; +import com.github.technus.tectech.mechanics.alignment.IAlignment; +import com.github.technus.tectech.mechanics.alignment.IAlignmentLimits; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; +import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; import com.github.technus.tectech.mechanics.elementalMatter.core.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.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.Structure; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; 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.github.technus.tectech.util.Vec3Impl; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -31,22 +39,24 @@ 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 +89,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 @@ -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 = AlignmentLimits.UNLIMITED; + private ExtendedFacing extendedFacing = ExtendedFacing.DEFAULT; //endregion protected GT_MetaTileEntity_MultiblockBase_EM(int aID, String aName, String aNameRegional) { @@ -148,357 +160,87 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } //region SUPER STRUCT + @Override + public ExtendedFacing getExtendedFacing() { + return extendedFacing; + } @Override - public boolean isFrontRotationValid(byte frontRotation, byte frontFacing) { - return true; + 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); + }else{ + base.issueTextureUpdate(); + } + } } - public boolean isFacingValid_EM(byte aFacing) { - return true; + @Override + public IAlignmentLimits getAlignmentLimits() { + return alignmentLimits; } @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 setAlignmentLimits(IAlignmentLimits limits) { + alignmentLimits=limits; } - /** - * 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; - - 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 IStructureDefinition<? extends GT_MetaTileEntity_MultiblockBase_EM> getStructure_EM(){ + throw new NoSuchMethodError("Implement it as STATIC INSTANCE"); } - 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; + @SuppressWarnings("unchecked") + private IStructureDefinition<GT_MetaTileEntity_MultiblockBase_EM> getStructure_EM_Internal(){ + return (IStructureDefinition<GT_MetaTileEntity_MultiblockBase_EM>)getStructure_EM(); } - //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 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); + } + + public final boolean structureBuild_EM(String piece,int horizontalOffset, int verticalOffset, int depthOffset,boolean hintsOnly,ItemStack trigger) { + IGregTechTileEntity baseMetaTileEntity = getBaseMetaTileEntity(); + return getStructure_EM_Internal().buildOrHints(this, trigger, piece, baseMetaTileEntity.getWorld(), + getExtendedFacing(), baseMetaTileEntity.getXCoord(), baseMetaTileEntity.getYCoord(), + baseMetaTileEntity.getZCoord(), horizontalOffset, verticalOffset, depthOffset, hintsOnly); + } - public final boolean structureCheck_EM( + @Deprecated + @SuppressWarnings("unchecked") + public final <T extends GT_MetaTileEntity_MultiblockBase_EM> 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, + IHatchAdder<T>[] 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); + return Structure.checker(structure, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, + horizontalOffset, verticalOffset, depthOffset, (T)this, getExtendedFacing(), !mMachine); } //endregion @@ -728,7 +470,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]}; } @@ -903,7 +645,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt */ protected long getAvailableData_EM() { long result = 0; - Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); + Vec3Impl pos = new Vec3Impl(getBaseMetaTileEntity()); for (GT_MetaTileEntity_Hatch_InputData in : eInputData) { if (in.q != null) { Long value = in.q.contentIfNotInTrace(pos); @@ -975,7 +717,8 @@ 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("eVoid", eSafeVoid); @@ -1065,7 +808,10 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt eCertainMode = aNBT.getByte("eCertainM"); eCertainStatus = aNBT.getByte("eCertainS"); minRepairStatus = aNBT.getByte("eMinRepair"); - frontRotation = aNBT.getByte("eRotation"); + extendedFacing=ExtendedFacing.of( + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()), + Rotation.byIndex(aNBT.getByte("eRotation")), + Flip.byIndex(aNBT.getByte("eFlip"))); eParameters = aNBT.getBoolean("eParam"); ePowerPass = aNBT.getBoolean("ePass"); eSafeVoid = aNBT.getBoolean("eVoid"); @@ -1264,40 +1010,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 +1091,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)); + NetworkDispatcher.INSTANCE.sendToServer(new AlignmentMessage.AlignmentQuery(this)); } onFirstTick_EM(aBaseMetaTileEntity); } @@ -1433,12 +1145,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { + 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) { + for (GT_MetaTileEntity_Hatch_DataConnector<?> hatch_data : eInputData) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { hatch_data.id = -1; } @@ -1502,13 +1214,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } id = 1; - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { + 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) { + for (GT_MetaTileEntity_Hatch_DataConnector<?> hatch_data : eInputData) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) { hatch_data.id = id++; } @@ -1665,12 +1377,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (voider.overflowMax < voider.getOverflowMatter()) { continue; } - float remaining = voider.overflowMax - voider.getOverflowMatter(); + double 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()); + double qty = div(remaining,instance.definition.getMass()); if (qty > 0) { - qty = Math.min(qty, instance.amount); + qty = min(qty, instance.amount); if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { voider.setOverflowMatter(voider.overflowMax); } @@ -1680,9 +1392,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) { for (cElementalInstanceStack instance : out.getContainerHandler().values()) { - long qty = (long) Math.floor(remaining / instance.definition.getMass()); + double qty = div(remaining,instance.definition.getMass()); if (qty > 0) { - qty = Math.min(qty, instance.amount); + qty = min(qty, instance.amount); if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { voider.setOverflowMatter(voider.overflowMax); } @@ -1728,7 +1440,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt 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)) { + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, 1), false)) { tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } @@ -1737,7 +1449,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt 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)) { + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.max(euVar / 24576, tHatch.Amperes), false)) { tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } @@ -1787,7 +1499,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt 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 +1514,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(); } @@ -1975,7 +1687,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } } - setEUVar(Math.min(getEUVar() + euVar, maxEUStore())); + setEUVar(min(getEUVar() + euVar, maxEUStore())); return false; } @@ -1999,6 +1711,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } private boolean drainEnergyInput_EM(long EUtTierVoltage, long EUtEffective, long Amperes) { + if(maxEUinputMin==0){ + return false; + } if (EUtTierVoltage < 0) { EUtTierVoltage = -EUtTierVoltage; } @@ -2151,7 +1866,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt 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); 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..44fa12ebb8 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,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base.render; -import com.github.technus.tectech.thing.metaTileEntity.IFrontRotation; +import com.github.technus.tectech.mechanics.alignment.IAlignmentProvider; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import gregtech.api.enums.Dyes; import gregtech.api.interfaces.IColorModulationContainer; import gregtech.api.interfaces.IIconContainer; @@ -14,8 +15,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,25 +28,25 @@ 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); + 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); @@ -55,7 +57,7 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { @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); + 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); @@ -66,7 +68,7 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { @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); + 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); @@ -77,7 +79,7 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { @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); + 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); @@ -88,7 +90,7 @@ 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); + 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); @@ -99,7 +101,7 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { @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); + 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); @@ -111,26 +113,46 @@ public class TT_RenderedTexture implements ITexture,IColorModulationContainer { /** * 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 +160,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 +174,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 +186,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 +232,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 +279,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 +293,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 +305,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 +351,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 +378,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 +412,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 +426,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 +438,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 +484,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 +504,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 +538,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 +552,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 +564,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 +610,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 +630,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 +664,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 +678,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 +690,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 +736,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 +762,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 +796,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 +810,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 +822,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 +875,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_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java index ef8c0e7c3d..1ed1278bce 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 @@ -4,23 +4,29 @@ 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.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.bTransformationInfo.AVOGADRO_CONSTANT_144; 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,12 +71,12 @@ 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 = dAtomDefinition.getSomethingHeavy().getMass() * (1 << tier); maxForce = maxSafeMass * maxRCF;// (eV/c^2 * m/s) / g - maxCapacity = maxSafeMass * 4f * radius;// eV/c^2 + maxCapacity = maxSafeMass * AVOGADRO_CONSTANT_144 * radius;// eV/c^2 } private double getRCF(double RPM) { @@ -78,19 +84,19 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav } private void addRandomly(cElementalInstanceStack me, cElementalInstanceStackMap[] toThis, int fractionCount) { - long amountPerFraction = me.amount / fractionCount; + double amountPerFraction = div(me.amount,fractionCount); cElementalInstanceStack[] stacks = new cElementalInstanceStack[fractionCount]; for (int i = 0; i < fractionCount; i++) { stacks[i] = me.clone(); stacks[i].amount = 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 @@ -116,15 +122,16 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav for (cElementalInstanceStack 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 + double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); + randomStack.amount= sub(randomStack.amount,amountToRemove);//mutates the parent InstanceStackMap if (randomStack.amount <= 0) { input.remove(randomStack.definition); + stacks = input.values(); } - float mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; + double mass = Math.abs(randomStack.getDefinition().getMass()) * amountToRemove; excessMass += mass; inputMass -= mass; } @@ -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)); @@ -158,8 +165,8 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav stacks = input.takeAllToNewMap().values();//cleanup stacks if (stacks.length > 1) { Arrays.sort(stacks, (o1, o2) -> { - float m1 = o1.definition.getMass(); - float m2 = o2.definition.getMass(); + double m1 = o1.definition.getMass(); + double m2 = o2.definition.getMass(); if (m1 < m2) return -1; if (m1 > m2) return 1; return o1.compareTo(o2); @@ -169,17 +176,17 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav for (cElementalInstanceStack stack : stacks) { double tempMass=Math.abs(stack.getMass()); if(tempMass!=0) { - long amount = stack.amount; - stack.amount *= mixingFactor; + double amount = stack.amount; + stack.amount = mul(stack.amount,mixingFactor); addRandomly(stack, outputs, fractionCount); - stack.amount = amount - stack.amount; + stack.amount = sub(amount,stack.amount); 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].definition.getMass())); //if(DEBUG_MODE){ // TecTech.LOGGER.info("stackMass "+stackMass); // TecTech.LOGGER.info("defMass "+stacks[stackNo].definition.getMass()); @@ -201,15 +208,15 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehav addRandomly(stacks[stackNo], outputs, fractionCount); stacks[stackNo] = null; } else if (amount >= stacks[stackNo].amount) { - remaining -= stackMass; + remaining= sub(remaining,stackMass); outputs[fraction].putUnify(stacks[stackNo]); stacks[stackNo] = null; } else if (amount > 0) { - remaining -= amount * stacks[stackNo].definition.getMass(); + remaining= sub(remaining, mul(amount,stacks[stackNo].definition.getMass())); cElementalInstanceStack clone = stacks[stackNo].clone(); clone.amount = amount; outputs[fraction].putUnify(clone); - stacks[stackNo].amount-=amount; + stacks[stackNo].amount= sub(stacks[stackNo].amount,amount); //if(DEBUG_MODE){ // TecTech.LOGGER.info("remainingAfter "+remaining); // TecTech.LOGGER.info("amountCloneAfter "+clone.amount+"/"+stacks[stackNo].amount); 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..40e2942bab 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 @@ -4,13 +4,16 @@ 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.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.bTransformationInfo.AVOGADRO_CONSTANT_144; +import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static com.github.technus.tectech.util.DoubleCount.mul; +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= dAtomDefinition.getSomethingHeavy().getMass()*(2<<tier)* AVOGADRO_CONSTANT_144; + maxCharge=144D*(1<<(tier-5)); switch (tier){ case 12: precisionFull=1; @@ -153,20 +156,20 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_ 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 + double amountToRemove = TecTech.RANDOM.nextDouble()/10D * randomStack.getAmount(); + randomStack.amount= sub(randomStack.amount,amountToRemove);//mutates the parent InstanceStackMap if (randomStack.amount <= 0) { input.remove(randomStack.definition); } - 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); @@ -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.amount,(Math.abs(charge)-precisionMinimalIn+1D)/levelsCountPlus1);//todo check + if (amount < stack.amount) { + cElementalInstanceStack clone = stack.clone(); + clone.amount = sub(clone.amount, amount); outputs[1].putReplace(clone); - stack.amount=amount; - if(charge>0){ - outputs[2].putReplace(stack); - }else { - outputs[0].putReplace(stack); - } + stack.amount = 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_Recycler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java index 8187759445..c86c06b2a0 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 @@ -4,17 +4,17 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInsta 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 @@ -27,7 +27,7 @@ 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; + double mass=0; for (cElementalInstanceStackMap input : inputs) { if (input != null) { mass += input.getMass(); 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..6b26132292 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,15 @@ 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.constructable.IConstructable; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; +import com.github.technus.tectech.mechanics.structure.adders.IHatchAdder; +import com.github.technus.tectech.mechanics.structure.Structure; import com.github.technus.tectech.thing.block.QuantumGlassBlock; 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 gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; @@ -21,7 +23,7 @@ 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.mechanics.structure.Structure.adders; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; @@ -49,7 +51,9 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa {"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 IHatchAdder<GT_MetaTileEntity_EM_machine>[] addingMethods = adders( + GT_MetaTileEntity_EM_machine::addClassicToMachineList, + GT_MetaTileEntity_EM_machine::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}; @@ -349,12 +353,12 @@ 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) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 1, getBaseMetaTileEntity(), getExtendedFacing(), 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/pipe/GT_MetaTileEntity_Pipe_Data.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java index 59ad1b927e..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; @@ -31,7 +34,7 @@ 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; @@ -118,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; @@ -200,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))) { @@ -275,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 98e0feccd1..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; @@ -32,7 +35,7 @@ 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; @@ -119,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; @@ -240,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 ce315fcd86..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; @@ -31,11 +34,11 @@ import static com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEn 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); @@ -115,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; @@ -180,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 b65601185b..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,9 +20,7 @@ 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 { @@ -54,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]))}; 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 4ad9e05b89..d942786916 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,12 @@ 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; /** @@ -69,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 @@ -92,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; @@ -185,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 { 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 183b999c3b..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,7 @@ 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; /** @@ -57,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 @@ -148,7 +148,7 @@ public class GT_MetaTileEntity_DebugPollutor extends GT_MetaTileEntity_TieredMac 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.1")//Since i wanted one... + 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 a666510666..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,7 @@ 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; /** @@ -56,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 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 cdfdee7899..3b194c516b 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.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.structure.StructureUtility; 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 cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; @@ -19,8 +21,9 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; -import static com.github.technus.tectech.Util.StructureWriter; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -56,7 +59,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 @@ -104,22 +107,36 @@ 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); + 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); + TecTech.LOGGER.info(pseudoJavaCode); + result = pseudoJavaCode.split("\\n"); + aBaseMetaTileEntity.disableWorking(); } @Override @@ -128,8 +145,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; } 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 28a5cf50b5..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; @@ -20,9 +20,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.reflect.FieldUtils; -import org.luaj.vm2.ast.Str; -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; @@ -59,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 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 351ca3a18a..388a253b27 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,16 +1,15 @@ 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.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.mechanics.spark.RendererMessage;
+import com.github.technus.tectech.mechanics.spark.ThaumSpark;
import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_TM_teslaCoil;
+import com.github.technus.tectech.util.Util;
+import com.github.technus.tectech.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;
@@ -18,60 +17,47 @@ 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;
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 {
+ 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
-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;
+ 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";
+ private int sortTime = 0;//Sorting tick counter
+ private final static int sortTimeMax = 100;//Sorting tick counter limit, so we only sort once every 5 seconds
+
public GT_MetaTileEntity_TeslaCoil(int aID, String aName, String aNameRegional, int aTier, int aSlotCount) {
super(aID, aName, aNameRegional, aTier, "", aSlotCount);
Util.setTier(aTier, this);
@@ -129,11 +115,11 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB @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++;
}
}
@@ -175,13 +161,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;
}
@@ -207,9 +191,9 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB 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);
+ xR = (byte) (nodeTesla.posTop.get0() - x);
+ yR = (byte) (nodeTesla.posTop.get1() - y);
+ zR = (byte) (nodeTesla.posTop.get2() - z);
} else {
xR = (byte) (node.getXCoord() - x);
yR = (byte) (node.getYCoord() - y);
@@ -221,15 +205,43 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB sparkList.add(new ThaumSpark(x, y, z, xR, yR, zR, wID));
}
- private long getEnergyEfficiency(long voltage, int distance, boolean overDriveToggle) {
+ private long[] getOutputVoltage(long outputVoltage, int distance, boolean overDriveToggle) {
+ long outputVoltageInjectable;
+ long outputVoltageConsumption;
+
if (overDriveToggle) {
- return (long) ((voltage * 2) - (voltage * Math.pow(overdriveEfficiency, distance)));
+ outputVoltageInjectable = outputVoltage;
+ outputVoltageConsumption = outputVoltage + (distance * perBlockLoss) + (long) Math.round(overDriveLoss * outputVoltage);
} else {
- return (long) (voltage * Math.pow(energyEfficiency, distance));
+ outputVoltageInjectable = outputVoltage - (distance * perBlockLoss);
+ outputVoltageConsumption = outputVoltage;
+ }
+ return new long[]{outputVoltageInjectable, outputVoltageConsumption};
+ }
+
+ @Override
+ public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
+ super.onFirstTick(aBaseMetaTileEntity);
+ if (!aBaseMetaTileEntity.isClientSide()) {
+ teslaNodeSet.add(this);
}
}
@Override
+ public void onRemoval() {
+ super.onRemoval();
+ if (!this.getBaseMetaTileEntity().isClientSide()) {
+ teslaNodeSet.remove(this);
+ }
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ teslaNodeSet.add(this);
+ }
+
+ @Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPostTick(aBaseMetaTileEntity, aTick);
if (aBaseMetaTileEntity.isClientSide()) {
@@ -248,88 +260,16 @@ 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());
- }
-
- //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;
- }
- }
+ //Create the teslaNodeMap
+ if (sortTime == sortTimeMax) {
+ sortTime = 0;
+ generateTeslaNodeMap(this);
}
+ sortTime++;
+
+ //Send Power
+ powerTeslaNodeMap(this);
+
sparkCount++;
if (sparkCount == 60 && !sparkList.isEmpty()) {
sparkCount = 0;
@@ -358,4 +298,83 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB return true;
}
+ @Override
+ public byte getTeslaReceptionCapability() {
+ return 1;
+ }
+
+ @Override
+ public float getTeslaReceptionCoefficient() {
+ return 1;
+ }
+
+ @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;
+ }
+
+ 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());
+ }
+
+ @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;
+ }
}
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/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..0c5865d56e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/util/DoubleCount.java @@ -0,0 +1,116 @@ +package com.github.technus.tectech.util; + +import java.util.Arrays; + +import static java.lang.Math.max; +import static java.lang.Math.ulp; + +public class DoubleCount { + public static double[] distribute(double count,double... probabilities) throws ArithmeticException{ + if(probabilities==null){ + return null; + }else if(count==0){ + return new double[probabilities.length]; + }else { + switch (probabilities.length){ + default: { + int size=probabilities.length; + double[] output=new double[size]; + size--; + double remaining=count,previous=probabilities[size],probability,out,sum=0; + for (int i = size - 1; i >= 0; i--) { + probability=probabilities[i]; + remaining-=out=count*(probability-ulp(probability)); + sum+=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){ + throw new ArithmeticException("Malformed probability sum: "+ Arrays.toString(probabilities)); + } + sum+=output[size]=remaining-ulp(remaining)*size; + if(sum>count){ + throw new ArithmeticException("Too much outputted: "+ Arrays.toString(output)+" "+sum+" / "+count); + } + return output; + } + case 1: return new double[]{count}; + case 0: return probabilities;//empty array at hand... + } + } + } + + public static double div(double count,double divisor){ + if (divisor == 0) { + throw new ArithmeticException("Divide by 0"); + }else if(count==0 || divisor==1){ + return count; + }else if(divisor==-1){ + return -count; + } else { + double result = count / divisor; + if(result*count<0){ + return 0; + } + return result-ulp(result); + } + } + + public static double mul(double count,double multiplier){ + if(count==0 || multiplier==1){ + return count; + }else if(multiplier==-1){ + return -count; + } else { + double result = count * multiplier; + if(result*count<0){ + return 0; + } + return result-ulp(result); + } + } + + public static double sub(double count,double value){ + if(value==0){ + return count; + } + if(count==0){ + return -value; + } + if(value==count){ + return 0; + } + return value < 0 ? addInternal(count, -value) : subInternal(count, value); + } + + public static double add(double count,double value){ + if(value==0){ + return count; + } + if(count==0){ + return value; + } + return value < 0 ? subInternal(count, -value) : addInternal(count, value); + } + + private static double subInternal(double count,double value){ + double result = count - max(value,ulp(count)); + if (result+value>count || value>count-result){ + result-=ulp(result); + } + return result; + } + + private static double addInternal(double count,double value){ + double result = count + value; + if (result-value>count || result-count>value){ + result-=ulp(result); + } + return result; + } +} diff --git a/src/main/java/com/github/technus/tectech/util/Util.java b/src/main/java/com/github/technus/tectech/util/Util.java new file mode 100644 index 0000000000..1843770e3a --- /dev/null +++ b/src/main/java/com/github/technus/tectech/util/Util.java @@ -0,0 +1,564 @@ +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); + } +} diff --git a/src/main/java/com/github/technus/tectech/util/Vec3Impl.java b/src/main/java/com/github/technus/tectech/util/Vec3Impl.java new file mode 100644 index 0000000000..9ba96d741a --- /dev/null +++ b/src/main/java/com/github/technus/tectech/util/Vec3Impl.java @@ -0,0 +1,146 @@ +package com.github.technus.tectech.util; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.dispenser.IPosition; +import net.minecraftforge.common.util.ForgeDirection; + +public class Vec3Impl implements Comparable<Vec3Impl> { + public static final Vec3Impl NULL_VECTOR = new Vec3Impl(0, 0, 0); + private final int val0; + private final int val1; + private final int val2; + + public Vec3Impl(int in0, int in1, int in2) { + this.val0 = in0; + this.val1 = in1; + this.val2 = in2; + } + + public Vec3Impl(IGregTechTileEntity baseMetaTileEntity) { + this(baseMetaTileEntity.getXCoord(),baseMetaTileEntity.getYCoord(),baseMetaTileEntity.getZCoord()); + } + + public int compareTo(Vec3Impl o) { + return val1 == o.val1 ? val2 == o.val2 ? val0 - o.val0 : val2 - o.val2 : val1 - o.val1; + } + + /** + * Gets the coordinate. + */ + public int get(int index) { + switch (index){ + case 0: return val0; + case 1: return val1; + case 2: return val2; + default: return 0; + } + } + + /** + * Gets the X coordinate. + */ + public int get0() { + return this.val0; + } + + /** + * Gets the Y coordinate. + */ + public int get1() { + return this.val1; + } + + /** + * Gets the Z coordinate. + */ + public int get2() { + return this.val2; + } + + public Vec3Impl offset(ForgeDirection facing, int n) { + return n == 0 ? this : new Vec3Impl(val0 + facing.offsetX * n, val1 + facing.offsetY * n, val2 + facing.offsetZ * n); + } + + public Vec3Impl add(IGregTechTileEntity tileEntity) { + return new Vec3Impl(val0 + tileEntity.getXCoord(), val1 + tileEntity.getYCoord(), val2 + tileEntity.getZCoord()); + } + + public Vec3Impl sub(IGregTechTileEntity tileEntity) { + return new Vec3Impl(val0 - tileEntity.getXCoord(), val1 - tileEntity.getYCoord(), val2 - tileEntity.getZCoord()); + } + + public Vec3Impl add(Vec3Impl pos) { + return new Vec3Impl(val0 + pos.val0, val1 + pos.val1, val2 + pos.val2); + } + + public Vec3Impl sub(Vec3Impl pos) { + return new Vec3Impl(val0 - pos.val0, val1 - pos.val1, val2 - pos.val2); + } + + public Vec3Impl add(int pos0,int pos1,int pos2) { + return new Vec3Impl(val0 + pos0, val1 + pos1, val2 + pos2); + } + + public Vec3Impl sub(int pos0,int pos1,int pos2) { + return new Vec3Impl(val0 - pos0, val1 - pos1, val2 - pos2); + } + + public Vec3Impl crossProduct(Vec3Impl vec) { + return new Vec3Impl(val1 * vec.val2 - val2 * vec.val1, val2 * vec.val0 - val0 * vec.val2, + val0 * vec.val1 - val1 * vec.val0); + } + + public boolean withinDistance(Vec3Impl to, double distance) { + return this.distanceSq(to.val0, to.val1, to.val2, false) < distance * distance; + } + + public boolean withinDistance(IPosition to, double distance) { + return this.distanceSq(to.getX(), to.getY(), to.getZ(), true) < distance * distance; + } + + public double distanceSq(Vec3Impl to) { + return this.distanceSq(to.val0, to.val1, to.val2, true); + } + + public double distanceSq(IPosition to, boolean useCenter) { + return this.distanceSq(to.getX(), to.getY(), to.getZ(), useCenter); + } + + public double distanceSq(double x, double y, double z, boolean useCenter) { + double d0 = useCenter ? 0.5D : 0.0D; + double d1 = (double)val0 + d0 - x; + double d2 = (double)val1 + d0 - y; + double d3 = (double)val2 + d0 - z; + return d1 * d1 + d2 * d2 + d3 * d3; + } + + public int manhattanDistance(Vec3Impl to) { + float f = (float)Math.abs(to.val0 - val0); + float f1 = (float)Math.abs(to.val1 - val1); + float f2 = (float)Math.abs(to.val2 - val2); + return (int)(f + f1 + f2); + } + + @Override + public String toString() { + return "Vec3[" + val0 + ", " + val1 + ", " + val2 + "]"; + } + + public Vec3Impl abs() { + return new Vec3Impl(Math.abs(val0),Math.abs(val1),Math.abs(val2)); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } else if (o instanceof Vec3Impl) { + Vec3Impl vec3i = (Vec3Impl)o; + return val0 == vec3i.val0 && val1 == vec3i.val1 && val2 == vec3i.val2; + } + return false; + } + + public int hashCode() { + return (val1 + val2 * 31) * 31 + val0; + } +}
\ No newline at end of file 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..e09e575a7d --- /dev/null +++ b/src/main/resources/META-INF/tectech_at.cfg @@ -0,0 +1,2 @@ +public net.minecraft.block.Block field_149781_w #blockResistance +public net.minecraft.block.Block field_149782_v #blockHardness
\ No newline at end of file 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 b3ae51a407..b81b865b22 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -64,6 +64,8 @@ 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! @@ -210,69 +212,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 @@ -307,69 +309,69 @@ gt.blockmachines.hatch.dynamomulti64.tier.13.name=IV 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.name=IV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.05.name=IV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.05.name=IV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.05.name=IV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.05.name=IV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.05.name=IV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.05.name=IV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.06.name=LuV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.06.name=LuV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.06.name=LuV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.06.name=LuV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.06.name=LuV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.06.name=LuV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.06.name=LuV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.07.name=ZPM 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.07.name=ZPM 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.07.name=ZPM 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.07.name=ZPM 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.07.name=ZPM 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.07.name=ZPM 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.07.name=ZPM 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.08.name=UV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.08.name=UV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.08.name=UV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.08.name=UV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.08.name=UV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.08.name=UV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.08.name=UV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.09.name=UHV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.09.name=UHV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.09.name=UHV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.09.name=UHV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.09.name=UHV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.09.name=UHV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.09.name=UHV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.10.name=UEV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.10.name=UEV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.10.name=UEV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.10.name=UEV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.10.name=UEV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.10.name=UEV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.10.name=UEV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.11.name=UIV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.11.name=UIV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.11.name=UIV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.11.name=UIV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.11.name=UIV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.11.name=UIV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.11.name=UIV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.12.name=UMV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.12.name=UMV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.12.name=UMV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.12.name=UMV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.12.name=UMV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.12.name=UMV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.12.name=UMV 1048576/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel1.tier.13.name=UXV 256/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel2.tier.13.name=UXV 1024/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel3.tier.13.name=UXV 4096/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel4.tier.13.name=UXV 16384/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel5.tier.13.name=UXV 65536/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel6.tier.13.name=UXV 262144/t Laser Source Hatch -gt.blockmachines.hatch.dynamotunnel7.tier.13.name=UXV 1048576/t 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 @@ -518,6 +520,7 @@ 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 @@ -535,7 +538,7 @@ 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 @@ -762,7 +765,7 @@ gt.blockmachines.machine.tt.tesla.desc.1=Lightning stoves for the rich 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.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. diff --git a/src/main/resources/assets/tectech/lang/zh_CN.lang b/src/main/resources/assets/tectech/lang/zh_CN.lang index 16d32829f7..2dfe46f615 100644 --- a/src/main/resources/assets/tectech/lang/zh_CN.lang +++ b/src/main/resources/assets/tectech/lang/zh_CN.lang @@ -535,7 +535,7 @@ 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.78125%的能量损失, HAYO! +gt.blockmachines.multimachine.em.transformer.desc.2=只有0.004%的能量损失, HAYO! gt.blockmachines.multimachine.tm.microwave.name=微波发生仪 gt.blockmachines.multimachine.tm.microwave.hint.0=1 - 基础仓室或洁净不锈钢机械方块 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 |