Jump to content

Recommended Posts

Posted

I have an ISBRH for a custom crop. In eclipse, it looks fine and renders the way it should, but outside eclipse, the block goes back and forth between rendering as a normal block and rendering the way it should.

Heres how its supposed to look:

 

 

e7619ea8-3577-11e4-8f03-816c999a14bc.png

 

 

And heres how it often looks:

 

 

04177e1e-3578-11e4-8a1c-d094eb10141c.png

 

 

 

Heres the rendering class:

public class RenderSoyPlant implements ISimpleBlockRenderingHandler{

public static int renderId;
private Tessellator t = Tessellator.instance;

public RenderSoyPlant(){
	renderId = RenderingRegistry.getNextAvailableRenderId();
}

@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 renderer) {

	IIcon icon = block.getIcon(0, world.getBlockMetadata(x, y, z));

	double u = icon.getMinU();
	double v = icon.getMinV();
	double U = icon.getMaxU();
	double V = icon.getMaxV();

	t.addTranslation(x, y, z);
	int lightValue = block.getMixedBrightnessForBlock(world, (int)x, (int)y, (int)z);
	t.setBrightness(lightValue);
	t.setColorOpaque_F(1.0F, 1.0F, 1.0F);
	renderer.renderStandardBlockWithAmbientOcclusion(block, (int)x, (int)y, (int)z, lightValue, lightValue, lightValue);

	renderModel(u, v, U, V);

	t.addTranslation(-x, -y, -z);

	return true;
}

private void renderModel(double u, double v, double U, double V){
	t.addVertexWithUV(0.5, 1, 1, u, v);
	t.addVertexWithUV(0.5, 1, 0, U, v);
	t.addVertexWithUV(0.5, 0, 0, U, V);
	t.addVertexWithUV(0.5, 0, 1, u, V);
	t.addVertexWithUV(0.5, 1, 0, U, v);
	t.addVertexWithUV(0.5, 1, 1, u, v);
	t.addVertexWithUV(0.5, 0, 1, u, V);
	t.addVertexWithUV(0.5, 0, 0, U, V);

	t.addVertexWithUV(1, 1, 0.5, u, v);
	t.addVertexWithUV(0, 1, 0.5, U, v);
	t.addVertexWithUV(0, 0, 0.5, U, V);
	t.addVertexWithUV(1, 0, 0.5, u, V);
	t.addVertexWithUV(0, 1, 0.5, U, v);
	t.addVertexWithUV(1, 1, 0.5, u, v);
	t.addVertexWithUV(1, 0, 0.5, u, V);
	t.addVertexWithUV(0, 0, 0.5, U, V);

	t.addVertexWithUV(0.825, 1, 0.825, u, v);
	t.addVertexWithUV(0.125, 1, 0.125, U, v);
	t.addVertexWithUV(0.125, 0, 0.125, U, V);
	t.addVertexWithUV(0.825, 0, 0.825, u, V);
	t.addVertexWithUV(0.125, 1, 0.125, U, v);
	t.addVertexWithUV(0.825, 1, 0.825, u, v);
	t.addVertexWithUV(0.825, 0, 0.825, u, V);
	t.addVertexWithUV(0.125, 0, 0.125, U, V);

	t.addVertexWithUV(0.825, 1, 0.125, u, v);
	t.addVertexWithUV(0.125, 1, 0.825, U, v);
	t.addVertexWithUV(0.125, 0, 0.825, U, V);
	t.addVertexWithUV(0.825, 0, 0.125, u, V);
	t.addVertexWithUV(0.125, 1, 0.825, U, v);
	t.addVertexWithUV(0.825, 1, 0.125, u, v);
	t.addVertexWithUV(0.825, 0, 0.125, u, V);
	t.addVertexWithUV(0.125, 0, 0.825, U, V);
}

@Override
public boolean shouldRender3DInInventory(int modelId) {
	return false;
}
@Override
public int getRenderId() {
	return renderId;
}
}

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Posted

Hi

 

That's quite odd.  It looks to me like it's trying to render as a standard cut-down block using your texture for all six sides.

 

What is this line in there for?

renderer.renderStandardBlockWithAmbientOcclusion(block, (int)x, (int)y, (int)z, lightValue, lightValue, lightValue);

 

First thing I would I suggest you try:

add System.out.println("renderWorldBlock()") to your method and see if is still getting called when the rendering goes strange.

 

-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.