Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/projectred-wires' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master committed May 20, 2024
2 parents 4b1223a + a70f256 commit 508bcb3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/main/java/mcp/mobius/waila/addons/projectred/HUDFMPWires.java
Original file line number Diff line number Diff line change
@@ -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<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}

@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("pr.showsignal")) return currenttip;

ITaggedList<String, String> tagList = (ITaggedList<String, String>) 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<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ 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");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_tgate");
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");
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/waila/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 508bcb3

Please sign in to comment.