mojira.dev
MC-307210

Custom villager trades don't respect stack sizes for non-stackable "want" items.

When defining a custom villager trade, output items can be made stackable even if their vanilla item ID is not by default. However, if an input item in the “wants” or “additional wants” field has a stack size applied, the game will reset its count to 1 if the item is not stackable by default, even if the “max_stack_size” component is adjusted in the trade definition.

In the example attached, I’m using beetroot soup as the base item for the custom “caramel” item in the additional want slot, and rabbit stew as the base item for the custom “molasses cookie” item in the output slot. I set the “additional_want” count to 4, and the “gives” count to 12. The expected result is that the trade should require 4 emeralds and 4 caramel, to output 12 molasses cookies; however, as seen in the screenshot, the emerald and cookie counts are correct, but the caramel count is reset to 1, despite the fact that its “max_stack_size” component should make it stackable.

Here’s the full trade definition file that produced the attached screenshot:

{
    "wants": {
        "id": "minecraft:emerald",
        "count": 4
    },
    "additional_wants": {
        "id": "minecraft:beetroot_soup",
        "count": 4,
        "components": {
            "minecraft:max_stack_size": 64
        }
    },
    "gives": {
        "id": "minecraft:rabbit_stew",
        "count": 12,
        "components": {
            "minecraft:item_model": "ministrapp:food/molasses_cookie",
            "minecraft:item_name": {
                "type": "translatable",
                "translate": "item.ministrapp.molasses_cookie",
                "fallback": "Molasses Cookie"
            },
            "minecraft:max_stack_size": 64,
            "minecraft:consumable": {
                "consume_seconds": 2,
                "animation": "eat",
                "sound": "minecraft:entity.generic.eat",
                "has_consume_particles": true
            },
            "minecraft:food": {
                "nutrition": 5,
                "saturation": 8,
                "can_always_eat": false
            },
            "!minecraft:use_remainder": {}
        }
    },
    "max_uses": 6,
    "reputation_discount": 0.02,
    "xp": 5
}

Attachments

Comments 1

Thank you for helping us improve Minecraft! We saved your files:

[media]

Erik Morris

(Unassigned)

Unconfirmed

(Unassigned)

26.1.1

Retrieved