Json Things

Json Things

982k Downloads

[Forge 1.20.1] Repairing a custom tier item in an anvil crashes the game

Closed this issue ยท 2 comments

commented

Defining a new tool/weapon with a custom item tier and its respective repair material, the game crashes when placing the custom tool in an anvil with said repair material (or any other item for that matter).

I believe the repair material is not being properly added to the registry, the crash happens due to a NullPointerException (Caused by: java.lang.NullPointerException: Cannot invoke "java.util.function.Supplier.get()" because "this.repairIngredient" is null).

I have tried this both with vanilla and modded items and tags and the problem seems to be persistent.

Minecraft 1.20.1 - Forge 47.4.0 - JsonThings 0.9.9
Here is my log:
latest.log

commented

Here are my jsons in case I made a typo:

item_tier/silver.json:

{
"uses": 182,
"speed": 1.0,
"attack_damage_bonus": 2.5,
"enchantment_value": 3,
"tag": "forge:requires_gold_tool",
"repair_ingredient": {
"item": "minecraft:iron_ingot"
},
"sort_after": [],
"sort_before": []
}

item/silver.sword:

{
"parent": "minecraft:golden_sword",
"type": "sword",
"fire_resistant": false,
"tier": "silver_gear:silver",
"damage": 2,
"speed": -2.4,
"creative_menu_stacks": [
{
"tabs": [
"combat"
]
}
]
}

commented

Thanks for the report, I looked into it and it seems to have been a silly copypasta. It works for tags, but not individual items. Will release updated builds as soon as I finish testing.