-
Bug
-
Resolution: Fixed
-
Minecraft 1.11.2, Minecraft 17w17b
-
Confirmed
The bug
When placing blocks, the default state of the block is used to check for collision with entities when deciding if it should be allowed to be placed.
This can lead to some strange valid placement conditions for certain blocks that have different collision boxes depending on state.
Blocks that I've found so far that are affected include Ladders, Fence Gates, Slabs, Anvils, End Rods, and Trapdoors.
Examples
- Placing Ladders on any side of a Block always succeeds unless an Entity is in the southern part of the Block that the Ladder will occupy, which is the location of the collision box of a north-facing Ladder, which is the default state.
- You can place upper Slabs intersecting an Entity's collision box if it is standing on a slab and partially intersecting the top of the Block you want to place the Slab in, assuming that Block doesn't have a bottom Slab already.
Code analysis
Based on 1.11.2 decompiled using MCP 9.37
The method net.minecraft.world.World.mayPlace(Block, BlockPos, boolean, EnumFacing, Entity) calls blockIn.getDefaultState().getCollisionBoundingBox(this, pos) and checks if this box intersects with the collision boxes of any Entities at the BlockPos parameter. Replacing the Block parameter with an IBlockState and using it instead of the default state to get the collision box may fix the problem.
- is duplicated by
-
MC-100621 Able to place upside down slabs inside yourself
- Resolved
-
MC-109736 Can place ladders where we normally can't (in our body)
- Resolved
-
MC-130931 Place slab in player
- Resolved
- relates to
-
MC-2208 Blocks with special placement can be placed inside player / entity
- Resolved
-
MC-221256 Collision checking of block placement ignores block states of items
- Open
-
MC-60117 Upper slabs can't be placed when standing on a lower slab 2 blocks below
- Resolved