Class SpellManagerDataHolder

java.lang.Object
com.binaris.wizardry.cca.player.SpellManagerDataHolder
All Implemented Interfaces:
SpellManagerData, 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 SpellManagerDataHolder extends Object implements SpellManagerData, dev.onyxstudios.cca.api.v3.component.ComponentV3, dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent
  • Field Details

  • Constructor Details

    • SpellManagerDataHolder

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

    • sync

      public void sync()
      Description copied from interface: SpellManagerData
      Synchronises this SpellManagerData with the client.
      Specified by:
      sync in interface SpellManagerData
    • getVariable

      public <T> T getVariable(ISpellVar<T> var)
      Description copied from interface: SpellManagerData
      Retrieves the value of a specific spell variable.
      Specified by:
      getVariable in interface SpellManagerData
      Type Parameters:
      T - the type of the spell variable
      Parameters:
      var - the spell variable to retrieve
      Returns:
      the value of the specified spell variable
    • setVariable

      public <T> void setVariable(ISpellVar<? super T> variable, T value)
      Description copied from interface: SpellManagerData
      Sets the value of a specific spell variable.
      Specified by:
      setVariable in interface SpellManagerData
      Type Parameters:
      T - the type of the spell variable
      Parameters:
      variable - the spell variable to set
      value - the value to set for the spell variable
    • getSpellData

      public Map<ISpellVar,Object> getSpellData()
      Description copied from interface: SpellManagerData
      Returns a map of all spell variables and their corresponding values.
      Specified by:
      getSpellData in interface SpellManagerData
      Returns:
      a Map containing all spell variables and their values
    • hasSpellBeenDiscovered

      public boolean hasSpellBeenDiscovered(Spell spell)
      Description copied from interface: SpellManagerData
      Checks if the given spell has been discovered by the player.
      Specified by:
      hasSpellBeenDiscovered in interface SpellManagerData
      Parameters:
      spell - the Spell to check
      Returns:
      true if the spell has been discovered, false otherwise
    • discoverSpell

      public boolean discoverSpell(Spell spell)
      Description copied from interface: SpellManagerData
      Marks the given spell as discovered for the player.
      Specified by:
      discoverSpell in interface SpellManagerData
      Parameters:
      spell - the Spell to mark as discovered
      Returns:
      true if the spell was not already discovered, false otherwise
    • undiscoverSpell

      public boolean undiscoverSpell(Spell spell)
      Description copied from interface: SpellManagerData
      Deletes the given spell from the player's discovered spells.
      Specified by:
      undiscoverSpell in interface SpellManagerData
      Parameters:
      spell - the Spell to mark as undiscovered
      Returns:
      true if the spell was previously discovered, false otherwise
    • 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