public class CommonProxy implements IGuiHandler
{
	public void RegisterRenderers()
	{
		
	}

    @Override
    public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) 
    {
    	switch(id)
    	{
    		case GuiIds.GUI_SELL :
    			return new ContainerSell((TileEntitySell) world.getBlockTileEntity(x, y, z), player.inventory);
            default:
            	return null;
    	}
    }

    @Override
    public Object getClientGuiElement(int id, EntityPlayer player, World world,int x, int y, int z) 
    {
    	switch(id)
    	{
    		case GuiIds.GUI_SELL :
    			return new GuiSell(player.inventory, (TileEntitySell) world.getBlockTileEntity(x, y, z));
    		default:
    			return null;
    	}
    }

	public void registerPostInit() 
	{
		
	}
} public class CommonTickHandler implements ITickHandler
{	
	@Override
	public void tickStart(EnumSet<TickType> type, Object... tickData) {}

	@Override
	public void tickEnd(EnumSet<TickType> type, Object... tickData)
	{
		if(type.equals(EnumSet.of(TickType.SERVER)))
		{
			onTickInGame();
		}
	}

    public EnumSet ticks()
	{
    	return EnumSet.of(TickType.SERVER);
	}

   public String getLabel()
   {
	   return null;
   }
	    
   public void onTickInGame()
   {

   }
} public class SaveHandler implements IPlayerTracker
{
	public static int DataSaved = 1;
	private static SaveHandler instance;
	public static int Worthy;
	private GoldKeeper gold;
	private ExperienceKeeper experience;
	private StatKeeper stats;
	private EntityPlayer player;
	private NBTTagCompound data;
	public Player par1player;
	private LevelKeeper level;
	private RaceKeeper race;
	
	public SaveHandler()
	{
		instance = this;
	}
	
	@Override
	public void onPlayerLogin(EntityPlayer receiver)
	{
		this.par1player = (Player)receiver;
		getData(receiver);
		PacketDispatcher.sendPacketToPlayer(PacketType.populatePacket(new PacketGold(receiver.username, gold.getGoldTotal(receiver))), par1player);
		PacketDispatcher.sendPacketToPlayer(PacketType.populatePacket(new PacketExperience(receiver.username, experience.getExperience(receiver))), par1player);
		PacketDispatcher.sendPacketToPlayer(PacketType.populatePacket(new PacketStatsClient(receiver.username, stats.getStrengthPoints(receiver), 	
																											stats.getDexerityPoints(receiver), 
																											stats.getIntelligencePoints(receiver), 
																											stats.getLuckPoints(receiver))), par1player);
				
				
		for(int i = 1; i <= QuestRegistry.getMap().size(); i++)
		{
			Quest quest = QuestRegistry.getQuest(i).setPlayer(player);
			PacketDispatcher.sendPacketToPlayer(PacketType.populatePacket(new PacketQuestDataClient(receiver.username, quest.getQuestName(), QuestHandler.instance().getQuestStatus(receiver, quest.getQuestName()))), par1player);
		}
	}
	
	@Override
	public void onPlayerLogout(EntityPlayer receiver)
	{
		SetData(receiver);
	}
	@Override
	public void onPlayerChangedDimension(EntityPlayer player){}
	@Override
	public void onPlayerRespawn(EntityPlayer player){}
	
	public void SetData(EntityPlayer player)
	{
		data = player.getEntityData().getCompoundTag(player.PERSISTED_NBT_TAG);
		data.setInteger("GoldTotal", gold.getGoldTotal(player));
		data.setInteger("Worthy", experience.getExperience(player));
		data.setInteger("Strength", stats.getStrengthPoints(player));
		data.setInteger("DEX", stats.getDexerityPoints(player));
		data.setInteger("INT", stats.getIntelligencePoints(player));
		data.setInteger("LUK", stats.getLuckPoints(player));
		data.setInteger("LVL", LevelKeeper.getLevel(player));
		data.setInteger("SP", LevelKeeper.getSP(player));
		data.setString("Race", race.getClass(player));
		data.setCompoundTag("Quests", QuestHandler.instance().getQuestPlayer(player));
		player.getEntityData().setCompoundTag(player.PERSISTED_NBT_TAG, data);
	}
	
	public void getData(EntityPlayer player)
	{
		if(player != null)
		{
			data = player.getEntityData().getCompoundTag(player.PERSISTED_NBT_TAG);
			if(data != null)
			{
				gold.setGold(player, data.getInteger("GoldTotal"));
				experience.setExperience(player, data.getInteger("Worthy"));
				stats.setStrengthPoints(player, data.getInteger("Strength"));
				stats.setDexerityPoints(player, data.getInteger("DEX"));
				stats.setIntelligencePoints(player, data.getInteger("INT"));
				stats.setLuckPoints(player, data.getInteger("LUK"));
				race.setClass(player, data.getString("Race"));
				LevelKeeper.setLevel(player, data.getInteger("LVL"));
				LevelKeeper.setSP(player, data.getInteger("SP"));
				QuestHandler.instance().setQuestPlayer(player, data.getCompoundTag("Quests"));
			}
		}
	}
} public class ConfigFileJoL 
{
	public static boolean GuildSpawning;
	public static int xLocation;
	public static int yLocation;
	public static int zLocation;
	
	public static void config(FMLPreInitializationEvent event)
	{
		Configuration config = new Configuration(event.getSuggestedConfigurationFile());
		
		config.load();
		
		InitBlocks.BlockSellID = config.getBlock("SellBlock", 1750).getInt();
		InitBlocks.BlockKingdomID = config.getBlock("KingdomBlock", 1751).getInt();
		
		InitItems.ItemCoinsID = config.getItem("Coins", 22125).getInt();
		InitItems.ItemExcaliburID = config.getItem("Excalibur", 22126).getInt();
		InitItems.ItemAgBladeID = config.getItem("Aginsuns Blade", 22127).getInt();
		InitItems.ItemExcaliburMaceID = config.getItem("Excalibur Mace", 22128).getInt();
		InitItems.ItemDebugID = config.getItem("Debug Tool ToK2", 22129).getInt();
		InitItems.itemRedClawID = config.getItem("RedClaw", 22130).getInt();
		InitItems.itemShurickenID = config.getItem("Shuricken Star", 22131).getInt();

		config.save();
	}
} public class InitBlocks 
{
	public static Block BlockSell;
	public static Block BlockKingdom;
	public static Block BlockReader;
	
	public static int BlockSellID;
	public static int BlockKingdomID;
	
	public static void Init()
	{
		BlockSell = new BlockSell(BlockSellID).setResistance(100000.0F).setHardness(120000.0F).setBlockUnbreakable();
		GameRegistry.registerBlock(BlockSell, "BlockSell");
	}
} public class InitEntities 
{
	public static void Init()
	{
		GameRegistry.registerTileEntity(TileEntitySell.class, "TeSell");
		
		EntityRegistry.registerGlobalEntityID(EntityGuildMaster.class, "GuildMaster", 215, 255, 255);
		EntityRegistry.registerModEntity(EntityGuildMaster.class, "GuildMaster", 215, JourneyofLegends.instance, 250, 5, false);
		
		EntityRegistry.registerGlobalEntityID(EntityBuilder.class, "Builder", 216, 145, 122);
		EntityRegistry.registerModEntity(EntityBuilder.class, "Builder", 216, JourneyofLegends.instance, 250, 5, false);
		
		EntityRegistry.registerGlobalEntityID(EntityFarmerKeeper.class, "Farmer", 217, 145, 122);
		EntityRegistry.registerModEntity(EntityFarmerKeeper.class, "Farmer", 217, JourneyofLegends.instance, 250, 5, false);
		
		EntityRegistry.registerGlobalEntityID(EntityGuildMember.class, "GuildMember", 218, 145, 122);
		EntityRegistry.registerModEntity(EntityGuildMember.class, "GuildMember", 218, JourneyofLegends.instance, 250, 5, false);
		
		EntityRegistry.registerGlobalEntityID(EntityWeaponKeeper.class, "WeaponKeeper", 219, 145, 122);
		EntityRegistry.registerModEntity(EntityWeaponKeeper.class, "WeaponKeeper", 219, JourneyofLegends.instance, 250, 5, false);
		
		EntityRegistry.registerModEntity(EntityShuricken.class, "ShurickenStar", 220, JourneyofLegends.instance, 250, 1, false);
	}
} public class CommandJoLHandler extends CommandBase
{
	private GoldKeeper gold;
	private StatKeeper stats;
	private World world = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(0);
	
	@Override
    public int getRequiredPermissionLevel()
    {
        return 1;
    }
	
	@Override
	public String getCommandName() 
	{
		return "JourneyofLegends";
	}

	@Override
	public void processCommand(ICommandSender sender, String[] args) 
	{
		if(!(sender instanceof EntityPlayer))
		{
			System.out.println("[Journey of Legends] Command only executeable by players");
			return;
		}
		
		if(args[0].matches("party"))
		{
			if(args[1].matches("create"))
			{
				if(args.length >= 4)
				{
					String partyName = args[2];
					String color = args[3];
					Color partyColor;
					if(color.equals("red"))
						partyColor = Color.RED;
					else if(color.equals("blue"))
						partyColor = Color.BLUE;
					else if(color.equals("green"))
						partyColor = Color.GREEN;
					else
						partyColor = Color.BLACK;
					List<String> usernames = new ArrayList<String>();
					usernames.add(sender.getCommandSenderName());
					PartyHandler.getInstance().makeParty(partyName, usernames, partyColor, sender.getCommandSenderName());
				}
				else{}
					//sender.sendChatToPlayer("Please enter the partyname.");
			}
			else if(args[1].matches("disband"))
			{
				if(PartyHandler.getInstance().isPlayerInParty(sender.getCommandSenderName()))
				{
					if(args.length >= 3)
						PartyHandler.getInstance().disbandParty(args[2]);
					else{}
						//sender.sendChatToPlayer("Please enter the partyname.");
				}
				else{}
					//sender.sendChatToPlayer("You have to be in a party to disband it.");
			}
			else if(args[1].matches("addPlayer"))
			{
				if(args.length >= 4)
					PartyHandler.getInstance().addPlayerToParty(args[3], args[2]);
				else{}
					//sender.sendChatToPlayer("Please enter the partyname and/or username");
			}
			else if(args[1].matches("removePlayer"))
			{
				if(args.length >= 4)
					PartyHandler.getInstance().removePlayerFromParty(args[3], args[2]);
				else{}
					//sender.sendChatToPlayer("Please enter the partyname and/or username");
			}
		}
		else if(args[0].matches("help"))
		{
			//sender.sendChatToPlayer("================================");
			//sender.sendChatToPlayer("Journey of Legends Command help");
			//sender.sendChatToPlayer("================================");
			//sender.sendChatToPlayer("/JourneyofLegends create <partyName> <color>");
			//sender.sendChatToPlayer("/JourneyofLegends disband <partyName>");
			//sender.sendChatToPlayer("/JourneyofLegends addPlayer <partyName> <usernamePlayer>");
			//sender.sendChatToPlayer("/JourneyofLegends removePlayer <partyName> <usernamePlayer>");
		}
	}

	@Override
	public String getCommandUsage(ICommandSender icommandsender) {
		return null;
	}
} public class EntityLivingHandler 
{
	@ForgeSubscribe
	public void onEntityLivingDeath(LivingDeathEvent event) 
	{
		if (event.source.getDamageType().equals("player"))
		{
			ItemDropHelper.dropCoins(event.entityLiving);
		}
	}
} public class GoldValueHandler 
{
	public static HashMap<String, Integer> goldValues = new HashMap<String, Integer>();
	
	public static void setGoldValues()
	{
		goldValues.clear();
		InputStream input = JourneyofLegends.class.getResourceAsStream("/assets/journeyoflegends/textures/utils/GoldValues.txt");
		try
		{
			BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(input));
			String gold = null;
			while((gold = bufferedReader.readLine()) != null)
			{
				gold = gold.trim();
				String[] values = gold.split(":");
				goldValues.put(values[0], Integer.parseInt(values[1]));
				System.out.printf("Set %s with goldvalue %s \n", values[0], values[1]);
			}
		}catch(Exception e){ e.printStackTrace();}
	}
	
	public static int getGoldValue(String s)
	{
		if(goldValues.containsKey(s))
			return goldValues.get(s);
		return 0;
	}
} public class LivingAttackEventHandler 
{
	private int damage;
	public StatKeeper stats;
	public RaceKeeper race;
	@ForgeSubscribe
	public void onEntityLivingAttack(LivingHurtEvent event) //TODO: Balancing!
	{
		if (event.source.getDamageType().equals("player"))
		{
			EntityPlayer player = (EntityPlayer) event.source.getSourceOfDamage();
			if(player.inventory.getCurrentItem() != null)
			{
				if(race.getClass(player).equals("Warrior"))
				{
					if((player.inventory.getCurrentItem().getItem() instanceof ItemSword))
					{
						event.ammount += Math.round(stats.getStrengthPoints(player) / 4);
					}
				}
				if(race.getClass(player).equals("Hunter"))
				{
					if((player.inventory.getCurrentItem().getItem() instanceof ItemBow))
					{
						event.ammount += Math.round(stats.getDexerityPoints(player) / 4);
					}
				}
				if(race.getClass(player).equals("Mage"))
				{
					if((player.inventory.getCurrentItem().getItem() instanceof ItemWand))
					{
						event.ammount += Math.round(stats.getIntelligencePoints(player) / 4);
					}
					else if((player.inventory.getCurrentItem().getItem() instanceof ItemExcaliburMace))
					{
						event.ammount += Math.round(stats.getIntelligencePoints(player) / 4);
					}
				}
				if(race.getClass(player).equals("Thief"))
				{
					if((player.inventory.getCurrentItem().getItem() instanceof ItemClaw))
					{
						event.ammount += Math.round(stats.getLuckPoints(player) / 4);
					}
				}
			}
		}
		
		if (event.source.getSourceOfDamage() instanceof EntityArrow) 
		{
            if (((EntityArrow) event.source.getSourceOfDamage()).shootingEntity != null) 
            {
                if (((EntityArrow) event.source.getSourceOfDamage()).shootingEntity instanceof EntityPlayer) 
                {
        			EntityPlayer player = (EntityPlayer) ((EntityArrow) event.source.getSourceOfDamage()).shootingEntity;
    				if(race.getClass(player).equals("Hunter"))
    				{
    					event.ammount += Math.round(stats.getDexerityPoints(player) / 4);
    				}
                }
            }
        }
		
		if(event.source.getSourceOfDamage() instanceof EntityShuricken)
		{
			if(((EntityShuricken) event.source.getSourceOfDamage()).getThrower() != null)
			{
				if(((EntityShuricken) event.source.getSourceOfDamage()).getThrower() instanceof EntityPlayer)
				{
					EntityPlayer player = (EntityPlayer) ((EntityShuricken) event.source.getSourceOfDamage()).getThrower();
					if(race.getClass(player).equals("Thief"))
						event.ammount += Math.round(StatKeeper.getLuckPoints(player) / 8);
				}
			}
		}
	}
} public class LivingDeathEventHandler
{
	@ForgeSubscribe
	public void onLivingDeath(LivingDeathEvent event)
	{
		if(event.source.getDamageType().equals("player")){
			EntityPlayer player = (EntityPlayer)event.source.getSourceOfDamage();
			if(event.entityLiving instanceof EntityZombie){
				if(QuestHandler.instance().isQuestActive(player, "Hunting"))
				{
					NBTTagCompound nbt = QuestHandler.instance().getQuestPlayer(player);
					int x = nbt.getInteger("QuestHunting");
					x++;
					nbt.setInteger("QuestHunting", x);
					System.out.println("Current Zombies killed for quest Hunting: " + x);
					if(x == 10)
						QuestHandler.instance().setQuestFinished(player, "Hunting");
					QuestHandler.instance().setQuestPlayer(player, nbt);
				}
			}
			
			if(event.entityLiving.getEntityName().equals("Some mo creature name for instance :D"))
			{
				
			}
		}
	}
} public class PacketHandler implements IPacketHandler
{
	@Override
	public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) 
	{
		PacketJoL packetToK = PacketType.buildPacket(packet.data);
		packetToK.execute(manager, player);
	}

} public class PickupHandler implements IPickupNotifier
{
	private Player par1player;
	
	public void checkLevelUps(EntityPlayer player)
	{
		int level = LevelKeeper.getLevel(player);
		int exp = ExperienceKeeper.getExperience(player);
		int levelShouldbe = (Math.round(exp / 850) + 1);
		System.out.println("Level: " + level + " EXP: " + exp + " LevelShoudbe: " + levelShouldbe);
		if(level < levelShouldbe)
		{
			if(QuestHandler.instance().isQuestActive(player, QuestRegistry.getQuest(2).getQuestName()))
				QuestHandler.instance().setQuestFinished(player, QuestRegistry.getQuest(2).getQuestName());
			if(levelShouldbe == 10)
			{
				if(QuestHandler.instance().isQuestActive(player, QuestRegistry.getQuest(5).getQuestName()))
					QuestHandler.instance().setQuestFinished(player, QuestRegistry.getQuest(5).getQuestName());
			}
			LevelKeeper.addLevel(player);
			if(level != 0)
				LevelKeeper.addSP(player, 4);
			PacketDispatcher.sendPacketToPlayer(PacketType.populatePacket(new PacketLevel(player.username, LevelKeeper.getLevel(player), LevelKeeper.getSP(player))), (Player)player);
		}
	}

	@Override
	public void notifyPickup(EntityItem item, EntityPlayer player) 
	{
		ItemStack itemstack = item.getEntityItem();
		if(itemstack.itemID == InitItems.ItemCoins.itemID)
		{
			player.inventory.consumeInventoryItem(itemstack.itemID);
			if(PartyHandler.getInstance().isPlayerInParty(player.username))
			{
				Party party = PartyHandler.getInstance().getParty(player.username);
				List<String> list = party.playerList;
				for(String string : list)
				{
					GoldKeeper.addGold(string, Math.round(15 / list.size()));
		            PacketDispatcher.sendPacketToPlayer(PacketType.populatePacket(new PacketGold(string, GoldKeeper.getGoldTotal(string))), (Player)player);
		            PacketDispatcher.sendPacketToPlayer(PacketType.populatePacket(new PacketExperience(string, ExperienceKeeper.getExperience(string))), (Player)player);
		    		checkLevelUps(player);
		    		return;
				}
			}
			else
			{
				GoldKeeper.addGold(player);
				this.par1player = (Player)player;
	            ExperienceKeeper.addExperience(player);
	            PacketDispatcher.sendPacketToPlayer(PacketType.populatePacket(new PacketGold(player.username, GoldKeeper.getGoldTotal(player))), (Player)player);
	            PacketDispatcher.sendPacketToPlayer(PacketType.populatePacket(new PacketExperience(player.username, ExperienceKeeper.getExperience(player))), (Player)player);
	    		checkLevelUps(player);
			}
    	}
	}
} public class QuestRegistry 
{
	private static HashMap<Integer, Quest> QuestMap = new HashMap<Integer, Quest>();
	
	public static void InitQuests()
	{
		registerQuest(new QuestGuildMaster(1, 0));
		registerQuest(new QuestGuildMaster(2, 1));
		registerQuest(new QuestGuildMaster(3, 2));
		registerQuest(new QuestAdventureStart(4, 0));
		registerQuest(new QuestGuildMaster(5, 3));
		//registerQuest(new QuestFarmer(4, 0));
		//registerQuest(new QuestFarmer(5, 1));
		//registerQuest(new QuestFarmer(6, 2));
	}
	
	public static void registerQuest(Quest quest)
	{
		QuestMap.put(quest.getQuestNumber(), quest);
	}
	
	public static Quest getQuest(int QuestNumber)
	{
		return QuestMap.get(QuestNumber);
	}
	
	public static HashMap<Integer, Quest> getMap()
	{
		return QuestMap;
	}
} public class InitItems 
{
	public static String ModID = Utils.modID;
	
	public static Item ItemCoins;
	public static int ItemCoinsID;
	
	public static Item ItemExcalibur;
	public static int ItemExcaliburID;
	
	public static Item ItemAgBlade;
	public static int ItemAgBladeID;
	
	public static Item ItemExcaliburMace;
	public static int ItemExcaliburMaceID;
	
	public static Item ItemDebug;
	public static int ItemDebugID;
	
	public static Item itemShuricken;
	public static int itemShurickenID;
	
	public static Item itemRedClaw;
	public static int itemRedClawID;
	
	public static void Init()
	{
		ItemCoins = new ItemCoins(ItemCoinsID).setUnlocalizedName("Coins").func_111206_d(ModID + ":coins");
		ItemExcalibur = new ItemExcaliburSword(ItemExcaliburID).setUnlocalizedName("Excalibur").func_111206_d(ModID+":"+"Sword15");
		ItemAgBlade = new ItemAgBlade(ItemAgBladeID).setUnlocalizedName("AgBlade").func_111206_d(ModID+":"+"AginsunsBlade");
		ItemExcaliburMace = new ItemExcaliburMace(ItemExcaliburMaceID).setUnlocalizedName("ExMace").func_111206_d(ModID+":"+"ExcaliburMace");
		ItemDebug = new ItemDebug(ItemDebugID).setUnlocalizedName("Debug").func_111206_d(ModID+":"+"DebugToK");
		itemRedClaw = new ItemRedClaw(itemRedClawID).setUnlocalizedName("RedClaw").func_111206_d(ModID+":redClaw");
		itemShuricken = new ItemShuricken(itemShurickenID).setUnlocalizedName("shurickenStar").func_111206_d(ModID+":shurickenStar");
		languageRegisterers();
	}
	
	public static void languageRegisterers()
	{
		LanguageRegistry.addName(ItemCoins, "Coins");
		LanguageRegistry.addName(ItemExcalibur, "Excalibur");
		LanguageRegistry.addName(ItemAgBlade, "Aginsuns Blade");
		LanguageRegistry.addName(ItemExcaliburMace, "Excalibur Mace");
		LanguageRegistry.addName(ItemDebug, "Debug Tool ToK2");
		LanguageRegistry.addName(itemRedClaw, "Red Claw");
		LanguageRegistry.addName(itemShuricken, "Shuricken Star");
	}
} public final class Utils 
{
	public static final String modID = "journeyoflegends";
	public static final String Version = "0.0.2A";
	public static final String Name = "Journey of Legends: The Start";
}	 public class WorldgenChests
{
	public static void Init()
	{
		WeightedRandomChestContent x = new WeightedRandomChestContent(new ItemStack(InitItems.ItemExcalibur), 50, 95, 4);
		ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).addItem(x);
	}
}
import net.minecraft.command.CommandHandler;
import net.minecraftforge.common.MinecraftForge;
import aginsun.journey.server.CommonProxy;
import aginsun.journey.server.handlers.CommonTickHandler;
import aginsun.journey.server.handlers.SaveHandler;
import aginsun.journey.universal.ConfigFileJoL;
import aginsun.journey.universal.blocks.InitBlocks;
import aginsun.journey.universal.entities.InitEntities;
import aginsun.journey.universal.handlers.CommandJoLHandler;
import aginsun.journey.universal.handlers.EntityLivingHandler;
import aginsun.journey.universal.handlers.GoldValueHandler;
import aginsun.journey.universal.handlers.LivingAttackEventHandler;
import aginsun.journey.universal.handlers.LivingDeathEventHandler;
import aginsun.journey.universal.handlers.PacketHandler;
import aginsun.journey.universal.handlers.PickupHandler;
import aginsun.journey.universal.handlers.QuestRegistry;
import aginsun.journey.universal.items.InitItems;
import aginsun.journey.universal.utils.Utils;
import aginsun.journey.universal.worldgen.WorldgenChests;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
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.FMLServerStartedEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
package aginsun.journey;


@Mod(modid = Utils.modID, version = Utils.Version, name = Utils.Name)
@NetworkMod(channels = { Utils.modID },clientSideRequired = true, serverSideRequired = true, packetHandler = PacketHandler.class)
public class JourneyofLegends 
{
	@Instance (Utils.modID)
	public static JourneyofLegends instance = new JourneyofLegends();
	
	@SidedProxy(clientSide="aginsun.journey.client.core.ClientProxy",serverSide="aginsun.journey.core.CommonProxy")
	public static CommonProxy proxy;
		
	@EventHandler
	public void PreInit(FMLPreInitializationEvent event)
	{
		ConfigFileJoL.config(event);
	}
	
	@EventHandler
	public void load(FMLInitializationEvent event)
	{			
		InitEntities.Init();
		
		InitBlocks.Init();
		
		InitItems.Init();
		
        NetworkRegistry.instance().registerGuiHandler(instance, proxy);
        
		TickRegistry.registerTickHandler(new CommonTickHandler(), Side.SERVER);
		
		MinecraftForge.EVENT_BUS.register(new EntityLivingHandler());
		
		MinecraftForge.EVENT_BUS.register(new LivingAttackEventHandler());
		
		MinecraftForge.EVENT_BUS.register(new LivingDeathEventHandler());
		
		proxy.RegisterRenderers();
		
		WorldgenChests.Init();
	}
	
	@EventHandler
	public void PostInit(FMLPostInitializationEvent event)
	{
		proxy.registerPostInit();
		
		GoldValueHandler.setGoldValues();
				
		QuestRegistry.InitQuests();
	}
	
	@EventHandler
	public void serverStarting(FMLServerStartingEvent event)
	{		
		CommandHandler commandManager = (CommandHandler)event.getServer().getCommandManager();
		commandManager.registerCommand(new CommandJoLHandler());
	}
	
	@EventHandler
	public void serverStarted(FMLServerStartedEvent event)
	{
		GameRegistry.registerPlayerTracker(new SaveHandler());
		GameRegistry.registerPickupHandler(new PickupHandler());