Mojira Archive
MC-161191

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

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
                        }
                     }
. . .