Java Code Examples for net.minecraft.client.renderer.RenderBlocks#renderItemIn3d()
The following examples show how to use
net.minecraft.client.renderer.RenderBlocks#renderItemIn3d() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RenderChiselSnowman.java From Chisel-2 with GNU General Public License v2.0 | 6 votes |
protected void renderEquippedItems(EntityChiselSnowman snowman, float size){ super.renderEquippedItems(snowman, size); ItemStack itemStack = snowman.getEquipmentInSlot(2); if(itemStack.getItem() instanceof ItemBlock){ GL11.glPushMatrix(); this.snowMan.head.postRender(0.0625F); IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemStack, EQUIPPED); boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemStack, BLOCK_3D)); if(is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemStack.getItem()).getRenderType())){ float f1 = 0.625F; GL11.glTranslatef(0.0F, -0.34375F, 0.0F); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(f1, -f1, f1); } this.renderManager.itemRenderer.renderItem(snowman, itemStack, 0); GL11.glPopMatrix(); } }
Example 2
Source File: RenderGolemHelper.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
public static void renderToolItem(EntityGolemBase golem, ItemStack itemstack, ModelBase mainModel, RenderManager renderManager) { GL11.glPushMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); float angle = (float) (0.195 * Math.PI / -1 * ((ModelGolem) mainModel).golemRightArm.rotateAngleX); float y = (float) (Math.cos(angle) * 1.15); float z = (float) (Math.sin(angle) * 1.15); GL11.glTranslatef(-0.25F, y, z * -0.5f); GL11.glRotated(angle / Math.PI * 180f, -1, 0, 0); float fs = 0.66F; GL11.glScalef(fs, fs, fs); net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient.getItemRenderer(itemstack, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED); boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack, net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D)); Item item = itemstack.getItem(); float f1; if (item instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType()))) { f1 = 0.5F; GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); f1 *= 0.75F; GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(-f1, -f1, f1); } else if (item == Items.bow) { f1 = 0.625F; GL11.glTranslatef(0.0F, 0.125F, 0.3125F); GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(f1, -f1, f1); GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); } else if (item.isFull3D()) { f1 = 0.625F; if (item.shouldRotateAroundWhenRendering()) { GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.0F, -0.125F, 0.0F); } GL11.glTranslatef(0.0F, 0.1875F, 0.0F); GL11.glScalef(f1, -f1, f1); GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); } else { f1 = 0.375F; GL11.glTranslatef(0.25F, 0.1875F, -0.1875F); GL11.glScalef(f1, f1, f1); GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F); } float f2; int i; float f5; if (itemstack.getItem().requiresMultipleRenderPasses()) { for (i = 0; i < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++i) { int j = itemstack.getItem().getColorFromItemStack(itemstack, i); f5 = (float)(j >> 16 & 255) / 255.0F; f2 = (float)(j >> 8 & 255) / 255.0F; float f3 = (float)(j & 255) / 255.0F; GL11.glColor4f(f5, f2, f3, 1.0F); renderManager.itemRenderer.renderItem(golem, itemstack, i); } } else { i = itemstack.getItem().getColorFromItemStack(itemstack, 0); float f4 = (float)(i >> 16 & 255) / 255.0F; f5 = (float)(i >> 8 & 255) / 255.0F; f2 = (float)(i & 255) / 255.0F; GL11.glColor4f(f4, f5, f2, 1.0F); renderManager.itemRenderer.renderItem(golem, itemstack, 0); } GL11.glScaled(1.0D, 1.0D, 1.0D); GL11.glPopMatrix(); }