-
-
Notifications
You must be signed in to change notification settings - Fork 201
/
ServerBlockBreakAnimPacket.java
63 lines (50 loc) · 1.62 KB
/
ServerBlockBreakAnimPacket.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package org.spacehq.mc.protocol.packet.ingame.server.world;
import org.spacehq.mc.protocol.data.game.Position;
import org.spacehq.mc.protocol.data.game.values.MagicValues;
import org.spacehq.mc.protocol.data.game.values.entity.player.BlockBreakStage;
import org.spacehq.mc.protocol.util.NetUtil;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;
import java.io.IOException;
public class ServerBlockBreakAnimPacket implements Packet {
private int breakerEntityId;
private Position position;
private BlockBreakStage stage;
@SuppressWarnings("unused")
private ServerBlockBreakAnimPacket() {
}
public ServerBlockBreakAnimPacket(int breakerEntityId, Position position, BlockBreakStage stage) {
this.breakerEntityId = breakerEntityId;
this.position = position;
this.stage = stage;
}
public int getBreakerEntityId() {
return this.breakerEntityId;
}
public Position getPosition() {
return this.position;
}
public BlockBreakStage getStage() {
return this.stage;
}
@Override
public void read(NetInput in) throws IOException {
this.breakerEntityId = in.readVarInt();
this.position = NetUtil.readPosition(in);
this.stage = MagicValues.key(BlockBreakStage.class, in.readUnsignedByte());
if (this.stage == null) {
this.stage = BlockBreakStage.RESET;
}
}
@Override
public void write(NetOutput out) throws IOException {
out.writeVarInt(this.breakerEntityId);
NetUtil.writePosition(out, this.position);
out.writeByte(MagicValues.value(Integer.class, this.stage));
}
@Override
public boolean isPriority() {
return false;
}
}