Class SpiritAccessor

java.lang.Object
etithespirit.orimod.api.spirit.SpiritAccessor

public final class SpiritAccessor extends Object
This class allows API users to access whether or not players are spirits.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    _setMethods(Function<net.minecraft.world.entity.player.Player,Boolean> isSpirit, BiConsumer<net.minecraft.world.entity.player.Player,Boolean> setSpirit)
    Strictly for internal use only, attempting to call this method will raise an exception.
    static boolean
    Returns whether or not the real methods are present, as opposed to dummy methods that always return default values or do nothing.
    static boolean
    isSpirit(net.minecraft.world.entity.player.Player playerId)
    Returns whether or not the given player, by ID, is a spirit.
    static void
    onInit(net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent evt)
     
    static void
    setSpirit(net.minecraft.world.entity.player.Player playerId, boolean isSpirit)
    Attempts to set the Spirit state of the player.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SpiritAccessor

      public SpiritAccessor()
  • Method Details

    • hasRealMethods

      public static boolean hasRealMethods()
      Returns whether or not the real methods are present, as opposed to dummy methods that always return default values or do nothing.
      Returns:
      Whether or not the mod is installed and has registered the real-deal methods for this.
    • isSpirit

      public static boolean isSpirit(net.minecraft.world.entity.player.Player playerId)
      Returns whether or not the given player, by ID, is a spirit.
      Parameters:
      playerId - The UUID of the player.
      Returns:
      Whether or not the given player ID is registered as a spirit. Always returns false if hasRealMethods() returns false.
    • setSpirit

      @NetworkReplicated(clientToServer=true) public static void setSpirit(net.minecraft.world.entity.player.Player playerId, boolean isSpirit)
      Attempts to set the Spirit state of the player.
      Parameters:
      playerId - The ID of the player to change.
      isSpirit - Whether or not they should be a spirit.
    • _setMethods

      public static void _setMethods(Function<net.minecraft.world.entity.player.Player,Boolean> isSpirit, BiConsumer<net.minecraft.world.entity.player.Player,Boolean> setSpirit) throws IllegalCallerException
      Strictly for internal use only, attempting to call this method will raise an exception.
      Parameters:
      isSpirit - The isSpirit method.
      setSpirit - The networked setSpirit method.
      Throws:
      IllegalCallerException
    • onInit

      public static void onInit(net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent evt)