Worked on Trough Pipes

These are designed to be open pipes for very easily tech tiers
This commit is contained in:
DarkGuardsman 2013-12-30 20:21:46 -05:00
parent fba04c02f0
commit b7a88d1786
5 changed files with 87 additions and 56 deletions

View file

@ -155,7 +155,34 @@ public class ModelLargePipe extends ModelBase
FrontConnect.mirror = true;
setRotation(FrontConnect, 0F, 0F, 0F);
}
public void render(boolean[] side)
{
if (side[0])
{
renderBottom();
}
if (side[1])
{
renderTop();
}
if (side[3])
{
renderFront();
}
if (side[2])
{
renderBack();
}
if (side[5])
{
renderRight();
}
if (side[4])
{
renderLeft();
}
renderMiddle();
}
public void renderMiddle()
{
Mid.render(0.0625F);

View file

@ -10,7 +10,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelOpenPipe extends ModelBase
public class ModelOpenTrough extends ModelBase
{
//fields
ModelRenderer base;
@ -51,7 +51,7 @@ public class ModelOpenPipe extends ModelBase
ModelRenderer cornerFrontLeft;
ModelRenderer cornerFrontRight;
public ModelOpenPipe()
public ModelOpenTrough()
{
textureWidth = 128;
textureHeight = 128;
@ -280,9 +280,22 @@ public class ModelOpenPipe extends ModelBase
setRotation(cornerFrontRight, 0F, 0F, 0F);
}
public void renderMiddle(boolean corners)
public void render(boolean[] side, boolean stone)
{
base.render(0.0625F);
if (side != null)
{
renderMiddle(!side[0], stone);
renderBack(side[2] ? PipeType.NORMAL : stone ? PipeType.SOLID : PipeType.MID_CAP);
renderFront(side[3] ? PipeType.NORMAL : stone ? PipeType.SOLID : PipeType.MID_CAP);
renderRight(side[4] ? PipeType.NORMAL : stone ? PipeType.SOLID : PipeType.MID_CAP);
renderLeft(side[5] ? PipeType.NORMAL : stone ? PipeType.SOLID : PipeType.MID_CAP);
}
}
public void renderMiddle(boolean bottom, boolean corners)
{
if (bottom)
base.render(0.0625F);
centerA.render(0.0625F);
centerB.render(0.0625F);
centerC.render(0.0625F);
@ -310,6 +323,7 @@ public class ModelOpenPipe extends ModelBase
if (type == PipeType.SOLID)
{
leftDoorB.render(0.0625F);
leftDoorC.render(0.0625F);
}
}
}
@ -333,6 +347,7 @@ public class ModelOpenPipe extends ModelBase
if (type == PipeType.SOLID)
{
rightDoorB.render(0.0625F);
rightDoorC.render(0.0625F);
}
}
}
@ -356,6 +371,7 @@ public class ModelOpenPipe extends ModelBase
if (type == PipeType.SOLID)
{
backDoorB.render(0.0625F);
backDoorC.render(0.0625F);
}
}
}
@ -379,6 +395,7 @@ public class ModelOpenPipe extends ModelBase
if (type == PipeType.SOLID)
{
frontDoorB.render(0.0625F);
frontDoorC.render(0.0625F);
}
}
}

View file

@ -21,7 +21,6 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemPipeRenderer implements IItemRenderer
{
private ModelReleaseValve valve = new ModelReleaseValve();
private RenderPipe pipe = new RenderPipe();
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
@ -44,55 +43,46 @@ public class ItemPipeRenderer implements IItemRenderer
}
if (item.itemID == ALRecipeLoader.blockReleaseValve.blockID)
{
this.renderReleaseValve((RenderBlocks) data[0], item.getItemDamage(), type == ItemRenderType.EQUIPPED);
this.renderReleaseValve((RenderBlocks) data[0], type == ItemRenderType.EQUIPPED);
}
}
public void renderPipeItem(RenderBlocks renderer, ItemStack item, boolean equ)
{
GL11.glPushMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderPipe.getTexture(FluidPartsMaterial.getFromItemMeta(item.getItemDamage()), item.getItemDamage() % FluidPartsMaterial.spacing));
GL11.glRotatef(180f, 0f, 0f, 1f);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderPipe.getTexture(item.getItemDamage()));
if (!equ)
{
GL11.glTranslatef(0.5F, -0.5F, 0.5F);
pipe.SixPipe.renderRight();
pipe.SixPipe.renderLeft();
pipe.SixPipe.renderMiddle();
RenderPipe.render(item.getItemDamage(), new boolean[] { false, false, false, false, true, true });
}
else
{
GL11.glTranslatef(0.5F, -0.5F, 0.5F);
pipe.SixPipe.renderFront();
pipe.SixPipe.renderBack();
pipe.SixPipe.renderMiddle();
RenderPipe.render(item.getItemDamage(), new boolean[] { false, false, true, true, false, false });
}
GL11.glPopMatrix();
}
public void renderReleaseValve(RenderBlocks renderer, int meta, boolean equ)
public void renderReleaseValve(RenderBlocks renderer, boolean equ)
{
GL11.glPushMatrix();
GL11.glRotatef(180f, 0f, 0f, 1f);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderPipe.getTexture(FluidPartsMaterial.STEEL, 0));
if (!equ)
{
GL11.glTranslatef(0.5F, -0.5F, 0.5F);
pipe.SixPipe.renderRight();
pipe.SixPipe.renderLeft();
pipe.SixPipe.renderMiddle();
RenderPipe.render(FluidPartsMaterial.IRON, 0, new boolean[] { false, false, false, false, true, true });
}
else
{
GL11.glTranslatef(0.5F, -0.5F, 0.5F);
pipe.SixPipe.renderFront();
pipe.SixPipe.renderBack();
pipe.SixPipe.renderMiddle();
RenderPipe.render(FluidPartsMaterial.IRON, 0, new boolean[] { false, false, true, true, false, false });
}
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "ReleaseValve.png"));
GL11.glRotatef(180f, 0f, 0f, 1f);
if (!equ)
{
GL11.glTranslatef(0, -2.0F, 0);
@ -104,5 +94,4 @@ public class ItemPipeRenderer implements IItemRenderer
valve.render();
GL11.glPopMatrix();
}
}

View file

@ -10,6 +10,7 @@ import org.lwjgl.opengl.GL11;
import com.builtbroken.assemblyline.AssemblyLine;
import com.builtbroken.assemblyline.client.model.ModelLargePipe;
import com.builtbroken.assemblyline.client.model.ModelOpenTrough;
import com.builtbroken.assemblyline.fluid.pipes.EnumPipeType;
import com.builtbroken.assemblyline.fluid.pipes.FluidPartsMaterial;
import com.builtbroken.assemblyline.fluid.pipes.TileEntityPipe;
@ -22,15 +23,11 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderPipe extends TileEntitySpecialRenderer
{
public ModelLargePipe SixPipe;
public static ModelLargePipe MODEL_PIPE = new ModelLargePipe();
public static ModelOpenTrough MODEL_TROUGH_PIPE = new ModelOpenTrough();
private static HashMap<Pair<FluidPartsMaterial, Integer>, ResourceLocation> TEXTURES = new HashMap<Pair<FluidPartsMaterial, Integer>, ResourceLocation>();
public static ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "pipes/Pipe.png");
public RenderPipe()
{
SixPipe = new ModelLargePipe();
}
@Override
public void renderTileEntityAt(TileEntity te, double d, double d1, double d2, float f)
{
@ -44,7 +41,7 @@ public class RenderPipe extends TileEntitySpecialRenderer
{
mat = FluidPartsMaterial.values()[te.getBlockMetadata()];
}
bindTexture(RenderPipe.getTexture(mat, 0));
if (te instanceof TileEntityPipe)
{
this.render(mat, ((TileEntityPipe) te).getSubID(), ((TileEntityPipe) te).renderConnection);
@ -76,34 +73,30 @@ public class RenderPipe extends TileEntitySpecialRenderer
return TEXTURE;
}
public void render(FluidPartsMaterial mat, int pipeID, boolean[] side)
public static ResourceLocation getTexture(int meta)
{
bindTexture(RenderPipe.getTexture(mat, pipeID));
if (side[0])
return getTexture(FluidPartsMaterial.getFromItemMeta(meta), FluidPartsMaterial.getType(meta));
}
public static void render(FluidPartsMaterial mat, int pipeID, boolean[] side)
{
if (mat == FluidPartsMaterial.WOOD)
{
SixPipe.renderBottom();
MODEL_TROUGH_PIPE.render(side, false);
}
if (side[1])
else if (mat == FluidPartsMaterial.STONE)
{
SixPipe.renderTop();
MODEL_TROUGH_PIPE.render(side, true);
}
if (side[3])
else
{
SixPipe.renderFront();
MODEL_PIPE.render(side);
}
if (side[2])
{
SixPipe.renderBack();
}
if (side[5])
{
SixPipe.renderRight();
}
if (side[4])
{
SixPipe.renderLeft();
}
SixPipe.renderMiddle();
}
public static void render(int meta, boolean[] bs)
{
render(FluidPartsMaterial.getFromItemMeta(meta), FluidPartsMaterial.getType(meta), bs);
}
}

View file

@ -14,11 +14,11 @@ import com.builtbroken.minecraft.helpers.ColorCode;
/** Enum to hold info about each pipe material. Values are by default and some can change with pipe
* upgrades.
*
*
* @Note unsupportedFluids should only be used by filters. All pipes should allow all fluid types.
* However, pipes that can't support the fluid should have an effect. Eg no gas support should cause
* the pipe to leak. No molten support should cause the pipe to take damage.
*
*
* @author DarkGuardsman */
public enum FluidPartsMaterial
{
@ -143,6 +143,11 @@ public enum FluidPartsMaterial
return this.getMeta(0);
}
public static int getType(int meta)
{
return meta / spacing;
}
public static int getDropItemMeta(World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);