Fix trigger/action rendering

This commit is contained in:
Christian 2013-03-29 20:47:12 -04:00
parent e6633ae6ff
commit 5441e821ad
3 changed files with 14 additions and 15 deletions

View file

@ -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);
}
}

View file

@ -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);
}

View file

@ -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");
}
}