Package fr.pacdu.pacpackquests.reward
Record Class LevelReward
java.lang.Object
java.lang.Record
fr.pacdu.pacpackquests.reward.LevelReward
- Record Components:
amount- The number of experience levels to add.
- All Implemented Interfaces:
QuestReward
A quest reward that grants experience levels directly to the player.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintamount()Returns the value of theamountrecord component.net.minecraft.world.item.ItemStackcreateIconStack(net.minecraft.core.HolderLookup.Provider registries) Generates a visual ItemStack representing this reward for display in tooltips and menus.final booleanIndicates whether some other object is "equal to" this one.voidgrant(net.minecraft.server.level.ServerPlayer player, net.minecraft.core.RegistryAccess registryManager) Grants the reward to the given server player.final inthashCode()Returns a hash code value for this object.static LevelRewardread(net.minecraft.network.FriendlyByteBuf buf) Reads aLevelRewardfrom the network buffer.final StringtoString()Returns a string representation of this record class.type()Returns the category type of this reward.voidwrite(net.minecraft.network.FriendlyByteBuf buf) Serializes this reward into a network buffer.
-
Constructor Details
-
LevelReward
public LevelReward(int amount) Creates an instance of aLevelRewardrecord class.- Parameters:
amount- the value for theamountrecord component
-
-
Method Details
-
type
Description copied from interface:QuestRewardReturns the category type of this reward.- Specified by:
typein interfaceQuestReward- Returns:
- The
RewardType.
-
grant
public void grant(net.minecraft.server.level.ServerPlayer player, net.minecraft.core.RegistryAccess registryManager) Description copied from interface:QuestRewardGrants the reward to the given server player.- Specified by:
grantin interfaceQuestReward- Parameters:
player- TheServerPlayerclaiming the quest.registryManager- The server registry access.
-
createIconStack
public net.minecraft.world.item.ItemStack createIconStack(net.minecraft.core.HolderLookup.Provider registries) Description copied from interface:QuestRewardGenerates a visual ItemStack representing this reward for display in tooltips and menus.- Specified by:
createIconStackin interfaceQuestReward- Parameters:
registries- The registry lookup provider.- Returns:
- An
ItemStackfor GUI rendering.
-
write
public void write(net.minecraft.network.FriendlyByteBuf buf) Description copied from interface:QuestRewardSerializes this reward into a network buffer.- Specified by:
writein interfaceQuestReward- Parameters:
buf- TheFriendlyByteBufto write into.
-
read
Reads aLevelRewardfrom the network buffer.- Parameters:
buf- The buffer to read from.- Returns:
- The read
LevelReward.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
amount
public int amount()Returns the value of theamountrecord component.- Specified by:
amountin interfaceQuestReward- Returns:
- the value of the
amountrecord component
-