Class SpiritStateReplicationPacket
java.lang.Object
etithespirit.orimod.networking.spirit.SpiritStateReplicationPacket
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionboolean
If set to true, this packet will attempt to bypass limits where possible.When a client is requesting players from the server, keys should be populated with the desired players' GUIDs and values can be anything, but should be false for the sake of uniformity.
When the server is telling a client (or several clients) about player model statuses, The server will respond with a list of players with true/false set accordingly.
When the client wants to change their model, the key should be the local player's GUID and the value should be their desired state.The type of packet that this is. -
Constructor Summary
ConstructorsConstructorDescriptionSpiritStateReplicationPacket
(SpiritStateReplicationPacket.EventType type, Map<UUID, Boolean> stateMappings) -
Method Summary
Modifier and TypeMethodDescriptionint
hashCode()
static SpiritStateReplicationPacket
toChangeModelOf
(net.minecraft.world.entity.player.Player player, boolean beSpirit) Constructs a packet that aims to change the given player's model.static SpiritStateReplicationPacket
toChangeMyModel
(boolean beSpirit) Constructs a packet that aims to change this player's model.static SpiritStateReplicationPacket
toGetModelsOf
(UUID... players) Constructs a packet that asks the server what the given players are with respect to being a spirit.static SpiritStateReplicationPacket
toGetModelsOf
(net.minecraft.world.entity.player.Player... players) Constructs a packet that asks the server what the given players are with respect to being a spirit.static SpiritStateReplicationPacket
Constructs a packet that asks the server what every player in the server's state is with respect to being a spirit.boolean
wantsToBeSpirit
(UUID byID) boolean
wantsToBeSpirit
(net.minecraft.world.entity.player.Player player)
-
Field Details
-
type
The type of packet that this is. -
playerSpiritStateMappings
When a client is requesting players from the server, keys should be populated with the desired players' GUIDs and values can be anything, but should be false for the sake of uniformity.
When the server is telling a client (or several clients) about player model statuses, The server will respond with a list of players with true/false set accordingly.
When the client wants to change their model, the key should be the local player's GUID and the value should be their desired state. Any attempts to input an ID that does not match the local player will be ignored. -
force
public boolean forceIf set to true, this packet will attempt to bypass limits where possible. This can only be set when the player sending the packet is the op of a server.
-
-
Constructor Details
-
SpiritStateReplicationPacket
public SpiritStateReplicationPacket() -
SpiritStateReplicationPacket
public SpiritStateReplicationPacket(SpiritStateReplicationPacket.EventType type, Map<UUID, Boolean> stateMappings)
-
-
Method Details
-
toChangeMyModel
Constructs a packet that aims to change this player's model. If the player is not authorized to make this change, the server will send anSpiritStateReplicationPacket.EventType.UPDATE_PLAYER_MODELS
call to inform the client of the correct type (the client will make a local change to themselves immediately as to hide network latency, so this is used to undo the change).- Parameters:
beSpirit
- Whether or not the player wants to be a spirit.- Returns:
- A packet that can be sent to the server to change this player's spirit state.
-
toChangeModelOf
public static SpiritStateReplicationPacket toChangeModelOf(net.minecraft.world.entity.player.Player player, boolean beSpirit) Constructs a packet that aims to change the given player's model. If the player is not authorized to make this change, the server will send anSpiritStateReplicationPacket.EventType.UPDATE_PLAYER_MODELS
call to inform the client of the correct type (the client will make a local change to themselves immediately as to hide network latency, so this is used to undo the change).- Parameters:
beSpirit
- Whether or not the player wants to be a spirit.- Returns:
- A packet that can be sent to the server to change this player's spirit state.
-
toGetModelsOfAll
Constructs a packet that asks the server what every player in the server's state is with respect to being a spirit.- Returns:
- A packet that can be sent to the server to acquire whether or not every player in the server is a spirit (individually).
-
toGetModelsOf
Constructs a packet that asks the server what the given players are with respect to being a spirit.- Parameters:
players
- The players to acquire information of. This can be empty to get all players, however it is recommended to usetoGetModelsOfAll()
for this purpose.- Returns:
- A packet that can be sent to the server to acquire whether or not the given players are spirits or not.
-
toGetModelsOf
@ClientUseOnly public static SpiritStateReplicationPacket toGetModelsOf(net.minecraft.world.entity.player.Player... players) Constructs a packet that asks the server what the given players are with respect to being a spirit.- Parameters:
players
- The players to acquire information of. This can be empty to get all players, however it is recommended to usetoGetModelsOfAll()
for this purpose.- Returns:
- A packet that can be sent to the server to acquire whether or not the given players are spirits or not.
-
wantsToBeSpirit
-
wantsToBeSpirit
public boolean wantsToBeSpirit(net.minecraft.world.entity.player.Player player) -
hashCode
public int hashCode()
-