mojira.dev
MC-101169

Double slab creation over offhand

The bug

When you press the place/interact key with a slab item on a bottom slab, it tries to place it, even when that action collides with an entity. Meaning: It plays the animation and off-hand items can't be used.

How to reproduce

  1. Slab on floor

  2. Slab in main hand

  3. Bow/food/whatever in off-hand

  4. Stand on slab

  5. Look down

  6. Press action key (standard: right click)
    → Bow/food doesn't get triggered, but slab, although it can't be placed.

Code analysis

Code analysis by @unknown can be found in this comment.

Linked issues

Attachments

Comments 3

Attached a screenshot with bow in offhand and slab in main hand playing the animation. Notice that my hands are set to left-handed mode.

Please link to this comment in the description

The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.

The reason why this happens is because the method net.minecraft.item.ItemSlab.onItemUse(ItemStack, EntityPlayer, World, BlockPos, EnumHand, EnumFacing, float, float, float) returns that it sucessfully used the slab if the slab matches with an existing slab at this position. Instead it should only return that the slab was sucessfully placed if it was really placed. Same applies to the method net.minecraft.item.ItemSlab.tryPlace(EntityPlayer, ItemStack, World, BlockPos, Object).

Issue has been fixed since 17w47b.

FaRo1

(Unassigned)

Confirmed

Minecraft 1.9.3 Pre-Release 1, Minecraft 1.10.2, Minecraft 16w43a, Minecraft 1.12.1, Minecraft 1.12.2

Minecraft 17w47b

Retrieved