Merge pull request #2 from BuildCraft/mc1.5

update
This commit is contained in:
viliml 2013-03-21 10:58:37 -07:00
commit 6cb6aa55ca
14 changed files with 76 additions and 19 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

@ -19,6 +19,6 @@ public interface IIconProvider {
* @param iconRegister
*/
@SideOnly(Side.CLIENT)
public void RegisterIcons(IconRegister iconRegister);
public void registerIcons(IconRegister iconRegister);
}

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

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

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

@ -192,7 +192,7 @@ public class RenderEngine extends TileEntitySpecialRenderer implements IInventor
break;
}
tileEntityRenderer.renderEngine.func_98187_b(texture);
bindTextureByName(texture);
trunk.render(factor);

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;

View file

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

View file

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

View file

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

View file

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

View file

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