Class PMWNetworking

java.lang.Object
net.nullved.pmweatherapi.network.PMWNetworking

public class PMWNetworking extends Object
The base networking class for PMWeatherAPI
Since:
0.14.15.3
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    register(Object... args)
    Registers all of PMWeatherAPI's packets.
    static <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
    void
    registerClientboundPacket(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,T> codec, BiConsumer<T,net.minecraft.world.entity.player.Player> handler, Object... args)
    Registers a clientbound packet payload
    static <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
    void
    registerServerboundPacket(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,T> codec, BiConsumer<T,net.minecraft.world.entity.player.Player> handler, Object... args)
    Registers a serverbound packet payload
    static void
    serverSendStorageToAll(net.minecraft.nbt.CompoundTag tag, Function<net.minecraft.nbt.CompoundTag,S2CStoragePacket<?>> pkt)
    Sends all clients a S2CStoragePacket.
    static void
    serverSendStorageToPlayer(net.minecraft.nbt.CompoundTag tag, Function<net.minecraft.nbt.CompoundTag,S2CStoragePacket<?>> pkt, net.minecraft.world.entity.player.Player player)
    Sends a S2CStoragePacket to a specific player.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PMWNetworking

      public PMWNetworking()
  • Method Details

    • register

      public static void register(Object... args)
      Registers all of PMWeatherAPI's packets. Should not be called
      Parameters:
      args - The arguments to pass
      Since:
      0.14.15.3
    • registerServerboundPacket

      public static <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> void registerServerboundPacket(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,T> codec, BiConsumer<T,net.minecraft.world.entity.player.Player> handler, Object... args)
      Registers a serverbound packet payload
      Type Parameters:
      T - A packet extending CustomPacketPayload
      Parameters:
      type - The CustomPacketPayload.Type of the packet
      codec - The StreamCodec for the packet
      handler - The handle method for the packet
      args - Additional arguments. args[0] should be the PayloadRegistrar
      Since:
      0.14.15.3
    • registerClientboundPacket

      public static <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> void registerClientboundPacket(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,T> codec, BiConsumer<T,net.minecraft.world.entity.player.Player> handler, Object... args)
      Registers a clientbound packet payload
      Type Parameters:
      T - A packet extending CustomPacketPayload
      Parameters:
      type - The CustomPacketPayload.Type of the packet
      codec - The StreamCodec for the packet
      handler - The handle method for the packet
      args - Additional arguments. args[0] should be the PayloadRegistrar
      Since:
      0.14.15.3
    • serverSendStorageToAll

      public static void serverSendStorageToAll(net.minecraft.nbt.CompoundTag tag, Function<net.minecraft.nbt.CompoundTag,S2CStoragePacket<?>> pkt)
      Sends all clients a S2CStoragePacket. The type of packet is dependent on the caller of this method
      Parameters:
      tag - The tag to send, generated by the RadarServerStorage
      Since:
      0.15.3.3
    • serverSendStorageToPlayer

      public static void serverSendStorageToPlayer(net.minecraft.nbt.CompoundTag tag, Function<net.minecraft.nbt.CompoundTag,S2CStoragePacket<?>> pkt, net.minecraft.world.entity.player.Player player)
      Sends a S2CStoragePacket to a specific player. The type of packet is dependent on the caller of this method
      Parameters:
      tag - The tag to send with the packet
      Since:
      0.15.3.3