Record Class QuestRewards
java.lang.Object
java.lang.Record
net.ixdarklord.folios.internal.quest.QuestRewards
public record QuestRewards(List<net.minecraft.world.item.ItemStack> items, List<QuestRewards.Choice> random, int rolls)
extends Record
A quest's
"rewards": items it always gives, and random gifts, each drawn from a list:
"rewards": {
"items": ["minecraft:diamond*3", {"id": "minecraft:potion", "components": {...}}],
"random": [{"item": "minecraft:emerald*4", "weight": 3}, "minecraft:gold_ingot*8"],
"random_rolls": 1
}
Read the same way on the server, which gives them, and on the client, which shows them.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA random gift's choice, pickedweighttimes as often as one of weight 1. -
Constructor Summary
ConstructorsConstructorDescriptionQuestRewards(List<net.minecraft.world.item.ItemStack> items, List<QuestRewards.Choice> random, int rolls) Creates an instance of aQuestRewardsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.voidgive(net.minecraft.server.level.ServerPlayer player) Gives them to a player: into their inventory, or at their feet where it is full; the random gifts drawn now.final inthashCode()Returns a hash code value for this object.booleanisEmpty()List<net.minecraft.world.item.ItemStack> items()Returns the value of theitemsrecord component.random()Returns the value of therandomrecord component.static QuestRewardsread(com.google.gson.JsonObject json, net.minecraft.core.HolderLookup.Provider registries) Rewards as written, their items made with the registries given (the server's, or the client's world's).introlls()Returns the value of therollsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
QuestRewards
public QuestRewards(List<net.minecraft.world.item.ItemStack> items, List<QuestRewards.Choice> random, int rolls) Creates an instance of aQuestRewardsrecord class.- Parameters:
items- the value for theitemsrecord componentrandom- the value for therandomrecord componentrolls- the value for therollsrecord component
-
-
Method Details
-
isEmpty
public boolean isEmpty() -
read
public static QuestRewards read(com.google.gson.JsonObject json, net.minecraft.core.HolderLookup.Provider registries) Rewards as written, their items made with the registries given (the server's, or the client's world's). -
give
public void give(net.minecraft.server.level.ServerPlayer player) Gives them to a player: into their inventory, or at their feet where it is full; the random gifts drawn now. -
toString
-
hashCode
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
items
Returns the value of theitemsrecord component.- Returns:
- the value of the
itemsrecord component
-
random
Returns the value of therandomrecord component.- Returns:
- the value of the
randomrecord component
-
rolls
public int rolls()Returns the value of therollsrecord component.- Returns:
- the value of the
rollsrecord component
-