Class NetworkHelper
java.lang.Object
com.pixelmonmod.pixelmon.api.util.helpers.NetworkHelper
Static utility class to abstract and simplify sending packets (weird
PacketDistributor is ugly)-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidsendNearbyPacket(PixelmonPacket packet, net.minecraftforge.network.PacketDistributor.TargetPoint targetPoint) Sends a packet to all nearby playersstatic voidsendNearbyPacket(net.minecraftforge.network.PacketDistributor.TargetPoint targetPoint, PixelmonPacket packet) Sends a packet to all nearby playersstatic voidsendPacket(PixelmonPacket packet, net.minecraft.server.level.ServerPlayer serverPlayer) Sends the packet to the playerstatic voidsendPacket(net.minecraft.server.level.ServerPlayer serverPlayer, PixelmonPacket packet) Sends the packet to the playerstatic voidsendToAll(PixelmonPacket packet) Sends a packet to all playersstatic voidsendToAllTracking(PixelmonPacket packet, net.minecraft.world.entity.Entity entity) Sends a packet to all nearby playersstatic voidsendToDimension(PixelmonPacket packet, net.minecraft.world.level.Level world) Sends a packet to all nearby playersstatic voidsendToServer(PixelmonPacket packet) Sends a packet to the serverstatic net.minecraft.network.protocol.Packet<?>Converts thePixelmonPacketto aPacketthat can be sent to the client using vanilla methods, and theConfigurationTaskmethod
-
Constructor Details
-
NetworkHelper
public NetworkHelper()
-
-
Method Details
-
sendPacket
public static void sendPacket(PixelmonPacket packet, net.minecraft.server.level.ServerPlayer serverPlayer) Sends the packet to the player- Parameters:
serverPlayer- The player implementationpacket- The packet to send to the player
-
sendPacket
public static void sendPacket(net.minecraft.server.level.ServerPlayer serverPlayer, PixelmonPacket packet) Sends the packet to the player- Parameters:
serverPlayer- The player implementationpacket- The packet to send to the player
-
sendNearbyPacket
public static void sendNearbyPacket(PixelmonPacket packet, net.minecraftforge.network.PacketDistributor.TargetPoint targetPoint) Sends a packet to all nearby players- Parameters:
targetPoint- The point to get nearby players frompacket- The packet to send
-
sendNearbyPacket
public static void sendNearbyPacket(net.minecraftforge.network.PacketDistributor.TargetPoint targetPoint, PixelmonPacket packet) Sends a packet to all nearby players- Parameters:
targetPoint- The point to get nearby players frompacket- The packet to send
-
sendToDimension
Sends a packet to all nearby players- Parameters:
world- The world to get all players frompacket- The packet to send
-
sendToAllTracking
public static void sendToAllTracking(PixelmonPacket packet, net.minecraft.world.entity.Entity entity) Sends a packet to all nearby players- Parameters:
entity- The entity to get all players trackingpacket- The packet to send
-
sendToAll
Sends a packet to all players- Parameters:
packet- The packet to send
-
sendToServer
Sends a packet to the server- Parameters:
packet- The packet to send
-
toClientBoundVanillaPacket
public static net.minecraft.network.protocol.Packet<?> toClientBoundVanillaPacket(PixelmonPacket packet) Converts thePixelmonPacketto aPacketthat can be sent to the client using vanilla methods, and theConfigurationTaskmethod- Parameters:
packet- The packet to convert- Returns:
- The converted vanilla packet
-