From 5441e821ad6f2b810f7b62f8d42d1f43f44c7438 Mon Sep 17 00:00:00 2001 From: Christian Date: Fri, 29 Mar 2013 20:47:12 -0400 Subject: [PATCH] Fix trigger/action rendering --- common/buildcraft/BuildCraftCore.java | 10 +++++----- .../core/gui/GuiAdvancedInterface.java | 2 ++ .../triggers/ActionTriggerIconProvider.java | 17 +++++++---------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/common/buildcraft/BuildCraftCore.java b/common/buildcraft/BuildCraftCore.java index fd8476ac..6a703761 100644 --- a/common/buildcraft/BuildCraftCore.java +++ b/common/buildcraft/BuildCraftCore.java @@ -127,7 +127,7 @@ public class BuildCraftCore { public static Icon stripesLaserTexture; @SideOnly(Side.CLIENT) public static Icon transparentTexture; - + @SideOnly(Side.CLIENT) public static IIconProvider iconProvider; @@ -161,7 +161,7 @@ public class BuildCraftCore { public static BptItem[] itemBptProps = new BptItem[Item.itemsList.length]; public static Logger bcLog = Logger.getLogger("Buildcraft"); - + public IIconProvider actionTriggerIconProvider = new ActionTriggerIconProvider(); @Instance("BuildCraft|Core") @@ -258,7 +258,7 @@ public class BuildCraftCore { diamondGearItem = (new ItemBuildCraft(diamondGearId.getInt())).setUnlocalizedName("diamondGearItem"); LanguageRegistry.addName(diamondGearItem, "Diamond Gear"); - + MinecraftForge.EVENT_BUS.register(this); } finally { @@ -316,14 +316,14 @@ public class BuildCraftCore { public void serverStarting(FMLServerStartingEvent event) { event.registerServerCommand(new CommandBuildCraft()); } - + @ForgeSubscribe @SideOnly(Side.CLIENT) public void textureHook(TextureStitchEvent.Pre event){ if (event.map == Minecraft.getMinecraft().renderEngine.textureMapItems) { - //if (event.map.textureType == 1) { 'TODO Replace above iconProvider = new CoreIconProvider(); iconProvider.registerIcons(event.map); + actionTriggerIconProvider.registerIcons(event.map); } } diff --git a/common/buildcraft/core/gui/GuiAdvancedInterface.java b/common/buildcraft/core/gui/GuiAdvancedInterface.java index 2fd8f452..8c7df136 100644 --- a/common/buildcraft/core/gui/GuiAdvancedInterface.java +++ b/common/buildcraft/core/gui/GuiAdvancedInterface.java @@ -45,6 +45,8 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft { if (getItemStack() != null) { drawStack(getItemStack()); } else if (getTexture() != null) { + mc.renderEngine.bindTexture("/gui/items.png"); + System.out.printf("Drawing advanced sprite %s (%d,%d) at %d %d\n", getTexture().getIconName(), getTexture().getOriginX(),getTexture().getOriginY(),cornerX + x, cornerY + y); drawTexturedModelRectFromIcon(cornerX + x, cornerY + y, getTexture(), 16, 16); } diff --git a/common/buildcraft/core/triggers/ActionTriggerIconProvider.java b/common/buildcraft/core/triggers/ActionTriggerIconProvider.java index 3901fd4b..ac1a9a39 100644 --- a/common/buildcraft/core/triggers/ActionTriggerIconProvider.java +++ b/common/buildcraft/core/triggers/ActionTriggerIconProvider.java @@ -7,11 +7,11 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ActionTriggerIconProvider implements IIconProvider { - + public static final int Action_MachineControl_On = 0; public static final int Action_MachineControl_Off = 1; public static final int Action_MachineControl_Loop = 2; - + public static final int Trigger_EngineHeat_Blue = 3; public static final int Trigger_EngineHeat_Green = 4; public static final int Trigger_EngineHeat_Yellow = 5; @@ -43,12 +43,12 @@ public class ActionTriggerIconProvider implements IIconProvider { public static final int MAX = 31; - + @SideOnly(Side.CLIENT) private Icon[] icons; - + private boolean registered = false; - + @Override @SideOnly(Side.CLIENT) public Icon getIcon(int iconIndex) { @@ -58,14 +58,12 @@ public class ActionTriggerIconProvider implements IIconProvider { @Override @SideOnly(Side.CLIENT) public void registerIcons(IconRegister iconRegister) { - if (registered) return; - registered = true; icons = new Icon[MAX]; - + icons[ActionTriggerIconProvider.Action_MachineControl_On] = iconRegister.registerIcon("buildcraft:triggers/action_machinecontrol_on"); icons[ActionTriggerIconProvider.Action_MachineControl_Off] = iconRegister.registerIcon("buildcraft:triggers/action_machinecontrol_off"); icons[ActionTriggerIconProvider.Action_MachineControl_Loop] = iconRegister.registerIcon("buildcraft:triggers/action_machinecontrol_loop"); - + icons[ActionTriggerIconProvider.Trigger_EngineHeat_Blue] = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_blue"); icons[ActionTriggerIconProvider.Trigger_EngineHeat_Green] = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_green"); icons[ActionTriggerIconProvider.Trigger_EngineHeat_Yellow] = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_yellow"); @@ -94,7 +92,6 @@ public class ActionTriggerIconProvider implements IIconProvider { icons[ActionTriggerIconProvider.Trigger_PipeSignal_Yellow_Inactive] = iconRegister.registerIcon("buildcraft:triggers/trigger_pipesignal_yellow_inactive"); icons[ActionTriggerIconProvider.Trigger_RedstoneInput_Active] = iconRegister.registerIcon("buildcraft:triggers/trigger_redstoneinput_active"); icons[ActionTriggerIconProvider.Trigger_RedstoneInput_Inactive] = iconRegister.registerIcon("buildcraft:triggers/trigger_redstoneinput_inactive"); - } }