Class WizardDataHolder

java.lang.Object
com.binaris.wizardry.cca.player.WizardDataHolder
All Implemented Interfaces:
WizardData, dev.onyxstudios.cca.api.v3.component.Component, dev.onyxstudios.cca.api.v3.component.ComponentV3, dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent, dev.onyxstudios.cca.api.v3.component.sync.ComponentPacketWriter, dev.onyxstudios.cca.api.v3.component.sync.PlayerSyncPredicate

public class WizardDataHolder extends Object implements WizardData, dev.onyxstudios.cca.api.v3.component.ComponentV3, dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final Set<UUID>
     
     
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    WizardDataHolder(net.minecraft.world.entity.player.Player provider)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Counts how many times a spell has been cast recently by the player.
    Gets a Random instance associated with this WizardData.
    Gets the spell modifiers associated with the player.
    boolean
    Checks if the player has reached the specified spell tier.
    boolean
    isPlayerAlly(UUID playerUUID)
    Checks if the given player UUID is an ally of the original player.
    boolean
    isPlayerAlly(net.minecraft.world.entity.player.Player ally)
    Checks if the given player is an ally of the original player.
    void
    readFromNbt(@NotNull net.minecraft.nbt.CompoundTag tag)
     
    void
    Removes recent spell casts that match the given predicate, allowing for custom filtering of which entries to remove.
    void
     
    void
    Sets the highest spell tier reached by the player, use this with caution as it can only be increased.
    boolean
    toggleAlly(net.minecraft.world.entity.player.Player friend)
    Toggles the ally status of a friend for the original player.
    void
    trackRecentSpell(Spell spell, long timestamp)
    Records a spell cast for tracking recent spells by the player, used especially to avoid spell spam for quick wand level progression and similar things.
    void
    writeToNbt(@NotNull net.minecraft.nbt.CompoundTag tag)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent

    applySyncPacket, shouldSyncWith, writeSyncPacket

    Methods inherited from interface dev.onyxstudios.cca.api.v3.component.Component

    equals
  • Field Details

  • Constructor Details

    • WizardDataHolder

      public WizardDataHolder(net.minecraft.world.entity.player.Player provider)
  • Method Details

    • setTierReached

      public void setTierReached(SpellTier tier)
      Description copied from interface: WizardData
      Sets the highest spell tier reached by the player, use this with caution as it can only be increased.
      Specified by:
      setTierReached in interface WizardData
      Parameters:
      tier - The SpellTier to set as reached.
    • hasReachedTier

      public boolean hasReachedTier(SpellTier tier)
      Description copied from interface: WizardData
      Checks if the player has reached the specified spell tier.
      Specified by:
      hasReachedTier in interface WizardData
      Parameters:
      tier - The SpellTier to check.
      Returns:
      true if the player has reached the specified tier, false otherwise.
    • toggleAlly

      public boolean toggleAlly(net.minecraft.world.entity.player.Player friend)
      Description copied from interface: WizardData
      Toggles the ally status of a friend for the original player.
      Specified by:
      toggleAlly in interface WizardData
      Parameters:
      friend - The player whose ally status is being toggled.
      Returns:
      true if the friend was added as an ally, false if they were removed.
    • isPlayerAlly

      public boolean isPlayerAlly(net.minecraft.world.entity.player.Player ally)
      Description copied from interface: WizardData
      Checks if the given player is an ally of the original player. This checks both the list of ally UUIDs and the original player's team.
      Specified by:
      isPlayerAlly in interface WizardData
      Parameters:
      ally - the Player to check
      Returns:
      true if the player is an ally, false otherwise
    • isPlayerAlly

      public boolean isPlayerAlly(UUID playerUUID)
      Description copied from interface: WizardData
      Checks if the given player UUID is an ally of the original player. This checks both the list of ally UUIDs and the original player's team.
      Specified by:
      isPlayerAlly in interface WizardData
      Parameters:
      playerUUID - the UUID of the player to check
      Returns:
      true if the player is an ally, false otherwise
    • getSpellModifiers

      public SpellModifiers getSpellModifiers()
      Description copied from interface: WizardData
      Gets the spell modifiers associated with the player.
      Specified by:
      getSpellModifiers in interface WizardData
      Returns:
      The SpellModifiers for the player.
    • setSpellModifiers

      public void setSpellModifiers(SpellModifiers modifiers)
      Specified by:
      setSpellModifiers in interface WizardData
    • trackRecentSpell

      public void trackRecentSpell(Spell spell, long timestamp)
      Description copied from interface: WizardData
      Records a spell cast for tracking recent spells by the player, used especially to avoid spell spam for quick wand level progression and similar things.
      Specified by:
      trackRecentSpell in interface WizardData
      Parameters:
      spell - The Spell that was just cast.
      timestamp - The time at which the spell was cast, in game ticks.
    • countRecentCasts

      public int countRecentCasts(Spell spell)
      Description copied from interface: WizardData
      Counts how many times a spell has been cast recently by the player. It could be 0 if it hasn't been cast recently.
      Specified by:
      countRecentCasts in interface WizardData
      Parameters:
      spell - The Spell to count recent casts of.
      Returns:
      The number of times the spell has been cast recently.
    • removeRecentCasts

      public void removeRecentCasts(Predicate<AbstractMap.SimpleEntry<Spell,Long>> predicate)
      Description copied from interface: WizardData
      Removes recent spell casts that match the given predicate, allowing for custom filtering of which entries to remove.
      Specified by:
      removeRecentCasts in interface WizardData
      Parameters:
      predicate - A Predicate that tests AbstractMap.SimpleEntry<Spell, Long> objects representing recent spell casts. If the predicate returns true for an entry, that entry will be removed.
    • getRandom

      public Random getRandom()
      Description copied from interface: WizardData
      Gets a Random instance associated with this WizardData.
      Specified by:
      getRandom in interface WizardData
      Returns:
      A Random instance.
    • readFromNbt

      public void readFromNbt(@NotNull @NotNull net.minecraft.nbt.CompoundTag tag)
      Specified by:
      readFromNbt in interface dev.onyxstudios.cca.api.v3.component.Component
    • writeToNbt

      public void writeToNbt(@NotNull @NotNull net.minecraft.nbt.CompoundTag tag)
      Specified by:
      writeToNbt in interface dev.onyxstudios.cca.api.v3.component.Component