diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/StandardPackets.java b/src/main/java/ch/spacebase/mcprotocol/standard/StandardPackets.java index 3794c0d1..e054da39 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/StandardPackets.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/StandardPackets.java @@ -69,6 +69,7 @@ import ch.spacebase.mcprotocol.standard.packet.PacketSpawnMob; import ch.spacebase.mcprotocol.standard.packet.PacketSpawnNamedEntity; import ch.spacebase.mcprotocol.standard.packet.PacketSpawnObject; import ch.spacebase.mcprotocol.standard.packet.PacketSpawnPainting; +import ch.spacebase.mcprotocol.standard.packet.PacketSpawnParticle; import ch.spacebase.mcprotocol.standard.packet.PacketSpawnPosition; import ch.spacebase.mcprotocol.standard.packet.PacketSteerVehicle; import ch.spacebase.mcprotocol.standard.packet.PacketTabComplete; @@ -140,6 +141,7 @@ public class StandardPackets extends PacketRegistry { this.registerPacket(60, PacketExplosion.class); this.registerPacket(61, PacketEffect.class); this.registerPacket(62, PacketNamedSound.class); + this.registerPacket(63, PacketSpawnParticle.class); this.registerPacket(70, PacketGameState.class); this.registerPacket(71, PacketLightning.class); this.registerPacket(100, PacketOpenWindow.class); @@ -171,4 +173,5 @@ public class StandardPackets extends PacketRegistry { this.registerPacket(254, PacketServerPing.class); this.registerPacket(255, PacketDisconnect.class); } + } diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEffect.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEffect.java index c17b3865..71bc287f 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEffect.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketEffect.java @@ -12,7 +12,7 @@ public class PacketEffect extends Packet { public int effectId; public int x; - public byte y; + public int y; public int z; public int data; public boolean ignoreVolume; @@ -20,7 +20,7 @@ public class PacketEffect extends Packet { public PacketEffect() { } - public PacketEffect(int effectId, int x, byte y, int z, int data, boolean ignoreVolume) { + public PacketEffect(int effectId, int x, int y, int z, int data, boolean ignoreVolume) { this.effectId = effectId; this.x = x; this.y = y; @@ -33,7 +33,7 @@ public class PacketEffect extends Packet { public void read(NetInput in) throws IOException { this.effectId = in.readInt(); this.x = in.readInt(); - this.y = in.readByte(); + this.y = in.readUnsignedByte(); this.z = in.readInt(); this.data = in.readInt(); this.ignoreVolume = in.readBoolean(); diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketNamedSound.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketNamedSound.java index 0018a751..6fdc4147 100644 --- a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketNamedSound.java +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketNamedSound.java @@ -20,7 +20,7 @@ public class PacketNamedSound extends Packet { public PacketNamedSound() { } - public PacketNamedSound(String sound, int x, byte y, int z, float volume, int pitch) { + public PacketNamedSound(String sound, int x, int y, int z, float volume, int pitch) { this.sound = sound; this.x = x; this.y = y; diff --git a/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnParticle.java b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnParticle.java new file mode 100644 index 00000000..61b15a9f --- /dev/null +++ b/src/main/java/ch/spacebase/mcprotocol/standard/packet/PacketSpawnParticle.java @@ -0,0 +1,74 @@ +package ch.spacebase.mcprotocol.standard.packet; + +import ch.spacebase.mcprotocol.net.io.NetInput; +import ch.spacebase.mcprotocol.net.io.NetOutput; +import java.io.IOException; + +import ch.spacebase.mcprotocol.net.Client; +import ch.spacebase.mcprotocol.net.ServerConnection; +import ch.spacebase.mcprotocol.packet.Packet; + +public class PacketSpawnParticle extends Packet { + + public String particle; + public float x; + public float y; + public float z; + public float offsetX; + public float offsetY; + public float offsetZ; + public float speed; + public int count; + + public PacketSpawnParticle() { + } + + public PacketSpawnParticle(String particle, float x, float y, float z, float offsetX, float offsetY, float offsetZ, float speed, int count) { + this.particle = particle; + this.x = x; + this.y = y; + this.z = z; + this.speed = speed; + this.count = count; + } + + @Override + public void read(NetInput in) throws IOException { + this.particle = in.readString(); + this.x = in.readFloat(); + this.y = in.readFloat(); + this.z = in.readFloat(); + this.offsetX = in.readFloat(); + this.offsetY = in.readFloat(); + this.offsetZ = in.readFloat(); + this.speed = in.readFloat(); + this.count = in.readInt(); + } + + @Override + public void write(NetOutput out) throws IOException { + out.writeString(this.particle); + out.writeFloat(this.x); + out.writeFloat(this.y); + out.writeFloat(this.z); + out.writeFloat(this.offsetX); + out.writeFloat(this.offsetY); + out.writeFloat(this.offsetZ); + out.writeFloat(this.speed); + out.writeInt(this.count); + } + + @Override + public void handleClient(Client conn) { + } + + @Override + public void handleServer(ServerConnection conn) { + } + + @Override + public int getId() { + return 63; + } + +}