Обработка анимации
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* d.mihailov <d.mihailov@samson-rus.com>
|
||||
* 2018-05-22
|
||||
*/
|
||||
package mc.core.network.proto_125.packets;
|
||||
|
||||
import lombok.*;
|
||||
import mc.core.network.CSPacket;
|
||||
import mc.core.network.NetStream;
|
||||
import mc.core.network.SCPacket;
|
||||
import mc.core.network.proto_125.ByteArrayOutputNetStream;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Setter
|
||||
@Getter
|
||||
@ToString
|
||||
public class AnimationPacket implements SCPacket, CSPacket {
|
||||
public static final int NO_ANIMATION = 0,
|
||||
SWING_ARM = 1,
|
||||
DAMAGE = 2,
|
||||
LEAVE_BED = 3,
|
||||
EAT_FOOD = 5,
|
||||
CROUCH = 104,
|
||||
UNCROUCH = 105;
|
||||
|
||||
private int id;
|
||||
private int animation;
|
||||
|
||||
@Override
|
||||
public void readSelf(NetStream netStream) {
|
||||
id = netStream.readInt();
|
||||
animation = netStream.readByte();
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] toByteArray() {
|
||||
ByteArrayOutputNetStream netStream = new ByteArrayOutputNetStream();
|
||||
netStream.writeInt(id);
|
||||
netStream.writeByte(animation);
|
||||
return netStream.toByteArray();
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ public class PacketManager {
|
||||
.put(0x0B, PlayerPositionPacket.class)
|
||||
.put(0x0C, PlayerLookPacket.class)
|
||||
.put(0x0D, PositionAndLookPacket.class)
|
||||
.put(0x12, AnimationPacket.class)
|
||||
.put(0x14, SpawnNamedEntityPacket.class)
|
||||
.put(0x1D, DestroyEntityPacket.class)
|
||||
.put(0x1F, EntityRelativeMovePacket.class)
|
||||
|
||||
Reference in New Issue
Block a user