Class SpellManagerDataHolder

java.lang.Object
com.binaris.wizardry.capabilities.SpellManagerDataHolder
All Implemented Interfaces:
SpellManagerData, net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>

public class SpellManagerDataHolder extends Object implements net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>, SpellManagerData
  • Field Details

    • LOCATION

      public static final net.minecraft.resources.ResourceLocation LOCATION
    • INSTANCE

      public static final net.minecraftforge.common.capabilities.Capability<SpellManagerDataHolder> INSTANCE
    • storedVariables

      public static final Set<IStoredSpellVar> storedVariables
    • spellData

      public final Map<ISpellVar,Object> spellData
    • spellsDiscovered

      public Set<Spell> spellsDiscovered
  • Constructor Details

    • SpellManagerDataHolder

      public SpellManagerDataHolder(net.minecraft.world.entity.player.Player player)
  • 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
    • serializeNBT

      public net.minecraft.nbt.CompoundTag serializeNBT()
      Specified by:
      serializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
    • deserializeNBT

      public void deserializeNBT(net.minecraft.nbt.CompoundTag tag)
      Specified by:
      deserializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
    • copyFrom

      public void copyFrom(@NotNull @NotNull SpellManagerDataHolder old)