Class SpiritStateReplicationPacket

java.lang.Object
etithespirit.orimod.networking.spirit.SpiritStateReplicationPacket

public final class SpiritStateReplicationPacket extends Object
  • Field Details

    • type

      The type of packet that this is.
    • playerSpiritStateMappings

      @Nonnull public Map<UUID,Boolean> 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 force
      If 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

  • Method Details

    • toChangeMyModel

      @ClientUseOnly public static SpiritStateReplicationPacket toChangeMyModel(boolean beSpirit)
      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 an SpiritStateReplicationPacket.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 an SpiritStateReplicationPacket.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

      @ClientUseOnly public static SpiritStateReplicationPacket 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

      @ClientUseOnly public static SpiritStateReplicationPacket toGetModelsOf(UUID... 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 use toGetModelsOfAll() 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 use toGetModelsOfAll() 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

      public boolean wantsToBeSpirit(UUID byID)
    • wantsToBeSpirit

      public boolean wantsToBeSpirit(net.minecraft.world.entity.player.Player player)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object