Jump to content

Recommended Posts

Posted

Trying to register my armor in 1.12, updating my mod from 1.11.2 and had to change how I do things, but for some reason once I get my armor registered and I attempt to launch the game, it says

[15:52:57] [main/ERROR]: Exception caught during firing event net.minecraftforge.event.RegistryEvent$Register@660b292c:
java.lang.NoClassDefFoundError: Could not initialize class com.rbs.slurpiesdongles.init.SlurpiesDonglesItems
    at com.rbs.slurpiesdongles.init.RegistrationHandler.registerItems(RegistrationHandler.java:18) ~[RegistrationHandler.class:?]

Here is my items class code 

Spoiler

package com.rbs.slurpiesdongles.init;

import com.rbs.slurpiesdongles.Items.*;
import com.rbs.slurpiesdongles.Items.ItemHoe;
import com.rbs.slurpiesdongles.Items.ItemPickaxe;
import com.rbs.slurpiesdongles.Items.ItemSword;
import com.rbs.slurpiesdongles.Reference;
import com.rbs.slurpiesdongles.armor.ArmorRubyArmor;
import com.rbs.slurpiesdongles.armor.ArmorSapphireArmor;
import com.rbs.slurpiesdongles.armor.ArmorTopazArmor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.init.Blocks;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.*;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.registries.IForgeRegistry;

/**
 * Created by RedBu on 3/19/2016.
 */
public class SlurpiesDonglesItems {

    public static boolean enableExampleItems = true;
        //Dusts
        public static Item blue_glowstone_dust;
        public static Item gray_glowstone_dust;
        public static Item green_glowstone_dust;
        public static Item orange_glowstone_dust;
        public static Item pink_glowstone_dust;
        public static Item purple_glowstone_dust;
        public static Item red_glowstone_dust;
        //Tools
        //public static Item jamez;
        public static Item diamond_battleaxe;
        public static Item diamond_paxel;
        public static Item emerald_battleaxe;
        public static Item gold_paxel;
        public static Item iron_paxel;
        public static Item sapphire_axe;
        public static Item sapphire_battleaxe;
        public static Item sapphire_hoe;
        public static Item sapphire_paxel;
        public static Item sapphire_pickaxe;
        public static Item sapphire_shovel;
        public static Item sapphire_sword;
        public static Item stone_paxel;
        public static Item ruby_axe;
        public static Item ruby_battleaxe;
        public static Item ruby_hoe;
        public static Item ruby_paxel;
        public static Item ruby_pickaxe;
        public static Item ruby_shovel;
        public static Item ruby_sword;
        public static Item topaz_axe;
        public static Item topaz_battleaxe;
        public static Item topaz_hoe;
        public static Item topaz_paxel;
        public static Item topaz_pickaxe;
        public static Item topaz_shovel;
        public static Item topaz_sword;
        public static Item vmpick;
        //Armor
       // public static Item sapphire_helmet;
        //public static Item sapphire_chestplate;
        //public static Item sapphire_leggings;
        //public static Item sapphire_boots;
        public static Item ruby_helmet;
        public static Item ruby_chestplate;
        public static Item ruby_leggings;
        public static Item ruby_boots;
        public static Item topaz_helmet;
        public static Item topaz_chestplate;
        public static Item topaz_leggings;
        public static Item topaz_boots;
        //Items
        public static Item blender;
        public static Item hot_water;
        public static Item pops_sign;
        public static Item knife;
        public static Item time_staff;
        public static Item topaz_handle;
        public static Item vmp_upgrade;
        public static Item repair;
        public static Item hammer;
        //Gems
        public static Item hardened_topaz;
        public static Item lignite;
        public static Item ruby;
        public static Item topaz;
        //Tool Materials
        public static Item.ToolMaterial vmpick_material;
        public static Item.ToolMaterial stone_paxel_material;
        public static Item.ToolMaterial iron_paxel_material;
        public static Item.ToolMaterial gold_paxel_material;
        public static Item.ToolMaterial diamond_paxel_material;
        public static Item.ToolMaterial diamond_battleaxe_material;
        public static Item.ToolMaterial emerald_battleaxe_material;
        public static Item.ToolMaterial sapphire_material;
        public static Item.ToolMaterial sapphire_battleaxe_material;
        public static Item.ToolMaterial sapphire_paxel_material;
        public static Item.ToolMaterial sapphire_sword_material;
        public static Item.ToolMaterial ruby_material;
        public static Item.ToolMaterial ruby_battleaxe_material;
        public static Item.ToolMaterial ruby_paxel_material;
        public static Item.ToolMaterial ruby_sword_material;
        public static Item.ToolMaterial topaz_material;
        public static Item.ToolMaterial topaz_battleaxe_material;
        public static Item.ToolMaterial topaz_sword_material;
        //Armor
        public static final int HELMET_ID = 0;
        public static final int CHESTPLATE_ID = 0;
        public static final int LEGGING_ID = 0;
        public static final int BOOT_ID = 0;
        //Armor Materials
        public static ItemArmor.ArmorMaterial sapphire_armor;
        public static ItemArmor.ArmorMaterial ruby_armor;
        public static ItemArmor.ArmorMaterial topaz_armor;
        //Seeds
        public static Item corn_seed;




    public static void init() {
        /*
        WOOD(0, 59, 2.0F, 0.0F, 15),
        STONE(1, 131, 4.0F, 1.0F, 5),
        IRON(2, 250, 6.0F, 2.0F, 14),
        DIAMOND(3, 1561, 8.0F, 3.0F, 10),
        GOLD(0, 32, 12.0F, 0.0F, 22);
        */

        //Tool Materials string name, harvest level, max uses, effciency, damage, enchantability
        //stone_paxel_material = EnumHelper.addToolMaterial("stone_paxel_material", 1, 393, 4.0F, 1.0F, 5);
        //iron_paxel_material = EnumHelper.addToolMaterial("iron_paxel_material", 2, 750, 6.0F, 2.0F, 14);
       // gold_paxel_material = EnumHelper.addToolMaterial("gold_paxel_material", 0, 96, 12.0F, 0.0F, 22);
        //diamond_paxel_material = EnumHelper.addToolMaterial("diamond_paxel_material", 3, 4683, 8.0F, 3.0F, 10);
        //diamond_battleaxe_material = EnumHelper.addToolMaterial("diamond_battleaxe_material", 0, 1561, 0.0F, 6.0F, 17);
        //emerald_battleaxe_material = EnumHelper.addToolMaterial("emerald_material", 0, 1024, 0.0F, 8.0F, 42);
        //sapphire_battleaxe_material = EnumHelper.addToolMaterial("sapphire_battleaxe_material", 0, 492, 0.0F, 3.5F, 27);
        //sapphire_paxel_material = EnumHelper.addToolMaterial("sapphire_paxel_material", 3, 1476, 8.0F, 1.0F, 27);
        //sapphire_sword_material = EnumHelper.addToolMaterial("sapphire_sword_material", 0, 492, 0.0F, 2.0F, 27);
        //ruby_paxel_material = EnumHelper.addToolMaterial("ruby_paxel_material", 3, 2163, 12.0F, 1.0F, 31);
        //ruby_sword_material = EnumHelper.addToolMaterial("ruby_sword_material", 0, 721, 0.0F, 2.5F, 31);
        //ruby_battleaxe_material = EnumHelper.addToolMaterial("ruby_battleaxe_material", 0, 721, 0.0F, 5.0F, 31);
        //topaz_battleaxe_material = EnumHelper.addToolMaterial("topaz_battleaxe_material", 0, 0, 0.0F, 9.0F, 45);
        //topaz_sword_material = EnumHelper.addToolMaterial("topaz_sword_material", 0, 0, 0.0F, 8.5F, 45);
        //Armor Material
        //Armor
        //sapphire_helmet = (new ArmorSapphireArmor(sapphire_armor, EntityEquipmentSlot.HEAD, "sapphire_helmet"));
        //sapphire_chestplate = (new ArmorSapphireArmor(sapphire_armor, CHESTPLATE_ID, EntityEquipmentSlot.CHEST, "sapphire_chestplate"));
        //sapphire_leggings = (new ArmorSapphireArmor(sapphire_armor, LEGGING_ID, EntityEquipmentSlot.LEGS, "sapphire_leggings"));
        //sapphire_boots = (new ArmorSapphireArmor(sapphire_armor, BOOT_ID, EntityEquipmentSlot.FEET, "sapphire_boots"));
        ruby_helmet = (new ArmorRubyArmor(ruby_armor, HELMET_ID, EntityEquipmentSlot.HEAD, "ruby_helmet"));
        ruby_chestplate = (new ArmorRubyArmor(ruby_armor, CHESTPLATE_ID, EntityEquipmentSlot.CHEST, "ruby_chestplate"));
        ruby_leggings = (new ArmorRubyArmor(ruby_armor, LEGGING_ID, EntityEquipmentSlot.LEGS, "ruby_leggings"));
        ruby_boots = (new ArmorRubyArmor(ruby_armor, BOOT_ID, EntityEquipmentSlot.FEET, "ruby_boots"));
        topaz_helmet = (new ArmorTopazArmor(topaz_armor, HELMET_ID, EntityEquipmentSlot.HEAD, "topaz_helmet"));
        topaz_chestplate = (new ArmorTopazArmor(topaz_armor, CHESTPLATE_ID, EntityEquipmentSlot.CHEST, "topaz_chestplate"));
        topaz_leggings = (new ArmorTopazArmor(topaz_armor, LEGGING_ID, EntityEquipmentSlot.LEGS, "topaz_leggings"));
        topaz_boots = (new ArmorTopazArmor(topaz_armor, BOOT_ID, EntityEquipmentSlot.FEET, "topaz_boots"));
        //Dust
        blue_glowstone_dust = (new ItemBase("blue_glowstone_dust"));
        gray_glowstone_dust = (new ItemBase("gray_glowstone_dust"));
        green_glowstone_dust = (new ItemBase("green_glowstone_dust"));
        orange_glowstone_dust = (new ItemBase("orange_glowstone_dust"));
        pink_glowstone_dust = (new ItemBase("pink_glowstone_dust"));
        purple_glowstone_dust = (new ItemBase("purple_glowstone_dust"));
        red_glowstone_dust = (new ItemBase("red_glowstone_dust"));
        //Fuel
        lignite = (new ItemLignite("lignite"));
        //Items
        blender = (new ItemBase("blender"));
        hot_water = (new ItemBase("hot_water"));
        knife = (new ItemBase("knife"));
        pops_sign = (new ItemBase("pops_sign"));
        time_staff = (new ItemTimeStaff("time_staff"));
        topaz_handle = (new ItemBase("topaz_handle"));
        vmp_upgrade = (new ItemBase("vmp_upgrade"));
        repair = (new DaRepairItem("repair"));
        hammer = (new ItemBase("hammer"));
        //Gems
       // sapphire = (new ItemBase("sapphire"));
        ruby = (new ItemBase("ruby"));
        topaz = (new ItemBase("topaz"));
        hardened_topaz = (new ItemBase("hardened_topaz"));
        //Tools
        //jamez = register(new ItemSword("jamez", topaz_sword_material));
        diamond_battleaxe = (new ItemSword("diamond_battleaxe", diamond_battleaxe_material));
        diamond_paxel = (new ItemPaxel("diamond_paxel", diamond_paxel_material));
        emerald_battleaxe = (new ItemSword("emerald_battleaxe", emerald_battleaxe_material));
        gold_paxel = (new ItemPaxel("gold_paxel", gold_paxel_material));
        iron_paxel = (new ItemPaxel("iron_paxel", iron_paxel_material));
        sapphire_axe = (new ItemSlurpiesDonglesAxe("sapphire_axe", sapphire_material));
        sapphire_battleaxe = (new ItemSword("sapphire_battleaxe", sapphire_battleaxe_material));
        sapphire_hoe = (new ItemHoe("sapphire_hoe", sapphire_material));
        sapphire_paxel = (new ItemPaxel("sapphire_paxel", sapphire_paxel_material));
        sapphire_pickaxe = (new ItemPickaxe("sapphire_pickaxe", sapphire_material));
        sapphire_shovel = (new ItemShovel("sapphire_shovel", sapphire_material));
        sapphire_sword = (new ItemSword("sapphire_sword", sapphire_sword_material));
        stone_paxel = (new ItemPaxel("stone_paxel", stone_paxel_material));
        ruby_axe = (new ItemSlurpiesDonglesAxe("ruby_axe", ruby_material));
        ruby_battleaxe = (new ItemSword("ruby_battleaxe", ruby_battleaxe_material));
        ruby_hoe = (new ItemHoe("ruby_hoe", ruby_material));
        ruby_paxel = (new ItemPaxel("ruby_paxel", ruby_paxel_material));
        ruby_pickaxe = (new ItemPickaxe("ruby_pickaxe", ruby_material));
        ruby_shovel = (new ItemShovel("ruby_shovel", ruby_material));
        ruby_sword = (new ItemSword("ruby_sword", ruby_sword_material));
        topaz_axe = (new ItemSlurpiesDonglesAxe("topaz_axe", topaz_material));
        topaz_battleaxe = (new ItemSword("topaz_battleaxe", topaz_battleaxe_material));
        topaz_hoe = (new ItemHoe("topaz_hoe", topaz_material));
        topaz_paxel = (new ItemPaxel("topaz_paxel", topaz_material));
        topaz_pickaxe = (new ItemPickaxe("topaz_pickaxe", topaz_material));
        topaz_shovel = (new ItemShovel("topaz_shovel", topaz_material));
        topaz_sword = (new ItemSword("topaz_sword", topaz_sword_material));
        vmpick = (new VmPick("vmpick", vmpick_material));
        //Seeds
        corn_seed = (new ItemCornSeed("corn_seed", SlurpiesDonglesBlocks.corn_crop, Blocks.FARMLAND));
    }

    public static Item sapphire_helmet = new ArmorSapphireArmor(sapphire_armor, EntityEquipmentSlot.HEAD, "sapphire_helmet", "sapphire");
    public static Item sapphire_chestplate = new ArmorSapphireArmor(sapphire_armor, EntityEquipmentSlot.CHEST, "sapphire_chestplate", "sapphire");
    public static Item sapphire_leggings = new ArmorSapphireArmor(sapphire_armor, EntityEquipmentSlot.LEGS, "sapphire_leggings", "sapphire");
    public static Item sapphire_boots = new ArmorSapphireArmor(sapphire_armor, EntityEquipmentSlot.FEET, "sapphire_boots", "sapphire");

        public static Item sapphire = new ItemBase("sapphire");
    //Armor



    public static void register(IForgeRegistry<Item> registry) {
        registry.registerAll(
                sapphire_helmet,
                sapphire_chestplate,
                sapphire_leggings,
                sapphire_boots,
                //Armor
                sapphire

        );
    }



    public static void registerRenders() {
        //Tools
        //registerRender(jamez);
/*        registerRender(diamond_battleaxe);
        registerRender(diamond_paxel);
        registerRender(emerald_battleaxe);
        registerRender(gold_paxel);
        registerRender(iron_paxel);
        registerRender(sapphire_axe);
        registerRender(sapphire_battleaxe);
        registerRender(sapphire_hoe);
        registerRender(sapphire_paxel);
        registerRender(sapphire_pickaxe);
        registerRender(sapphire_shovel);
        registerRender(sapphire_sword);
        registerRender(stone_paxel);
        registerRender(ruby_axe);
        registerRender(ruby_battleaxe);
        registerRender(ruby_hoe);
        registerRender(ruby_paxel);
        registerRender(ruby_pickaxe);
        registerRender(ruby_shovel);
        registerRender(ruby_sword);
        registerRender(topaz_axe);
        registerRender(topaz_battleaxe);
        registerRender(topaz_hoe);
        registerRender(topaz_pickaxe);
        registerRender(topaz_paxel);
        registerRender(topaz_shovel);
        registerRender(topaz_sword);
        registerRender(vmpick);
        //Armor
        registerRender(sapphire_helmet);
        registerRender(sapphire_chestplate);
        registerRender(sapphire_leggings);
        registerRender(sapphire_boots);
        registerRender(ruby_helmet);
        registerRender(ruby_chestplate);
        registerRender(ruby_leggings);
        registerRender(ruby_boots);
        registerRender(topaz_helmet);
        registerRender(topaz_chestplate);
        registerRender(topaz_leggings);
        registerRender(topaz_boots);
        //Dust
        registerRender(blue_glowstone_dust);
        registerRender(gray_glowstone_dust);
        registerRender(green_glowstone_dust);
        registerRender(orange_glowstone_dust);
        registerRender(pink_glowstone_dust);
        registerRender(purple_glowstone_dust);
        registerRender(red_glowstone_dust);
        //Fuel
        registerRender(lignite);
        //Items
        registerRender(blender);
        registerRender(hot_water);
        registerRender(pops_sign);
        registerRender(knife);
        registerRender(time_staff);
        registerRender(topaz_handle);
        registerRender(vmp_upgrade);
        registerRender(repair);
        registerRender(hammer);
        //Gems
        registerRender(sapphire);
        registerRender(ruby);
        registerRender(topaz);
        registerRender(hardened_topaz);
        //Seeds
        registerRender(corn_seed);
        */
        //Armor
        registerRender(sapphire_helmet);
        registerRender(sapphire_chestplate);
        registerRender(sapphire_leggings);
        registerRender(sapphire_boots);
        //Gems
        registerRender(sapphire);

    }

    public static void registerRender(Item item) {
        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
    }

}

Here is my Registration Handler class 

Spoiler

package com.rbs.slurpiesdongles.init;

import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

/**
 * Created by Consular on 7/20/2017.
 */
@Mod.EventBusSubscriber
public class RegistrationHandler {

    @SubscribeEvent
    public static void registerItems(RegistryEvent.Register<Item> event) {
        SlurpiesDonglesBlocks.registerItemBlocks(event.getRegistry());
        SlurpiesDonglesItems.register(event.getRegistry());


    }

    @SubscribeEvent
    public static void registerBlocks(RegistryEvent.Register<Block> event) {
        SlurpiesDonglesBlocks.registerBlocks(event.getRegistry());
    }
}

and yeah i've got the RegistrationHandler class called in my main under PreInit with this. 

FMLCommonHandler.instance().bus().register(new RegistrationHandler());
Posted

That's not the full error, the NoClassDefFoundError was almost certainly caused by another exception that indicates what actually went wrong.

 

The FML event bus (FMLCommonHandler#bus) has been deprecated since 1.8.9 (when it was merged with the Forge event bus), don't use it.

 

As explained in Forge's documentation on events, registering an instance with an event bus will only register the non-static @SubscribeEvent methods and registering the Class object (or annotating the class with @Mod.EventBusSubscriber) will only register the static @SubscribeEvent methods.

 

If you're using @Mod.EventBusSubscriber, you don't need to manually register your class with the Forge event bus.

 

Your code is quite hard to read on the dark theme. In future, please paste your code into the post without formatting and use the built-in syntax highlighting of the code blocks. Alternatively, post your code using Gist or Pastebin.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.