Package net.nullved.pmweatherapi.network
Class PMWNetworking
java.lang.Object
net.nullved.pmweatherapi.network.PMWNetworking
The base networking class for PMWeatherAPI
- Since:
- 0.14.15.3
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidRegisters all of PMWeatherAPI's packets.static <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
voidregisterClientboundPacket(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 payloadstatic <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
voidregisterServerboundPacket(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 payloadstatic voidserverSendStorageToAll(net.minecraft.nbt.CompoundTag tag, Function<net.minecraft.nbt.CompoundTag, S2CStoragePacket<?>> pkt) Sends all clients aS2CStoragePacket.static voidserverSendStorageToPlayer(net.minecraft.nbt.CompoundTag tag, Function<net.minecraft.nbt.CompoundTag, S2CStoragePacket<?>> pkt, net.minecraft.world.entity.player.Player player) Sends aS2CStoragePacketto a specific player.
-
Constructor Details
-
PMWNetworking
public PMWNetworking()
-
-
Method Details
-
register
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 extendingCustomPacketPayload- Parameters:
type- TheCustomPacketPayload.Typeof the packetcodec- TheStreamCodecfor the packethandler- The handle method for the packetargs- Additional arguments. args[0] should be thePayloadRegistrar- 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 extendingCustomPacketPayload- Parameters:
type- TheCustomPacketPayload.Typeof the packetcodec- TheStreamCodecfor the packethandler- The handle method for the packetargs- Additional arguments. args[0] should be thePayloadRegistrar- 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 aS2CStoragePacket. The type of packet is dependent on the caller of this method- Parameters:
tag- The tag to send, generated by theRadarServerStorage- 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 aS2CStoragePacketto 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
-