diff options
author | Noc <95299389+Nockyx@users.noreply.github.com> | 2024-11-01 16:48:31 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-01 19:48:31 +0000 |
commit | 6b0467685b833db1282dde5c22a2cd9230fda376 (patch) | |
tree | 9bcb629a76b11444964f2cac8e076a1bb7216051 /src/main | |
parent | 0c73ba7f8dd7e7e2429f084eeb0fc7855849695d (diff) | |
download | GT5-Unofficial-6b0467685b833db1282dde5c22a2cd9230fda376.tar.gz GT5-Unofficial-6b0467685b833db1282dde5c22a2cd9230fda376.tar.bz2 GT5-Unofficial-6b0467685b833db1282dde5c22a2cd9230fda376.zip |
Fixes for Deep Earth Heating Pump (#3434)
Diffstat (limited to 'src/main')
6 files changed, 79 insertions, 85 deletions
diff --git a/src/main/java/bartworks/common/loaders/ItemRegistry.java b/src/main/java/bartworks/common/loaders/ItemRegistry.java index eb1d227073..a644e6c838 100644 --- a/src/main/java/bartworks/common/loaders/ItemRegistry.java +++ b/src/main/java/bartworks/common/loaders/ItemRegistry.java @@ -535,7 +535,7 @@ public class ItemRegistry { StatCollector.translateToLocal("tile.acidgenerator.name") + " " + GTValues.VN[1], +1).getStackForm(1L); - ItemRegistry.dehp = new MTEDeepEarthHeatingPump(DeepEarthHeatingPump.ID, 1, "DEHP", "Deep Earth Heating Pump") + ItemRegistry.dehp = new MTEDeepEarthHeatingPump(DeepEarthHeatingPump.ID, "DEHP", "Deep Earth Heating Pump") .getStackForm(1L); ItemRegistry.megaMachines[0] = new MTEMegaBlastFurnace( MegaBlastFurnace.ID, diff --git a/src/main/java/bartworks/common/tileentities/multis/MTEDeepEarthHeatingPump.java b/src/main/java/bartworks/common/tileentities/multis/MTEDeepEarthHeatingPump.java index 8f329e2348..60a69abbf1 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTEDeepEarthHeatingPump.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTEDeepEarthHeatingPump.java @@ -16,76 +16,57 @@ package bartworks.common.tileentities.multis; import static bartworks.util.BWTooltipReference.MULTIBLOCK_ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS; import static gregtech.api.enums.GTValues.VN; -import java.lang.reflect.Field; import java.util.Arrays; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; -import gregtech.api.enums.GTValues; +import com.gtnewhorizons.modularui.api.math.Pos2d; + import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; +import gregtech.api.enums.TierEU; +import gregtech.api.gui.modularui.GTUITextures; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.MTEHatchInput; import gregtech.api.util.GTModHandler; -import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.common.tileentities.machines.multi.MTEDrillerBase; -import ic2.core.block.reactor.tileentity.TileEntityNuclearReactorElectric; +import gtPlusPlus.core.util.minecraft.PlayerUtils; public class MTEDeepEarthHeatingPump extends MTEDrillerBase { - private static float nulearHeatMod = 2f; private byte mMode; - private byte mTier; - public MTEDeepEarthHeatingPump(int aID, int tier, String aName, String aNameRegional) { + public MTEDeepEarthHeatingPump(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); - this.mTier = (byte) tier; } - public MTEDeepEarthHeatingPump(String aName, byte mTier) { + public MTEDeepEarthHeatingPump(String aName) { super(aName); - this.mTier = mTier; - } - - @Override - @SuppressWarnings("rawtypes") - public void onConfigLoad() { - try { - Class c = TileEntityNuclearReactorElectric.class; - Field f = c.getDeclaredField("huOutputModifier"); - f.setAccessible(true); - MTEDeepEarthHeatingPump.nulearHeatMod = f.getFloat(f); - } catch (SecurityException | IllegalArgumentException | ExceptionInInitializerError | NullPointerException - | IllegalAccessException | NoSuchFieldException e) { - e.printStackTrace(); - } - super.onConfigLoad(); } @Override public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setByte("mTier", this.mTier); aNBT.setByte("mMode", this.mMode); super.saveNBTData(aNBT); } @Override public void loadNBTData(NBTTagCompound aNBT) { - this.mTier = aNBT.getByte("mTier"); this.mMode = aNBT.getByte("mMode"); super.loadNBTData(aNBT); } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { - return new MTEDeepEarthHeatingPump(this.mName, this.mTier); + return new MTEDeepEarthHeatingPump(this.mName); } @Override @@ -95,15 +76,14 @@ public class MTEDeepEarthHeatingPump extends MTEDrillerBase { .get(0) .getDisplayName(); tt.addMachineType("Geothermal Heat Pump") - .addInfo("Consumes " + GTValues.V[this.mTier + 2] + "EU/t") - .addInfo("Has 3 Modes, use the Screwdriver to change them:"); + .addInfo("Consumes " + TierEU.RECIPE_HV + "EU/t") + .addInfo("Has 2 Modes, use the Screwdriver to change them:"); - tt.addInfo("Direct Steam, Coolant Heating, Retract") + tt.addInfo("Direct Steam and Coolant Heating") .addInfo( - "Direct Steam Mode: Consumes Distilled Water to produce " + (long) (this.mTier * 25600 * 20) + "Direct Steam Mode: Consumes Distilled Water to produce " + (long) (25600 * 20) + "L/s of Superheated Steam") - .addInfo( - "Coolant Heating Mode: Converts " + (long) (this.mTier * 96 * 2 * 20) + "L/s Coolant to Hot Coolant") + .addInfo("Coolant Heating Mode: Converts " + (long) (192 * 20) + "L/s Coolant to Hot Coolant") .addInfo("Each maintenance issue lowers output efficiency by 10%") .addInfo("Explodes when it runs out of Distilled Water/Coolant"); @@ -140,8 +120,30 @@ public class MTEDeepEarthHeatingPump extends MTEDrillerBase { } @Override + public boolean supportsMachineModeSwitch() { + return true; + } + + @Override + public Pos2d getMachineModeSwitchButtonPos() { + return new Pos2d(98, 91); + } + + @Override + public void setMachineModeIcons() { + machineModeIcons.clear(); + machineModeIcons.add(GTUITextures.OVERLAY_BUTTON_MACHINEMODE_STEAM); + machineModeIcons.add(GTUITextures.OVERLAY_BUTTON_MACHINEMODE_LPF_FLUID); + } + + @Override + public String getMachineModeName() { + return StatCollector.translateToLocal("GT5U.DEHP.mode." + machineMode); + } + + @Override protected int getMinTier() { - return 2 + this.mTier; + return 3; } @Override @@ -178,50 +180,35 @@ public class MTEDeepEarthHeatingPump extends MTEDrillerBase { } @Override - protected boolean workingUpward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, - int yHead, int oldYHead) { - if (this.mMode != 3) { - this.isPickingPipes = false; - this.workState = 0; - return true; - } - return super.workingUpward(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead); + protected void addOperatingMessages() { + // Inheritors can overwrite these to add custom operating messages. + addResultMessage(STATE_DOWNWARD, true, "deploying_pipe"); + addResultMessage(STATE_DOWNWARD, false, "extracting_pipe"); + addResultMessage(STATE_AT_BOTTOM, true, "circulating_fluid"); + addResultMessage(STATE_AT_BOTTOM, false, "no_mining_pipe"); + addResultMessage(STATE_UPWARD, true, "retracting_pipe"); + addResultMessage(STATE_UPWARD, false, "drill_generic_finished"); + addResultMessage(STATE_ABORT, true, "retracting_pipe"); + addResultMessage(STATE_ABORT, false, "drill_retract_pipes_finished"); } @Override public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (this.getBaseMetaTileEntity() - .getWorld().isRemote) return; - ++this.mMode; - if (this.mMode >= 3) this.mMode = 0; - if (this.mMode == 0) { - GTUtility.sendChatToPlayer(aPlayer, "Mode: Direct Steam"); - } else if (this.mMode == 1) { - GTUtility.sendChatToPlayer(aPlayer, "Mode: Coolant Heating"); - } else if (this.mMode == 2) { - GTUtility.sendChatToPlayer(aPlayer, "Mode: Retract"); - } - super.onScrewdriverRightClick(side, aPlayer, aX, aY, aZ); + setMachineMode(nextMachineMode()); + PlayerUtils.messagePlayer( + aPlayer, + String.format(StatCollector.translateToLocal("GT5U.MULTI_MACHINE_CHANGE"), getMachineModeName())); } @Override - protected boolean workingDownward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, + protected boolean workingAtBottom(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { - if (this.mMode == 2) { - this.isPickingPipes = true; - this.workState = 2; + if (tryLowerPipeState(true) == 0) { + workState = STATE_DOWNWARD; return true; } - - if (this.tryLowerPipeState(false) == 0) { - return true; - } - if (this.waitForPipes()) { - return false; - } - - if (this.mMode == 0) { - long steamProduced = this.mTier * 25600L * this.mEfficiency / 10000L; + if (this.machineMode == 0) { + long steamProduced = 25600L * this.mEfficiency / 10000L; long waterConsume = (steamProduced + 160) / 160; if (this.getWaterFromHatches(true) - waterConsume > 0) { @@ -234,11 +221,8 @@ public class MTEDeepEarthHeatingPump extends MTEDrillerBase { this.explodeMultiblock(); return false; } - } else if (this.mMode == 1) { - long coolantConverted = (long) (this.mTier * 96L - * (double) MTEDeepEarthHeatingPump.nulearHeatMod - * this.mEfficiency - / 10000L); + } else if (this.machineMode == 1) { + long coolantConverted = (long) (192L * this.mEfficiency / 10000L); if (this.getFluidFromHatches(FluidRegistry.getFluid("ic2coolant")) - coolantConverted > 0) { this.consumeFluid(FluidRegistry.getFluid("ic2coolant"), coolantConverted); this.addOutput(FluidRegistry.getFluidStack("ic2hotcoolant", (int) coolantConverted)); @@ -297,7 +281,7 @@ public class MTEDeepEarthHeatingPump extends MTEDrillerBase { @Override protected void setElectricityStats() { try { - this.mEUt = this.isPickingPipes ? -60 : -1 * Math.toIntExact(GTValues.V[this.getMinTier()]); + this.mEUt = this.isPickingPipes ? -60 : -((int) TierEU.RECIPE_HV); } catch (ArithmeticException e) { e.printStackTrace(); this.mEUt = Integer.MAX_VALUE - 7; diff --git a/src/main/java/gregtech/api/gui/modularui/GTUITextures.java b/src/main/java/gregtech/api/gui/modularui/GTUITextures.java index 67fc603f3e..2e0fc114d9 100644 --- a/src/main/java/gregtech/api/gui/modularui/GTUITextures.java +++ b/src/main/java/gregtech/api/gui/modularui/GTUITextures.java @@ -449,6 +449,8 @@ public class GTUITextures { .fullImage(GregTech.ID, "gui/overlay_button/machine_mode_compressing"); public static final UITexture OVERLAY_BUTTON_MACHINEMODE_SINGULARITY = UITexture .fullImage(GregTech.ID, "gui/overlay_button/machine_mode_singularity"); + public static final UITexture OVERLAY_BUTTON_MACHINEMODE_STEAM = UITexture + .fullImage(GregTech.ID, "gui/overlay_button/machine_mode_dehp_steam"); /** * Can adjust size as needed. diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEDrillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEDrillerBase.java index 81069c8841..f35d9f4a84 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEDrillerBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEDrillerBase.java @@ -181,6 +181,18 @@ public abstract class MTEDrillerBase extends MTEEnhancedMultiBlockBase<MTEDrille initFields(); } + protected void addOperatingMessages() { + // Inheritors can overwrite these to add custom operating messages. + addResultMessage(STATE_DOWNWARD, true, "deploying_pipe"); + addResultMessage(STATE_DOWNWARD, false, "extracting_pipe"); + addResultMessage(STATE_AT_BOTTOM, true, "drilling"); + addResultMessage(STATE_AT_BOTTOM, false, "no_mining_pipe"); + addResultMessage(STATE_UPWARD, true, "retracting_pipe"); + addResultMessage(STATE_UPWARD, false, "drill_generic_finished"); + addResultMessage(STATE_ABORT, true, "retracting_pipe"); + addResultMessage(STATE_ABORT, false, "drill_retract_pipes_finished"); + } + private void initFields() { casingBlock = getCasingBlockItem().getBlock(); casingMeta = getCasingBlockItem().get(0) @@ -192,15 +204,8 @@ public abstract class MTEDrillerBase extends MTEEnhancedMultiBlockBase<MTEDrille casingTextureIndex = getCasingTextureIndex(); workState = STATE_DOWNWARD; - // Inheritors can overwrite these to add custom operating messages. - addResultMessage(STATE_DOWNWARD, true, "deploying_pipe"); - addResultMessage(STATE_DOWNWARD, false, "extracting_pipe"); - addResultMessage(STATE_AT_BOTTOM, true, "drilling"); - addResultMessage(STATE_AT_BOTTOM, false, "no_mining_pipe"); - addResultMessage(STATE_UPWARD, true, "retracting_pipe"); - addResultMessage(STATE_UPWARD, false, "drill_generic_finished"); - addResultMessage(STATE_ABORT, true, "retracting_pipe"); - addResultMessage(STATE_ABORT, false, "drill_retract_pipes_finished"); + addOperatingMessages(); + } @Override diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang index 38565a572b..6235554b13 100644 --- a/src/main/resources/assets/gregtech/lang/en_US.lang +++ b/src/main/resources/assets/gregtech/lang/en_US.lang @@ -362,6 +362,8 @@ GT5U.MULTI_MACHINE_CHANGE=Now running in %s mode GT5U.MULTI_MACHINE_CONFIG.SAVE=Saved Multiblock Hatch Configuration GT5U.MULTI_MACHINE_CONFIG.LOAD=Loaded Multiblock Hatch Configuration GT5U.MULTI_MACHINE_CONFIG.LOAD.FAIL=Failed to load Multiblock Hatch Configuration +GT5U.DEHP.mode.0=Direct Steam +GT5U.DEHP.mode.1=Coolant Heating GT5U.machines.oreprocessor1=§eRunning Mode: GT5U.machines.oreprocessor2=§cTime: %s s GT5U.machines.oreprocessor.void=§eVoid Stone Dust: %s @@ -527,6 +529,7 @@ GT5U.gui.text.machine_mismatch=§7Machine doesn't match to locked recipe GT5U.gui.text.high_gravity=§7Recipe needs low gravity GT5U.gui.text.no_mining_pipe=§7Missing Mining Pipe GT5U.gui.text.drilling=§aDrilling +GT5U.gui.text.circulating_fluid=§aCirculating Fluid GT5U.gui.text.deploying_pipe=§aDeploying mining pipe GT5U.gui.text.extracting_pipe=§aExtracting pipe GT5U.gui.text.retracting_pipe=§aRetracting pipe diff --git a/src/main/resources/assets/gregtech/textures/gui/overlay_button/machine_mode_dehp_steam.png b/src/main/resources/assets/gregtech/textures/gui/overlay_button/machine_mode_dehp_steam.png Binary files differnew file mode 100644 index 0000000000..523a36739f --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/gui/overlay_button/machine_mode_dehp_steam.png |