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

Falling Block entity does not evaluate block loot table when being broken

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 1.11.2, Minecraft 1.12 Pre-Release 6, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 1.13.2, Minecraft 18w43c, 1.14.4, 19w37a, 19w38a, 1.15.1, 1.15.2, 1.16 Pre-release 1, 1.16.3, 1.16.4 Pre-release 1, 20w49a, 21w03a, 1.16.5, 21w06a, 21w08b, 1.17.1, 1.19, 1.19.3, 23w06a, 1.20.1, 1.20.2, 23w41a, 23w43a, 23w46a, 1.20.3, 1.20.4 Release Candidate 1, 1.20.4, 24w07a, 1.20.5
    • Confirmed
    • Entities, Loot tables
    • Low
    • Platform

      The Bug:

      When a falling block entity is destroyed, it will exclusively drop whatever block it's "BlockState" data is, ignoring any loot tables for the block.

      Steps to Reproduce:

      Summon a falling block entity set to a "double oak slab"

      /summon falling_block ~ ~ ~ {BlockState:{Name:"minecraft:oak_slab",Properties:{type:"double"}},Time:601,DropItem:1b} 

      Observed & Expected:

      - The falling block entity will be destroyed, and drop a single oak slab.
      - The falling block entity would drop whatever it's 'BlockState' data is set to. In this case it would be two oak slabs, as the slab block is double.

      Screenshots/Videos:

      MC-161191.mp4

      Notes:

      1. This directly affects gameplay, as if the player specifically changes a block's loot table which has a naturally occuring falling block entity counter part (such as sand, gravel, or pointed dripstone), it will always drop itself, and not evaluate any custom loot tables set (See MC-212228). This primarily negatively impacts map creators.

      Code Analysis:

      Near the end of the below "tick()" method, if some conditions are met and the entity is discarded, it will execute the "spawnAtLocation(Block)" method which simply takes in the block state of what ever the falling block entity is set to, and return that.

      Class: net\minecraft\world\entity\item\FallingBlockEntity.java Method: tick()
      

      (Method condensed for ease of reading)

      . . .
      Block block = this.blockState.getBlock();
      . . .
      
      . . .
                           } else {
                              this.discard();
                              if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
                                 this.callOnBrokenAfterFall(block, blockpos);
      //Issue Start
                                 this.spawnAtLocation(block);
      //Issue End
                              }
                           }
      . . .
      

            Unassigned Unassigned
            Jingy [Mod] Jiingy
            Votes:
            18 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              CHK: