// Path: src/main/java/eureka/Eureka.java
// @Mod(modid = "eureka", name = "Eureka", version = "@MODVERSION@", acceptedMinecraftVersions = "1.7.10")
// public class Eureka {
// 
// 	@Mod.Instance("eureka")
// 	public static Eureka instance;
// 
// 	@SidedProxy(clientSide = "eureka.proxy.ClientProxy", serverSide = "eureka.proxy.ServerProxy")
// 	public static IProxy proxy;
// 	public static ItemEngineeringDiary engineeringDiary;
// 	public static CreativeTabs eureka = new CreativeTabs("Eureka") {
// 
// 		@Override
// 		public Item getTabIconItem() {
// 			return engineeringDiary;
// 		}
// 
// 	};
// 
// 	public static boolean giveBook;
// 
// 	@Mod.EventHandler
// 	public void preInit(FMLPreInitializationEvent event) {
// 		EurekaAPI.API = new EurekaAPIImplementation();
// 		engineeringDiary = new ItemEngineeringDiary();
// 		GameRegistry.registerItem(engineeringDiary, "engineeringDiary");
// 		GameRegistry.addShapelessRecipe(new ItemStack(engineeringDiary), new Object[]{Items.book, Items.iron_ingot});
// 		MinecraftForge.EVENT_BUS.register(new EventHandler());
// 		FMLCommonHandler.instance().bus().register(new EventHandler());
// 		NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// 		EurekaAPI.API.registerCategory(new BasicEurekaCategory("Eureka", new ItemStack(engineeringDiary)));
// 		PacketHandler.init();
// 		ConfigReader.mainfolder = new File(event.getModConfigurationDirectory(), "Eureka");
// 		ConfigReader.read();
// 		Configuration config = new Configuration(event.getSuggestedConfigurationFile());
// 		giveBook = config.get("General", "giveBook", true).setDefaultValue(true).getBoolean();
// 		config.save();
// 	}
// 
// 	@Mod.EventHandler
// 	public void serverStart(FMLServerStartingEvent event) {
// 		event.registerServerCommand(new EurekaCommand());
// 	}
// 
// }
// 
// Path: src/main/java/eureka/networking/MessageResearch.java
// public class MessageResearch implements IMessage, IMessageHandler<MessageResearch, IMessage> {
// 	public PlayerResearch research;
// 	public HashMap<String, Integer> progress = new HashMap<String, Integer>();
// 	public HashMap<String, Boolean> finished = new HashMap<String, Boolean>();
// 
// 	public MessageResearch() {
// 
// 	}
// 
// 	public MessageResearch(EntityPlayer player) {
// 		research = PlayerResearch.get(player);
// 	}
// 
// 	@Override
// 	public void fromBytes(ByteBuf buf) {
// 		for (IEurekaInfo info : EurekaAPI.API.getAllKeys()) {
// 			progress.put(info.getName(), buf.readInt());
// 			finished.put(info.getName(), buf.readBoolean());
// 		}
// 	}
// 
// 	@Override
// 	public void toBytes(ByteBuf buf) {
// 		for (IEurekaInfo info : EurekaAPI.API.getAllKeys()) {
// 			buf.writeInt(research.getProgress(info.getName()));
// 			buf.writeBoolean(research.isFinished(info.getName()));
// 		}
// 	}
// 
// 	@Override
// 	public IMessage onMessage(MessageResearch message, MessageContext ctx) {
// 		research = PlayerResearch.get(Eureka.proxy.getPlayer());
// 		for (IEurekaInfo info : EurekaAPI.API.getAllKeys()) {
// 			research.overrideProgress(info.getName(), message.progress.get(info.getName()));
// 			research.overrideFinished(info.getName(), message.finished.get(info.getName()));
// 		}
// 		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 net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBook;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import eureka.Eureka;
import eureka.networking.MessageResearch;
import eureka.networking.PacketHandler;
package eureka.items;



/**
 * Copyright (c) 2014-2015, AEnterprise
 * http://buildcraftadditions.wordpress.com/
 * Eureka is distributed under the terms of GNU GPL v3.0
 * Please check the contents of the license located in
 * http://buildcraftadditions.wordpress.com/wiki/licensing-stuff/
 */
public class ItemEngineeringDiary extends ItemBook {

	public ItemEngineeringDiary() {
		setCreativeTab(Eureka.eureka);
		setTextureName("eureka:engineeringDiary");
		setUnlocalizedName("engineeringDiary");
	}

	@Override
	public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
		if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER)
// Path: src/main/java/eureka/Eureka.java
// @Mod(modid = "eureka", name = "Eureka", version = "@MODVERSION@", acceptedMinecraftVersions = "1.7.10")
// public class Eureka {
// 
// 	@Mod.Instance("eureka")
// 	public static Eureka instance;
// 
// 	@SidedProxy(clientSide = "eureka.proxy.ClientProxy", serverSide = "eureka.proxy.ServerProxy")
// 	public static IProxy proxy;
// 	public static ItemEngineeringDiary engineeringDiary;
// 	public static CreativeTabs eureka = new CreativeTabs("Eureka") {
// 
// 		@Override
// 		public Item getTabIconItem() {
// 			return engineeringDiary;
// 		}
// 
// 	};
// 
// 	public static boolean giveBook;
// 
// 	@Mod.EventHandler
// 	public void preInit(FMLPreInitializationEvent event) {
// 		EurekaAPI.API = new EurekaAPIImplementation();
// 		engineeringDiary = new ItemEngineeringDiary();
// 		GameRegistry.registerItem(engineeringDiary, "engineeringDiary");
// 		GameRegistry.addShapelessRecipe(new ItemStack(engineeringDiary), new Object[]{Items.book, Items.iron_ingot});
// 		MinecraftForge.EVENT_BUS.register(new EventHandler());
// 		FMLCommonHandler.instance().bus().register(new EventHandler());
// 		NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// 		EurekaAPI.API.registerCategory(new BasicEurekaCategory("Eureka", new ItemStack(engineeringDiary)));
// 		PacketHandler.init();
// 		ConfigReader.mainfolder = new File(event.getModConfigurationDirectory(), "Eureka");
// 		ConfigReader.read();
// 		Configuration config = new Configuration(event.getSuggestedConfigurationFile());
// 		giveBook = config.get("General", "giveBook", true).setDefaultValue(true).getBoolean();
// 		config.save();
// 	}
// 
// 	@Mod.EventHandler
// 	public void serverStart(FMLServerStartingEvent event) {
// 		event.registerServerCommand(new EurekaCommand());
// 	}
// 
// }
// 
// Path: src/main/java/eureka/networking/MessageResearch.java
// public class MessageResearch implements IMessage, IMessageHandler<MessageResearch, IMessage> {
// 	public PlayerResearch research;
// 	public HashMap<String, Integer> progress = new HashMap<String, Integer>();
// 	public HashMap<String, Boolean> finished = new HashMap<String, Boolean>();
// 
// 	public MessageResearch() {
// 
// 	}
// 
// 	public MessageResearch(EntityPlayer player) {
// 		research = PlayerResearch.get(player);
// 	}
// 
// 	@Override
// 	public void fromBytes(ByteBuf buf) {
// 		for (IEurekaInfo info : EurekaAPI.API.getAllKeys()) {
// 			progress.put(info.getName(), buf.readInt());
// 			finished.put(info.getName(), buf.readBoolean());
// 		}
// 	}
// 
// 	@Override
// 	public void toBytes(ByteBuf buf) {
// 		for (IEurekaInfo info : EurekaAPI.API.getAllKeys()) {
// 			buf.writeInt(research.getProgress(info.getName()));
// 			buf.writeBoolean(research.isFinished(info.getName()));
// 		}
// 	}
// 
// 	@Override
// 	public IMessage onMessage(MessageResearch message, MessageContext ctx) {
// 		research = PlayerResearch.get(Eureka.proxy.getPlayer());
// 		for (IEurekaInfo info : EurekaAPI.API.getAllKeys()) {
// 			research.overrideProgress(info.getName(), message.progress.get(info.getName()));
// 			research.overrideFinished(info.getName(), message.finished.get(info.getName()));
// 		}
// 		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/items/ItemEngineeringDiary.java
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBook;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import eureka.Eureka;
import eureka.networking.MessageResearch;
import eureka.networking.PacketHandler;

package eureka.items;



/**
 * Copyright (c) 2014-2015, AEnterprise
 * http://buildcraftadditions.wordpress.com/
 * Eureka is distributed under the terms of GNU GPL v3.0
 * Please check the contents of the license located in
 * http://buildcraftadditions.wordpress.com/wiki/licensing-stuff/
 */
public class ItemEngineeringDiary extends ItemBook {

	public ItemEngineeringDiary() {
		setCreativeTab(Eureka.eureka);
		setTextureName("eureka:engineeringDiary");
		setUnlocalizedName("engineeringDiary");
	}

	@Override
	public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
		if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER)
			PacketHandler.instance.sendToAllAround(new MessageResearch(player), new NetworkRegistry.TargetPoint(player.dimension, player.posX, player.posY, player.posZ, 1));