Class PlayerPositionPacket
java.lang.Object
org.cyclops.cyclopscore.network.PacketBase
org.cyclops.cyclopscore.network.PacketCodec
org.cyclops.cyclopscore.network.packet.PlayerPositionPacket
- Direct Known Subclasses:
RingOfFirePacket
An abstract superclass for all packets that contain the position and uuid
of a player and execute a specific action on the client side that is visible by
all players in a specific range around the given player.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.cyclops.cyclopscore.network.PacketCodec
PacketCodec.ICodecAction, PacketCodec.ICodecRunnable -
Field Summary
FieldsFields inherited from class org.cyclops.cyclopscore.network.PacketCodec
fieldCache, READ_STRING_MAX_LENGTH -
Constructor Summary
ConstructorsConstructorDescriptionCreates a packet with no contentPlayerPositionPacket(net.minecraft.world.entity.player.Player player) Creates a PlayerPositionPacket which contains the player data.PlayerPositionPacket(net.minecraft.world.entity.player.Player player, int range) Creates a PlayerPositionPacket which contains the player data and will be sent to all players in the specified range of the player. -
Method Summary
Modifier and TypeMethodDescriptionvoidactionClient(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player) Actions for client-side.voidactionServer(net.minecraft.world.level.Level level, net.minecraft.server.level.ServerPlayer player) Actions for server-side.protected abstract PlayerPositionPacketcreate(net.minecraft.world.entity.player.Player player, int range) protected abstract ModBasebooleanisAsync()protected abstract voidperformClientAction(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player) Methods inherited from class org.cyclops.cyclopscore.network.PacketCodec
addCodedAction, decode, encode, getAction, getActionSuper, read, write
-
Field Details
-
uuid
-
position
protected net.minecraft.world.phys.Vec3 position
-
-
Constructor Details
-
PlayerPositionPacket
public PlayerPositionPacket()Creates a packet with no content -
PlayerPositionPacket
public PlayerPositionPacket(net.minecraft.world.entity.player.Player player) Creates a PlayerPositionPacket which contains the player data.- Parameters:
player- The player data.
-
PlayerPositionPacket
public PlayerPositionPacket(net.minecraft.world.entity.player.Player player, int range) Creates a PlayerPositionPacket which contains the player data and will be sent to all players in the specified range of the player.- Parameters:
player- The player data.range- The range around the player.
-
-
Method Details
-
isAsync
public boolean isAsync()- Specified by:
isAsyncin classPacketBase- Returns:
- If this packet can run on a thread other than the main-thread of Minecraft. If this is asynchronous, the player parameter inside the action is not guaranteed to be defined.
-
actionClient
public void actionClient(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player) Description copied from class:PacketBaseActions for client-side.- Specified by:
actionClientin classPacketBase- Parameters:
level- The world.player- The player. Can be null if this packet is asynchronous.
-
actionServer
public void actionServer(net.minecraft.world.level.Level level, net.minecraft.server.level.ServerPlayer player) Description copied from class:PacketBaseActions for server-side.- Specified by:
actionServerin classPacketBase- Parameters:
level- The world.player- The player.
-
create
protected abstract PlayerPositionPacket create(net.minecraft.world.entity.player.Player player, int range) -
getModInstance
-
performClientAction
protected abstract void performClientAction(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player)
-