From d9e0203ab1a48fd4ddeaff67d4251a71fba0b1b2 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sun, 28 Apr 2024 09:59:51 -0400 Subject: [PATCH 1/2] Fix blog post networking code --- _posts/2024-04-19-1205.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/_posts/2024-04-19-1205.md b/_posts/2024-04-19-1205.md index d7148539..18cc1925 100644 --- a/_posts/2024-04-19-1205.md +++ b/_posts/2024-04-19-1205.md @@ -334,9 +334,9 @@ var nbt = PacketCodecs.NBT_COMPOUND; // Serializing a registry value (by raw ID) // Note: these require RegistryByteBuf! -PacketCodecs item = PacketCodecs.registryValue(RegistryKeys.ITEM); +PacketCodec item = PacketCodecs.registryValue(RegistryKeys.ITEM); // Or, RegistryEntry -PacketCodecs biome = PacketCodecs.registryEntry(RegistryKeys.BIOME); +PacketCodec biome = PacketCodecs.registryEntry(RegistryKeys.BIOME); // Serializing an Enum var axis = PacketCodecs.indexed(i -> Direction.Axis.VALUES[i], Direction.Axis::ordinal); @@ -400,12 +400,12 @@ Then, you can change the receiver. Instead of long parameters, the event callbac Here are the available fields in the context object: -| `PayloadTypeRegistry` | Class | Fields | -| --------------------- | ---------------------- | ------------------------------------ | -| `playC2S` | `ServerPlayNetworking` | `player`, `responseSender` | -| `playS2C` | `ClientPlayNetworking` | `client`, `player`, `responseSender` | -| `configurationC2S` | `ServerConfigurationNetworking` | `networkHandler`, `responseSender` | -| `configurationS2C` | `ClientConfigurationNetworking` | `responseSender` | +| `PayloadTypeRegistry` | Class | Fields | +|-----------------------|---------------------------------|----------------------| +| `playC2S` | `ServerPlayNetworking` | `payload`, `context` | +| `playS2C` | `ClientPlayNetworking` | `payload`, `context` | +| `configurationC2S` | `ServerConfigurationNetworking` | `payload`, `context` | +| `configurationS2C` | `ClientConfigurationNetworking` | `payload`, `context` | Note that the field shortcuts might be added later. From de64133239c1f90fbadf74c60aaad024b4586b9b Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sun, 28 Apr 2024 15:17:30 -0400 Subject: [PATCH 2/2] Fix context fields --- _posts/2024-04-19-1205.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/_posts/2024-04-19-1205.md b/_posts/2024-04-19-1205.md index 18cc1925..4971c231 100644 --- a/_posts/2024-04-19-1205.md +++ b/_posts/2024-04-19-1205.md @@ -400,12 +400,12 @@ Then, you can change the receiver. Instead of long parameters, the event callbac Here are the available fields in the context object: -| `PayloadTypeRegistry` | Class | Fields | -|-----------------------|---------------------------------|----------------------| -| `playC2S` | `ServerPlayNetworking` | `payload`, `context` | -| `playS2C` | `ClientPlayNetworking` | `payload`, `context` | -| `configurationC2S` | `ServerConfigurationNetworking` | `payload`, `context` | -| `configurationS2C` | `ClientConfigurationNetworking` | `payload`, `context` | +| `PayloadTypeRegistry` | Class | Context Fields | +|-----------------------|---------------------------------|--------------------------------------| +| `playC2S` | `ServerPlayNetworking` | `player`, `responseSender` | +| `playS2C` | `ClientPlayNetworking` | `client`, `player`, `responseSender` | +| `configurationC2S` | `ServerConfigurationNetworking` | `networkHandler`, `responseSender` | +| `configurationS2C` | `ClientConfigurationNetworking` | `responseSender` | Note that the field shortcuts might be added later.