Posted January 1, 20169 yr Hi, I'm writing mod began studying Tessellator, all I want , but there is one catch , here's a video , please help Sorry for the bad english . I do not know where to go . https://www.youtube.com/watch?v=3oseyxqsFik package com.economy.render; import com.economy.item.Items; 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.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import org.lwjgl.opengl.GL11; /** * Created by NEO on 31.12.2015. */ public class TileEntityTradeShopRenderer extends TileEntitySpecialRenderer { @Override public void renderTileEntityAt(TileEntity p_147500_1_, double x, double y, double z, float p_147500_8_) { GL11.glPushMatrix(); GL11.glTranslated(x, y, z); GL11.glDisable(GL11.GL_LIGHTING); Tessellator tessellator = Tessellator.instance; Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); tessellator.setBrightness (0); tessellator.setColorOpaque_F (1.0F, 1.0F, 1.0F); tessellator.startDrawingQuads(); float miU, miV, maU, maV; miU = Blocks.glass.getIcon(0, 0).getMinU(); miV = Blocks.glass.getIcon(0, 0).getMinV(); maU = Blocks.glass.getIcon(0, 0).getMaxU(); maV = Blocks.glass.getIcon(0, 0).getMaxV(); tessellator.addVertexWithUV (0, 0, 0, miU, miV); tessellator.addVertexWithUV (0, 1, 0, miU, maV); tessellator.addVertexWithUV (1, 1, 0, maU , maV); tessellator.addVertexWithUV (1, 0, 0, maU, miV); tessellator.addVertexWithUV (0, 0, 0, miU, miV); tessellator.addVertexWithUV (0, 1, 0, miU, maV); tessellator.addVertexWithUV (0, 1, 1, maU , maV); tessellator.addVertexWithUV (0, 0, 1, maU, miV); tessellator.draw(); tessellator.startDrawingQuads(); GL11.glTranslated(0, 1, 0); tessellator.addVertexWithUV (0, 0, 0, miU, miV); tessellator.addVertexWithUV (0, 0, 1, miU, maV); tessellator.addVertexWithUV (1, 0, 1, maU , maV); tessellator.addVertexWithUV (1, 0, 0, maU, miV); tessellator.draw(); GL11.glTranslated(0, -1, 0); tessellator.startDrawingQuads(); GL11.glTranslated(0, 0, 1); tessellator.addVertexWithUV (0, 0, 0, miU, miV); tessellator.addVertexWithUV (0, 1, 0, miU, maV); tessellator.addVertexWithUV (1, 1, 0, maU , maV); tessellator.addVertexWithUV (1, 0, 0, maU, miV); tessellator.draw(); tessellator.startDrawingQuads(); GL11.glTranslated(1, 0, 0); tessellator.addVertexWithUV (0, 0, 0, miU, miV); tessellator.addVertexWithUV (0, 1, 0, miU, maV); tessellator.addVertexWithUV (0, 1, -1, maU , maV); tessellator.addVertexWithUV (0, 0, -1, maU, miV); tessellator.draw(); miU = Blocks.iron_block.getIcon(0, 0).getMinU(); miV = Blocks.iron_block.getIcon(0, 0).getMinV(); maU = Blocks.iron_block.getIcon(0, 0).getMaxU(); maV = Blocks.iron_block.getIcon(0, 0).getMaxV(); tessellator.startDrawingQuads(); GL11.glTranslated(0, 0, 0); tessellator.addVertexWithUV (0, 0, 0, miU, miV); tessellator.addVertexWithUV (0, 0, -1, miU, maV); tessellator.addVertexWithUV (-1, 0, -1, maU , maV); tessellator.addVertexWithUV (-1, 0, 0, maU, miV); tessellator.draw(); //Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } }
January 1, 20169 yr You have to add the vertices 'anti-clockwise', rather than 'clockwise'. This will make sure you are rendering the outside of the block, and not the inside. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
January 1, 20169 yr Author You have to add the vertices 'anti-clockwise', rather than 'clockwise'. This will make sure you are rendering the outside of the block, and not the inside. Thanks for the answer , I found a solution had to fulfill GL11.glDisable (GL11.GL_CULL_FACE);
January 2, 20169 yr Author Who can tell what is the problem ? package com.economy.render; import com.economy.tileentity.TileEntityTradeShop; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import org.lwjgl.opengl.GL11; /** * Created by NEO on 31.12.2015. */ public class TileEntityTradeShopRenderer extends TileEntitySpecialRenderer { private EntityItem entityItem; public static float angle; public TileEntityTradeShopRenderer() { angle = 0; entityItem = new EntityItem(Minecraft.getMinecraft().theWorld, 0, 0, 0, new ItemStack(Blocks.air)); } @Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float a) { GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glTranslated(x, y, z); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(true); bindTexture(TextureMap.locationBlocksTexture); Tessellator tessellator = Tessellator.instance; tessellator.setBrightness (0); tessellator.setColorOpaque_F (1.0F, 1.0F, 1.0F); tessellator.startDrawingQuads(); float u, v, U, V; u = Blocks.glass.getIcon(0, 0).getMinU(); v = Blocks.glass.getIcon(0, 0).getMinV(); U = Blocks.glass.getIcon(0, 0).getMaxU(); V = Blocks.glass.getIcon(0, 0).getMaxV(); tessellator.addVertexWithUV(0, 0, 0, u, v); tessellator.addVertexWithUV(0, 1, 0, u, V); tessellator.addVertexWithUV(0, 1, 1, U, V); tessellator.addVertexWithUV(0, 0, 1, U, v); tessellator.addVertexWithUV(0, 0, 1, u, v); tessellator.addVertexWithUV(0, 1, 1, u, V); tessellator.addVertexWithUV(1, 1, 1, U, V); tessellator.addVertexWithUV(1, 0, 1, U, v); tessellator.addVertexWithUV(1, 0, 1, u, v); tessellator.addVertexWithUV(1, 1, 1, u, V); tessellator.addVertexWithUV(1, 1, 0, U, V); tessellator.addVertexWithUV(1, 0, 0, U, v); tessellator.addVertexWithUV(0, 0, 0, u, v); tessellator.addVertexWithUV(0, 1, 0, u, V); tessellator.addVertexWithUV(0, 1, 0, U, V); tessellator.addVertexWithUV(0, 0, 0, U, v); tessellator.addVertexWithUV(1, 0, 0, u, v); tessellator.addVertexWithUV(1, 1, 0, u, V); tessellator.addVertexWithUV(0, 1, 0, U, V); tessellator.addVertexWithUV(0, 0, 0, U, v); u = Blocks.iron_block.getIcon(0, 0).getMinU(); v = Blocks.iron_block.getIcon(0, 0).getMinV(); U = Blocks.iron_block.getIcon(0, 0).getMaxU(); V = Blocks.iron_block.getIcon(0, 0).getMaxV(); tessellator.addVertexWithUV(0, 0, 0, u, v); tessellator.addVertexWithUV(1, 0, 0, u, V); tessellator.addVertexWithUV(1, 0, 1, U, V); tessellator.addVertexWithUV(0, 0, 1, U, v); tessellator.draw(); if(tileEntity instanceof TileEntityTradeShop){ TileEntityTradeShop tradeShop = (TileEntityTradeShop)tileEntity; if(tradeShop.select_item != null && tradeShop.select_item.getItem() != null){ ItemStack stack = new ItemStack(tradeShop.select_item.getItem()); entityItem.setEntityItemStack(stack); } } if(entityItem.getEntityItem() != null){ RenderManager.instance.renderEntityWithPosYaw(entityItem, 0.5f, 0.3f, 0.5f, 0, angle); } GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glPopAttrib(); GL11.glPopMatrix(); } }
January 2, 20169 yr Minecraft assumes every block is an opaque cube by default, so it doesn't render faces that are covered. Override Block#isOpaqueCube to return false so Minecraft always renders the faces adjacent to your block. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
January 2, 20169 yr Author Minecraft assumes every block is an opaque cube by default, so it doesn't render faces that are covered. Override Block#isOpaqueCube to return false so Minecraft always renders the faces adjacent to your block. many thanks .
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.