Package com.binaris.wizardry.cca.player
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.binaris.wizardry.api.content.data.WizardData
WizardData.RecentSpellCast -
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcountRecentCasts(Spell spell) Counts how many times a spell has been cast recently by the player.Gets a Random instance associated with this WizardData.@Nullable WizardData.RecentSpellCastGets the most recently cast spell by the player.Gets the recent spells cast by the player.Gets the spell modifiers associated with the player.booleanhasReachedTier(SpellTier tier) Checks if the player has reached the specified spell tier.booleanisPlayerAlly(UUID playerUUID) Checks if the given player UUID is an ally of the original player.booleanisPlayerAlly(net.minecraft.world.entity.player.Player ally) Checks if the given player is an ally of the original player.voidreadFromNbt(@NotNull net.minecraft.nbt.CompoundTag tag) voidremoveRecentCasts(Predicate<WizardData.RecentSpellCast> predicate) Removes recent spell casts that match the given predicate, allowing for custom filtering of which entries to remove.voidsetSpellModifiers(SpellModifiers modifiers) voidsetTierReached(SpellTier tier) Sets the highest spell tier reached by the player, use this with caution as it can only be increased.booleantoggleAlly(net.minecraft.world.entity.player.Player friend) Toggles the ally status of a friend for the original player.voidtrackRecentSpell(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.voidwriteToNbt(@NotNull net.minecraft.nbt.CompoundTag tag) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent
applySyncPacket, shouldSyncWith, writeSyncPacketMethods inherited from interface dev.onyxstudios.cca.api.v3.component.Component
equals
-
Field Details
-
allies
-
allyNames
-
itemModifiers
-
-
Constructor Details
-
WizardDataHolder
public WizardDataHolder(net.minecraft.world.entity.player.Player provider)
-
-
Method Details
-
setTierReached
Description copied from interface:WizardDataSets the highest spell tier reached by the player, use this with caution as it can only be increased.- Specified by:
setTierReachedin interfaceWizardData- Parameters:
tier- The SpellTier to set as reached.
-
hasReachedTier
Description copied from interface:WizardDataChecks if the player has reached the specified spell tier.- Specified by:
hasReachedTierin interfaceWizardData- 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:WizardDataToggles the ally status of a friend for the original player.- Specified by:
toggleAllyin interfaceWizardData- 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:WizardDataChecks 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:
isPlayerAllyin interfaceWizardData- Parameters:
ally- the Player to check- Returns:
- true if the player is an ally, false otherwise
-
isPlayerAlly
Description copied from interface:WizardDataChecks 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:
isPlayerAllyin interfaceWizardData- Parameters:
playerUUID- the UUID of the player to check- Returns:
- true if the player is an ally, false otherwise
-
getSpellModifiers
Description copied from interface:WizardDataGets the spell modifiers associated with the player.- Specified by:
getSpellModifiersin interfaceWizardData- Returns:
- The SpellModifiers for the player.
-
setSpellModifiers
- Specified by:
setSpellModifiersin interfaceWizardData
-
trackRecentSpell
Description copied from interface:WizardDataRecords 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:
trackRecentSpellin interfaceWizardData- Parameters:
spell- The Spell that was just cast.timestamp- The time at which the spell was cast, in game ticks.
-
countRecentCasts
Description copied from interface:WizardDataCounts 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:
countRecentCastsin interfaceWizardData- Parameters:
spell- The Spell to count recent casts of.- Returns:
- The number of times the spell has been cast recently.
-
getRecentSpells
Description copied from interface:WizardDataGets the recent spells cast by the player.- Specified by:
getRecentSpellsin interfaceWizardData- Returns:
- A list of recent spells cast by the player.
-
getRecentlyCastSpell
Description copied from interface:WizardDataGets the most recently cast spell by the player.- Specified by:
getRecentlyCastSpellin interfaceWizardData- Returns:
- The most recently cast spell by the player, or null if no spells have been cast recently.
-
removeRecentCasts
Description copied from interface:WizardDataRemoves recent spell casts that match the given predicate, allowing for custom filtering of which entries to remove.- Specified by:
removeRecentCastsin interfaceWizardData- 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
Description copied from interface:WizardDataGets a Random instance associated with this WizardData.- Specified by:
getRandomin interfaceWizardData- Returns:
- A Random instance.
-
readFromNbt
public void readFromNbt(@NotNull @NotNull net.minecraft.nbt.CompoundTag tag) - Specified by:
readFromNbtin interfacedev.onyxstudios.cca.api.v3.component.Component
-
writeToNbt
public void writeToNbt(@NotNull @NotNull net.minecraft.nbt.CompoundTag tag) - Specified by:
writeToNbtin interfacedev.onyxstudios.cca.api.v3.component.Component
-