From 205579baab63a75702cfa68d2c22aace15654191 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Tue, 29 Dec 2020 13:35:25 +0100 Subject: [PATCH] Added Multi Smelter TT Replacement Updated Coil Logic --- build.gradle.kts | 8 +- .../mega/GT_TileEntity_MegaVacuumFreezer.java | 2 +- .../crossmod/BartWorksCrossmod.java | 18 +- .../crossmod/tectech/helper/CoilAdder.java | 15 +- .../crossmod/tectech/helper/IHasCoils.java | 6 +- .../TT_ElectronicBlastFurnace.java | 132 +++----- .../TT_ImplosionCompressor.java | 39 ++- .../multi/GT_Replacement/TT_MultiSmelter.java | 311 ++++++++++++++++++ .../GT_Replacement/TT_OilCrackingUnit.java | 54 +-- .../GT_Replacement/TT_VaccuumFreezer.java | 34 +- 10 files changed, 464 insertions(+), 155 deletions(-) create mode 100644 src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_MultiSmelter.java diff --git a/build.gradle.kts b/build.gradle.kts index fe8e52a95..8d144993c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -60,12 +60,12 @@ val majorUpdate: String by project val minorUpdate: String by project val buildNumber: String by project +minecraft.version = "1.7.10-10.13.4.1614-1.7.10" version = "$majorUpdate.$minorUpdate.$buildNumber" group = "com.github.bartimaeusnek.bartworks" //minecraft block configure { - this.version = "1.7.10-10.13.4.1614-1.7.10" this.includes.addAll( arrayOf( "MainMod.java", @@ -121,9 +121,9 @@ dependencies { compileOnly("com.azanor.baubles:Baubles:1.7.10-1.0.1.10:deobf") compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") compileOnly("mods.railcraft:Railcraft_1.7.10:9.12.3.0:dev") - compileOnly("micdoodle8.mods:MicdoodleCore:$galacticraftVersion:Dev") - compileOnly("micdoodle8.mods:GalacticraftCore:$galacticraftVersion:Dev") - compileOnly("micdoodle8.mods:Galacticraft-Planets:$galacticraftVersion:Dev") + compile("micdoodle8.mods:MicdoodleCore:$galacticraftVersion:Dev") + compile("micdoodle8.mods:GalacticraftCore:$galacticraftVersion:Dev") + compile("micdoodle8.mods:Galacticraft-Planets:$galacticraftVersion:Dev") compileOnly("li.cil.oc:OpenComputers:MC1.7.10-1.5.+:api") compileOnly("net.sengir.forestry:forestry_1.7.10:4.2.16.64:dev") //jitpack diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java index 6a3c6ae7a..e93d7342e 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java @@ -105,7 +105,7 @@ public boolean checkRecipe(ItemStack itemStack) { int processed = 0; while (this.getStoredInputs().size() > 0 && processed < ConfigHandler.megaMachinesMax) { - if (tRecipe != null && (tRecipe.mEUt * (processed + 1)) < nominalV && tRecipe.isRecipeInputEqual(true, null, tInputs)) { + if (tRecipe != null && ((long) tRecipe.mEUt * (processed + 1)) < nominalV && tRecipe.isRecipeInputEqual(true, null, tInputs)) { found_Recipe = true; for (int i = 0; i < tRecipe.mOutputs.length; i++) { outputItems.add(tRecipe.getOutput(i)); diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java index d20f191dd..46e7652c2 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java @@ -27,10 +27,7 @@ import com.github.bartimaeusnek.crossmod.GTpp.loader.RadioHatchCompat; import com.github.bartimaeusnek.crossmod.galacticraft.GalacticraftProxy; import com.github.bartimaeusnek.crossmod.tectech.TecTechResearchLoader; -import com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement.TT_ElectronicBlastFurnace; -import com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement.TT_ImplosionCompressor; -import com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement.TT_OilCrackingUnit; -import com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement.TT_VaccuumFreezer; +import com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement.*; import com.github.bartimaeusnek.crossmod.thaumcraft.CustomAspects; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.event.FMLInitializationEvent; @@ -80,12 +77,13 @@ public void init(FMLInitializationEvent init) { if (LoaderReference.GalacticraftCore) GalacticraftProxy.init(init); //Base GT -> TT Replacement - //if (LoaderReference.tectech) { - // new TT_VaccuumFreezer(null); - // new TT_OilCrackingUnit(null); - // new TT_ImplosionCompressor(null); - // new TT_ElectronicBlastFurnace(null); - //} + if (LoaderReference.tectech) { + new TT_VaccuumFreezer(null,null); + new TT_OilCrackingUnit(null,null); + new TT_ImplosionCompressor(null,null); + new TT_ElectronicBlastFurnace(null,null); + new TT_MultiSmelter(null,null); + } } @Mod.EventHandler diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/CoilAdder.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/CoilAdder.java index 8cec3450a..8e3dab256 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/CoilAdder.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/helper/CoilAdder.java @@ -26,6 +26,9 @@ import com.github.technus.tectech.mechanics.structure.IStructureElement; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.GregTech_API; +import gregtech.api.enums.HeatingCoilLevel; +import gregtech.api.interfaces.IHeatingCoil; +import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -43,10 +46,14 @@ public static STRUCTURE_DEFINITION = StructureDefinition .builder() @@ -113,8 +116,8 @@ public IStructureDefinition getStructure_EM() { @Override protected boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - this.setCoilMeta((short) -1); - boolean ret = this.structureCheck_EM("main", 1, 3, 0) && this.getHeatingCapacity() > -1; + this.setCoilHeat(HeatingCoilLevel.None); + boolean ret = this.structureCheck_EM("main", 1, 3, 0) && this.getCoilHeat() != HeatingCoilLevel.None; if (this.mMufflerHatches.stream() .map(MetaTileEntity::getBaseMetaTileEntity) .mapToInt(ITurnable::getFrontFacing) @@ -210,24 +213,36 @@ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti) } public String[] getDescription() { - return new String[]{ - "Controller Block for the Blast Furnace", - "Size(WxHxD): 3x4x3 (Hollow), Controller (Front middle bottom)", - "16x Heating Coils (Two middle Layers, hollow)", - "1x Input Hatch/Bus (Any bottom layer casing)", - "1x Output Hatch/Bus (Any bottom layer casing)", - "1x Energy Hatch (Any bottom layer casing)", - "1x Maintenance Hatch (Any bottom layer casing)", - "1x Muffler Hatch (Top middle)", - "1x Output Hatch to recover CO2/CO/SO2 (optional, any top layer casing),", - " Recovery scales with Muffler Hatch tier", - "Heat Proof Machine Casings for the rest", - "Each 900K over the min. Heat Capacity multiplies eu/t by 0.95", - "Each 1800K over the min. Heat Capacity allows for one upgraded overclock", - "Upgraded overclocks reduce recipe time to 25% and increase EU/t to 400%", - "Causes " + 20 * getPollutionPerTick(null) + " Pollution per second", - ADV_STR_CHECK - }; + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Blast Furnace") + .addInfo("Controller block for the Electric Blast Furnace") + .addInfo("You can use some fluids to reduce recipe time. Place the circuit in the Input Bus") + .addInfo("Each 900K over the min. Heat required multiplies EU/t by 0.95") + .addInfo("Each 1800K over the min. Heat required allows for one upgraded overclock instead of normal") + .addInfo("Upgraded overclocks reduce recipe time to 25% (instead of 50%) and increase EU/t to 400%") + .addInfo("Additionally gives +100K for every tier past MV") + .addPollutionAmount(20 * getPollutionPerTick(null)) + .addInfo(ADV_STR_CHECK) + .addSeparator() + .beginStructureBlock(3, 4, 3, true) + .addController("Front bottom") + .addCasingInfo("Heat Proof Machine Casing", 0) + .addOtherStructurePart("Heating Coils", "Two middle Layers") + .addEnergyHatch("Any bottom layer casing") + .addMaintenanceHatch("Any bottom layer casing") + .addMufflerHatch("Top middle") + .addInputBus("Any bottom layer casing") + .addInputHatch("Any bottom layer casing") + .addOutputBus("Any bottom layer casing") + .addOutputHatch("CO/CO2/SO2, Any top layer casing") + .addStructureInfo("Recovery amount scales with Muffler Hatch tier") + .addOutputHatch("Fluids, Any bottom layer casing") + .toolTipFinisher("Gregtech"); + if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getInformation(); + } else { + return tt.getStructureInformation(); + } } public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { @@ -247,40 +262,15 @@ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechT } @Override - public void setCoilMeta(short coilMeta) { + public void setCoilHeat(HeatingCoilLevel coilMeta) { this.coilMeta = coilMeta; } @Override - public short getCoilMeta() { + public HeatingCoilLevel getCoilHeat() { return coilMeta; } - private int getHeatingCapacity() { - switch (coilMeta) { - case 0: - return 1801; - case 1: - return 2701; - case 2: - return 3601; - case 3: - return 4501; - case 4: - return 5401; - case 5: - return 7201; - case 6: - return 9001; - case 7: - return 9901; - case 8: - return 10801; - default: - return -1; - } - } - @Override public String[] getStructureDescription(ItemStack itemStack) { return new String[0]; @@ -292,53 +282,21 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { } public boolean checkRecipe_EM(ItemStack aStack) { - ArrayList tInputList = getStoredInputs(); - int tInputList_sS = tInputList.size(); - for (int i = 0; i < tInputList_sS - 1; i++) { - for (int j = i + 1; j < tInputList_sS; j++) { - if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { - if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { - tInputList.remove(j--); - tInputList_sS = tInputList.size(); - } else { - tInputList.remove(i--); - tInputList_sS = tInputList.size(); - break; - } - } - } - } - ItemStack[] tInputs = tInputList.toArray(new ItemStack[0]); - - ArrayList tFluidList = getStoredFluids(); - int tFluidList_sS = tFluidList.size(); - for (int i = 0; i < tFluidList_sS - 1; i++) { - for (int j = i + 1; j < tFluidList_sS; j++) { - if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { - if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { - tFluidList.remove(j--); - tFluidList_sS = tFluidList.size(); - } else { - tFluidList.remove(i--); - tFluidList_sS = tFluidList.size(); - break; - } - } - } - } - FluidStack[] tFluids = tFluidList.toArray(new FluidStack[0]); - if (tInputList.size() > 0) { + ItemStack[] tInputs = this.getCompactedInputs(); + FluidStack[] tFluids = this.getCompactedFluids(); + + if (tInputs.length > 0) { long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBlastRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); if (tRecipe == null - || (this.getHeatingCapacity() < tRecipe.mSpecialValue) + || (this.getCoilHeat().getHeat() < tRecipe.mSpecialValue) || (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { return false; } this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; - int tHeatCapacityDivTiers = (this.getHeatingCapacity() - tRecipe.mSpecialValue) / 900; + int tHeatCapacityDivTiers = (int) ((this.getCoilHeat().getHeat() - tRecipe.mSpecialValue) / 900); byte overclockCount = calculateOverclockednessEBF(tRecipe.mEUt, tRecipe.mDuration, tVoltage); //In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ImplosionCompressor.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ImplosionCompressor.java index 387540cfb..8b41aa1db 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ImplosionCompressor.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_ImplosionCompressor.java @@ -39,11 +39,13 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.*; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; +import org.lwjgl.input.Keyboard; import java.util.List; @@ -52,7 +54,7 @@ public class TT_ImplosionCompressor extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - public TT_ImplosionCompressor(Object unused) { + public TT_ImplosionCompressor(Object unused, Object unused2) { super(32765, "multimachine.implosioncompressor", "Implosion Compressor"); GregTech_API.METATILEENTITIES[32765] = null; GregTech_API.METATILEENTITIES[1001] = this; @@ -150,19 +152,28 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { @Override public String[] getDescription() { - return new String[]{ - "Controller Block for the Implosion Compressor", - "Size(WxHxD): 3x3x3 (Hollow), Controller (Front centered)", - "1x Input Bus (Any casing)", - "1x Output Bus (Any casing)", - "1x Maintenance Hatch (Any casing)", - "1x Muffler Hatch (Any casing)", - "1x Energy Hatch (Any casing)", - "Solid Steel Machine Casings for the rest (16 at least!)", - "Casings can be replaced with Explosion Warning Signs", - "Causes " + 20 * getPollutionPerTick(null) + " Pollution per second", - ADV_STR_CHECK - }; + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Implosion Compressor") + .addInfo("Explosions are fun") + .addInfo("Controller block for the Implosion Compressor") + .addPollutionAmount(20 * getPollutionPerTick(null)) + .addInfo(ADV_STR_CHECK) + .addSeparator() + .beginStructureBlock(3, 3, 3, true) + .addController("Front center") + .addCasingInfo("Solid Steel Machine Casing", 16) + .addStructureInfo("Casings can be replaced with Explosion Warning Signs") + .addEnergyHatch("Any casing") + .addMaintenanceHatch("Any casing") + .addMufflerHatch("Any casing") + .addInputBus("Any casing") + .addOutputBus("Any casing") + .toolTipFinisher("Gregtech"); + if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getInformation(); + } else { + return tt.getStructureInformation(); + } } @Override diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_MultiSmelter.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_MultiSmelter.java new file mode 100644 index 000000000..086b2c694 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_MultiSmelter.java @@ -0,0 +1,311 @@ +/* + * Copyright (c) 2018-2020 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement; + +import com.github.bartimaeusnek.crossmod.tectech.helper.CoilAdder; +import com.github.bartimaeusnek.crossmod.tectech.helper.IHasCoils; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.StructureDefinition; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; +import gregtech.api.GregTech_API; +import gregtech.api.enums.HeatingCoilLevel; +import gregtech.api.enums.Textures; +import gregtech.api.gui.GT_Container_MultiMachine; +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.interfaces.tileentity.ITurnable; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.*; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import gregtech.api.util.GT_Utility; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import org.lwjgl.input.Keyboard; + +import java.util.ArrayList; + +import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.ADV_STR_CHECK; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; + +public class TT_MultiSmelter extends GT_MetaTileEntity_MultiblockBase_EM implements IHasCoils, IConstructable { + + private int mLevel; + private int mCostDiscount; + + public TT_MultiSmelter(Object unused, Object unused2) { + super(32765, "multimachine.multifurnace", "Multi Smelter"); + GregTech_API.METATILEENTITIES[32765] = null; + GregTech_API.METATILEENTITIES[1003] = this; + } + + private TT_MultiSmelter(String aName) { + super(aName); + } + + private HeatingCoilLevel coilMeta = HeatingCoilLevel.None; + private static final byte TEXTURE_INDEX = 11; + private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition + .builder() + .addShape("main", + transpose(new String[][]{ + {"AAA", "AMA", "AAA"}, + {"CCC", "C-C", "CCC"}, + {"B~B", "BBB", "BBB"} + }) + ).addElement( + 'C', + CoilAdder.getINSTANCE() + ).addElement( + 'M', + ofHatchAdder( + GT_MetaTileEntity_MultiblockBase_EM::addClassicMufflerToMachineList, TEXTURE_INDEX, + 1 + ) + ).addElement( + 'A', + ofBlock( + GregTech_API.sBlockCasings1, TEXTURE_INDEX, + GregTech_API.sBlockCasings1, TEXTURE_INDEX + ) + ).addElement( + 'B', + ofHatchAdderOptional( + TT_MultiSmelter::addHatchesBottom, TEXTURE_INDEX, + GregTech_API.sBlockCasings1, TEXTURE_INDEX, + GregTech_API.sBlockCasings1, TEXTURE_INDEX + ) + ) + .build(); + + public final boolean addHatchesBottom(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) + return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + else + return false; + + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) + return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) + return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) + return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) + return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) + return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) + return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) + return this.eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti) + return this.eDynamoMulti.add((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity); + return false; + } + + @Override + public IStructureDefinition getStructure_EM() { + return STRUCTURE_DEFINITION; + } + + @Override + protected boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + this.mLevel = 0; + this.mCostDiscount = 1; + this.setCoilHeat(HeatingCoilLevel.None); + boolean ret = this.structureCheck_EM("main", 1, 2, 0) && this.getCoilHeat() != HeatingCoilLevel.None; + if (this.mMufflerHatches.stream() + .map(MetaTileEntity::getBaseMetaTileEntity) + .mapToInt(ITurnable::getFrontFacing) + .noneMatch(x -> x == this.getExtendedFacing().getRelativeUpInWorld().ordinal())) + return false; + + this.mLevel = this.getCoilHeat().getLevel(); + this.mCostDiscount = this.getCoilHeat().getCostDiscount(); + return ret; + } + + @Override + public void construct(ItemStack itemStack, boolean b) { + this.structureBuild_EM("main", 1,2,0, b, itemStack); + } + + @Override + protected boolean cyclicUpdate_EM() { + return false; + } + + @Override + public String[] getDescription() { + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Furnace") + .addInfo("Controller Block for the Multi Smelter") + .addInfo("Smelts up to 8-128 items at once") + .addInfo("Items smelted increases with coil tier") + .addPollutionAmount(20 * getPollutionPerTick(null)) + .addInfo(ADV_STR_CHECK) + .addSeparator() + .beginStructureBlock(3, 3, 3, true) + .addController("Front bottom") + .addCasingInfo("Heat Proof Machine Casing", 8) + .addOtherStructurePart("Heating Coils", "Middle layer") + .addEnergyHatch("Any bottom casing") + .addMaintenanceHatch("Any bottom casing") + .addMufflerHatch("Top Middle") + .addInputBus("Any bottom casing") + .addOutputBus("Any bottom casing") + .toolTipFinisher("Gregtech"); + if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + return tt.getInformation(); + return tt.getStructureInformation(); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][11], new TT_RenderedExtendedFacingTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)}; + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][11]}; + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiFurnace.png"); + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public void setCoilHeat(HeatingCoilLevel coilMeta) { + this.coilMeta = coilMeta; + } + + @Override + public HeatingCoilLevel getCoilHeat() { + return coilMeta; + } + + @Override + public String[] getStructureDescription(ItemStack itemStack) { + return new String[0]; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { + return new TT_MultiSmelter(this.mName); + } + + @Override + public boolean checkRecipe_EM(ItemStack aStack) { + ArrayList tInputList = getStoredInputs(); + if (tInputList.isEmpty()) + return false; + + int mVolatage = GT_Utility.safeInt(getMaxInputVoltage()); + int tMaxParrallel = 8 * this.mLevel; + int tCurrenParrallel = 0; + ItemStack tSmeltStack = tInputList.get(0); + ItemStack tOutputStack = GT_ModHandler.getSmeltingOutput(tSmeltStack,false,null); + if (tOutputStack == null) + return false; + for (ItemStack item : tInputList) + if (tSmeltStack.isItemEqual(item)) + if (item.stackSize < (tMaxParrallel - tCurrenParrallel)) { + tCurrenParrallel += item.stackSize; + item.stackSize = 0; + } else { + item.stackSize = (tCurrenParrallel + item.stackSize) - tMaxParrallel; + tCurrenParrallel = tMaxParrallel; + break; + } + tCurrenParrallel *= tOutputStack.stackSize; + this.mOutputItems = new ItemStack[(tCurrenParrallel/64)+1]; + for (int i = 0; i < this.mOutputItems.length; i++) { + ItemStack tNewStack = tOutputStack.copy(); + int size = Math.min(tCurrenParrallel, 64); + tNewStack.stackSize = size; + tCurrenParrallel -= size; + this.mOutputItems[i] = tNewStack; + } + + if (this.mOutputItems.length > 0) { + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + calculateOverclockedNessMulti(4, 512, 1, mVolatage); + //In case recipe is too OP for that machine + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) + return false; + + this.mEUt = GT_Utility.safeInt(((long)mEUt) * this.mLevel / (long)this.mCostDiscount,1); + if (mEUt == Integer.MAX_VALUE - 1) + return false; + + if (this.mEUt > 0) + this.mEUt = (-this.mEUt); + } + updateSlots(); + return true; + } + + @Override + public boolean isMachineBlockUpdateRecursive() { + return true; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 20; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_OilCrackingUnit.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_OilCrackingUnit.java index e35782eaf..2d154d66b 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_OilCrackingUnit.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_OilCrackingUnit.java @@ -30,6 +30,7 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import gregtech.api.GregTech_API; +import gregtech.api.enums.HeatingCoilLevel; import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_Container_MultiMachine; @@ -41,11 +42,13 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import org.lwjgl.input.Keyboard; import java.util.ArrayList; @@ -54,7 +57,7 @@ public class TT_OilCrackingUnit extends GT_MetaTileEntity_MultiblockBase_EM implements IHasCoils, IConstructable { - public TT_OilCrackingUnit(Object unused) { + public TT_OilCrackingUnit(Object unused, Object unused2) { super(32765, "multimachine.cracker", "Oil Cracking Unit"); GregTech_API.METATILEENTITIES[32765] = null; GregTech_API.METATILEENTITIES[1160] = this; @@ -64,15 +67,15 @@ private TT_OilCrackingUnit(String aName) { super(aName); } - private short coilMeta = -1; + private HeatingCoilLevel coilMeta = HeatingCoilLevel.None; @Override - public void setCoilMeta(short coilMeta) { + public void setCoilHeat(HeatingCoilLevel coilMeta) { this.coilMeta = coilMeta; } @Override - public short getCoilMeta() { + public HeatingCoilLevel getCoilHeat() { return coilMeta; } @@ -151,7 +154,7 @@ public final boolean addMiddleFluidHatch(IGregTechTileEntity aTileEntity, int aB @Override protected boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - this.coilMeta = -1; + this.coilMeta = HeatingCoilLevel.None; this.blocks = 0; return this.structureCheck_EM("main", 2,1,0) && this.blocks >= 18; @@ -196,21 +199,30 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { @Override public String[] getDescription() { - return new String[]{ - "Controller Block for the Oil Cracking Unit", - "Thermally cracks heavy hydrocarbons into lighter fractions", - "Size(WxHxD): 5x3x3 (Hollow), Controller (Front center)", - "Ring of 8 Coils (Each side of Controller)", - "Gets 5% energy cost reduction per coil tier", - "1x Hydrocarbon Input Bus/Hatch (Any left/right side casing)", - "1x Steam/Hydrogen Input Hatch (Any middle ring casing)", - "1x Cracked Hydrocarbon Output Hatch (Any left/right side casing)", - "1x Maintenance Hatch (Any casing)", - "1x Energy Hatch (Any casing)", - "Clean Stainless Steel Machine Casings for the rest (18 at least!)", - "Input/Output Hatches must be on opposite sides", - ADV_STR_CHECK - }; + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Cracker") + .addInfo("Controller block for the Oil Cracking Unit") + .addInfo("Thermally cracks heavy hydrocarbons into lighter fractions") + .addInfo("More efficient than the Chemical Reactor") + .addInfo("Place the appropriate circuit in the controller") + .addSeparator() + .beginStructureBlock(5, 3, 3, true) + .addController("Front center") + .addCasingInfo("Clean Stainless Steel Machine Casing", 18) + .addOtherStructurePart("2 Rings of 8 Coils", "Each side of the controller") + .addInfo("Gets 5% energy cost reduction per coil tier") + .addInfo(ADV_STR_CHECK) + .addEnergyHatch("Any casing") + .addMaintenanceHatch("Any casing") + .addInputHatch("Steam/Hydrogen, Any middle ring casing") + .addInputHatch("Any left/right side casing") + .addOutputHatch("Any left/right side casing") + .addStructureInfo("Input/Output Hatches must be on opposite sides!") + .toolTipFinisher("Gregtech"); + if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + return tt.getInformation(); + else + return tt.getStructureInformation(); } @Override @@ -247,7 +259,7 @@ public boolean checkRecipe_EM(ItemStack aStack) { calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, getMaxInputVoltage()); if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return false; - this.mEUt *= Math.pow(0.95D, this.coilMeta); + this.mEUt *= Math.pow(0.95D, this.coilMeta.getTier()); if (this.mEUt > 0) { this.mEUt = (-this.mEUt); diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_VaccuumFreezer.java b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_VaccuumFreezer.java index 4e07db560..156ef9006 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_VaccuumFreezer.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/tectech/tileentites/multi/GT_Replacement/TT_VaccuumFreezer.java @@ -40,10 +40,12 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.*; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; +import org.lwjgl.input.Keyboard; import java.util.ArrayList; @@ -51,7 +53,7 @@ import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; public class TT_VaccuumFreezer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - public TT_VaccuumFreezer(Object unused) { + public TT_VaccuumFreezer(Object unused, Object unused2) { super(32765, "multimachine.vacuumfreezer", "Vacuum Freezer"); GregTech_API.METATILEENTITIES[32765] = null; GregTech_API.METATILEENTITIES[1002] = this; @@ -97,17 +99,25 @@ public IStructureDefinition getStructure_EM() { } public String[] getDescription() { - return new String[]{ - "Controller Block for the Vacuum Freezer", - "Super cools hot ingots and cells", - "Size(WxHxD): 3x3x3 (Hollow), Controller (Front centered)", - "1x Input Bus (Any casing)", - "1x Output Bus (Any casing)", - "1x Maintenance Hatch (Any casing)", - "1x Energy Hatch (Any casing)", - "Frost Proof Machine Casings for the rest (16 at least!)", - ADV_STR_CHECK - }; + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Vacuum Freezer") + .addInfo("Controller Block for the Vacuum Freezer") + .addInfo("Cools hot ingots and cells") + .addInfo(ADV_STR_CHECK) + .addSeparator() + .beginStructureBlock(3, 3, 3, true) + .addController("Front center") + .addCasingInfo("Frost Proof Machine Casing", 16) + .addEnergyHatch("Any casing") + .addMaintenanceHatch("Any casing") + .addInputBus("Any casing") + .addOutputBus("Any casing") + .toolTipFinisher("Gregtech"); + if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getInformation(); + } else { + return tt.getStructureInformation(); + } } @Override