neoforged/NeoForge

[1.21.3] Crash when using custom ToolMaterial

Closed this issue · 1 comments

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

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