From 98426a766e4d7e85aaefe93396332a17e7ebbdc0 Mon Sep 17 00:00:00 2001 From: DM <83300800+mak8427@users.noreply.github.com> Date: Tue, 21 Jan 2025 21:00:50 +0000 Subject: [PATCH] Add Waila Pipe info (#3839) Co-authored-by: Martin Robertz Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com> --- .../implementations/MTEFluid.java | 40 +++++++++++++++++++ .../resources/assets/gregtech/lang/en_US.lang | 8 ++++ 2 files changed, 48 insertions(+) diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEFluid.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEFluid.java index 4d062540cfc..fced47c1a30 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEFluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEFluid.java @@ -29,6 +29,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; @@ -67,6 +68,8 @@ import gregtech.common.covers.CoverDrain; import gregtech.common.covers.CoverFluidRegulator; import gregtech.common.covers.CoverInfo; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; public class MTEFluid extends MetaPipeEntity { @@ -931,6 +934,43 @@ public FluidStack drain(ForgeDirection side, FluidStack aFluid, boolean doDrain) return null; } + @Override + public void getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + + // Basic pipe stats + currenttip.add( + StatCollector.translateToLocal("GT5U.item.pipe.capacity") + ": " + + EnumChatFormatting.BLUE + + GTUtility.formatNumbers(mCapacity * 20L) + + " L/s"); + + currenttip.add( + StatCollector.translateToLocal("GT5U.item.pipe.heat_resistance") + ": " + + EnumChatFormatting.RED + + GTUtility.formatNumbers(mHeatResistance) + + "K"); + + // Gas handling info + if (mGasProof) { + currenttip.add( + StatCollector.translateToLocal("GT5U.item.pipe.gas_proof") + ": " + + EnumChatFormatting.GREEN + + StatCollector.translateToLocal("GT5U.item.pipe.gas_proof.yes")); + } else { + currenttip.add( + StatCollector.translateToLocal("GT5U.item.pipe.gas_proof") + ": " + + EnumChatFormatting.RED + + StatCollector.translateToLocal("GT5U.item.pipe.gas_proof.no")); + } + + // Multi-pipe info + if (mPipeAmount > 1) { + currenttip.add( + StatCollector.translateToLocal("GT5U.item.pipe.amount") + ": " + EnumChatFormatting.AQUA + mPipeAmount); + } + } + private static EnumMap borderMap(ForgeDirection topSide, ForgeDirection bottomSide, ForgeDirection leftSide, ForgeDirection rightSide) { final EnumMap sideMap = new EnumMap<>(Border.class); diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang index 24eeb2e3a8e..eff10f91452 100644 --- a/src/main/resources/assets/gregtech/lang/en_US.lang +++ b/src/main/resources/assets/gregtech/lang/en_US.lang @@ -681,6 +681,14 @@ GT5U.item.cable.loss=Loss/Meter/Ampere GT5U.item.cable.eu_volt=EU-Volt GT5U.item.tank.locked_to=Content locked to %s +GT5U.item.pipe.capacity=Capacity +GT5U.item.pipe.heat_resistance=Heat Resistance +GT5U.item.pipe.gas_proof=Gas Proof +GT5U.item.pipe.gas_proof.yes=Yes +GT5U.item.pipe.gas_proof.no=No +GT5U.item.pipe.amount=Pipe Amount +GT5U.item.pipe.empty=Empty + gt.behaviour.paintspray.infinite.gui.header=Select a Color gt.behaviour.paintspray.infinite.gui.lock_error=§eSpray can is §clocked§e! §bSneak middle-click to unlock. gt.behaviour.paintspray.infinite.gui.solvent=Solvent