From 12de71213a6a91e44cff7c6f3b9bd3a856c8c080 Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Thu, 27 Jun 2013 13:10:01 -0700 Subject: [PATCH] Convert Pipe Icon Prov to enum And fixed a issue with the PowerProvider casting objects to TileEntities that aren't TileEntities. Fixed by adding a getWorldObj() function to IPowerReceptor. --- .../buildcraft/api/power/IPowerReceptor.java | 3 + .../buildcraft/api/power/PowerProvider.java | 7 +- common/buildcraft/core/TileBuildCraft.java | 1 + .../transport/BlockGenericPipe.java | 2 +- common/buildcraft/transport/Pipe.java | 4 + .../transport/PipeIconProvider.java | 169 +++++++----------- .../transport/pipes/PipeItemsCobblestone.java | 2 +- .../transport/pipes/PipeItemsDiamond.java | 14 +- .../transport/pipes/PipeItemsEmerald.java | 4 +- .../transport/pipes/PipeItemsGold.java | 2 +- .../transport/pipes/PipeItemsIron.java | 6 +- .../transport/pipes/PipeItemsObsidian.java | 2 +- .../transport/pipes/PipeItemsQuartz.java | 2 +- .../transport/pipes/PipeItemsSandstone.java | 2 +- .../transport/pipes/PipeItemsStone.java | 2 +- .../transport/pipes/PipeItemsVoid.java | 2 +- .../transport/pipes/PipeItemsWood.java | 4 +- .../pipes/PipeLiquidsCobblestone.java | 2 +- .../transport/pipes/PipeLiquidsEmerald.java | 4 +- .../transport/pipes/PipeLiquidsGold.java | 2 +- .../transport/pipes/PipeLiquidsIron.java | 4 +- .../transport/pipes/PipeLiquidsSandstone.java | 2 +- .../transport/pipes/PipeLiquidsStone.java | 2 +- .../transport/pipes/PipeLiquidsVoid.java | 2 +- .../transport/pipes/PipeLiquidsWood.java | 4 +- .../transport/pipes/PipePowerCobblestone.java | 2 +- .../transport/pipes/PipePowerDiamond.java | 2 +- .../transport/pipes/PipePowerGold.java | 2 +- .../transport/pipes/PipePowerQuartz.java | 2 +- .../transport/pipes/PipePowerStone.java | 2 +- .../transport/pipes/PipePowerWood.java | 4 +- .../pipes/PipeStructureCobblestone.java | 2 +- .../transport/render/FacadeItemRenderer.java | 2 +- .../transport/render/PipeWorldRenderer.java | 6 +- .../transport/render/PlugItemRenderer.java | 2 +- .../transport/render/RenderPipe.java | 4 +- 36 files changed, 126 insertions(+), 154 deletions(-) diff --git a/common/buildcraft/api/power/IPowerReceptor.java b/common/buildcraft/api/power/IPowerReceptor.java index b1eea8fd..8ac71b77 100644 --- a/common/buildcraft/api/power/IPowerReceptor.java +++ b/common/buildcraft/api/power/IPowerReceptor.java @@ -7,6 +7,7 @@ */ package buildcraft.api.power; +import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; public interface IPowerReceptor { @@ -14,4 +15,6 @@ public interface IPowerReceptor { public PowerProvider getPowerProvider(ForgeDirection side); public void doWork(PowerProvider workProvider); + + public World getWorldObj(); } diff --git a/common/buildcraft/api/power/PowerProvider.java b/common/buildcraft/api/power/PowerProvider.java index b2b2a4eb..c2d757ed 100644 --- a/common/buildcraft/api/power/PowerProvider.java +++ b/common/buildcraft/api/power/PowerProvider.java @@ -8,7 +8,6 @@ package buildcraft.api.power; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.ForgeDirection; import buildcraft.api.core.SafeTimeTracker; @@ -141,8 +140,7 @@ public final class PowerProvider { private void applyPerdition() { if (energyStored > 0) { - TileEntity tile = (TileEntity) receptor; - if (energyLossTracker.markTimeIfDelay(tile.worldObj, 10)) { + if (energyLossTracker.markTimeIfDelay(receptor.getWorldObj(), 10)) { float newEnergy = getPerdition().applyPerdition(this, energyStored); if (newEnergy == 0 || newEnergy < energyStored) { energyStored = newEnergy; @@ -155,8 +153,7 @@ public final class PowerProvider { private void applyWork() { if (energyStored >= activationEnergy) { - TileEntity tile = (TileEntity) receptor; - if (doWorkTracker.markTimeIfDelay(tile.worldObj, 1)) { + if (doWorkTracker.markTimeIfDelay(receptor.getWorldObj(), 1)) { receptor.doWork(this); } } diff --git a/common/buildcraft/core/TileBuildCraft.java b/common/buildcraft/core/TileBuildCraft.java index 53745f3e..4a2c7efd 100644 --- a/common/buildcraft/core/TileBuildCraft.java +++ b/common/buildcraft/core/TileBuildCraft.java @@ -22,6 +22,7 @@ import buildcraft.core.network.PacketUpdate; import buildcraft.core.network.TilePacketWrapper; import buildcraft.core.proxy.CoreProxy; import buildcraft.core.utils.Utils; +import net.minecraft.world.World; public abstract class TileBuildCraft extends TileEntity implements ISynchronizedTile { diff --git a/common/buildcraft/transport/BlockGenericPipe.java b/common/buildcraft/transport/BlockGenericPipe.java index 782d56ca..a7e860eb 100644 --- a/common/buildcraft/transport/BlockGenericPipe.java +++ b/common/buildcraft/transport/BlockGenericPipe.java @@ -918,7 +918,7 @@ public class BlockGenericPipe extends BlockContainer { @Override @SideOnly(Side.CLIENT) public Icon getIcon(int par1, int par2) { - return BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.Stripes); + return BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.Stripes.ordinal()); } /** diff --git a/common/buildcraft/transport/Pipe.java b/common/buildcraft/transport/Pipe.java index 5a41bb48..097d432f 100644 --- a/common/buildcraft/transport/Pipe.java +++ b/common/buildcraft/transport/Pipe.java @@ -728,5 +728,9 @@ public abstract class Pipe implements IPipe, IDropControlInventory { fixedTriggers = true; } + + public World getWorldObj(){ + return worldObj; + } } diff --git a/common/buildcraft/transport/PipeIconProvider.java b/common/buildcraft/transport/PipeIconProvider.java index e5786ecb..cedf1ade 100644 --- a/common/buildcraft/transport/PipeIconProvider.java +++ b/common/buildcraft/transport/PipeIconProvider.java @@ -7,115 +7,82 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class PipeIconProvider implements IIconProvider { - - public static final int PipeStructureCobblestone = 0; - public static final int PipeItemsCobbleStone = 1; - public static final int PipeItemsDiamond_Center = 2; - public static final int PipeItemsDiamond_Down = 3; - public static final int PipeItemsDiamond_Up = 4; - public static final int PipeItemsDiamond_North = 5; - public static final int PipeItemsDiamond_South = 6; - public static final int PipeItemsDiamond_West = 7; - public static final int PipeItemsDiamond_East = 8; - public static final int PipeItemsWood_Standard = 9; - public static final int PipeAllWood_Solid = 10; - public static final int PipeItemsEmerald_Standard = 11; - public static final int PipeAllEmerald_Solid = 12; - public static final int PipeItemsGold = 13; - public static final int PipeItemsIron_Standard = 14; - public static final int PipeAllIron_Solid = 15; - public static final int PipeItemsObsidian = 16; - public static final int PipeItemsSandstone = 17; - public static final int PipeItemsStone = 18; - public static final int PipeItemsVoid = 19; - public static final int PipeLiquidsCobblestone = 20; - public static final int PipeLiquidsWood_Standard = 21; - public static final int PipeLiquidsEmerald_Standard = 22; - public static final int PipeLiquidsGold = 23; - public static final int PipeLiquidsIron_Standard = 24; - public static final int PipeLiquidsSandstone = 25; - public static final int PipeLiquidsStone = 26; - public static final int PipeLiquidsVoid = 27; - public static final int PipePowerGold = 28; - public static final int PipePowerStone = 29; - public static final int PipePowerWood_Standard = 30; - - public static final int Power_Normal = 31; - public static final int Power_Overload = 32; - - public static final int Stripes = 33; - - public static final int PipePowerCobblestone = 34; - public static final int PipePowerDiamond = 35; - public static final int PipePowerQuartz = 36; - public static final int PipeItemsQuartz = 37; - - public static final int MAX = 38; - - - @SideOnly(Side.CLIENT) - private Icon[] _icons; + + public enum TYPE { + + PipeStructureCobblestone("pipeStructureCobblestone"), + // + PipeItemsCobbleStone("pipeItemsCobblestone"), + // + PipeItemsDiamond_Center("pipeItemsDiamond_center"), + PipeItemsDiamond_Down("pipeItemsDiamond_down"), + PipeItemsDiamond_Up("pipeItemsDiamond_up"), + PipeItemsDiamond_North("pipeItemsDiamond_north"), + PipeItemsDiamond_South("pipeItemsDiamond_south"), + PipeItemsDiamond_West("pipeItemsDiamond_west"), + PipeItemsDiamond_East("pipeItemsDiamond_east"), + // + PipeItemsWood_Standard("pipeItemsWood_standard"), + PipeAllWood_Solid("pipeAllWood_solid"), + // + PipeItemsEmerald_Standard("pipeItemsEmerald_standard"), + PipeAllEmerald_Solid("pipeAllEmerald_solid"), + // + PipeItemsGold("pipeItemsGold"), + // + PipeItemsIron_Standard("pipeItemsIron_standard"), + PipeAllIron_Solid("pipeAllIron_solid"), + // + PipeItemsObsidian("pipeItemsObsidian"), + PipeItemsSandstone("pipeItemsSandstone"), + PipeItemsStone("pipeItemsStone"), + PipeItemsQuartz("pipeItemsQuartz"), + PipeItemsVoid("pipeItemsVoid"), + // + PipeLiquidsCobblestone("pipeLiquidsCobblestone"), + PipeLiquidsWood_Standard("pipeLiquidsWood_standard"), + PipeLiquidsEmerald_Standard("pipeLiquidsEmerald_standard"), + PipeLiquidsGold("pipeLiquidsGold"), + PipeLiquidsIron_Standard("pipeLiquidsIron_standard"), + PipeLiquidsSandstone("pipeLiquidsSandstone"), + PipeLiquidsStone("pipeLiquidsStone"), + PipeLiquidsVoid("pipeLiquidsVoid"), + // + PipePowerDiamond("pipePowerDiamond"), + PipePowerGold("pipePowerGold"), + PipePowerQuartz("pipePowerQuartz"), + PipePowerStone("pipePowerStone"), + PipePowerCobblestone("pipePowerCobblestone"), + PipePowerWood_Standard("pipePowerWood_standard"), + // + Power_Normal("texture_cyan"), + Power_Overload("texture_red_lit"), + Stripes("pipeStripes"); + // + public static final TYPE[] VALUES = values(); + private final String iconTag; + private Icon icon; + + private TYPE(String iconTag) { + this.iconTag = iconTag; + } + + private void registerIcon(IconRegister iconRegister) { + icon = iconRegister.registerIcon("buildcraft:" + iconTag); + } + } @Override @SideOnly(Side.CLIENT) public Icon getIcon(int pipeIconIndex) { - return _icons[pipeIconIndex]; + return TYPE.VALUES[pipeIconIndex].icon; } @Override @SideOnly(Side.CLIENT) public void registerIcons(IconRegister iconRegister) { - - _icons = new Icon[PipeIconProvider.MAX]; - - _icons[PipeIconProvider.PipeStructureCobblestone] = iconRegister.registerIcon("buildcraft:pipeStructureCobblestone"); - - _icons[PipeIconProvider.PipeItemsCobbleStone] = iconRegister.registerIcon("buildcraft:pipeItemsCobblestone"); - - _icons[PipeIconProvider.PipeItemsDiamond_Center] = iconRegister.registerIcon("buildcraft:pipeItemsDiamond_center"); - _icons[PipeIconProvider.PipeItemsDiamond_Down] = iconRegister.registerIcon("buildcraft:pipeItemsDiamond_down"); - _icons[PipeIconProvider.PipeItemsDiamond_Up] = iconRegister.registerIcon("buildcraft:pipeItemsDiamond_up"); - _icons[PipeIconProvider.PipeItemsDiamond_North] = iconRegister.registerIcon("buildcraft:pipeItemsDiamond_north"); - _icons[PipeIconProvider.PipeItemsDiamond_South] = iconRegister.registerIcon("buildcraft:pipeItemsDiamond_south"); - _icons[PipeIconProvider.PipeItemsDiamond_West] = iconRegister.registerIcon("buildcraft:pipeItemsDiamond_west"); - _icons[PipeIconProvider.PipeItemsDiamond_East] = iconRegister.registerIcon("buildcraft:pipeItemsDiamond_east"); - - _icons[PipeIconProvider.PipeItemsWood_Standard] = iconRegister.registerIcon("buildcraft:pipeItemsWood_standard"); - _icons[PipeIconProvider.PipeAllWood_Solid] = iconRegister.registerIcon("buildcraft:pipeAllWood_solid"); - - _icons[PipeIconProvider.PipeItemsEmerald_Standard] = iconRegister.registerIcon("buildcraft:pipeItemsEmerald_standard"); - _icons[PipeIconProvider.PipeAllEmerald_Solid] = iconRegister.registerIcon("buildcraft:pipeAllEmerald_solid"); - - _icons[PipeIconProvider.PipeItemsGold] = iconRegister.registerIcon("buildcraft:pipeItemsGold"); - - _icons[PipeIconProvider.PipeItemsIron_Standard] = iconRegister.registerIcon("buildcraft:pipeItemsIron_standard"); - _icons[PipeIconProvider.PipeAllIron_Solid] = iconRegister.registerIcon("buildcraft:pipeAllIron_solid"); - - _icons[PipeIconProvider.PipeItemsObsidian] = iconRegister.registerIcon("buildcraft:pipeItemsObsidian"); - _icons[PipeIconProvider.PipeItemsSandstone] = iconRegister.registerIcon("buildcraft:pipeItemsSandstone"); - _icons[PipeIconProvider.PipeItemsStone] = iconRegister.registerIcon("buildcraft:pipeItemsStone"); - _icons[PipeIconProvider.PipeItemsQuartz] = iconRegister.registerIcon("buildcraft:pipeItemsQuartz"); - _icons[PipeIconProvider.PipeItemsVoid] = iconRegister.registerIcon("buildcraft:pipeItemsVoid"); - - _icons[PipeIconProvider.PipeLiquidsCobblestone] = iconRegister.registerIcon("buildcraft:pipeLiquidsCobblestone"); - _icons[PipeIconProvider.PipeLiquidsWood_Standard] = iconRegister.registerIcon("buildcraft:pipeLiquidsWood_standard"); - _icons[PipeIconProvider.PipeLiquidsEmerald_Standard] = iconRegister.registerIcon("buildcraft:pipeLiquidsEmerald_standard"); - _icons[PipeIconProvider.PipeLiquidsGold] = iconRegister.registerIcon("buildcraft:pipeLiquidsGold"); - _icons[PipeIconProvider.PipeLiquidsIron_Standard] = iconRegister.registerIcon("buildcraft:pipeLiquidsIron_standard"); - _icons[PipeIconProvider.PipeLiquidsSandstone] = iconRegister.registerIcon("buildcraft:pipeLiquidsSandstone"); - _icons[PipeIconProvider.PipeLiquidsStone] = iconRegister.registerIcon("buildcraft:pipeLiquidsStone"); - _icons[PipeIconProvider.PipeLiquidsVoid] = iconRegister.registerIcon("buildcraft:pipeLiquidsVoid"); - - _icons[PipeIconProvider.PipePowerDiamond] = iconRegister.registerIcon("buildcraft:pipePowerDiamond"); - _icons[PipeIconProvider.PipePowerGold] = iconRegister.registerIcon("buildcraft:pipePowerGold"); - _icons[PipeIconProvider.PipePowerQuartz] = iconRegister.registerIcon("buildcraft:pipePowerQuartz"); - _icons[PipeIconProvider.PipePowerStone] = iconRegister.registerIcon("buildcraft:pipePowerStone"); - _icons[PipeIconProvider.PipePowerCobblestone] = iconRegister.registerIcon("buildcraft:pipePowerCobblestone"); - _icons[PipeIconProvider.PipePowerWood_Standard] = iconRegister.registerIcon("buildcraft:pipePowerWood_standard"); - - _icons[PipeIconProvider.Power_Normal] = iconRegister.registerIcon("buildcraft:texture_cyan"); - _icons[PipeIconProvider.Power_Overload] = iconRegister.registerIcon("buildcraft:texture_red_lit"); - _icons[PipeIconProvider.Stripes] = iconRegister.registerIcon("buildcraft:pipeStripes"); + for (TYPE type : TYPE.VALUES) { + type.registerIcon(iconRegister); + } } - } diff --git a/common/buildcraft/transport/pipes/PipeItemsCobblestone.java b/common/buildcraft/transport/pipes/PipeItemsCobblestone.java index 2f693abe..5c8dca15 100644 --- a/common/buildcraft/transport/pipes/PipeItemsCobblestone.java +++ b/common/buildcraft/transport/pipes/PipeItemsCobblestone.java @@ -32,7 +32,7 @@ public class PipeItemsCobblestone extends Pipe { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipeItemsCobbleStone; + return PipeIconProvider.TYPE.PipeItemsCobbleStone.ordinal(); } } diff --git a/common/buildcraft/transport/pipes/PipeItemsDiamond.java b/common/buildcraft/transport/pipes/PipeItemsDiamond.java index e8f2abac..bef5814f 100644 --- a/common/buildcraft/transport/pipes/PipeItemsDiamond.java +++ b/common/buildcraft/transport/pipes/PipeItemsDiamond.java @@ -45,13 +45,13 @@ public class PipeItemsDiamond extends Pipe implements IPipeTransportItemsHook, I @Override public int getIconIndex(ForgeDirection direction) { switch(direction){ - case UNKNOWN: return PipeIconProvider.PipeItemsDiamond_Center; - case DOWN: return PipeIconProvider.PipeItemsDiamond_Down; - case UP: return PipeIconProvider.PipeItemsDiamond_Up; - case NORTH: return PipeIconProvider.PipeItemsDiamond_North; - case SOUTH: return PipeIconProvider.PipeItemsDiamond_South; - case WEST: return PipeIconProvider.PipeItemsDiamond_West; - case EAST: return PipeIconProvider.PipeItemsDiamond_East; + case UNKNOWN: return PipeIconProvider.TYPE.PipeItemsDiamond_Center.ordinal(); + case DOWN: return PipeIconProvider.TYPE.PipeItemsDiamond_Down.ordinal(); + case UP: return PipeIconProvider.TYPE.PipeItemsDiamond_Up.ordinal(); + case NORTH: return PipeIconProvider.TYPE.PipeItemsDiamond_North.ordinal(); + case SOUTH: return PipeIconProvider.TYPE.PipeItemsDiamond_South.ordinal(); + case WEST: return PipeIconProvider.TYPE.PipeItemsDiamond_West.ordinal(); + case EAST: return PipeIconProvider.TYPE.PipeItemsDiamond_East.ordinal(); default: throw new IllegalArgumentException("direction out of bounds"); } } diff --git a/common/buildcraft/transport/pipes/PipeItemsEmerald.java b/common/buildcraft/transport/pipes/PipeItemsEmerald.java index b1bfe351..4af248e1 100644 --- a/common/buildcraft/transport/pipes/PipeItemsEmerald.java +++ b/common/buildcraft/transport/pipes/PipeItemsEmerald.java @@ -40,8 +40,8 @@ public class PipeItemsEmerald extends PipeItemsWood implements ISpecialInventory protected PipeItemsEmerald(int itemID, PipeTransportItems transport) { super(transport, new PipeLogicEmerald(), itemID); - standardIconIndex = PipeIconProvider.PipeItemsEmerald_Standard; - solidIconIndex = PipeIconProvider.PipeAllEmerald_Solid; + standardIconIndex = PipeIconProvider.TYPE.PipeItemsEmerald_Standard.ordinal(); + solidIconIndex = PipeIconProvider.TYPE.PipeAllEmerald_Solid.ordinal(); } public PipeItemsEmerald(int itemID) { diff --git a/common/buildcraft/transport/pipes/PipeItemsGold.java b/common/buildcraft/transport/pipes/PipeItemsGold.java index d39653a7..7e89fb09 100644 --- a/common/buildcraft/transport/pipes/PipeItemsGold.java +++ b/common/buildcraft/transport/pipes/PipeItemsGold.java @@ -37,7 +37,7 @@ public class PipeItemsGold extends Pipe implements IPipeTransportItemsHook { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipeItemsGold; + return PipeIconProvider.TYPE.PipeItemsGold.ordinal(); } @Override diff --git a/common/buildcraft/transport/pipes/PipeItemsIron.java b/common/buildcraft/transport/pipes/PipeItemsIron.java index 8fd64a62..949b1e3b 100644 --- a/common/buildcraft/transport/pipes/PipeItemsIron.java +++ b/common/buildcraft/transport/pipes/PipeItemsIron.java @@ -19,8 +19,8 @@ import cpw.mods.fml.relauncher.SideOnly; public class PipeItemsIron extends Pipe { - private int standardIconIndex = PipeIconProvider.PipeItemsIron_Standard; - private int solidIconIndex = PipeIconProvider.PipeAllIron_Solid; + private int standardIconIndex = PipeIconProvider.TYPE.PipeItemsIron_Standard.ordinal(); + private int solidIconIndex = PipeIconProvider.TYPE.PipeAllIron_Solid.ordinal(); public PipeItemsIron(int itemID) { super(new PipeTransportItems(), new PipeLogicIron(), itemID); @@ -35,7 +35,7 @@ public class PipeItemsIron extends Pipe { else { int metadata = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); - if (metadata == direction.ordinal()) + if (metadata != direction.ordinal()) return solidIconIndex; else return standardIconIndex; diff --git a/common/buildcraft/transport/pipes/PipeItemsObsidian.java b/common/buildcraft/transport/pipes/PipeItemsObsidian.java index de173bf9..c72df02e 100644 --- a/common/buildcraft/transport/pipes/PipeItemsObsidian.java +++ b/common/buildcraft/transport/pipes/PipeItemsObsidian.java @@ -63,7 +63,7 @@ public class PipeItemsObsidian extends Pipe implements IPowerReceptor { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipeItemsObsidian; + return PipeIconProvider.TYPE.PipeItemsObsidian.ordinal(); } @Override diff --git a/common/buildcraft/transport/pipes/PipeItemsQuartz.java b/common/buildcraft/transport/pipes/PipeItemsQuartz.java index c7ff6ba0..8a4fe7b9 100644 --- a/common/buildcraft/transport/pipes/PipeItemsQuartz.java +++ b/common/buildcraft/transport/pipes/PipeItemsQuartz.java @@ -37,7 +37,7 @@ public class PipeItemsQuartz extends Pipe implements IPipeTransportItemsHook { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipeItemsQuartz; + return PipeIconProvider.TYPE.PipeItemsQuartz.ordinal(); } @Override diff --git a/common/buildcraft/transport/pipes/PipeItemsSandstone.java b/common/buildcraft/transport/pipes/PipeItemsSandstone.java index dd2a79e6..84c2d63e 100644 --- a/common/buildcraft/transport/pipes/PipeItemsSandstone.java +++ b/common/buildcraft/transport/pipes/PipeItemsSandstone.java @@ -31,6 +31,6 @@ public class PipeItemsSandstone extends Pipe { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipeItemsSandstone; + return PipeIconProvider.TYPE.PipeItemsSandstone.ordinal(); } } diff --git a/common/buildcraft/transport/pipes/PipeItemsStone.java b/common/buildcraft/transport/pipes/PipeItemsStone.java index 0b07ac2d..86029578 100644 --- a/common/buildcraft/transport/pipes/PipeItemsStone.java +++ b/common/buildcraft/transport/pipes/PipeItemsStone.java @@ -38,7 +38,7 @@ public class PipeItemsStone extends Pipe implements IPipeTransportItemsHook { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipeItemsStone; + return PipeIconProvider.TYPE.PipeItemsStone.ordinal(); } @Override diff --git a/common/buildcraft/transport/pipes/PipeItemsVoid.java b/common/buildcraft/transport/pipes/PipeItemsVoid.java index 225aa334..90271b02 100644 --- a/common/buildcraft/transport/pipes/PipeItemsVoid.java +++ b/common/buildcraft/transport/pipes/PipeItemsVoid.java @@ -36,7 +36,7 @@ public class PipeItemsVoid extends Pipe implements IItemTravelingHook { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipeItemsVoid; + return PipeIconProvider.TYPE.PipeItemsVoid.ordinal(); } // This is called if the void pipe is only connected to one pipe diff --git a/common/buildcraft/transport/pipes/PipeItemsWood.java b/common/buildcraft/transport/pipes/PipeItemsWood.java index 17c0fef7..42794dc2 100644 --- a/common/buildcraft/transport/pipes/PipeItemsWood.java +++ b/common/buildcraft/transport/pipes/PipeItemsWood.java @@ -33,8 +33,8 @@ import cpw.mods.fml.relauncher.SideOnly; public class PipeItemsWood extends Pipe implements IPowerReceptor { protected PowerProvider powerProvider; - protected int standardIconIndex = PipeIconProvider.PipeItemsWood_Standard; - protected int solidIconIndex = PipeIconProvider.PipeAllWood_Solid; + protected int standardIconIndex = PipeIconProvider.TYPE.PipeItemsWood_Standard.ordinal(); + protected int solidIconIndex = PipeIconProvider.TYPE.PipeAllWood_Solid.ordinal(); protected PipeItemsWood(PipeTransportItems transport, PipeLogic logic, int itemID) { super(transport, logic, itemID); diff --git a/common/buildcraft/transport/pipes/PipeLiquidsCobblestone.java b/common/buildcraft/transport/pipes/PipeLiquidsCobblestone.java index ff9fca16..c4354404 100644 --- a/common/buildcraft/transport/pipes/PipeLiquidsCobblestone.java +++ b/common/buildcraft/transport/pipes/PipeLiquidsCobblestone.java @@ -31,6 +31,6 @@ public class PipeLiquidsCobblestone extends Pipe { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipeLiquidsCobblestone; + return PipeIconProvider.TYPE.PipeLiquidsCobblestone.ordinal(); } } diff --git a/common/buildcraft/transport/pipes/PipeLiquidsEmerald.java b/common/buildcraft/transport/pipes/PipeLiquidsEmerald.java index 6b8e1726..feec1f9d 100644 --- a/common/buildcraft/transport/pipes/PipeLiquidsEmerald.java +++ b/common/buildcraft/transport/pipes/PipeLiquidsEmerald.java @@ -20,8 +20,8 @@ public class PipeLiquidsEmerald extends PipeLiquidsWood { public PipeLiquidsEmerald(int itemID) { super(new PipeLogicEmerald(), itemID); - standardIconIndex = PipeIconProvider.PipeLiquidsEmerald_Standard; - solidIconIndex = PipeIconProvider.PipeAllEmerald_Solid; + standardIconIndex = PipeIconProvider.TYPE.PipeLiquidsEmerald_Standard.ordinal(); + solidIconIndex = PipeIconProvider.TYPE.PipeAllEmerald_Solid.ordinal(); ((PipeTransportLiquids) transport).flowRate = 40; ((PipeTransportLiquids) transport).travelDelay = 4; diff --git a/common/buildcraft/transport/pipes/PipeLiquidsGold.java b/common/buildcraft/transport/pipes/PipeLiquidsGold.java index dfe2372f..664c1d8c 100644 --- a/common/buildcraft/transport/pipes/PipeLiquidsGold.java +++ b/common/buildcraft/transport/pipes/PipeLiquidsGold.java @@ -34,7 +34,7 @@ public class PipeLiquidsGold extends Pipe { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipeLiquidsGold; + return PipeIconProvider.TYPE.PipeLiquidsGold.ordinal(); } } diff --git a/common/buildcraft/transport/pipes/PipeLiquidsIron.java b/common/buildcraft/transport/pipes/PipeLiquidsIron.java index a7cf4990..a634416a 100644 --- a/common/buildcraft/transport/pipes/PipeLiquidsIron.java +++ b/common/buildcraft/transport/pipes/PipeLiquidsIron.java @@ -19,8 +19,8 @@ import cpw.mods.fml.relauncher.SideOnly; public class PipeLiquidsIron extends Pipe { - protected int standardIconIndex = PipeIconProvider.PipeLiquidsIron_Standard; - protected int solidIconIndex = PipeIconProvider.PipeAllIron_Solid; + protected int standardIconIndex = PipeIconProvider.TYPE.PipeLiquidsIron_Standard.ordinal(); + protected int solidIconIndex = PipeIconProvider.TYPE.PipeAllIron_Solid.ordinal(); public PipeLiquidsIron(int itemID) { diff --git a/common/buildcraft/transport/pipes/PipeLiquidsSandstone.java b/common/buildcraft/transport/pipes/PipeLiquidsSandstone.java index b787858c..65fbf405 100644 --- a/common/buildcraft/transport/pipes/PipeLiquidsSandstone.java +++ b/common/buildcraft/transport/pipes/PipeLiquidsSandstone.java @@ -34,7 +34,7 @@ public class PipeLiquidsSandstone extends Pipe implements IPipeTransportLiquidsH @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipeLiquidsSandstone; + return PipeIconProvider.TYPE.PipeLiquidsSandstone.ordinal(); } @Override diff --git a/common/buildcraft/transport/pipes/PipeLiquidsStone.java b/common/buildcraft/transport/pipes/PipeLiquidsStone.java index 51e8c37f..cd18c34d 100644 --- a/common/buildcraft/transport/pipes/PipeLiquidsStone.java +++ b/common/buildcraft/transport/pipes/PipeLiquidsStone.java @@ -33,7 +33,7 @@ public class PipeLiquidsStone extends Pipe { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipeLiquidsStone; + return PipeIconProvider.TYPE.PipeLiquidsStone.ordinal(); } } diff --git a/common/buildcraft/transport/pipes/PipeLiquidsVoid.java b/common/buildcraft/transport/pipes/PipeLiquidsVoid.java index 56665e95..8640e00e 100644 --- a/common/buildcraft/transport/pipes/PipeLiquidsVoid.java +++ b/common/buildcraft/transport/pipes/PipeLiquidsVoid.java @@ -34,7 +34,7 @@ public class PipeLiquidsVoid extends Pipe implements IPipeTransportLiquidsHook { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipeLiquidsVoid; + return PipeIconProvider.TYPE.PipeLiquidsVoid.ordinal(); } @Override diff --git a/common/buildcraft/transport/pipes/PipeLiquidsWood.java b/common/buildcraft/transport/pipes/PipeLiquidsWood.java index 7ada3d95..a95dba46 100644 --- a/common/buildcraft/transport/pipes/PipeLiquidsWood.java +++ b/common/buildcraft/transport/pipes/PipeLiquidsWood.java @@ -34,8 +34,8 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor { private PowerProvider powerProvider; - protected int standardIconIndex = PipeIconProvider.PipeLiquidsWood_Standard; - protected int solidIconIndex = PipeIconProvider.PipeAllWood_Solid; + protected int standardIconIndex = PipeIconProvider.TYPE.PipeLiquidsWood_Standard.ordinal(); + protected int solidIconIndex = PipeIconProvider.TYPE.PipeAllWood_Solid.ordinal(); long lastMining = 0; boolean lastPower = false; diff --git a/common/buildcraft/transport/pipes/PipePowerCobblestone.java b/common/buildcraft/transport/pipes/PipePowerCobblestone.java index 151dbee9..b8ed7ab3 100644 --- a/common/buildcraft/transport/pipes/PipePowerCobblestone.java +++ b/common/buildcraft/transport/pipes/PipePowerCobblestone.java @@ -31,6 +31,6 @@ public class PipePowerCobblestone extends Pipe { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipePowerCobblestone; + return PipeIconProvider.TYPE.PipePowerCobblestone.ordinal(); } } diff --git a/common/buildcraft/transport/pipes/PipePowerDiamond.java b/common/buildcraft/transport/pipes/PipePowerDiamond.java index b60caab8..54f8103b 100644 --- a/common/buildcraft/transport/pipes/PipePowerDiamond.java +++ b/common/buildcraft/transport/pipes/PipePowerDiamond.java @@ -31,6 +31,6 @@ public class PipePowerDiamond extends Pipe { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipePowerDiamond; + return PipeIconProvider.TYPE.PipePowerDiamond.ordinal(); } } diff --git a/common/buildcraft/transport/pipes/PipePowerGold.java b/common/buildcraft/transport/pipes/PipePowerGold.java index b8a8dcd4..920b55ab 100644 --- a/common/buildcraft/transport/pipes/PipePowerGold.java +++ b/common/buildcraft/transport/pipes/PipePowerGold.java @@ -31,6 +31,6 @@ public class PipePowerGold extends Pipe { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipePowerGold; + return PipeIconProvider.TYPE.PipePowerGold.ordinal(); } } diff --git a/common/buildcraft/transport/pipes/PipePowerQuartz.java b/common/buildcraft/transport/pipes/PipePowerQuartz.java index 6a3f5bdb..c80678aa 100644 --- a/common/buildcraft/transport/pipes/PipePowerQuartz.java +++ b/common/buildcraft/transport/pipes/PipePowerQuartz.java @@ -31,6 +31,6 @@ public class PipePowerQuartz extends Pipe { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipePowerQuartz; + return PipeIconProvider.TYPE.PipePowerQuartz.ordinal(); } } diff --git a/common/buildcraft/transport/pipes/PipePowerStone.java b/common/buildcraft/transport/pipes/PipePowerStone.java index e98c7c92..8d2236c8 100644 --- a/common/buildcraft/transport/pipes/PipePowerStone.java +++ b/common/buildcraft/transport/pipes/PipePowerStone.java @@ -31,6 +31,6 @@ public class PipePowerStone extends Pipe { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipePowerStone; + return PipeIconProvider.TYPE.PipePowerStone.ordinal(); } } diff --git a/common/buildcraft/transport/pipes/PipePowerWood.java b/common/buildcraft/transport/pipes/PipePowerWood.java index 4cb69a56..bcdcc74a 100644 --- a/common/buildcraft/transport/pipes/PipePowerWood.java +++ b/common/buildcraft/transport/pipes/PipePowerWood.java @@ -22,8 +22,8 @@ import net.minecraft.nbt.NBTTagCompound; public class PipePowerWood extends Pipe implements IPowerReceptor { private PowerProvider powerProvider; - protected int standardIconIndex = PipeIconProvider.PipePowerWood_Standard; - protected int solidIconIndex = PipeIconProvider.PipeAllWood_Solid; + protected int standardIconIndex = PipeIconProvider.TYPE.PipePowerWood_Standard.ordinal(); + protected int solidIconIndex = PipeIconProvider.TYPE.PipeAllWood_Solid.ordinal(); private boolean[] powerSources = new boolean[6]; private boolean full; diff --git a/common/buildcraft/transport/pipes/PipeStructureCobblestone.java b/common/buildcraft/transport/pipes/PipeStructureCobblestone.java index 450051ba..f5e6b4f6 100644 --- a/common/buildcraft/transport/pipes/PipeStructureCobblestone.java +++ b/common/buildcraft/transport/pipes/PipeStructureCobblestone.java @@ -23,6 +23,6 @@ public class PipeStructureCobblestone extends Pipe { @Override public int getIconIndex(ForgeDirection direction) { - return PipeIconProvider.PipeStructureCobblestone; + return PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal(); } } diff --git a/common/buildcraft/transport/render/FacadeItemRenderer.java b/common/buildcraft/transport/render/FacadeItemRenderer.java index a53da19f..92238b8b 100644 --- a/common/buildcraft/transport/render/FacadeItemRenderer.java +++ b/common/buildcraft/transport/render/FacadeItemRenderer.java @@ -62,7 +62,7 @@ public class FacadeItemRenderer implements IItemRenderer { // Render StructurePipe block = BuildCraftTransport.genericPipeBlock; - Icon textureID = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.PipeStructureCobblestone); // Structure pipe + Icon textureID = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal()); // Structure pipe block.setBlockBounds(Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMaxPos, Utils.pipeMaxPos, Utils.pipeMaxPos - 1F / 16F); block.setBlockBoundsForItemRender(); diff --git a/common/buildcraft/transport/render/PipeWorldRenderer.java b/common/buildcraft/transport/render/PipeWorldRenderer.java index e8c6b6f8..90de08b0 100644 --- a/common/buildcraft/transport/render/PipeWorldRenderer.java +++ b/common/buildcraft/transport/render/PipeWorldRenderer.java @@ -267,7 +267,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler { zeroState[2][0] = Utils.pipeMinPos; zeroState[2][1] = Utils.pipeMaxPos; - state.currentTexture = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.PipeStructureCobblestone); // Structure Pipe + state.currentTexture = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal()); // Structure Pipe for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { if (state.facadeMatrix.getFacadeBlockId(direction) != 0 && !state.pipeConnectionMatrix.isConnected(direction)) { @@ -296,7 +296,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler { zeroState[2][0] = 0.25F + zFightOffset; zeroState[2][1] = 0.75F - zFightOffset; - state.currentTexture = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.PipeStructureCobblestone); // Structure Pipe + state.currentTexture = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal()); // Structure Pipe for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { if (state.plugMatrix.isConnected(direction)) { @@ -319,7 +319,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler { zeroState[2][0] = 0.25F + 0.125F/2; zeroState[2][1] = 0.75F - 0.125F/2; - state.currentTexture = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.PipeStructureCobblestone); // Structure Pipe + state.currentTexture = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal()); // Structure Pipe for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { if (state.plugMatrix.isConnected(direction)) { diff --git a/common/buildcraft/transport/render/PlugItemRenderer.java b/common/buildcraft/transport/render/PlugItemRenderer.java index 7fabb646..c50f768d 100644 --- a/common/buildcraft/transport/render/PlugItemRenderer.java +++ b/common/buildcraft/transport/render/PlugItemRenderer.java @@ -20,7 +20,7 @@ public class PlugItemRenderer implements IItemRenderer{ Tessellator tessellator = Tessellator.instance; block = BuildCraftTransport.genericPipeBlock; - Icon textureID = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.PipeStructureCobblestone); // Structure pipe + Icon textureID = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal()); // Structure pipe block.setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.375F, 0.75F); block.setBlockBoundsForItemRender(); diff --git a/common/buildcraft/transport/render/RenderPipe.java b/common/buildcraft/transport/render/RenderPipe.java index 228180d5..52bc862a 100644 --- a/common/buildcraft/transport/render/RenderPipe.java +++ b/common/buildcraft/transport/render/RenderPipe.java @@ -196,7 +196,7 @@ public class RenderPipe extends TileEntitySpecialRenderer { initialized = true; BlockInterface block = new BlockInterface(); - block.texture = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.Power_Normal); + block.texture = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.Power_Normal.ordinal()); float size = Utils.pipeMaxPos - Utils.pipeMinPos; @@ -222,7 +222,7 @@ public class RenderPipe extends TileEntitySpecialRenderer { GL11.glEndList(); } - block.texture = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.Power_Overload); + block.texture = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.Power_Overload.ordinal()); size = Utils.pipeMaxPos - Utils.pipeMinPos;