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

Falling block can place directional block state at invalid position

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • None
    • Minecraft 1.11.2, Minecraft 17w06a, Minecraft 1.12.2, Minecraft 18w05a, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w48a, Minecraft 18w48b, Minecraft 18w49a, Minecraft 18w50a
    • Confirmed
    • (Unassigned)

      The bug

      Falling block entities can place directional block states at invalid positions. For example a lever attached to the ceiling is placed without ceiling.

      How to reproduce

      Use the following command while standing on a block a lever can be placed on, like for example stone

      /summon falling_block ~ ~ ~ {Time:1,BlockState:{Name:"minecraft:lever"}}
      

      Code analysis

      Based on 1.11.2 decompiled using MCP 9.35 rc1

      The method net.minecraft.entity.item.EntityFallingBlock.onUpdate() calls the method net.minecraft.world.World.mayPlace(Block, BlockPos, boolean, EnumFacing, Entity) always with EnumFacing.UP but places the stored block state which is not necessarily facing upwards.

      This could maybe be solved by adding a general method boolean isStateValidForPosition(World world, IBlockState blockState, BlockPos position) since many blocks currently have a method similar to this anyways which is called when they are updated.

            Unassigned Unassigned
            marcono1234 [Mod] Marcono1234
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: