diff options
author | Martin Robertz <dream-master@gmx.net> | 2022-11-11 17:45:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-11 17:45:33 +0100 |
commit | 1768d561450231ec8228914f28f0d08e16c4e609 (patch) | |
tree | 6799863bbf97fba5ddf74bb3174f2646e34a503f | |
parent | f7ffab4b1f0ef45dd4852b26965367f2c559ca0a (diff) | |
parent | cc7a9790eb6e268f4eb57b28d39b2bd4f4730a3d (diff) | |
download | GT5-Unofficial-1768d561450231ec8228914f28f0d08e16c4e609.tar.gz GT5-Unofficial-1768d561450231ec8228914f28f0d08e16c4e609.tar.bz2 GT5-Unofficial-1768d561450231ec8228914f28f0d08e16c4e609.zip |
Merge pull request #45 from GTNewHorizons/feature/tfft-rework
TFFT rework
56 files changed, 1416 insertions, 1984 deletions
diff --git a/build.gradle b/build.gradle index b961a5e176..d20d35165d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1664372158 +//version: 1666118075 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -147,17 +147,21 @@ String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" String kotlinSourceDir = "src/main/kotlin/" -String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") -String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") -String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + +final String modGroupPath = modGroup.toString().replaceAll("\\.", "/") +final String apiPackagePath = apiPackage.toString().replaceAll("\\.", "/") + +String targetPackageJava = javaSourceDir + modGroupPath +String targetPackageScala = scalaSourceDir + modGroupPath +String targetPackageKotlin = kotlinSourceDir + modGroupPath if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } if (apiPackage) { - targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") - targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") - targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + targetPackageJava = javaSourceDir + modGroupPath + "/" + apiPackagePath + targetPackageScala = scalaSourceDir + modGroupPath + "/" + apiPackagePath + targetPackageKotlin = kotlinSourceDir + modGroupPath + "/" + apiPackagePath if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } @@ -171,31 +175,36 @@ if (accessTransformersFile) { } if (usesMixins.toBoolean()) { - if (mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) { - throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!") + if (mixinsPackage.isEmpty()) { + throw new GradleException("\"usesMixins\" requires \"mixinsPackage\" to be set!") } + final String mixinPackagePath = mixinsPackage.toString().replaceAll("\\.", "/") + final String mixinPluginPath = mixinPlugin.toString().replaceAll("\\.", "/") - targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") - targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") - targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") + targetPackageJava = javaSourceDir + modGroupPath + "/" + mixinPackagePath + targetPackageScala = scalaSourceDir + modGroupPath + "/" + mixinPackagePath + targetPackageKotlin = kotlinSourceDir + modGroupPath + "/" + mixinPackagePath if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } - String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" - String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala" - String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" - String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt" - if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { - throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) + if (!mixinPlugin.isEmpty()) { + String targetFileJava = javaSourceDir + modGroupPath + "/" + mixinPluginPath + ".java" + String targetFileScala = scalaSourceDir + modGroupPath + "/" + mixinPluginPath + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroupPath + "/" + mixinPluginPath + ".java" + String targetFileKotlin = kotlinSourceDir + modGroupPath + "/" + mixinPluginPath + ".kt" + if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { + throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) + } } } if (coreModClass) { - String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" - String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala" - String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" - String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt" + final String coreModPath = coreModClass.toString().replaceAll("\\.", "/") + String targetFileJava = javaSourceDir + modGroupPath + "/" + coreModPath + ".java" + String targetFileScala = scalaSourceDir + modGroupPath + "/" + coreModPath + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroupPath + "/" + coreModPath + ".java" + String targetFileKotlin = kotlinSourceDir + modGroupPath + "/" + coreModPath + ".kt" if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) } @@ -225,9 +234,9 @@ try { } catch (Exception ignored) { out.style(Style.Failure).text( - 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' + - 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' + - 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)' + 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' + + 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' + + 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)' ) versionOverride = 'NO-GIT-TAG-SET' identifiedVersion = versionOverride @@ -251,15 +260,15 @@ if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { def arguments = [] def jvmArguments = [] -if (usesMixins.toBoolean() || forceEnableMixins) { +if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { arguments += [ - "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" ] if (usesMixinDebug.toBoolean()) { jvmArguments += [ - "-Dmixin.debug.countInjections=true", - "-Dmixin.debug.verbose=true", - "-Dmixin.debug.export=true" + "-Dmixin.debug.countInjections=true", + "-Dmixin.debug.verbose=true", + "-Dmixin.debug.export=true" ] } } @@ -316,13 +325,10 @@ repositories { name 'Overmind forge repo mirror' url 'https://gregtech.overminddl1.com/' } - if (usesMixins.toBoolean() || forceEnableMixins) { - maven { - name 'sponge' - url 'https://repo.spongepowered.org/repository/maven-public' - } + if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { maven { - url 'https://jitpack.io' + name = "GTNH Maven" + url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" } } } @@ -332,19 +338,10 @@ dependencies { annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') annotationProcessor('com.google.guava:guava:24.1.1-jre') annotationProcessor('com.google.code.gson:gson:2.8.6') - annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT') - } - if (usesMixins.toBoolean() || forceEnableMixins) { - // using 0.8 to workaround a issue in 0.7 which fails mixin application - compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') { - // Mixin includes a lot of dependencies that are too up-to-date - exclude module: 'launchwrapper' - exclude module: 'guava' - exclude module: 'gson' - exclude module: 'commons-io' - exclude module: 'log4j-core' - } - compile('com.github.GTNewHorizons:SpongeMixins:1.5.0') + annotationProcessor('org.spongepowered:mixin:0.8.5-GTNH:processor') + } + if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { + compile('com.gtnewhorizon:gtnhmixins:2.0.1') } } @@ -356,13 +353,18 @@ def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg" task generateAssets { if (usesMixins.toBoolean()) { - def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json"); + def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json") if (!mixinConfigFile.exists()) { + def mixinPluginLine = "" + if(!mixinPlugin.isEmpty()) { + // We might not have a mixin plugin if we're using early/late mixins + mixinPluginLine += """\n "plugin": "${modGroup}.${mixinPlugin}", """ + } + mixinConfigFile.text = """{ "required": true, - "minVersion": "0.7.11", - "package": "${modGroup}.${mixinsPackage}", - "plugin": "${modGroup}.${mixinPlugin}", + "minVersion": "0.8.5-GTNH", + "package": "${modGroup}.${mixinsPackage}",${mixinPluginLine} "refmap": "${mixingConfigRefMap}", "target": "@env(DEFAULT)", "compatibilityLevel": "JAVA_8", @@ -393,8 +395,8 @@ shadowJar { minimize() // This will only allow shading for actually used classes configurations = [ - project.configurations.shadowImplementation, - project.configurations.shadowCompile + project.configurations.shadowImplementation, + project.configurations.shadowCompile ] dependsOn(relocateShadowJar) } @@ -426,12 +428,12 @@ afterEvaluate { if (usesMixins.toBoolean()) { tasks.compileJava { options.compilerArgs += [ - "-AreobfSrgFile=${tasks.reobf.srg}", - "-AoutSrgFile=${mixinSrg}", - "-AoutRefMapFile=${refMap}", - // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code - "-XDenableSunApiLintControl", - "-XDignore.symbol.file" + "-AreobfSrgFile=${tasks.reobf.srg}", + "-AoutSrgFile=${mixinSrg}", + "-AoutRefMapFile=${refMap}", + // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code + "-XDenableSunApiLintControl", + "-XDignore.symbol.file" ] } } @@ -440,8 +442,8 @@ afterEvaluate { runClient { if (developmentEnvironmentUserName) { arguments += [ - "--username", - developmentEnvironmentUserName + "--username", + developmentEnvironmentUserName ] } @@ -456,9 +458,9 @@ runServer { tasks.withType(JavaExec).configureEach { javaLauncher.set( - javaToolchains.launcherFor { - languageVersion = projectJavaVersion - } + javaToolchains.launcherFor { + languageVersion = projectJavaVersion + } ) } @@ -474,9 +476,9 @@ processResources { // replace modVersion and minecraftVersion expand "minecraftVersion": project.minecraft.version, - "modVersion": modVersion, - "modId": modId, - "modName": modName + "modVersion": modVersion, + "modId": modId, + "modName": modName } if (usesMixins.toBoolean()) { @@ -506,9 +508,9 @@ def getManifestAttributes() { if (usesMixins.toBoolean()) { manifestAttributes += [ - "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", - "MixinConfigs" : "mixins." + modId + ".json", - "ForceLoadAsMod": !containsMixinsAndOrCoreModOnly.toBoolean() + "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs" : "mixins." + modId + ".json", + "ForceLoadAsMod": !containsMixinsAndOrCoreModOnly.toBoolean() ] } return manifestAttributes @@ -536,8 +538,8 @@ task shadowDevJar(type: ShadowJar) { minimize() // This will only allow shading for actually used classes configurations = [ - project.configurations.shadowImplementation, - project.configurations.shadowCompile + project.configurations.shadowImplementation, + project.configurations.shadowCompile ] } @@ -574,11 +576,11 @@ task devJar(type: Jar) { task apiJar(type: Jar) { from(sourceSets.main.allSource) { - include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' + include modGroupPath + "/" + apiPackagePath + '/**' } from(sourceSets.main.output) { - include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' + include modGroupPath + "/" + apiPackagePath + '/**' } from(sourceSets.main.resources.srcDirs) { @@ -631,8 +633,8 @@ publishing { pom.withXml { def badArtifacts = [:].withDefault { [] as Set<String> } for (configuration in [ - projectConfigs.minecraft, - projectConfigs.minecraftDeps + projectConfigs.minecraft, + projectConfigs.minecraftDeps ]) { for (dependency in configuration.allDependencies) { badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name @@ -662,10 +664,10 @@ publishing { } } -if (modrinthProjectId.size() != 0) { +if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) { apply plugin: 'com.modrinth.minotaur' - File changelogFile = new File("CHANGELOG.md") + File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md") modrinth { token = System.getenv("MODRINTH_TOKEN") @@ -691,14 +693,17 @@ if (modrinthProjectId.size() != 0) { addModrinthDep(qual[0], qual[1], parts[1]) } } + if (usesMixins.toBoolean()) { + addModrinthDep("required", "version", "gtnhmixins") + } tasks.modrinth.dependsOn(build) tasks.publish.dependsOn(tasks.modrinth) } -if (curseForgeProjectId.size() != 0) { +if (curseForgeProjectId.size() != 0 && System.getenv("CURSEFORGE_TOKEN") != null) { apply plugin: 'com.matthewprenger.cursegradle' - File changelogFile = new File("CHANGELOG.md") + File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md") curseforge { apiKey = System.getenv("CURSEFORGE_TOKEN") @@ -732,6 +737,9 @@ if (curseForgeProjectId.size() != 0) { addCurseForgeRelation(parts[0], parts[1]) } } + if (usesMixins.toBoolean()) { + addCurseForgeRelation("requiredDependency", "gtnhmixins") + } tasks.curseforge.dependsOn(build) tasks.publish.dependsOn(tasks.curseforge) } @@ -1092,4 +1100,4 @@ def getSecondaryArtifacts() { if (!noPublishedSources) secondaryArtifacts += [sourcesJar] if (apiPackage) secondaryArtifacts += [apiJar] return secondaryArtifacts -} +}
\ No newline at end of file diff --git a/dependencies.gradle b/dependencies.gradle index 99edcb884a..e92b38489a 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,9 +1,9 @@ // Add your dependencies here dependencies { - compile 'com.github.GTNewHorizons:GT5-Unofficial:5.09.41.39:dev' - compile 'com.github.GTNewHorizons:TecTech:5.0.21-pre:dev' - compile 'com.github.GTNewHorizons:bartworks:0.5.72-pre:dev' + compile 'com.github.GTNewHorizons:GT5-Unofficial:5.09.41.68:dev' + compile 'com.github.GTNewHorizons:TecTech:5.0.42:dev' + compile 'com.github.GTNewHorizons:bartworks:0.5.89:dev' compile 'com.github.GTNewHorizons:StructureLib:1.1.12:dev' compile 'com.github.GTNewHorizons:ThaumicTinkerer:2.6.4:dev' diff --git a/src/main/java/client/GTTexture.java b/src/main/java/client/GTTexture.java deleted file mode 100644 index 345bb8f790..0000000000 --- a/src/main/java/client/GTTexture.java +++ /dev/null @@ -1,43 +0,0 @@ -package client; - -import gregtech.api.GregTech_API; -import gregtech.api.interfaces.IIconContainer; -import kekztech.KekzCore; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; - -public class GTTexture implements IIconContainer, Runnable { - - public static final GTTexture TFFT_CASING = new GTTexture("blocks/TFFTCasing"); - public static final GTTexture MULTI_HATCH_OFF = new GTTexture("blocks/multi_hatch_off"); - public static final GTTexture MULTI_HATCH_ON = new GTTexture("blocks/multi_hatch_on"); - - private IIcon icon; - private final String iconName; - - private GTTexture(String iconName) { - this.iconName = iconName; - GregTech_API.sGTBlockIconload.add(this); - } - - @Override - public IIcon getIcon() { - return icon; - } - - @Override - public IIcon getOverlayIcon() { - return null; - } - - @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationBlocksTexture; - } - - @Override - public void run() { - icon = GregTech_API.sBlockIcons.registerIcon(KekzCore.MODID + ":" + iconName); - } -} diff --git a/src/main/java/common/Blocks.java b/src/main/java/common/Blocks.java index 2a4bf328f7..3bc8ddc9f9 100644 --- a/src/main/java/common/Blocks.java +++ b/src/main/java/common/Blocks.java @@ -9,13 +9,7 @@ public class Blocks { public static Block yszUnit; public static Block gdcUnit; - public static Block tfftCasing; - public static Block tfftStorageField1; - public static Block tfftStorageField2; - public static Block tfftStorageField3; - public static Block tfftStorageField4; - public static Block tfftStorageField5; - public static Block tfftMultiHatch; + public static Block tfftStorageField; public static Block reactorChamberOFF; public static Block reactorChamberON; @@ -62,13 +56,7 @@ public class Blocks { } private static void registerBlocks_TFFT() { - tfftCasing = Block_TFFTCasing.registerBlock(); - tfftStorageField1 = Block_TFFTStorageFieldBlockT1.registerBlock(); - tfftStorageField2 = Block_TFFTStorageFieldBlockT2.registerBlock(); - tfftStorageField3 = Block_TFFTStorageFieldBlockT3.registerBlock(); - tfftStorageField4 = Block_TFFTStorageFieldBlockT4.registerBlock(); - tfftStorageField5 = Block_TFFTStorageFieldBlockT5.registerBlock(); - tfftMultiHatch = Block_TFFTMultiHatch.registerBlock(); + tfftStorageField = Block_TFFTStorageField.registerBlock(); } /*private static void registerBlocks_Nuclear() { diff --git a/src/main/java/common/CommonProxy.java b/src/main/java/common/CommonProxy.java index bf92f6c697..464f8eab49 100644 --- a/src/main/java/common/CommonProxy.java +++ b/src/main/java/common/CommonProxy.java @@ -3,10 +3,12 @@ package common; import common.items.ErrorItem; import common.items.MetaItem_CraftingComponent; import common.items.MetaItem_ReactorComponent; +import common.tileentities.GTMTE_TFFTHatch; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkRegistry; +import gregtech.api.GregTech_API; import kekztech.GuiHandler; import kekztech.Items; import kekztech.KekzCore; @@ -39,5 +41,7 @@ public class CommonProxy { Recipes.postInit(); // Research Researches.postInit(); + + if (GregTech_API.mAE2) GTMTE_TFFTHatch.registerAEIntegration(); } } diff --git a/src/main/java/common/Recipes.java b/src/main/java/common/Recipes.java index 558f0b83db..8af826dd61 100644 --- a/src/main/java/common/Recipes.java +++ b/src/main/java/common/Recipes.java @@ -54,8 +54,8 @@ public class Recipes { private static void registerRecipes_TFFT() { - // Controller - final Object[] tfft_recipe = { + // TFFT Controller + GT_ModHandler.addCraftingRecipe(TileEntities.tfft.getStackForm(1), new Object[] { "HFH", "PVP", "CFC", @@ -69,92 +69,96 @@ public class Recipes { OrePrefixes.rotor.get(Materials.VibrantAlloy), 'C', OrePrefixes.circuit.get(Materials.Data) - }; - GT_ModHandler.addCraftingRecipe(TileEntities.fms.getStackForm(1), tfft_recipe); + }); - // Blocks - final ItemStack[] tfftcasing = { - GT_Utility.getIntegratedCircuit(6), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.DarkSteel, 3), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.EnderPearl, 3), - GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.StainlessSteel, 1), - }; + // TFFT Casing GT_Values.RA.addAssemblerRecipe( - tfftcasing, + new ItemStack[] { + GT_Utility.getIntegratedCircuit(6), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.DarkSteel, 3), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.EnderPearl, 3), + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.StainlessSteel, 1) + }, FluidRegistry.getFluidStack("molten.polytetrafluoroethylene", 144), - new ItemStack(Blocks.tfftCasing, 1), + new ItemStack(Blocks.tfftStorageField, 1), 200, 256); - final ItemStack[] tfftstoragefield1 = { - GT_Utility.getIntegratedCircuit(6), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 1), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.PulsatingIron, 1), - GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.Steel, 1), - ItemList.Electric_Pump_LV.get(1L) - }; + + // TFFTStorageField1 GT_Values.RA.addAssemblerRecipe( - tfftstoragefield1, + new ItemStack[] { + GT_Utility.getIntegratedCircuit(6), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 1), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.PulsatingIron, 1), + GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.Steel, 1), + ItemList.Electric_Pump_LV.get(1L) + }, FluidRegistry.getFluidStack("molten.glass", 144), - new ItemStack(Blocks.tfftStorageField1, 1), + new ItemStack(Blocks.tfftStorageField, 1, 1), 200, 256); - final ItemStack[] tfftstoragefield2 = { - GT_Utility.getIntegratedCircuit(6), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.PulsatingIron, 4), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.StainlessSteel, 1), - ItemList.Electric_Pump_MV.get(1L) - }; + + // TFFTStorageField2 GT_Values.RA.addAssemblerRecipe( - tfftstoragefield2, + new ItemStack[] { + GT_Utility.getIntegratedCircuit(6), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.PulsatingIron, 4), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.StainlessSteel, 1), + ItemList.Electric_Pump_MV.get(1L) + }, FluidRegistry.getFluidStack("molten.plastic", 576), - new ItemStack(Blocks.tfftStorageField2, 1), + new ItemStack(Blocks.tfftStorageField, 1, 2), 200, 480); - final ItemStack[] tfftstoragefield3 = { - GT_Utility.getIntegratedCircuit(6), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Data, 2), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.VibrantAlloy, 2), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Titanium, 1), - ItemList.Field_Generator_MV.get(1L), - ItemList.Electric_Pump_HV.get(2L) - }; + + // TFFTStorageField3 GT_Values.RA.addAssemblerRecipe( - tfftstoragefield3, + new ItemStack[] { + GT_Utility.getIntegratedCircuit(6), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Data, 2), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.VibrantAlloy, 2), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Titanium, 1), + ItemList.Field_Generator_MV.get(1L), + ItemList.Electric_Pump_HV.get(2L) + }, FluidRegistry.getFluidStack("molten.epoxid", 576), - new ItemStack(Blocks.tfftStorageField3, 1), + new ItemStack(Blocks.tfftStorageField, 1, 3), 300, 1920); - final ItemStack[] tfftstoragefield4 = { - GT_Utility.getIntegratedCircuit(6), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 4), - GT_OreDictUnificator.get(OrePrefixes.plateTriple, Materials.NiobiumTitanium, 1), - GT_OreDictUnificator.get(OrePrefixes.pipeHuge, Materials.TungstenSteel, 1), - ItemList.Field_Generator_HV.get(1L), - ItemList.Electric_Pump_EV.get(1L) - }; + + // TFFTStorageField4 GT_Values.RA.addAssemblerRecipe( - tfftstoragefield4, + new ItemStack[] { + GT_Utility.getIntegratedCircuit(6), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 4), + GT_OreDictUnificator.get(OrePrefixes.plateTriple, Materials.NiobiumTitanium, 1), + GT_OreDictUnificator.get(OrePrefixes.pipeHuge, Materials.TungstenSteel, 1), + ItemList.Field_Generator_HV.get(1L), + ItemList.Electric_Pump_EV.get(1L) + }, FluidRegistry.getFluidStack("molten.epoxid", 1152), - new ItemStack(Blocks.tfftStorageField4, 1), + new ItemStack(Blocks.tfftStorageField, 1, 4), 400, 4098); - final ItemStack[] tfftstoragefield5 = { - GT_Utility.getIntegratedCircuit(6), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 4), - GT_OreDictUnificator.get(OrePrefixes.plateTriple, Materials.HSSS, 1), - GT_OreDictUnificator.get(OrePrefixes.pipeHuge, Materials.Enderium, 1), - ItemList.Field_Generator_EV.get(1L), - ItemList.Electric_Pump_IV.get(1L) - }; + + // TFFTStorageField5 GT_Values.RA.addAssemblerRecipe( - tfftstoragefield5, + new ItemStack[] { + GT_Utility.getIntegratedCircuit(6), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 4), + GT_OreDictUnificator.get(OrePrefixes.plateTriple, Materials.HSSS, 1), + GT_OreDictUnificator.get(OrePrefixes.pipeHuge, Materials.Enderium, 1), + ItemList.Field_Generator_EV.get(1L), + ItemList.Electric_Pump_IV.get(1L) + }, FluidRegistry.getFluidStack("molten.epoxid", 1152), - new ItemStack(Blocks.tfftStorageField5, 1), + new ItemStack(Blocks.tfftStorageField, 1, 5), 400, 6147); - // Multi Hatch - final Object[] multi_hatch_HV = { + + // TFFT Multi Hatch + GT_ModHandler.addCraftingRecipe(TileEntities.tfftHatch.getStackForm(1), new Object[] { "PRP", "UFU", "PRP", @@ -166,40 +170,7 @@ public class Recipes { ItemList.Electric_Pump_HV.get(1L), 'F', ItemList.Field_Generator_LV.get(1L) - }; - GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.tfftMultiHatch), multi_hatch_HV); - final Object[] multi_hatch_IV = { - "PRP", - "UFU", - "PRP", - 'P', - GT_OreDictUnificator.get(OrePrefixes.pipeTiny, Materials.TungstenSteel, 1), - 'R', - GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.TungstenSteel, 1), - 'U', - ItemList.Electric_Pump_IV.get(1L), - 'F', - ItemList.Field_Generator_HV.get(1L) - }; - GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.tfftMultiHatch), multi_hatch_IV); - final Object[] multi_hatch_ZPM = { - "PRP", - "UFU", - "PRP", - 'P', - GT_OreDictUnificator.get(OrePrefixes.pipeTiny, Materials.NaquadahAlloy, 1), - 'R', - GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.NaquadahAlloy, 1), - 'U', - ItemList.Electric_Pump_ZPM.get(1L), - 'F', - ItemList.Field_Generator_IV.get(1L) - }; - GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.tfftMultiHatch), multi_hatch_ZPM); - - // Conversion recipe from deprecated hatch to new one (old hatch is equal to new IV hatch) - GT_ModHandler.addShapelessCraftingRecipe( - TileEntities.mhIV.getStackForm(1), new ItemStack[] {new ItemStack(Blocks.tfftMultiHatch, 1)}); + }); } private static void registerRecipes_SOFC() { diff --git a/src/main/java/common/TileEntities.java b/src/main/java/common/TileEntities.java index 6253629ddb..455bde0e63 100644 --- a/src/main/java/common/TileEntities.java +++ b/src/main/java/common/TileEntities.java @@ -1,6 +1,8 @@ package common; import common.tileentities.*; +import common.tileentities.GTMTE_TFFT; +import common.tileentities.GTMTE_TFFTHatch; import cpw.mods.fml.common.registry.GameRegistry; public class TileEntities { @@ -9,16 +11,14 @@ public class TileEntities { public static GTMTE_SOFuelCellMK1 sofc1; public static GTMTE_SOFuelCellMK2 sofc2; // public static GTMTE_ModularNuclearReactor mdr; - public static GTMTE_FluidMultiStorage fms; + public static GTMTE_TFFT tfft; public static GTMTE_LapotronicSuperCapacitor lsc; public static GTMTE_SpaceElevator se; + // Singleblocks - public static GTMTE_TFFTMultiHatch mhHV; - public static GTMTE_TFFTMultiHatch mhIV; - public static GTMTE_TFFTMultiHatch mhZPM; + public static GTMTE_TFFTHatch tfftHatch; public static void preInit() { - GameRegistry.registerTileEntity(TE_TFFTMultiHatch.class, "kekztech_tfftmultihatch_tile"); // GameRegistry.registerTileEntity(TE_ItemProxyCable.class, "kekztech_itemproxycable_tile"); // GameRegistry.registerTileEntity(TE_ItemProxySource.class, "kekztech_itemproxysource_tile"); // GameRegistry.registerTileEntity(TE_ItemProxyEndpoint.class, "kekztech_itemproxyendpoint_tile"); @@ -35,12 +35,11 @@ public class TileEntities { sofc1 = new GTMTE_SOFuelCellMK1(13101, "multimachine.fuelcellmk1", "Solid-Oxide Fuel Cell Mk I"); sofc2 = new GTMTE_SOFuelCellMK2(13102, "multimachine.fuelcellmk2", "Solid-Oxide Fuel Cell Mk II"); // mdr = new GTMTE_ModularNuclearReactor(13103, "multimachine.nuclearreactor", "Nuclear Reactor"); - fms = new GTMTE_FluidMultiStorage(13104, "multimachine.tf_fluidtank", "T.F.F.T"); + tfft = new GTMTE_TFFT(13104, "multimachine.tfft", "T.F.F.T"); lsc = new GTMTE_LapotronicSuperCapacitor(13106, "multimachine.supercapacitor", "Lapotronic Supercapacitor"); // se = new GTMTE_SpaceElevator(13107, "multimachine.spaceelevator", "Space Elevator"); + // Singleblocks - mhHV = new GTMTE_TFFTMultiHatch(13108, "machine.multihatch.0", "T.F.F.T Multi I/O Hatch [HV]", 3); - mhIV = new GTMTE_TFFTMultiHatch(13109, "machine.multihatch.1", "T.F.F.T Multi I/O Hatch [IV]", 5); - mhZPM = new GTMTE_TFFTMultiHatch(13110, "machine.multihatch.2", "T.F.F.T Multi I/O Hatch [ZPM]", 7); + tfftHatch = new GTMTE_TFFTHatch(13109, "machine.tffthatch", "T.F.F.T Multi I/O Hatch"); } } diff --git a/src/main/java/common/blocks/Block_TFFTCasing.java b/src/main/java/common/blocks/Block_TFFTCasing.java deleted file mode 100644 index b6d793e7ec..0000000000 --- a/src/main/java/common/blocks/Block_TFFTCasing.java +++ /dev/null @@ -1,28 +0,0 @@ -package common.blocks; - -import cpw.mods.fml.common.registry.GameRegistry; -import kekztech.KekzCore; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; - -public class Block_TFFTCasing extends BaseGTUpdateableBlock { - - private static Block_TFFTCasing instance = new Block_TFFTCasing(); - - private Block_TFFTCasing() { - super(Material.iron); - } - - public static Block registerBlock() { - final String blockName = "kekztech_tfftcasingblock_block"; - instance.setBlockName(blockName); - instance.setCreativeTab(CreativeTabs.tabMisc); - instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTCasing"); - instance.setHardness(5.0f); - instance.setResistance(6.0f); - GameRegistry.registerBlock(instance, blockName); - - return instance; - } -} diff --git a/src/main/java/common/blocks/Block_TFFTMultiHatch.java b/src/main/java/common/blocks/Block_TFFTMultiHatch.java deleted file mode 100644 index 14d288b7bb..0000000000 --- a/src/main/java/common/blocks/Block_TFFTMultiHatch.java +++ /dev/null @@ -1,55 +0,0 @@ -package common.blocks; - -import common.itemBlocks.IB_TFFTMultiHatch; -import common.tileentities.TE_TFFTMultiHatch; -import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -@Deprecated -public class Block_TFFTMultiHatch extends BaseGTUpdateableBlock { - - private static final Block_TFFTMultiHatch INSTANCE = new Block_TFFTMultiHatch(); - - private IIcon casing; - - private Block_TFFTMultiHatch() { - super(Material.iron); - } - - public static Block registerBlock() { - final String blockName = "kekztech_tfftmultihatch_block"; - INSTANCE.setBlockName(blockName); - INSTANCE.setCreativeTab(CreativeTabs.tabMisc); - INSTANCE.setHardness(5.0f); - INSTANCE.setResistance(6.0f); - GameRegistry.registerBlock(INSTANCE, IB_TFFTMultiHatch.class, blockName); - - return INSTANCE; - } - - @Override - public void registerBlockIcons(IIconRegister ir) { - casing = ir.registerIcon("kekztech:TFFTCasing"); - } - - @Override - public IIcon getIcon(int side, int meta) { - return casing; - } - - @Override - public TileEntity createTileEntity(World world, int meta) { - return new TE_TFFTMultiHatch(); - } - - @Override - public boolean hasTileEntity(int meta) { - return true; - } -} diff --git a/src/main/java/common/blocks/Block_TFFTStorageField.java b/src/main/java/common/blocks/Block_TFFTStorageField.java new file mode 100644 index 0000000000..36439548af --- /dev/null +++ b/src/main/java/common/blocks/Block_TFFTStorageField.java @@ -0,0 +1,88 @@ +package common.blocks; + +import common.itemBlocks.IB_TFFTStorageField; +import common.tileentities.GTMTE_TFFT; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_Utility; +import java.util.List; +import kekztech.KekzCore; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; + +public class Block_TFFTStorageField extends BaseGTUpdateableBlock { + + private static final Block_TFFTStorageField INSTANCE = new Block_TFFTStorageField(); + private static final int SUB_BLOCK_COUNT = GTMTE_TFFT.Field.VALUES.length + 1; + private static final IIcon[] textures = new IIcon[SUB_BLOCK_COUNT]; + + public enum TFFTCasingIcon implements IIconContainer { + INSTANCE; + + @Override + public IIcon getIcon() { + return textures[0]; + } + + @Override + public IIcon getOverlayIcon() { + return null; + } + + @Override + public ResourceLocation getTextureFile() { + return TextureMap.locationBlocksTexture; + } + } + + // I guess glodblock won't mind + static { + GT_Utility.addTexturePage((byte) 12); + Textures.BlockIcons.setCasingTexture( + (byte) 12, (byte) 127, TextureFactory.of(Block_TFFTStorageField.TFFTCasingIcon.INSTANCE)); + } + + private Block_TFFTStorageField() { + super(Material.iron); + } + + public static Block registerBlock() { + final String blockName = "kekztech_tfftstoragefield_block"; + INSTANCE.setBlockName(blockName); + INSTANCE.setCreativeTab(CreativeTabs.tabMisc); + INSTANCE.setHardness(5.0f); + INSTANCE.setResistance(6.0f); + GameRegistry.registerBlock(INSTANCE, IB_TFFTStorageField.class, blockName); + + return INSTANCE; + } + + @Override + public void registerBlockIcons(IIconRegister ir) { + textures[0] = ir.registerIcon(KekzCore.MODID + ":" + "TFFTCasing"); + for (int i = 1; i < SUB_BLOCK_COUNT; i++) { + textures[i] = ir.registerIcon(KekzCore.MODID + ":" + "TFFTStorageFieldBlock" + i); + } + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for (int i = 0; i < SUB_BLOCK_COUNT; i++) { + par3List.add(new ItemStack(par1, 1, i)); + } + } + + @Override + public IIcon getIcon(int side, int meta) { + return textures[meta]; + } +} diff --git a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT1.java b/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT1.java deleted file mode 100644 index e6e3649f3a..0000000000 --- a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT1.java +++ /dev/null @@ -1,37 +0,0 @@ -package common.blocks; - -import common.itemBlocks.IB_TFFTStorageFieldBlockT1; -import cpw.mods.fml.common.registry.GameRegistry; -import kekztech.KekzCore; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; - -public class Block_TFFTStorageFieldBlockT1 extends BaseGTUpdateableBlock { - - private static Block_TFFTStorageFieldBlockT1 instance; - - private Block_TFFTStorageFieldBlockT1() { - super(Material.iron); - } - - public static int getCapacity() { - return 500000; - } - - public static Block registerBlock() { - if (instance == null) { - instance = new Block_TFFTStorageFieldBlockT1(); - } - - final String blockName = "kekztech_tfftstoragefieldblock1_block"; - instance.setBlockName(blockName); - instance.setCreativeTab(CreativeTabs.tabMisc); - instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTStorageFieldBlock1"); - instance.setHardness(5.0f); - instance.setResistance(6.0f); - GameRegistry.registerBlock(instance, IB_TFFTStorageFieldBlockT1.class, blockName); - - return instance; - } -} diff --git a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT2.java b/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT2.java deleted file mode 100644 index 2b3477f750..0000000000 --- a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT2.java +++ /dev/null @@ -1,37 +0,0 @@ -package common.blocks; - -import common.itemBlocks.IB_TFFTStorageFieldBlockT2; -import cpw.mods.fml.common.registry.GameRegistry; -import kekztech.KekzCore; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; - -public class Block_TFFTStorageFieldBlockT2 extends BaseGTUpdateableBlock { - - private static Block_TFFTStorageFieldBlockT2 instance; - - private Block_TFFTStorageFieldBlockT2() { - super(Material.iron); - } - - public static int getCapacity() { - return 4000000; - } - - public static Block registerBlock() { - if (instance == null) { - instance = new Block_TFFTStorageFieldBlockT2(); - } - - final String blockName = "kekztech_tfftstoragefieldblock2_block"; - instance.setBlockName(blockName); - instance.setCreativeTab(CreativeTabs.tabMisc); - instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTStorageFieldBlock2"); - instance.setHardness(5.0f); - instance.setResistance(6.0f); - GameRegistry.registerBlock(instance, IB_TFFTStorageFieldBlockT2.class, blockName); - - return instance; - } -} diff --git a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT3.java b/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT3.java deleted file mode 100644 index 313b87d10f..0000000000 --- a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT3.java +++ /dev/null @@ -1,37 +0,0 @@ -package common.blocks; - -import common.itemBlocks.IB_TFFTStorageFieldBlockT3; -import cpw.mods.fml.common.registry.GameRegistry; -import kekztech.KekzCore; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; - -public class Block_TFFTStorageFieldBlockT3 extends BaseGTUpdateableBlock { - - private static Block_TFFTStorageFieldBlockT3 instance; - - private Block_TFFTStorageFieldBlockT3() { - super(Material.iron); - } - - public static int getCapacity() { - return 16000000; - } - - public static Block registerBlock() { - if (instance == null) { - instance = new Block_TFFTStorageFieldBlockT3(); - } - - final String blockName = "kekztech_tfftstoragefieldblock3_block"; - instance.setBlockName(blockName); - instance.setCreativeTab(CreativeTabs.tabMisc); - instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTStorageFieldBlock3"); - instance.setHardness(5.0f); - instance.setResistance(6.0f); - GameRegistry.registerBlock(instance, IB_TFFTStorageFieldBlockT3.class, blockName); - - return instance; - } -} diff --git a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT4.java b/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT4.java deleted file mode 100644 index bdd0af8d2b..0000000000 --- a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT4.java +++ /dev/null @@ -1,37 +0,0 @@ -package common.blocks; - -import common.itemBlocks.IB_TFFTStorageFieldBlockT4; -import cpw.mods.fml.common.registry.GameRegistry; -import kekztech.KekzCore; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; - -public class Block_TFFTStorageFieldBlockT4 extends BaseGTUpdateableBlock { - - private static Block_TFFTStorageFieldBlockT4 instance; - - private Block_TFFTStorageFieldBlockT4() { - super(Material.iron); - } - - public static int getCapacity() { - return 64000000; - } - - public static Block registerBlock() { - if (instance == null) { - instance = new Block_TFFTStorageFieldBlockT4(); - } - - final String blockName = "kekztech_tfftstoragefieldblock4_block"; - instance.setBlockName(blockName); - instance.setCreativeTab(CreativeTabs.tabMisc); - instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTStorageFieldBlock4"); - instance.setHardness(5.0f); - instance.setResistance(6.0f); - GameRegistry.registerBlock(instance, IB_TFFTStorageFieldBlockT4.class, blockName); - - return instance; - } -} diff --git a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT5.java b/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT5.java deleted file mode 100644 index c215fe3909..0000000000 --- a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT5.java +++ /dev/null @@ -1,37 +0,0 @@ -package common.blocks; - -import common.itemBlocks.IB_TFFTStorageFieldBlockT5; -import cpw.mods.fml.common.registry.GameRegistry; -import kekztech.KekzCore; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; - -public class Block_TFFTStorageFieldBlockT5 extends BaseGTUpdateableBlock { - - private static Block_TFFTStorageFieldBlockT5 instance; - - private Block_TFFTStorageFieldBlockT5() { - super(Material.iron); - } - - public static int getCapacity() { - return 256000000; - } - - public static Block registerBlock() { - if (instance == null) { - instance = new Block_TFFTStorageFieldBlockT5(); - } - - final String blockName = "kekztech_tfftstoragefieldblock5_block"; - instance.setBlockName(blockName); - instance.setCreativeTab(CreativeTabs.tabMisc); - instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTStorageFieldBlock5"); - instance.setHardness(5.0f); - instance.setResistance(6.0f); - GameRegistry.registerBlock(instance, IB_TFFTStorageFieldBlockT5.class, blockName); - - return instance; - } -} diff --git a/src/main/java/common/itemBlocks/IB_TFFTMultiHatch.java b/src/main/java/common/itemBlocks/IB_TFFTMultiHatch.java deleted file mode 100644 index 4e4da45b2d..0000000000 --- a/src/main/java/common/itemBlocks/IB_TFFTMultiHatch.java +++ /dev/null @@ -1,37 +0,0 @@ -package common.itemBlocks; - -import java.util.List; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; - -@Deprecated -public class IB_TFFTMultiHatch extends ItemBlock { - - public IB_TFFTMultiHatch(Block block) { - super(block); - } - - @Override - public int getMetadata(int meta) { - return meta; - } - - @Override - public boolean getHasSubtypes() { - return true; - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName() + "." + stack.getItemDamage(); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add(StatCollector.translateToLocal("tile.kekztech_tfftmultihatch_block.0.desc")); - } -} diff --git a/src/main/java/common/itemBlocks/IB_TFFTStorageField.java b/src/main/java/common/itemBlocks/IB_TFFTStorageField.java new file mode 100644 index 0000000000..8e75a881f2 --- /dev/null +++ b/src/main/java/common/itemBlocks/IB_TFFTStorageField.java @@ -0,0 +1,47 @@ +package common.itemBlocks; + +import common.tileentities.GTMTE_TFFT; +import java.text.NumberFormat; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; + +public class IB_TFFTStorageField extends ItemBlock { + + public IB_TFFTStorageField(Block block) { + super(block); + } + + @Override + public int getMetadata(int meta) { + return meta; + } + + @Override + public boolean getHasSubtypes() { + return true; + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return super.getUnlocalizedName() + "." + stack.getItemDamage(); + } + + @SuppressWarnings("unchecked") + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { + int meta = stack.getItemDamage(); + if (meta > 0) { + lines.add(StatCollector.translateToLocal("tile.kekztech_tfftstoragefield_block.desc")); + lines.add("Capacity: " + EnumChatFormatting.BLUE + + NumberFormat.getNumberInstance().format(GTMTE_TFFT.Field.VALUES[meta - 1].getCapacity()) + + EnumChatFormatting.GRAY + " L"); + lines.add("Power Draw: " + EnumChatFormatting.BLUE + GTMTE_TFFT.Field.VALUES[meta - 1].getCost() + + EnumChatFormatting.GRAY + " EU/t"); + } + } +} diff --git a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT1.java b/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT1.java deleted file mode 100644 index adcf705bcb..0000000000 --- a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT1.java +++ /dev/null @@ -1,24 +0,0 @@ -package common.itemBlocks; - -import common.blocks.Block_TFFTStorageFieldBlockT1; -import java.util.List; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; - -public class IB_TFFTStorageFieldBlockT1 extends ItemBlock { - - public IB_TFFTStorageFieldBlockT1(Block block) { - super(block); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add(StatCollector.translateToLocal("tile.kekztech_tfftstoragefieldblock1_block.0.desc")); - lines.add("Capacity: " + Block_TFFTStorageFieldBlockT1.getCapacity() + "L"); - lines.add("Power Draw: +0.5EU/t"); - } -} diff --git a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT2.java b/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT2.java deleted file mode 100644 index 2ee7a632a7..0000000000 --- a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT2.java +++ /dev/null @@ -1,24 +0,0 @@ -package common.itemBlocks; - -import common.blocks.Block_TFFTStorageFieldBlockT2; -import java.util.List; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; - -public class IB_TFFTStorageFieldBlockT2 extends ItemBlock { - - public IB_TFFTStorageFieldBlockT2(Block block) { - super(block); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add(StatCollector.translateToLocal("tile.kekztech_tfftstoragefieldblock1_block.0.desc")); - lines.add("Capacity: " + Block_TFFTStorageFieldBlockT2.getCapacity() + "L"); - lines.add("Power Draw: +1EU/t"); - } -} diff --git a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT3.java b/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT3.java deleted file mode 100644 index 6305209bb3..0000000000 --- a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT3.java +++ /dev/null @@ -1,24 +0,0 @@ -package common.itemBlocks; - -import common.blocks.Block_TFFTStorageFieldBlockT3; -import java.util.List; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; - -public class IB_TFFTStorageFieldBlockT3 extends ItemBlock { - - public IB_TFFTStorageFieldBlockT3(Block block) { - super(block); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add(StatCollector.translateToLocal("tile.kekztech_tfftstoragefieldblock1_block.0.desc")); - lines.add("Capacity: " + Block_TFFTStorageFieldBlockT3.getCapacity() + "L"); - lines.add("Power Draw: +2EU/t"); - } -} diff --git a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT4.java b/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT4.java deleted file mode 100644 index f0ed537b66..0000000000 --- a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT4.java +++ /dev/null @@ -1,24 +0,0 @@ -package common.itemBlocks; - -import common.blocks.Block_TFFTStorageFieldBlockT4; -import java.util.List; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; - -public class IB_TFFTStorageFieldBlockT4 extends ItemBlock { - - public IB_TFFTStorageFieldBlockT4(Block block) { - super(block); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add(StatCollector.translateToLocal("tile.kekztech_tfftstoragefieldblock1_block.0.desc")); - lines.add("Capacity: " + Block_TFFTStorageFieldBlockT4.getCapacity() + "L"); - lines.add("Power Draw: +4EU/t"); - } -} diff --git a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT5.java b/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT5.java deleted file mode 100644 index 4913d791e0..0000000000 --- a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT5.java +++ /dev/null @@ -1,24 +0,0 @@ -package common.itemBlocks; - -import common.blocks.Block_TFFTStorageFieldBlockT5; -import java.util.List; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; - -public class IB_TFFTStorageFieldBlockT5 extends ItemBlock { - - public IB_TFFTStorageFieldBlockT5(Block block) { - super(block); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add(StatCollector.translateToLocal("tile.kekztech_tfftstoragefieldblock1_block.0.desc")); - lines.add("Capacity: " + Block_TFFTStorageFieldBlockT5.getCapacity() + "L"); - lines.add("Power Draw: +8EU/t"); - } -} diff --git a/src/main/java/common/tileentities/GTMTE_FluidMultiStorage.java b/src/main/java/common/tileentities/GTMTE_FluidMultiStorage.java deleted file mode 100644 index df60be8362..0000000000 --- a/src/main/java/common/tileentities/GTMTE_FluidMultiStorage.java +++ /dev/null @@ -1,562 +0,0 @@ -package common.tileentities; - -import common.Blocks; -import common.blocks.*; -import gregtech.api.enums.Textures.BlockIcons; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.*; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import java.util.ArrayList; -import java.util.HashSet; -import kekztech.MultiFluidHandler; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import util.Vector3i; -import util.Vector3ic; - -public class GTMTE_FluidMultiStorage extends GT_MetaTileEntity_TooltipMultiBlockBase { - - private static final String glassNameIC2Reinforced = "blockAlloyGlass"; - private static final Block CASING = Blocks.tfftCasing; - private static final Block_TFFTStorageFieldBlockT1 STORAGE_FIELD1 = - (Block_TFFTStorageFieldBlockT1) Blocks.tfftStorageField1; - private static final Block_TFFTStorageFieldBlockT2 STORAGE_FIELD2 = - (Block_TFFTStorageFieldBlockT2) Blocks.tfftStorageField2; - private static final Block_TFFTStorageFieldBlockT3 STORAGE_FIELD3 = - (Block_TFFTStorageFieldBlockT3) Blocks.tfftStorageField3; - private static final Block_TFFTStorageFieldBlockT4 STORAGE_FIELD4 = - (Block_TFFTStorageFieldBlockT4) Blocks.tfftStorageField4; - private static final Block_TFFTStorageFieldBlockT5 STORAGE_FIELD5 = - (Block_TFFTStorageFieldBlockT5) Blocks.tfftStorageField5; - private static final int CASING_TEXTURE_ID = 176; - - private MultiFluidHandler mfh; - private final HashSet<GTMTE_TFFTMultiHatch> sMultiHatches = new HashSet<>(); - - private int runningCost = 0; - private boolean doVoidExcess = false; - private byte fluidSelector = 0; - - public GTMTE_FluidMultiStorage(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GTMTE_FluidMultiStorage(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) { - return new GTMTE_FluidMultiStorage(super.mName); - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Fluid Tank") - .addInfo("High-Tech fluid tank that can hold up to 25 different fluids!") - .addInfo("Has 1/25th of the total capacity as capacity for each fluid.") - .addInfo("Right clicking the controller with a screwdriver will turn on excess voiding.") - .addInfo("Fluid storage amount and running cost depends on the storage field blocks used.") - .addSeparator() - .addInfo("Note on hatch locking:") - .addInfo("Use an Integrated Circuit in the GUI slot to limit which fluid is output.") - .addInfo("The index of a stored fluid can be obtained through the Tricorder.") - .addSeparator() - .beginStructureBlock(5, 9, 5, false) - .addController("Top Center") - .addCasingInfo("T.F.F.T. Casing", 20) - .addOtherStructurePart("Storage Field Blocks (Tier I-V)", "Inner 3x7x3 solid pillar") - .addOtherStructurePart("IC2 Reinforced Glass", "Outer 5x7x5 glass shell") - .addMaintenanceHatch("Any top or bottom casing") - .addEnergyHatch("Any top or bottom casing") - .addInputHatch("Instead of any casing or glass, has to touch storage field block") - .addOutputHatch("Instead of any casing or glass, has to touch storage field block") - .addStructureInfo("You can have a bunch of hatches") - .addOtherStructurePart( - "Multi I/O Hatches", "Instead of any casing or glass, has to touch storage field block") - .addStructureInfo( - "Use MIOH with conduits or fluid storage busses to see all fluids at once. If it's fixed.") - .addStructureInfo("Ask someone else why there's 4 versions, with 2 uncraftable ones") - .toolTipFinisher("KekzTech"); - return tt; - } - - @Override - public ITexture[] getTexture( - IGregTechTileEntity aBaseMetaTileEntity, - byte aSide, - byte aFacing, - byte aColorIndex, - boolean aActive, - boolean aRedstone) { - return aSide == aFacing - ? new ITexture[] { - BlockIcons.casingTexturePages[1][48], - new GT_RenderedTexture( - aActive - ? BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE - : BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR) - } - : new ITexture[] {BlockIcons.casingTexturePages[1][48]}; - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine( - aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); - } - - @Override - public boolean isCorrectMachinePart(ItemStack var1) { - return true; - } - - @Override - public boolean checkRecipe(ItemStack guiSlotItem) { - - super.mEfficiency = 10000 - (super.getIdealStatus() - super.getRepairStatus()) * 1000; - super.mEfficiencyIncrease = 10000; - super.mEUt = runningCost; - super.mMaxProgresstime = 10; - - if (guiSlotItem != null && guiSlotItem.getUnlocalizedName().equals("gt.integrated_circuit")) { - this.fluidSelector = (byte) guiSlotItem.getItemDamage(); - } - - // If there are no basic I/O hatches, let multi hatches handle it and skip a lot of code! - if (sMultiHatches.size() > 0 && super.mInputHatches.size() == 0 && super.mOutputHatches.size() == 0) { - return true; - } - - // Suck in fluids - final ArrayList<FluidStack> inputHatchFluids = super.getStoredFluids(); - if (inputHatchFluids.size() > 0) { - - for (FluidStack fluidStack : inputHatchFluids) { - - final int pushed = mfh.pushFluid(fluidStack, true); - final FluidStack toDeplete = fluidStack.copy(); - toDeplete.amount = pushed; - super.depleteInput(toDeplete); - } - } - - // Push out fluids - if (guiSlotItem != null && guiSlotItem.getUnlocalizedName().equals("gt.integrated_circuit")) { - final FluidStack storedFluid = mfh.getFluidCopy(fluidSelector); - // Sum available output capacity - int possibleOutput = 0; - for (GT_MetaTileEntity_Hatch_Output outputHatch : super.mOutputHatches) { - if (outputHatch.isFluidLocked() - && outputHatch.getLockedFluidName().equals(storedFluid.getUnlocalizedName())) { - possibleOutput += outputHatch.getCapacity() - outputHatch.getFluidAmount(); - } else if (outputHatch.getFluid() != null - && outputHatch.getFluid().getUnlocalizedName().equals(storedFluid.getUnlocalizedName())) { - possibleOutput += outputHatch.getCapacity() - outputHatch.getFluidAmount(); - } else if (outputHatch.getFluid() == null) { - possibleOutput += outputHatch.getCapacity() - outputHatch.getFluidAmount(); - } - } - // Output as much as possible - final FluidStack tempStack = storedFluid.copy(); - tempStack.amount = possibleOutput; - tempStack.amount = mfh.pullFluid(tempStack, fluidSelector, true); - super.addOutput(tempStack); - - } else { - int tDistinct = mfh.getDistinctFluids(); - int tDistinctCount = 0; - int tMaxDistinct = mfh.getMaxDistinctFluids(); - for (int i = 0; i < tMaxDistinct && tDistinctCount < tDistinct; i++) { - final FluidStack storedFluidCopy = mfh.getFluidCopy(i); - if (storedFluidCopy == null) continue; - tDistinctCount++; - storedFluidCopy.amount = 0; - // Calculate how much capacity all available Output Hatches offer - for (GT_MetaTileEntity_Hatch_Output outputHatch : super.mOutputHatches) { - if (outputHatch.isFluidLocked() - && outputHatch.getLockedFluidName().equals(storedFluidCopy.getUnlocalizedName())) { - storedFluidCopy.amount += outputHatch.getCapacity() - outputHatch.getFluidAmount(); - addFluidToHatch(storedFluidCopy, outputHatch); - } else if (outputHatch.getFluid() != null - && outputHatch.getFluid().isFluidEqual(storedFluidCopy)) { - storedFluidCopy.amount += outputHatch.getCapacity() - outputHatch.getFluidAmount(); - addFluidToHatch(storedFluidCopy, outputHatch); - } else if (!outputHatch.isFluidLocked() && outputHatch.getFluid() == null) { - storedFluidCopy.amount += outputHatch.getCapacity() - outputHatch.getFluidAmount(); - addFluidToHatch(storedFluidCopy, outputHatch); - } - } - } - } - - return true; - } - - public void addFluidToHatch(FluidStack aFluid, GT_MetaTileEntity_Hatch_Output aHatch) { - aFluid.amount = mfh.pullFluid(aFluid, true); - aHatch.fill(aFluid, true); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - - if (mfh != null) { - mfh.setLock(!super.getBaseMetaTileEntity().isActive()); - mfh.setFluidSelector(fluidSelector); - mfh.setDoVoidExcess(doVoidExcess); - } - } - - public Vector3ic rotateOffsetVector(Vector3ic forgeDirection, int x, int y, int z) { - final Vector3i offset = new Vector3i(); - - // either direction on z-axis - if (forgeDirection.x() == 0 && forgeDirection.z() == -1) { - offset.x = x; - offset.y = y; - offset.z = z; - } - if (forgeDirection.x() == 0 && forgeDirection.z() == 1) { - offset.x = -x; - offset.y = y; - offset.z = -z; - } - // either direction on x-axis - if (forgeDirection.x() == -1 && forgeDirection.z() == 0) { - offset.x = z; - offset.y = y; - offset.z = -x; - } - if (forgeDirection.x() == 1 && forgeDirection.z() == 0) { - offset.x = -z; - offset.y = y; - offset.z = x; - } - // either direction on y-axis - if (forgeDirection.y() == -1) { - offset.x = x; - offset.y = z; - offset.z = y; - } - - return offset; - } - - @Override - public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) { - // Figure out the vector for the direction the back face of the controller is facing - final Vector3ic forgeDirection = new Vector3i( - ForgeDirection.getOrientation(thisController.getBackFacing()).offsetX, - ForgeDirection.getOrientation(thisController.getBackFacing()).offsetY, - ForgeDirection.getOrientation(thisController.getBackFacing()).offsetZ); - int minCasingAmount = 20; - boolean formationChecklist = true; // If this is still true at the end, machine is good to go :) - float runningCostAcc = 0; - double fluidCapacityAcc = 0; - - sMultiHatches.clear(); - - // Front segment - for (int X = -2; X <= 2; X++) { - for (int Y = -2; Y <= 2; Y++) { - if (X == 0 && Y == 0) { - continue; // Skip controller - } - - // Get next TE - final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, 0); - final IGregTechTileEntity currentTE = - thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z()); - - // Fluid hatches should touch the storage field. - // Maintenance/Energy hatch can go anywhere - if (X > -2 && X < 2 && Y > -2 && Y < 2) { - if (!super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addEnergyInputToMachineList(currentTE, CASING_TEXTURE_ID) - && !addMultiHatchToMachineList(currentTE, CASING_TEXTURE_ID)) { - - // If it's not a hatch, is it the right casing for this machine? Check block and block meta. - // Also check for multi hatch - if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING) { - // Seems to be valid casing. Decrement counter. - minCasingAmount--; - } else { - formationChecklist = false; - } - } - } else { - if (!super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addEnergyInputToMachineList(currentTE, CASING_TEXTURE_ID)) { - - // If it's not a hatch, is it the right casing for this machine? Check block and block meta. - if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING) { - // Seems to be valid casing. Decrement counter. - minCasingAmount--; - } else { - formationChecklist = false; - } - } - } - } - } - - // Middle seven long segment - for (int X = -2; X <= 2; X++) { - for (int Y = -2; Y <= 2; Y++) { - for (int Z = -1; Z >= -7; Z--) { - final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, Z); - if (X > -2 && X < 2 && Y > -2 && Y < 2) { - if (thisController - .getBlockOffset(offset.x(), offset.y(), offset.z()) - .getUnlocalizedName() - .equals(STORAGE_FIELD1.getUnlocalizedName())) { - runningCostAcc += 0.5f; - fluidCapacityAcc += (float) Block_TFFTStorageFieldBlockT1.getCapacity(); - } else if (thisController - .getBlockOffset(offset.x(), offset.y(), offset.z()) - .getUnlocalizedName() - .equals(STORAGE_FIELD2.getUnlocalizedName())) { - runningCostAcc += 1.0f; - fluidCapacityAcc += (float) Block_TFFTStorageFieldBlockT2.getCapacity(); - } else if (thisController - .getBlockOffset(offset.x(), offset.y(), offset.z()) - .getUnlocalizedName() - .equals(STORAGE_FIELD3.getUnlocalizedName())) { - runningCostAcc += 2.0f; - fluidCapacityAcc += (float) Block_TFFTStorageFieldBlockT3.getCapacity(); - } else if (thisController - .getBlockOffset(offset.x(), offset.y(), offset.z()) - .getUnlocalizedName() - .equals(STORAGE_FIELD4.getUnlocalizedName())) { - runningCostAcc += 4.0f; - fluidCapacityAcc += (float) Block_TFFTStorageFieldBlockT4.getCapacity(); - } else if (thisController - .getBlockOffset(offset.x(), offset.y(), offset.z()) - .getUnlocalizedName() - .equals(STORAGE_FIELD5.getUnlocalizedName())) { - runningCostAcc += 8.0f; - fluidCapacityAcc += (float) Block_TFFTStorageFieldBlockT5.getCapacity(); - } else { - formationChecklist = false; - } - continue; - } - - // Get next TE - final IGregTechTileEntity currentTE = - thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z()); - - // Corner allows only glass - if (X == -2 && Y == -2 || X == 2 && Y == 2 || X == -2 && Y == 2 || X == 2 && Y == -2) { - if (!(thisController - .getBlockOffset(offset.x(), offset.y(), offset.z()) - .getUnlocalizedName() - .equals(glassNameIC2Reinforced))) { - formationChecklist = false; - } - } else { - // Tries to add TE as either of those kinds of hatches. - // The number is the texture index number for the texture that needs to be painted over the - // hatch texture (TAE for GT++) - if (!super.addInputToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID) - && !addMultiHatchToMachineList(currentTE, CASING_TEXTURE_ID)) { - - // If it's not a hatch, is it the right casing for this machine? Check block and block meta. - // Also check for multi hatch - if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING) { - // Seems to be valid casing. Decrement counter. - minCasingAmount--; - } else if (!thisController - .getBlockOffset(offset.x(), offset.y(), offset.z()) - .getUnlocalizedName() - .equals(glassNameIC2Reinforced)) { - formationChecklist = false; - } - } - } - } - } - } - - // Back segment - for (int X = -2; X <= 2; X++) { - for (int Y = -2; Y <= 2; Y++) { - // Get next TE - final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, -8); - final IGregTechTileEntity currentTE = - thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z()); - - // Fluid hatches should touch the storage field. - // Maintenance/Energy hatch can go anywhere - if (X > -2 && X < 2 && Y > -2 && Y < 2) { - if (!super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addEnergyInputToMachineList(currentTE, CASING_TEXTURE_ID) - && !addMultiHatchToMachineList(currentTE, CASING_TEXTURE_ID)) { - - // If it's not a hatch, is it the right casing for this machine? Check block and block meta. - if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING) { - // Seems to be valid casing. Decrement counter. - minCasingAmount--; - } else { - formationChecklist = false; - } - } - } else { - if (!super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addEnergyInputToMachineList(currentTE, CASING_TEXTURE_ID)) { - - // If it's not a hatch, is it the right casing for this machine? Check block and block meta. - if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING) { - // Seems to be valid casing. Decrement counter. - minCasingAmount--; - } else { - formationChecklist = false; - } - } - } - } - } - - if (this.mEnergyHatches.size() < 1) { - formationChecklist = false; - } - - if (this.mMaintenanceHatches.size() != 1) { - formationChecklist = false; - } - - if (minCasingAmount > 0) { - formationChecklist = false; - } - - if (formationChecklist) { - runningCost = Math.round(-runningCostAcc); - // Update MultiFluidHandler in case storage cells have been changed - final int capacityPerFluid = (int) Math.round(fluidCapacityAcc / 25.0f); - if (mfh == null) { - mfh = MultiFluidHandler.newInstance(25, capacityPerFluid); - } else { - if (mfh.getCapacity() != capacityPerFluid) { - mfh = MultiFluidHandler.newAdjustedInstance(mfh, capacityPerFluid); - } - } - for (GTMTE_TFFTMultiHatch mh : sMultiHatches) { - mh.setMultiFluidHandler(mfh); - } - } - - return formationChecklist; - } - - public boolean addMultiHatchToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } else if (aMetaTileEntity instanceof GTMTE_TFFTMultiHatch) { - ((GTMTE_TFFTMultiHatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return this.sMultiHatches.add((GTMTE_TFFTMultiHatch) aMetaTileEntity); - } else { - return false; - } - } - } - - @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - doVoidExcess = !doVoidExcess; - GT_Utility.sendChatToPlayer(aPlayer, doVoidExcess ? "Auto-voiding enabled" : "Auto-voiding disabled"); - } - - @Override - public String[] getInfoData() { - final ArrayList<String> ll = mfh.getInfoData(); - - ll.add(EnumChatFormatting.YELLOW + "Operational Data:" + EnumChatFormatting.RESET); - ll.add("Auto-voiding: " + doVoidExcess); - ll.add("Per-Fluid Capacity: " + mfh.getCapacity() + "L"); - ll.add("Running Cost: " - // mEUt does not naturally reflect efficiency status. Do that here. - + ((-super.mEUt) * 10000 / Math.max(1000, super.mEfficiency)) + "EU/t"); - ll.add("Maintenance Status: " - + ((super.getRepairStatus() == super.getIdealStatus()) - ? EnumChatFormatting.GREEN + "Working perfectly" + EnumChatFormatting.RESET - : EnumChatFormatting.RED + "Has Problems" + EnumChatFormatting.RESET)); - ll.add("---------------------------------------------"); - - final String[] a = new String[ll.size()]; - return ll.toArray(a); - } - - @Override - public void saveNBTData(NBTTagCompound nbt) { - nbt = (nbt == null) ? new NBTTagCompound() : nbt; - - nbt.setInteger("runningCost", runningCost); - nbt.setBoolean("doVoidExcess", doVoidExcess); - - nbt.setInteger("capacityPerFluid", mfh.getCapacity()); - nbt.setTag("fluids", mfh.saveNBTData(new NBTTagCompound())); - - super.saveNBTData(nbt); - } - - @Override - public void loadNBTData(NBTTagCompound nbt) { - nbt = (nbt == null) ? new NBTTagCompound() : nbt; - - runningCost = nbt.getInteger("runningCost"); - doVoidExcess = nbt.getBoolean("doVoidExcess"); - - mfh = MultiFluidHandler.loadNBTData(nbt); - for (GTMTE_TFFTMultiHatch mh : sMultiHatches) { - mh.setMultiFluidHandler(mfh); - } - super.loadNBTData(nbt); - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public int getMaxEfficiency(ItemStack var1) { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack var1) { - return 0; - } - - @Override - public int getDamageToComponent(ItemStack var1) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack var1) { - return false; - } -} diff --git a/src/main/java/common/tileentities/GTMTE_TFFT.java b/src/main/java/common/tileentities/GTMTE_TFFT.java new file mode 100644 index 0000000000..e3f7951cdb --- /dev/null +++ b/src/main/java/common/tileentities/GTMTE_TFFT.java @@ -0,0 +1,757 @@ +package common.tileentities; + +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static java.lang.Math.min; + +import com.github.bartimaeusnek.bartworks.API.BorosilicateGlass; +import com.gtnewhorizon.structurelib.StructureLibAPI; +import com.gtnewhorizon.structurelib.alignment.constructable.ChannelDataAccessor; +import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; +import com.gtnewhorizon.structurelib.structure.*; +import com.gtnewhorizon.structurelib.util.ItemStackPredicate; +import common.Blocks; +import gregtech.api.enums.Textures; +import gregtech.api.fluid.FluidTankGT; +import gregtech.api.interfaces.IHatchElement; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.IGT_HatchAdder; +import gregtech.common.items.GT_IntegratedCircuit_Item; +import java.math.BigInteger; +import java.text.MessageFormat; +import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; + +public class GTMTE_TFFT extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_TFFT> implements ISurvivalConstructable { + + public enum Field { + T1(1_000_000L, 1), // LV + T2(4_000_000L, 2), // MV + T3(16_000_000L, 5), // HV + T4(64_000_000L, 14), // EV + T5(256_000_000L, 42), // IV + + T6(2_048_000_000L, 132), // LuV + T7(131_072_000_000L, 429), // UV + T8(8_388_608_000_000L, 1430), // UEV + T9(536_870_912_000_000L, 4862), // UMV + + T10(1_099_511_627_776_000_000L, 0); // UXV + + public static final GTMTE_TFFT.Field[] VALUES = values(); + private final long capacity; + private final int cost; + + Field(long capacity, int cost) { + this.capacity = capacity; + this.cost = cost; + } + + public long getCapacity() { + return capacity; + } + + public int getCost() { + return cost; + } + } + + private enum TFFTMultiHatch implements IHatchElement<GTMTE_TFFT> { + INSTANCE; + + private final List<? extends Class<? extends IMetaTileEntity>> mteClasses; + + @SafeVarargs + TFFTMultiHatch(Class<? extends IMetaTileEntity>... mteClasses) { + this.mteClasses = Arrays.asList(mteClasses); + } + + @Override + public List<? extends Class<? extends IMetaTileEntity>> mteClasses() { + return mteClasses; + } + + @Override + public IGT_HatchAdder<? super GTMTE_TFFT> adder() { + return GTMTE_TFFT::addMultiHatchToMachineList; + } + + @Override + public long count(GTMTE_TFFT t) { + return t.tfftHatch == null ? 0 : 1; + } + } + + private enum TFFTStorageFieldElement implements IStructureElement<GTMTE_TFFT> { + INSTANCE; + + @Override + public boolean check(GTMTE_TFFT t, World world, int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + int meta = worldBlock.getDamageValue(world, x, y, z); + if (TFFT_FIELD != worldBlock || meta == 0) return false; + t.FIELDS[meta - 1]++; + return true; + } + + private int getHint(ItemStack stack) { + return Math.min(Field.VALUES.length, ChannelDataAccessor.getChannelData(stack, "field")); + } + + @Override + public boolean spawnHint(GTMTE_TFFT t, World world, int x, int y, int z, ItemStack trigger) { + StructureLibAPI.hintParticle(world, x, y, z, TFFT_FIELD, getHint(trigger)); + return true; + } + + @Override + public boolean placeBlock(GTMTE_TFFT t, World world, int x, int y, int z, ItemStack trigger) { + world.setBlock(x, y, z, TFFT_FIELD, getHint(trigger), 3); + return true; + } + + @Override + public PlaceResult survivalPlaceBlock( + GTMTE_TFFT t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env) { + if (check(t, world, x, y, z)) return PlaceResult.SKIP; + int fieldTier = getHint(trigger); + ItemStack result = env.getSource() + .takeOne( + s -> s != null + && s.stackSize >= 0 + && s.getItem() == TFFT_FIELD_ITEM + && s.getItemDamage() != CASING_META + && s.getItemDamage() <= fieldTier, + true); + if (result == null) return PlaceResult.REJECT; + + return StructureUtility.survivalPlaceBlock( + result, + ItemStackPredicate.NBTMode.EXACT, + null, + true, + world, + x, + y, + z, + env.getSource(), + env.getActor(), + env.getChatter()); + } + } + + private static final IIconContainer TEXTURE_TFFT = new Textures.BlockIcons.CustomIcon("iconsets/TFFT"); + private static final IIconContainer TEXTURE_TFFT_ACTIVE = + new Textures.BlockIcons.CustomIcon("iconsets/TFFT_ACTIVE"); + private static final IIconContainer TEXTURE_TFFT_ACTIVE_GLOW = + new Textures.BlockIcons.CustomIcon("iconsets/TFFT_ACTIVE_GLOW"); + private static final int CASING_TEXTURE_ID_1 = (12 << 7) | 127; + private static final int CASING_TEXTURE_ID_2 = 176; + + private static final Block TFFT_FIELD = Blocks.tfftStorageField; + private static final Item TFFT_FIELD_ITEM = Item.getItemFromBlock(TFFT_FIELD); + public static final int MAX_DISTINCT_FLUIDS = 25; + private static final BigInteger MAX_CAPACITY = + BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.valueOf(25)); + private static final int CASING_META = 0; + private static final int MIN_CASING_AMOUNT = 20; + private static final int MAX_LAYER_AMOUNT = 13; + private static final int DEFAULT_LAYER_AMOUNT = 3; + + private static final String STRUCTURE_PIECE_TOP = "top"; + private static final String STRUCTURE_PIECE_MID = "mid"; + private static final String STRUCTURE_PIECE_BOTTOM = "bottom"; + + // height channel for height + // field channel for field + private static final IStructureDefinition<GTMTE_TFFT> STRUCTURE_DEFINITION = + IStructureDefinition.<GTMTE_TFFT>builder() + .addShape( + STRUCTURE_PIECE_TOP, + transpose(new String[][] {{"ccccc"}, {"cCCCc"}, {"cC~Cc"}, {"cCCCc"}, {"ccccc"}})) + .addShape( + STRUCTURE_PIECE_MID, + transpose(new String[][] {{"gGGGg"}, {"GfffG"}, {"GfffG"}, {"GfffG"}, {"gGGGg"}})) + .addShape( + STRUCTURE_PIECE_BOTTOM, + transpose(new String[][] {{"ccccc"}, {"cCCCc"}, {"cCCCc"}, {"cCCCc"}, {"ccccc"}})) + .addElement( + 'c', + buildHatchAdder(GTMTE_TFFT.class) + .atLeast(Energy, Maintenance) + .casingIndex(CASING_TEXTURE_ID_1) + .dot(1) + .buildAndChain( + onElementPass(te -> te.casingAmount++, ofBlock(TFFT_FIELD, CASING_META)))) + .addElement( + 'C', + buildHatchAdder(GTMTE_TFFT.class) + .casingIndex(CASING_TEXTURE_ID_1) + .atLeast( + Energy, + Maintenance, + InputHatch.or(TFFTMultiHatch.INSTANCE), + OutputHatch.or(TFFTMultiHatch.INSTANCE)) + .dot(2) + .buildAndChain( + onElementPass(te -> te.casingAmount++, ofBlock(TFFT_FIELD, CASING_META)))) + .addElement( + 'G', + buildHatchAdder(GTMTE_TFFT.class) + .atLeast( + InputHatch.or(TFFTMultiHatch.INSTANCE), + OutputHatch.or(TFFTMultiHatch.INSTANCE)) + .casingIndex(CASING_TEXTURE_ID_2) + .dot(3) + .buildAndChain( + ofBlockUnlocalizedName("IC2", "blockAlloyGlass", 0, true), + ofBlockUnlocalizedName("Thaumcraft", "blockCosmeticOpaque", 2, false), + BorosilicateGlass.ofBoroGlassAnyTier())) + .addElement( + 'g', + ofChain( + ofBlockUnlocalizedName("IC2", "blockAlloyGlass", 0, true), + ofBlockUnlocalizedName("Thaumcraft", "blockCosmeticOpaque", 2, false), + BorosilicateGlass.ofBoroGlassAnyTier())) + .addElement('f', ofChain(TFFTStorageFieldElement.INSTANCE)) + .build(); + + public final FluidTankGT[] STORE = new FluidTankGT[MAX_DISTINCT_FLUIDS]; + + { + for (int i = 0; i < MAX_DISTINCT_FLUIDS; i++) { + STORE[i] = new FluidTankGT(0); + } + } + + private final int[] FIELDS = new int[Field.VALUES.length]; + + private BigInteger capacity = BigInteger.ZERO; + private long capacityPerFluid = 0L; + private int casingAmount = 0; + private int runningCost = 0; + + private boolean locked = true; + private boolean doVoidExcess = false; + private byte fluidSelector = -1; + + private GTMTE_TFFTHatch tfftHatch = null; + + public GTMTE_TFFT(String aName) { + super(aName); + } + + public GTMTE_TFFT(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + @Override + public IStructureDefinition<GTMTE_TFFT> getStructureDefinition() { + return STRUCTURE_DEFINITION; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GTMTE_TFFT(super.mName); + } + + @Override + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + if (aSide == aFacing) { + if (aActive) + return new ITexture[] { + Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID_1), + TextureFactory.builder() + .addIcon(TEXTURE_TFFT_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(TEXTURE_TFFT_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { + Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID_1), + TextureFactory.builder().addIcon(TEXTURE_TFFT).extFacing().build() + }; + } + return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID_1)}; + } + + @Override + protected GT_Multiblock_Tooltip_Builder createTooltip() { + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Fluid Tank") + .addInfo("High-Tech fluid tank that can hold up to 25 different fluids!") + .addInfo("Has 1/25th of the total capacity as capacity for each fluid.") + .addInfo("Right clicking the controller with a screwdriver will turn on excess voiding.") + .addInfo("Fluid storage amount and running cost depends on the storage field blocks used.") + .addSeparator() + .addInfo("Note on hatch locking:") + .addInfo("Use an Integrated Circuit in the GUI slot to limit which fluid is output.") + .addInfo("The index of a stored fluid can be obtained through the Tricorder.") + .addSeparator() + .beginVariableStructureBlock(5, 5, 5, 15, 5, 5, false) + .addController("Top Center") + .addCasingInfo("T.F.F.T Casing", MIN_CASING_AMOUNT) + .addOtherStructurePart("Storage Field Blocks (Tier I-X)", "Inner 3xhx3 solid pillar") + .addStructureInfo("Energy hatch is not required when running cost is 0") + .addOtherStructurePart( + "Borosilicate Glass(any)/Warded Glass/Reinforced Glass", "Outer 5xhx5 glass shell") + .addMaintenanceHatch("Any top or bottom casing") + .addEnergyHatch("Any top or bottom casing") + .addInputHatch("Instead of any casing or glass, has to touch storage field block") + .addOutputHatch("Instead of any casing or glass, has to touch storage field block") + .addStructureInfo("You can have a bunch of hatches") + .addOtherStructurePart( + "Multi I/O Hatches", "Instead of any casing or glass, has to touch storage field block") + .addStructureInfo("Use MIOH with conduits or fluid storage busses to see all fluids at once.") + .addSubChannelUsage("field", "Maximum Field Tier") + .addSubChannelUsage("height", "Height of structure") + .toolTipFinisher("KekzTech"); + return tt; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + int layer = min(stackSize.stackSize + DEFAULT_LAYER_AMOUNT, MAX_LAYER_AMOUNT + 1); + buildPiece(STRUCTURE_PIECE_TOP, stackSize, hintsOnly, 2, 2, 0); + for (int i = -1; i >= 1 - layer; i--) buildPiece(STRUCTURE_PIECE_MID, stackSize, hintsOnly, 2, 2, i); + buildPiece(STRUCTURE_PIECE_BOTTOM, stackSize, hintsOnly, 2, 2, -layer); + } + + @Override + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { + if (mMachine) return -1; + int build = survivialBuildPiece(STRUCTURE_PIECE_TOP, stackSize, 2, 2, 0, elementBudget, env, false, true); + if (build >= 0) return build; + int layer = min(stackSize.stackSize + DEFAULT_LAYER_AMOUNT, MAX_LAYER_AMOUNT + 1); + for (int i = -1; i >= 1 - layer; i--) { + build = survivialBuildPiece(STRUCTURE_PIECE_MID, stackSize, 2, 2, i, elementBudget, env, false, true); + if (build >= 0) return build; + } + return survivialBuildPiece(STRUCTURE_PIECE_BOTTOM, stackSize, 2, 2, -layer, elementBudget, env, false, true); + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public void clearHatches() { + super.clearHatches(); + if (tfftHatch != null) { + tfftHatch.unbind(); + tfftHatch = null; + } + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + Arrays.fill(FIELDS, 0); + + this.capacity = BigInteger.ZERO; + this.capacityPerFluid = 0L; + this.casingAmount = 0; + this.runningCost = 0; + + if (!checkPiece(STRUCTURE_PIECE_TOP, 2, 2, 0)) return false; + + int layer = 1; + while (checkPiece(STRUCTURE_PIECE_MID, 2, 2, -layer)) layer++; + if (layer - 1 > MAX_LAYER_AMOUNT || layer - 1 < DEFAULT_LAYER_AMOUNT) return false; + if (!checkPiece(STRUCTURE_PIECE_BOTTOM, 2, 2, -layer)) return false; + if (casingAmount >= MIN_CASING_AMOUNT + && (tfftHatch != null || (!mInputHatches.isEmpty() && !mOutputHatches.isEmpty())) + && mInputHatches.size() + mOutputHatches.size() <= MAX_DISTINCT_FLUIDS * 2 + && mMaintenanceHatches.size() == 1) { + BigInteger tempCap = BigInteger.ZERO; + for (int i = 0; i < this.FIELDS.length; i++) { + tempCap = tempCap.add( + BigInteger.valueOf(Field.VALUES[i].getCapacity()).multiply(BigInteger.valueOf(this.FIELDS[i]))); + this.runningCost += Field.VALUES[i].getCost() * this.FIELDS[i]; + } + this.setCapacity(tempCap); + + if (tfftHatch != null) tfftHatch.bind(this); + + return !mEnergyHatches.isEmpty() ^ this.runningCost == 0; + } + return false; + } + + @Override + public boolean checkRecipe(ItemStack itemStack) { + mEfficiency = getCurrentEfficiency(null); + mEfficiencyIncrease = 10000; + mEUt = this.runningCost; + mMaxProgresstime = 20; + + this.fluidSelector = (itemStack != null && itemStack.getItem() instanceof GT_IntegratedCircuit_Item) + ? (byte) itemStack.getItemDamage() + : -1; + + // Suck in fluids + final ArrayList<FluidStack> inputFluids = getStoredFluids(); + + if (!inputFluids.isEmpty()) { + for (FluidStack aFluid : inputFluids) { + final FluidStack toDeplete = aFluid.copy(); + toDeplete.amount = this.pull(aFluid, true); + depleteInput(toDeplete); + } + } + + // Push out fluids + if (!this.mOutputHatches.isEmpty()) { + final FluidTankGT sFluid = this.getSelectedFluid(); + boolean isFluidSelected = this.fluidSelector != -1; + + if (!isFluidSelected || !sFluid.isEmpty()) { + for (GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { + int hatchCapacity = tHatch.getCapacity(); + int hatchAmount = tHatch.getFluidAmount(); + int remaining = hatchCapacity - hatchAmount; + + if (remaining <= 0) continue; + + final FluidStack tFluid = tHatch.getFluid(); + + String lockedFluidName = tHatch.getLockedFluidName() == null ? "" : tHatch.getLockedFluidName(); + String tFluidName = tFluid == null ? "" : tFluid.getFluid().getName(); + + boolean isFluidLocked = tHatch.isFluidLocked(); + boolean isFluidEmpty = tFluid == null || tHatch.getFluidAmount() == 0; + + if (isFluidLocked && !this.contains(lockedFluidName)) continue; + if (!isFluidEmpty && !this.contains(tFluid)) continue; + if ((isFluidLocked && !isFluidEmpty) && !lockedFluidName.equals(tFluidName)) continue; + + if (isFluidSelected) { + if (isFluidLocked && !lockedFluidName.equals(sFluid.name())) continue; + if (!isFluidEmpty && !sFluid.contains(tFluid)) continue; + + tHatch.fill(this.push(sFluid.get(remaining), true), true); + } else if (isFluidLocked) { + if (!isFluidEmpty + && !lockedFluidName.equals(tFluid.getFluid().getName())) continue; + + FluidStack aFluid = FluidRegistry.getFluidStack(lockedFluidName, remaining); + tHatch.fill(this.push(aFluid, true), true); + } else if (isFluidEmpty) { + if (this.firstNotNull() != null) tHatch.fill(this.push(hatchCapacity, true), true); + } else { + tHatch.fill(this.push(new FluidStack(tFluid, remaining), true), true); + } + } + } + } + + if (this.mEUt > 0) this.mEUt = -this.mEUt; + + return true; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if (aBaseMetaTileEntity.isServerSide()) this.locked = !aBaseMetaTileEntity.isActive(); + } + + @Override + public String[] getInfoData() { + ArrayList<String> ll = new ArrayList<>(); + NumberFormat nf = NumberFormat.getNumberInstance(); + + ll.add(EnumChatFormatting.YELLOW + "Stored Fluids:" + EnumChatFormatting.RESET); + for (int i = 0; i < MAX_DISTINCT_FLUIDS; i++) { + FluidTankGT tank = STORE[i]; + if (tank.isEmpty()) { + ll.add(MessageFormat.format("{0} - {1}: {2}L ({3}%)", i, "NULL", 0, 0)); + } else { + String localizedName = STORE[i].get().getLocalizedName(); + String amount = nf.format(STORE[i].amount()); + String percentage = + capacityPerFluid > 0 ? String.valueOf(STORE[i].amount() * 100 / capacityPerFluid) : ""; + + ll.add(MessageFormat.format("{0} - {1}: {2}L ({3}%)", i, localizedName, amount, percentage)); + } + } + ll.add(EnumChatFormatting.YELLOW + "Operational Data:" + EnumChatFormatting.RESET); + ll.add("Used Capacity: " + nf.format(getStoredAmount()) + "L"); + ll.add("Total Capacity: " + nf.format(capacity) + "L"); + ll.add("Per-Fluid Capacity: " + nf.format(capacityPerFluid) + "L"); + ll.add("Running Cost: " + getActualEnergyUsage() + "EU/t"); + ll.add("Auto-voiding: " + doVoidExcess); + ll.add("Maintenance Status: " + + ((getRepairStatus() == getIdealStatus()) + ? EnumChatFormatting.GREEN + "Working perfectly" + EnumChatFormatting.RESET + : EnumChatFormatting.RED + "Has Problems" + EnumChatFormatting.RESET)); + ll.add("---------------------------------------------"); + + return ll.toArray(new String[0]); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setByteArray("capacity", capacity.toByteArray()); + aNBT.setBoolean("doVoidExcess", doVoidExcess); + aNBT.setInteger("runningCost", runningCost); + aNBT.setBoolean("lockFluid", locked); + aNBT.setByte("fluidSelector", fluidSelector); + + NBTTagCompound fluidNBT = new NBTTagCompound(); + aNBT.setTag("STORE", fluidNBT); + + for (int i = 0; i < MAX_DISTINCT_FLUIDS; i++) { + STORE[i].writeToNBT(fluidNBT, String.valueOf(i)); + } + + super.saveNBTData(aNBT); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + this.setCapacity(new BigInteger(aNBT.getByteArray("capacity"))); + this.setDoVoidExcess(aNBT.getBoolean("doVoidExcess")); + this.runningCost = aNBT.getInteger("runningCost"); + this.locked = aNBT.getBoolean("lockFluid"); + this.fluidSelector = aNBT.getByte("fluidSelector"); + + NBTTagCompound fluidNBT = (NBTTagCompound) aNBT.getTag("STORE"); + for (int i = 0; i < MAX_DISTINCT_FLUIDS; i++) { + STORE[i].readFromNBT(fluidNBT, String.valueOf(i)); + } + + super.loadNBTData(aNBT); + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public int getMaxEfficiency(ItemStack stack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack stack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack stack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack stack) { + return false; + } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + this.setDoVoidExcess(!doVoidExcess); + GT_Utility.sendChatToPlayer(aPlayer, "Auto-voiding " + (this.doVoidExcess ? "enabled" : "disabled")); + } + + private boolean addMultiHatchToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity != null) { + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity instanceof GTMTE_TFFTHatch) { + if (this.tfftHatch != null) return false; + this.tfftHatch = (GTMTE_TFFTHatch) aMetaTileEntity; + this.tfftHatch.updateTexture(aBaseCasingIndex); + return true; + } + } + return false; + } + + public int pull(FluidStack aFluid, boolean doPull) { + if (locked) return 0; + int index = getFluidPosition(aFluid); + if (index >= 0) { + return STORE[index].fill(aFluid, doPull); + } else if (fluidCount() < MAX_DISTINCT_FLUIDS) { + return STORE[getNullSlot()].setCapacity(capacityPerFluid).fill(aFluid, doPull); + } + return 0; + } + + public long pull(FluidStack aFluid, long amount, boolean doPull) { + if (locked) return 0; + int index = getFluidPosition(aFluid); + if (index >= 0) { + FluidTankGT tank = STORE[index]; + if (doPull) return tank.add(amount); + return doVoidExcess + ? amount + : tank.amount() + amount > tank.capacity() ? tank.capacity() - tank.amount() : amount; + } else if (fluidCount() < MAX_DISTINCT_FLUIDS) { + FluidTankGT tank = STORE[getNullSlot()]; + if (doPull) return tank.add(amount, aFluid); + return doVoidExcess ? amount : Math.min(amount, tank.capacity()); + } + return 0; + } + + public FluidStack push(FluidStack aFluid, boolean doPush) { + if (locked) return null; + int index = getFluidPosition(aFluid); + if (index < 0) return null; + return STORE[index].drain(aFluid.amount, doPush); + } + + public FluidStack push(int amount, boolean doPush) { + if (locked) return null; + int index = firstNotNullSlot(); + if (index < 0) return null; + return STORE[index].drain(amount, doPush); + } + + public long push(FluidStack aFluid, long amount, boolean doPush) { + if (locked) return 0; + int index = getFluidPosition(aFluid); + if (index < 0) return 0; + if (doPush) return STORE[index].remove(amount); + return STORE[index].amount(amount); + } + + public long getCapacityPerFluid() { + return this.capacityPerFluid; + } + + public void setCapacity(BigInteger capacity) { + if (capacity.compareTo(MAX_CAPACITY) > 0) { + this.capacity = MAX_CAPACITY; + this.capacityPerFluid = Long.MAX_VALUE; + } else { + this.capacity = capacity; + this.capacityPerFluid = + capacity.divide(BigInteger.valueOf(MAX_DISTINCT_FLUIDS)).longValue(); + } + + for (int i = 0; i < MAX_DISTINCT_FLUIDS; i++) { + FluidTankGT tank = STORE[i]; + if (tank.setCapacity(capacityPerFluid).amount() > capacityPerFluid) { + STORE[i] = new FluidTankGT(tank.get(), capacityPerFluid, capacityPerFluid); + } + } + } + + public int fluidCount() { + int tCount = 0; + for (int i = 0; i < MAX_DISTINCT_FLUIDS; i++) { + if (!STORE[i].isEmpty()) tCount++; + } + return tCount; + } + + public int getFluidPosition(String fluidName) { + for (int i = 0; i < MAX_DISTINCT_FLUIDS; i++) { + if (!STORE[i].isEmpty() && STORE[i].name().equals(fluidName)) return i; + } + return -1; + } + + public int getFluidPosition(FluidStack aFluid) { + for (int i = 0; i < MAX_DISTINCT_FLUIDS; i++) { + if (STORE[i].contains(aFluid)) return i; + } + return -1; + } + + public int getNullSlot() { + for (int i = 0; i < MAX_DISTINCT_FLUIDS; i++) { + if (STORE[i].isEmpty()) return i; + } + return -1; + } + + public boolean contains(String fluidName) { + return getFluidPosition(fluidName) >= 0; + } + + public boolean contains(FluidStack aFluid) { + return getFluidPosition(aFluid) >= 0; + } + + public int firstNotNullSlot() { + for (int i = 0; i < MAX_DISTINCT_FLUIDS; i++) { + if (!STORE[i].isEmpty()) return i; + } + return -1; + } + + public FluidTankGT firstNotNull() { + for (int i = 0; i < MAX_DISTINCT_FLUIDS; i++) { + if (!STORE[i].isEmpty()) return STORE[i]; + } + return null; + } + + public BigInteger getStoredAmount() { + BigInteger amount = BigInteger.ZERO; + for (int i = 0; i < MAX_DISTINCT_FLUIDS; i++) { + amount = amount.add(BigInteger.valueOf(STORE[i].amount())); + } + return amount; + } + + public byte getFluidSelector() { + return fluidSelector; + } + + public FluidTankGT getSelectedFluid() { + return fluidSelector != -1 ? STORE[fluidSelector] : null; + } + + public void setDoVoidExcess(boolean doVoidExcess) { + this.doVoidExcess = doVoidExcess; + for (int i = 0; i < MAX_DISTINCT_FLUIDS; i++) { + STORE[i].setVoidExcess(doVoidExcess); + } + } + + public FluidTankInfo[] getTankInfo() { + FluidTankInfo[] info = new FluidTankInfo[MAX_DISTINCT_FLUIDS]; + for (int i = 0; i < MAX_DISTINCT_FLUIDS; i++) { + STORE[i].getFluid(); // + info[i] = STORE[i].getInfo(); + } + return info; + } +} diff --git a/src/main/java/common/tileentities/GTMTE_TFFTHatch.java b/src/main/java/common/tileentities/GTMTE_TFFTHatch.java new file mode 100644 index 0000000000..bf79bb877e --- /dev/null +++ b/src/main/java/common/tileentities/GTMTE_TFFTHatch.java @@ -0,0 +1,268 @@ +package common.tileentities; + +import appeng.api.AEApi; +import appeng.api.config.AccessRestriction; +import appeng.api.config.Actionable; +import appeng.api.networking.security.BaseActionSource; +import appeng.api.storage.*; +import appeng.api.storage.data.IAEFluidStack; +import appeng.api.storage.data.IItemList; +import appeng.util.item.AEFluidStack; +import appeng.util.item.FluidList; +import cpw.mods.fml.common.Optional; +import gregtech.api.enums.Textures; +import gregtech.api.fluid.FluidTankGT; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.BaseMetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.render.TextureFactory; +import java.util.HashMap; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; + +@Optional.Interface(iface = "appeng.api.storage.IMEMonitor", modid = "appliedenergistics2", striprefs = true) +public class GTMTE_TFFTHatch extends GT_MetaTileEntity_Hatch implements IMEMonitor<IAEFluidStack> { + + @Optional.Interface( + iface = "appeng.api.storage.IExternalStorageHandler", + modid = "appliedenergistics2", + striprefs = true) + private static class AE2TFFTHatchHandler implements IExternalStorageHandler { + + @Override + @Optional.Method(modid = "appliedenergistics2") + public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc) { + return channel == StorageChannel.FLUIDS + && te instanceof BaseMetaTileEntity + && ((BaseMetaTileEntity) te).getMetaTileEntity() instanceof GTMTE_TFFTHatch; + } + + @Override + @Optional.Method(modid = "appliedenergistics2") + public IMEInventory getInventory( + TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src) { + if (channel == StorageChannel.FLUIDS) { + return ((GTMTE_TFFTHatch) (((BaseMetaTileEntity) te).getMetaTileEntity())); + } + return null; + } + } + + private static final Textures.BlockIcons.CustomIcon TEXTURE_TFFT_HATCH = + new Textures.BlockIcons.CustomIcon("iconsets/TFFT_HATCH"); + + private HashMap<IMEMonitorHandlerReceiver<IAEFluidStack>, Object> listeners = new HashMap<>(); + private GTMTE_TFFT controller; + + public GTMTE_TFFTHatch(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional, 3, 0, "All-in-one access for the T.F.F.T"); + } + + public GTMTE_TFFTHatch(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 0, aDescription, aTextures); + } + + @Override + public boolean isFacingValid(byte aFacing) { + return true; + } + + @Override + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + return super.getTexture(aBaseMetaTileEntity, aSide, aFacing, aColorIndex, aActive, aRedstone); + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[] { + aBaseTexture, + TextureFactory.of(Textures.BlockIcons.OVERLAY_PIPE_IN), + TextureFactory.builder().addIcon(TEXTURE_TFFT_HATCH).extFacing().build() + }; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[] { + aBaseTexture, + TextureFactory.of(Textures.BlockIcons.OVERLAY_PIPE_IN), + TextureFactory.builder().addIcon(TEXTURE_TFFT_HATCH).extFacing().build() + }; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GTMTE_TFFTHatch(mName, mTier, mDescriptionArray, mTextures); + } + + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { + return (controller != null) ? controller.pull(resource, doFill) : 0; + } + + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { + if (controller != null) { + final FluidTankGT sFluid = controller.getSelectedFluid(); + if (controller.getFluidSelector() == -1 || (sFluid != null && sFluid.contains(resource))) { + return controller.push(resource, doDrain); + } + } + return null; + } + + @Override + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { + if (controller != null) { + final FluidTankGT sFluid = controller.getSelectedFluid(); + if (controller.getFluidSelector() == -1) return controller.push(maxDrain, doDrain); + if (sFluid != null) return controller.push(sFluid.get(maxDrain), doDrain); + } + return null; + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection from) { + return (controller != null) ? controller.getTankInfo() : null; + } + + public void bind(GTMTE_TFFT controller) { + this.controller = controller; + } + + public void unbind() { + this.controller = null; + } + + @Optional.Method(modid = "appliedenergistics2") + public static void registerAEIntegration() { + AEApi.instance().registries().externalStorage().addExternalStorageInterface(new AE2TFFTHatchHandler()); + } + + @Override + @Optional.Method(modid = "appliedenergistics2") + public IItemList<IAEFluidStack> getAvailableItems(IItemList out) { + if (controller != null) { + for (int i = 0; i < GTMTE_TFFT.MAX_DISTINCT_FLUIDS; i++) { + if (!controller.STORE[i].isEmpty()) { + IAEFluidStack s = AEFluidStack.create(controller.STORE[i].get()); + s.setStackSize(controller.STORE[i].amount()); + out.add(s); + } + } + } + return out; + } + + @Override + @Optional.Method(modid = "appliedenergistics2") + public IItemList<IAEFluidStack> getStorageList() { + IItemList<IAEFluidStack> fluidList = new FluidList(); + if (controller != null) { + for (int i = 0; i < GTMTE_TFFT.MAX_DISTINCT_FLUIDS; i++) { + if (!controller.STORE[i].isEmpty()) { + IAEFluidStack s = AEFluidStack.create(controller.STORE[i].get()); + s.setStackSize(controller.STORE[i].amount()); + fluidList.add(s); + } + } + } + return fluidList; + } + + @Override + @Optional.Method(modid = "appliedenergistics2") + public void addListener(IMEMonitorHandlerReceiver<IAEFluidStack> l, Object verificationToken) { + if (listeners == null) listeners = new HashMap<>(); + listeners.put(l, verificationToken); + } + + @Override + @Optional.Method(modid = "appliedenergistics2") + public void removeListener(IMEMonitorHandlerReceiver<IAEFluidStack> l) { + if (listeners == null) listeners = new HashMap<>(); + listeners.remove(l); + } + + @Override + @Optional.Method(modid = "appliedenergistics2") + public AccessRestriction getAccess() { + return AccessRestriction.READ_WRITE; + } + + @Override + @Optional.Method(modid = "appliedenergistics2") + public boolean isPrioritized(IAEFluidStack input) { + if (controller == null || input == null) return false; + return controller.contains(input.getFluidStack()) || controller.fluidCount() < GTMTE_TFFT.MAX_DISTINCT_FLUIDS; + } + + @Override + @Optional.Method(modid = "appliedenergistics2") + public boolean canAccept(IAEFluidStack input) { + if (controller == null || input == null) return false; + return controller.contains(input.getFluidStack()) || controller.fluidCount() < GTMTE_TFFT.MAX_DISTINCT_FLUIDS; + } + + @Override + @Optional.Method(modid = "appliedenergistics2") + public int getPriority() { + return 0; + } + + @Override + @Optional.Method(modid = "appliedenergistics2") + public int getSlot() { + return 0; + } + + @Override + @Optional.Method(modid = "appliedenergistics2") + public boolean validForPass(int i) { + return true; + } + + @Override + @Optional.Method(modid = "appliedenergistics2") + public IAEFluidStack injectItems(IAEFluidStack input, Actionable mode, BaseActionSource src) { + final FluidStack inputStack = input.getFluidStack(); + if (inputStack == null) return null; + if (controller == null || getBaseMetaTileEntity() == null) return input; + if (mode != Actionable.SIMULATE) getBaseMetaTileEntity().markDirty(); + long amount = controller.pull(input.getFluidStack(), input.getStackSize(), mode != Actionable.SIMULATE); + if (amount == 0) return input; + if (amount == input.getStackSize()) return null; + IAEFluidStack result = AEFluidStack.create(input.getFluidStack()); + result.setStackSize(input.getStackSize() - amount); + return result; + } + + @Override + @Optional.Method(modid = "appliedenergistics2") + public IAEFluidStack extractItems(IAEFluidStack request, Actionable mode, BaseActionSource src) { + if (controller == null || getBaseMetaTileEntity() == null) return null; + if (mode != Actionable.SIMULATE) getBaseMetaTileEntity().markDirty(); + long amount = controller.push(request.getFluidStack(), request.getStackSize(), mode != Actionable.SIMULATE); + if (amount == 0) return null; + if (amount == request.getStackSize()) return request.copy(); + IAEFluidStack result = AEFluidStack.create(request.getFluidStack()); + result.setStackSize(amount); + return result; + } + + @Override + @Optional.Method(modid = "appliedenergistics2") + public StorageChannel getChannel() { + return StorageChannel.FLUIDS; + } +} diff --git a/src/main/java/common/tileentities/GTMTE_TFFTMultiHatch.java b/src/main/java/common/tileentities/GTMTE_TFFTMultiHatch.java deleted file mode 100644 index 8c992f8cb0..0000000000 --- a/src/main/java/common/tileentities/GTMTE_TFFTMultiHatch.java +++ /dev/null @@ -1,217 +0,0 @@ -package common.tileentities; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; -import java.util.HashMap; -import kekztech.MultiFluidHandler; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; - -public class GTMTE_TFFTMultiHatch extends GT_MetaTileEntity_Hatch { - - private static final HashMap<Integer, Integer> vals = new HashMap<>(); - - static { - vals.put(3, 2000); - vals.put(5, 20000); - vals.put(7, 200000); - } - - private static final int INV_SLOT_COUNT = 2; - - private MultiFluidHandler mfh; - private boolean outputting = false; - - public GTMTE_TFFTMultiHatch(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, INV_SLOT_COUNT, new String[] { - "All-in-one access for the T.F.F.T", - "Right-click with a screwdriver to toggle auto-output", - "Throughput: " + vals.get(aTier) + "L/s per fluid" - }); - } - - public GTMTE_TFFTMultiHatch(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, INV_SLOT_COUNT, aDescription, aTextures); - } - - public GTMTE_TFFTMultiHatch(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, INV_SLOT_COUNT, aDescription, aTextures); - } - - public void setMultiFluidHandler(MultiFluidHandler mfh) { - this.mfh = mfh; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setBoolean("outputting", outputting); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - outputting = aNBT.getBoolean("outputting"); - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - // return new ITexture[]{aBaseTexture, new GT_RenderedTexture(GTTexture.MULTI_HATCH_ON)}; - return new ITexture[] {aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_PIPE_STEEL)}; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - // return new ITexture[]{aBaseTexture, new GT_RenderedTexture(GTTexture.MULTI_HATCH_OFF)}; - return new ITexture[] { - aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_PIPE_POLYTETRAFLUOROETHYLENE) - }; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { - return new GTMTE_TFFTMultiHatch(super.mName, super.mTier, super.mDescriptionArray, super.mTextures); - } - - @Override - public boolean isMachineBlockUpdateRecursive() { - return false; - } - - @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - outputting = !outputting; - GT_Utility.sendChatToPlayer(aPlayer, outputting ? "Auto-output enabled" : "Auto-output disabled"); - } - - @Override - public int getCapacity() { - return (mfh != null) ? mfh.getCapacity() : 0; - } - - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPreTick(aBaseMetaTileEntity, aTick); - if (aBaseMetaTileEntity.isServerSide() && mfh != null) { - if (outputting && (aTick % 20 == 0)) { - doAutoOutputPerSecond(aBaseMetaTileEntity); - } - } - } - - /** - * Handle the Multi Hatch's auto-output feature. Should be called once per second only. - * @param aBaseMetaTileEntity - * this MetaTileEntity - */ - private void doAutoOutputPerSecond(IGregTechTileEntity aBaseMetaTileEntity) { - final ForgeDirection outSide = ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()); - final TileEntity adjacentTE = - aBaseMetaTileEntity.getTileEntityOffset(outSide.offsetX, outSide.offsetY, outSide.offsetZ); - if (adjacentTE instanceof IFluidHandler) { - final IFluidHandler adjFH = (IFluidHandler) adjacentTE; - // Cycle through fluids - for (int i = 0; i < mfh.getDistinctFluids(); i++) { - final FluidStack fluidCopy = mfh.getFluidCopy(i); - // Make sure the adjacent IFluidHandler can accept this fluid - if (adjFH.canFill(outSide.getOpposite(), fluidCopy.getFluid())) { - - // Limit to output rate - fluidCopy.amount = Math.min(fluidCopy.amount, vals.get(super.mTier)); - - // Test how much can be drawn - fluidCopy.amount = mfh.pullFluid(fluidCopy, false); - - // Test how much can be filled (and fill if possible) - fluidCopy.amount = adjFH.fill(outSide.getOpposite(), fluidCopy, true); - - // Actually deplete storage - mfh.pullFluid(fluidCopy, true); - } - } - } - } - - @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { - return (mfh != null) ? mfh.pushFluid(resource, doFill) : 0; - } - - @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - return (mfh != null) ? new FluidStack(resource.getFluid(), mfh.pullFluid(resource, doDrain)) : null; - } - - /** - * Drains fluid out of 0th internal tank. - * If the TFFT Controller contains an Integrated Circuit, drain fluid - * from the slot equal to the circuit configuration. - * - * @param from - * Orientation the fluid is drained to. - * @param maxDrain - * Maximum amount of fluid to drain. - * @param doDrain - * If false, drain will only be simulated. - * @return FluidStack representing the Fluid and amount that was (or would have been, if - * simulated) drained. - */ - @Override - public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - if (mfh != null) { - final FluidStack drain = mfh.getFluidCopy(0); - if (drain != null) { - // If there's no integrated circuit in the T.F.F.T. controller, output slot 0 - final byte selectedSlot = (mfh.getSelectedFluid() == -1) ? 0 : mfh.getSelectedFluid(); - - return new FluidStack( - drain.getFluid(), - mfh.pullFluid(new FluidStack(drain.getFluid(), maxDrain), selectedSlot, doDrain)); - } - } - return null; - } - - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) { - if (mfh == null) return null; - FluidStack[] fluids = mfh.getAllFluids(); - int length = fluids.length; - int maxCapcity = mfh.getCapacity(); - FluidTankInfo[] tankInfo = new FluidTankInfo[length]; - for (int i = 0; i < length; i++) { - tankInfo[i] = new FluidTankInfo(fluids[i], maxCapcity); - } - return tankInfo; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; - } - - @Override - public boolean canTankBeFilled() { - return true; - } - - @Override - public boolean canTankBeEmptied() { - return true; - } -} diff --git a/src/main/java/common/tileentities/TE_TFFTMultiHatch.java b/src/main/java/common/tileentities/TE_TFFTMultiHatch.java deleted file mode 100644 index 2e55e600d3..0000000000 --- a/src/main/java/common/tileentities/TE_TFFTMultiHatch.java +++ /dev/null @@ -1,112 +0,0 @@ -package common.tileentities; - -import kekztech.MultiFluidHandler; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; - -@Deprecated -public class TE_TFFTMultiHatch extends TileEntity implements IFluidHandler { - - public static final int BASE_OUTPUT_PER_SECOND = 2000; // L/s - - private byte facings = 0x0; - - private MultiFluidHandler mfh; - private int tickCounter = 0; - private boolean autoOutput = false; - - public boolean hasFacingOnSide(byte side) { - final byte key = (byte) Math.pow(0x2, side); - return (facings & key) == key; - } - - public void setFacingToSide(byte side) { - facings = (byte) Math.pow(0x2, side); - } - - public void setMultiFluidHandler(MultiFluidHandler mfh) { - this.mfh = mfh; - } - - public void toggleAutoOutput() { - autoOutput = !autoOutput; - } - - public boolean isOutputting() { - return autoOutput; - } - - @Override - public void updateEntity() { - // Removed deprecated code - } - - @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { - // Removed deprecated code - return 0; - } - - @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - // Removed deprecated code - return null; - } - - /** - * Drains fluid out of 0th internal tank. - * If the TFFT Controller contains an Integrated Circuit, drain fluid - * from the slot equal to the circuit configuration. - * - * @param from - * Orientation the fluid is drained to. - * @param maxDrain - * Maximum amount of fluid to drain. - * @param doDrain - * If false, drain will only be simulated. - * @return FluidStack representing the Fluid and amount that was (or would have been, if - * simulated) drained. - */ - @Override - public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - // Removed deprecated code - return null; - } - - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) { - // Removed deprecated code - return false; - } - - @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) { - // Removed deprecated code - return false; - } - - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) { - // Removed deprecated code - return null; - } - - @Override - public void writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(nbt); - nbt.setBoolean("autoOutput", autoOutput); - nbt.setByte("facings", facings); - } - - @Override - public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(nbt); - autoOutput = nbt.getBoolean("autoOutput"); - facings = nbt.getByte("facings"); - } -} diff --git a/src/main/java/kekztech/MultiFluidHandler.java b/src/main/java/kekztech/MultiFluidHandler.java deleted file mode 100644 index 232931b6fc..0000000000 --- a/src/main/java/kekztech/MultiFluidHandler.java +++ /dev/null @@ -1,397 +0,0 @@ -package kekztech; - -import java.util.ArrayList; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.fluids.FluidStack; - -public class MultiFluidHandler { - - private final FluidStack[] fluids; - private final int maxDistinctFluids; - private final int capacityPerFluid; - - private boolean locked = true; - private boolean doVoidExcess = false; - private byte fluidSelector = -1; - - public MultiFluidHandler(int maxDistinctFluids, int capacityPerFluid, FluidStack[] fluidsToAdd) { - this.maxDistinctFluids = maxDistinctFluids; - this.fluids = new FluidStack[maxDistinctFluids]; - if (fluidsToAdd != null) { - int tFluidLengt = (maxDistinctFluids < fluidsToAdd.length) ? maxDistinctFluids : fluidsToAdd.length; - for (int i = 0; i < tFluidLengt; i++) { - this.fluids[i] = fluidsToAdd[i]; - } - } - this.capacityPerFluid = capacityPerFluid; - } - - /** - * Initialize a new MultiFluidHandler object with the given parameters - * @param maxDistinctFluids - * How many different fluids can be stored - * @param capacityPerFluid - * How much capacity each fluid should have - * @param fluidsToAdd - * Fluids to add immediately - * @return - * A new instance - */ - public static MultiFluidHandler newInstance( - int maxDistinctFluids, int capacityPerFluid, FluidStack... fluidsToAdd) { - return new MultiFluidHandler(maxDistinctFluids, capacityPerFluid, fluidsToAdd); - } - - /** - * Deep copy a MultiFluidHandler instance with a new capacity - * @param toCopy - * The MultiFluidHandler that should be copied - * @param capacityPerFluid - * How much capacity each fluid should have - * @return - * A new instance - */ - public static MultiFluidHandler newAdjustedInstance(MultiFluidHandler toCopy, int capacityPerFluid) { - return new MultiFluidHandler(toCopy.maxDistinctFluids, capacityPerFluid, toCopy.fluids); - } - - /** - * Lock internal tanks in case T.F.F.T is not running. - * - * @param state - * Lock state. - */ - public void setLock(boolean state) { - locked = state; - } - - public void setDoVoidExcess(boolean doVoidExcess) { - this.doVoidExcess = doVoidExcess; - } - - /** - * Used to tell the MFH if a fluid is selected by - * an Integrated Circuit in the controller. - * If the Integrate Circuit configuration exceeds - * the number of stored fluid, the configuration will be ignored. - * - * @param fluidSelector - * Selected fluid or -1 if no fluid is selected - */ - public void setFluidSelector(byte fluidSelector) { - this.fluidSelector = fluidSelector < fluids.length ? fluidSelector : -1; - } - - /** - * - * @return - * Selected fluid or -1 if no fluid is selected - */ - public byte getSelectedFluid() { - return fluidSelector; - } - - public FluidStack[] getAllFluids() { - return fluids; - } - - public int getFluidPosistion(FluidStack aFluid) { - - for (int i = 0; i < fluids.length; i++) { - FluidStack tFluid = fluids[i]; - if (tFluid != null && tFluid.isFluidEqual(aFluid)) return i; - } - return -1; - } - - public boolean contains(FluidStack aFluid) { - if (locked) return false; - return getFluidPosistion(aFluid) >= 0; - } - - public int countFluids() { - int tCount = 0; - for (int i = 0; i < fluids.length; i++) { - if (fluids[i] != null) tCount++; - } - return tCount; - } - - public int getCapacity() { - return capacityPerFluid; - } - - public int getMaxDistinctFluids() { - return maxDistinctFluids; - } - - /** - * Returns a deep copy of the the FluidStack in the requested slot - * @param slot - * requested slot - * @return - * deep copy of the requested FluidStack - */ - public FluidStack getFluidCopy(int slot) { - if (slot >= fluids.length) return null; - if (!locked && fluids.length > 0 && slot >= 0 && slot < maxDistinctFluids) { - FluidStack tFluid = fluids[slot]; - if (tFluid != null) return tFluid.copy(); - } - return null; - } - - /** - * Returns the amount of different fluids currently stored. - * @return - * amount of different fluids currently stored (0-25) - */ - public int getDistinctFluids() { - int distinctFluids = 0; - for (FluidStack f : fluids) { - if (f != null) distinctFluids++; - } - return distinctFluids; - } - - /** - * Helper method to save a MultiFluidHandler to NBT data - * @param nbt - * The NBT Tag to write to - * @return - * Updated NBT Tag - */ - public NBTTagCompound saveNBTData(NBTTagCompound nbt) { - nbt = (nbt == null) ? new NBTTagCompound() : nbt; - - nbt.setInteger("capacityPerFluid", getCapacity()); - nbt.setInteger("maxDistinctFluids", this.maxDistinctFluids); - int c = 0; - for (FluidStack f : fluids) { - if (f == null) { - c++; - continue; - } - nbt.setTag(String.valueOf(c), f.writeToNBT(new NBTTagCompound())); - c++; - } - return nbt; - } - - /** - * Helper method to initialize a MultiFluidHandler from NBT data - * @param nbt - * The NBT Tag to read from - * @return - * A new Instance - */ - public static MultiFluidHandler loadNBTData(NBTTagCompound nbt) { - nbt = (nbt == null) ? new NBTTagCompound() : nbt; - - final int capacityPerFluid = nbt.getInteger("capacityPerFluid"); - final NBTTagCompound fluidsTag = (NBTTagCompound) nbt.getTag("fluids"); - int distinctFluids = nbt.getInteger("maxDistinctFluids"); - if (!nbt.hasKey("maxDistinctFluids")) distinctFluids = 25; // adding it so it doesent break on upgrading - final FluidStack[] loadedFluids = new FluidStack[distinctFluids]; - - if (fluidsTag != null) { - for (int i = 0; i < distinctFluids; i++) { - final NBTTagCompound fluidNBT = (NBTTagCompound) fluidsTag.getTag("" + i); - if (fluidNBT == null) { - loadedFluids[i] = null; - } else { - loadedFluids[i] = FluidStack.loadFluidStackFromNBT(fluidNBT); - } - } - } - return new MultiFluidHandler(distinctFluids, capacityPerFluid, loadedFluids); - } - - public ArrayList<String> getInfoData() { - final ArrayList<String> lines = new ArrayList<>(fluids.length); - lines.add(EnumChatFormatting.YELLOW + "Stored Fluids:" + EnumChatFormatting.RESET); - for (int i = 0; i < fluids.length; i++) { - FluidStack tFluid = fluids[i]; - if (tFluid == null) { - lines.add(i + " - " + "null" + ": " + "0" + "L (" + "0" + "%)"); - } else { - lines.add(i + " - " + tFluid.getLocalizedName() + ": " - + tFluid.amount + "L (" - + (Math.round(100.0f * tFluid.amount / getCapacity())) + "%)"); - } - } - - return lines; - } - - /** - * Fill fluid into a tank. - * - * @param push - * Fluid type and quantity to be inserted. - * @param doPush - * If false, fill will only be simulated. - * @return Amount of fluid that was (or would have been, if simulated) filled. - */ - public int pushFluid(FluidStack push, boolean doPush) { - if (locked) { - return 0; - } - int empty = getNullSlot(); - int fluidCount = countFluids(); - if (fluidCount >= maxDistinctFluids && !contains(push)) { - // Already contains 25 fluids and this isn't one of them - return 0; - } else if (empty < maxDistinctFluids && !contains(push)) { - // Add new fluid - final int fit = Math.min(getCapacity(), push.amount); - if (doPush) { - if (empty == -1) return 0; - else fluids[empty] = new FluidStack(push.getFluid(), fit); - } - // If doVoidExcess, pretend all of it fit - return doVoidExcess ? push.amount : fit; - } else { - // Add to existing fluids - int index = getFluidPosistion(push); - if (index < 0) return 0; - final FluidStack existing = fluids[index]; - final int fit = Math.min(getCapacity() - existing.amount, push.amount); - if (doPush) { - existing.amount += fit; - } - // If doVoidExcess, pretend all of it fit - return doVoidExcess ? push.amount : fit; - } - } - - public int getNullSlot() { - for (int i = 0; i < fluids.length; i++) { - if (fluids[i] == null) return i; - } - return -1; - } - - /** - * Fill fluid into the specified tank. - * - * @param push - * Fluid type and quantity to be inserted. - * @param slot - * Tank the fluid should go into. - * @param doPush - * If false, fill will only be simulated. - * @return Amount of fluid that was (or would have been, if simulated) filled. - */ - public int pushFluid(FluidStack push, int slot, boolean doPush) { - if (locked) { - return 0; - } - FluidStack tFluid = fluids[slot]; - if (slot < 0 || slot >= maxDistinctFluids) { - // Invalid slot - return 0; - } - if ((tFluid != null) && !tFluid.equals(push)) { - // Selected slot is taken by a non-matching fluid - return 0; - } else { - int fit = 0; - // Add to existing fluid - if (tFluid == null) { - fit = Math.min(getCapacity(), push.amount); - fluids[slot] = new FluidStack(push.getFluid(), fit); - } else { - fit = Math.min(getCapacity() - tFluid.amount, push.amount); - if (doPush) { - tFluid.amount += fit; - } - } - // If doVoidExcess, pretend all of it fit - return doVoidExcess ? push.amount : fit; - } - } - - /** - * Drains fluid out of the internal tanks. - * - * @param pull - * Fluid type and quantity to be pulled. - * @param doPull - * If false, drain will only be simulated. - * @return Amount of fluid that was (or would have been, if simulated) pulled. - */ - public int pullFluid(FluidStack pull, boolean doPull) { - if (locked) { - return 0; - } else { - int tIndex = getFluidPosistion(pull); - if (tIndex < 0) return 0; - FluidStack src = fluids[tIndex]; - final int rec = Math.min(pull.amount, src.amount); - if (doPull) { - src.amount -= rec; - } - if (src.amount == 0) { - fluids[tIndex] = null; - } - return rec; - } - } - - /** - * Drains fluid out of the specified internal tank. - * - * @param pull - * Fluid type and quantity to be pulled. - * @param slot - * Tank fluid should be drained from. - * @param doPull - * If false, drain will only be simulated. - * @return Amount of fluid that was (or would have been, if simulated) pulled. - */ - public int pullFluid(FluidStack pull, int slot, boolean doPull) { - if (locked || slot >= fluids.length) { - return 0; - } - if (slot < 0 || slot >= maxDistinctFluids) { - return 0; - } - FluidStack tFluid = fluids[slot]; - if (tFluid == null || !tFluid.equals(pull)) { - return 0; - } else { - final int rec = Math.min(pull.amount, tFluid.amount); - if (doPull) { - tFluid.amount -= rec; - } - if (tFluid.amount == 0) { - fluids[slot] = null; - } - return rec; - } - } - - /** - * Test whether the given fluid type and quantity can be inserted into the internal tanks. - * @param push - * Fluid type and quantity to be tested - * @return True if there is sufficient space - */ - public boolean couldPush(FluidStack push) { - if (locked) { - return false; - } - int tFluidIndex = getFluidPosistion(push); - int fluidCount = countFluids(); - if (fluidCount >= maxDistinctFluids && !contains(push)) { - return false; - } else if (fluidCount < maxDistinctFluids && !contains(push)) { - return Math.min(getCapacity(), push.amount) > 0; - } else { - final int remcap = getCapacity() - fluids[tFluidIndex].amount; - return doVoidExcess || (Math.min(remcap, push.amount) > 0); - } - } -} diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT.png Binary files differnew file mode 100644 index 0000000000..f00e6d571f --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT_ACTIVE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT_ACTIVE.png Binary files differnew file mode 100644 index 0000000000..69cea70d75 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT_ACTIVE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT_ACTIVE.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT_ACTIVE.png.mcmeta new file mode 100644 index 0000000000..3de4a0bdd8 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT_ACTIVE.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 8 + } +} diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT_ACTIVE_GLOW.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT_ACTIVE_GLOW.png Binary files differnew file mode 100644 index 0000000000..30557c19a1 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT_ACTIVE_GLOW.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT_ACTIVE_GLOW.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT_ACTIVE_GLOW.png.mcmeta new file mode 100644 index 0000000000..f16b74ddb1 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT_ACTIVE_GLOW.png.mcmeta @@ -0,0 +1,6 @@ +{ + "animation": { + "frametime": 8 + } +} + diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT_HATCH.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT_HATCH.png Binary files differnew file mode 100644 index 0000000000..ea3a35a5f0 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/TFFT_HATCH.png diff --git a/src/main/resources/assets/kekztech/lang/en_US.lang b/src/main/resources/assets/kekztech/lang/en_US.lang index 13fc831a0c..0e0245ae8e 100644 --- a/src/main/resources/assets/kekztech/lang/en_US.lang +++ b/src/main/resources/assets/kekztech/lang/en_US.lang @@ -110,17 +110,18 @@ item.kekztech_crafting_item.14.name=YSZ Ceramic Plate item.kekztech_crafting_item.15.name=GDC Ceramic Plate # -------- TFFT: Structure Blocks -tile.kekztech_tfftcasingblock_block.name=T.F.F.T Casing -tile.kekztech_tfftstoragefieldblock1_block.name=T.F.F.T Storage Field Block (Tier I) -tile.kekztech_tfftstoragefieldblock1_block.0.desc=This is not a fluid tank -tile.kekztech_tfftstoragefieldblock2_block.name=T.F.F.T Storage Field Block (Tier II) -tile.kekztech_tfftstoragefieldblock3_block.name=T.F.F.T Storage Field Block (Tier III) -tile.kekztech_tfftstoragefieldblock4_block.name=T.F.F.T Storage Field Block (Tier IV) -tile.kekztech_tfftstoragefieldblock5_block.name=T.F.F.T Storage Field Block (Tier V) -tile.kekztech_tfftmultihatch_block.0.name=[DEPRECATED] T.F.F.T Multi-Fluid I/O Hatch (Tier I) -tile.kekztech_tfftmultihatch_block.1.name=[DEPRECATED] T.F.F.T Multi-Fluid I/O Hatch (Tier II) -tile.kekztech_tfftmultihatch_block.2.name=[DEPRECATED] T.F.F.T Multi-Fluid I/O Hatch (Tier III) -tile.kekztech_tfftmultihatch_block.0.desc=Put in crafting field to change to update +tile.kekztech_tfftstoragefield_block.0.name=T.F.F.T Casing +tile.kekztech_tfftstoragefield_block.1.name=T.F.F.T Storage Field Block (Tier I) +tile.kekztech_tfftstoragefield_block.2.name=T.F.F.T Storage Field Block (Tier II) +tile.kekztech_tfftstoragefield_block.3.name=T.F.F.T Storage Field Block (Tier III) +tile.kekztech_tfftstoragefield_block.4.name=T.F.F.T Storage Field Block (Tier IV) +tile.kekztech_tfftstoragefield_block.5.name=T.F.F.T Storage Field Block (Tier V) +tile.kekztech_tfftstoragefield_block.6.name=T.F.F.T Storage Field Block (Tier VI) +tile.kekztech_tfftstoragefield_block.7.name=T.F.F.T Storage Field Block (Tier VII) +tile.kekztech_tfftstoragefield_block.8.name=T.F.F.T Storage Field Block (Tier VIII) +tile.kekztech_tfftstoragefield_block.9.name=T.F.F.T Storage Field Block (Tier IX) +tile.kekztech_tfftstoragefield_block.10.name=T.F.F.T Storage Field Block (Tier X) +tile.kekztech_tfftstoragefield_block.desc=This is not a fluid tank # -------- Item Proxy: Structure Blocks tile.kekztech_itemproxycable_block.name=Item Proxy Network Cable diff --git a/src/main/resources/assets/kekztech/lang/zh_CN.lang b/src/main/resources/assets/kekztech/lang/zh_CN.lang index cfc135b863..d7ec936c48 100644 --- a/src/main/resources/assets/kekztech/lang/zh_CN.lang +++ b/src/main/resources/assets/kekztech/lang/zh_CN.lang @@ -110,17 +110,18 @@ item.kekztech_crafting_item.14.name=钇锆陶瓷板 item.kekztech_crafting_item.15.name=钆铈陶瓷板 # -------- TFFT: Structure Blocks -tile.kekztech_tfftcasingblock_block.name=T.F.F.T机械方块 -tile.kekztech_tfftstoragefieldblock1_block.name=T.F.F.T存储库方块(T1) -tile.kekztech_tfftstoragefieldblock1_block.0.desc=这不是流体储罐 -tile.kekztech_tfftstoragefieldblock2_block.name=T.F.F.T存储库方块(T2) -tile.kekztech_tfftstoragefieldblock3_block.name=T.F.F.T存储库方块(T3) -tile.kekztech_tfftstoragefieldblock4_block.name=T.F.F.T存储库方块(T4) -tile.kekztech_tfftstoragefieldblock5_block.name=T.F.F.T存储库方块(T5) -tile.kekztech_tfftmultihatch_block.0.name=[已弃用]T.F.F.T输入/输出仓(Tier I) -tile.kekztech_tfftmultihatch_block.1.name=[已弃用]T.F.F.T输入/输出仓(Tier II) -tile.kekztech_tfftmultihatch_block.2.name=[已弃用]T.F.F.T输入/输出仓(Tier III) -tile.kekztech_tfftmultihatch_block.0.desc=放入合成栏以升级 +tile.kekztech_tfftstoragefield_block.0.name=T.F.F.T机械方块 +tile.kekztech_tfftstoragefield_block.1.name=T.F.F.T存储库方块(T1) +tile.kekztech_tfftstoragefield_block.2.name=T.F.F.T存储库方块(T2) +tile.kekztech_tfftstoragefield_block.3.name=T.F.F.T存储库方块(T3) +tile.kekztech_tfftstoragefield_block.4.name=T.F.F.T存储库方块(T4) +tile.kekztech_tfftstoragefield_block.5.name=T.F.F.T存储库方块(T5) +tile.kekztech_tfftstoragefield_block.6.name=T.F.F.T存储库方块(T6) +tile.kekztech_tfftstoragefield_block.7.name=T.F.F.T存储库方块(T7) +tile.kekztech_tfftstoragefield_block.8.name=T.F.F.T存储库方块(T8) +tile.kekztech_tfftstoragefield_block.9.name=T.F.F.T存储库方块(T9) +tile.kekztech_tfftstoragefield_block.10.name=T.F.F.T存储库方块(T10) +tile.kekztech_tfftstoragefield_block.desc=这不是流体储罐 # -------- Item Proxy: Structure Blocks tile.kekztech_itemproxycable_block.name=物流网络线缆 diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTCasing.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTCasing.png Binary files differindex dba2574939..1ff7495c1a 100644 --- a/src/main/resources/assets/kekztech/textures/blocks/TFFTCasing.png +++ b/src/main/resources/assets/kekztech/textures/blocks/TFFTCasing.png diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch0_off.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch0_off.png Binary files differdeleted file mode 100755 index 96ced7f091..0000000000 --- a/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch0_off.png +++ /dev/null diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch0_on.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch0_on.png Binary files differdeleted file mode 100755 index 149c7c847e..0000000000 --- a/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch0_on.png +++ /dev/null diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch1_off.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch1_off.png Binary files differdeleted file mode 100755 index 259826d921..0000000000 --- a/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch1_off.png +++ /dev/null diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch1_on.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch1_on.png Binary files differdeleted file mode 100755 index ed5dd7610b..0000000000 --- a/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch1_on.png +++ /dev/null diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch2_off.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch2_off.png Binary files differdeleted file mode 100755 index 30fbb78f34..0000000000 --- a/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch2_off.png +++ /dev/null diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch2_on.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch2_on.png Binary files differdeleted file mode 100755 index be6c2a6856..0000000000 --- a/src/main/resources/assets/kekztech/textures/blocks/TFFTMultiHatch2_on.png +++ /dev/null diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock1.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock1.png Binary files differindex 424cf822c0..55b4a17c56 100644 --- a/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock1.png +++ b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock1.png diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock10.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock10.png Binary files differnew file mode 100644 index 0000000000..26aee7ef63 --- /dev/null +++ b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock10.png diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock10.png.mcmeta b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock10.png.mcmeta new file mode 100644 index 0000000000..33611385bd --- /dev/null +++ b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock10.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 1, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock2.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock2.png Binary files differindex a286645cb3..8176f2e44b 100644 --- a/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock2.png +++ b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock2.png diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock3.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock3.png Binary files differindex 7e0ccf1192..bc03da1fee 100644 --- a/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock3.png +++ b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock3.png diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock4.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock4.png Binary files differindex c8ed271aa1..09738a5211 100644 --- a/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock4.png +++ b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock4.png diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock5.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock5.png Binary files differindex f5db48e3d2..20ad0ba3c6 100644 --- a/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock5.png +++ b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock5.png diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock6.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock6.png Binary files differnew file mode 100644 index 0000000000..126536a973 --- /dev/null +++ b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock6.png diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock7.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock7.png Binary files differnew file mode 100644 index 0000000000..da20b67964 --- /dev/null +++ b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock7.png diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock8.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock8.png Binary files differnew file mode 100644 index 0000000000..ba8046b244 --- /dev/null +++ b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock8.png diff --git a/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock9.png b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock9.png Binary files differnew file mode 100644 index 0000000000..d8c6374fb0 --- /dev/null +++ b/src/main/resources/assets/kekztech/textures/blocks/TFFTStorageFieldBlock9.png diff --git a/src/main/resources/assets/kekztech/textures/blocks/multi_hatch_off.png b/src/main/resources/assets/kekztech/textures/blocks/multi_hatch_off.png Binary files differdeleted file mode 100644 index ae3108edad..0000000000 --- a/src/main/resources/assets/kekztech/textures/blocks/multi_hatch_off.png +++ /dev/null diff --git a/src/main/resources/assets/kekztech/textures/blocks/multi_hatch_on.png b/src/main/resources/assets/kekztech/textures/blocks/multi_hatch_on.png Binary files differdeleted file mode 100644 index a1e931c3a2..0000000000 --- a/src/main/resources/assets/kekztech/textures/blocks/multi_hatch_on.png +++ /dev/null |