KubeJS-Mods / KubeJS

https://kubejs.com
GNU Lesser General Public License v3.0
307 stars 90 forks source link

[1.19.2 forge] Campfire cooking recipe not using the correct nbt data #840

Closed YOYOK9 closed 3 months ago

YOYOK9 commented 4 months ago

Minecraft Version

1.19.2

KubeJS Version

1902.6.2-build.69

Rhino Version

1902.2.3-build.284

Architectury Version

6.6.92

Forge/Fabric Version

Forge 43.3.13

Describe your issue

Was trying to make a custom campfire recipe to turn water bottles into a "purified water" bottle from the Survive mod. Depending on what recipe option I chose event.campfireCooking or event.custom with vanillas datapack structure I would get 1 of 2 results:

1:

ServerEvents.recipes(event => {
    event.campfireCooking(Item.of('minecraft:potion', '{Potion:"survive:purified_water"}'), Item.of('minecraft:potion', '{Potion:"minecraft:water"}'))
})

Would result in the correct output, but the input was an un-craftable potion. JEI SS: https://i.imgur.com/OnF1qBq.png

2:

event.custom({
        "type": "minecraft:campfire_cooking",
        "cookingtime": 600,
        "experience": 0.0,
        "ingredient": {
          "item": "minecraft:potion", 
          "nbt": {"Potion":"minecraft:water"}
        },
        "result": "minecraft:potion", 
        "nbt": {"Potion":"survive:purified_water"}
      })

Would result in both input/output to be un-craftable potions JEI SS: https://i.imgur.com/BVBvOZL.png


I had a chat with 2 devs I know of to try and figure out a solution before reporting here. both thought it was possible issue in Forge itself, However after some poking at the script, this was produced and works with no issues

event.campfireCooking(
        Item.of(
            'minecraft:potion',
            {
                "Potion":"survive:purified_water"
            }
        ),
        Ingredient.of(
            {
                type: "forge:partial_nbt",
                item: "minecraft:potion",
                nbt: {
                    Potion: "minecraft:water"
                }
            }
        )
    )

Input and output are as they should be in game. JEI SS: https://i.imgur.com/3iDuHpa.png

Incase its needed, used Survive-1.19.2-8.0.8.2, but should be the same for really any minecraft potion

Crash report/logs

No response

MundM2007 commented 4 months ago

So basically If you use your First script and add a .strongNBT() after the Input Item.of it should work

YOYOK9 commented 4 months ago

That worked. Didn't see this when looking at the wiki

MaxNeedsSnacks commented 3 months ago

Yeah this is intentional, by default Ingredients are set to ignore NBT and KubeJS just keeps with that behaviour (mostly because we don't want to decide on strong / weak NBT for you)