2012-12-19 19:09:56 +01:00
|
|
|
package com.pahimar.ee3.network.packet;
|
|
|
|
|
|
|
|
import java.io.DataInputStream;
|
|
|
|
import java.io.DataOutputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.network.INetworkManager;
|
|
|
|
|
2012-12-31 09:14:44 +01:00
|
|
|
import com.pahimar.ee3.configuration.ConfigurationSettings;
|
2012-12-19 19:09:56 +01:00
|
|
|
import com.pahimar.ee3.network.PacketTypeHandler;
|
|
|
|
|
|
|
|
import cpw.mods.fml.common.network.Player;
|
|
|
|
|
|
|
|
public class PacketSpawnParticle extends PacketEE {
|
|
|
|
|
|
|
|
public String particleName;
|
2012-12-19 19:47:45 +01:00
|
|
|
public double x, y, z;
|
2012-12-19 19:09:56 +01:00
|
|
|
public double velocityX, velocityY, velocityZ;
|
|
|
|
|
|
|
|
public PacketSpawnParticle() {
|
|
|
|
|
|
|
|
super(PacketTypeHandler.SPAWN_PARTICLE, false);
|
|
|
|
}
|
|
|
|
|
2012-12-19 19:47:45 +01:00
|
|
|
public PacketSpawnParticle(String particleName, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
|
2012-12-19 19:09:56 +01:00
|
|
|
|
|
|
|
super(PacketTypeHandler.SPAWN_PARTICLE, false);
|
|
|
|
this.particleName = particleName;
|
|
|
|
this.x = x;
|
|
|
|
this.y = y;
|
|
|
|
this.z = z;
|
|
|
|
this.velocityX = velocityX;
|
|
|
|
this.velocityY = velocityY;
|
|
|
|
this.velocityZ = velocityZ;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void writeData(DataOutputStream data) throws IOException {
|
|
|
|
|
|
|
|
data.writeUTF(particleName);
|
2012-12-19 19:47:45 +01:00
|
|
|
data.writeDouble(x);
|
|
|
|
data.writeDouble(y);
|
|
|
|
data.writeDouble(z);
|
2012-12-19 19:09:56 +01:00
|
|
|
data.writeDouble(velocityX);
|
|
|
|
data.writeDouble(velocityY);
|
|
|
|
data.writeDouble(velocityZ);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void readData(DataInputStream data) throws IOException {
|
|
|
|
|
|
|
|
this.particleName = data.readUTF();
|
2012-12-19 19:47:45 +01:00
|
|
|
this.x = data.readDouble();
|
|
|
|
this.y = data.readDouble();
|
|
|
|
this.z = data.readDouble();
|
2012-12-19 19:09:56 +01:00
|
|
|
this.velocityX = data.readDouble();
|
|
|
|
this.velocityY = data.readDouble();
|
|
|
|
this.velocityZ = data.readDouble();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void execute(INetworkManager manager, Player player) {
|
|
|
|
|
|
|
|
EntityPlayer thePlayer = (EntityPlayer) player;
|
|
|
|
|
2012-12-31 09:14:44 +01:00
|
|
|
if (ConfigurationSettings.ENABLE_PARTICLE_FX) {
|
|
|
|
thePlayer.worldObj.spawnParticle(particleName, x, y, z, velocityX, velocityY, velocityZ);
|
|
|
|
}
|
2012-12-19 19:09:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|