// Path: src/main/java/com/panicnot42/warpbook/WarpSounds.java
// @ObjectHolder("warpbook")
// @Mod.EventBusSubscriber(modid = "warpbook")
// public class WarpSounds
// {
//   @ObjectHolder("depart")
//   public static final SoundEvent departSound = null;
//   
//   @ObjectHolder("arrive")
//   public static final SoundEvent arriveSound = null;
// 
//   @SubscribeEvent
//   public static void registerSounds(RegistryEvent.Register<SoundEvent> event)
//   {
//     ResourceLocation departLocation = new ResourceLocation("warpbook", "depart");
//     ResourceLocation arriveLocation = new ResourceLocation("warpbook", "arrive");
//     
//     event.getRegistry().registerAll(
//         new SoundEvent(departLocation).setRegistryName(departLocation),
//         new SoundEvent(arriveLocation).setRegistryName(arriveLocation)
//         );
//   }
// }
// 
// Path: src/main/java/com/panicnot42/warpbook/util/net/NetUtils.java
// public class NetUtils {
// 	public static EntityPlayer getPlayerFromContext(MessageContext ctx) {
// 		if (ctx.side == Side.SERVER) {
// 			return ctx.getServerHandler().player;
// 		}
// 		else {
// 			return getClientPlayer();
// 		}
// 	}
// 	
// 	@SideOnly(Side.CLIENT)
// 	private static EntityPlayer getClientPlayer() {
// 		return Minecraft.getMinecraft().player;
// 	}
// }


import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import com.panicnot42.warpbook.WarpSounds;
import com.panicnot42.warpbook.util.net.NetUtils;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.EnumParticleTypes;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
package com.panicnot42.warpbook.net.packet;




public class PacketEffect implements IMessage, IMessageHandler<PacketEffect, IMessage> {
	boolean enter;
	int x, y, z;
	
	public PacketEffect() {
	}
	
	public PacketEffect(boolean enter, int x, int y, int z) {
		this.enter = enter;
		this.x = x;
		this.y = y;
		this.z = z;
	}
	
	@Override
	public IMessage onMessage(PacketEffect message, MessageContext ctx) {
		EntityPlayer player = NetUtils.getPlayerFromContext(ctx);
		int particles = (2 - Minecraft.getMinecraft().gameSettings.particleSetting) * 50;
		if (message.enter) {
			for (int i = 0; i < (5 * particles); ++i) {
				player.world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, message.x, message.y + (player.world.rand.nextDouble() * 2), message.z, (player.world.rand.nextDouble() / 10) - 0.05D, 0D,
						(player.world.rand.nextDouble() / 10) - 0.05D);
			}
// Path: src/main/java/com/panicnot42/warpbook/WarpSounds.java
// @ObjectHolder("warpbook")
// @Mod.EventBusSubscriber(modid = "warpbook")
// public class WarpSounds
// {
//   @ObjectHolder("depart")
//   public static final SoundEvent departSound = null;
//   
//   @ObjectHolder("arrive")
//   public static final SoundEvent arriveSound = null;
// 
//   @SubscribeEvent
//   public static void registerSounds(RegistryEvent.Register<SoundEvent> event)
//   {
//     ResourceLocation departLocation = new ResourceLocation("warpbook", "depart");
//     ResourceLocation arriveLocation = new ResourceLocation("warpbook", "arrive");
//     
//     event.getRegistry().registerAll(
//         new SoundEvent(departLocation).setRegistryName(departLocation),
//         new SoundEvent(arriveLocation).setRegistryName(arriveLocation)
//         );
//   }
// }
// 
// Path: src/main/java/com/panicnot42/warpbook/util/net/NetUtils.java
// public class NetUtils {
// 	public static EntityPlayer getPlayerFromContext(MessageContext ctx) {
// 		if (ctx.side == Side.SERVER) {
// 			return ctx.getServerHandler().player;
// 		}
// 		else {
// 			return getClientPlayer();
// 		}
// 	}
// 	
// 	@SideOnly(Side.CLIENT)
// 	private static EntityPlayer getClientPlayer() {
// 		return Minecraft.getMinecraft().player;
// 	}
// }


// Path: src/main/java/com/panicnot42/warpbook/net/packet/PacketEffect.java
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import com.panicnot42.warpbook.WarpSounds;
import com.panicnot42.warpbook.util.net.NetUtils;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.EnumParticleTypes;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;

package com.panicnot42.warpbook.net.packet;




public class PacketEffect implements IMessage, IMessageHandler<PacketEffect, IMessage> {
	boolean enter;
	int x, y, z;
	
	public PacketEffect() {
	}
	
	public PacketEffect(boolean enter, int x, int y, int z) {
		this.enter = enter;
		this.x = x;
		this.y = y;
		this.z = z;
	}
	
	@Override
	public IMessage onMessage(PacketEffect message, MessageContext ctx) {
		EntityPlayer player = NetUtils.getPlayerFromContext(ctx);
		int particles = (2 - Minecraft.getMinecraft().gameSettings.particleSetting) * 50;
		if (message.enter) {
			for (int i = 0; i < (5 * particles); ++i) {
				player.world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, message.x, message.y + (player.world.rand.nextDouble() * 2), message.z, (player.world.rand.nextDouble() / 10) - 0.05D, 0D,
						(player.world.rand.nextDouble() / 10) - 0.05D);
			}
			player.world.playSound(player, player.posX, player.posY, player.posZ, WarpSounds.arriveSound, SoundCategory.PLAYERS, 1.0f, 1.0f);