Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Problem with Armor Repair Ingredient (solved)


Recommended Posts

(bruh null pointer exception)

I'm watching a tutorial for modding and this error shows up every time, i can't find the issue anywhere.

I've been looking at other people's code but still, can't find the issue...

 

ModArmorMaterial:

SILVER(IRBS.MOD_ID + ":silver", 15, new int[] { 2, 5, 6, 2 }, 18,
        SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0.5F, () -> { return Ingredient.fromItems(RegistryHandler.SILVER.get()); });

I get the error " Cannot resolve symbol 'SILVER' "

 

RegistryHandler:

package com.inconsequente.irbs.util;

import com.inconsequente.irbs.IRBS;
import com.inconsequente.irbs.armor.ModArmorMaterial;
import com.inconsequente.irbs.blocks.BlockItemBase;
import com.inconsequente.irbs.blocks.SilverBlock;
import com.inconsequente.irbs.blocks.SilverOre;
import com.inconsequente.irbs.items.ItemBase;
import com.inconsequente.irbs.tools.ModItemTier;
import net.minecraft.block.Block;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.SwordItem;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

public class RegistryHandler {

    public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, IRBS.MOD_ID);
    public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, IRBS.MOD_ID);

    public static void init() {
        ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
        BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus());
    }

    // Items
    public static final RegistryObject<Item> SILVER_INGOT = ITEMS.register("silver_ingot", ItemBase::new);

    // Tools
    public static final RegistryObject<SwordItem> SILVER_SABRE = ITEMS.register("silver_sabre", () ->
            new SwordItem(ModItemTier.SILVER, 4, 1.5F, new Item.Properties().group(IRBS.TAB)));

    // Armor
    public static final RegistryObject<ArmorItem> SILVER_HELMET = ITEMS.register("silver_helmet", () ->
            new ArmorItem(ModArmorMaterial.SILVER, EquipmentSlotType.HEAD, new Item.Properties().group(IRBS.TAB)));
    public static final RegistryObject<ArmorItem> SILVER_CHESTPLATE = ITEMS.register("silver_chestplate", () ->
            new ArmorItem(ModArmorMaterial.SILVER, EquipmentSlotType.CHEST, new Item.Properties().group(IRBS.TAB)));
    public static final RegistryObject<ArmorItem> SILVER_LEGGINGS = ITEMS.register("silver_leggings", () ->
            new ArmorItem(ModArmorMaterial.SILVER, EquipmentSlotType.LEGS, new Item.Properties().group(IRBS.TAB)));
    public static final RegistryObject<ArmorItem> SILVER_BOOTS = ITEMS.register("silver_boots", () ->
            new ArmorItem(ModArmorMaterial.SILVER, EquipmentSlotType.FEET, new Item.Properties().group(IRBS.TAB)));

    // Blocks
    public static final RegistryObject<Block> SILVER_BLOCK = BLOCKS.register("silver_block", SilverBlock::new);
    public static final RegistryObject<Block> SILVER_ORE = BLOCKS.register("silver_ore", SilverOre::new);

    // Block Items
    public static final RegistryObject<BlockItem> SILVER_BLOCK_ITEM = ITEMS.register("silver_block", () -> new BlockItemBase(SILVER_BLOCK.get()));
    public static final RegistryObject<BlockItem> SILVER_ORE_ITEM = ITEMS.register("silver_ore", () -> new BlockItemBase(SILVER_ORE.get()));
}

 

Edited by inconsequente
found the answer myself
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.