diff --git a/src/main/java/com/sollace/fabwork/api/packets/C2SPacketType.java b/src/main/java/com/sollace/fabwork/api/packets/C2SPacketType.java index b22b472..53570dc 100644 --- a/src/main/java/com/sollace/fabwork/api/packets/C2SPacketType.java +++ b/src/main/java/com/sollace/fabwork/api/packets/C2SPacketType.java @@ -38,6 +38,11 @@ public void sendToServer(T packet) { ClientSimpleNetworkingImpl.send(new Payload<>(packet, id)); } + @Deprecated + public void sendToServer(Packet packet) { + sendToServer((T)packet); + } + /** * Creates a single-use callback to invoke when receiving a packet from a particular client. * The returned future will either complete successfully with the incoming packet, @@ -60,4 +65,9 @@ public net.minecraft.network.packet.Packet toPacket( Objects.requireNonNull(packet, "Packet cannot be null"); return ClientSimpleNetworkingImpl.createC2SPacket(new Payload<>(packet, id)); } + + @Deprecated + public net.minecraft.network.packet.Packet toPacket(Packet packet) { + return toPacket((T)packet); + } } \ No newline at end of file diff --git a/src/main/java/com/sollace/fabwork/api/packets/S2CPacketType.java b/src/main/java/com/sollace/fabwork/api/packets/S2CPacketType.java index a3cf2d7..c5091f7 100644 --- a/src/main/java/com/sollace/fabwork/api/packets/S2CPacketType.java +++ b/src/main/java/com/sollace/fabwork/api/packets/S2CPacketType.java @@ -26,6 +26,11 @@ public void sendToPlayer(T packet, ServerPlayerEntity recipient) { ServerPlayNetworking.send(recipient, new Payload<>(packet, id)); } + @Deprecated + public void sendToPlayer(Packet packet, ServerPlayerEntity recipient) { + sendToPlayer((T)packet, recipient); + } + public void sendToAllPlayers(T packet, World world) { Objects.requireNonNull(world, "Server world cannot be null"); var p = toPacket(packet); @@ -36,6 +41,11 @@ public void sendToAllPlayers(T packet, World world) { }); } + @Deprecated + public void sendToAllPlayers(Packet packet, World world) { + sendToAllPlayers((T)packet, world); + } + public void sendToSurroundingPlayers(T packet, Entity entity) { Objects.requireNonNull(entity, "Entity cannot be null"); if (entity.getWorld() instanceof ServerWorld sw) { @@ -43,6 +53,11 @@ public void sendToSurroundingPlayers(T packet, Entity entity) { } } + @Deprecated + public void sendToSurroundingPlayers(Packet packet, Entity entity) { + sendToSurroundingPlayers((T)packet, entity); + } + public void sendToAllPlayers(T packet, MinecraftServer server) { Objects.requireNonNull(server, "Server cannot be null"); var p = toPacket(packet); @@ -51,6 +66,11 @@ public void sendToAllPlayers(T packet, MinecraftServer server) { }); } + @Deprecated + public void sendToAllPlayers(Packet packet, MinecraftServer server) { + sendToAllPlayers((T)packet, server); + } + /** * Repackages a fabwork packet into a normal Minecraft protocol packet suitable for sending to a connected client. */ @@ -58,4 +78,9 @@ public net.minecraft.network.packet.Packet toPacket( Objects.requireNonNull(packet, "Packet cannot be null"); return ServerPlayNetworking.createS2CPacket(new Payload<>(packet, id)); } + + @Deprecated + public net.minecraft.network.packet.Packet toPacket(Packet packet) { + return toPacket((T)packet); + } } \ No newline at end of file