Skip to content

Commit

Permalink
Fix crash when client connection is missing in packet
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Dec 9, 2024
1 parent b3ecdb6 commit 18ba37f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public abstract class PalettedContainerDataMixin<T> {
var palette = this.palette();
if (palette instanceof IdListPalette<T> && palette.get(0) instanceof BlockState) {
var player = PacketContext.get();
if (player.getPacketListener() == null) {
if (player.getClientConnection() == null) {
return storage;
}
int bits;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private static Supplier<Codec<ItemStack>> patchCodec(Supplier<Codec<ItemStack>>
}, content -> { // Encode
if (PolymerCommonUtils.isServerNetworkingThreadWithContext()) {
var ctx = PacketContext.get();
if (ctx.getPacketListener() == null) {
if (ctx.getBackingPacketListener() == null) {
return content;
}
return PolymerItemUtils.getPolymerItemStack(content, ctx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static ContextByteBuf of(PacketContext context, int version, ByteBuf buf)

if (buf instanceof RegistryByteBuf reg) {
registryManager = reg.getRegistryManager();
} else if (context.getPacketListener() instanceof NetworkHandlerExtension ext) {
} else if (context.getBackingPacketListener() instanceof NetworkHandlerExtension ext) {
registryManager = ext.polymer$getDynamicRegistryManager();
}
if (registryManager == null) {
Expand Down

0 comments on commit 18ba37f

Please sign in to comment.