A bunch of client packets

This commit is contained in:
themode 2021-01-05 13:58:38 +01:00
parent 261d734740
commit 45c148974e
6 changed files with 99 additions and 7 deletions

View File

@ -6,18 +6,20 @@ public class ClientPlayPacketsHandler extends ClientPacketsHandler {
public ClientPlayPacketsHandler() {
register(0x00, ClientTeleportConfirmPacket::new);
register(0x01, ClientQueryBlockNbtPacket::new);
register(0x03, ClientChatMessagePacket::new);
register(0x04, ClientStatusPacket::new);
register(0x05, ClientSettingsPacket::new);
register(0x06, ClientTabCompletePacket::new);
register(0x07, ClientWindowConfirmationPacket::new);
register(0x08, ClientClickWindowButtonPacket::new); // Marked as 0x07 on wiki.vg
register(0x08, ClientClickWindowButtonPacket::new);
register(0x09, ClientClickWindowPacket::new);
register(0x0A, ClientCloseWindow::new);
register(0x0B, ClientPluginMessagePacket::new);
register(0x0C, ClientEditBookPacket::new);
register(0x0D, ClientQueryEntityNbtPacket::new);
register(0x0E, ClientInteractEntityPacket::new);
//todo 0x0F Generate Structure
register(0x0F, ClientKeepAlivePacket::new);
register(0x0F, ClientGenerateStructurePacket::new);
register(0x10, ClientKeepAlivePacket::new);
// 0x11 packet not used server-side
@ -33,18 +35,15 @@ public class ClientPlayPacketsHandler extends ClientPacketsHandler {
register(0x1B, ClientPlayerDiggingPacket::new);
register(0x1C, ClientEntityActionPacket::new);
register(0x1D, ClientSteerVehiclePacket::new);
register(0x1E, ClientRecipeBookData::new);
register(0x1F, ClientRecipeBookData::new);
register(0x20, ClientNameItemPacket::new);
register(0x21, ClientResourcePackStatusPacket::new);
register(0x22, ClientAdvancementTabPacket::new);
register(0x23, ClientSelectTradePacket::new);
// Set Beacon Effect??
register(0x24, ClientSetBeaconEffectPacket::new);
register(0x25, ClientHeldItemChangePacket::new);
register(0x26, ClientUpdateCommandBlockPacket::new);
register(0x27, ClientUpdateCommandBlockMinecartPacket::new);

View File

@ -0,0 +1,21 @@
package net.minestom.server.network.packet.client.play;
import net.minestom.server.entity.Player;
import net.minestom.server.item.ItemStack;
import net.minestom.server.network.packet.client.ClientPlayPacket;
import net.minestom.server.utils.binary.BinaryReader;
import org.jetbrains.annotations.NotNull;
public class ClientEditBookPacket extends ClientPlayPacket {
public ItemStack book;
public boolean isSigning;
public Player.Hand hand;
@Override
public void read(@NotNull BinaryReader reader) {
this.book = reader.readSlot();
this.isSigning = reader.readBoolean();
this.hand = Player.Hand.values()[reader.readVarInt()];
}
}

View File

@ -0,0 +1,20 @@
package net.minestom.server.network.packet.client.play;
import net.minestom.server.network.packet.client.ClientPlayPacket;
import net.minestom.server.utils.BlockPosition;
import net.minestom.server.utils.binary.BinaryReader;
import org.jetbrains.annotations.NotNull;
public class ClientGenerateStructurePacket extends ClientPlayPacket {
public BlockPosition blockPosition;
public int level;
public boolean keepJigsaws;
@Override
public void read(@NotNull BinaryReader reader) {
this.blockPosition = reader.readBlockPosition();
this.level = reader.readVarInt();
this.keepJigsaws = reader.readBoolean();
}
}

View File

@ -0,0 +1,18 @@
package net.minestom.server.network.packet.client.play;
import net.minestom.server.network.packet.client.ClientPlayPacket;
import net.minestom.server.utils.BlockPosition;
import net.minestom.server.utils.binary.BinaryReader;
import org.jetbrains.annotations.NotNull;
public class ClientQueryBlockNbtPacket extends ClientPlayPacket {
public int transactionId;
public BlockPosition blockPosition;
@Override
public void read(@NotNull BinaryReader reader) {
this.transactionId = reader.readVarInt();
this.blockPosition = reader.readBlockPosition();
}
}

View File

@ -0,0 +1,17 @@
package net.minestom.server.network.packet.client.play;
import net.minestom.server.network.packet.client.ClientPlayPacket;
import net.minestom.server.utils.binary.BinaryReader;
import org.jetbrains.annotations.NotNull;
public class ClientQueryEntityNbtPacket extends ClientPlayPacket {
public int transactionId;
public int entityId;
@Override
public void read(@NotNull BinaryReader reader) {
this.transactionId = reader.readVarInt();
this.entityId = reader.readVarInt();
}
}

View File

@ -0,0 +1,17 @@
package net.minestom.server.network.packet.client.play;
import net.minestom.server.network.packet.client.ClientPlayPacket;
import net.minestom.server.utils.binary.BinaryReader;
import org.jetbrains.annotations.NotNull;
public class ClientSetBeaconEffectPacket extends ClientPlayPacket {
public int primaryEffect;
public int secondaryEffect;
@Override
public void read(@NotNull BinaryReader reader) {
this.primaryEffect = reader.readVarInt();
this.secondaryEffect = reader.readVarInt();
}
}