From c94292a667af5c929e3a1f8d34dce56210136295 Mon Sep 17 00:00:00 2001 From: Xenox003 Date: Thu, 2 Jan 2025 00:10:38 +0100 Subject: [PATCH 1/2] feat: Add look overlay to Leviathan Turbine (aka. Big Chungus) --- .../hbm/blocks/machine/MachineChungus.java | 47 ++++++++++++++++++- .../tileentity/machine/TileEntityChungus.java | 4 ++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/hbm/blocks/machine/MachineChungus.java b/src/main/java/com/hbm/blocks/machine/MachineChungus.java index 957169a40..f9b7a214e 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineChungus.java +++ b/src/main/java/com/hbm/blocks/machine/MachineChungus.java @@ -1,23 +1,32 @@ package com.hbm.blocks.machine; +import java.util.ArrayList; import java.util.List; import com.hbm.blocks.BlockDummyable; +import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ITooltipProvider; import com.hbm.handler.MultiblockHandlerXR; import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; +import com.hbm.inventory.fluid.tank.FluidTank; +import com.hbm.inventory.fluid.trait.FT_Coolable; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityChungus; +import com.hbm.tileentity.machine.oil.TileEntityMachineFractionTower; +import com.hbm.util.BobMathUtil; +import com.hbm.util.I18nUtil; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; +import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; -public class MachineChungus extends BlockDummyable implements ITooltipProvider { +public class MachineChungus extends BlockDummyable implements ITooltipProvider, ILookOverlay { public MachineChungus(Material mat) { super(mat); @@ -135,4 +144,40 @@ public class MachineChungus extends BlockDummyable implements ITooltipProvider { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { this.addStandardInfo(stack, player, list, ext); } + + @Override + public void printHook(Pre event, World world, int x, int y, int z) { + int[] pos = this.findCore(world, x, y, z); + + if(pos == null) + return; + + TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]); + + if(!(te instanceof TileEntityChungus)) + return; + + TileEntityChungus chungus = (TileEntityChungus) te; + + List text = new ArrayList(); + + FluidTank tankInput = chungus.getReceivingTanks()[0]; + FluidTank tankOutput = chungus.getSendingTanks()[0]; + + FluidType inputType = tankInput.getTankType(); + FluidType outputType = Fluids.NONE; + + if (inputType.hasTrait(FT_Coolable.class)) { + outputType = inputType.getTrait(FT_Coolable.class).coolsTo; + } + + text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + inputType.getLocalizedName() + ": " + tankInput.getFill() + "/" + tankInput.getMaxFill() + "mB"); + text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + outputType.getLocalizedName() + ": " + tankOutput.getFill() + "/" + tankOutput.getMaxFill() + "mB"); + + + text.add(EnumChatFormatting.YELLOW + "** " + EnumChatFormatting.RESET + BobMathUtil.getShortNumber(chungus.power) + "/" + BobMathUtil.getShortNumber(chungus.getMaxPower()) + "HE"); + + + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); + } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityChungus.java b/src/main/java/com/hbm/tileentity/machine/TileEntityChungus.java index 925e10cdc..2a9e10f17 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityChungus.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityChungus.java @@ -144,6 +144,8 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr data.setLong("power", power); data.setInteger("type", tanks[0].getTankType().getID()); data.setInteger("operational", turnTimer); + data.setInteger("input_fill", tanks[0].getFill()); + data.setInteger("output_fill", tanks[1].getFill()); this.networkPack(data, 150); } else { @@ -223,6 +225,8 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IEnergyPr this.power = data.getLong("power"); this.turnTimer = data.getInteger("operational"); this.tanks[0].setTankType(Fluids.fromID(data.getInteger("type"))); + this.tanks[0].setFill(data.getInteger("input_fill")); + this.tanks[1].setFill(data.getInteger("output_fill")); } @Override From f1bb5f1d17a9b20cd52ad9aab1590c41c1bf052f Mon Sep 17 00:00:00 2001 From: Xenox003 <68594244+Xenox003@users.noreply.github.com> Date: Thu, 2 Jan 2025 00:32:38 +0100 Subject: [PATCH 2/2] chore: Update changelog --- changelog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog b/changelog index 79cd7c3fe..3ebccb1e3 100644 --- a/changelog +++ b/changelog @@ -7,6 +7,7 @@ ## Changed * Removed the old casing items * Reduced the flicker on the autoshotgun's holo sights +* Leviathan Turbine now has an info overlay displaying steam and energy buffer values ## Fixed * Fixed the bullet casing molds being unobtainable @@ -22,4 +23,4 @@ * Added safeguards to prevent any unnamed casing config from crashing * Fixed one of the break action revolver's faces having incorrect normals, making it invisible * Fixed the fluid trait config not loading correctly - * Fluids are now subject to the /ntmreload command \ No newline at end of file + * Fluids are now subject to the /ntmreload command