Removed remaining usage of ITextureProvider

This commit is contained in:
Krapht 2012-08-11 18:44:24 +02:00
parent c1f189f931
commit 5971330432
6 changed files with 21 additions and 48 deletions

View file

@ -56,25 +56,18 @@ public class GuiCombustionEngine extends GuiEngine {
} }
private void displayGauge(int j, int k, int line, int col, int squaled, int liquidId) { private void displayGauge(int j, int k, int line, int col, int squaled, int liquidId) {
Object o = null;
int liquidImgIndex = 0; int liquidImgIndex = 0;
if (liquidId < Block.blocksList.length && Block.blocksList[liquidId] != null) { if (liquidId < Block.blocksList.length && Block.blocksList[liquidId] != null) {
o = Block.blocksList[liquidId]; MinecraftForgeClient.bindTexture(Block.blocksList[liquidId].getTextureFile());
liquidImgIndex = Block.blocksList[liquidId].blockIndexInTexture; liquidImgIndex = Block.blocksList[liquidId].blockIndexInTexture;
} else if (Item.itemsList[liquidId] != null) { } else if (Item.itemsList[liquidId] != null) {
o = Item.itemsList[liquidId]; MinecraftForgeClient.bindTexture(Item.itemsList[liquidId].getTextureFile());
liquidImgIndex = Item.itemsList[liquidId].getIconFromDamage(0); liquidImgIndex = Item.itemsList[liquidId].getIconFromDamage(0);
} else {
return;
} }
if (o == null)
return;
if (o instanceof ITextureProvider)
MinecraftForgeClient.bindTexture(((ITextureProvider) o).getTextureFile());
else
MinecraftForgeClient.bindTexture("/terrain.png");
int imgLine = liquidImgIndex / 16; int imgLine = liquidImgIndex / 16;
int imgColumn = liquidImgIndex - imgLine * 16; int imgColumn = liquidImgIndex - imgLine * 16;

View file

@ -16,7 +16,6 @@ import buildcraft.core.TextureLiquidsFX;
public class TextureFuelFX extends TextureLiquidsFX { public class TextureFuelFX extends TextureLiquidsFX {
public TextureFuelFX() { public TextureFuelFX() {
super(150, 250, 150, 250, 0, 10, BuildCraftEnergy.fuel.getIconFromDamage(0), ((ITextureProvider) BuildCraftEnergy.fuel) super(150, 250, 150, 250, 0, 10, BuildCraftEnergy.fuel.getIconFromDamage(0), BuildCraftEnergy.fuel.getTextureFile());
.getTextureFile());
} }
} }

View file

@ -16,7 +16,6 @@ import buildcraft.core.TextureLiquidsFX;
public class TextureOilFX extends TextureLiquidsFX { public class TextureOilFX extends TextureLiquidsFX {
public TextureOilFX() { public TextureOilFX() {
super(10, 31, 10, 31, 10, 31, BuildCraftEnergy.oilStill.blockIndexInTexture, super(10, 31, 10, 31, 10, 31, BuildCraftEnergy.oilStill.blockIndexInTexture, BuildCraftEnergy.oilStill.getTextureFile());
((ITextureProvider) BuildCraftEnergy.oilStill).getTextureFile());
} }
} }

View file

@ -250,16 +250,10 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent
} }
public void setTextureFor(int liquidId) { public void setTextureFor(int liquidId) {
Object o = null; if (liquidId < Block.blocksList.length && Block.blocksList[liquidId] != null) {
MinecraftForgeClient.bindTexture(Block.blocksList[liquidId].getTextureFile());
if (liquidId < Block.blocksList.length && Block.blocksList[liquidId] != null) } else {
o = Block.blocksList[liquidId]; MinecraftForgeClient.bindTexture(Item.itemsList[liquidId].getTextureFile());
else }
o = Item.itemsList[liquidId];
if (o instanceof ITextureProvider)
MinecraftForgeClient.bindTexture(((ITextureProvider) o).getTextureFile());
else
MinecraftForgeClient.bindTexture("/terrain.png");
} }
} }

View file

@ -82,17 +82,11 @@ public class RenderTank extends TileEntitySpecialRenderer {
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glDisable(2896 /* GL_LIGHTING */); GL11.glDisable(2896 /* GL_LIGHTING */);
Object obj = null; if (liquid.itemID < Block.blocksList.length && Block.blocksList[liquid.itemID] != null) {
MinecraftForgeClient.bindTexture(Block.blocksList[liquid.itemID].getTextureFile());
if (liquid.itemID < Block.blocksList.length && Block.blocksList[liquid.itemID] != null) } else {
obj = Block.blocksList[liquid.itemID]; MinecraftForgeClient.bindTexture(Item.itemsList[liquid.itemID].getTextureFile());
else }
obj = Item.itemsList[liquid.itemID];
if (obj instanceof ITextureProvider)
MinecraftForgeClient.bindTexture(((ITextureProvider) obj).getTextureFile());
else
MinecraftForgeClient.bindTexture("/terrain.png");
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);

View file

@ -381,17 +381,11 @@ public class RenderPipe extends TileEntitySpecialRenderer {
if (liquidId == 0) if (liquidId == 0)
return null; return null;
Object o = null; if (liquidId < Block.blocksList.length && Block.blocksList[liquidId] != null) {
MinecraftForgeClient.bindTexture(Block.blocksList[liquidId].getTextureFile());
if (liquidId < Block.blocksList.length && Block.blocksList[liquidId] != null) } else {
o = Block.blocksList[liquidId]; MinecraftForgeClient.bindTexture(Item.itemsList[liquidId].getTextureFile());
else }
o = Item.itemsList[liquidId];
// should be safe, items and block all implement ITextureProvider now
// and if o is null, something else is wrong somewhere
MinecraftForgeClient.bindTexture(((ITextureProvider) o).getTextureFile());
return getDisplayLiquidLists(liquidId, stack.itemMeta, world); return getDisplayLiquidLists(liquidId, stack.itemMeta, world);
} }