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.
This commit is contained in:
CovertJaguar 2013-06-27 13:10:01 -07:00
parent 42181dbc7f
commit 12de71213a
36 changed files with 126 additions and 154 deletions

View file

@ -7,6 +7,7 @@
*/ */
package buildcraft.api.power; package buildcraft.api.power;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
public interface IPowerReceptor { public interface IPowerReceptor {
@ -14,4 +15,6 @@ public interface IPowerReceptor {
public PowerProvider getPowerProvider(ForgeDirection side); public PowerProvider getPowerProvider(ForgeDirection side);
public void doWork(PowerProvider workProvider); public void doWork(PowerProvider workProvider);
public World getWorldObj();
} }

View file

@ -8,7 +8,6 @@
package buildcraft.api.power; package buildcraft.api.power;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import buildcraft.api.core.SafeTimeTracker; import buildcraft.api.core.SafeTimeTracker;
@ -141,8 +140,7 @@ public final class PowerProvider {
private void applyPerdition() { private void applyPerdition() {
if (energyStored > 0) { if (energyStored > 0) {
TileEntity tile = (TileEntity) receptor; if (energyLossTracker.markTimeIfDelay(receptor.getWorldObj(), 10)) {
if (energyLossTracker.markTimeIfDelay(tile.worldObj, 10)) {
float newEnergy = getPerdition().applyPerdition(this, energyStored); float newEnergy = getPerdition().applyPerdition(this, energyStored);
if (newEnergy == 0 || newEnergy < energyStored) { if (newEnergy == 0 || newEnergy < energyStored) {
energyStored = newEnergy; energyStored = newEnergy;
@ -155,8 +153,7 @@ public final class PowerProvider {
private void applyWork() { private void applyWork() {
if (energyStored >= activationEnergy) { if (energyStored >= activationEnergy) {
TileEntity tile = (TileEntity) receptor; if (doWorkTracker.markTimeIfDelay(receptor.getWorldObj(), 1)) {
if (doWorkTracker.markTimeIfDelay(tile.worldObj, 1)) {
receptor.doWork(this); receptor.doWork(this);
} }
} }

View file

@ -22,6 +22,7 @@ import buildcraft.core.network.PacketUpdate;
import buildcraft.core.network.TilePacketWrapper; import buildcraft.core.network.TilePacketWrapper;
import buildcraft.core.proxy.CoreProxy; import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.Utils; import buildcraft.core.utils.Utils;
import net.minecraft.world.World;
public abstract class TileBuildCraft extends TileEntity implements ISynchronizedTile { public abstract class TileBuildCraft extends TileEntity implements ISynchronizedTile {

View file

@ -918,7 +918,7 @@ public class BlockGenericPipe extends BlockContainer {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public Icon getIcon(int par1, int par2) { public Icon getIcon(int par1, int par2) {
return BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.Stripes); return BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.Stripes.ordinal());
} }
/** /**

View file

@ -728,5 +728,9 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
fixedTriggers = true; fixedTriggers = true;
} }
public World getWorldObj(){
return worldObj;
}
} }

View file

@ -7,115 +7,82 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class PipeIconProvider implements IIconProvider { public class PipeIconProvider implements IIconProvider {
public static final int PipeStructureCobblestone = 0; public enum TYPE {
public static final int PipeItemsCobbleStone = 1;
public static final int PipeItemsDiamond_Center = 2; PipeStructureCobblestone("pipeStructureCobblestone"),
public static final int PipeItemsDiamond_Down = 3; //
public static final int PipeItemsDiamond_Up = 4; PipeItemsCobbleStone("pipeItemsCobblestone"),
public static final int PipeItemsDiamond_North = 5; //
public static final int PipeItemsDiamond_South = 6; PipeItemsDiamond_Center("pipeItemsDiamond_center"),
public static final int PipeItemsDiamond_West = 7; PipeItemsDiamond_Down("pipeItemsDiamond_down"),
public static final int PipeItemsDiamond_East = 8; PipeItemsDiamond_Up("pipeItemsDiamond_up"),
public static final int PipeItemsWood_Standard = 9; PipeItemsDiamond_North("pipeItemsDiamond_north"),
public static final int PipeAllWood_Solid = 10; PipeItemsDiamond_South("pipeItemsDiamond_south"),
public static final int PipeItemsEmerald_Standard = 11; PipeItemsDiamond_West("pipeItemsDiamond_west"),
public static final int PipeAllEmerald_Solid = 12; PipeItemsDiamond_East("pipeItemsDiamond_east"),
public static final int PipeItemsGold = 13; //
public static final int PipeItemsIron_Standard = 14; PipeItemsWood_Standard("pipeItemsWood_standard"),
public static final int PipeAllIron_Solid = 15; PipeAllWood_Solid("pipeAllWood_solid"),
public static final int PipeItemsObsidian = 16; //
public static final int PipeItemsSandstone = 17; PipeItemsEmerald_Standard("pipeItemsEmerald_standard"),
public static final int PipeItemsStone = 18; PipeAllEmerald_Solid("pipeAllEmerald_solid"),
public static final int PipeItemsVoid = 19; //
public static final int PipeLiquidsCobblestone = 20; PipeItemsGold("pipeItemsGold"),
public static final int PipeLiquidsWood_Standard = 21; //
public static final int PipeLiquidsEmerald_Standard = 22; PipeItemsIron_Standard("pipeItemsIron_standard"),
public static final int PipeLiquidsGold = 23; PipeAllIron_Solid("pipeAllIron_solid"),
public static final int PipeLiquidsIron_Standard = 24; //
public static final int PipeLiquidsSandstone = 25; PipeItemsObsidian("pipeItemsObsidian"),
public static final int PipeLiquidsStone = 26; PipeItemsSandstone("pipeItemsSandstone"),
public static final int PipeLiquidsVoid = 27; PipeItemsStone("pipeItemsStone"),
public static final int PipePowerGold = 28; PipeItemsQuartz("pipeItemsQuartz"),
public static final int PipePowerStone = 29; PipeItemsVoid("pipeItemsVoid"),
public static final int PipePowerWood_Standard = 30; //
PipeLiquidsCobblestone("pipeLiquidsCobblestone"),
public static final int Power_Normal = 31; PipeLiquidsWood_Standard("pipeLiquidsWood_standard"),
public static final int Power_Overload = 32; PipeLiquidsEmerald_Standard("pipeLiquidsEmerald_standard"),
PipeLiquidsGold("pipeLiquidsGold"),
public static final int Stripes = 33; PipeLiquidsIron_Standard("pipeLiquidsIron_standard"),
PipeLiquidsSandstone("pipeLiquidsSandstone"),
public static final int PipePowerCobblestone = 34; PipeLiquidsStone("pipeLiquidsStone"),
public static final int PipePowerDiamond = 35; PipeLiquidsVoid("pipeLiquidsVoid"),
public static final int PipePowerQuartz = 36; //
public static final int PipeItemsQuartz = 37; PipePowerDiamond("pipePowerDiamond"),
PipePowerGold("pipePowerGold"),
public static final int MAX = 38; PipePowerQuartz("pipePowerQuartz"),
PipePowerStone("pipePowerStone"),
PipePowerCobblestone("pipePowerCobblestone"),
@SideOnly(Side.CLIENT) PipePowerWood_Standard("pipePowerWood_standard"),
private Icon[] _icons; //
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 @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public Icon getIcon(int pipeIconIndex) { public Icon getIcon(int pipeIconIndex) {
return _icons[pipeIconIndex]; return TYPE.VALUES[pipeIconIndex].icon;
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) { public void registerIcons(IconRegister iconRegister) {
for (TYPE type : TYPE.VALUES) {
_icons = new Icon[PipeIconProvider.MAX]; type.registerIcon(iconRegister);
}
_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");
} }
} }

View file

@ -32,7 +32,7 @@ public class PipeItemsCobblestone extends Pipe {
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipeItemsCobbleStone; return PipeIconProvider.TYPE.PipeItemsCobbleStone.ordinal();
} }
} }

View file

@ -45,13 +45,13 @@ public class PipeItemsDiamond extends Pipe implements IPipeTransportItemsHook, I
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
switch(direction){ switch(direction){
case UNKNOWN: return PipeIconProvider.PipeItemsDiamond_Center; case UNKNOWN: return PipeIconProvider.TYPE.PipeItemsDiamond_Center.ordinal();
case DOWN: return PipeIconProvider.PipeItemsDiamond_Down; case DOWN: return PipeIconProvider.TYPE.PipeItemsDiamond_Down.ordinal();
case UP: return PipeIconProvider.PipeItemsDiamond_Up; case UP: return PipeIconProvider.TYPE.PipeItemsDiamond_Up.ordinal();
case NORTH: return PipeIconProvider.PipeItemsDiamond_North; case NORTH: return PipeIconProvider.TYPE.PipeItemsDiamond_North.ordinal();
case SOUTH: return PipeIconProvider.PipeItemsDiamond_South; case SOUTH: return PipeIconProvider.TYPE.PipeItemsDiamond_South.ordinal();
case WEST: return PipeIconProvider.PipeItemsDiamond_West; case WEST: return PipeIconProvider.TYPE.PipeItemsDiamond_West.ordinal();
case EAST: return PipeIconProvider.PipeItemsDiamond_East; case EAST: return PipeIconProvider.TYPE.PipeItemsDiamond_East.ordinal();
default: throw new IllegalArgumentException("direction out of bounds"); default: throw new IllegalArgumentException("direction out of bounds");
} }
} }

View file

@ -40,8 +40,8 @@ public class PipeItemsEmerald extends PipeItemsWood implements ISpecialInventory
protected PipeItemsEmerald(int itemID, PipeTransportItems transport) { protected PipeItemsEmerald(int itemID, PipeTransportItems transport) {
super(transport, new PipeLogicEmerald(), itemID); super(transport, new PipeLogicEmerald(), itemID);
standardIconIndex = PipeIconProvider.PipeItemsEmerald_Standard; standardIconIndex = PipeIconProvider.TYPE.PipeItemsEmerald_Standard.ordinal();
solidIconIndex = PipeIconProvider.PipeAllEmerald_Solid; solidIconIndex = PipeIconProvider.TYPE.PipeAllEmerald_Solid.ordinal();
} }
public PipeItemsEmerald(int itemID) { public PipeItemsEmerald(int itemID) {

View file

@ -37,7 +37,7 @@ public class PipeItemsGold extends Pipe implements IPipeTransportItemsHook {
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipeItemsGold; return PipeIconProvider.TYPE.PipeItemsGold.ordinal();
} }
@Override @Override

View file

@ -19,8 +19,8 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PipeItemsIron extends Pipe { public class PipeItemsIron extends Pipe {
private int standardIconIndex = PipeIconProvider.PipeItemsIron_Standard; private int standardIconIndex = PipeIconProvider.TYPE.PipeItemsIron_Standard.ordinal();
private int solidIconIndex = PipeIconProvider.PipeAllIron_Solid; private int solidIconIndex = PipeIconProvider.TYPE.PipeAllIron_Solid.ordinal();
public PipeItemsIron(int itemID) { public PipeItemsIron(int itemID) {
super(new PipeTransportItems(), new PipeLogicIron(), itemID); super(new PipeTransportItems(), new PipeLogicIron(), itemID);
@ -35,7 +35,7 @@ public class PipeItemsIron extends Pipe {
else { else {
int metadata = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); int metadata = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
if (metadata == direction.ordinal()) if (metadata != direction.ordinal())
return solidIconIndex; return solidIconIndex;
else else
return standardIconIndex; return standardIconIndex;

View file

@ -63,7 +63,7 @@ public class PipeItemsObsidian extends Pipe implements IPowerReceptor {
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipeItemsObsidian; return PipeIconProvider.TYPE.PipeItemsObsidian.ordinal();
} }
@Override @Override

View file

@ -37,7 +37,7 @@ public class PipeItemsQuartz extends Pipe implements IPipeTransportItemsHook {
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipeItemsQuartz; return PipeIconProvider.TYPE.PipeItemsQuartz.ordinal();
} }
@Override @Override

View file

@ -31,6 +31,6 @@ public class PipeItemsSandstone extends Pipe {
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipeItemsSandstone; return PipeIconProvider.TYPE.PipeItemsSandstone.ordinal();
} }
} }

View file

@ -38,7 +38,7 @@ public class PipeItemsStone extends Pipe implements IPipeTransportItemsHook {
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipeItemsStone; return PipeIconProvider.TYPE.PipeItemsStone.ordinal();
} }
@Override @Override

View file

@ -36,7 +36,7 @@ public class PipeItemsVoid extends Pipe implements IItemTravelingHook {
@Override @Override
public int getIconIndex(ForgeDirection direction) { 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 // This is called if the void pipe is only connected to one pipe

View file

@ -33,8 +33,8 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PipeItemsWood extends Pipe implements IPowerReceptor { public class PipeItemsWood extends Pipe implements IPowerReceptor {
protected PowerProvider powerProvider; protected PowerProvider powerProvider;
protected int standardIconIndex = PipeIconProvider.PipeItemsWood_Standard; protected int standardIconIndex = PipeIconProvider.TYPE.PipeItemsWood_Standard.ordinal();
protected int solidIconIndex = PipeIconProvider.PipeAllWood_Solid; protected int solidIconIndex = PipeIconProvider.TYPE.PipeAllWood_Solid.ordinal();
protected PipeItemsWood(PipeTransportItems transport, PipeLogic logic, int itemID) { protected PipeItemsWood(PipeTransportItems transport, PipeLogic logic, int itemID) {
super(transport, logic, itemID); super(transport, logic, itemID);

View file

@ -31,6 +31,6 @@ public class PipeLiquidsCobblestone extends Pipe {
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipeLiquidsCobblestone; return PipeIconProvider.TYPE.PipeLiquidsCobblestone.ordinal();
} }
} }

View file

@ -20,8 +20,8 @@ public class PipeLiquidsEmerald extends PipeLiquidsWood {
public PipeLiquidsEmerald(int itemID) { public PipeLiquidsEmerald(int itemID) {
super(new PipeLogicEmerald(), itemID); super(new PipeLogicEmerald(), itemID);
standardIconIndex = PipeIconProvider.PipeLiquidsEmerald_Standard; standardIconIndex = PipeIconProvider.TYPE.PipeLiquidsEmerald_Standard.ordinal();
solidIconIndex = PipeIconProvider.PipeAllEmerald_Solid; solidIconIndex = PipeIconProvider.TYPE.PipeAllEmerald_Solid.ordinal();
((PipeTransportLiquids) transport).flowRate = 40; ((PipeTransportLiquids) transport).flowRate = 40;
((PipeTransportLiquids) transport).travelDelay = 4; ((PipeTransportLiquids) transport).travelDelay = 4;

View file

@ -34,7 +34,7 @@ public class PipeLiquidsGold extends Pipe {
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipeLiquidsGold; return PipeIconProvider.TYPE.PipeLiquidsGold.ordinal();
} }
} }

View file

@ -19,8 +19,8 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PipeLiquidsIron extends Pipe { public class PipeLiquidsIron extends Pipe {
protected int standardIconIndex = PipeIconProvider.PipeLiquidsIron_Standard; protected int standardIconIndex = PipeIconProvider.TYPE.PipeLiquidsIron_Standard.ordinal();
protected int solidIconIndex = PipeIconProvider.PipeAllIron_Solid; protected int solidIconIndex = PipeIconProvider.TYPE.PipeAllIron_Solid.ordinal();
public PipeLiquidsIron(int itemID) { public PipeLiquidsIron(int itemID) {

View file

@ -34,7 +34,7 @@ public class PipeLiquidsSandstone extends Pipe implements IPipeTransportLiquidsH
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipeLiquidsSandstone; return PipeIconProvider.TYPE.PipeLiquidsSandstone.ordinal();
} }
@Override @Override

View file

@ -33,7 +33,7 @@ public class PipeLiquidsStone extends Pipe {
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipeLiquidsStone; return PipeIconProvider.TYPE.PipeLiquidsStone.ordinal();
} }
} }

View file

@ -34,7 +34,7 @@ public class PipeLiquidsVoid extends Pipe implements IPipeTransportLiquidsHook {
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipeLiquidsVoid; return PipeIconProvider.TYPE.PipeLiquidsVoid.ordinal();
} }
@Override @Override

View file

@ -34,8 +34,8 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor {
private PowerProvider powerProvider; private PowerProvider powerProvider;
protected int standardIconIndex = PipeIconProvider.PipeLiquidsWood_Standard; protected int standardIconIndex = PipeIconProvider.TYPE.PipeLiquidsWood_Standard.ordinal();
protected int solidIconIndex = PipeIconProvider.PipeAllWood_Solid; protected int solidIconIndex = PipeIconProvider.TYPE.PipeAllWood_Solid.ordinal();
long lastMining = 0; long lastMining = 0;
boolean lastPower = false; boolean lastPower = false;

View file

@ -31,6 +31,6 @@ public class PipePowerCobblestone extends Pipe {
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipePowerCobblestone; return PipeIconProvider.TYPE.PipePowerCobblestone.ordinal();
} }
} }

View file

@ -31,6 +31,6 @@ public class PipePowerDiamond extends Pipe {
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipePowerDiamond; return PipeIconProvider.TYPE.PipePowerDiamond.ordinal();
} }
} }

View file

@ -31,6 +31,6 @@ public class PipePowerGold extends Pipe {
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipePowerGold; return PipeIconProvider.TYPE.PipePowerGold.ordinal();
} }
} }

View file

@ -31,6 +31,6 @@ public class PipePowerQuartz extends Pipe {
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipePowerQuartz; return PipeIconProvider.TYPE.PipePowerQuartz.ordinal();
} }
} }

View file

@ -31,6 +31,6 @@ public class PipePowerStone extends Pipe {
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipePowerStone; return PipeIconProvider.TYPE.PipePowerStone.ordinal();
} }
} }

View file

@ -22,8 +22,8 @@ import net.minecraft.nbt.NBTTagCompound;
public class PipePowerWood extends Pipe implements IPowerReceptor { public class PipePowerWood extends Pipe implements IPowerReceptor {
private PowerProvider powerProvider; private PowerProvider powerProvider;
protected int standardIconIndex = PipeIconProvider.PipePowerWood_Standard; protected int standardIconIndex = PipeIconProvider.TYPE.PipePowerWood_Standard.ordinal();
protected int solidIconIndex = PipeIconProvider.PipeAllWood_Solid; protected int solidIconIndex = PipeIconProvider.TYPE.PipeAllWood_Solid.ordinal();
private boolean[] powerSources = new boolean[6]; private boolean[] powerSources = new boolean[6];
private boolean full; private boolean full;

View file

@ -23,6 +23,6 @@ public class PipeStructureCobblestone extends Pipe {
@Override @Override
public int getIconIndex(ForgeDirection direction) { public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.PipeStructureCobblestone; return PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal();
} }
} }

View file

@ -62,7 +62,7 @@ public class FacadeItemRenderer implements IItemRenderer {
// Render StructurePipe // Render StructurePipe
block = BuildCraftTransport.genericPipeBlock; 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.setBlockBounds(Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMinPos, Utils.pipeMaxPos, Utils.pipeMaxPos, Utils.pipeMaxPos - 1F / 16F);
block.setBlockBoundsForItemRender(); block.setBlockBoundsForItemRender();

View file

@ -267,7 +267,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
zeroState[2][0] = Utils.pipeMinPos; zeroState[2][0] = Utils.pipeMinPos;
zeroState[2][1] = Utils.pipeMaxPos; 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) { for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
if (state.facadeMatrix.getFacadeBlockId(direction) != 0 && !state.pipeConnectionMatrix.isConnected(direction)) { 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][0] = 0.25F + zFightOffset;
zeroState[2][1] = 0.75F - 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) { for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
if (state.plugMatrix.isConnected(direction)) { if (state.plugMatrix.isConnected(direction)) {
@ -319,7 +319,7 @@ public class PipeWorldRenderer implements ISimpleBlockRenderingHandler {
zeroState[2][0] = 0.25F + 0.125F/2; zeroState[2][0] = 0.25F + 0.125F/2;
zeroState[2][1] = 0.75F - 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) { for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
if (state.plugMatrix.isConnected(direction)) { if (state.plugMatrix.isConnected(direction)) {

View file

@ -20,7 +20,7 @@ public class PlugItemRenderer implements IItemRenderer{
Tessellator tessellator = Tessellator.instance; Tessellator tessellator = Tessellator.instance;
block = BuildCraftTransport.genericPipeBlock; 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.setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.375F, 0.75F);
block.setBlockBoundsForItemRender(); block.setBlockBoundsForItemRender();

View file

@ -196,7 +196,7 @@ public class RenderPipe extends TileEntitySpecialRenderer {
initialized = true; initialized = true;
BlockInterface block = new BlockInterface(); 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; float size = Utils.pipeMaxPos - Utils.pipeMinPos;
@ -222,7 +222,7 @@ public class RenderPipe extends TileEntitySpecialRenderer {
GL11.glEndList(); 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; size = Utils.pipeMaxPos - Utils.pipeMinPos;