Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-5232

Unnecessary null-check in Item Rendering code

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • Minecraft 1.4.6
    • MCP 725
    • Unconfirmed

      File: Seargename "RenderItem", Notchname "bce"
      Method Signature: a(LEntityItem;IIFFFF)V
      At Obfuscated Source File Line 176
      At MCP Source File Line 246
      Near:
      ```
      GL11.glTranslatef(0.0F, 0.0F, var16 + var17);
      if (Block.blocksList[var18.itemID] != null)
      {
      this.loadTexture("/terrain.png");
      }
      else
      ```
      Var18 is the item contained in the EntityItem.
      There are no bounds-checks on this statement to check if var18.itemID will fit into that array. Even though it seems like this is not crashing the game yet, it's possible that that statement could generate an ArrayIndexOutOfBounds exception in certain cases, like a 4096-block fix.

      To be honest, I have no clue how this doesn't cause an exception when you drop an item :s

      A better way would be to check the item array and do instanceof.

            Unassigned Unassigned
            riking Riking (Kane York)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: