mojira.dev
MC-279265

Item modifiers applied from a "consume_item" advancement exhibit inconsistent behavior

Within the reward function of the advancement minecraft:consume_item, item modifiers, which target the item triggering the advancement, do not apply / work oddly or inconsistently.

For example, updating the consumed item's `use_remainder` component does not work the first time its done. It may also prevent stack size from changing.
Another example is increasing/setting the consumed item's count - which sometimes doesn't work, depending on the stack size. Additionally, this sometimes results in visual/functional bugs.

Steps to Reproduce:

  [Step 1]Download and load the datapack:

[media]

  [Step 2]In game, enter the command `/reload`. Attempt to consume the given items.

  [Step 3]Type `/reload` again, separate the items down to 1 per stack without consuming, and attempt to consume the items again.

  [Step 4]Disable the previous datapack. Download and load the datapack:

[media]

  [Step 5]Attempt to consume the sword.

Observed Results:

In [Step 2]:

The unenchanted diamonds will be consumed and reduce in stack size.
The enchanted diamonds will be consumed, but the stack size will not change. The first remainder created will be a barrier item. Afterwards, the remainders will be nether star items.
The unenchanted glowstonedust will be consumed and reduce in stack size.
The enchanted glowstonedust will be consumed, but the stack size will not change. The first remainder created will be a barrier item. Afterwards, the remainders will be nether star items.

In [Step 3]:

The single unenchanted diamond will be consumed and depleted.
The single enchanted diamond will be consumed and depleted.. A barrier remainder is created.
The single unenchanted glowstonedust will be consumed and depleted.
The single enchanted glowstonedust will be consumed and depleted. A barrier remainder is created.

In [Step 5]:

The sword will be consumed but not disappear from the inventory. However, it will visually be missing, and not be able to be clicked. Pressing the offhand key or moving it around in the inventory will update it.

Expected Results:

In [Step 2]:

The unenchanted diamonds/glowstonedust should maintain the same stack size (correct/expected behavior).
The enchanted diamonds/glowstonedust SHOULD reduce in stack size, and the first remainder created SHOULD be a nether star item.

In [Step 3]:

The unenchanted diamond/glowstonedust SHOULD maintain the same stack size.
The enchanted diamond/glowstonedust SHOULD create a remainder nether star item.

In [Step 5]:

The sword SHOULD stay visible and usable in the inventory, without needing to move it around in the inventory.

Notes:

Unenchanted items test the `set_count` modifier. Enchanted items test the `set_components` (use_remainder) modifier.
The diamonds test the `item modify` command. The glowstonedust test the `item replace` command. A barrel containing the expected result is placed under the player as a result (for the glowstonedust).

 

Linked issues

Attachments

Comments 5

Please attach a datapack that can be used to reproduce the issue.

Description has been updated. A datapack is included as well.

A second datapack highlighting the visual/functional bug has been included

Please confirm these datapacks are formatted correctly. Trying to activate them on my testing server displays 'Missing metadata in pack file'

Datapack formats have been updated and now work. Redundant directories have been removed

RedSyven

(Unassigned)

Confirmed

Platform

Normal

Data Packs, Items

1.21.4

Retrieved