From 3507cb1b0f46c57707c1a3c6ec616c66022e05d5 Mon Sep 17 00:00:00 2001 From: Krapht Date: Tue, 19 Mar 2013 23:00:47 +0100 Subject: [PATCH 1/3] Fix Engine model texture binding --- common/buildcraft/energy/render/RenderEngine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/buildcraft/energy/render/RenderEngine.java b/common/buildcraft/energy/render/RenderEngine.java index 1d513876..304a211b 100644 --- a/common/buildcraft/energy/render/RenderEngine.java +++ b/common/buildcraft/energy/render/RenderEngine.java @@ -192,7 +192,7 @@ public class RenderEngine extends TileEntitySpecialRenderer implements IInventor break; } - tileEntityRenderer.renderEngine.func_98187_b(texture); + bindTextureByName(texture); trunk.render(factor); From d23562f1e391f92f1fe75b6ad0bbcb3aaa8cfdc0 Mon Sep 17 00:00:00 2001 From: Krapht Date: Thu, 21 Mar 2013 00:22:07 +0100 Subject: [PATCH 2/3] Uncaps method name (sorry Flow) --- common/buildcraft/api/core/IIconProvider.java | 2 +- .../buildcraft/core/triggers/ActionTriggerIconProvider.java | 2 +- common/buildcraft/transport/BlockGenericPipe.java | 6 +++--- common/buildcraft/transport/GateIconProvider.java | 2 +- common/buildcraft/transport/ItemGate.java | 4 ++-- common/buildcraft/transport/PipeIconProvider.java | 2 +- common/buildcraft/transport/WireIconProvider.java | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/common/buildcraft/api/core/IIconProvider.java b/common/buildcraft/api/core/IIconProvider.java index dc259761..04833918 100644 --- a/common/buildcraft/api/core/IIconProvider.java +++ b/common/buildcraft/api/core/IIconProvider.java @@ -19,6 +19,6 @@ public interface IIconProvider { * @param iconRegister */ @SideOnly(Side.CLIENT) - public void RegisterIcons(IconRegister iconRegister); + public void registerIcons(IconRegister iconRegister); } diff --git a/common/buildcraft/core/triggers/ActionTriggerIconProvider.java b/common/buildcraft/core/triggers/ActionTriggerIconProvider.java index 3f6b56f9..a7cff883 100644 --- a/common/buildcraft/core/triggers/ActionTriggerIconProvider.java +++ b/common/buildcraft/core/triggers/ActionTriggerIconProvider.java @@ -57,7 +57,7 @@ public class ActionTriggerIconProvider implements IIconProvider { @Override @SideOnly(Side.CLIENT) - public void RegisterIcons(IconRegister iconRegister) { + public void registerIcons(IconRegister iconRegister) { if (registered) return; registered = true; icons = new Icon[MAX]; diff --git a/common/buildcraft/transport/BlockGenericPipe.java b/common/buildcraft/transport/BlockGenericPipe.java index 57135ff4..acf9a9c1 100644 --- a/common/buildcraft/transport/BlockGenericPipe.java +++ b/common/buildcraft/transport/BlockGenericPipe.java @@ -889,12 +889,12 @@ public class BlockGenericPipe extends BlockContainer { skippedFirstIconRegister = true; return; } - BuildCraftTransport.instance.gateIconProvider.RegisterIcons(iconRegister); - BuildCraftTransport.instance.wireIconProvider.RegisterIcons(iconRegister); + BuildCraftTransport.instance.gateIconProvider.registerIcons(iconRegister); + BuildCraftTransport.instance.wireIconProvider.registerIcons(iconRegister); for (int i : pipes.keySet()){ Pipe dummyPipe = createPipe(i); if (dummyPipe != null){ - dummyPipe.getIconProvider().RegisterIcons(iconRegister); + dummyPipe.getIconProvider().registerIcons(iconRegister); } } } diff --git a/common/buildcraft/transport/GateIconProvider.java b/common/buildcraft/transport/GateIconProvider.java index b3a2e257..085f4519 100644 --- a/common/buildcraft/transport/GateIconProvider.java +++ b/common/buildcraft/transport/GateIconProvider.java @@ -53,7 +53,7 @@ public class GateIconProvider implements IIconProvider { @Override @SideOnly(Side.CLIENT) - public void RegisterIcons(IconRegister iconRegister) { + public void registerIcons(IconRegister iconRegister) { if (registered) return; registered = true; diff --git a/common/buildcraft/transport/ItemGate.java b/common/buildcraft/transport/ItemGate.java index e203db61..e9f06863 100644 --- a/common/buildcraft/transport/ItemGate.java +++ b/common/buildcraft/transport/ItemGate.java @@ -118,12 +118,12 @@ public class ItemGate extends ItemBuildCraft { for (IAction action : ActionManager.actions){ if (action == null) continue; - action.getIconProvider().RegisterIcons(iconRegister); + action.getIconProvider().registerIcons(iconRegister); } for (ITrigger trigger : ActionManager.triggers){ if (trigger == null) continue; - trigger.getIconProvider().RegisterIcons(iconRegister); + trigger.getIconProvider().registerIcons(iconRegister); } icons = new Icon[ItemGate.MAX]; diff --git a/common/buildcraft/transport/PipeIconProvider.java b/common/buildcraft/transport/PipeIconProvider.java index 156a3f0d..f302d29b 100644 --- a/common/buildcraft/transport/PipeIconProvider.java +++ b/common/buildcraft/transport/PipeIconProvider.java @@ -58,7 +58,7 @@ public class PipeIconProvider implements IIconProvider { @Override @SideOnly(Side.CLIENT) - public void RegisterIcons(IconRegister iconRegister) { + public void registerIcons(IconRegister iconRegister) { if (registered) return; registered = true; diff --git a/common/buildcraft/transport/WireIconProvider.java b/common/buildcraft/transport/WireIconProvider.java index 332becf3..45579d9b 100644 --- a/common/buildcraft/transport/WireIconProvider.java +++ b/common/buildcraft/transport/WireIconProvider.java @@ -32,7 +32,7 @@ public class WireIconProvider implements IIconProvider { @Override @SideOnly(Side.CLIENT) - public void RegisterIcons(IconRegister iconRegister) { + public void registerIcons(IconRegister iconRegister) { if (registered) return; registered = true; From c352bc53ad0c1dfc31849e0a6cc58f87f4ee84b6 Mon Sep 17 00:00:00 2001 From: Krapht Date: Thu, 21 Mar 2013 00:24:41 +0100 Subject: [PATCH 3/3] Fix ledger Icons --- .../icons/{guiicons_0_0.png => energy.png} | Bin common/buildcraft/BuildCraftCore.java | 18 ++++++++++ common/buildcraft/core/CoreIconProvider.java | 32 ++++++++++++++++++ common/buildcraft/energy/gui/GuiEngine.java | 11 +++--- .../gui/GuiAssemblyAdvancedWorkbench.java | 6 +++- .../silicon/gui/GuiAssemblyTable.java | 6 +++- 6 files changed, 65 insertions(+), 8 deletions(-) rename buildcraft_resources/mods/buildcraft/textures/items/icons/{guiicons_0_0.png => energy.png} (100%) create mode 100644 common/buildcraft/core/CoreIconProvider.java diff --git a/buildcraft_resources/mods/buildcraft/textures/items/icons/guiicons_0_0.png b/buildcraft_resources/mods/buildcraft/textures/items/icons/energy.png similarity index 100% rename from buildcraft_resources/mods/buildcraft/textures/items/icons/guiicons_0_0.png rename to buildcraft_resources/mods/buildcraft/textures/items/icons/energy.png diff --git a/common/buildcraft/BuildCraftCore.java b/common/buildcraft/BuildCraftCore.java index 9f19a24b..c342b888 100644 --- a/common/buildcraft/BuildCraftCore.java +++ b/common/buildcraft/BuildCraftCore.java @@ -19,6 +19,7 @@ import net.minecraft.entity.EntityList; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; +import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.Configuration; import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.Property; @@ -34,6 +35,7 @@ import buildcraft.core.DefaultProps; import buildcraft.core.EntityEnergyLaser; import buildcraft.core.EntityPowerLaser; import buildcraft.core.EntityRobot; +import buildcraft.core.CoreIconProvider; import buildcraft.core.ItemBuildCraft; import buildcraft.core.ItemWrench; import buildcraft.core.RedstonePowerFramework; @@ -77,6 +79,7 @@ import cpw.mods.fml.common.registry.TickRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.ForgeSubscribe; @Mod(name = "BuildCraft", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Core", dependencies = "required-after:Forge@[6.5.0.0,)") @NetworkMod(channels = { DefaultProps.NET_CHANNEL_NAME }, packetHandler = PacketHandler.class, clientSideRequired = true, serverSideRequired = true) @@ -124,6 +127,9 @@ public class BuildCraftCore { public static Icon stripesLaserTexture; @SideOnly(Side.CLIENT) public static Icon transparentTexture; + + @SideOnly(Side.CLIENT) + public static IIconProvider iconProvider; public static int blockByEntityModel; public static int legacyPipeModel; @@ -252,6 +258,9 @@ public class BuildCraftCore { diamondGearItem = (new ItemBuildCraft(diamondGearId.getInt())).setUnlocalizedName("diamondGearItem"); LanguageRegistry.addName(diamondGearItem, "Diamond Gear"); + + MinecraftForge.EVENT_BUS.register(this); + } finally { if (mainConfiguration.hasChanged()) { mainConfiguration.save(); @@ -307,6 +316,15 @@ public class BuildCraftCore { public void serverStarting(FMLServerStartingEvent event) { event.registerServerCommand(new CommandBuildCraft()); } + + @ForgeSubscribe + @SideOnly(Side.CLIENT) + public void textureHook(TextureStitchEvent.Pre event){ + if ("items".equals(event.map.field_94253_b)){ + iconProvider = new CoreIconProvider(); + iconProvider.registerIcons(event.map); + } + } public void loadRecipes() { GameRegistry.addRecipe(new ItemStack(wrenchItem), "I I", " G ", " I ", Character.valueOf('I'), Item.ingotIron, Character.valueOf('G'), stoneGearItem); diff --git a/common/buildcraft/core/CoreIconProvider.java b/common/buildcraft/core/CoreIconProvider.java new file mode 100644 index 00000000..2140265e --- /dev/null +++ b/common/buildcraft/core/CoreIconProvider.java @@ -0,0 +1,32 @@ +package buildcraft.core; + +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.util.Icon; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import buildcraft.api.core.IIconProvider; + +public class CoreIconProvider implements IIconProvider { + + public static int ENERGY = 0; + + public static int MAX = 1; + + private Icon[] _icons; + + @Override + @SideOnly(Side.CLIENT) + public Icon getIcon(int iconIndex) { + return _icons[iconIndex]; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister iconRegister) { + _icons = new Icon[MAX]; + + _icons[ENERGY] = iconRegister.func_94245_a("buildcraft:icons/energy"); + + } + +} diff --git a/common/buildcraft/energy/gui/GuiEngine.java b/common/buildcraft/energy/gui/GuiEngine.java index aa2a0929..8a92a2f3 100644 --- a/common/buildcraft/energy/gui/GuiEngine.java +++ b/common/buildcraft/energy/gui/GuiEngine.java @@ -1,10 +1,9 @@ package buildcraft.energy.gui; -import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; -import buildcraft.BuildCraftTransport; -import buildcraft.core.DefaultProps; +import buildcraft.BuildCraftCore; +import buildcraft.core.CoreIconProvider; import buildcraft.core.gui.BuildCraftContainer; import buildcraft.core.gui.GuiBuildCraft; import buildcraft.core.utils.StringUtil; @@ -33,8 +32,8 @@ public abstract class GuiEngine extends GuiBuildCraft { drawBackground(x, y); // Draw icon - drawIcon(DefaultProps.TEXTURE_ICONS, 0, x + 3, y + 4); - //drawIcon(BuildCraftTransport.instance.wireIconProvider.getIcon(0), x + 3, y + 4); + Minecraft.getMinecraft().renderEngine.func_98187_b("/gui/items.png"); + drawIcon(BuildCraftCore.iconProvider.getIcon(CoreIconProvider.ENERGY), x + 3, y + 4); if (!isFullyOpened()) return; diff --git a/common/buildcraft/silicon/gui/GuiAssemblyAdvancedWorkbench.java b/common/buildcraft/silicon/gui/GuiAssemblyAdvancedWorkbench.java index cdbca78a..4a20b5f7 100644 --- a/common/buildcraft/silicon/gui/GuiAssemblyAdvancedWorkbench.java +++ b/common/buildcraft/silicon/gui/GuiAssemblyAdvancedWorkbench.java @@ -1,5 +1,6 @@ package buildcraft.silicon.gui; +import net.minecraft.client.Minecraft; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -7,7 +8,9 @@ import net.minecraft.item.crafting.IRecipe; import org.lwjgl.opengl.GL11; +import buildcraft.BuildCraftCore; import buildcraft.core.DefaultProps; +import buildcraft.core.CoreIconProvider; import buildcraft.core.gui.GuiAdvancedInterface; import buildcraft.core.utils.StringUtil; import buildcraft.silicon.TileAssemblyAdvancedWorkbench; @@ -30,7 +33,8 @@ public class GuiAssemblyAdvancedWorkbench extends GuiAdvancedInterface { drawBackground(x, y); // Draw icon - drawIcon(DefaultProps.TEXTURE_ICONS, 0, x + 3, y + 4); + Minecraft.getMinecraft().renderEngine.func_98187_b("/gui/items.png"); + drawIcon(BuildCraftCore.iconProvider.getIcon(CoreIconProvider.ENERGY), x + 3, y + 4); if (!isFullyOpened()) return; diff --git a/common/buildcraft/silicon/gui/GuiAssemblyTable.java b/common/buildcraft/silicon/gui/GuiAssemblyTable.java index 0192b6fd..51980ba3 100644 --- a/common/buildcraft/silicon/gui/GuiAssemblyTable.java +++ b/common/buildcraft/silicon/gui/GuiAssemblyTable.java @@ -12,13 +12,16 @@ package buildcraft.silicon.gui; import java.util.Iterator; import java.util.LinkedList; +import net.minecraft.client.Minecraft; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import org.lwjgl.opengl.GL11; +import buildcraft.BuildCraftCore; import buildcraft.api.recipes.AssemblyRecipe; import buildcraft.core.DefaultProps; +import buildcraft.core.CoreIconProvider; import buildcraft.core.gui.GuiAdvancedInterface; import buildcraft.core.network.PacketCoordinates; import buildcraft.core.network.PacketIds; @@ -50,7 +53,8 @@ public class GuiAssemblyTable extends GuiAdvancedInterface { drawBackground(x, y); // Draw icon - drawIcon(DefaultProps.TEXTURE_ICONS, 0, x + 3, y + 4); + Minecraft.getMinecraft().renderEngine.func_98187_b("/gui/items.png"); + drawIcon(BuildCraftCore.iconProvider.getIcon(CoreIconProvider.ENERGY), x + 3, y + 4); if (!isFullyOpened()) return;