diff --git a/src/main/java/mcp/mobius/waila/addons/projectred/HUDFMPWires.java b/src/main/java/mcp/mobius/waila/addons/projectred/HUDFMPWires.java new file mode 100644 index 0000000..2fdd302 --- /dev/null +++ b/src/main/java/mcp/mobius/waila/addons/projectred/HUDFMPWires.java @@ -0,0 +1,41 @@ +package mcp.mobius.waila.addons.projectred; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +import mcp.mobius.waila.api.ITaggedList; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaFMPAccessor; +import mcp.mobius.waila.api.IWailaFMPProvider; +import mcp.mobius.waila.cbcore.LangUtil; +import mcp.mobius.waila.utils.NBTUtil; + +public class HUDFMPWires implements IWailaFMPProvider { + + @Override + public List getWailaHead(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, + IWailaConfigHandler config) { + return currenttip; + } + + @Override + public List getWailaBody(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, + IWailaConfigHandler config) { + if (!config.getConfig("pr.showsignal")) return currenttip; + + ITaggedList tagList = (ITaggedList) currenttip; + int signal = ((NBTUtil.getNBTInteger(accessor.getNBTData(), "signal") & 0xff) + 16) / 17; + if (tagList.getEntries("signal").isEmpty()) { + tagList.add(String.format("%s : %s", LangUtil.translateG("hud.msg.power"), signal), "signal"); + } + + return currenttip; + } + + @Override + public List getWailaTail(ItemStack itemStack, List currenttip, IWailaFMPAccessor accessor, + IWailaConfigHandler config) { + return currenttip; + } +} diff --git a/src/main/java/mcp/mobius/waila/addons/projectred/ProjectRedModule.java b/src/main/java/mcp/mobius/waila/addons/projectred/ProjectRedModule.java index a6d3512..ad57f9a 100644 --- a/src/main/java/mcp/mobius/waila/addons/projectred/ProjectRedModule.java +++ b/src/main/java/mcp/mobius/waila/addons/projectred/ProjectRedModule.java @@ -18,6 +18,7 @@ public static void register() { ModuleRegistrar.instance().addConfigRemote("Project:Red", "pr.showio"); ModuleRegistrar.instance().addConfigRemote("Project:Red", "pr.showdata"); + ModuleRegistrar.instance().addConfigRemote("Project:Red", "pr.showsignal"); ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_sgate"); ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_igate"); @@ -25,6 +26,10 @@ public static void register() { ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_bgate"); ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_agate"); ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_rgate"); + ModuleRegistrar.instance().registerBodyProvider(new HUDFMPWires(), "pr_redwire"); + ModuleRegistrar.instance().registerBodyProvider(new HUDFMPWires(), "pr_insulated"); + ModuleRegistrar.instance().registerBodyProvider(new HUDFMPWires(), "pr_fredwire"); + ModuleRegistrar.instance().registerBodyProvider(new HUDFMPWires(), "pr_finsulated"); ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_sgate"); ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_igate"); diff --git a/src/main/resources/assets/waila/lang/en_US.lang b/src/main/resources/assets/waila/lang/en_US.lang index 84ef482..ea45526 100644 --- a/src/main/resources/assets/waila/lang/en_US.lang +++ b/src/main/resources/assets/waila/lang/en_US.lang @@ -136,6 +136,7 @@ option.bcapi.consump=Show maximum power option.bcapi.trigger=Show triggering energy option.pr.showio=Show gates IO option.pr.showdata=Show gates data +option.pr.showsignal=Show wire signal strength option.extrautilities.fluidamount=Show fluid amount option.openblocks.fluidamount=Show fluid amount option.railcraft.fluidamount=Show fluid amount