Jump to content

[1.7.10] ISBRH RenderBlocks issue with blocks extending out of block bounds


Flenix

Recommended Posts

Hello all.

 

I'm trying to make some new blocks, and I'm using the RenderBlocks renderStandardBlock method for doing so.

 

However, it's treating textures oddly, and I can't figure out why. I've stripped my class right down to bare basics, trying to emulate this guide:

http://greyminecraftcoder.blogspot.com.au/2013/07/rendering-non-standard-blocks.html

 

In that article, you can see the textures get truncated, so they render as if a full block, but only actually show the relevant part of it.

 

In my case, this happens (as I want it to) on the top and bottom textures. However, the side textures are all showing the full size texture scaled down:

5652326f48da0.jpg

 

Has anyone got any idea why this might be happening? I'm guessing I've just missed something minor, but I can't seem to find any other examples that are any different to mine...

 

Render class:

package co.uk.silvania.cities.core.client.renders;

import org.lwjgl.opengl.GL11;

import co.uk.silvania.cities.core.blocks.BlockWalkway;
import co.uk.silvania.cities.core.client.ClientProxy;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;

public class WalkwayRenderer 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 renderer) {
	renderBlock(0.25D, 0.9D, 0.25D, 0.75D, 1.4D, 0.75D, true, renderer, block, x, y, z, 0);
	return true;
}

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

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

public void renderBlock(double minX, double minY, double minZ, double maxX, double maxY, double maxZ, boolean existsInWorld, RenderBlocks renderer, Block block, int x, int y, int z, int meta) {
	renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, maxZ);
	renderer.renderStandardBlock(block, x, y, z);
}
}

 

As for getting the texture, in my Block's class:

@Override
public IIcon getIcon(int side, int metadata) {
	return Blocks.planks.getIcon(0, textureMeta);
}

 

Any help much appreciated :)

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Link to comment
Share on other sites

I've figured out the CAUSE of the issue, but still need a solution.

 

My rendered block is ever so slightly larger than a standard block - stretching 1/16th to 1/8th outside its ordinary bounds.

Now, I CAN remodel it and fit it within the block, but doing so just makes it appear a little bit too small IMO, so I'd rather find a solution.

 

Anyone got any ideas?

 

(Photo examples)

 

Bad one (Block Y is 0.8-1.3, giving an 0.5x0.5x0.5 block)

Note how the texture is 8 wide as it should be, but is a full 16 high.

565360781b86c.jpg

 

Good one (Y is 0.5-1.0, same size block)

Here the texture is correct, rendering 8 pixels on each axis:

565360884bf96.jpg

 

And an example with both. Lower is 0.3-0.8, upper is 0.9-1.4

5653623b5c13f.jpg

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Link to comment
Share on other sites

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.