Jump to content

Recommended Posts

Posted

Hi everyone. What im looking for is how to make pipes. Ok, so let's talk about this. I actually know how to make them, but there are many ways to do so and I can't find the best / don't want to. What I'm trying to do is make a gas pipe, that, obviously, will have its boundingBox and shape changed, based on adjacent connections. And it's fine. My problem is... what's the best way to do it? So, first of all i store 6 booleans in a boolean array (For each direction) and return true if one block is connected on that side. And that's the tileentity. But now, in the render class... what should I use? I can use a techne model but i couldn't choose which parts to render with renderPart(), because that's for obj files i think. And i can't model on Blender so that's excluded. Last thing i could do? Tessellator? Oh, im not good at that.

 

So what im actually looking for is some codes, basic ones to start. I have to say that i have some kind of modding experience, but rendering is the most annoying yet rewarding thing i ever met. It's hard to explain what i actually need, i don't want to look to other mod's source, but I'd like to have some basic render codes. Something to help me.

 

Dammit im bad at writing.

I try my best, so apologies if I said something obviously stupid!

Posted

Alright, so im gonna have to look at source codes then. My main problem is still the network part. I don't get how to add piping / wiring to my custom network, nor how to create it. This is some sort of black magic to me, i've been creating machines only but i've never dealt with pipes and wires.. any suggestions for this problem? :(

 

I could create a wiring system by scratch but i don't know how to make them transmit data / fluids / stuff. Rendering the connections is the easiest thing, even if it's still a bit tricky to do.

I try my best, so apologies if I said something obviously stupid!

Posted

I already looked up your entire mod source on github to see networking. Usually i learn more from source codes than tutorials, but this time i'd love to have my mind cleared, like... how do these work? Because i can't understand them, and i don't wanna copy. That's agaisnt myself, i won't copy. I need to understand how to make one from scratch, and i know i'm asking very much... but my mod needs it.

 

Oh, i forgot to thank you for bothering helping me and trying to decrypt my crap english. Thanks again c:

I try my best, so apologies if I said something obviously stupid!

Posted

You just made me look dumb :o

This doesnt seem easy to explain huh... or at least for me to understand. For me this is too hard, but i need it. Dammit Java is cruel.

I try my best, so apologies if I said something obviously stupid!

Posted

Huh, I guess I am not alone with my obsession with gas and gas pipes.

Rendering pipes is all about detecting which blocks adjacent to your pipe block are also pipes. Then it's just a matter or rendering it based on this data.

Using a tessellator is the most efficient approach, but I guess it can be challenging to work with.

 

Here's an example of how my pipes look:

wiXVvbO.jpg

 

The pipes in my mod use this texture:

2sBtIhx.png

The upper left corner is the texture of the actual pipe.

The upper right corner is the texture of the pipe support (you can see them connected to the ground in the screenshot).

The lower left corner is the texture used for the end of a pipe. You can't see it in the screenshot, but you can understand where it is.

 

The rendering of the pipes isn't actually that advanced. The rendering is very similar to that of a normal block, except each side is indented by 6/16 of a block.

I use the information of which sides to connect to the pipe to decide the corners of each indented face.

I also apply faces for the ends of pipes where it is necessary.

 

Here is the code used to render that:

public class RenderBlockGasPipe implements ISimpleBlockRenderingHandler
{
private IIcon icon;
private double uIconTranslate = 0.0F;
private double vIconTranslate = 0.0F;

private static final int[] xDirection = new int[]{
	0, 0, 1, -1, 0, 0
};
private static final int[] yDirection = new int[]{
	-1, 1, 0, 0, 0, 0
};
private static final int[] zDirection = new int[]{
	0, 0, 0, 0, 1, -1
};

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID,RenderBlocks renderer)
{
	Tessellator tessellator = Tessellator.instance;
	icon = renderer.hasOverrideBlockTexture() ? renderer.overrideBlockTexture : renderer.getBlockIcon(block);

        GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(1.4F, 1.4F, 1.4F);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        
	double d1 = 6.0F / 16.0F;
	double d2 = 10.0F / 16.0F;

        tessellator.startDrawingQuads();
    	
    	uIconTranslate = 0.0D;
    	vIconTranslate = 0.0D;
        tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
        tessellator.setNormal(0.0F, 1.0F, 0.0F);
	tessellator.addVertexWithUV(0.0D, d2, 1.0D, u(0.0D), v(1.0D));
	tessellator.addVertexWithUV(1.0D, d2, 1.0D, u(1.0D), v(1.0D));
	tessellator.addVertexWithUV(1.0D, d2, 0.0D, u(1.0D), v(0.0D));
	tessellator.addVertexWithUV(0.0D, d2, 0.0D, u(0.0D), v(0.0D));

        //tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F);
        tessellator.setNormal(0.0F, -1.0F, 0.0F);
	tessellator.addVertexWithUV(0.0D, d1, 0.0D, u(0.0D), v(0.0D));
	tessellator.addVertexWithUV(1.0D, d1, 0.0D, u(1.0D), v(0.0D));
	tessellator.addVertexWithUV(1.0D, d1, 1.0D, u(1.0D), v(1.0D));
	tessellator.addVertexWithUV(0.0D, d1, 1.0D, u(0.0D), v(1.0D));

	//tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
        tessellator.setNormal(-1.0F, 0.0F, 0.0F);
	tessellator.addVertexWithUV(d1, 0.0D, 1.0D, u(0.0D), v(1.0D));
	tessellator.addVertexWithUV(d1, 1.0D, 1.0D, u(1.0D), v(1.0D));
	tessellator.addVertexWithUV(d1, 1.0D, 0.0D, u(1.0D), v(0.0D));
	tessellator.addVertexWithUV(d1, 0.0D, 0.0D, u(0.0D), v(0.0D));

        tessellator.setNormal(1.0F, 0.0F, 0.0F);
	tessellator.addVertexWithUV(d2, 0.0D, 0.0D, u(0.0D), v(0.0D));
	tessellator.addVertexWithUV(d2, 1.0D, 0.0D, u(1.0D), v(0.0D));
	tessellator.addVertexWithUV(d2, 1.0D, 1.0D, u(1.0D), v(1.0D));
	tessellator.addVertexWithUV(d2, 0.0D, 1.0D, u(0.0D), v(1.0D));

        tessellator.setNormal(0.0F, 0.0F, -1.0F);
	tessellator.addVertexWithUV(0.0D, 1.0D, d1, u(0.0D), v(1.0D));
	tessellator.addVertexWithUV(1.0D, 1.0D, d1, u(1.0D), v(1.0D));
	tessellator.addVertexWithUV(1.0D, 0.0D, d1, u(1.0D), v(0.0D));
	tessellator.addVertexWithUV(0.0D, 0.0D, d1, u(0.0D), v(0.0D));

        tessellator.setNormal(0.0F, 0.0F, 1.0F);
	tessellator.addVertexWithUV(0.0D, 0.0D, d2, u(0.0D), v(0.0D));
	tessellator.addVertexWithUV(1.0D, 0.0D, d2, u(1.0D), v(0.0D));
	tessellator.addVertexWithUV(1.0D, 1.0D, d2, u(1.0D), v(1.0D));
	tessellator.addVertexWithUV(0.0D, 1.0D, d2, u(0.0D), v(1.0D));

	vIconTranslate = 8.0D;
    	
	//tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
        tessellator.setNormal(0.0F, 1.0F, 0.0F);
	tessellator.addVertexWithUV(0.0D, 1.0D, 1.0D, u(0.0D), v(1.0D));
	tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, u(1.0D), v(1.0D));
	tessellator.addVertexWithUV(1.0D, 1.0D, 0.0D, u(1.0D), v(0.0D));
	tessellator.addVertexWithUV(0.0D, 1.0D, 0.0D, u(0.0D), v(0.0D));

	//tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F);
        tessellator.setNormal(0.0F, -1.0F, 0.0F);
	tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, u(0.0D), v(0.0D));
	tessellator.addVertexWithUV(1.0D, 0.0D, 0.0D, u(1.0D), v(0.0D));
	tessellator.addVertexWithUV(1.0D, 0.0D, 1.0D, u(1.0D), v(1.0D));
	tessellator.addVertexWithUV(0.0D, 0.0D, 1.0D, u(0.0D), v(1.0D));

	//tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
        tessellator.setNormal(-1.0F, 0.0F, 0.0F);
	tessellator.addVertexWithUV(0.0D, 0.0D, 1.0D, u(0.0D), v(1.0D));
	tessellator.addVertexWithUV(0.0D, 1.0D, 1.0D, u(1.0D), v(1.0D));
	tessellator.addVertexWithUV(0.0D, 1.0D, 0.0D, u(1.0D), v(0.0D));
	tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, u(0.0D), v(0.0D));

        tessellator.setNormal(1.0F, 0.0F, 0.0F);
	tessellator.addVertexWithUV(1.0D, 0.0D, 0.0D, u(0.0D), v(0.0D));
	tessellator.addVertexWithUV(1.0D, 1.0D, 0.0D, u(1.0D), v(0.0D));
	tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, u(1.0D), v(1.0D));
	tessellator.addVertexWithUV(1.0D, 0.0D, 1.0D, u(0.0D), v(1.0D));

        tessellator.setNormal(0.0F, 0.0F, -1.0F);
	tessellator.addVertexWithUV(0.0D, 1.0D, 0.0D, u(0.0D), v(1.0D));
	tessellator.addVertexWithUV(1.0D, 1.0D, 0.0D, u(1.0D), v(1.0D));
	tessellator.addVertexWithUV(1.0D, 0.0D, 0.0D, u(1.0D), v(0.0D));
	tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, u(0.0D), v(0.0D));

        tessellator.setNormal(0.0F, 0.0F, 1.0F);
	tessellator.addVertexWithUV(0.0D, 0.0D, 1.0D, u(0.0D), v(0.0D));
	tessellator.addVertexWithUV(1.0D, 0.0D, 1.0D, u(1.0D), v(0.0D));
	tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, u(1.0D), v(1.0D));
	tessellator.addVertexWithUV(0.0D, 1.0D, 1.0D, u(0.0D), v(1.0D));

        tessellator.draw();

        GL11.glTranslatef(0.5F, 0.5F, 0.5F);

        GL11.glDisable(GL11.GL_ALPHA_TEST);
}

@Override
public boolean renderWorldBlock(IBlockAccess blockAccess, int x, int y, int z, Block bblock, int modelId, RenderBlocks renderer)
{
	BlockGasPipe block = (BlockGasPipe)bblock;

        int brightness = block.getMixedBrightnessForBlock(blockAccess, x, y, z);
	icon = renderer.hasOverrideBlockTexture() ? renderer.overrideBlockTexture : renderer.getBlockIcon(block);
	Tessellator tessellator = Tessellator.instance;

	final boolean[] sidePipe = new boolean[6];
	final boolean[] sideOpaque = new boolean[6];

	for(int i = 0; i < 6; i++)
	{
		int x1 = x + xDirection[i];
		int y1 = y + yDirection[i];
		int z1 = z + zDirection[i];

		Block directionBlock = blockAccess.getBlock(x1, y1, z1);
		if(directionBlock != Blocks.air)
		{
			sidePipe[i] = directionBlock instanceof BlockGasPipe || IGasReceptor.class.isAssignableFrom(directionBlock.getClass());
			sideOpaque[i] = directionBlock.isOpaqueCube() & !sidePipe[i];
		}
	}

	double d1 = 6.0F / 16.0F;
	double d2 = 10.0F / 16.0F;
	double d3 = 4.5F / 16.0F;
	double d4 = 11.5F / 16.0F;

	boolean collectionAll = sidePipe[0] || sidePipe[1] || sidePipe[2] || sidePipe[3] || sidePipe[4] || sidePipe[5];
	boolean collectionY = sidePipe[2] || sidePipe[3] || sidePipe[4] || sidePipe[5];
	boolean collectionX = sidePipe[0] || sidePipe[1] || sidePipe[4] || sidePipe[5];
	boolean collectionZ = sidePipe[0] || sidePipe[1] || sidePipe[2] || sidePipe[3];

	double minX = (sidePipe[3] | !collectionX) & collectionAll ? 0.0F : d1;
	double maxX = (sidePipe[2] | !collectionX) & collectionAll ? 1.0F : d2;
	double minY = (sidePipe[0] | !collectionY) & collectionAll ? 0.0F : d1;
	double maxY = (sidePipe[1] | !collectionY) & collectionAll ? 1.0F : d2;
	double minZ = (sidePipe[5] | !collectionZ) & collectionAll ? 0.0F : d1;
	double maxZ = (sidePipe[4] | !collectionZ) & collectionAll ? 1.0F : d2;
	/*double minX = sidePipe[2] ? 0.0F : 0.0F;		
	double maxX = sidePipe[2] ? 1.0F : 1.0F;
	double minY = sidePipe[0] ? 0.0F : 0.0F;		
	double maxY = sidePipe[1] ? 1.0F : 1.0F;
	double minZ = sidePipe[4] ? 0.0F : 0.0F;		
	double maxZ = sidePipe[5] ? 1.0F : 1.0F;*/

    	tessellator.setBrightness(brightness);
    	tessellator.addTranslation((float)x, (float)y, (float)z);
    	
    	uIconTranslate = 0.0D;
    	vIconTranslate = 0.0D;
    	
    	tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
    	
    	if(collectionY | !collectionAll)
    	{
    		tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F);
    		tessellator.setNormal(0.0F, -1.0F, 0.0F);
    		tessellator.addVertexWithUV(minX, d1, minZ, u(minX), v(minZ));
    		tessellator.addVertexWithUV(maxX, d1, minZ, u(maxX), v(minZ));
    		tessellator.addVertexWithUV(maxX, d1, maxZ, u(maxX), v(maxZ));
    		tessellator.addVertexWithUV(minX, d1, maxZ, u(minX), v(maxZ));

    		tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
    		tessellator.setNormal(0.0F, 1.0F, 0.0F);
    		tessellator.addVertexWithUV(minX, d2, maxZ, u(minX), v(maxZ));
    		tessellator.addVertexWithUV(maxX, d2, maxZ, u(maxX), v(maxZ));
    		tessellator.addVertexWithUV(maxX, d2, minZ, u(maxX), v(minZ));
    		tessellator.addVertexWithUV(minX, d2, minZ, u(minX), v(minZ));
    	}

    	if(collectionX | !collectionAll)
    	{
    		tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
    		tessellator.setNormal(-1.0F, 0.0F, 0.0F);
    		tessellator.addVertexWithUV(d1, minY, maxZ, u(minY), v(maxZ));
    		tessellator.addVertexWithUV(d1, maxY, maxZ, u(maxY), v(maxZ));
    		tessellator.addVertexWithUV(d1, maxY, minZ, u(maxY), v(minZ));
    		tessellator.addVertexWithUV(d1, minY, minZ, u(minY), v(minZ));

    		tessellator.setNormal(1.0F, 0.0F, 0.0F);
    		tessellator.addVertexWithUV(d2, minY, minZ, u(minY), v(minZ));
    		tessellator.addVertexWithUV(d2, maxY, minZ, u(maxY), v(minZ));
    		tessellator.addVertexWithUV(d2, maxY, maxZ, u(maxY), v(maxZ));
    		tessellator.addVertexWithUV(d2, minY, maxZ, u(minY), v(maxZ));
    	}
    	
    	if(collectionZ | !collectionAll)
    	{
    		tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
    		tessellator.setNormal(0.0F, 0.0F, -1.0F);
    		tessellator.addVertexWithUV(minX, maxY, d1, u(minX), v(maxY));
    		tessellator.addVertexWithUV(maxX, maxY, d1, u(maxX), v(maxY));
    		tessellator.addVertexWithUV(maxX, minY, d1, u(maxX), v(minY));
    		tessellator.addVertexWithUV(minX, minY, d1, u(minX), v(minY));

    		tessellator.setNormal(0.0F, 0.0F, 1.0F);
    		tessellator.addVertexWithUV(minX, minY, d2, u(minX), v(minY));
    		tessellator.addVertexWithUV(maxX, minY, d2, u(maxX), v(minY));
    		tessellator.addVertexWithUV(maxX, maxY, d2, u(maxX), v(maxY));
    		tessellator.addVertexWithUV(minX, maxY, d2, u(minX), v(maxY));
    	}
    	
    	if(collectionAll)
    	{
    		vIconTranslate = 8.0D;
        	
    		if(maxY == 1.0D)
    		{
        		tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
        		tessellator.setNormal(0.0F, 1.0F, 0.0F);
    			tessellator.addVertexWithUV(minX, maxY, maxZ, u(minX), v(maxZ));
        		tessellator.addVertexWithUV(maxX, maxY, maxZ, u(maxX), v(maxZ));
        		tessellator.addVertexWithUV(maxX, maxY, minZ, u(maxX), v(minZ));
        		tessellator.addVertexWithUV(minX, maxY, minZ, u(minX), v(minZ));
    		}
    		
    		if(minY == 0.0D)
    		{
        		tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F);
        		tessellator.setNormal(0.0F, -1.0F, 0.0F);
    			tessellator.addVertexWithUV(minX, minY, minZ, u(minX), v(minZ));
        		tessellator.addVertexWithUV(maxX, minY, minZ, u(maxX), v(minZ));
        		tessellator.addVertexWithUV(maxX, minY, maxZ, u(maxX), v(maxZ));
        		tessellator.addVertexWithUV(minX, minY, maxZ, u(minX), v(maxZ));
    		}
    	
    		tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
    		if(minX == 0.0D)
    		{
        		tessellator.setNormal(-1.0F, 0.0F, 0.0F);
    			tessellator.addVertexWithUV(minX, minY, maxZ, u(minY), v(maxZ));
        		tessellator.addVertexWithUV(minX, maxY, maxZ, u(maxY), v(maxZ));
        		tessellator.addVertexWithUV(minX, maxY, minZ, u(maxY), v(minZ));
        		tessellator.addVertexWithUV(minX, minY, minZ, u(minY), v(minZ));
    		}
    		
    		if(maxX == 1.0D)
    		{
        		tessellator.setNormal(1.0F, 0.0F, 0.0F);
    			tessellator.addVertexWithUV(maxX, minY, minZ, u(minY), v(minZ));
        		tessellator.addVertexWithUV(maxX, maxY, minZ, u(maxY), v(minZ));
        		tessellator.addVertexWithUV(maxX, maxY, maxZ, u(maxY), v(maxZ));
        		tessellator.addVertexWithUV(maxX, minY, maxZ, u(minY), v(maxZ));
    		}
    	
    		tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
    		if(minZ == 0.0D)
    		{
        		tessellator.setNormal(0.0F, 0.0F, -1.0F);
    			tessellator.addVertexWithUV(minX, maxY, minZ, u(minX), v(maxY));
        		tessellator.addVertexWithUV(maxX, maxY, minZ, u(maxX), v(maxY));
        		tessellator.addVertexWithUV(maxX, minY, minZ, u(maxX), v(minY));
        		tessellator.addVertexWithUV(minX, minY, minZ, u(minX), v(minY));
    		}
    		
    		if(maxZ == 1.0D)
    		{
        		tessellator.setNormal(0.0F, 0.0F, 1.0F);
    			tessellator.addVertexWithUV(minX, minY, maxZ, u(minX), v(minY));
        		tessellator.addVertexWithUV(maxX, minY, maxZ, u(maxX), v(minY));
        		tessellator.addVertexWithUV(maxX, maxY, maxZ, u(maxX), v(maxY));
        		tessellator.addVertexWithUV(minX, maxY, maxZ, u(minX), v(maxY));
    		}
    		
    		if(((x ^ y ^ z) & 1) > 0)
    		{
    			uIconTranslate = 8.0D;
            	vIconTranslate = 0.0D;
            	
            	minX = sideOpaque[3] ? 0.0F : d1;
        		maxX = sideOpaque[2] ? 1.0F : d2;
        		minY = sideOpaque[0] ? 0.0F : d1;
        		maxY = sideOpaque[1] ? 1.0F : d2;
        		minZ = sideOpaque[5] ? 0.0F : d1;
        		maxZ = sideOpaque[4] ? 1.0F : d2;
        		
        		if(sidePipe[0] | !collectionY)
            	{
            		tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F);
            		tessellator.setNormal(0.0F, -1.0F, 0.0F);
            		tessellator.addVertexWithUV(minX, d3, minZ, u(minX), v(minZ));
            		tessellator.addVertexWithUV(maxX, d3, minZ, u(maxX), v(minZ));
            		tessellator.addVertexWithUV(maxX, d3, maxZ, u(maxX), v(maxZ));
            		tessellator.addVertexWithUV(minX, d3, maxZ, u(minX), v(maxZ));

            		tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
            		tessellator.setNormal(0.0F, 1.0F, 0.0F);
            		tessellator.addVertexWithUV(minX, d3, maxZ, u(minX), v(maxZ));
            		tessellator.addVertexWithUV(maxX, d3, maxZ, u(maxX), v(maxZ));
            		tessellator.addVertexWithUV(maxX, d3, minZ, u(maxX), v(minZ));
            		tessellator.addVertexWithUV(minX, d3, minZ, u(minX), v(minZ));
            	}
        		
        		if(sidePipe[1] | !collectionY)
            	{
            		tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F);
            		tessellator.setNormal(0.0F, -1.0F, 0.0F);
            		tessellator.addVertexWithUV(minX, d4, minZ, u(minX), v(minZ));
            		tessellator.addVertexWithUV(maxX, d4, minZ, u(maxX), v(minZ));
            		tessellator.addVertexWithUV(maxX, d4, maxZ, u(maxX), v(maxZ));
            		tessellator.addVertexWithUV(minX, d4, maxZ, u(minX), v(maxZ));

            		tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
            		tessellator.setNormal(0.0F, 1.0F, 0.0F);
            		tessellator.addVertexWithUV(minX, d4, maxZ, u(minX), v(maxZ));
            		tessellator.addVertexWithUV(maxX, d4, maxZ, u(maxX), v(maxZ));
            		tessellator.addVertexWithUV(maxX, d4, minZ, u(maxX), v(minZ));
            		tessellator.addVertexWithUV(minX, d4, minZ, u(minX), v(minZ));
            	}
        		
        		if(sidePipe[2] | !collectionX)
            	{
            		tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
            		tessellator.setNormal(-1.0F, 0.0F, 0.0F);
            		tessellator.addVertexWithUV(d4, minY, maxZ, u(minY), v(maxZ));
            		tessellator.addVertexWithUV(d4, maxY, maxZ, u(maxY), v(maxZ));
            		tessellator.addVertexWithUV(d4, maxY, minZ, u(maxY), v(minZ));
            		tessellator.addVertexWithUV(d4, minY, minZ, u(minY), v(minZ));

            		tessellator.setNormal(1.0F, 0.0F, 0.0F);
            		tessellator.addVertexWithUV(d4, minY, minZ, u(minY), v(minZ));
            		tessellator.addVertexWithUV(d4, maxY, minZ, u(maxY), v(minZ));
            		tessellator.addVertexWithUV(d4, maxY, maxZ, u(maxY), v(maxZ));
            		tessellator.addVertexWithUV(d4, minY, maxZ, u(minY), v(maxZ));
            	}

            	if(sidePipe[3] | !collectionX)
            	{
            		tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
            		tessellator.setNormal(-1.0F, 0.0F, 0.0F);
            		tessellator.addVertexWithUV(d3, minY, maxZ, u(minY), v(maxZ));
            		tessellator.addVertexWithUV(d3, maxY, maxZ, u(maxY), v(maxZ));
            		tessellator.addVertexWithUV(d3, maxY, minZ, u(maxY), v(minZ));
            		tessellator.addVertexWithUV(d3, minY, minZ, u(minY), v(minZ));

            		tessellator.setNormal(1.0F, 0.0F, 0.0F);
            		tessellator.addVertexWithUV(d3, minY, minZ, u(minY), v(minZ));
            		tessellator.addVertexWithUV(d3, maxY, minZ, u(maxY), v(minZ));
            		tessellator.addVertexWithUV(d3, maxY, maxZ, u(maxY), v(maxZ));
            		tessellator.addVertexWithUV(d3, minY, maxZ, u(minY), v(maxZ));
            	}
            	
            	if(sidePipe[4] | !collectionZ)
            	{
            		tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
            		tessellator.setNormal(0.0F, 0.0F, -1.0F);
            		tessellator.addVertexWithUV(minX, maxY, d4, u(minX), v(maxY));
            		tessellator.addVertexWithUV(maxX, maxY, d4, u(maxX), v(maxY));
            		tessellator.addVertexWithUV(maxX, minY, d4, u(maxX), v(minY));
            		tessellator.addVertexWithUV(minX, minY, d4, u(minX), v(minY));

            		tessellator.setNormal(0.0F, 0.0F, 1.0F);
            		tessellator.addVertexWithUV(minX, minY, d4, u(minX), v(minY));
            		tessellator.addVertexWithUV(maxX, minY, d4, u(maxX), v(minY));
            		tessellator.addVertexWithUV(maxX, maxY, d4, u(maxX), v(maxY));
            		tessellator.addVertexWithUV(minX, maxY, d4, u(minX), v(maxY));
            	}
            	
            	if(sidePipe[5] | !collectionZ)
            	{
            		tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
            		tessellator.setNormal(0.0F, 0.0F, -1.0F);
            		tessellator.addVertexWithUV(minX, maxY, d3, u(minX), v(maxY));
            		tessellator.addVertexWithUV(maxX, maxY, d3, u(maxX), v(maxY));
            		tessellator.addVertexWithUV(maxX, minY, d3, u(maxX), v(minY));
            		tessellator.addVertexWithUV(minX, minY, d3, u(minX), v(minY));

            		tessellator.setNormal(0.0F, 0.0F, 1.0F);
            		tessellator.addVertexWithUV(minX, minY, d3, u(minX), v(minY));
            		tessellator.addVertexWithUV(maxX, minY, d3, u(maxX), v(minY));
            		tessellator.addVertexWithUV(maxX, maxY, d3, u(maxX), v(maxY));
            		tessellator.addVertexWithUV(minX, maxY, d3, u(minX), v(maxY));
            	}
    		}
    	}
    	
    	tessellator.addTranslation((float)-x, (float)-y, (float)-z);

	return true;
}

private double u(double u)
{
	return icon.getInterpolatedU(u * 8.0D + uIconTranslate);
}

private double v(double v)
{
	return icon.getInterpolatedV(v * 8.0D + vIconTranslate);
}

@Override
public boolean shouldRender3DInInventory(int i)
{
	return true;
}

@Override
public int getRenderId()
{
	return GasesFramework.renderBlockGasPipeID;
}
}

 

You could also consider adapting your mod to work with my Gases Framework. It would save you the work of creating gas pipes, and has some other features. The problem is that it probably brings in a few too many unnecessary features for your mod.

Posted

Gotta be honest with you Glenn, yesterday this gas piping system idead was born into my head. I remembered about your mod (Already knew it) and checked for updates. Yes! You had implemented those sexy pipes. So i looked at your source code and to test it out i copied it into my project. (Then deleted it obv, i dont wanna copy) It worked very nicely but i didnt like one thing: pipes seemed like they were connecting to every block when one is next to another one in a line... let me explain...

Where you actually see the pipe hole, the end, its a bit too far. I don't like that it's that long and reaches the end of the block, i wanted it to be half of it... dammit i cant explain... so let me take a screenshot

 

Also sorry for the sad biome in my screen, but it's part of the mod, and i need a gas piping system to extract gases from volcanos :D

 

http://i.imgur.com/iHyJH44.png

Sorry if its just a link but im busy now and i have to go as soon as possible.

 

Oh btw i have your GasesFramework in my workspace, will use it :)

 

Last thing is that i can't use Tessellator, because i woud know how to. SO thats why i abandoned the idea of using your pipe render thing and to make my own.

I try my best, so apologies if I said something obviously stupid!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.