Jump to content

Recommended Posts

Posted

I just made a CustomBlockRenderer(ISimpleBlockRenderingHandler),beacos i want to make somting like vine,but it will be not based on metadata,but on the is there block or no.From my tryes,i did rendering just of 2 sides(Z pos and neg).But now,when i did add X pos and neg,it just dont want to work...just dont rendering them...at all...My render code:


public class LightRenderer implements ISimpleBlockRenderingHandler {

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID,
		RenderBlocks renderer) {
}

@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z,Block block, int modelId, RenderBlocks r) {
	float f19 = 0.1F;
	Tessellator tessellator = Tessellator.instance;
//		if (world.getBlockId(x+1, y, z)!=0) {
	        tessellator.addTranslation(f19, 0.0F,0.0F);
	 	r.renderFaceXNeg(block, (double)x, (double)y, (double)z, r.getBlockIcon(block, r.blockAccess, x, y, z, 0));
		r.renderFaceXPos(block, (double)x, (double)y, (double)z, r.getBlockIcon(block, r.blockAccess, x, y, z, 0));
		tessellator.addTranslation(-f19, 0.0F,0.0F);
//		}
//		if (world.getBlockId(x-1, y, z)!=0) {
		tessellator.addTranslation(-f19+1, 0.0F,0.0F);
		r.renderFaceXNeg(block, (double)x, (double)y, (double)z, r.getBlockIcon(block, r.blockAccess, x, y, z, 0));
		r.renderFaceXPos(block, (double)x, (double)y, (double)z, r.getBlockIcon(block, r.blockAccess, x, y, z, 0));
		tessellator.addTranslation(f19-1, 0.0F,0.0F);
//		}
//		if (world.getBlockId(x, y, z-1)!=0) { 
		tessellator.addTranslation(0.0f, 0.0f,f19);
		r.renderFaceZPos(block, (double)x, (double)y, (double)z, r.getBlockIcon(block, r.blockAccess, x, y, z, 0));
		r.renderFaceZNeg(block, (double)x, (double)y, (double)z, r.getBlockIcon(block, r.blockAccess, x, y, z, 0));
		tessellator.addTranslation(0.0f, 0.0f,-f19); 
//		}
//		if (world.getBlockId(x, y, z+1)!=0) {
		tessellator.addTranslation(0.0f, 0.0f,-f19+1);
		r.renderFaceZPos(block, (double)x, (double)y, (double)z, r.getBlockIcon(block, r.blockAccess, x, y, z, 0));
		r.renderFaceZNeg(block, (double)x, (double)y, (double)z, r.getBlockIcon(block, r.blockAccess, x, y, z, 0));
		tessellator.addTranslation(0.0f, 0.0f,f19-1);
//		}
	return true;
}

@Override
public boolean shouldRender3DInInventory() {
	return false;
}

@Override
public int getRenderId() {
	return ClientProxy.LightRenderID;
}

}

All other code works fine(its registrading kk,and works all fine),but the render X pos+neg...its just dont wont to work...

Posted
beacos

somting

tryes

registrading

 

Ow, my English. >..x

I have no idea what your problem actually is.  I can't read your post.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

X pos,and X neg sides dont render,but Z pos+Z neg sides work fine(X pos side-side that you can see from X+1 block,and it the nearest side)

 

edit:forgot to add a screen shot:

http://snag.gy/uVUnm.jpg

 

Zpos and Zneg are not working correctly if you have both rendering with only a block at Zpos and none at Zneg (or vice versa if you're facing north).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

so are you want to say,what side can be "seen" only from one of the its "sides"?) What is a problem with rendering only- you will see it only from one side,let me explain what i mean...beacos i'm bad in englesh.

                                                  ___

My block                                  > |      | < My block

We will not see oposite side  > |___| < If we are stading here,we will see that side

 

soo,i need to render Z pos,and Z neg in one place at the same time...i think what will be easyer to me-just use pure OpenGL,and not MC's render engine....

Posted

soo,i need to render Z pos,and Z neg in one place at the same time...i think what will be easyer to me-just use pure OpenGL,and not MC's render engine....

 

His code is doing that, actually.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Oh I see, the if statements are commented, didn't notice that.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

 

 

 

 

Beep beep boop boop.  Errorͤͬͬͦͬ parsing post.ͬͦͬͬͤ̄ͤͩͦͨ̄ͦͨͣͬͩ

  • Like 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Hi

 

There's  a few things here about custom rendering that might help (see the Block Rendering sections)

http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html

 

Are you rendering in pass 0 or pass 1?

 

From looking at your code I don't see an obvious problem

 

A couple of suggestions to try -

* you could try rendering in pass 1 - all faces are double-sided in pass 1 unlike pass 0 - so you only need to render one

* you could try turning off cull face

        GL11.glDisable(GL11.GL_CULL_FACE);

(don't forget to reenable after)

        GL11.glEnable(GL11.GL_CULL_FACE);

* you could try moving the two faces slightly apart

        tessellator.addTranslation(f19, 0.0F,0.0F);

r.renderFaceXNeg(block, (double)x, (double)y, (double)z, r.getBlockIcon(block, r.blockAccess, x, y, z, 0));

tessellator.addTranslation(0.001F, 0.0F, 0.0F);

r.renderFaceXPos(block, (double)x, (double)y, (double)z, r.getBlockIcon(block, r.blockAccess, x, y, z, 0));

tessellator.addTranslation(-f19-0.001F, 0.0F,0.0F);

 

-TGG

 

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.