// Path: src/main/java/eureka/api/EurekaAPI.java
// public class EurekaAPI {
// 
// 	public static IEurekAPI API;
// }
// 
// Path: src/main/java/eureka/api/IEurekaInfo.java
// public interface IEurekaInfo {
// 
// 	String getCategory();
// 
// 	int getMaxProgress();
// 
// 	ItemStack getDisplayStack();
// 
// 	String getName();
// 
// 	List<String> getRequiredResearch();
// }
// 
// Path: src/main/java/eureka/networking/MessageResearchFinished.java
// public class MessageResearchFinished implements IMessage, IMessageHandler<MessageResearchFinished, IMessage> {
// 	public String key;
// 
// 	public MessageResearchFinished() {
// 	}
// 
// 	public MessageResearchFinished(String key) {
// 		this.key = key;
// 	}
// 
// 	@Override
// 	public void fromBytes(ByteBuf buf) {
// 		int num = buf.readInt();
// 		key = "";
// 		for (int t = 0; t < num; t++)
// 			key += buf.readChar();
// 		key = key.trim();
// 	}
// 
// 	@Override
// 	public void toBytes(ByteBuf buf) {
// 		buf.writeInt(key.length());
// 		for (char c : key.toCharArray())
// 			buf.writeChar(c);
// 	}
// 
// 	@Override
// 	public IMessage onMessage(MessageResearchFinished message, MessageContext ctx) {
// 		FMLClientHandler.instance().getClient().thePlayer.addChatComponentMessage(new ChatComponentTranslation("EUREKA"));
// 		FMLClientHandler.instance().getClient().thePlayer.addChatComponentMessage(new ChatComponentText("Research finished: " + TextGetter.getTitle(message.key)));
// 		return null;
// 	}
// }
// 
// Path: src/main/java/eureka/networking/PacketHandler.java
// public class PacketHandler {
// 
// 	public static final SimpleNetworkWrapper instance = NetworkRegistry.INSTANCE.newSimpleChannel("eureka");
// 
// 	public static void init() {
// 		instance.registerMessage(MessageResearch.class, MessageResearch.class, 0, Side.CLIENT);
// 		instance.registerMessage(MessageResearchFinished.class, MessageResearchFinished.class, 1, Side.CLIENT);
// 		instance.registerMessage(MessageBookSave.class, MessageBookSave.class, 2, Side.SERVER);
// 	}
// }


import java.util.HashMap;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties;
import eureka.api.EurekaAPI;
import eureka.api.IEurekaInfo;
import eureka.networking.MessageResearchFinished;
import eureka.networking.PacketHandler;
		this.player = player;
	}

	public static void register(EntityPlayer player) {
		player.registerExtendedProperties(EXT_PROP_NAME, new PlayerResearch(player));
	}

	public static PlayerResearch get(EntityPlayer player) {
		if (player == null)
			return null;
		return (PlayerResearch) player.getExtendedProperties(EXT_PROP_NAME);
	}

	@Override
	public void saveNBTData(NBTTagCompound compound) {
		NBTTagCompound tag = new NBTTagCompound();
		for (IEurekaInfo research : EurekaAPI.API.getAllKeys()) {
			if (!progressList.containsKey(research.getName()))
				progressList.put(research.getName(), 0);
			tag.setInteger(research.getName() + "Progress", progressList.get(research.getName()));
			if (finished.containsKey(research.getName()))
				tag.setBoolean(research.getName() + "Finished", finished.get(research.getName()));
		}
		compound.setTag(EXT_PROP_NAME, tag);
	}

	@Override
	public void loadNBTData(NBTTagCompound compound) {
		NBTTagCompound tag = compound.getCompoundTag(EXT_PROP_NAME);
		loadOldResearch(compound);
// Path: src/main/java/eureka/api/EurekaAPI.java
// public class EurekaAPI {
// 
// 	public static IEurekAPI API;
// }
// 
// Path: src/main/java/eureka/api/IEurekaInfo.java
// public interface IEurekaInfo {
// 
// 	String getCategory();
// 
// 	int getMaxProgress();
// 
// 	ItemStack getDisplayStack();
// 
// 	String getName();
// 
// 	List<String> getRequiredResearch();
// }
// 
// Path: src/main/java/eureka/networking/MessageResearchFinished.java
// public class MessageResearchFinished implements IMessage, IMessageHandler<MessageResearchFinished, IMessage> {
// 	public String key;
// 
// 	public MessageResearchFinished() {
// 	}
// 
// 	public MessageResearchFinished(String key) {
// 		this.key = key;
// 	}
// 
// 	@Override
// 	public void fromBytes(ByteBuf buf) {
// 		int num = buf.readInt();
// 		key = "";
// 		for (int t = 0; t < num; t++)
// 			key += buf.readChar();
// 		key = key.trim();
// 	}
// 
// 	@Override
// 	public void toBytes(ByteBuf buf) {
// 		buf.writeInt(key.length());
// 		for (char c : key.toCharArray())
// 			buf.writeChar(c);
// 	}
// 
// 	@Override
// 	public IMessage onMessage(MessageResearchFinished message, MessageContext ctx) {
// 		FMLClientHandler.instance().getClient().thePlayer.addChatComponentMessage(new ChatComponentTranslation("EUREKA"));
// 		FMLClientHandler.instance().getClient().thePlayer.addChatComponentMessage(new ChatComponentText("Research finished: " + TextGetter.getTitle(message.key)));
// 		return null;
// 	}
// }
// 
// Path: src/main/java/eureka/networking/PacketHandler.java
// public class PacketHandler {
// 
// 	public static final SimpleNetworkWrapper instance = NetworkRegistry.INSTANCE.newSimpleChannel("eureka");
// 
// 	public static void init() {
// 		instance.registerMessage(MessageResearch.class, MessageResearch.class, 0, Side.CLIENT);
// 		instance.registerMessage(MessageResearchFinished.class, MessageResearchFinished.class, 1, Side.CLIENT);
// 		instance.registerMessage(MessageBookSave.class, MessageBookSave.class, 2, Side.SERVER);
// 	}
// }


// Path: src/main/java/eureka/core/PlayerResearch.java
import java.util.HashMap;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties;
import eureka.api.EurekaAPI;
import eureka.api.IEurekaInfo;
import eureka.networking.MessageResearchFinished;
import eureka.networking.PacketHandler;

		this.player = player;
	}

	public static void register(EntityPlayer player) {
		player.registerExtendedProperties(EXT_PROP_NAME, new PlayerResearch(player));
	}

	public static PlayerResearch get(EntityPlayer player) {
		if (player == null)
			return null;
		return (PlayerResearch) player.getExtendedProperties(EXT_PROP_NAME);
	}

	@Override
	public void saveNBTData(NBTTagCompound compound) {
		NBTTagCompound tag = new NBTTagCompound();
		for (IEurekaInfo research : EurekaAPI.API.getAllKeys()) {
			if (!progressList.containsKey(research.getName()))
				progressList.put(research.getName(), 0);
			tag.setInteger(research.getName() + "Progress", progressList.get(research.getName()));
			if (finished.containsKey(research.getName()))
				tag.setBoolean(research.getName() + "Finished", finished.get(research.getName()));
		}
		compound.setTag(EXT_PROP_NAME, tag);
	}

	@Override
	public void loadNBTData(NBTTagCompound compound) {
		NBTTagCompound tag = compound.getCompoundTag(EXT_PROP_NAME);
		loadOldResearch(compound);
		for (IEurekaInfo research : EurekaAPI.API.getAllKeys()) {