Class SpellGlyphData
java.lang.Object
net.minecraft.world.level.saveddata.SavedData
com.binaris.wizardry.content.data.SpellGlyphData
public class SpellGlyphData
extends net.minecraft.world.level.saveddata.SavedData
This class is responsible for storing and managing the random names and descriptions assigned to spell glyphs, this
is when the player don't know what a spell does and they have to identify it first, all the scrolls/books showing
that spell will then have the same random name/description. The names and descriptions are generated randomly when
the world is first created and saved to disk.
Note that this data is stored per-world, not per-player, so all players in the same world will see the same random names/descriptions for spell glyphs.
-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerateGlyphNames(net.minecraft.world.level.Level world) static SpellGlyphDataget(net.minecraft.server.level.ServerLevel world) Retrieves the SpellGlyphData instance for the given world, creating and populating it if it doesn't already exist.static StringgetGlyphDescription(Spell spell, SpellGlyphData data) static StringgetGlyphDescription(Spell spell, net.minecraft.server.level.ServerLevel world) static StringgetGlyphName(Spell spell, SpellGlyphData data) static StringgetGlyphName(Spell spell, net.minecraft.server.level.ServerLevel world) static net.minecraft.network.chat.ComponentgetGlyphNameFormatted(Spell spell, SpellGlyphData data) static SpellGlyphDataload(net.minecraft.nbt.CompoundTag nbt) static void@NotNull net.minecraft.nbt.CompoundTagsave(@NotNull net.minecraft.nbt.CompoundTag nbt) voidsync(net.minecraft.server.level.ServerPlayer player) Methods inherited from class net.minecraft.world.level.saveddata.SavedData
isDirty, save, setDirty, setDirty
-
Field Details
-
randomNames
-
randomDescriptions
-
-
Constructor Details
-
SpellGlyphData
public SpellGlyphData()
-
-
Method Details
-
get
Retrieves the SpellGlyphData instance for the given world, creating and populating it if it doesn't already exist. This also ensures that all registered spells have entries in the data, adding any that are missing (for example, due to addons being installed or spells being renamed).- Parameters:
world- The server level to get the SpellGlyphData for.- Returns:
- The SpellGlyphData instance for the given world.
-
getGlyphNameFormatted
public static net.minecraft.network.chat.Component getGlyphNameFormatted(Spell spell, SpellGlyphData data) -
getGlyphName
-
getGlyphDescription
-
getGlyphName
-
getGlyphDescription
-
load
-
onServerLevelLoad
-
generateGlyphNames
public void generateGlyphNames(net.minecraft.world.level.Level world) -
sync
public void sync(net.minecraft.server.level.ServerPlayer player) -
save
@NotNull public @NotNull net.minecraft.nbt.CompoundTag save(@NotNull @NotNull net.minecraft.nbt.CompoundTag nbt) - Specified by:
savein classnet.minecraft.world.level.saveddata.SavedData
-