001package net.minecraft.client.renderer.entity; 002 003import cpw.mods.fml.relauncher.Side; 004import cpw.mods.fml.relauncher.SideOnly; 005import java.util.Random; 006import net.minecraft.block.Block; 007import net.minecraft.client.Minecraft; 008import net.minecraft.client.gui.FontRenderer; 009import net.minecraft.client.renderer.ItemRenderer; 010import net.minecraft.client.renderer.RenderBlocks; 011import net.minecraft.client.renderer.RenderEngine; 012import net.minecraft.client.renderer.Tessellator; 013import net.minecraft.entity.Entity; 014import net.minecraft.entity.item.EntityItem; 015import net.minecraft.item.Item; 016import net.minecraft.item.ItemStack; 017import net.minecraft.util.Icon; 018import net.minecraft.util.MathHelper; 019import org.lwjgl.opengl.GL11; 020import org.lwjgl.opengl.GL12; 021 022import net.minecraftforge.client.ForgeHooksClient; 023 024@SideOnly(Side.CLIENT) 025public class RenderItem extends Render 026{ 027 private RenderBlocks itemRenderBlocks = new RenderBlocks(); 028 029 /** The RNG used in RenderItem (for bobbing itemstacks on the ground) */ 030 private Random random = new Random(); 031 public boolean field_77024_a = true; 032 033 /** Defines the zLevel of rendering of item on GUI. */ 034 public float zLevel = 0.0F; 035 public static boolean field_82407_g = false; 036 037 public RenderItem() 038 { 039 this.shadowSize = 0.15F; 040 this.shadowOpaque = 0.75F; 041 } 042 043 /** 044 * Renders the item 045 */ 046 public void doRenderItem(EntityItem par1EntityItem, double par2, double par4, double par6, float par8, float par9) 047 { 048 this.random.setSeed(187L); 049 ItemStack itemstack = par1EntityItem.getEntityItem(); 050 051 if (itemstack.getItem() != null) 052 { 053 GL11.glPushMatrix(); 054 float f2 = shouldBob() ? MathHelper.sin(((float)par1EntityItem.age + par9) / 10.0F + par1EntityItem.hoverStart) * 0.1F + 0.1F : 0F; 055 float f3 = (((float)par1EntityItem.age + par9) / 20.0F + par1EntityItem.hoverStart) * (180F / (float)Math.PI); 056 byte b0 = getMiniBlockCount(itemstack); 057 058 GL11.glTranslatef((float)par2, (float)par4 + f2, (float)par6); 059 GL11.glEnable(GL12.GL_RESCALE_NORMAL); 060 int i; 061 float f4; 062 float f5; 063 float f6; 064 065 Block block = null; 066 if (itemstack.itemID < Block.blocksList.length) 067 { 068 block = Block.blocksList[itemstack.itemID]; 069 } 070 071 if (ForgeHooksClient.renderEntityItem(par1EntityItem, itemstack, f2, f3, random, renderManager.renderEngine, renderBlocks)) 072 { 073 ; 074 } 075 else if (itemstack.func_94608_d() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) 076 { 077 GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F); 078 079 if (field_82407_g) 080 { 081 GL11.glScalef(1.25F, 1.25F, 1.25F); 082 GL11.glTranslatef(0.0F, 0.05F, 0.0F); 083 GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); 084 } 085 086 this.loadTexture("/terrain.png"); 087 float f7 = 0.25F; 088 int j = block.getRenderType(); 089 090 if (j == 1 || j == 19 || j == 12 || j == 2) 091 { 092 f7 = 0.5F; 093 } 094 095 GL11.glScalef(f7, f7, f7); 096 097 for (i = 0; i < b0; ++i) 098 { 099 GL11.glPushMatrix(); 100 101 if (i > 0) 102 { 103 f5 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7; 104 f4 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7; 105 f6 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7; 106 GL11.glTranslatef(f5, f4, f6); 107 } 108 109 f5 = 1.0F; 110 this.itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5); 111 GL11.glPopMatrix(); 112 } 113 } 114 else 115 { 116 float f8; 117 118 if (itemstack.getItem().requiresMultipleRenderPasses()) 119 { 120 if (field_82407_g) 121 { 122 GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F); 123 GL11.glTranslatef(0.0F, -0.05F, 0.0F); 124 } 125 else 126 { 127 GL11.glScalef(0.5F, 0.5F, 0.5F); 128 } 129 130 this.loadTexture("/gui/items.png"); 131 132 for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k) 133 { 134 this.random.setSeed(187L); 135 Icon icon = itemstack.getItem().getIcon(itemstack, k); 136 f8 = 1.0F; 137 138 if (this.field_77024_a) 139 { 140 i = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, k); 141 f5 = (float)(i >> 16 & 255) / 255.0F; 142 f4 = (float)(i >> 8 & 255) / 255.0F; 143 f6 = (float)(i & 255) / 255.0F; 144 GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F); 145 this.renderDroppedItem(par1EntityItem, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8); 146 } 147 else 148 { 149 this.renderDroppedItem(par1EntityItem, icon, b0, par9, 1.0F, 1.0F, 1.0F); 150 } 151 } 152 } 153 else 154 { 155 if (field_82407_g) 156 { 157 GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F); 158 GL11.glTranslatef(0.0F, -0.05F, 0.0F); 159 } 160 else 161 { 162 GL11.glScalef(0.5F, 0.5F, 0.5F); 163 } 164 165 Icon icon1 = itemstack.getIconIndex(); 166 167 if (itemstack.func_94608_d() == 0) 168 { 169 this.loadTexture("/terrain.png"); 170 } 171 else 172 { 173 this.loadTexture("/gui/items.png"); 174 } 175 176 if (this.field_77024_a) 177 { 178 int l = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 0); 179 f8 = (float)(l >> 16 & 255) / 255.0F; 180 float f9 = (float)(l >> 8 & 255) / 255.0F; 181 f5 = (float)(l & 255) / 255.0F; 182 f4 = 1.0F; 183 this.renderDroppedItem(par1EntityItem, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4); 184 } 185 else 186 { 187 this.renderDroppedItem(par1EntityItem, icon1, b0, par9, 1.0F, 1.0F, 1.0F); 188 } 189 } 190 } 191 192 GL11.glDisable(GL12.GL_RESCALE_NORMAL); 193 GL11.glPopMatrix(); 194 } 195 } 196 197 /** 198 * Renders a dropped item 199 */ 200 private void renderDroppedItem(EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5, float par6, float par7) 201 { 202 Tessellator tessellator = Tessellator.instance; 203 204 if (par2Icon == null) 205 { 206 par2Icon = this.renderManager.renderEngine.func_96448_c(par1EntityItem.getEntityItem().func_94608_d()); 207 } 208 209 float f4 = par2Icon.func_94209_e(); 210 float f5 = par2Icon.func_94212_f(); 211 float f6 = par2Icon.func_94206_g(); 212 float f7 = par2Icon.func_94210_h(); 213 float f8 = 1.0F; 214 float f9 = 0.5F; 215 float f10 = 0.25F; 216 float f11; 217 218 if (this.renderManager.options.fancyGraphics) 219 { 220 GL11.glPushMatrix(); 221 222 if (field_82407_g) 223 { 224 GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); 225 } 226 else 227 { 228 GL11.glRotatef((((float)par1EntityItem.age + par4) / 20.0F + par1EntityItem.hoverStart) * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); 229 } 230 231 float f12 = 0.0625F; 232 f11 = 0.021875F; 233 ItemStack itemstack = par1EntityItem.getEntityItem(); 234 int j = itemstack.stackSize; 235 byte b0 = getMiniItemCount(itemstack); 236 237 GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float)b0 / 2.0F)); 238 239 for (int k = 0; k < b0; ++k) 240 { 241 // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug... 242 if (k > 0 && shouldSpreadItems()) 243 { 244 float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; 245 float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; 246 float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; 247 GL11.glTranslatef(x, y, f12 + f11); 248 } 249 else 250 { 251 GL11.glTranslatef(0f, 0f, f12 + f11); 252 } 253 254 if (itemstack.func_94608_d() == 0) 255 { 256 this.loadTexture("/terrain.png"); 257 } 258 else 259 { 260 this.loadTexture("/gui/items.png"); 261 } 262 263 GL11.glColor4f(par5, par6, par7, 1.0F); 264 ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, par2Icon.func_94213_j(), par2Icon.func_94208_k(), f12); 265 266 if (itemstack != null && itemstack.hasEffect()) 267 { 268 GL11.glDepthFunc(GL11.GL_EQUAL); 269 GL11.glDisable(GL11.GL_LIGHTING); 270 this.renderManager.renderEngine.func_98187_b("%blur%/misc/glint.png"); 271 GL11.glEnable(GL11.GL_BLEND); 272 GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); 273 float f13 = 0.76F; 274 GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F); 275 GL11.glMatrixMode(GL11.GL_TEXTURE); 276 GL11.glPushMatrix(); 277 float f14 = 0.125F; 278 GL11.glScalef(f14, f14, f14); 279 float f15 = (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; 280 GL11.glTranslatef(f15, 0.0F, 0.0F); 281 GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); 282 ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12); 283 GL11.glPopMatrix(); 284 GL11.glPushMatrix(); 285 GL11.glScalef(f14, f14, f14); 286 f15 = (float)(Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; 287 GL11.glTranslatef(-f15, 0.0F, 0.0F); 288 GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); 289 ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12); 290 GL11.glPopMatrix(); 291 GL11.glMatrixMode(GL11.GL_MODELVIEW); 292 GL11.glDisable(GL11.GL_BLEND); 293 GL11.glEnable(GL11.GL_LIGHTING); 294 GL11.glDepthFunc(GL11.GL_LEQUAL); 295 } 296 } 297 298 GL11.glPopMatrix(); 299 } 300 else 301 { 302 for (int l = 0; l < par3; ++l) 303 { 304 GL11.glPushMatrix(); 305 306 if (l > 0) 307 { 308 f11 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F; 309 float f16 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F; 310 float f17 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F; 311 GL11.glTranslatef(f11, f16, f17); 312 } 313 314 if (!field_82407_g) 315 { 316 GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); 317 } 318 319 GL11.glColor4f(par5, par6, par7, 1.0F); 320 tessellator.startDrawingQuads(); 321 tessellator.setNormal(0.0F, 1.0F, 0.0F); 322 tessellator.addVertexWithUV((double)(0.0F - f9), (double)(0.0F - f10), 0.0D, (double)f4, (double)f7); 323 tessellator.addVertexWithUV((double)(f8 - f9), (double)(0.0F - f10), 0.0D, (double)f5, (double)f7); 324 tessellator.addVertexWithUV((double)(f8 - f9), (double)(1.0F - f10), 0.0D, (double)f5, (double)f6); 325 tessellator.addVertexWithUV((double)(0.0F - f9), (double)(1.0F - f10), 0.0D, (double)f4, (double)f6); 326 tessellator.draw(); 327 GL11.glPopMatrix(); 328 } 329 } 330 } 331 332 /** 333 * Renders the item's icon or block into the UI at the specified position. 334 */ 335 public void renderItemIntoGUI(FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5) 336 { 337 int k = par3ItemStack.itemID; 338 int l = par3ItemStack.getItemDamage(); 339 Icon icon = par3ItemStack.getIconIndex(); 340 float f; 341 float f1; 342 float f2; 343 344 Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null); 345 346 if (par3ItemStack.func_94608_d() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType())) 347 { 348 par2RenderEngine.func_98187_b("/terrain.png"); 349 GL11.glPushMatrix(); 350 GL11.glTranslatef((float)(par4 - 2), (float)(par5 + 3), -3.0F + this.zLevel); 351 GL11.glScalef(10.0F, 10.0F, 10.0F); 352 GL11.glTranslatef(1.0F, 0.5F, 1.0F); 353 GL11.glScalef(1.0F, 1.0F, -1.0F); 354 GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F); 355 GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); 356 int i1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0); 357 f2 = (float)(i1 >> 16 & 255) / 255.0F; 358 f = (float)(i1 >> 8 & 255) / 255.0F; 359 f1 = (float)(i1 & 255) / 255.0F; 360 361 if (this.field_77024_a) 362 { 363 GL11.glColor4f(f2, f, f1, 1.0F); 364 } 365 366 GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); 367 this.itemRenderBlocks.useInventoryTint = this.field_77024_a; 368 this.itemRenderBlocks.renderBlockAsItem(block, l, 1.0F); 369 this.itemRenderBlocks.useInventoryTint = true; 370 GL11.glPopMatrix(); 371 } 372 else 373 { 374 int j1; 375 376 if (Item.itemsList[k].requiresMultipleRenderPasses()) 377 { 378 GL11.glDisable(GL11.GL_LIGHTING); 379 if (par3ItemStack.func_94608_d() == 0) 380 { 381 par2RenderEngine.func_98187_b("/terrain.png"); 382 } 383 else 384 { 385 par2RenderEngine.func_98187_b("/gui/items.png"); 386 } 387 388 for (j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1) 389 { 390 Icon icon1 = Item.itemsList[k].getIcon(par3ItemStack, j1); 391 int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1); 392 f = (float)(k1 >> 16 & 255) / 255.0F; 393 f1 = (float)(k1 >> 8 & 255) / 255.0F; 394 float f3 = (float)(k1 & 255) / 255.0F; 395 396 if (this.field_77024_a) 397 { 398 GL11.glColor4f(f, f1, f3, 1.0F); 399 } 400 401 this.func_94149_a(par4, par5, icon1, 16, 16); 402 } 403 404 GL11.glEnable(GL11.GL_LIGHTING); 405 } 406 else 407 { 408 GL11.glDisable(GL11.GL_LIGHTING); 409 410 if (par3ItemStack.func_94608_d() == 0) 411 { 412 par2RenderEngine.func_98187_b("/terrain.png"); 413 } 414 else 415 { 416 par2RenderEngine.func_98187_b("/gui/items.png"); 417 } 418 419 if (icon == null) 420 { 421 icon = par2RenderEngine.func_96448_c(par3ItemStack.func_94608_d()); 422 } 423 424 j1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0); 425 float f4 = (float)(j1 >> 16 & 255) / 255.0F; 426 f2 = (float)(j1 >> 8 & 255) / 255.0F; 427 f = (float)(j1 & 255) / 255.0F; 428 429 if (this.field_77024_a) 430 { 431 GL11.glColor4f(f4, f2, f, 1.0F); 432 } 433 434 this.func_94149_a(par4, par5, icon, 16, 16); 435 GL11.glEnable(GL11.GL_LIGHTING); 436 } 437 } 438 439 GL11.glEnable(GL11.GL_CULL_FACE); 440 } 441 442 /** 443 * Render the item's icon or block into the GUI, including the glint effect. 444 */ 445 public void renderItemAndEffectIntoGUI(FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5) 446 { 447 if (par3ItemStack != null) 448 { 449 if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2RenderEngine, par3ItemStack, field_77024_a, zLevel, (float)par4, (float)par5)) 450 { 451 this.renderItemIntoGUI(par1FontRenderer, par2RenderEngine, par3ItemStack, par4, par5); 452 } 453 454 if (par3ItemStack.hasEffect()) 455 { 456 GL11.glDepthFunc(GL11.GL_GREATER); 457 GL11.glDisable(GL11.GL_LIGHTING); 458 GL11.glDepthMask(false); 459 par2RenderEngine.func_98187_b("%blur%/misc/glint.png"); 460 this.zLevel -= 50.0F; 461 GL11.glEnable(GL11.GL_BLEND); 462 GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR); 463 GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); 464 this.func_77018_a(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20); 465 GL11.glDisable(GL11.GL_BLEND); 466 GL11.glDepthMask(true); 467 this.zLevel += 50.0F; 468 GL11.glEnable(GL11.GL_LIGHTING); 469 GL11.glDepthFunc(GL11.GL_LEQUAL); 470 } 471 } 472 } 473 474 private void func_77018_a(int par1, int par2, int par3, int par4, int par5) 475 { 476 for (int j1 = 0; j1 < 2; ++j1) 477 { 478 if (j1 == 0) 479 { 480 GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); 481 } 482 483 if (j1 == 1) 484 { 485 GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); 486 } 487 488 float f = 0.00390625F; 489 float f1 = 0.00390625F; 490 float f2 = (float)(Minecraft.getSystemTime() % (long)(3000 + j1 * 1873)) / (3000.0F + (float)(j1 * 1873)) * 256.0F; 491 float f3 = 0.0F; 492 Tessellator tessellator = Tessellator.instance; 493 float f4 = 4.0F; 494 495 if (j1 == 1) 496 { 497 f4 = -1.0F; 498 } 499 500 tessellator.startDrawingQuads(); 501 tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + par5), (double)this.zLevel, (double)((f2 + (float)par5 * f4) * f), (double)((f3 + (float)par5) * f1)); 502 tessellator.addVertexWithUV((double)(par2 + par4), (double)(par3 + par5), (double)this.zLevel, (double)((f2 + (float)par4 + (float)par5 * f4) * f), (double)((f3 + (float)par5) * f1)); 503 tessellator.addVertexWithUV((double)(par2 + par4), (double)(par3 + 0), (double)this.zLevel, (double)((f2 + (float)par4) * f), (double)((f3 + 0.0F) * f1)); 504 tessellator.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)this.zLevel, (double)((f2 + 0.0F) * f), (double)((f3 + 0.0F) * f1)); 505 tessellator.draw(); 506 } 507 } 508 509 /** 510 * Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the 511 * specified position. 512 */ 513 public void renderItemOverlayIntoGUI(FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5) 514 { 515 this.func_94148_a(par1FontRenderer, par2RenderEngine, par3ItemStack, par4, par5, (String)null); 516 } 517 518 public void func_94148_a(FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5, String par6Str) 519 { 520 if (par3ItemStack != null) 521 { 522 if (par3ItemStack.stackSize > 1 || par6Str != null) 523 { 524 String s1 = par6Str == null ? String.valueOf(par3ItemStack.stackSize) : par6Str; 525 GL11.glDisable(GL11.GL_LIGHTING); 526 GL11.glDisable(GL11.GL_DEPTH_TEST); 527 par1FontRenderer.drawStringWithShadow(s1, par4 + 19 - 2 - par1FontRenderer.getStringWidth(s1), par5 + 6 + 3, 16777215); 528 GL11.glEnable(GL11.GL_LIGHTING); 529 GL11.glEnable(GL11.GL_DEPTH_TEST); 530 } 531 532 if (par3ItemStack.isItemDamaged()) 533 { 534 int k = (int)Math.round(13.0D - (double)par3ItemStack.getItemDamageForDisplay() * 13.0D / (double)par3ItemStack.getMaxDamage()); 535 int l = (int)Math.round(255.0D - (double)par3ItemStack.getItemDamageForDisplay() * 255.0D / (double)par3ItemStack.getMaxDamage()); 536 GL11.glDisable(GL11.GL_LIGHTING); 537 GL11.glDisable(GL11.GL_DEPTH_TEST); 538 GL11.glDisable(GL11.GL_TEXTURE_2D); 539 Tessellator tessellator = Tessellator.instance; 540 int i1 = 255 - l << 16 | l << 8; 541 int j1 = (255 - l) / 4 << 16 | 16128; 542 this.renderQuad(tessellator, par4 + 2, par5 + 13, 13, 2, 0); 543 this.renderQuad(tessellator, par4 + 2, par5 + 13, 12, 1, j1); 544 this.renderQuad(tessellator, par4 + 2, par5 + 13, k, 1, i1); 545 GL11.glEnable(GL11.GL_TEXTURE_2D); 546 GL11.glEnable(GL11.GL_LIGHTING); 547 GL11.glEnable(GL11.GL_DEPTH_TEST); 548 GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); 549 } 550 } 551 } 552 553 /** 554 * Adds a quad to the tesselator at the specified position with the set width and height and color. Args: 555 * tessellator, x, y, width, height, color 556 */ 557 private void renderQuad(Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6) 558 { 559 par1Tessellator.startDrawingQuads(); 560 par1Tessellator.setColorOpaque_I(par6); 561 par1Tessellator.addVertex((double)(par2 + 0), (double)(par3 + 0), 0.0D); 562 par1Tessellator.addVertex((double)(par2 + 0), (double)(par3 + par5), 0.0D); 563 par1Tessellator.addVertex((double)(par2 + par4), (double)(par3 + par5), 0.0D); 564 par1Tessellator.addVertex((double)(par2 + par4), (double)(par3 + 0), 0.0D); 565 par1Tessellator.draw(); 566 } 567 568 public void func_94149_a(int par1, int par2, Icon par3Icon, int par4, int par5) 569 { 570 Tessellator tessellator = Tessellator.instance; 571 tessellator.startDrawingQuads(); 572 tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + par5), (double)this.zLevel, (double)par3Icon.func_94209_e(), (double)par3Icon.func_94210_h()); 573 tessellator.addVertexWithUV((double)(par1 + par4), (double)(par2 + par5), (double)this.zLevel, (double)par3Icon.func_94212_f(), (double)par3Icon.func_94210_h()); 574 tessellator.addVertexWithUV((double)(par1 + par4), (double)(par2 + 0), (double)this.zLevel, (double)par3Icon.func_94212_f(), (double)par3Icon.func_94206_g()); 575 tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + 0), (double)this.zLevel, (double)par3Icon.func_94209_e(), (double)par3Icon.func_94206_g()); 576 tessellator.draw(); 577 } 578 579 /** 580 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then 581 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic 582 * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1, 583 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. 584 */ 585 public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) 586 { 587 this.doRenderItem((EntityItem)par1Entity, par2, par4, par6, par8, par9); 588 } 589 590 /** 591 * Items should spread out when rendered in 3d? 592 * @return 593 */ 594 public boolean shouldSpreadItems() 595 { 596 return true; 597 } 598 599 /** 600 * Items should have a bob effect 601 * @return 602 */ 603 public boolean shouldBob() 604 { 605 return true; 606 } 607 608 public byte getMiniBlockCount(ItemStack stack) 609 { 610 byte ret = 1; 611 if (stack.stackSize > 1 ) ret = 2; 612 if (stack.stackSize > 5 ) ret = 3; 613 if (stack.stackSize > 20) ret = 4; 614 if (stack.stackSize > 40) ret = 5; 615 return ret; 616 } 617 618 /** 619 * Allows for a subclass to override how many rendered items appear in a 620 * "mini item 3d stack" 621 * @param stack 622 * @return 623 */ 624 public byte getMiniItemCount(ItemStack stack) 625 { 626 byte ret = 1; 627 if (stack.stackSize > 1) ret = 2; 628 if (stack.stackSize > 15) ret = 3; 629 if (stack.stackSize > 31) ret = 4; 630 return ret; 631 } 632}