Fix ledger Icons

This commit is contained in:
Krapht 2013-03-21 00:24:41 +01:00
parent d23562f1e3
commit c352bc53ad
6 changed files with 65 additions and 8 deletions

View file

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

View file

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

View file

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

View file

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

View file

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