ClientboundProjectilePowerPacket 0x8A

ClientboundProjectilePowerPacket: Minecraft 26.3 packet (0x8A Play clientbound). Wire name 'projectile_power', fields: id, accelerationPower, handled

Minecraft 26.3PlayClientboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x8A138PLAYClientboundGamePacketTypes.CLIENTBOUND_PROJECTILE_POWER: "projectile_power"

Packet ids are positional: the id is the index of the addPacket call in the protocol builder (see ProtocolInfoBuilder.listPackets). Ids change between game versions.

Wire fields (2)

FieldType
idint
accelerationPowerdouble

Stream codec

static final StreamCodec<FriendlyByteBuf, ClientboundProjectilePowerPacket> STREAM_CODEC = Packet.codec( ClientboundProjectilePowerPacket::write, ClientboundProjectilePowerPacket::new );

Modern packets serialize through StreamCodecs instead of read/write methods.

Handling

Resolved on the ClientGamePacketListener packet-listener interface by void handleProjectilePowerPacket(ClientboundProjectilePowerPacket clientboundprojectilepowerpacket). The implementation in the game is ClientPacketListener.

Full Source

ClientboundProjectilePowerPacket.java47 lines · Minecraft 26.3 · verbatimSource page ↗
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
8
public class ClientboundProjectilePowerPacket implements Packet<ClientGamePacketListener> {
9
	public static final StreamCodec<FriendlyByteBuf, ClientboundProjectilePowerPacket> STREAM_CODEC = Packet.codec(
10
		ClientboundProjectilePowerPacket::write, ClientboundProjectilePowerPacket::new
11
	);
12
	private final int id;
13
	private final double accelerationPower;
14
15
	public ClientboundProjectilePowerPacket(final int id, final double accelerationPower) {
16
		this.id = id;
17
		this.accelerationPower = accelerationPower;
18
	}
19
20
	private ClientboundProjectilePowerPacket(final FriendlyByteBuf input) {
21
		this.id = input.readVarInt();
22
		this.accelerationPower = input.readDouble();
23
	}
24
25
	private void write(final FriendlyByteBuf output) {
26
		output.writeVarInt(this.id);
27
		output.writeDouble(this.accelerationPower);
28
	}
29
30
	@Override
31
	public PacketType<ClientboundProjectilePowerPacket> type() {
32
		return GamePacketTypes.CLIENTBOUND_PROJECTILE_POWER;
33
	}
34
35
	public void handle(final ClientGamePacketListener listener) {
36
		listener.handleProjectilePowerPacket(this);
37
	}
38
39
	public int getId() {
40
		return this.id;
41
	}
42
43
	public double getAccelerationPower() {
44
		return this.accelerationPower;
45
	}
46
}
47