package com.zivilon.cinder_loe;

import com.zivilon.cinder_loe.blocks.*;
import com.zivilon.cinder_loe.character.CharacterEventListener;
import com.zivilon.cinder_loe.character.CharacterRoleAPI;
import com.zivilon.cinder_loe.client.render.*;
import com.zivilon.cinder_loe.client.render.corrupt.*;
import com.zivilon.cinder_loe.command.CommandCinderCharacter;
import com.zivilon.cinder_loe.entity.*;
import com.zivilon.cinder_loe.entity.corrupt.*;
import com.zivilon.cinder_loe.entity.npc.*;
import com.zivilon.cinder_loe.entity.trader.BladorthinSmith;
import com.zivilon.cinder_loe.entity.trader.LimwaithFishmonger;
import com.zivilon.cinder_loe.entity.trader.LimwaithShaman;
import com.zivilon.cinder_loe.entity.trader.RedDwarfSmith;
import com.zivilon.cinder_loe.items.*;
import com.zivilon.cinder_loe.tileentity.*;
import com.zivilon.cinder_loe.util.Utilities;
import com.zivilon.cindercore.CinderCore;
import lotr.common.block.LOTRBlockGate;
import lotr.common.item.*;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.potion.Potion;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.util.TraceClassVisitor;

import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;

import lotr.client.render.entity.*;
import lotr.client.render.entity.LOTRRenderSauron;
import lotr.client.render.tileentity.LOTRRenderUtumnoPortal;
import lotr.common.LOTRCreativeTabs;
import lotr.common.LOTRMod;
import lotr.common.entity.animal.*;
import lotr.common.entity.npc.*;
import lotr.common.entity.npc.LOTREntityBarrowWight;
import lotr.common.entity.npc.LOTREntitySauron;
import lotr.common.entity.projectile.LOTREntityGandalfFireball;
import lotr.common.world.biome.LOTRBiome;
import lotr.common.world.spawning.LOTRBiomeSpawnList;
import lotr.common.world.spawning.LOTRSpawnEntry;
import lotr.common.world.spawning.LOTRSpawnList;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;

import static lotr.common.LOTRMod.horseArmorIron;
import static lotr.common.item.LOTRMaterial.NEAR_HARAD;

import net.minecraft.command.ICommandSender;
import net.minecraft.command.CommandBase;
import net.minecraft.util.ChatComponentText;
import net.minecraftforge.client.ClientCommandHandler;

@Mod(
    modid = "cinder_loe",
    version = "1.2.5",
    name = "CinderLoE",
    dependencies = "required-after:spongemixins@[1.1.0,);required-after:lotr",
    acceptedMinecraftVersions = "[1.7.10]",
    acceptableRemoteVersions = "[1.2.5]")
public class CinderLoE {

    @Instance("cinder_loe")
    public static CinderLoE instance;

    public static final Logger LOG = LogManager.getLogger(Tags.MODID);

    // LOTR Materials
    public static LOTRMaterial MATERIAL_RED_DWARF;
    public static LOTRMaterial MATERIAL_BONEMOLD;
    public static LOTRMaterial MATERIAL_LIMWAITH_WOOD;
    public static LOTRMaterial EVENT;
    public static LOTRMaterial MATERIAL_BREE;
    public static LOTRMaterial MATERIAL_RHUDUAR;
    public static LOTRMaterial MATERIAL_BATTLENUN;
    public static LOTRMaterial MATERIAL_ASH;
    public static LOTRMaterial MATERIAL_SERPENT;
    public static LOTRMaterial MATERIAL_USURPER;
    public static LOTRMaterial MATERIAL_WARLORD;
    public static LOTRMaterial MATERIAL_JADE;


    // Blocks
   // public static Block barricade;
    public static Block cinderBlock;
    public static Block ivoryBlock;
    public static Block blockRedDwarfSteel;
    public static Block barsRedDwarf;
    public static Block chandelierRedDwarf;
    public static Block furBundle;
    public static Block leatherBundle;
    public static Block reedBale;
    public static Block dwarvenBrickRuned;
    public static Block fishBarrel;
    public static Block rustedsword;
    public static Block mistBlock;
    public static Block cutDrystone;
    public static Block cobbleDrystone;
    public static Block reeflessCoral;
    public static Block silverChain;
    public static Block goldChain;
    public static Block ironChain;
    public static Block bronzeChain;
    public static Block plaster;
    public static Block voidblock;
    //public static Block verticalWeaponRack;

    //Gates
    //public static Block gatecharredportcullis;

    //Food Crop blocks
    public static Block onionCrop;
    public static Block cabbageCrop;
    //Food! Yum :P
    public static Item onion;
    public static Item cabbage;
    public static Item pelmen;
    public static Item spice;
    public static Item spicedHam;
    public static Item lightStew;
    public static Item chocolatebar;
    public static Item fruitsalad;
    public static Item flour;
    public static Item dough;
    public static Item pasta;
    public static Item pretzel;
    public static Item halva;
    public static Item honey;

    // Misc
    public static Item frostblade;
    public static Item daggervoid;
    public static Item spearsolidgold;
    public static Item spearUnnamed;
    public static Item whip;
    public static Item swordAsh;
    public static Item staffAsh;
    public static Item daggerAsh;
    public static Item spearAsh;
    public static Item hammerAsh;
    public static Item battleaxeAsh;
    public static Item pikeAsh;
    public static Item bowAsh;
    public static Item ingotAsh;
    public static Item helmetbrokenhalo;
    public static Item helmetJade;
    public static Item bodyJade;
    public static Item legsJade;
    public static Item bootsJade;

    // Elite Armors
    public static Item helmetserpent;
    public static Item bodyserpent;
    public static Item legsserpent;
    public static Item bootsserpent;
    public static Item helmetUsurper;
    public static Item bodyUsurper;
    public static Item legsUsurper;
    public static Item bootsUsurper;
    public static Item helmetWarlord;
    public static Item bodyWarlord;
    public static Item legsWarlord;
    public static Item bootsWarlord;

    // Red Dwarves
    public static Item redDwarfSteel;
    public static Item helmetRedDwarf;
    public static Item bodyRedDwarf;
    public static Item legsRedDwarf;
    public static Item bootsRedDwarf;
    public static Item spearRedDwarf;
    public static Item swordRedDwarf;
    public static Item battleaxeRedDwarf;
    public static Item pikeRedDwarf;
    public static Item hammerRedDwarf;
    public static Item daggerRedDwarf;
    public static Item daggerRedDwarfPoisoned;
    public static Item crossbowRedDwarf;
    public static Item boarArmorRedDwarf;
    public static LOTRUnitTradeEntries RED_DWARF_COMMANDER;

    // Rhudaur
    public static Item helmetRhudaur;
    public static Item bodyRhudaur;
    public static Item legsRhudaur;
    public static Item bootsRhudaur;

    // Limwaith
    public static Item bonemold;
    public static Item helmetLimwaith;
    public static Item bodyLimwaith;
    public static Item legsLimwaith;
    public static Item bootsLimwaith;
    public static Item helmetboneLimwaith;
    public static Item bodyboneLimwaith;
    public static Item legsboneLimwaith;
    public static Item bootsboneLimwaith;
    public static Item tridentLimwaith;
    public static Item spearLimwaith;
    public static Item truncheonLimwaith;
    public static Item battleaxeLimwaith;
    public static Item daggerLimwaith;
    public static Item daggerLimwaithPoisoned;
    public static Item blowgunLimwaith;
    public static LOTRUnitTradeEntries LIMWAITH_COMMANDER;

    //Bree
    public static Item helmetBree;
    public static Item helmetBreeKettle;
    public static Item bodyBree;
    public static Item legsBree;
    public static Item bootsBree;
    public static Item swordBree;
    public static LOTRUnitTradeEntries BREE_CAPTAIN;

    // Arnor
    public static Item helmetArnorBanner;
    public static Item bodyArnorBanner;
    public static Item legsArnorBanner;
    public static Item bootsArnorBanner;
    public static Item maceArnor;
    public static LOTRUnitTradeEntries ARNOR_CAPTAIN;
    public static Item battleNunSpawnEgg;

    // Wizards
    public static Item radagastStaff;
    public static Item pallandoStaff;
    public static Item alatarStaff;
    public static Item sarumanStaff;

    // Relics
    public static Item welfRelic;
    // Spawn eggs
    public static Item redDwarfWarriorSpawnEgg;
    public static Item redDwarfArbalestSpawnEgg;
    public static Item redDwarfCommanderSpawnEgg;
    public static Item redDwarfBannerBearerSpawnEgg;
    public static Item redDwarfSmithSpawnEgg;

    public static Item limwaithSpawnEgg;
    public static Item limwaithWarriorSpawnEgg;
    public static Item limwaithBoneWarriorSpawnEgg;
    public static Item limwaithBlowgunnerSpawnEgg;
    public static Item limwaithBannerBearerSpawnEgg;
    public static Item limwaithChieftainSpawnEgg;
    public static Item limwaithFishmongerSpawnEgg;
    public static Item limwaithShamanSpawnEgg;


    public static Item fangornBearSpawnEgg;
    public static Item fangornWildBoarSpawnEgg;
    public static Item fangornAurochSpawnEgg;
    public static Item fangornElkSpawnEgg;
    public static Item renegadeSpawnEgg;
    public static Item renegadeCaptainSpawnEgg;
    public static Item wraithSpawnEgg;

    public static Item ArnorSoldierSpawnEgg;
    public static Item ArnorSoldierArcherSpawnEgg;
    public static Item ArnorCaptainSpawnEgg;
    public static Item ArnorBannerBearerSpawnEgg;

    public static Item BreeSoldierSpawnEgg;
    public static Item BreeCrossbowmanSpawnEgg;
    public static Item BreeCaptainSpawnEgg;
    public static Item BreeSoldierBannerBearerSpawnEgg;
    public static Item BreeOutriderSpawnEgg;

    public static Item SauronSpawnEgg;

    public static Item utumnoSlaveSpawnEgg;

    // Spawn lists
    public static LOTRSpawnList RED_DWARF;
    public static LOTRSpawnList LIMWAITH;
    public static LOTRSpawnList Rhudaur;

    @Mod.EventHandler
    public void preInit(FMLPreInitializationEvent event) {
        CinderLoE_Config.init(event);
        Materials.registerMaterials();
        registerItems();
        ItemRegistration.registerItems();
        registerBlocks();
        registerEntities();
    }

    @Mod.EventHandler
    public void init(FMLInitializationEvent event) {
        CommonProxy proxy = event.getSide() == Side.CLIENT ? new ClientProxy() : new ServerProxy();
        proxy.setup();
        if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
            FMLCommonHandler.instance().bus().register(this);
        }
        MinecraftForge.EVENT_BUS.register(this);
        new CharacterEventListener();

        if (event.getSide().isClient()) {
            ClientCommandHandler.instance.registerCommand(new DevCommand());
        }
    }


    @Mod.EventHandler
    public void postInit(FMLPostInitializationEvent event) {
        if (event.getSide()
            .isServer()) {
            SpeechBankModifier.insertSpeechBanks();
            modifySpawnLists();
        }
        Utilities.initialize_reflects();
        recipes.registerRecipes(); // Register recipes at com.zivilon.cinder_loe.recipes.java
        setupTradeEntries();
        LOTRWeaponStats.registerMeleeReach(Whip.class, 1.5F);
    }


    @Mod.EventHandler
    public void serverStarting(FMLServerStartingEvent event) {
        CharacterRoleAPI.loadRolesFromFile();
        event.registerServerCommand(new CommandCinderCharacter());
    }

    public void registerEntities() { // Last ID added: 43
        ///GameRegistry.registerTileEntity(TileEntityMistBlock.class, "TileEntityMistBlock");
        ///.registerBlock(TileEntityRustedSword, "TileEntityRustedSword");

        int entityID = 7320; // Always increment entityID by 1 over the last entity to ensure unique IDs
      //  EntityRegistry.registerModEntity(HaradLevy.class, "HaradLevy", (entityID + 36), this, 64, 1, true);
      //  EntityRegistry.registerModEntity(DwarfLevy.class, "DwarfLevy", (entityID + 37), this, 64, 1, true);

        // Traders
        EntityRegistry.registerModEntity(RedDwarfSmith.class, "RedDwarfSmith", (entityID + 29), this, 64, 1, true);
        EntityRegistry.registerModEntity(LimwaithFishmonger.class, "LimwaithFishmonger", (entityID + 33), this, 64, 1, true);
        EntityRegistry.registerModEntity(LimwaithShaman.class, "LimwaithShaman", (entityID + 34), this, 64, 1, true);
        EntityRegistry.registerModEntity(BladorthinSmith.class, "BladorthinSmith", (entityID + 43), this, 64, 1, true);


        // Others

        EntityRegistry.registerModEntity(DarkSpider.class, "DarkSpider", (entityID + 42), this, 64, 1, true);

        EntityRegistry.registerModEntity(CorruptDwarf.class, "CorruptDwarf", (entityID + 36), this, 64, 1, true);
        EntityRegistry.registerModEntity(CorruptElf.class, "CorruptElf", (entityID + 37), this, 64, 1, true);
        EntityRegistry.registerModEntity(CorruptEnt.class, "CorruptEnt", (entityID + 38), this, 64, 1, true);
        EntityRegistry.registerModEntity(CorruptHobbit.class, "CorruptHobit", (entityID + 39), this, 64, 1, true);
        EntityRegistry.registerModEntity(CorruptMan.class, "CorruptMan", (entityID + 40), this, 64, 1, true);
        EntityRegistry.registerModEntity(CorruptOrc.class, "CorruptOrc", (entityID + 41), this, 64, 1, true);

        EntityRegistry.registerModEntity(SarumanFireball.class, "SarumanFireball", entityID + 0, this, 64, 10, true);
        EntityRegistry.registerModEntity(Renegade.class, "Renegade", (entityID + 1), this, 64, 1, true);
        EntityRegistry.registerModEntity(RenegadeCaptain.class, "RenegadeCaptain", (entityID + 16), this, 64, 1, true);

        EntityRegistry.registerModEntity(RedDwarfWarrior.class, "RedDwarfWarrior", (entityID + 2), this, 64, 1, true);
        EntityRegistry.registerModEntity(RedDwarfArbalest.class, "RedDwarfArbalest", (entityID + 3), this, 64, 1, true);
        EntityRegistry.registerModEntity(RedDwarfBannerBearer.class, "RedDwarfBannerBearer", (entityID + 4), this, 64, 1, true);
        EntityRegistry.registerModEntity(RedDwarfCommander.class, "RedDwarfCommander", (entityID + 5), this, 64, 1, true);

        EntityRegistry.registerModEntity(FangornBear.class, "FangornBear", (entityID + 6), this, 64, 1, true);
        EntityRegistry.registerModEntity(FangornWildBoar.class, "FangornWildBoar", (entityID + 7), this, 64, 1, true);
        EntityRegistry.registerModEntity(FangornAuroch.class, "FangornAuroch", (entityID + 8), this, 64, 1, true);
        EntityRegistry.registerModEntity(FangornElk.class, "FangornElk", (entityID + 9), this, 64, 1, true);
        EntityRegistry.registerModEntity(FangornWolf.class, "FangornWolf", (entityID + 10), this, 64, 1, true);
      //  EntityRegistry.registerModEntity(FangornWolf.class, "TamedCrocodile", (entityID + 35), this, 64, 1, true);

        EntityRegistry.registerModEntity(Limwaith.class, "Limwaith", (entityID + 31), this, 64, 1, true);
        EntityRegistry.registerModEntity(LimwaithWarrior.class, "LimwaithWarrior", (entityID + 11), this, 64, 1, true);
        EntityRegistry.registerModEntity(LimwaithBoneWarrior.class, "LimwaithBoneWarrior", (entityID + 32), this, 64, 1, true);
        EntityRegistry.registerModEntity(LimwaithBlowgunner.class, "LimwaithBlowgunner", (entityID + 12), this, 64, 1, true);
        EntityRegistry.registerModEntity(LimwaithBannerBearer.class, "LimwaithBannerBearer", (entityID + 13), this, 64, 1, true);
        EntityRegistry.registerModEntity(LimwaithChieftain.class, "LimwaithChieftain", (entityID + 14), this, 64, 1, true);

        EntityRegistry.registerModEntity(Wraith.class, "Wraith", (entityID + 15), this, 64, 1, true);

        EntityRegistry.registerModEntity(ArnorSoldier.class, "ArnorSoldier", (entityID + 17), this, 64, 1, true);
        EntityRegistry.registerModEntity(ArnorSoldierArcher.class, "ArnorSoldierArcher", (entityID + 19), this, 64, 1, true);
        EntityRegistry.registerModEntity(ArnorCaptain.class, "ArnorCaptain", (entityID + 20), this, 64, 1, true);
        EntityRegistry.registerModEntity(ArnorBannerBearer.class, "ArnorBannerBearer", (entityID + 21), this, 64, 1, true);
        EntityRegistry.registerModEntity(BattleNun.class, "BattleNun", (entityID + 27), this, 64, 1, true);

        EntityRegistry.registerModEntity(BreeSoldier.class, "BreeSoldier", (entityID + 22), this, 64, 1, true);
        EntityRegistry.registerModEntity(BreeCrossbowman.class, "BreeCrossbowman", (entityID + 23), this, 64, 1, true);
        EntityRegistry.registerModEntity(BreeCaptain.class, "BreeCaptain", (entityID + 24), this, 64, 1, true);
        EntityRegistry.registerModEntity(BreeSoldierBannerBearer.class, "BreeSoldierBannerBearer", (entityID + 25), this, 64, 1, true);
        EntityRegistry.registerModEntity(BreeOutrider.class, "BreeOutrider", (entityID + 26), this, 64, 1, true);

        EntityRegistry.registerModEntity(LOTREntitySauron.class, "LOTREntitySauron", (entityID + 28), this, 64, 1, true);

        EntityRegistry.registerModEntity(UtumnoSlaveTrader.class, "UtumnoSlaveTrader", (entityID + 30), this, 64, 1, true);
    }

    public void registerBlocks() {
        // barricade
       // barricade = (new barricade());
      //  GameRegistry.registerBlock(barricade, "barricade");

        // Cinder Block
        cinderBlock = (new CinderBlock());
        GameRegistry.registerBlock(cinderBlock, "cinderBlock");

        // Ivory Block
        ivoryBlock = (new IvoryBlock()); //Unobtainable
        GameRegistry.registerBlock(ivoryBlock, "ivoryBlock");

        // Reefless Coral
        reeflessCoral = (new reeflessCoral());
        GameRegistry.registerBlock(reeflessCoral, "reeflessCoral");

        // Red Dwarven Steel Block
        blockRedDwarfSteel = (new BlockRedDwarfSteel());
        GameRegistry.registerBlock(blockRedDwarfSteel, "blockRedDwarfSteel");

        // Red Dwarven Steel Bars
        barsRedDwarf = (new RedDwarfBars());
        GameRegistry.registerBlock(barsRedDwarf, "barsRedDwarf");

        // Red dwarven chandelier
        chandelierRedDwarf = (new RedDwarfChandelier());
        GameRegistry.registerBlock(chandelierRedDwarf, "chandelierRedDwarf");

        // Bundles
        furBundle = (new FurBundle());
        GameRegistry.registerBlock(furBundle, "furBundle");
        leatherBundle = (new LeatherBundle());
        GameRegistry.registerBlock(leatherBundle, "leatherBundle");
        reedBale = (new ReedBale());
        GameRegistry.registerBlock(reedBale, "reedBale");

        // Unique
        dwarvenBrickRuned = (new RunedDwarvenBrick());
        GameRegistry.registerBlock(dwarvenBrickRuned, "dwarvenBrickRuned");
      //  verticalWeaponRack = new VerticalWeaponRack();
      //  GameRegistry.registerTileEntity(LOTRTileEntityWeaponRack.class, "verticalWeaponRack");
      //  GameRegistry.registerBlock(verticalWeaponRack, "verticalWeaponRack");
        //Decor
        ///rustedsword = (new RustedSword());
       ///GameRegistry.registerBlock(rustedsword, "rustedsword");
        // Barrel
        fishBarrel = (new FishBarrel());
        GameRegistry.registerBlock(fishBarrel, "fishbarrel");

        // Chains
        silverChain = (new silverChain());
        GameRegistry.registerBlock(silverChain, "silverChain");
        goldChain = (new goldChain());
        GameRegistry.registerBlock(goldChain, "goldChain");
        ironChain = (new ironChain());
        GameRegistry.registerBlock(ironChain, "ironChain");
        bronzeChain = (new bronzeChain());
        GameRegistry.registerBlock(bronzeChain, "bronzeChain");

        // Staff
        mistBlock = (new MistBlock());
        GameRegistry.registerBlock(mistBlock, "mist");
        voidblock = (new voidblock());
        GameRegistry.registerBlock(voidblock, "voidblock");

        // Building Blocks
        cutDrystone = (new cutDrystone());
        GameRegistry.registerBlock(cutDrystone, "cutDrystone");
        cobbleDrystone = (new cobbleDrystone());
        GameRegistry.registerBlock(cobbleDrystone, "cobbleDrystone");
        plaster = (new plaster());
        GameRegistry.registerBlock(plaster, "plaster");

        // Gates
        //gatecharredportcullis = LOTRBlockGate.createWooden(false).setBlockName("lotr:gatecharredportcullis");
        //GameRegistry.registerBlock(gatecharredportcullis, "gatecharredportcullis");

        //Food Crops
        onionCrop = new onionCrop().setBlockName("onion");
        GameRegistry.registerBlock(onionCrop, "onionCrop");
        cabbageCrop = new cabbageCrop().setBlockName("cabbage");
        GameRegistry.registerBlock(cabbageCrop, "cabbageCrop");


    }

    public void registerItems() {
        // Get materials tab via reflection because ForgeGradle insists on obfuscating it when it should not
        LOTRCreativeTabs materials = null;
        try {
            Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabMaterials"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to be
            materials = (LOTRCreativeTabs) tabField.get(null);
        } catch (NoSuchFieldException | IllegalAccessException e) {
            e.printStackTrace();
        }
        // Food
       // onion = new ItemSeedFood(3, 0.3f, CinderLoE.onionCrop, Blocks.farmland).setUnlocalizedName("lotr:onion").setTextureName("lotr:onion");
        //cabbage = new ItemSeedFood(3, 0.3f, CinderLoE.cabbageCrop, Blocks.farmland).setUnlocalizedName("lotr:cabbage").setTextureName("lotr:cabbage");;
        spice = new CinderItemFood(1, 0.0f, false).setdamageAmount(2).setPotionEffect(Potion.moveSpeed.id, 5,0,100).setUnlocalizedName("lotr:spice").setTextureName("lotr:spice");
        spicedHam = new CinderItemFood(9, 0.6f, true).setdamageAmount(2).setPotionEffect(Potion.moveSpeed.id, 15, 0, 100).setUnlocalizedName("lotr:spicedHam").setTextureName("lotr:spicedHam");
       // spice = new LOTRItemFood(1, 0.0f, false).setPotionEffect(Potion.moveSpeed.id, 10,0,100).setUnlocalizedName("lotr:spice");
        pelmen = new LOTRItemFood(4, 5.0f, true).setUnlocalizedName("lotr:pelmen").setTextureName("lotr:pelmen");
        onion = new LOTRItemFood(3, 0.3f, false).setUnlocalizedName("lotr:onion").setTextureName("lotr:onion");
        cabbage = new LOTRItemFood(4, 0.5f, false).setUnlocalizedName("lotr:cabbage").setTextureName("lotr:cabbage");
        lightStew = new LOTRItemStew(6, 0.7f, false).setPotionEffect(Potion.damageBoost.id, 60, 0, 100).setUnlocalizedName("lotr:lightStew").setTextureName("lotr:lightStew");
        chocolatebar = new LOTRItemFood(4,0.3f, false).setUnlocalizedName("lotr:chocolatebar").setTextureName("lotr:chocolatebar");
        fruitsalad = new LOTRItemStew(6, 0.5f, false).setPotionEffect(Potion.field_76444_x.id, 60, 0,1).setUnlocalizedName("lotr:fruitsalad").setTextureName("lotr:fruitsalad");
        flour = new LOTRItemFood(0,0.0f, false).setPotionEffect(Potion.confusion.id, 5,0,100).setUnlocalizedName("lotr:flour").setTextureName("lotr:flour");
        dough = new LOTRItemFood(1,0.0f, false).setPotionEffect(Potion.hunger.id, 5,0,100).setUnlocalizedName("lotr:dough").setTextureName("lotr:dough");
        pasta = new LOTRItemFood(2,0.0f, false).setPotionEffect(Potion.hunger.id, 5,0,100).setUnlocalizedName("lotr:pasta").setTextureName("lotr:pasta");
        pretzel = new LOTRItemFood(4,1.0f, false).setUnlocalizedName("lotr:pretzel").setTextureName("lotr:pretzel");
        halva = new LOTRItemFood (7, 4.0f, false).setUnlocalizedName("lotr:halva").setTextureName("lotr:halva");
        honey = new LOTRItemFood(3, 0.4f, false).setPotionEffect(Potion.regeneration.id, 5, 0, 100).setUnlocalizedName("lotr:honey").setTextureName("lotr:honey");
        // Red Dwarf Spawns
        redDwarfWarriorSpawnEgg = new CinderLoESpawnEgg(RedDwarfWarrior.class).setTextureName("lotr:spawn_egg");
        redDwarfArbalestSpawnEgg = new CinderLoESpawnEgg(RedDwarfArbalest.class).setTextureName("lotr:spawn_egg");
        redDwarfCommanderSpawnEgg = new CinderLoESpawnEgg(RedDwarfCommander.class).setTextureName("lotr:spawn_egg");
        redDwarfBannerBearerSpawnEgg = new CinderLoESpawnEgg(RedDwarfBannerBearer.class).setTextureName("lotr:spawn_egg");
        redDwarfSmithSpawnEgg = new CinderLoESpawnEgg(RedDwarfSmith.class).setTextureName("lotr:spawn_egg");
        // Limwaith Spawns
        limwaithSpawnEgg = new CinderLoESpawnEgg(Limwaith.class).setTextureName("lotr:spawn_egg");
        limwaithFishmongerSpawnEgg = new CinderLoESpawnEgg(LimwaithFishmonger.class).setTextureName("lotr:spawn_egg");
        limwaithShamanSpawnEgg = new CinderLoESpawnEgg(LimwaithShaman.class).setTextureName("lotr:spawn_egg");
        limwaithWarriorSpawnEgg = new CinderLoESpawnEgg(LimwaithWarrior.class).setTextureName("lotr:spawn_egg");
        limwaithBoneWarriorSpawnEgg = new CinderLoESpawnEgg(LimwaithBoneWarrior.class).setTextureName("lotr:spawn_egg");
        limwaithBlowgunnerSpawnEgg = new CinderLoESpawnEgg(LimwaithBlowgunner.class).setTextureName("lotr:spawn_egg");
        limwaithChieftainSpawnEgg = new CinderLoESpawnEgg(LimwaithChieftain.class).setTextureName("lotr:spawn_egg");
        limwaithBannerBearerSpawnEgg = new CinderLoESpawnEgg(LimwaithBannerBearer.class).setTextureName("lotr:spawn_egg");
        // Fangorn Spawns
        fangornBearSpawnEgg = new CinderLoESpawnEgg(FangornBear.class).setTextureName("lotr:spawn_egg");
        fangornWildBoarSpawnEgg = new CinderLoESpawnEgg(FangornWildBoar.class).setTextureName("lotr:spawn_egg");
        fangornAurochSpawnEgg = new CinderLoESpawnEgg(FangornAuroch.class).setTextureName("lotr:spawn_egg");
        fangornElkSpawnEgg = new CinderLoESpawnEgg(FangornElk.class).setTextureName("lotr:spawn_egg");
        // Renegade Spawns
        renegadeSpawnEgg = new CinderLoESpawnEgg(Renegade.class).setTextureName("lotr:spawn_egg");
        renegadeCaptainSpawnEgg = new CinderLoESpawnEgg(RenegadeCaptain.class).setTextureName("lotr:spawn_egg");
        // Arnor Spawns
        ArnorSoldierSpawnEgg = new CinderLoESpawnEgg(ArnorSoldier.class).setTextureName("lotr:spawn_egg");
        ArnorSoldierArcherSpawnEgg = new CinderLoESpawnEgg(ArnorSoldierArcher.class).setTextureName("lotr:spawn_egg");
        ArnorCaptainSpawnEgg = new CinderLoESpawnEgg(ArnorCaptain.class).setTextureName("lotr:spawn_egg");
        ArnorBannerBearerSpawnEgg = new CinderLoESpawnEgg(ArnorBannerBearer.class).setTextureName("lotr:spawn_egg");
        battleNunSpawnEgg = new CinderLoESpawnEgg(BattleNun.class).setTextureName("lotr:spawn_egg");
        // Bree Spawns
        BreeSoldierSpawnEgg = new CinderLoESpawnEgg(BreeSoldier.class).setTextureName("lotr:spawn_egg");
        BreeCrossbowmanSpawnEgg = new CinderLoESpawnEgg(BreeCrossbowman.class).setTextureName("lotr:spawn_egg");
        BreeCaptainSpawnEgg = new CinderLoESpawnEgg(BreeCaptain.class).setTextureName("lotr:spawn_egg");
        BreeSoldierBannerBearerSpawnEgg = new CinderLoESpawnEgg(BreeSoldierBannerBearer.class).setTextureName("lotr:spawn_egg");
        BreeOutriderSpawnEgg = new CinderLoESpawnEgg(BreeOutrider.class).setTextureName("lotr:spawn_egg");
        // Special Spawns
        SauronSpawnEgg = new CinderLoESpawnEgg(LOTREntitySauron.class).setTextureName("lotr:spawn_egg");
        wraithSpawnEgg = new CinderLoESpawnEgg(Wraith.class).setTextureName("lotr:spawn_egg");
        // Wizard Staves
        radagastStaff = (new RadagastStaff()).setUnlocalizedName("lotr:radagastStaff").setTextureName("lotr:radagastStaff");
        pallandoStaff = (new PallandoStaff()).setUnlocalizedName("lotr:pallandoStaff").setTextureName("lotr:pallandoStaff");
        alatarStaff = (new AlatarStaff()).setUnlocalizedName("lotr:alatarStaff").setTextureName("lotr:alatarStaff");
        sarumanStaff = (new SarumanStaff()).setUnlocalizedName("lotr:sarumanStaff").setTextureName("lotr:sarumanStaff");
        // Relics
        welfRelic = (new WoodElfRelic()).setUnlocalizedName("lotr:welfRelic").setTextureName("lotr:welfRelic");
        // Utumno Spawns
        utumnoSlaveSpawnEgg = new CinderLoESpawnEgg(UtumnoSlaveTrader.class).setTextureName("lotr:spawn_egg");

        /*
        * Item Registation, add up the "last ID added" upon adding a new item
        * Weapons will need to be linked
         */
        // Last ID added: 126

        // ==Food Items==
        ItemRegistration.registerItem(onion, "onion", 89);
        ItemRegistration.registerItem(cabbage, "cabbage", 90);
        ItemRegistration.registerItem(pelmen, "pelmen", 91);
        ItemRegistration.registerItem(lightStew, "lightStew", 92);
        ItemRegistration.registerItem(spice, "spice", 93);
        ItemRegistration.registerItem(spicedHam, "spicedHam", 94);
        ItemRegistration.registerItem(chocolatebar, "chocolatebar", 115);
        ItemRegistration.registerItem(fruitsalad, "fruitsalad", 116);
        ItemRegistration.registerItem(flour, "flour", 117);
        ItemRegistration.registerItem(dough, "dough", 118);
        ItemRegistration.registerItem(pasta, "pasta", 119);
        ItemRegistration.registerItem(pretzel, "pretzel", 120);
        ItemRegistration.registerItem(halva, "halva", 125);
        ItemRegistration.registerItem(honey, "honey", 126);

        // ==Red Dwarf Eggs==
        ItemRegistration.registerItem(redDwarfWarriorSpawnEgg, "redDwarfWarriorSpawnEgg", 0);
        ItemRegistration.registerItem(redDwarfArbalestSpawnEgg, "redDwarfArbalestSpawnEgg", 1);
        ItemRegistration.registerItem(redDwarfCommanderSpawnEgg, "redDwarfCommanderSpawnEgg", 2);
        ItemRegistration.registerItem(redDwarfBannerBearerSpawnEgg, "redDwarfBannerBearerSpawnEgg", 3);
        ItemRegistration.registerItem(redDwarfSmithSpawnEgg, "redDwarfSmithSpawnEgg", 68);
        // ==Fangorn and Event Mob Eggs==
        ItemRegistration.registerItem(fangornBearSpawnEgg, "fangornBearSpawnEgg", 4);
        ItemRegistration.registerItem(fangornWildBoarSpawnEgg, "fangornWildBoarSpawnEgg", 5);
        ItemRegistration.registerItem(fangornAurochSpawnEgg, "fangornAurochSpawnEgg", 6);
        ItemRegistration.registerItem(fangornElkSpawnEgg, "fangornElkSpawnEgg", 7);
        ItemRegistration.registerItem(renegadeSpawnEgg, "renegadeSpawnEgg", 8);
        ItemRegistration.registerItem(renegadeCaptainSpawnEgg, "renegadeCaptainSpawnEgg", 9);
        ItemRegistration.registerItem(wraithSpawnEgg, "wraithSpawnEgg", 10);
        ItemRegistration.registerItem(SauronSpawnEgg, "SauronSpawnEgg", 25);
        // ==Limwaith Eggs==
        ItemRegistration.registerItem(limwaithSpawnEgg, "limwaithSpawnEgg", 82);
        ItemRegistration.registerItem(limwaithShamanSpawnEgg, "limwaithShamanSpawnEgg", 85);
        ItemRegistration.registerItem(limwaithFishmongerSpawnEgg, "limwaithFishmongerSpawnEgg", 86);
        ItemRegistration.registerItem(limwaithWarriorSpawnEgg, "limwaithWarriorSpawnEgg", 11);
        ItemRegistration.registerItem(limwaithBoneWarriorSpawnEgg, "limwaithBoneWarriorSpawnEgg", 84);
        ItemRegistration.registerItem(limwaithBlowgunnerSpawnEgg, "limwaithBlowgunnerSpawnEgg", 12);
        ItemRegistration.registerItem(limwaithBannerBearerSpawnEgg, "limwaithBannerBearerSpawnEgg", 13);
        ItemRegistration.registerItem(limwaithChieftainSpawnEgg, "limwaithChieftainSpawnEgg", 14);
        // ==Arnor Eggs==
        ItemRegistration.registerItem(ArnorSoldierSpawnEgg, "ArnorSoldierSpawnEgg", 15);
        ItemRegistration.registerItem(ArnorSoldierArcherSpawnEgg, "ArnorSoldierArcherSpawnEgg", 16);
        ItemRegistration.registerItem(ArnorCaptainSpawnEgg, "ArnorCaptainSpawnEgg", 17);
        ItemRegistration.registerItem(ArnorBannerBearerSpawnEgg, "ArnorBannerBearerSpawnEgg", 18);
        ItemRegistration.registerItem(battleNunSpawnEgg, "battleNunSpawnEgg", 19);
        // ==Bree Eggs==
        ItemRegistration.registerItem(BreeSoldierSpawnEgg, "BreeSoldierSpawnEgg", 20);
        ItemRegistration.registerItem(BreeCrossbowmanSpawnEgg, "BreeCrossbowmanSpawnEgg", 21);
        ItemRegistration.registerItem(BreeCaptainSpawnEgg, "BreeCaptainSpawnEgg", 22);
        ItemRegistration.registerItem(BreeSoldierBannerBearerSpawnEgg, "BreeSoldierBannerBearerSpawnEgg", 23);
        ItemRegistration.registerItem(BreeOutriderSpawnEgg, "BreeOutriderSpawnEgg", 24);

        // ==Utumno Expansion Eggs==
        ItemRegistration.registerItem(utumnoSlaveSpawnEgg, "utumnoSlaveSpawnEgg", 69);

        // Wizard Staves
        ItemRegistration.registerItem(radagastStaff, "radagastStaff", 26);
        ItemRegistration.registerItem(pallandoStaff, "pallandoStaff", 27);
        ItemRegistration.registerItem(alatarStaff, "alatarStaff", 28);
        ItemRegistration.registerItem(sarumanStaff, "sarumanStaff", 29);

        linkLOTRWeapon(radagastStaff, "radagastStaff");
        linkLOTRWeapon(pallandoStaff, "pallandoStaff");
        linkLOTRWeapon(alatarStaff, "alatarStaff");
        linkLOTRWeapon(sarumanStaff, "sarumanStaff");

        //Relics
        ItemRegistration.registerItem(welfRelic, "welfRelic", 87);

        linkLOTRWeapon(welfRelic, "welfRelic");

        // Misc
        EVENT = getLOTRMaterialByName("EVENT");
        frostblade = (new LOTRItemSword(EVENT)).setUnlocalizedName("lotr:frostblade").setTextureName("lotr:frostblade");
        daggervoid = (new VoidDagger(EVENT)).addWeaponDamage(5.0F).setUnlocalizedName("lotr:daggerVoid").setTextureName("lotr:daggerVoid").setCreativeTab(null);
        spearsolidgold = (new LOTRItemSpear(EVENT)).setUnlocalizedName("lotr:spearsolidgold").setTextureName("lotr:spearsolidgold").setCreativeTab(null);
        spearUnnamed = (new UnnamedSpear(EVENT)).setUnlocalizedName("lotr:spearUnnamed").setTextureName("lotr:spearUnnamed").setCreativeTab(null);
        whip = (new Whip()).setUnlocalizedName("lotr:whip").setTextureName("lotr:whip");
        helmetbrokenhalo = (new LOTRItemArmor(EVENT, 0, "helmet")).setUnlocalizedName("lotr:helmetbrokenhalo").setTextureName("lotr:helmetbrokenhalo").setCreativeTab(null);
        MATERIAL_JADE = getLOTRMaterialByName("JADE");
        helmetJade = (new LOTRItemArmor(MATERIAL_JADE, 0, "helmet")).setUnlocalizedName("lotr:helmetJade").setTextureName("lotr:helmetJade").setCreativeTab(null);
        bodyJade = (new LOTRItemArmor(MATERIAL_JADE, 1, "chestplate")).setUnlocalizedName("lotr:bodyJade").setTextureName("lotr:bodyJade").setCreativeTab(null);
        legsJade = (new LOTRItemArmor(MATERIAL_JADE, 2,"leggings")).setUnlocalizedName("lotr:legsJade").setTextureName("lotr:legsJade").setCreativeTab(null);
        bootsJade = (new LOTRItemArmor(MATERIAL_JADE, 3)).setUnlocalizedName("lotr:bootsJade").setTextureName("lotr:bootsJade").setCreativeTab(null);


        ItemRegistration.registerItem(frostblade, "frostblade", 30);
        ItemRegistration.registerItem(daggervoid, "daggerVoid", 96);
        ItemRegistration.registerItem(spearsolidgold, "spearsolidgold", 31);
        ItemRegistration.registerItem(spearUnnamed, "spearUnnamed", 97);
        ItemRegistration.registerItem(whip, "whip", 32);
        ItemRegistration.registerItem(helmetbrokenhalo, "brokenhalo", 98);
        ItemRegistration.registerItem(helmetJade, "helmetJade", 121);
        ItemRegistration.registerItem(bodyJade, "chestplateJade", 122);
        ItemRegistration.registerItem(legsJade, "legsJade", 123);
        ItemRegistration.registerItem(bootsJade, "bootsJade", 124);
        linkLOTRWeapon(frostblade, "frostblade");
        linkLOTRWeapon(daggervoid, "daggerVoid");
        linkLOTRWeapon(spearsolidgold, "spearsolidgold");
        linkLOTRWeapon(spearUnnamed, "spearUnnamed");
        linkLOTRWeapon(whip, "whip");

        //ASH
        MATERIAL_ASH = getLOTRMaterialByName("ASH");
        ingotAsh = new Item().setUnlocalizedName("lotr:ingotAsh").setTextureName("lotr:ingotAsh").setCreativeTab((CreativeTabs) materials);
        if (MATERIAL_ASH != null) {
            swordAsh = (new LOTRItemSword(MATERIAL_ASH)).addWeaponDamage(4.25F).setUnlocalizedName("lotr:swordAsh").setTextureName("lotr:swordAsh");
            staffAsh = (new LOTRItemPolearm(MATERIAL_ASH)).addWeaponDamage(5.5F).setUnlocalizedName("lotr:staffAsh").setTextureName("lotr:staffAsh");
            daggerAsh = (new LOTRItemDagger(MATERIAL_ASH)).addWeaponDamage(6.75F).setUnlocalizedName("lotr:daggerAsh").setTextureName("lotr:daggerAsh");
            hammerAsh = (new LOTRItemHammer(MATERIAL_ASH)).addWeaponDamage(5.5F).setUnlocalizedName("lotr:hammerAsh").setTextureName("lotr:hammerAsh");
            battleaxeAsh = (new LOTRItemBattleaxe(MATERIAL_ASH)).addWeaponDamage(5.5F).setUnlocalizedName("lotr:battleaxeAsh").setTextureName("lotr:battleaxeAsh");
            bowAsh = (new CinderBow(MATERIAL_ASH, 1.5)).setDrawTime(16).setUnlocalizedName("lotr:bowAsh").setTextureName("lotr:bowAsh");
            pikeAsh = (new LOTRItemPike(MATERIAL_ASH)).addWeaponDamage(5.0F).setUnlocalizedName("lotr:pikeAsh").setTextureName("lotr:pikeAsh");
            spearAsh = (new LOTRItemSpear(MATERIAL_ASH)).addWeaponDamage(5.0F).setUnlocalizedName("lotr:spearAsh").setTextureName("lotr:spearAsh");

            ItemRegistration.registerItem(ingotAsh, "ingotAsh", 74);
            ItemRegistration.registerItem(swordAsh, "swordAsh", 75);
            ItemRegistration.registerItem(daggerAsh, "daggerAsh", 76);
            ItemRegistration.registerItem(hammerAsh, "hammerAsh", 77);
            ItemRegistration.registerItem(battleaxeAsh, "battleaxeAsh", 78);
            ItemRegistration.registerItem(bowAsh, "bowAsh", 79);
            ItemRegistration.registerItem(pikeAsh, "pikeAsh", 80);
            ItemRegistration.registerItem(spearAsh, "spearAsh", 81);
            ItemRegistration.registerItem(staffAsh, "staffAsh", 95);
        } else {
            // Log an error or handle the case where the material could not be found
            System.err.println("Failed to find MATERIAL_ASH material for armor initialization.");
        }
        linkLOTRWeapon(swordAsh, "swordAsh");
        linkLOTRWeapon(daggerAsh, "daggerAsh");
        linkLOTRWeapon(hammerAsh, "hammerAsh");
        linkLOTRWeapon(battleaxeAsh, "battleaxeAsh");
        linkLOTRWeapon(bowAsh, "bowAsh");
        linkLOTRWeapon(pikeAsh, "pikeAsh");
        linkLOTRWeapon(spearAsh, "spearAsh");
        linkLOTRWeapon(staffAsh, "staffAsh");

        // Red Dwarves
        redDwarfSteel = new Item().setUnlocalizedName("lotr:redDwarfSteel").setTextureName("lotr:redDwarfSteel").setCreativeTab((CreativeTabs) materials);
        ItemRegistration.registerItem(redDwarfSteel, "redDwarfSteel", 33);

        MATERIAL_RED_DWARF = getLOTRMaterialByName("RED_DWARF");
        if (MATERIAL_RED_DWARF != null) {
            helmetRedDwarf = (new LOTRItemArmor(MATERIAL_RED_DWARF, 0, "helmet")).setUnlocalizedName("lotr:helmetRedDwarf").setTextureName("lotr:helmetRedDwarf");
            bodyRedDwarf = (new LOTRItemArmor(MATERIAL_RED_DWARF, 1)).setUnlocalizedName("lotr:bodyRedDwarf").setTextureName("lotr:bodyRedDwarf");
            legsRedDwarf = (new LOTRItemArmor(MATERIAL_RED_DWARF, 2)).setUnlocalizedName("lotr:legsRedDwarf").setTextureName("lotr:legsRedDwarf");
            bootsRedDwarf = (new LOTRItemArmor(MATERIAL_RED_DWARF, 3)).setUnlocalizedName("lotr:bootsRedDwarf").setTextureName("lotr:bootsRedDwarf");
            spearRedDwarf = (new LOTRItemSpear(MATERIAL_RED_DWARF)).setUnlocalizedName("lotr:spearRedDwarf").setTextureName("lotr:spearRedDwarf");
            swordRedDwarf = (new LOTRItemSword(MATERIAL_RED_DWARF)).setUnlocalizedName("lotr:swordRedDwarf").setTextureName("lotr:swordRedDwarf");
            battleaxeRedDwarf = (new LOTRItemBattleaxe(MATERIAL_RED_DWARF)).setUnlocalizedName("lotr:battleaxeRedDwarf").setTextureName("lotr:battleaxeRedDwarf");
            pikeRedDwarf = (new LOTRItemPike(MATERIAL_RED_DWARF)).setUnlocalizedName("lotr:pikeRedDwarf").setTextureName("lotr:pikeRedDwarf");
            hammerRedDwarf = (new LOTRItemHammer(MATERIAL_RED_DWARF)).setUnlocalizedName("lotr:hammerRedDwarf").setTextureName("lotr:hammerRedDwarf");
            daggerRedDwarf = (new LOTRItemDagger(MATERIAL_RED_DWARF)).setUnlocalizedName("lotr:daggerRedDwarf").setTextureName("lotr:daggerRedDwarf");
            daggerRedDwarfPoisoned = (new LOTRItemDagger(MATERIAL_RED_DWARF, LOTRItemDagger.DaggerEffect.POISON)).setUnlocalizedName("lotr:daggerRedDwarfPoisoned").setTextureName("lotr:daggerRedDwarfPoisoned");
            crossbowRedDwarf = (new LOTRItemCrossbow(MATERIAL_RED_DWARF)).setUnlocalizedName("lotr:crossbowRedDwarf").setTextureName("lotr:crossbowRedDwarf");
            boarArmorRedDwarf = (new LOTRItemMountArmor(MATERIAL_RED_DWARF, LOTRItemMountArmor.Mount.BOAR)).setUnlocalizedName("lotr:boarArmorRedDwarf").setTextureName("lotr:boarArmorRedDwarf");

            ItemRegistration.registerItem(helmetRedDwarf, "helmetRedDwarf", 34);
            ItemRegistration.registerItem(bodyRedDwarf, "bodyRedDwarf", 35);
            ItemRegistration.registerItem(legsRedDwarf, "legsRedDwarf", 36);
            ItemRegistration.registerItem(bootsRedDwarf, "bootsRedDwarf", 37);
            ItemRegistration.registerItem(spearRedDwarf, "spearRedDwarf", 38);
            ItemRegistration.registerItem(swordRedDwarf, "swordRedDwarf", 39);
            ItemRegistration.registerItem(battleaxeRedDwarf, "battleaxeRedDwarf", 40);
            ItemRegistration.registerItem(pikeRedDwarf, "pikeRedDwarf", 41);
            ItemRegistration.registerItem(hammerRedDwarf, "hammerRedDwarf", 42);
            ItemRegistration.registerItem(daggerRedDwarf, "daggerRedDwarf", 43);
            ItemRegistration.registerItem(daggerRedDwarfPoisoned, "daggerRedDwarfPoisoned", 44);
            ItemRegistration.registerItem(crossbowRedDwarf, "crossbowRedDwarf", 45);
            ItemRegistration.registerItem(boarArmorRedDwarf, "boarArmorRedDwarf", 46);
//            System.out.println("Registered red dwarf equipment");
        } else {
            // Log an error or handle the case where the material could not be found
            System.err.println("Failed to find RED_DWARF material for armor initialization.");
        }
        linkLOTRWeapon(spearRedDwarf, "spearRedDwarf");
        linkLOTRWeapon(swordRedDwarf, "swordRedDwarf");
        linkLOTRWeapon(battleaxeRedDwarf, "battleaxeRedDwarf");
        linkLOTRWeapon(pikeRedDwarf, "pikeRedDwarf");
        linkLOTRWeapon(hammerRedDwarf, "hammerRedDwarf");
        linkLOTRWeapon(daggerRedDwarf, "daggerRedDwarf");
        linkLOTRWeapon(daggerRedDwarfPoisoned, "daggerRedDwarfPoisoned");
        linkLOTRWeapon(crossbowRedDwarf, "crossbowRedDwarf");

        // Limwaith

        bonemold = new Item().setUnlocalizedName("lotr:bonemold").setTextureName("lotr:bonemold").setCreativeTab((CreativeTabs) materials);
        ItemRegistration.registerItem(bonemold, "bonemold", 83);

        MATERIAL_LIMWAITH_WOOD = getLOTRMaterialByName("LIMWAITH_WOOD");
        MATERIAL_BONEMOLD = getLOTRMaterialByName("BONEMOLD");
        if (MATERIAL_LIMWAITH_WOOD != null && MATERIAL_BONEMOLD != null) {
            helmetLimwaith = (new LOTRItemArmor(MATERIAL_LIMWAITH_WOOD, 0)).setUnlocalizedName("lotr:helmetLimwaith").setTextureName("lotr:helmetLimwaith");
            bodyLimwaith = (new LOTRItemArmor(MATERIAL_LIMWAITH_WOOD, 1)).setUnlocalizedName("lotr:bodyLimwaith").setTextureName("lotr:bodyLimwaith");
            legsLimwaith = (new LOTRItemArmor(MATERIAL_LIMWAITH_WOOD, 2)).setUnlocalizedName("lotr:legsLimwaith").setTextureName("lotr:legsLimwaith");
            bootsLimwaith = (new LOTRItemArmor(MATERIAL_LIMWAITH_WOOD, 3)).setUnlocalizedName("lotr:bootsLimwaith").setTextureName("lotr:bootsLimwaith");

            helmetboneLimwaith = (new LOTRItemArmor(MATERIAL_BONEMOLD, 0)).setUnlocalizedName("lotr:helmetboneLimwaith").setTextureName("lotr:helmetboneLimwaith");
            bodyboneLimwaith = (new LOTRItemArmor(MATERIAL_BONEMOLD, 1)).setUnlocalizedName("lotr:bodyboneLimwaith").setTextureName("lotr:bodyboneLimwaith");
            legsboneLimwaith = (new LOTRItemArmor(MATERIAL_BONEMOLD, 2)).setUnlocalizedName("lotr:legsboneLimwaith").setTextureName("lotr:legsboneLimwaith");
            bootsboneLimwaith = (new LOTRItemArmor(MATERIAL_BONEMOLD, 3)).setUnlocalizedName("lotr:bootsboneLimwaith").setTextureName("lotr:bootsboneLimwaith");

            spearLimwaith = (new LOTRItemSpear(MATERIAL_BONEMOLD)).setUnlocalizedName("lotr:spearLimwaith").setTextureName("lotr:spearLimwaith");
            truncheonLimwaith = (new LOTRItemSword(MATERIAL_BONEMOLD)).setUnlocalizedName("lotr:truncheonLimwaith").setTextureName("lotr:truncheonLimwaith");
            battleaxeLimwaith = (new LOTRItemBattleaxe(MATERIAL_BONEMOLD)).setUnlocalizedName("lotr:battleaxeLimwaith").setTextureName("lotr:battleaxeLimwaith");
            tridentLimwaith = (new LOTRItemTrident(MATERIAL_BONEMOLD)).setUnlocalizedName("lotr:tridentLimwaith").setTextureName("lotr:tridentLimwaith");
            daggerLimwaith = (new LOTRItemDagger(MATERIAL_BONEMOLD)).setUnlocalizedName("lotr:daggerLimwaith").setTextureName("lotr:daggerLimwaith");
            daggerLimwaithPoisoned = (new LOTRItemDagger(MATERIAL_BONEMOLD, LOTRItemDagger.DaggerEffect.POISON)).setUnlocalizedName("lotr:daggerLimwaithPoisoned").setTextureName("lotr:daggerLimwaithPoisoned");
            blowgunLimwaith = (new LOTRItemBlowgun(LOTRMaterial.TAUREDAIN)).setUnlocalizedName("lotr:blowgunLimwaith").setTextureName("lotr:blowgunLimwaith");

            ItemRegistration.registerItem(helmetLimwaith, "helmetLimwaith", 47);
            ItemRegistration.registerItem(bodyLimwaith, "bodyLimwaith", 48);
            ItemRegistration.registerItem(legsLimwaith, "legsLimwaith", 49);
            ItemRegistration.registerItem(bootsLimwaith, "bootsLimwaith", 50);

            ItemRegistration.registerItem(helmetboneLimwaith, "helmetboneLimwaith", 70);
            ItemRegistration.registerItem(bodyboneLimwaith, "bodyboneLimwaith", 71);
            ItemRegistration.registerItem(legsboneLimwaith, "legsboneLimwaith", 72);
            ItemRegistration.registerItem(bootsboneLimwaith, "bootsboneLimwaith", 73);

            ItemRegistration.registerItem(spearLimwaith, "spearLimwaith", 51);
            ItemRegistration.registerItem(tridentLimwaith, "tridentLimwaith", 52);
            ItemRegistration.registerItem(truncheonLimwaith, "truncheonLimwaith", 53);
            ItemRegistration.registerItem(battleaxeLimwaith, "battleaxeLimwaith", 54);
            ItemRegistration.registerItem(daggerLimwaith, "daggerLimwaith", 55);
            ItemRegistration.registerItem(daggerLimwaithPoisoned, "daggerLimwaithPoisoned", 56);
            ItemRegistration.registerItem(blowgunLimwaith, "blowgunLimwaith", 57);
        } else {
            System.err.println("Failed to find LIMWAITH material for armor initialization.");
        }
        linkLOTRWeapon(spearLimwaith, "spearLimwaith");
        linkLOTRWeapon(truncheonLimwaith, "truncheonLimwaith");
        linkLOTRWeapon(battleaxeLimwaith, "battleaxeLimwaith");
        linkLOTRWeapon(tridentLimwaith, "tridentLimwaith");
        linkLOTRWeapon(daggerLimwaith, "daggerLimwaith");
        linkLOTRWeapon(daggerLimwaithPoisoned, "daggerLimwaithPoisoned");
        linkLOTRWeapon(blowgunLimwaith, "blowgunLimwaith");

        //Bree
        MATERIAL_BREE = getLOTRMaterialByName("BREE");
        if (MATERIAL_BREE != null) {
            helmetBreeKettle = (new LOTRItemArmor(MATERIAL_BREE, 0, "helmet")).setUnlocalizedName("lotr:helmetBreeKettle").setTextureName("lotr:breekettlehelmet");
            helmetBree = (new LOTRItemArmor(MATERIAL_BREE, 0)).setUnlocalizedName("lotr:helmetBree").setTextureName("lotr:helmetBree");
            bodyBree = (new LOTRItemArmor(MATERIAL_BREE, 1)).setUnlocalizedName("lotr:bodyBree").setTextureName("lotr:bodyBree");
            legsBree = (new LOTRItemArmor(MATERIAL_BREE, 2)).setUnlocalizedName("lotr:legsBree").setTextureName("lotr:legsBree");
            bootsBree = (new LOTRItemArmor(MATERIAL_BREE, 3)).setUnlocalizedName("lotr:bootsBree").setTextureName("lotr:bootsBree");
            swordBree = (new LOTRItemSword(MATERIAL_BREE)).setUnlocalizedName("lotr:swordBree").setTextureName("lotr:swordBree");

            ItemRegistration.registerItem(helmetBree, "helmetBree", 58);
            ItemRegistration.registerItem(helmetBreeKettle, "breekettle", 88);
            ItemRegistration.registerItem(bodyBree, "bodyBree", 59);
            ItemRegistration.registerItem(legsBree, "legsBree", 60);
            ItemRegistration.registerItem(bootsBree, "bootsBree", 61);
            ItemRegistration.registerItem(swordBree, "swordBree", 62);
        } else {
            System.err.println("Failed to find BREE material for armor initialization.");
        }
        linkLOTRWeapon(swordBree, "swordBree");

        //Elite Armors
        MATERIAL_SERPENT = getLOTRMaterialByName("SERPENT");
        if (MATERIAL_SERPENT != null) {
            helmetserpent = (new LOTRItemArmor(MATERIAL_SERPENT, 0)).setUnlocalizedName("lotr:helmetserpent").setTextureName("lotr:helmetserpent").setCreativeTab(null);
            bodyserpent = (new LOTRItemArmor(MATERIAL_SERPENT, 1, "chestplate")).setUnlocalizedName("lotr:bodyserpent").setTextureName("lotr:bodyserpent").setCreativeTab(null);
            legsserpent = (new LOTRItemArmor(MATERIAL_SERPENT, 2)).setUnlocalizedName("lotr:legsserpent").setTextureName("lotr:legsserpent").setCreativeTab(null);
            bootsserpent = (new LOTRItemArmor(MATERIAL_SERPENT, 3)).setUnlocalizedName("lotr:bootsserpent").setTextureName("lotr:bootsserpent").setCreativeTab(null);

            ItemRegistration.registerItem(helmetserpent, "helmetserpent", 103);
            ItemRegistration.registerItem(bodyserpent, "bodyserpent", 104);
            ItemRegistration.registerItem(legsserpent, "legsserpent", 105);
            ItemRegistration.registerItem(bootsserpent, "bootsserpent", 106);
        } else {
            System.err.println("Failed to find SERPENT material for armor initialization.");
        }
        MATERIAL_USURPER = getLOTRMaterialByName("USURPER");
        if (MATERIAL_USURPER != null) {
            helmetUsurper = (new LOTRItemArmor(MATERIAL_USURPER, 0, "helmet")).setUnlocalizedName("lotr:helmetUsurper").setTextureName("lotr:helmetUsurper").setCreativeTab(null);
            bodyUsurper = (new LOTRItemArmor(MATERIAL_USURPER, 1)).setUnlocalizedName("lotr:bodyUsurper").setTextureName("lotr:bodyUsurper").setCreativeTab(null);
            legsUsurper = (new LOTRItemArmor(MATERIAL_USURPER, 2)).setUnlocalizedName("lotr:legsUsurper").setTextureName("lotr:legsUsurper").setCreativeTab(null);
            bootsUsurper = (new LOTRItemArmor(MATERIAL_USURPER, 3)).setUnlocalizedName("lotr:bootsUsurper").setTextureName("lotr:bootsUsurper").setCreativeTab(null);

            ItemRegistration.registerItem(helmetUsurper, "helmetUsurper", 107);
            ItemRegistration.registerItem(bodyUsurper, "bodyUsurper", 108);
            ItemRegistration.registerItem(legsUsurper, "legsUsurper", 109);
            ItemRegistration.registerItem(bootsUsurper, "bootsUsurper", 110);
        } else {
            System.err.println("Failed to find USURPER material for armor initialization.");
        }
        MATERIAL_WARLORD = getLOTRMaterialByName("WARLORD");
        if (MATERIAL_WARLORD != null) {
            helmetWarlord = (new LOTRItemArmor(MATERIAL_WARLORD, 0, "helmet")).setUnlocalizedName("lotr:helmetWarlord").setTextureName("lotr:helmetWarlord").setCreativeTab(null);
            bodyWarlord = (new LOTRItemArmor(MATERIAL_WARLORD, 1)).setUnlocalizedName("lotr:bodyWarlord").setTextureName("lotr:bodyWarlord").setCreativeTab(null);
            legsWarlord = (new LOTRItemArmor(MATERIAL_WARLORD, 2)).setUnlocalizedName("lotr:legsWarlord").setTextureName("lotr:legsWarlord").setCreativeTab(null);
            bootsWarlord = (new LOTRItemArmor(MATERIAL_WARLORD, 3)).setUnlocalizedName("lotr:bootsWarlord").setTextureName("lotr:bootsWarlord").setCreativeTab(null);

            ItemRegistration.registerItem(helmetWarlord, "helmetWarlord", 111);
            ItemRegistration.registerItem(bodyWarlord, "bodyWarlord", 112);
            ItemRegistration.registerItem(legsWarlord, "legsWarlord", 113);
            ItemRegistration.registerItem(bootsWarlord, "bootsWarlord", 114);
        } else {
            System.err.println("Failed to find WARLORD material for armor initialization.");
        }

        //Rhudaur
        MATERIAL_RHUDUAR = getLOTRMaterialByName("RHUDAUR");
        if (MATERIAL_RHUDUAR != null) {
            helmetRhudaur = (new LOTRItemArmor(MATERIAL_RHUDUAR, 0, "helmet")).setUnlocalizedName("lotr:helmetRhudaur").setTextureName("lotr:helmetRhudaur");
            bodyRhudaur = (new LOTRItemArmor(MATERIAL_RHUDUAR, 1)).setUnlocalizedName("lotr:bodyRhudaur").setTextureName("lotr:bodyRhudaur");
            legsRhudaur = (new LOTRItemArmor(MATERIAL_RHUDUAR, 2)).setUnlocalizedName("lotr:legsRhudaur").setTextureName("lotr:legsRhudaur");
            bootsRhudaur = (new LOTRItemArmor(MATERIAL_RHUDUAR, 3)).setUnlocalizedName("lotr:bootsRhudaur").setTextureName("lotr:bootsRhudaur");

            ItemRegistration.registerItem(helmetRhudaur, "rhudaur",99);
            ItemRegistration.registerItem(bodyRhudaur, "bodyRhudaur", 100);
            ItemRegistration.registerItem(legsRhudaur, "legsRhudaur", 101);
            ItemRegistration.registerItem(bootsRhudaur, "bootsRhudaur", 102);
        } else {
            System.err.println("Failed to find RHUDAUR material for armor initialization.");
        }
        //Arnor
        MATERIAL_BATTLENUN = getLOTRMaterialByName("BATTLENUN");
        if (MATERIAL_BATTLENUN != null) {
            helmetArnorBanner = (new LOTRItemArmor(MATERIAL_BATTLENUN, 0)).setUnlocalizedName("lotr:helmetArnorBanner").setTextureName("lotr:helmetArnorBanner");
            bodyArnorBanner = (new LOTRItemArmor(MATERIAL_BATTLENUN, 1)).setUnlocalizedName("lotr:bodyArnorBanner").setTextureName("lotr:bodyArnorBanner");
            legsArnorBanner = (new LOTRItemArmor(MATERIAL_BATTLENUN, 2)).setUnlocalizedName("lotr:legsArnorBanner").setTextureName("lotr:legsArnorBanner");
            bootsArnorBanner = (new LOTRItemArmor(MATERIAL_BATTLENUN, 3)).setUnlocalizedName("lotr:bootsArnorBanner").setTextureName("lotr:bootsArnorBanner");
            maceArnor = (new LOTRItemHammer(LOTRMaterial.ARNOR)).setUnlocalizedName("lotr:maceArnor").setTextureName("lotr:maceArnor");

            ItemRegistration.registerItem(helmetArnorBanner, "helmetArnorBanner", 63);
            ItemRegistration.registerItem(bodyArnorBanner, "bodyArnorBanner", 64);
            ItemRegistration.registerItem(legsArnorBanner, "legsArnorBanner", 65);
            ItemRegistration.registerItem(bootsArnorBanner, "bootsArnorBanner", 66);
            ItemRegistration.registerItem(maceArnor, "maceArnor", 67);
        } else {
            System.err.println("Failed to find ARNOR material for armor initialization.");
        }
        linkLOTRWeapon(maceArnor, "maceArnor");
    }

    public static ModContainer getModContainer() {
        return FMLCommonHandler.instance()
            .findContainerFor(instance);
    }

    public void linkLOTRWeapon(Item item, String weapon_name) {
        try {
            Field field = LOTRMod.class.getField(weapon_name);
            field.set(null, item);
        } catch (Exception e) {
            System.err.println("[CinderLoE] linkLOTRWeapon: Failed to find field " + weapon_name + " in LOTRMod!");
        }
    }

    public static class CommonProxy {
        public void setup() {
        }
    }

    public static class ClientProxy extends CommonProxy {
        @Override
        public void setup() {
       //     RenderingRegistry.registerEntityRenderingHandler(HaradLevy.class, new LOTRRenderNearHaradrim());
        //    RenderingRegistry.registerEntityRenderingHandler(DwarfLevy.class, new LOTRRenderDwarf());

            RenderingRegistry.registerEntityRenderingHandler(BladorthinSmith.class, new LOTRRenderDorwinionElfVintner());

            RenderingRegistry.registerEntityRenderingHandler(DarkSpider.class, new RenderDarkSpider());

            RenderingRegistry.registerEntityRenderingHandler(CorruptDwarf.class, new RenderCorruptDwarf());
            RenderingRegistry.registerEntityRenderingHandler(CorruptElf.class, new RenderCorruptElf());
            RenderingRegistry.registerEntityRenderingHandler(CorruptEnt.class, new RenderCorruptEnt());
            RenderingRegistry.registerEntityRenderingHandler(CorruptHobbit.class, new RenderCorruptHobbit());
            RenderingRegistry.registerEntityRenderingHandler(CorruptMan.class, new RenderCorruptMan());
            RenderingRegistry.registerEntityRenderingHandler(CorruptOrc.class, new RenderCorruptOrc());

            RenderingRegistry.registerEntityRenderingHandler(SarumanFireball.class, new RenderSarumanFireball());
            RenderingRegistry.registerEntityRenderingHandler(Renegade.class, new RenderRenegade());
            RenderingRegistry.registerEntityRenderingHandler(RenegadeCaptain.class, new RenderRenegade());
            RenderingRegistry.registerEntityRenderingHandler(Wraith.class, new RenderWraith());

            RenderingRegistry.registerEntityRenderingHandler(RedDwarfWarrior.class, new LOTRRenderDwarf());
            RenderingRegistry.registerEntityRenderingHandler(RedDwarfArbalest.class, new LOTRRenderDwarf());
            RenderingRegistry.registerEntityRenderingHandler(RedDwarfBannerBearer.class, new LOTRRenderDwarf());
            RenderingRegistry.registerEntityRenderingHandler(RedDwarfCommander.class, new LOTRRenderDwarf());
            RenderingRegistry.registerEntityRenderingHandler(RedDwarfSmith.class, new LOTRRenderDwarf());

            RenderingRegistry.registerEntityRenderingHandler(Limwaith.class, new RenderLimwaith());
            RenderingRegistry.registerEntityRenderingHandler(LimwaithFishmonger.class, new RenderLimwaith());
            RenderingRegistry.registerEntityRenderingHandler(LimwaithShaman.class, new RenderLimwaithShaman());
            RenderingRegistry.registerEntityRenderingHandler(LimwaithWarrior.class, new RenderLimwaith());
            RenderingRegistry.registerEntityRenderingHandler(LimwaithBoneWarrior.class, new RenderLimwaith());
            RenderingRegistry.registerEntityRenderingHandler(LimwaithBlowgunner.class, new RenderLimwaith());
            RenderingRegistry.registerEntityRenderingHandler(LimwaithBannerBearer.class, new RenderLimwaith());
            RenderingRegistry.registerEntityRenderingHandler(LimwaithChieftain.class, new RenderLimwaith());

            //RenderingRegistry.registerEntityRenderingHandler(LimwaithCrocodile.class, new RenderTamedCrocodile());
            RenderingRegistry.registerEntityRenderingHandler(FangornBear.class, new RenderFangornBear());
            RenderingRegistry.registerEntityRenderingHandler(FangornWildBoar.class, new RenderFangornWildBoar());
            RenderingRegistry.registerEntityRenderingHandler(FangornAuroch.class, new RenderFangornAuroch());
            RenderingRegistry.registerEntityRenderingHandler(FangornElk.class, new RenderFangornElk());
            RenderingRegistry.registerEntityRenderingHandler(FangornWolf.class, new RenderFangornWolf());

            RenderingRegistry.registerEntityRenderingHandler(ArnorSoldier.class, new LOTRRenderDunedain());
            RenderingRegistry.registerEntityRenderingHandler(ArnorSoldierArcher.class, new LOTRRenderDunedain());
            RenderingRegistry.registerEntityRenderingHandler(ArnorCaptain.class, new LOTRRenderDunedain());
            RenderingRegistry.registerEntityRenderingHandler(ArnorBannerBearer.class, new LOTRRenderDunedain());
            RenderingRegistry.registerEntityRenderingHandler(BattleNun.class, new RenderBattleNun());

            RenderingRegistry.registerEntityRenderingHandler(BreeSoldier.class, new LOTRRenderBreeMan());
            RenderingRegistry.registerEntityRenderingHandler(BreeCrossbowman.class, new LOTRRenderBreeMan());
            RenderingRegistry.registerEntityRenderingHandler(BreeCaptain.class, new LOTRRenderBreeMan());
            RenderingRegistry.registerEntityRenderingHandler(BreeSoldierBannerBearer.class, new LOTRRenderBreeMan());
            RenderingRegistry.registerEntityRenderingHandler(BreeOutrider.class, new LOTRRenderBreeMan());

            RenderingRegistry.registerEntityRenderingHandler(LOTREntitySauron.class, new LOTRRenderSauron());
            RenderingRegistry.registerEntityRenderingHandler(UtumnoSlaveTrader.class, new RenderUtumnoSlave());
            ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMistBlock.class, (TileEntitySpecialRenderer)new LOTRRenderUtumnoPortal());
        }
    }

    public static class ServerProxy extends CommonProxy {
        @Override
        public void setup() {
        }
    }

    public void modifySpawnLists() {
        try {
            // Retrieve the constructor of LOTRSpawnList class
            Constructor<LOTRSpawnList> constructor = LOTRSpawnList.class.getDeclaredConstructor(LOTRSpawnEntry[].class);
            constructor.setAccessible(true); // Make the private constructor accessible

            // RED_DWARF is initialized earlier in this class
            LOTRSpawnList RED_DWARF = constructor.newInstance((Object) new LOTRSpawnEntry[]{
                new LOTRSpawnEntry(LOTREntityDwarf.class, 100, 4, 4),
                new LOTRSpawnEntry(LOTREntityDwarfMiner.class, 15, 1, 3),
                new LOTRSpawnEntry(RedDwarfWarrior.class, 20, 4, 4),
                new LOTRSpawnEntry(RedDwarfArbalest.class, 10, 4, 4)
            });

            LOTRSpawnList LIMWAITH = constructor.newInstance((Object) new LOTRSpawnEntry[]{
                new LOTRSpawnEntry(Limwaith.class, 100, 4, 6),
                new LOTRSpawnEntry(LimwaithWarrior.class, 20, 4, 6),
                new LOTRSpawnEntry(LimwaithBlowgunner.class, 15, 1, 3),
                new LOTRSpawnEntry(LimwaithBoneWarrior.class, 10, 1, 3)
            });


            Field redDwarfField = LOTRSpawnList.class.getDeclaredField("RED_DWARF");
            redDwarfField.setAccessible(true);
            redDwarfField.set(null, RED_DWARF);

            Field limwaithField = LOTRSpawnList.class.getDeclaredField("LIMWAITH");
            limwaithField.setAccessible(true);
            limwaithField.set(null, LIMWAITH);


            if (LOTRBiome.redMountains != null) {
                LOTRBiome.redMountains.npcSpawnList.newFactionList(500)
                    .add(new LOTRBiomeSpawnList.SpawnListContainer[]{
                        LOTRBiomeSpawnList.entry((LOTRSpawnList) redDwarfField.get(null), 10)
                    });
            } else {
                System.out.println("Red Mountains biome is not available.");
            }
            if (LOTRBiome.farHaradMangrove != null) {
                LOTRBiome.farHaradMangrove.npcSpawnList.newFactionList(500)
                    .add(new LOTRBiomeSpawnList.SpawnListContainer[]{
                        LOTRBiomeSpawnList.entry((LOTRSpawnList) limwaithField.get(null), 10)
                    });
            } else {
                System.out.println("Mangrove biome is not available.");
            }
        } catch (Exception e) {
            System.err.println("[CinderLoE] linkLOTRWeapon: Failed to find field RED_DWARF in LOTRSpawnList!");
        }
    }

    public static LOTRMaterial getLOTRMaterialByName(String materialName) {
        try {
            Field materialField = LOTRMaterial.class.getField(materialName);
            return (LOTRMaterial) materialField.get(null);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    // Debug method
    public static void printClass(String className) {
        String resourcePath = "/" + className.replace('.', '/') + ".class";
        InputStream in = CinderLoE.class.getResourceAsStream(resourcePath);
        if (in == null) {
            System.out.println("Class resource not found: " + resourcePath);
            return;
        }
        try {
            ClassReader classReader = new ClassReader(in);
            classReader.accept(new TraceClassVisitor(new PrintWriter(System.out)), 0);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    @SubscribeEvent
    @SideOnly(Side.SERVER)
    public void onWorldLoad(WorldEvent.Load event) {
        // == Crop Blocks ==
        CinderCore.registerItemFallback(Block.getIdFromBlock(onionCrop), Block.getIdFromBlock(LOTRMod.turnipCrop), "cinder_loe", "1.2.1");
        CinderCore.registerItemFallback(Block.getIdFromBlock(cabbageCrop), Block.getIdFromBlock(LOTRMod.lettuceCrop), "cinder_loe", "1.2.1");
        // == Food Items ==
        CinderCore.registerItemFallback(Item.getIdFromItem(onion), Item.getIdFromItem(LOTRMod.turnip), "cinder_loe", "1.2.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(cabbage), Item.getIdFromItem(LOTRMod.lettuce), "cinder_loe", "1.2.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(spice), Item.getIdFromItem(LOTRMod.dye), "cinder_loe", "1.2.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(spicedHam), Item.getIdFromItem(LOTRMod.gammon), "cinder_loe", "1.2.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(pelmen), Item.getIdFromItem(LOTRMod.cram), "cinder_loe", "1.2.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(lightStew), Item.getIdFromItem(LOTRMod.leekSoup), "cinder_loe", "1.2.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(chocolatebar),Item.getIdFromItem(LOTRMod.marzipanChocolate), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(fruitsalad),Item.getIdFromItem(LOTRMod.leekSoup), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(flour),Item.getIdFromItem(Items.sugar), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(dough),Item.getIdFromItem(Items.gunpowder), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(pasta),Item.getIdFromItem(Items.wheat), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(pretzel),Item.getIdFromItem(Items.bread), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(halva),Item.getIdFromItem(Items.bread),"cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(honey),Item.getIdFromItem(LOTRMod.mapleSyrup), "cinder_loe", "1.2.5");

        //== Blocks==
        CinderCore.registerItemFallback(Block.getIdFromBlock(cinderBlock), Block.getIdFromBlock(Blocks.netherrack), "cinder_loe", "1.0");
       // CinderCore.registerItemFallback(Block.getIdFromBlock(barricade), Block.getIdFromBlock(Blocks.fence), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Block.getIdFromBlock(ivoryBlock), Block.getIdFromBlock(LOTRMod.boneBlock), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Block.getIdFromBlock(blockRedDwarfSteel), Block.getIdFromBlock(LOTRMod.blockOreStorage), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Block.getIdFromBlock(chandelierRedDwarf), Block.getIdFromBlock(LOTRMod.chandelier), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Block.getIdFromBlock(barsRedDwarf), Block.getIdFromBlock(LOTRMod.dwarfBars), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Block.getIdFromBlock(furBundle), Block.getIdFromBlock(Blocks.hay_block), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Block.getIdFromBlock(leatherBundle), Block.getIdFromBlock(Blocks.hay_block), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Block.getIdFromBlock(reedBale), Block.getIdFromBlock(Blocks.hay_block), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Block.getIdFromBlock(dwarvenBrickRuned), Block.getIdFromBlock(LOTRMod.brick), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Block.getIdFromBlock(fishBarrel), Block.getIdFromBlock(LOTRMod.woodBeam1), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Block.getIdFromBlock(rustedsword), Block.getIdFromBlock(Blocks.nether_brick_fence), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Block.getIdFromBlock(silverChain), Block.getIdFromBlock(LOTRMod.orcChain), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Block.getIdFromBlock(goldChain), Block.getIdFromBlock(LOTRMod.orcChain), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Block.getIdFromBlock(ironChain), Block.getIdFromBlock(LOTRMod.orcChain), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Block.getIdFromBlock(bronzeChain), Block.getIdFromBlock(LOTRMod.orcChain), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Block.getIdFromBlock(mistBlock), Block.getIdFromBlock(LOTRMod.utumnoPortal), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Block.getIdFromBlock(cutDrystone), Block.getIdFromBlock(LOTRMod.cobblebrick), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Block.getIdFromBlock(cobbleDrystone), Block.getIdFromBlock(LOTRMod.cobblebrick), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Block.getIdFromBlock(reeflessCoral), Block.getIdFromBlock(LOTRMod.coralReef), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Block.getIdFromBlock(plaster), Block.getIdFromBlock(Blocks.brick_block), "cinder_loe", "1.2.1");
        CinderCore.registerItemFallback(Block.getIdFromBlock(voidblock), Block.getIdFromBlock(Blocks.coal_block), "cinder_loe", "1.2.1");
       // CinderCore.registerItemFallback(Block.getIdFromBlock(verticalWeaponRack), Block.getIdFromBlock(Blocks.fence), "cinder_loe", "1.2.4");
        // == Gates ==
        //CinderCore.registerItemFallback(Block.getIdFromBlock(gatecharredportcullis), Block.getIdFromBlock(LOTRMod.gateWoodenCross), "cinder_loe", "1.2.5");
        // == Red Dwarf Items==
        CinderCore.registerItemFallback(Item.getIdFromItem(redDwarfSteel), Item.getIdFromItem(LOTRMod.dwarfSteel), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(spearRedDwarf), Item.getIdFromItem(LOTRMod.spearDwarven), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(swordRedDwarf), Item.getIdFromItem(LOTRMod.swordDwarven), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(battleaxeRedDwarf), Item.getIdFromItem(LOTRMod.battleaxeDwarven), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(pikeRedDwarf), Item.getIdFromItem(LOTRMod.pikeDwarven), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(hammerRedDwarf), Item.getIdFromItem(LOTRMod.hammerDwarven), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(daggerRedDwarf), Item.getIdFromItem(LOTRMod.daggerDwarven), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(daggerRedDwarfPoisoned), Item.getIdFromItem(LOTRMod.daggerDwarvenPoisoned), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(helmetRedDwarf), Item.getIdFromItem(LOTRMod.helmetDwarvenGold), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(bodyRedDwarf), Item.getIdFromItem(LOTRMod.bodyDwarvenGold), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(legsRedDwarf), Item.getIdFromItem(LOTRMod.legsDwarvenGold), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(bootsRedDwarf), Item.getIdFromItem(LOTRMod.bootsDwarvenGold), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(crossbowRedDwarf), Item.getIdFromItem(LOTRMod.ironCrossbow), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(boarArmorRedDwarf), Item.getIdFromItem(LOTRMod.boarArmorDwarven), "cinder_loe", "1.0");
        // == Rhudaur Items==
        CinderCore.registerItemFallback(Item.getIdFromItem(helmetRhudaur), Item.getIdFromItem(LOTRMod.helmetFur), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(bodyRhudaur), Item.getIdFromItem(LOTRMod.bodyFur), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(legsRhudaur), Item.getIdFromItem(LOTRMod.legsFur), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(bootsRhudaur), Item.getIdFromItem(LOTRMod.bootsFur), "cinder_loe", "1.2.5");
        // == Elite Armors==
        CinderCore.registerItemFallback(Item.getIdFromItem(helmetserpent), Item.getIdFromItem(LOTRMod.helmetNearHarad), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(bodyserpent), Item.getIdFromItem(LOTRMod.bodyNearHarad), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(legsserpent),Item.getIdFromItem(LOTRMod.bodyNearHarad), "cinder_loe","1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(bootsserpent), Item.getIdFromItem(LOTRMod.bootsNearHarad), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(helmetUsurper), Item.getIdFromItem(LOTRMod.helmetUmbar), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(bodyUsurper), Item.getIdFromItem(LOTRMod.bodyUmbar), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(legsUsurper), Item.getIdFromItem(LOTRMod.legsUmbar), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(bootsUsurper), Item.getIdFromItem(LOTRMod.bootsUmbar), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(helmetWarlord), Item.getIdFromItem(LOTRMod.helmetNomad), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(bodyWarlord), Item.getIdFromItem(LOTRMod.bodyNomad), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(legsWarlord), Item.getIdFromItem(LOTRMod.legsNomad), "cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(bootsWarlord), Item.getIdFromItem(LOTRMod.bootsNomad), "cinder_loe", "1.2.5");
        // == Wizard Staves ==
        CinderCore.registerItemFallback(Item.getIdFromItem(radagastStaff), Item.getIdFromItem(LOTRMod.gandalfStaffWhite), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(pallandoStaff), Item.getIdFromItem(LOTRMod.gandalfStaffWhite), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(alatarStaff), Item.getIdFromItem(LOTRMod.gandalfStaffWhite), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(sarumanStaff), Item.getIdFromItem(LOTRMod.gandalfStaffWhite), "cinder_loe", "1.0");
        // == Relics ==
        CinderCore.registerItemFallback(Item.getIdFromItem(welfRelic), Item.getIdFromItem(LOTRMod.rhinoHorn), "cinder_loe", "1.2");
        // == Specials ==
        CinderCore.registerItemFallback(Item.getIdFromItem(frostblade), Item.getIdFromItem(LOTRMod.swordMithril), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(daggervoid), Item.getIdFromItem(LOTRMod.daggerMithril), "cinder_loe", "1.2.3");
        CinderCore.registerItemFallback(Item.getIdFromItem(spearsolidgold), Item.getIdFromItem(LOTRMod.spearMithril), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(spearUnnamed), Item.getIdFromItem(LOTRMod.spearMithril), "cinder_loe", "1.2.4");
        CinderCore.registerItemFallback(Item.getIdFromItem(whip), Item.getIdFromItem(LOTRMod.balrogWhip), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(helmetbrokenhalo), Item.getIdFromItem(Items.golden_helmet),"cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(helmetJade), Item.getIdFromItem(LOTRMod.helmetMithril),"cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(bodyJade), Item.getIdFromItem(LOTRMod.bodyMithril),"cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(legsJade), Item.getIdFromItem(LOTRMod.legsMithril),"cinder_loe", "1.2.5");
        CinderCore.registerItemFallback(Item.getIdFromItem(bootsJade), Item.getIdFromItem(LOTRMod.bootsMithril),"cinder_loe", "1.2.5");
        // == Ash Forged ==
        CinderCore.registerItemFallback(Item.getIdFromItem(ingotAsh), Item.getIdFromItem(LOTRMod.galvorn), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(daggerAsh), Item.getIdFromItem(LOTRMod.daggerBlackUruk), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(swordAsh), Item.getIdFromItem(LOTRMod.scimitarBlackUruk), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(staffAsh), Item.getIdFromItem(LOTRMod.polearmOrc), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(hammerAsh), Item.getIdFromItem(LOTRMod.hammerBlackUruk), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(battleaxeAsh), Item.getIdFromItem(LOTRMod.battleaxeBlackUruk), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(pikeAsh), Item.getIdFromItem(LOTRMod.pikeDolGuldur), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(bowAsh), Item.getIdFromItem(LOTRMod.blackUrukBow), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(spearAsh), Item.getIdFromItem(LOTRMod.spearBlackUruk), "cinder_loe", "1.2");
        // == Spawn Eggs ==
        CinderCore.registerItemFallback(Item.getIdFromItem(fangornBearSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(fangornAurochSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(fangornWildBoarSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(fangornElkSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(redDwarfWarriorSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(redDwarfArbalestSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(redDwarfCommanderSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(redDwarfBannerBearerSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(redDwarfSmithSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.2.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(limwaithSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(limwaithFishmongerSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(limwaithShamanSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(limwaithWarriorSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(limwaithBoneWarriorSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(limwaithBlowgunnerSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(limwaithBannerBearerSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(limwaithChieftainSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(renegadeSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(renegadeCaptainSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(wraithSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(ArnorSoldierSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(ArnorSoldierArcherSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(ArnorCaptainSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(ArnorBannerBearerSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(battleNunSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(BreeSoldierSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(BreeCrossbowmanSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(BreeCaptainSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(BreeSoldierBannerBearerSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(BreeOutriderSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(SauronSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.1");
        // == Utumno Expansion ==
        CinderCore.registerItemFallback(Item.getIdFromItem(utumnoSlaveSpawnEgg), Item.getIdFromItem(Items.spawn_egg), "cinder_loe", "1.2.1");
        // == Limwaith Items ==
        CinderCore.registerItemFallback(Item.getIdFromItem(bonemold), Item.getIdFromItem(LOTRMod.leekSoup), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(helmetLimwaith), Item.getIdFromItem(LOTRMod.helmetMoredain), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(bodyLimwaith), Item.getIdFromItem(LOTRMod.bodyMoredain), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(legsLimwaith), Item.getIdFromItem(LOTRMod.legsMoredain), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(bootsLimwaith), Item.getIdFromItem(LOTRMod.bootsMoredain), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(helmetboneLimwaith), Item.getIdFromItem(LOTRMod.helmetBone), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(bodyboneLimwaith), Item.getIdFromItem(LOTRMod.bodyBone), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(legsboneLimwaith), Item.getIdFromItem(LOTRMod.legsBone), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(bootsboneLimwaith), Item.getIdFromItem(LOTRMod.bootsBone), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(spearLimwaith), Item.getIdFromItem(LOTRMod.spearMoredain), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(tridentLimwaith), Item.getIdFromItem(LOTRMod.dunlendingTrident), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(truncheonLimwaith), Item.getIdFromItem(LOTRMod.swordMoredain), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(battleaxeLimwaith), Item.getIdFromItem(LOTRMod.battleaxeMoredain), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(daggerLimwaith), Item.getIdFromItem(LOTRMod.daggerMoredain), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(daggerLimwaithPoisoned), Item.getIdFromItem(LOTRMod.daggerMoredainPoisoned), "cinder_loe", "1.0");
        CinderCore.registerItemFallback(Item.getIdFromItem(blowgunLimwaith), Item.getIdFromItem(LOTRMod.tauredainBlowgun), "cinder_loe", "1.0");
        // == Bree Items ==
        CinderCore.registerItemFallback(Item.getIdFromItem(helmetBree), Item.getIdFromItem(Items.iron_helmet), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(helmetBreeKettle), Item.getIdFromItem(Items.iron_helmet), "cinder_loe", "1.2");
        CinderCore.registerItemFallback(Item.getIdFromItem(bodyBree), Item.getIdFromItem(Items.chainmail_chestplate), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(legsBree), Item.getIdFromItem(Items.chainmail_leggings), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(bootsBree), Item.getIdFromItem(Items.iron_boots), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(swordBree), Item.getIdFromItem(Items.iron_sword), "cinder_loe", "1.1");
        // == Arnor Items ==
        CinderCore.registerItemFallback(Item.getIdFromItem(helmetArnorBanner), Item.getIdFromItem(Items.chainmail_helmet), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(bodyArnorBanner), Item.getIdFromItem(Items.chainmail_chestplate), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(legsArnorBanner), Item.getIdFromItem(Items.chainmail_leggings), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(bootsArnorBanner), Item.getIdFromItem(Items.chainmail_boots), "cinder_loe", "1.1");
        CinderCore.registerItemFallback(Item.getIdFromItem(maceArnor), Item.getIdFromItem(LOTRMod.blacksmithHammer), "cinder_loe", "1.1");

     //   CinderCore.registerEntityFallback(HaradLevy.class, LOTREntityNearHaradrim.class, "cinder_loe", "1.2.3");
     //   CinderCore.registerEntityFallback(DwarfLevy.class, LOTREntityDwarf.class, "cinder_loe", "1.2.3");
        CinderCore.registerEntityFallback(DarkSpider.class, LOTREntityUtumnoIceSpider.class, "cinder_loe", "1.2.4");

        CinderCore.registerEntityFallback(BladorthinSmith.class, LOTREntityDorwinionElf.class, "cinder_loe", "1.2.4");

        CinderCore.registerEntityFallback(CorruptDwarf.class, LOTREntityDwarf.class, "cinder_loe", "1.2.3");
        CinderCore.registerEntityFallback(CorruptElf.class, LOTREntityTormentedElf.class, "cinder_loe", "1.2.3");
        CinderCore.registerEntityFallback(CorruptEnt.class, LOTREntityEnt.class, "cinder_loe", "1.2.3");
        CinderCore.registerEntityFallback(CorruptHobbit.class, LOTREntityHobbit.class, "cinder_loe", "1.2.3");
        CinderCore.registerEntityFallback(CorruptMan.class, LOTREntityGondorMan.class, "cinder_loe", "1.2.3");
        CinderCore.registerEntityFallback(CorruptOrc.class, LOTREntityGundabadOrc.class, "cinder_loe", "1.2.3");

        CinderCore.registerEntityFallback(SarumanFireball.class, LOTREntityGandalfFireball.class, "cinder_loe", "1.0");
        CinderCore.registerEntityFallback(Renegade.class, LOTREntityBandit.class, "cinder_loe", "1.0");
        CinderCore.registerEntityFallback(RenegadeCaptain.class, LOTREntityBandit.class, "cinder_loe", "1.1");
        CinderCore.registerEntityFallback(Wraith.class, LOTREntityMarshWraith.class, "cinder_loe", "1.0");
        CinderCore.registerEntityFallback(LOTREntitySauron.class, LOTREntityBarrowWight.class, "cinder_loe", "1.1");

        CinderCore.registerEntityFallback(RedDwarfWarrior.class, LOTREntityDwarfWarrior.class, "cinder_loe", "1.0");
        CinderCore.registerEntityFallback(RedDwarfArbalest.class, LOTREntityDwarfAxeThrower.class, "cinder_loe", "1.0");
        CinderCore.registerEntityFallback(RedDwarfBannerBearer.class, LOTREntityDwarfBannerBearer.class, "cinder_loe", "1.0");
        CinderCore.registerEntityFallback(RedDwarfCommander.class, LOTREntityDwarfCommander.class, "cinder_loe", "1.0");
        CinderCore.registerEntityFallback(RedDwarfSmith.class, LOTREntityDwarfSmith.class, "cinder_loe", "1.2.1");

        CinderCore.registerEntityFallback(Limwaith.class, LOTREntityMoredain.class, "cinder_loe", "1.2");
        CinderCore.registerEntityFallback(LimwaithFishmonger.class, LOTREntityMoredain.class, "cinder_loe", "1.2");
        CinderCore.registerEntityFallback(LimwaithShaman.class, LOTREntityTauredainShaman.class, "cinder_loe", "1.2");
        CinderCore.registerEntityFallback(LimwaithWarrior.class, LOTREntityMoredain.class, "cinder_loe", "1.0");
        CinderCore.registerEntityFallback(LimwaithBoneWarrior.class, LOTREntityMoredain.class, "cinder_loe", "1.2");
        CinderCore.registerEntityFallback(LimwaithBlowgunner.class, LOTREntityMoredain.class, "cinder_loe", "1.0");
        CinderCore.registerEntityFallback(LimwaithBannerBearer.class, LOTREntityMoredainBannerBearer.class, "cinder_loe", "1.0");
        CinderCore.registerEntityFallback(LimwaithChieftain.class, LOTREntityMoredainChieftain.class, "cinder_loe", "1.0");

        //CinderCore.registerEntityFallback(LimwaithCrocodile.class, LOTREntityCrocodile.class, "cinder_loe", "1.2");
        CinderCore.registerEntityFallback(FangornBear.class, LOTREntityBear.class, "cinder_loe", "1.0");
        CinderCore.registerEntityFallback(FangornWildBoar.class, LOTREntityWildBoar.class, "cinder_loe", "1.0");
        CinderCore.registerEntityFallback(FangornAuroch.class, LOTREntityAurochs.class, "cinder_loe", "1.0");
        CinderCore.registerEntityFallback(FangornElk.class, LOTREntityElk.class, "cinder_loe", "1.0");
        CinderCore.registerEntityFallback(FangornWolf.class, EntityWolf.class, "cinder_loe", "1.0");

        CinderCore.registerEntityFallback(ArnorSoldier.class, LOTREntityDunedain.class, "cinder_loe", "1.1");
        CinderCore.registerEntityFallback(ArnorSoldierArcher.class, LOTREntityDunedain.class, "cinder_loe", "1.1");
        CinderCore.registerEntityFallback(ArnorCaptain.class, LOTREntityDunedain.class, "cinder_loe", "1.1");
        CinderCore.registerEntityFallback(ArnorBannerBearer.class, LOTREntityDunedain.class, "cinder_loe", "1.1");
        CinderCore.registerEntityFallback(BattleNun.class, LOTREntityDunedain.class, "cinder_loe", "1.1");

        CinderCore.registerEntityFallback(BreeSoldier.class, LOTREntityBreeMan.class, "cinder_loe", "1.1");
        CinderCore.registerEntityFallback(BreeCrossbowman.class, LOTREntityBreeMan.class, "cinder_loe", "1.1");
        CinderCore.registerEntityFallback(BreeCaptain.class, LOTREntityBreeMan.class, "cinder_loe", "1.1");
        CinderCore.registerEntityFallback(BreeSoldierBannerBearer.class, LOTREntityBreeMan.class, "cinder_loe", "1.1");
        CinderCore.registerEntityFallback(BreeOutrider.class, LOTREntityBreeMan.class, "cinder_loe", "1.1");

        CinderCore.registerCustomFallback(42, 16, "banner", "cinder_loe", "1.2");
        CinderCore.registerCustomFallback(43, 16, "banner", "cinder_loe", "1.2.4");
        CinderCore.registerCustomFallback(44, 16, "banner", "cinder_loe", "1.2.4");
        CinderCore.registerCustomFallback(45, 16, "banner", "cinder_loe", "1.2.4");
        CinderCore.registerCustomFallback(46, 16, "banner", "cinder_loe", "1.2.4");
    }

    // Create unit trade entries here, out of the way of important code
    public void setupTradeEntries() {
        RED_DWARF_COMMANDER = new LOTRUnitTradeEntries(200.0F, new LOTRUnitTradeEntry[]{
            new LOTRUnitTradeEntry(LOTREntityDwarf.class, 20, 0.0F),
            (new LOTRUnitTradeEntry(RedDwarfWarrior.class, 30, 50.0F)).setPledgeType(LOTRUnitTradeEntry.PledgeType.ANY_DWARF),
            (new LOTRUnitTradeEntry(RedDwarfArbalest.class, 50, 100.0F)).setPledgeType(LOTRUnitTradeEntry.PledgeType.ANY_DWARF),
            (new LOTRUnitTradeEntry(RedDwarfWarrior.class, LOTREntityWildBoar.class, "RedDwarfWarrior_Boar", 50, 150.0F)).setMountArmor(boarArmorRedDwarf).setPledgeType(LOTRUnitTradeEntry.PledgeType.ANY_DWARF),
            (new LOTRUnitTradeEntry(RedDwarfArbalest.class, LOTREntityWildBoar.class, "RedDwarfArbalest_Boar", 70, 200.0F)).setMountArmor(boarArmorRedDwarf).setPledgeType(LOTRUnitTradeEntry.PledgeType.ANY_DWARF),
            (new LOTRUnitTradeEntry(RedDwarfBannerBearer.class, 50, 200.0F)).setPledgeType(LOTRUnitTradeEntry.PledgeType.ANY_DWARF) });

        LIMWAITH_COMMANDER = new LOTRUnitTradeEntries(200.0F, new LOTRUnitTradeEntry[]{
            new LOTRUnitTradeEntry(LimwaithWarrior.class, 30, 50.0F),
            (new LOTRUnitTradeEntry(LimwaithBlowgunner.class, 50, 100.0F)).setPledgeType(LOTRUnitTradeEntry.PledgeType.FACTION),
            (new LOTRUnitTradeEntry(LimwaithBoneWarrior.class, 70, 200.0F)).setPledgeType(LOTRUnitTradeEntry.PledgeType.FACTION),
            (new LOTRUnitTradeEntry(LimwaithBannerBearer.class, 50, 200.0F)).setPledgeType(LOTRUnitTradeEntry.PledgeType.FACTION) });

        ARNOR_CAPTAIN = new LOTRUnitTradeEntries(200.0F, new LOTRUnitTradeEntry[]{
            (new LOTRUnitTradeEntry(ArnorSoldier.class, 60, 250.0F)).setPledgeType(LOTRUnitTradeEntry.PledgeType.FACTION),
            (new LOTRUnitTradeEntry(ArnorSoldierArcher.class, 100, 300.0F)).setPledgeType(LOTRUnitTradeEntry.PledgeType.FACTION),
            (new LOTRUnitTradeEntry(ArnorSoldier.class, LOTREntityHorse.class, "Arnor_Horse", 100, 150.0F)).setMountArmor(horseArmorIron).setPledgeType(LOTRUnitTradeEntry.PledgeType.FACTION),
            (new LOTRUnitTradeEntry(ArnorSoldierArcher.class, LOTREntityHorse.class, "Arnor_Horse", 140, 200.0F)).setMountArmor(horseArmorIron).setPledgeType(LOTRUnitTradeEntry.PledgeType.FACTION),
            (new LOTRUnitTradeEntry(LOTREntityRangerNorth.class, 50, 0.0f)),
            (new LOTRUnitTradeEntry(LOTREntityRangerNorth.class, LOTREntityHorse.class, "RangerNorth_Horse", 70, 100.0f)),
            (new LOTRUnitTradeEntry(LOTREntityRangerNorthBannerBearer.class, 70, 150.0f)),
            (new LOTRUnitTradeEntry(ArnorBannerBearer.class, 100, 400.0F)).setPledgeType(LOTRUnitTradeEntry.PledgeType.FACTION) });

        BREE_CAPTAIN = new LOTRUnitTradeEntries(150.0F, new LOTRUnitTradeEntry[]{
            (new LOTRUnitTradeEntry(LOTREntityBreeGuard.class, 20, 0.0f)),
            (new LOTRUnitTradeEntry(BreeSoldier.class, 60, 250.0F)).setPledgeType(LOTRUnitTradeEntry.PledgeType.FACTION),
            (new LOTRUnitTradeEntry(BreeCrossbowman.class, 100, 300.0F)).setPledgeType(LOTRUnitTradeEntry.PledgeType.FACTION),
            (new LOTRUnitTradeEntry(BreeOutrider.class, LOTREntityHorse.class, "Bree_Horse", 150, 400.0F)).setMountArmor(horseArmorIron).setPledgeType(LOTRUnitTradeEntry.PledgeType.FACTION),
            (new LOTRUnitTradeEntry(LOTREntityBreeBannerBearer.class, 40, 150.0f)),
            (new LOTRUnitTradeEntry(BreeSoldierBannerBearer.class, 100, 400.0F)).setPledgeType(LOTRUnitTradeEntry.PledgeType.FACTION) });
    }


    public class DevCommand extends CommandBase {
/*
        public static float box1 = -7F;
        public static float box2 = -6F;
        public static float box3 = -7F;
        public static int box4 = 14;
        public static int box5 = 0;
        public static int box6 = 14;
*/
        public static float box1 = -7F; // X position
        public static float box2 = -6.5F; // Y position
        public static float box3 = -7F; // Z position
        public static int box4 = 14; // X Texture map size
        public static int box5 = 0; // Y Texture map size
        public static int box6 = 14; // Z Texture map size

        @Override
        public String getCommandName() {
            return "dev"; // Command name
        }

        @Override
        public String getCommandUsage(ICommandSender sender) {
            return "/dev"; // Usage
        }

        @Override
        public void processCommand(ICommandSender sender, String[] args) {
            if (args.length < 1) {
                sender.addChatMessage(new ChatComponentText("Usage: /dev <variable> <value>"));
                return;
            } else if (args.length < 2 && args[0].equals("print")) {
                sender.addChatMessage(new ChatComponentText("Variable box1: " + box1));
                sender.addChatMessage(new ChatComponentText("Variable box2: " + box2));
                sender.addChatMessage(new ChatComponentText("Variable box3: " + box3));
                sender.addChatMessage(new ChatComponentText("Variable box4: " + box4));
                sender.addChatMessage(new ChatComponentText("Variable box5: " + box5));
                sender.addChatMessage(new ChatComponentText("Variable box6: " + box6));
                return;
            }


            String variableName = args[0];
            String value = args[1];

            try {
                switch (variableName) {
                    case "box1":
                        box1 = Float.parseFloat(value);
                        break;
                    case "box2":
                        box2 = Float.parseFloat(value);
                        break;
                    case "box3":
                        box3 = Float.parseFloat(value);
                        break;
                    case "box4":
                        box4 = Integer.parseInt(value);
                        break;
                    case "box5":
                        box5 = Integer.parseInt(value);
                        break;
                    case "box6":
                        box6 = Integer.parseInt(value);
                        break;
                    default:
                        sender.addChatMessage(new ChatComponentText("Unknown variable."));
                        return;
                }
                sender.addChatMessage(new ChatComponentText(variableName + " set to " + value));
            } catch (NumberFormatException e) {
                sender.addChatMessage(new ChatComponentText("Invalid value format for " + variableName));
            }
        }

        @Override
        public boolean canCommandSenderUseCommand(ICommandSender sender) {
            return true; // Here you can add permission checks if necessary
        }
    }
    public int getRustedSwordID() {return 0;}
}
