public static boolean renderEntityItem( EntityItem entity, ItemStack item, float bobing, float rotation, Random random, TextureManager engine, RenderBlocks renderBlocks) { IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY); if (customRenderer == null) { return false; } if (customRenderer.shouldUseRenderHelper(ENTITY, item, ENTITY_ROTATION)) { GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F); } if (!customRenderer.shouldUseRenderHelper(ENTITY, item, ENTITY_BOBBING)) { GL11.glTranslatef(0.0F, -bobing, 0.0F); } boolean is3D = customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D); engine.func_110577_a( item.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c); Block block = (item.itemID < Block.blocksList.length ? Block.blocksList[item.itemID] : null); if (is3D || (block != null && RenderBlocks.renderItemIn3d(block.getRenderType()))) { int renderType = (block != null ? block.getRenderType() : 1); float scale = (renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2 ? 0.5F : 0.25F); if (RenderItem.renderInFrame) { GL11.glScalef(1.25F, 1.25F, 1.25F); GL11.glTranslatef(0.0F, 0.05F, 0.0F); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); } GL11.glScalef(scale, scale, scale); int size = item.stackSize; int count = (size > 40 ? 5 : (size > 20 ? 4 : (size > 5 ? 3 : (size > 1 ? 2 : 1)))); for (int j = 0; j < count; j++) { GL11.glPushMatrix(); if (j > 0) { GL11.glTranslatef( ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale, ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale, ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale); } customRenderer.renderItem(ENTITY, item, renderBlocks, entity); GL11.glPopMatrix(); } } else { GL11.glScalef(0.5F, 0.5F, 0.5F); customRenderer.renderItem(ENTITY, item, renderBlocks, entity); } return true; }
public static boolean renderInventoryItem( RenderBlocks renderBlocks, TextureManager engine, ItemStack item, boolean inColor, float zLevel, float x, float y) { IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, INVENTORY); if (customRenderer == null) { return false; } engine.func_110577_a( item.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c); if (customRenderer.shouldUseRenderHelper(INVENTORY, item, INVENTORY_BLOCK)) { GL11.glPushMatrix(); GL11.glTranslatef(x - 2, y + 3, -3.0F + zLevel); GL11.glScalef(10F, 10F, 10F); GL11.glTranslatef(1.0F, 0.5F, 1.0F); GL11.glScalef(1.0F, 1.0F, -1F); GL11.glRotatef(210F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F); if (inColor) { int color = Item.itemsList[item.itemID].getColorFromItemStack(item, 0); float r = (float) (color >> 16 & 0xff) / 255F; float g = (float) (color >> 8 & 0xff) / 255F; float b = (float) (color & 0xff) / 255F; GL11.glColor4f(r, g, b, 1.0F); } GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F); renderBlocks.useInventoryTint = inColor; customRenderer.renderItem(INVENTORY, item, renderBlocks); renderBlocks.useInventoryTint = true; GL11.glPopMatrix(); } else { GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); GL11.glTranslatef(x, y, -3.0F + zLevel); if (inColor) { int color = Item.itemsList[item.itemID].getColorFromItemStack(item, 0); float r = (float) (color >> 16 & 255) / 255.0F; float g = (float) (color >> 8 & 255) / 255.0F; float b = (float) (color & 255) / 255.0F; GL11.glColor4f(r, g, b, 1.0F); } customRenderer.renderItem(INVENTORY, item, renderBlocks); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_LIGHTING); } return true; }
public FontRenderer( GameSettings p_i1035_1_, ResourceLocation p_i1035_2_, TextureManager p_i1035_3_, boolean p_i1035_4_) { this.field_111273_g = p_i1035_2_; this.field_78298_i = p_i1035_3_; this.field_78293_l = p_i1035_4_; p_i1035_3_.func_110577_a(this.field_111273_g); for (int var5 = 0; var5 < 32; ++var5) { int var6 = (var5 >> 3 & 1) * 85; int var7 = (var5 >> 2 & 1) * 170 + var6; int var8 = (var5 >> 1 & 1) * 170 + var6; int var9 = (var5 >> 0 & 1) * 170 + var6; if (var5 == 6) { var7 += 85; } if (p_i1035_1_.field_74337_g) { int var10 = (var7 * 30 + var8 * 59 + var9 * 11) / 100; int var11 = (var7 * 30 + var8 * 70) / 100; int var12 = (var7 * 30 + var9 * 70) / 100; var7 = var10; var8 = var11; var9 = var12; } if (var5 >= 16) { var7 /= 4; var8 /= 4; var9 /= 4; } this.field_78285_g[var5] = (var7 & 255) << 16 | (var8 & 255) << 8 | var9 & 255; } this.func_98306_d(); }
public void renderMap( EntityPlayer par1EntityPlayer, TextureManager par2TextureManager, MapData par3MapData) { for (int i = 0; i < 16384; ++i) { byte b0 = par3MapData.colors[i]; if (b0 / 4 == 0) { this.intArray[i] = (i + i / 128 & 1) * 8 + 16 << 24; } else { int j = MapColor.mapColorArray[b0 / 4].colorValue; int k = b0 & 3; short short1 = 220; if (k == 2) { short1 = 255; } if (k == 0) { short1 = 180; } int l = (j >> 16 & 255) * short1 / 255; int i1 = (j >> 8 & 255) * short1 / 255; int j1 = (j & 255) * short1 / 255; this.intArray[i] = -16777216 | l << 16 | i1 << 8 | j1; } } this.bufferedImage.func_110564_a(); byte b1 = 0; byte b2 = 0; Tessellator tessellator = Tessellator.instance; float f = 0.0F; par2TextureManager.func_110577_a(this.field_111276_e); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_ALPHA_TEST); // Default Vanilla tessellator.startDrawingQuads(); tessellator.addVertexWithUV( (double) ((float) (b1 + 0) + f), (double) ((float) (b2 + 128) - f), -0.009999999776482582D, 0.0D, 1.0D); tessellator.addVertexWithUV( (double) ((float) (b1 + 128) - f), (double) ((float) (b2 + 128) - f), -0.009999999776482582D, 1.0D, 1.0D); tessellator.addVertexWithUV( (double) ((float) (b1 + 128) - f), (double) ((float) (b2 + 0) + f), -0.009999999776482582D, 1.0D, 0.0D); tessellator.addVertexWithUV( (double) ((float) (b1 + 0) + f), (double) ((float) (b2 + 0) + f), -0.009999999776482582D, 0.0D, 0.0D); tessellator.draw(); /* */ // Icons show fine, map glitches in the paper /* tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double)((float)(b1 + 0) + f), (double)((float)(b2 + 128) - f), -0.0001D, 0.0D, 1.0D); tessellator.addVertexWithUV((double)((float)(b1 + 128) - f), (double)((float)(b2 + 128) - f), -0.0001D, 1.0D, 1.0D); tessellator.addVertexWithUV((double)((float)(b1 + 128) - f), (double)((float)(b2 + 0) + f), -0.0001D, 1.0D, 0.0D); tessellator.addVertexWithUV((double)((float)(b1 + 0) + f), (double)((float)(b2 + 0) + f), -0.0001D, 0.0D, 0.0D); tessellator.draw(); */ int k1 = 0; // CartoCraft GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); par2TextureManager.func_110577_a(ccMapIcons); k1 = 0; for (Iterator iterator = par3MapData.customIcons.values().iterator(); iterator.hasNext(); ++k1) { MapCoord mapcoord = (MapCoord) iterator.next(); float iconSize = 8.0F; // Default vanilla = 4, using a 8x8 icon int iconsPerRow = 4; // mapcoord.iconSize = 3; GL11.glPushMatrix(); GL11.glTranslatef( (float) b1 + (float) mapcoord.centerX / 2.0F + 64.0F, (float) b2 + (float) mapcoord.centerZ / 2.0F + 64.0F, -0.02F); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); GL11.glScalef(iconSize, iconSize, 3.0F); GL11.glTranslatef(-0.125F, 0.125F, 0.0F); float f1 = (float) (mapcoord.iconSize % iconsPerRow + 0) / iconsPerRow; // X start float f2 = (float) (mapcoord.iconSize / iconsPerRow + 0) / iconsPerRow; // Y start float f3 = (float) (mapcoord.iconSize % iconsPerRow + 1) / iconsPerRow; // X end float f4 = (float) (mapcoord.iconSize / iconsPerRow + 1) / iconsPerRow; // Y end // System.out.println("Map icons test: " + mapcoord.iconSize + " | " + f1 + " | " + f2 + " | " // + f3 + " | " + f4); System.out.println( "C Map icons pos: " + mapcoord.iconSize + " | " + mapcoord.centerX + " | " + mapcoord.centerZ); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-1.0D, 1.0D, (double) (0.001D), (double) f1, (double) f2); tessellator.addVertexWithUV(1.0D, 1.0D, (double) (0.001D), (double) f3, (double) f2); tessellator.addVertexWithUV(1.0D, -1.0D, (double) (0.001D), (double) f3, (double) f4); tessellator.addVertexWithUV(-1.0D, -1.0D, (double) (0.001D), (double) f1, (double) f4); tessellator.draw(); GL11.glPopMatrix(); } // Vanilla GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); par2TextureManager.func_110577_a(field_111277_a); k1 = 0; for (Iterator iterator = par3MapData.playersVisibleOnMap.values().iterator(); iterator.hasNext(); ++k1) { MapCoord mapcoord = (MapCoord) iterator.next(); // System.out.println("Map icons test: " + mapcoord.iconSize + " | " + mapcoord.iconRotation + // " | " + ((float)(mapcoord.iconRotation * 360) / 16.0F)); System.out.println( "V Map icons pos: " + mapcoord.iconSize + " | " + mapcoord.centerX + " | " + mapcoord.centerZ); GL11.glPushMatrix(); GL11.glTranslatef( (float) b1 + (float) mapcoord.centerX / 2.0F + 64.0F, (float) b2 + (float) mapcoord.centerZ / 2.0F + 64.0F, -0.02F); GL11.glRotatef((float) (mapcoord.iconRotation * 360) / 16.0F, 0.0F, 0.0F, 1.0F); GL11.glScalef(4.0F, 4.0F, 3.0F); GL11.glTranslatef(-0.125F, 0.125F, 0.0F); float f1 = (float) (mapcoord.iconSize % 4 + 0) / 4.0F; float f2 = (float) (mapcoord.iconSize / 4 + 0) / 4.0F; float f3 = (float) (mapcoord.iconSize % 4 + 1) / 4.0F; float f4 = (float) (mapcoord.iconSize / 4 + 1) / 4.0F; tessellator.startDrawingQuads(); tessellator.addVertexWithUV( -1.0D, 1.0D, (double) ((float) k1 * 0.001F), (double) f1, (double) f2); tessellator.addVertexWithUV( 1.0D, 1.0D, (double) ((float) k1 * 0.001F), (double) f3, (double) f2); tessellator.addVertexWithUV( 1.0D, -1.0D, (double) ((float) k1 * 0.001F), (double) f3, (double) f4); tessellator.addVertexWithUV( -1.0D, -1.0D, (double) ((float) k1 * 0.001F), (double) f1, (double) f4); tessellator.draw(); GL11.glPopMatrix(); } GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 0.0F, -0.04F); GL11.glScalef(1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); // CartoCraft /* System.out.println("MapItemRenderer.renderMap()"); System.out.println(" My map: " + par3MapData); System.out.println(" Map name: " + par3MapData.mapName); */ }
public void func_78443_a(EntityLivingBase p_78443_1_, ItemStack p_78443_2_, int p_78443_3_) { GL11.glPushMatrix(); TextureManager var4 = this.field_78455_a.func_110434_K(); if (p_78443_2_.func_94608_d() == 0 && p_78443_2_.field_77993_c < Block.field_71973_m.length && Block.field_71973_m[p_78443_2_.field_77993_c] != null && RenderBlocks.func_78597_b( Block.field_71973_m[p_78443_2_.field_77993_c].func_71857_b())) { var4.func_110577_a(var4.func_130087_a(0)); this.field_78452_e.func_78600_a( Block.field_71973_m[p_78443_2_.field_77993_c], p_78443_2_.func_77960_j(), 1.0F); } else { Icon var5 = p_78443_1_.func_70620_b(p_78443_2_, p_78443_3_); if (var5 == null) { GL11.glPopMatrix(); return; } var4.func_110577_a(var4.func_130087_a(p_78443_2_.func_94608_d())); Tessellator var6 = Tessellator.field_78398_a; float var7 = var5.func_94209_e(); float var8 = var5.func_94212_f(); float var9 = var5.func_94206_g(); float var10 = var5.func_94210_h(); float var11 = 0.0F; float var12 = 0.3F; GL11.glEnable('\u803a'); GL11.glTranslatef(-var11, -var12, 0.0F); float var13 = 1.5F; GL11.glScalef(var13, var13, var13); GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); func_78439_a( var6, var8, var9, var7, var10, var5.func_94211_a(), var5.func_94216_b(), 0.0625F); if (p_78443_2_.func_77962_s() && p_78443_3_ == 0) { GL11.glDepthFunc(514); GL11.glDisable(2896); var4.func_110577_a(field_110930_b); GL11.glEnable(3042); GL11.glBlendFunc(768, 1); float var14 = 0.76F; GL11.glColor4f(0.5F * var14, 0.25F * var14, 0.8F * var14, 1.0F); GL11.glMatrixMode(5890); GL11.glPushMatrix(); float var15 = 0.125F; GL11.glScalef(var15, var15, var15); float var16 = (float) (Minecraft.func_71386_F() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(var16, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); func_78439_a(var6, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(var15, var15, var15); var16 = (float) (Minecraft.func_71386_F() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-var16, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); func_78439_a(var6, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glMatrixMode(5888); GL11.glDisable(3042); GL11.glEnable(2896); GL11.glDepthFunc(515); } GL11.glDisable('\u803a'); } GL11.glPopMatrix(); }