Record Class Disease
java.lang.Object
java.lang.Record
com.minecolonies.core.datalistener.model.Disease
- Record Components:
id- the id of the disease.name- the name of the disease.rarity- the rarity of the disease.cureItems- the list of items needed to heal.
- All Implemented Interfaces:
net.minecraft.util.random.WeightedEntry
public record Disease(net.minecraft.resources.ResourceLocation id, net.minecraft.network.chat.Component name, int rarity, List<ItemStorage> cureItems)
extends Record
implements net.minecraft.util.random.WeightedEntry
A possible disease.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.util.random.WeightedEntry
net.minecraft.util.random.WeightedEntry.IntrusiveBase, net.minecraft.util.random.WeightedEntry.Wrapper<T extends Object> -
Constructor Summary
ConstructorsConstructorDescriptionDisease(net.minecraft.resources.ResourceLocation id, net.minecraft.network.chat.Component name, int rarity, List<ItemStorage> cureItems) Creates an instance of aDiseaserecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecureItemsrecord component.final booleanIndicates whether some other object is "equal to" this one.net.minecraft.network.chat.ComponentGet the cure string containing all items required for the cure.@NotNull net.minecraft.util.random.Weightstatic Predicate<net.minecraft.world.item.ItemStack>hasCureItem(ItemStorage cure) Predicate for the different usages to check if inventory contains a cure.final inthashCode()Returns a hash code value for this object.net.minecraft.resources.ResourceLocationid()Returns the value of theidrecord component.static booleanisCureItem(net.minecraft.world.item.ItemStack stack, ItemStorage cure) Check if the given item is a cure item.net.minecraft.network.chat.Componentname()Returns the value of thenamerecord component.intrarity()Returns the value of therarityrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Disease
public Disease(net.minecraft.resources.ResourceLocation id, net.minecraft.network.chat.Component name, int rarity, List<ItemStorage> cureItems) Creates an instance of aDiseaserecord class.
-
-
Method Details
-
hasCureItem
Predicate for the different usages to check if inventory contains a cure.- Parameters:
cure- the expected cure item.- Returns:
- the predicate for checking if the cure exists.
-
isCureItem
Check if the given item is a cure item.- Parameters:
stack- the input stack.cure- the cure item.- Returns:
- true if so.
-
getCureString
public net.minecraft.network.chat.Component getCureString()Get the cure string containing all items required for the cure.- Returns:
- the cure string.
-
getWeight
@NotNull public @NotNull net.minecraft.util.random.Weight getWeight()- Specified by:
getWeightin interfacenet.minecraft.util.random.WeightedEntry
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
id
public net.minecraft.resources.ResourceLocation id()Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
name
public net.minecraft.network.chat.Component name()Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
rarity
public int rarity()Returns the value of therarityrecord component.- Returns:
- the value of the
rarityrecord component
-
cureItems
Returns the value of thecureItemsrecord component.- Returns:
- the value of the
cureItemsrecord component
-