fixed render and connection between pipes

There is however an odd error with old pipes updating to the new system.
Since the new pipes are an extend of the old pipes they may thing
themselves as old pipes. breaking them and replacing solves this isssue
This commit is contained in:
Rseifert 2013-04-17 13:48:25 -04:00
parent 2b093d349e
commit a3335491d4
6 changed files with 31 additions and 14 deletions

View file

@ -41,7 +41,7 @@ public class ItemRenderHelper implements IItemRenderer
{
if (item.itemID == FluidMech.blockPipe.blockID || item.itemID == FluidMech.blockGenPipe.blockID)
{
this.renderPipeItem((RenderBlocks) data[0], item.getItemDamage(), type == ItemRenderType.EQUIPPED);
this.renderPipeItem((RenderBlocks) data[0], item, type == ItemRenderType.EQUIPPED);
}
if (item.itemID == FluidMech.blockReleaseValve.blockID)
{
@ -50,11 +50,11 @@ public class ItemRenderHelper implements IItemRenderer
}
public void renderPipeItem(RenderBlocks renderer, int meta, boolean equ)
public void renderPipeItem(RenderBlocks renderer, ItemStack item, boolean equ)
{
GL11.glPushMatrix();
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(RenderPipe.getPipeTexture(meta)));
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(RenderPipe.getPipeTexture(item.getItemDamage(),item.itemID == FluidMech.blockPipe.blockID)));
if (!equ)
{
@ -77,7 +77,7 @@ public class ItemRenderHelper implements IItemRenderer
public void renderReleaseValve(RenderBlocks renderer, int meta, boolean equ)
{
GL11.glPushMatrix();
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(RenderPipe.getPipeTexture(15)));
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(RenderPipe.getPipeTexture(15,false)));
if (!equ)
{
GL11.glTranslatef(0.5F, -0.5F, 0.5F);

View file

@ -14,6 +14,7 @@ import universalelectricity.core.vector.Vector3;
import fluidmech.client.model.ModelLargePipe;
import fluidmech.common.FluidMech;
import fluidmech.common.machines.pipes.IPipeExtention;
import fluidmech.common.machines.pipes.TileEntityGenericPipe;
import fluidmech.common.machines.pipes.TileEntityPipe;
public class RenderPipe extends TileEntitySpecialRenderer
@ -40,6 +41,8 @@ public class RenderPipe extends TileEntitySpecialRenderer
meta = te.getBlockMetadata();
TileEntityPipe pipe = ((TileEntityPipe) te);
this.renderSide = pipe.renderConnection;
// Pipes extension rendering
for (int i = 0; i < 6; i++)
{
IPipeExtention extention = (IPipeExtention) pipe.subEntities[i];
@ -68,7 +71,7 @@ public class RenderPipe extends TileEntitySpecialRenderer
}
}
}
this.render(meta, renderSide);
this.render(te, meta, renderSide);
GL11.glPopMatrix();
}
@ -78,9 +81,9 @@ public class RenderPipe extends TileEntitySpecialRenderer
this.bindTextureByName(texture);
}
public static String getPipeTexture(int meta, Object... og)
public static String getPipeTexture(int meta, boolean bool)
{
if (og != null && og.length > 0 && og[0] instanceof TileEntityPipe && FluidRestrictionHandler.hasRestrictedStack(meta))
if (bool && FluidRestrictionHandler.hasRestrictedStack(meta))
{
LiquidStack stack = FluidRestrictionHandler.getStackForColor(ColorCode.get(meta));
String name = LiquidDictionary.findLiquidName(stack);
@ -92,9 +95,14 @@ public class RenderPipe extends TileEntitySpecialRenderer
return FluidMech.MODEL_TEXTURE_DIRECTORY + "pipes/" + ColorCode.get(meta).getName() + "Pipe.png";
}
public void render(int meta, boolean[] side)
public void render(TileEntity entity, int meta, boolean[] side)
{
bindTextureByName(this.getPipeTexture(meta));
boolean bool = true;
if (entity instanceof TileEntityGenericPipe)
{
bool = false;
}
bindTextureByName(this.getPipeTexture(meta, bool));
if (side[0])
{
SixPipe.renderBottom();

View file

@ -18,7 +18,7 @@ public class RenderPipeWindow implements IPipeExtentionRender
@Override
public void renderAModelAt(RenderPipe renderPipe, TileEntityPipe pipe, Vector3 location, float size, ForgeDirection facingDirection)
{
renderPipe.bindTextureForPipe(renderPipe.getPipeTexture(0));
renderPipe.bindTextureForPipe(renderPipe.getPipeTexture(0,false));
this.render(facingDirection.ordinal());
System.out.println("Rendered Window Pipe");

View file

@ -80,6 +80,10 @@ public class BlockPipe extends BlockAdvanced
@Override
public TileEntity createNewTileEntity(World var1)
{
if(this.blockID == FluidMech.blockGenPipe.blockID)
{
return new TileEntityGenericPipe();
}
return new TileEntityPipe();
}
@ -87,7 +91,8 @@ public class BlockPipe extends BlockAdvanced
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
return new ItemStack(FluidMech.blockPipe, 1, meta);
int blockID = world.getBlockId(x, y, z);
return new ItemStack(blockID, 1, meta);
}
@Override

View file

@ -53,5 +53,9 @@ public class TileEntityGenericPipe extends TileEntityPipe
{
return FluidHelper.getDefaultFlowRate(stack);
}
@Override
public ColorCode getColor()
{
return ColorCode.NONE;
}
}

View file

@ -528,7 +528,7 @@ public class TileEntityPipe extends TileEntityAdvanced implements ITankContainer
@Override
public boolean canPipeConnect(TileEntity entity, ForgeDirection dir)
{
return this.subEntities[dir.ordinal()] == null;
return entity != null && this.subEntities[dir.ordinal()] == null;
}
@Override