diff --git a/src/main/java/org/quartzpowered/protocol/codec/v1_8_R1/ProtocolV1_8_R1.java b/src/main/java/org/quartzpowered/protocol/codec/v1_8_R1/ProtocolV1_8_R1.java index 317fc3b..ccbe602 100644 --- a/src/main/java/org/quartzpowered/protocol/codec/v1_8_R1/ProtocolV1_8_R1.java +++ b/src/main/java/org/quartzpowered/protocol/codec/v1_8_R1/ProtocolV1_8_R1.java @@ -120,6 +120,7 @@ protected void registerPackets() { clientBoundPacket(PLAY, 0x0B, AnimationPacket.class, new AnimationCodec()); clientBoundPacket(PLAY, 0x0C, SpawnPlayerPacket.class, new SpawnPlayerCodec()); clientBoundPacket(PLAY, 0x0D, CollectItemPacket.class, new CollectItemCodec()); + clientBoundPacket(PLAY, 0x12, EntityVelocityPacket.class, new EntityVelocityCodec()); clientBoundPacket(PLAY, 0x13, EntityDestroyPacket.class, new EntityDestroyCodec()); clientBoundPacket(PLAY, 0x14, EntityPacket.class, new EntityCodec()); clientBoundPacket(PLAY, 0x15, EntityMovePacket.class, new EntityMoveCodec()); @@ -134,6 +135,7 @@ protected void registerPackets() { clientBoundPacket(PLAY, 0x2F, SetExperiencePacket.class, new SetExperienceCodec()); clientBoundPacket(PLAY, 0x21, ChunkPacket.class, new ChunkCodec()); clientBoundPacket(PLAY, 0x26, ChunkBulkPacket.class, new ChunkBulkCodec()); + clientBoundPacket(PLAY, 0x29, SoundEffectPacket.class, new SoundEffectCodec()); clientBoundPacket(PLAY, 0x32, ConfirmTransactionPacket.class, new ConfirmTransactionCodec()); clientBoundPacket(PLAY, 0x38, PlayerInfoPacket.class, new PlayerInfoCodec()); clientBoundPacket(PLAY, 0x40, KickPacket.class, new KickCodec()); diff --git a/src/main/java/org/quartzpowered/protocol/codec/v1_8_R1/play/client/EntityVelocityCodec.java b/src/main/java/org/quartzpowered/protocol/codec/v1_8_R1/play/client/EntityVelocityCodec.java new file mode 100644 index 0000000..b674ce0 --- /dev/null +++ b/src/main/java/org/quartzpowered/protocol/codec/v1_8_R1/play/client/EntityVelocityCodec.java @@ -0,0 +1,49 @@ +/* + * This file is a component of Quartz Powered, this license makes sure any work + * associated with Quartz Powered, must follow the conditions of the license included. + * + * The MIT License (MIT) + * + * Copyright (c) 2015 Quartz Powered + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package org.quartzpowered.protocol.codec.v1_8_R1.play.client; + +import org.quartzpowered.network.buffer.Buffer; +import org.quartzpowered.network.protocol.codec.Codec; +import org.quartzpowered.protocol.packet.play.client.EntityVelocityPacket; + +public class EntityVelocityCodec implements Codec { + @Override + public void encode(Buffer buffer, EntityVelocityPacket packet) { + buffer.writeVarInt(packet.getEntityID()); + buffer.writeShort(packet.getVelocityX()); + buffer.writeShort(packet.getVelocityY()); + buffer.writeShort(packet.getVelocityZ()); + } + + @Override + public void decode(Buffer buffer, EntityVelocityPacket packet) { + packet.setEntityID(buffer.readVarInt()); + packet.setVelocityX(buffer.readShort()); + packet.setVelocityY(buffer.readShort()); + packet.setVelocityZ(buffer.readShort()); + } +} diff --git a/src/main/java/org/quartzpowered/protocol/codec/v1_8_R1/play/client/SoundEffectCodec.java b/src/main/java/org/quartzpowered/protocol/codec/v1_8_R1/play/client/SoundEffectCodec.java new file mode 100644 index 0000000..fcd857a --- /dev/null +++ b/src/main/java/org/quartzpowered/protocol/codec/v1_8_R1/play/client/SoundEffectCodec.java @@ -0,0 +1,27 @@ +package org.quartzpowered.protocol.codec.v1_8_R1.play.client; + +import org.quartzpowered.network.buffer.Buffer; +import org.quartzpowered.network.protocol.codec.Codec; +import org.quartzpowered.protocol.packet.play.client.SoundEffectPacket; + +public class SoundEffectCodec implements Codec { + @Override + public void encode(Buffer buffer, SoundEffectPacket packet) { + buffer.writeString(packet.getSoundName()); + buffer.writeInt(packet.getEffectPositionX()); + buffer.writeInt(packet.getEffectPositionY()); + buffer.writeInt(packet.getEffectPositionZ()); + buffer.writeFloat(packet.getVolume()); + buffer.writeByte(packet.getPitch()); + } + + @Override + public void decode(Buffer buffer, SoundEffectPacket packet) { + packet.setSoundName(buffer.readString()); + packet.setEffectPositionX(buffer.readInt()); + packet.setEffectPositionY(buffer.readInt()); + packet.setEffectPositionZ(buffer.readInt()); + packet.setVolume(buffer.readFloat()); + packet.setPitch(buffer.readByte()); + } +} diff --git a/src/main/java/org/quartzpowered/protocol/packet/play/client/EntityVelocityPacket.java b/src/main/java/org/quartzpowered/protocol/packet/play/client/EntityVelocityPacket.java new file mode 100644 index 0000000..656c206 --- /dev/null +++ b/src/main/java/org/quartzpowered/protocol/packet/play/client/EntityVelocityPacket.java @@ -0,0 +1,39 @@ +/* + * This file is a component of Quartz Powered, this license makes sure any work + * associated with Quartz Powered, must follow the conditions of the license included. + * + * The MIT License (MIT) + * + * Copyright (c) 2015 Quartz Powered + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package org.quartzpowered.protocol.packet.play.client; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.quartzpowered.network.protocol.packet.Packet; +@Data +@EqualsAndHashCode(callSuper = true) +public class EntityVelocityPacket extends Packet { + private int entityID; + private int velocityX; + private int velocityY; + private int velocityZ; +} diff --git a/src/main/java/org/quartzpowered/protocol/packet/play/client/SoundEffectPacket.java b/src/main/java/org/quartzpowered/protocol/packet/play/client/SoundEffectPacket.java new file mode 100644 index 0000000..b949117 --- /dev/null +++ b/src/main/java/org/quartzpowered/protocol/packet/play/client/SoundEffectPacket.java @@ -0,0 +1,43 @@ +/* + * This file is a component of Quartz Powered, this license makes sure any work + * associated with Quartz Powered, must follow the conditions of the license included. + * + * The MIT License (MIT) + * + * Copyright (c) 2015 Quartz Powered + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package org.quartzpowered.protocol.packet.play.client; + + +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.quartzpowered.network.protocol.packet.Packet; + +@Data +@EqualsAndHashCode(callSuper = true) +public class SoundEffectPacket extends Packet { + private String soundName; + private int effectPositionX; + private int effectPositionY; + private int effectPositionZ; + private double volume; + private int pitch; +}