neoforged / NeoForge

Neo Modding API for Minecraft, based on Forge
https://neoforged.net
Other
1.25k stars 179 forks source link

[1.21.3] Crash when using custom ToolMaterial #1631

Closed yanny7 closed 4 weeks ago

yanny7 commented 1 month ago

Minecraft Version: 1.21.3

NeoForge Version: 21.3.3-beta

Logs: https://pastebin.com/ZVbGqum0

Steps to Reproduce:

  1. Run DataGen with Item using custom ToolMaterial
  2. Crash happens:
public static final DeferredItem<Item> SHARP_FLINT = ITEMS.registerItem("sharp_flint", (properties) -> knife(properties));

...

    public static Item knife(Properties properties) {
        ToolMaterial toolMaterial = new ToolMaterial(BlockTags.INCORRECT_FOR_STONE_TOOL, 160, 5.0F, 0.5F, 10, ItemTags.BEDS);
        properties = toolMaterial.applyCommonProperties(properties);
        properties = properties.component(DataComponents.TOOL, new Tool(List.of(), 1.0F, 1));
        properties = properties.attributes(toolMaterial.createToolAttributes(0.0F, 4.0F));
        return new ToolItem(properties);
    }

Description of issue: Crash happens when creating item with custom ToolMaterial or ArmorMaterial

neoforged-releases[bot] commented 4 weeks ago

🚀 This issue has been resolved in NeoForge version 21.3.7-beta, as part of #1651.