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>
  • Constructor Summary

    Constructors
    Constructor
    Description
    Disease(net.minecraft.resources.ResourceLocation id, net.minecraft.network.chat.Component name, int rarity, List<ItemStorage> cureItems)
    Creates an instance of a Disease record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the cureItems record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    net.minecraft.network.chat.Component
    Get the cure string containing all items required for the cure.
    @NotNull net.minecraft.util.random.Weight
     
    static Predicate<net.minecraft.world.item.ItemStack>
    Predicate for the different usages to check if inventory contains a cure.
    final int
    Returns a hash code value for this object.
    net.minecraft.resources.ResourceLocation
    id()
    Returns the value of the id record component.
    static boolean
    isCureItem(net.minecraft.world.item.ItemStack stack, ItemStorage cure)
    Check if the given item is a cure item.
    net.minecraft.network.chat.Component
    Returns the value of the name record component.
    int
    Returns the value of the rarity record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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 a Disease record class.
      Parameters:
      id - the value for the id record component
      name - the value for the name record component
      rarity - the value for the rarity record component
      cureItems - the value for the cureItems record component
  • Method Details

    • hasCureItem

      public static Predicate<net.minecraft.world.item.ItemStack> hasCureItem(ItemStorage cure)
      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

      public static boolean isCureItem(net.minecraft.world.item.ItemStack stack, ItemStorage cure)
      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:
      getWeight in interface net.minecraft.util.random.WeightedEntry
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public net.minecraft.resources.ResourceLocation id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • name

      public net.minecraft.network.chat.Component name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • rarity

      public int rarity()
      Returns the value of the rarity record component.
      Returns:
      the value of the rarity record component
    • cureItems

      public List<ItemStorage> cureItems()
      Returns the value of the cureItems record component.
      Returns:
      the value of the cureItems record component