mojira.dev
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:

[media]

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

Linked issues

Attachments

Comments

tryashtar

Can confirm, although it seems inappropriate to run the loot table when popping a falling block. Should grass path turn into dirt for example? Or stone into cobblestone? Currently they drop themselves

Jayceebee

I think the block state properties should at least be evaluated, so it doesn't drop a single item.

Marty McFly

Affects 20w49a

Avoma

Can confirm in 21w03a.

Avoma

Can confirm in 21w06a.

Avoma

Can confirm in 1.16.5 and 21w08b. Video attached.

ampolive

Can confirm in 1.17.1.

Avoma

Can confirm in 1.19.

windwend

Is this related to MC-260073?

[Mod] Jingy

Requesting ownership of the issue to add additional information to the issue, and maintain future affected versions

Synthestra

[Mod] Jingy

(Unassigned)

Confirmed

Platform

Low

Entities, Loot tables

falling-block-entity, loot_table

Minecraft 1.11.2, Minecraft 1.12 Pre-Release 6, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 1.13.2, ..., 1.20.3, 1.20.4 Release Candidate 1, 1.20.4, 24w07a, 1.20.5

Retrieved