ClientboundAnimatePacket .java

net.minecraft.network.protocol.game.ClientboundAnimatePacket (class): members: MAGIC_CRITICAL_HIT, CRITICAL_HIT, WAKE_UP, getAction, action, getId, handle.

net.minecraft.network.protocol.gameclass51 linescommon1.4 KB

Implements

API Surface (4)

PacketType<ClientboundAnimatePacket> type()
void handle(final ClientGamePacketListener listener)
int getId()
int getAction()

Fields & Constants (6)

STREAM_CODEC
WAKE_UP
CRITICAL_HIT
MAGIC_CRITICAL_HIT
id
action

Same Package (197)

Code Graph: Dependencies (6)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

ClientboundAnimatePacket.java51 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.network.protocol.game;
2
3
import net.minecraft.network.FriendlyByteBuf;
4
import net.minecraft.network.codec.StreamCodec;
5
import net.minecraft.network.protocol.Packet;
6
import net.minecraft.network.protocol.PacketType;
7
import net.minecraft.world.entity.Entity;
8
9
public class ClientboundAnimatePacket implements Packet<ClientGamePacketListener> {
10
	public static final StreamCodec<FriendlyByteBuf, ClientboundAnimatePacket> STREAM_CODEC = Packet.codec(
11
		ClientboundAnimatePacket::write, ClientboundAnimatePacket::new
12
	);
13
	public static final int WAKE_UP = 0;
14
	public static final int CRITICAL_HIT = 1;
15
	public static final int MAGIC_CRITICAL_HIT = 2;
16
	private final int id;
17
	private final int action;
18
19
	public ClientboundAnimatePacket(final Entity entity, final int action) {
20
		this.id = entity.getId();
21
		this.action = action;
22
	}
23
24
	private ClientboundAnimatePacket(final FriendlyByteBuf input) {
25
		this.id = input.readVarInt();
26
		this.action = input.readUnsignedByte();
27
	}
28
29
	private void write(final FriendlyByteBuf output) {
30
		output.writeVarInt(this.id);
31
		output.writeByte(this.action);
32
	}
33
34
	@Override
35
	public PacketType<ClientboundAnimatePacket> type() {
36
		return GamePacketTypes.CLIENTBOUND_ANIMATE;
37
	}
38
39
	public void handle(final ClientGamePacketListener listener) {
40
		listener.handleAnimate(this);
41
	}
42
43
	public int getId() {
44
		return this.id;
45
	}
46
47
	public int getAction() {
48
		return this.action;
49
	}
50
}
51

Decompiled Minecraft 26.3 source of ClientboundAnimatePacket (net/minecraft/network/protocol/game/ClientboundAnimatePacket.java) with Mojang official mappings, stored verbatim on the site.