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)
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)
//
else if
...
- duplicates
-
MC-2208 Blocks with special placement can be placed inside player / entity
- Resolved