Interface ResearchStorage
- All Known Implementing Classes:
PixelmonResearchStorage
public interface ResearchStorage
This interface represents the storage of research data for a player.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears all research data.void
deserialize
(net.minecraft.nbt.CompoundTag tag) Deserializes the research storage from aCompoundTag
.boolean
discardResearch
(PlayerResearch research) Discards the research.findResearch
(Research research) Finds all active research the player has of that type.findResearch
(UUID uuid) Finds the active research the player has with the given UUID, or null if not present.@Nullable net.minecraft.server.level.ServerPlayer
getOwner()
void
handleInteractionEvent
(InteractionEvent event, InteractionContext context) Handles anInteractionEvent
that the player has triggered.void
markComplete
(PlayerResearch research) Marks the research as complete.void
removeResearch
(PlayerResearch research) Removes the research from the storage bypassing the check for if theResearch
isResearch.abandonable()
.net.minecraft.nbt.CompoundTag
Serializes the research storage.boolean
startResearch
(Research research) Starts a new research for the player.void
Updates all research data.
-
Method Details
-
getUniqueId
UUID getUniqueId()- Returns:
- The unique identifier of the player.
-
getOwner
@Nullable @Nullable net.minecraft.server.level.ServerPlayer getOwner()- Returns:
- The owner of the research storage.
-
handleInteractionEvent
Handles anInteractionEvent
that the player has triggered.- Parameters:
event
- The event that the player has triggered.context
- The context of the interaction.
-
activeResearch
Collection<PlayerResearch> activeResearch()- Returns:
- The collection of active research that the player is currently researching.
-
findResearch
Finds all active research the player has of that type.- Parameters:
research
- The research to find.- Returns:
- The list of research that the player has found.
-
findResearch
Finds the active research the player has with the given UUID, or null if not present.- Parameters:
uuid
- The UUID to find.- Returns:
- The research with the given UUID, or null if not present.
-
startResearch
Starts a new research for the player.- Parameters:
research
- The research to start.
-
markComplete
Marks the research as complete.- Parameters:
research
- The research to mark as complete.
-
discardResearch
Discards the research.- Parameters:
research
- The research to discard.- Returns:
- Whether this research was discarded or not.
-
removeResearch
Removes the research from the storage bypassing the check for if theResearch
isResearch.abandonable()
.- Parameters:
research
- The research to remove.
-
clear
void clear()Clears all research data. -
updateAll
void updateAll()Updates all research data. -
serialize
net.minecraft.nbt.CompoundTag serialize()Serializes the research storage.- Returns:
- The serialized form of the research storage.
-
deserialize
void deserialize(net.minecraft.nbt.CompoundTag tag) Deserializes the research storage from aCompoundTag
.- Parameters:
tag
- The tag to deserialize.
-