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
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraftforge.common.capabilities.Capability<SpellManagerDataHolder>static final net.minecraft.resources.ResourceLocationstatic final Set<IStoredSpellVar> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcopyFrom(@NotNull SpellManagerDataHolder old) voiddeserializeNBT(net.minecraft.nbt.CompoundTag tag) booleandiscoverSpell(Spell spell) Marks the given spell as discovered for the player.Returns a map of all spell variables and their corresponding values.<T> TgetVariable(ISpellVar<T> var) Retrieves the value of a specific spell variable.booleanhasSpellBeenDiscovered(Spell spell) Checks if the given spell has been discovered by the player.net.minecraft.nbt.CompoundTag<T> voidsetVariable(ISpellVar<? super T> variable, T value) Sets the value of a specific spell variable.voidsync()Synchronises this SpellManagerData with the client.booleanundiscoverSpell(Spell spell) Deletes the given spell from the player's discovered spells.
-
Field Details
-
LOCATION
public static final net.minecraft.resources.ResourceLocation LOCATION -
INSTANCE
public static final net.minecraftforge.common.capabilities.Capability<SpellManagerDataHolder> INSTANCE -
storedVariables
-
spellData
-
spellsDiscovered
-
-
Constructor Details
-
SpellManagerDataHolder
public SpellManagerDataHolder(net.minecraft.world.entity.player.Player player)
-
-
Method Details
-
sync
public void sync()Description copied from interface:SpellManagerDataSynchronises this SpellManagerData with the client.- Specified by:
syncin interfaceSpellManagerData
-
getVariable
Description copied from interface:SpellManagerDataRetrieves the value of a specific spell variable.- Specified by:
getVariablein interfaceSpellManagerData- 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
Description copied from interface:SpellManagerDataSets the value of a specific spell variable.- Specified by:
setVariablein interfaceSpellManagerData- Type Parameters:
T- the type of the spell variable- Parameters:
variable- the spell variable to setvalue- the value to set for the spell variable
-
getSpellData
Description copied from interface:SpellManagerDataReturns a map of all spell variables and their corresponding values.- Specified by:
getSpellDatain interfaceSpellManagerData- Returns:
- a Map containing all spell variables and their values
-
hasSpellBeenDiscovered
Description copied from interface:SpellManagerDataChecks if the given spell has been discovered by the player.- Specified by:
hasSpellBeenDiscoveredin interfaceSpellManagerData- Parameters:
spell- the Spell to check- Returns:
- true if the spell has been discovered, false otherwise
-
discoverSpell
Description copied from interface:SpellManagerDataMarks the given spell as discovered for the player.- Specified by:
discoverSpellin interfaceSpellManagerData- Parameters:
spell- the Spell to mark as discovered- Returns:
- true if the spell was not already discovered, false otherwise
-
undiscoverSpell
Description copied from interface:SpellManagerDataDeletes the given spell from the player's discovered spells.- Specified by:
undiscoverSpellin interfaceSpellManagerData- 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:
serializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
deserializeNBT
public void deserializeNBT(net.minecraft.nbt.CompoundTag tag) - Specified by:
deserializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
copyFrom
-