Posted May 16, 201411 yr So i am custom rendering my block using a tesslator. How would i do that in the inventory? Here is my code: My itemrenderer: package com.professorvennie.main.Itemrender; import com.professorvennie.main.render.TileEntityRenderWasher; import net.minecraft.item.ItemStack; import net.minecraftforge.client.IItemRenderer; public class ItemRenderWasher implements IItemRenderer{ @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { return true; } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { new TileEntityRenderWasher(); } } My custom renderer: package com.professorvennie.main.render; import org.lwjgl.opengl.GL11; import com.professorvennie.block.EFBlock; import com.professorvennie.lib.Strings; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; public class TileEntityRenderWasher extends TileEntitySpecialRenderer{ private final ResourceLocation texterwasher = new ResourceLocation(Strings.MODID, "textures/blocks/ironoxideblock.png"); private final ResourceLocation glass = new ResourceLocation( "textures/blocks/glass.png"); private float pixel = 1F/16F; private int textureWidth = 32; private int textureHeight = 32; @Override public void renderTileEntityAt(TileEntity tileentity, double x, double y,double z, float var8) { int x1 = tileentity.xCoord; int y1 = tileentity.yCoord; int z1 = tileentity.zCoord; int metadata =tileentity.getWorldObj().getBlockMetadata(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslatef((float)x, (float)y, (float)z); Tessellator tessellator = Tessellator.instance; this.bindTexture(texterwasher); tessellator.startDrawingQuads(); if(metadata == 5){ this.bindTexture(glass); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(1, 1, 1, 1, 0); tessellator.addVertexWithUV(0, 1, 1, 0, 0); tessellator.addVertexWithUV(0, 0, 1, 0, 1); tessellator.addVertexWithUV(1, 1, 0, 1, 0); tessellator.addVertexWithUV(1, 0, 0, 1, 1); tessellator.addVertexWithUV(0, 0, 0, 0, 1); tessellator.addVertexWithUV(0, 1, 0, 0, 0); } if(metadata == 7){ this.bindTexture(glass); tessellator.addVertexWithUV(1, 1, 1, 1, 0); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(1, 0, 0, 0, 1); tessellator.addVertexWithUV(1, 1, 0, 0, 0); tessellator.addVertexWithUV(0, 0, 1, 1, 1); tessellator.addVertexWithUV(0, 1, 1, 1, 0); tessellator.addVertexWithUV(0, 1, 0, 0, 0); tessellator.addVertexWithUV(0, 0, 0, 0, 1); } if(metadata == 6){ this.bindTexture(texterwasher); tessellator.addVertexWithUV(1, 1, 1, 1, 0); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(1, 0, 0, 0, 1); tessellator.addVertexWithUV(1, 1, 0, 0, 0); tessellator.addVertexWithUV(0, 0, 1, 1, 1); tessellator.addVertexWithUV(0, 1, 1, 1, 0); tessellator.addVertexWithUV(0, 1, 0, 0, 0); tessellator.addVertexWithUV(0, 0, 0, 0, 1); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(1, 1, 1, 1, 0); tessellator.addVertexWithUV(0, 1, 1, 0, 0); tessellator.addVertexWithUV(0, 0, 1, 0, 1); tessellator.addVertexWithUV(1, 1, 0, 1, 0); tessellator.addVertexWithUV(1, 0, 0, 1, 1); tessellator.addVertexWithUV(0, 0, 0, 0, 1); tessellator.addVertexWithUV(0, 1, 0, 0, 0); tessellator.addVertexWithUV(0, 1, 1, 1, 0); tessellator.addVertexWithUV(1, 1, 1, 1, 1); tessellator.addVertexWithUV(1, 1, 0, 0, 1); tessellator.addVertexWithUV(0, 1, 0, 0, 0); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(0, 0, 1, 1, 0); tessellator.addVertexWithUV(0, 0, 0, 0, 0); tessellator.addVertexWithUV(1, 0, 0, 0, 1); } if(metadata == 3){ this.bindTexture(texterwasher); tessellator.addVertexWithUV(1, 1, 1, 1, 0); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(1, 0, 0, 0, 1); tessellator.addVertexWithUV(1, 1, 0, 0, 0); tessellator.addVertexWithUV(0, 0, 1, 1, 1); tessellator.addVertexWithUV(0, 1, 1, 1, 0); tessellator.addVertexWithUV(0, 1, 0, 0, 0); tessellator.addVertexWithUV(0, 0, 0, 0, 1); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(1, 1, 1, 1, 0); tessellator.addVertexWithUV(0, 1, 1, 0, 0); tessellator.addVertexWithUV(0, 0, 1, 0, 1); tessellator.addVertexWithUV(1, 1, 0, 1, 0); tessellator.addVertexWithUV(1, 0, 0, 1, 1); tessellator.addVertexWithUV(0, 0, 0, 0, 1); tessellator.addVertexWithUV(0, 1, 0, 0, 0); } if(metadata == 2){ this.bindTexture(texterwasher); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(0, 0, 1, 1, 0); tessellator.addVertexWithUV(0, 0, 0, 0, 0); tessellator.addVertexWithUV(1, 0, 0, 0, 1); tessellator.addVertexWithUV(0, 1, 1, 1, 0); tessellator.addVertexWithUV(1, 1, 1, 1, 1); tessellator.addVertexWithUV(1, 1, 0, 0, 1); tessellator.addVertexWithUV(0, 1, 0, 0, 0); } if(metadata == 4){ this.bindTexture(texterwasher); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(0, 0, 1, 1, 0); tessellator.addVertexWithUV(0, 0, 0, 0, 0); tessellator.addVertexWithUV(1, 0, 0, 0, 1); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(1, 1, 1, 1, 0); tessellator.addVertexWithUV(0, 1, 1, 0, 0); tessellator.addVertexWithUV(0, 0, 1, 0, 1); tessellator.addVertexWithUV(1, 1, 0, 1, 0); tessellator.addVertexWithUV(1, 0, 0, 1, 1); tessellator.addVertexWithUV(0, 0, 0, 0, 1); tessellator.addVertexWithUV(0, 1, 0, 0, 0); tessellator.addVertexWithUV(0, 1, 1, 1, 0); tessellator.addVertexWithUV(1, 1, 1, 1, 1); tessellator.addVertexWithUV(1, 1, 0, 0, 1); tessellator.addVertexWithUV(0, 1, 0, 0, 0); } if(metadata == 1){ this.bindTexture(texterwasher); tessellator.addVertexWithUV(1, 1, 1, 1, 0); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(1, 0, 0, 0, 1); tessellator.addVertexWithUV(1, 1, 0, 0, 0); tessellator.addVertexWithUV(0, 0, 1, 1, 1); tessellator.addVertexWithUV(0, 1, 1, 1, 0); tessellator.addVertexWithUV(0, 1, 0, 0, 0); tessellator.addVertexWithUV(0, 0, 0, 0, 1); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(1, 1, 1, 1, 0); tessellator.addVertexWithUV(0, 1, 1, 0, 0); tessellator.addVertexWithUV(0, 0, 1, 0, 1); tessellator.addVertexWithUV(1, 1, 0, 1, 0); tessellator.addVertexWithUV(1, 0, 0, 1, 1); tessellator.addVertexWithUV(0, 0, 0, 0, 1); tessellator.addVertexWithUV(0, 1, 0, 0, 0); tessellator.addVertexWithUV(0, 1, 1, 1, 0); tessellator.addVertexWithUV(1, 1, 1, 1, 1); tessellator.addVertexWithUV(1, 1, 0, 0, 1); tessellator.addVertexWithUV(0, 1, 0, 0, 0); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(0, 0, 1, 1, 0); tessellator.addVertexWithUV(0, 0, 0, 0, 0); tessellator.addVertexWithUV(1, 0, 0, 0, 1); } if(metadata == 0){ this.bindTexture(texterwasher); tessellator.addVertexWithUV(1, 1, 1, 1, 0); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(1, 0, 0, 0, 1); tessellator.addVertexWithUV(1, 1, 0, 0, 0); tessellator.addVertexWithUV(0, 0, 1, 1, 1); tessellator.addVertexWithUV(0, 1, 1, 1, 0); tessellator.addVertexWithUV(0, 1, 0, 0, 0); tessellator.addVertexWithUV(0, 0, 0, 0, 1); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(1, 1, 1, 1, 0); tessellator.addVertexWithUV(0, 1, 1, 0, 0); tessellator.addVertexWithUV(0, 0, 1, 0, 1); tessellator.addVertexWithUV(1, 1, 0, 1, 0); tessellator.addVertexWithUV(1, 0, 0, 1, 1); tessellator.addVertexWithUV(0, 0, 0, 0, 1); tessellator.addVertexWithUV(0, 1, 0, 0, 0); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(0, 0, 1, 1, 0); tessellator.addVertexWithUV(0, 0, 0, 0, 0); tessellator.addVertexWithUV(1, 0, 0, 0, 1); tessellator.addVertexWithUV(0, 1, 1, 1, 0); tessellator.addVertexWithUV(1, 1, 1, 1, 1); tessellator.addVertexWithUV(1, 1, 0, 0, 1); tessellator.addVertexWithUV(0, 1, 0, 0, 0); } if(metadata == { this.bindTexture(texterwasher); tessellator.addVertexWithUV(0, 1, 1, 1, 0); tessellator.addVertexWithUV(1, 1, 1, 1, 1); tessellator.addVertexWithUV(1, 1, 0, 0, 1); tessellator.addVertexWithUV(0, 1, 0, 0, 0); } tessellator.draw(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } }
May 18, 201411 yr Hi This link might help http://greyminecraftcoder.blogspot.com.au/2013/09/custom-item-rendering-using.html -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.