Posted August 16, 201411 yr I'm having a bit of an issue with rendering an item. My item renderer basically renders the default 3D item and then scales it to make it bigger. The problem is, there are some grainy, noise-like rendering on the item. Here's my item renderer: package terrarium.client.render.item; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; import terrarium.item.IScaledRender; import terrarium.util.Util; public class RenderScaledItem implements IItemRenderer { @Override public boolean handleRenderType(ItemStack itemStack, ItemRenderType type) { return (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) ? true : false; } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack itemStack, ItemRendererHelper helper) { return (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) ? true : false; } @Override public void renderItem(ItemRenderType type, ItemStack itemStack, Object... data) { Item item = itemStack.getItem(); if(item instanceof IScaledRender) { double scale = ((IScaledRender) item).getScale(itemStack); IIcon icon = item.getIcon(itemStack, 0); Minecraft mc = Util.getMC(); mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); if(type == ItemRenderType.EQUIPPED) { scale *= 2; GL11.glPushMatrix(); GL11.glScaled(scale, scale, scale); GL11.glTranslated(0.05D, 0.875D, -0.05D); GL11.glRotated(130D, 0D, 1D, 0D); GL11.glRotated(-120D, 0D, 0D, 1D); ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), 255, 255, 0.0625F); GL11.glPopMatrix(); } else if(type == ItemRenderType.EQUIPPED_FIRST_PERSON) { scale *= 200; GL11.glPushMatrix(); GL11.glScaled(scale, scale, scale); GL11.glTranslated(0.4D, -0.2D, 0.45D); GL11.glRotated(37.5D, 0D, 1D, 0D); GL11.glRotated(-30D, 0D, 0D, 1D); ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), 255, 255, 0.0625F); GL11.glPopMatrix(); } } } } Kain
August 17, 201411 yr Hi That is caused by the vanilla minecraft code, which converts a 2D icon into "thickness" slice. The gaps are caused by the way it cuts it into slices. Look in ItemRenderer.renderItemIn2D() for more clues. The only way to fix it is to copy the renderer and optimise it for your larger icon (or, if it's just this one item - create a proper model for it) -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.