mirror of
https://github.com/FabricMC/fabric.git
synced 2024-11-22 23:58:02 -05:00
Networking: fix type of created packet (#2712)
This commit is contained in:
parent
422b77fbfd
commit
d9ac3c39e0
4 changed files with 8 additions and 4 deletions
|
@ -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<ServerPlayPacketListener> createC2SPacket(Identifier channelName, PacketByteBuf buf) {
|
||||
Objects.requireNonNull(channelName, "Channel name cannot be null");
|
||||
Objects.requireNonNull(buf, "Buf cannot be null");
|
||||
|
||||
|
|
|
@ -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<ServerPlayPacketListener> createPlayC2SPacket(Identifier channelName, PacketByteBuf buf) {
|
||||
return new CustomPayloadC2SPacket(channelName, buf);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<ClientPlayPacketListener> createS2CPacket(Identifier channelName, PacketByteBuf buf) {
|
||||
Objects.requireNonNull(channelName, "Channel cannot be null");
|
||||
Objects.requireNonNull(buf, "Buf cannot be null");
|
||||
|
||||
|
|
|
@ -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<ClientPlayPacketListener> createPlayC2SPacket(Identifier channel, PacketByteBuf buf) {
|
||||
return new CustomPayloadS2CPacket(channel, buf);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue