From d9ac3c39e05920475777f95f07f0ff5bebf727df Mon Sep 17 00:00:00 2001 From: apple502j <33279053+apple502j@users.noreply.github.com> Date: Wed, 30 Nov 2022 03:11:22 +0900 Subject: [PATCH] Networking: fix type of created packet (#2712) --- .../fabric/api/client/networking/v1/ClientPlayNetworking.java | 3 ++- .../fabric/impl/networking/client/ClientNetworkingImpl.java | 3 ++- .../fabric/api/networking/v1/ServerPlayNetworking.java | 3 ++- .../fabric/impl/networking/server/ServerNetworkingImpl.java | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/fabric-networking-api-v1/src/client/java/net/fabricmc/fabric/api/client/networking/v1/ClientPlayNetworking.java b/fabric-networking-api-v1/src/client/java/net/fabricmc/fabric/api/client/networking/v1/ClientPlayNetworking.java index deb09efba..9a7e9547e 100644 --- a/fabric-networking-api-v1/src/client/java/net/fabricmc/fabric/api/client/networking/v1/ClientPlayNetworking.java +++ b/fabric-networking-api-v1/src/client/java/net/fabricmc/fabric/api/client/networking/v1/ClientPlayNetworking.java @@ -25,6 +25,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.network.Packet; import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.listener.ServerPlayPacketListener; import net.minecraft.util.Identifier; import net.fabricmc.api.EnvType; @@ -189,7 +190,7 @@ public final class ClientPlayNetworking { * @param buf the packet byte buf which represents the payload of the packet * @return a new packet */ - public static Packet createC2SPacket(Identifier channelName, PacketByteBuf buf) { + public static Packet createC2SPacket(Identifier channelName, PacketByteBuf buf) { Objects.requireNonNull(channelName, "Channel name cannot be null"); Objects.requireNonNull(buf, "Buf cannot be null"); diff --git a/fabric-networking-api-v1/src/client/java/net/fabricmc/fabric/impl/networking/client/ClientNetworkingImpl.java b/fabric-networking-api-v1/src/client/java/net/fabricmc/fabric/impl/networking/client/ClientNetworkingImpl.java index 8749f1931..4a5ce2ee1 100644 --- a/fabric-networking-api-v1/src/client/java/net/fabricmc/fabric/impl/networking/client/ClientNetworkingImpl.java +++ b/fabric-networking-api-v1/src/client/java/net/fabricmc/fabric/impl/networking/client/ClientNetworkingImpl.java @@ -30,6 +30,7 @@ import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.network.ClientConnection; import net.minecraft.network.Packet; import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.listener.ServerPlayPacketListener; import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket; import net.minecraft.util.Identifier; @@ -60,7 +61,7 @@ public final class ClientNetworkingImpl { return (ClientLoginNetworkAddon) ((NetworkHandlerExtensions) handler).getAddon(); } - public static Packet createPlayC2SPacket(Identifier channelName, PacketByteBuf buf) { + public static Packet createPlayC2SPacket(Identifier channelName, PacketByteBuf buf) { return new CustomPayloadC2SPacket(channelName, buf); } diff --git a/fabric-networking-api-v1/src/main/java/net/fabricmc/fabric/api/networking/v1/ServerPlayNetworking.java b/fabric-networking-api-v1/src/main/java/net/fabricmc/fabric/api/networking/v1/ServerPlayNetworking.java index d4ddb3a73..67589b313 100644 --- a/fabric-networking-api-v1/src/main/java/net/fabricmc/fabric/api/networking/v1/ServerPlayNetworking.java +++ b/fabric-networking-api-v1/src/main/java/net/fabricmc/fabric/api/networking/v1/ServerPlayNetworking.java @@ -23,6 +23,7 @@ import org.jetbrains.annotations.Nullable; import net.minecraft.network.Packet; import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.listener.ClientPlayPacketListener; import net.minecraft.server.MinecraftServer; import net.minecraft.server.network.ServerPlayNetworkHandler; import net.minecraft.server.network.ServerPlayerEntity; @@ -203,7 +204,7 @@ public final class ServerPlayNetworking { * @param buf the packet byte buf which represents the payload of the packet * @return a new packet */ - public static Packet createS2CPacket(Identifier channelName, PacketByteBuf buf) { + public static Packet createS2CPacket(Identifier channelName, PacketByteBuf buf) { Objects.requireNonNull(channelName, "Channel cannot be null"); Objects.requireNonNull(buf, "Buf cannot be null"); diff --git a/fabric-networking-api-v1/src/main/java/net/fabricmc/fabric/impl/networking/server/ServerNetworkingImpl.java b/fabric-networking-api-v1/src/main/java/net/fabricmc/fabric/impl/networking/server/ServerNetworkingImpl.java index c78096a77..d059066f5 100644 --- a/fabric-networking-api-v1/src/main/java/net/fabricmc/fabric/impl/networking/server/ServerNetworkingImpl.java +++ b/fabric-networking-api-v1/src/main/java/net/fabricmc/fabric/impl/networking/server/ServerNetworkingImpl.java @@ -18,6 +18,7 @@ package net.fabricmc.fabric.impl.networking.server; import net.minecraft.network.Packet; import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.listener.ClientPlayPacketListener; import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket; import net.minecraft.server.network.ServerLoginNetworkHandler; import net.minecraft.server.network.ServerPlayNetworkHandler; @@ -40,7 +41,7 @@ public final class ServerNetworkingImpl { return (ServerLoginNetworkAddon) ((NetworkHandlerExtensions) handler).getAddon(); } - public static Packet createPlayC2SPacket(Identifier channel, PacketByteBuf buf) { + public static Packet createPlayC2SPacket(Identifier channel, PacketByteBuf buf) { return new CustomPayloadS2CPacket(channel, buf); } }