Interface PlayerResearch
- All Known Subinterfaces:
ServerPlayerResearch
- All Known Implementing Classes:
ClientResearch
,PixelmonPlayerResearch
public interface PlayerResearch
This interface represents data stored about the player's progress on the
Research
.-
Method Summary
Modifier and TypeMethodDescriptionboolean
abandon()
Abandons the research, if able to.void
complete()
Completes the research.void
Completes the currentPlayerResearchStage
and progresses to the next stage.void
deserialize
(net.minecraft.nbt.CompoundTag tag) Deserializes the player research from aCompoundTag
.boolean
handleInteractionEvent
(InteractionEvent event, InteractionContext context) Handles anInteractionEvent
that the player has triggered.default boolean
default boolean
boolean
boolean
@Nullable ResearchStage
net.minecraft.world.entity.player.Player
owner()
Gets the player which this research is for.net.minecraft.nbt.CompoundTag
Serializes the player research to aCompoundTag
.storage()
Gets the storage which this research is for.void
Toggles the favorite state of this research.type()
default void
update()
Sends this research to the player which it is for.default void
update
(boolean remove) Sends this research to the player which it is for.uuid()
Gets the UUID of this research instance.default void
write
(net.minecraft.network.FriendlyByteBuf buffer) Writes the player research into a buffer, for reading byClientResearch
later.
-
Method Details
-
uuid
UUID uuid()Gets the UUID of this research instance.- Returns:
- The UUID of this.
-
type
Research type()- Returns:
- The
Research
that this player research is for.
-
owner
net.minecraft.world.entity.player.Player owner()Gets the player which this research is for.- Returns:
- The player which this is for.
-
storage
ResearchStorage storage()Gets the storage which this research is for.- Returns:
- The storage which this is for.
-
currentStage
PlayerResearchStage currentStage()- Returns:
- The current
PlayerResearchStage
that the player is on.
-
nextStage
- Returns:
- The next
ResearchStage
that the player will progress to.
-
isFavorite
boolean isFavorite()- Returns:
- Whether this research is marked as a favorite.
-
toggleFavorite
void toggleFavorite()Toggles the favorite state of this research. -
isComplete
boolean isComplete()- Returns:
- Whether the player has completed the research.
-
handleInteractionEvent
Handles anInteractionEvent
that the player has triggered.- Parameters:
event
- The event that the player has triggered.context
- The context of the interaction.- Returns:
- If the event caused the research to progress (not complete).
-
complete
void complete()Completes the research. -
completeStage
void completeStage()Completes the currentPlayerResearchStage
and progresses to the next stage.
This will also callcomplete()
if the player has completed the research. -
abandon
boolean abandon()Abandons the research, if able to.- Returns:
- Whether this research was abandoned or not.
-
serialize
net.minecraft.nbt.CompoundTag serialize()Serializes the player research to aCompoundTag
.- Returns:
- The serialized player research.
-
deserialize
void deserialize(net.minecraft.nbt.CompoundTag tag) Deserializes the player research from aCompoundTag
.- Parameters:
tag
- The tag to deserialize from.
-
isAssignment
default boolean isAssignment()- Returns:
- Whether this research is an assignment.
-
isCollection
default boolean isCollection()- Returns:
- Whether this research is a collection.
-
update
default void update()Sends this research to the player which it is for. -
update
default void update(boolean remove) Sends this research to the player which it is for.- Parameters:
remove
- Whether to mark this research for removal on the client.
-
write
default void write(net.minecraft.network.FriendlyByteBuf buffer) Writes the player research into a buffer, for reading byClientResearch
later.- Parameters:
buffer
- The buffer to write to.
-