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

Code does not stop the prevention of placing null blocks. As a result, you can place solid blocks in the block you are standing in

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • Minecraft 1.5.1, Minecraft 1.5.2, Minecraft 1.6.1
    • Java 7, Windows 7 64 bit
    • Unconfirmed
    • Survival

      This happens when you have a stack of 2 dirt blocks in your inventory. It happens with gravel blocks too. I was using a 2x2 room to provide an example of the bug.

      To reproduce:
      Place the stack of dirt blocks in the first inventory slot in your inventory (Make sure that they are the only dirt blocks in your inventory).
      Place one dirt block in a corner of a room.
      Stand on the block behind the dirt block.
      Look at the side of the dirt block and press and hold both mouse buttons.

      When you pick up the dirt blocks, you will sometimes immediately place it in the block you are standing on.

      I have provided a screenshot showing the bug. It was taken in 1.5.2 but since then I have updated the game to 1.6.1 and it is still happening.

      Edit:
      I just had a chance to look at the decompiled code and after browsing for some time, I found some code that I think executes too late. It executes after the statement that sends the message to place the block in the world so I moved that piece of code to a section before that stament executes and after 5 minutes of mining the same two blocks I have been unable to reproduce this bug.

      Using MCP namings:
      In the PlayerControllerMP file there is a method called onPlayerRightClick. I changed a section of the method to this.

      ...

      //The code should be here
      if (par3ItemStack == null)

      { return false; }

      if (!var12 && par3ItemStack != null && par3ItemStack.getItem() instanceof ItemBlock)
      {
      ItemBlock var16 = (ItemBlock)par3ItemStack.getItem();

      if (!var16.canPlaceItemBlockOnSide(par2World, par4, par5, par6, par7, par1EntityPlayer, par3ItemStack))

      { return false; }

      }

      this.netClientHandler.addToSendQueue(new Packet15Place(par4, par5, par6, par7, par1EntityPlayer.inventory.getCurrentItem(), var9, var10, var11));

      if (var12)

      { return true; }

      //This code shouldn't be here
      //else if (par3ItemStack == null)
      //

      { // return false; //}

      else if

      ...

            Unassigned Unassigned
            JerryH001 Jerry Hundric
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: