Record Class Charm

java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.storage.charms.Charm
Record Components:
name - The name of the charm, shown in the UI.
description - A brief description of what the charm does, shown in the UI.
color - The color of the charm, used for the charm's icon and other UI elements.
icon - The icon of the charm, shown in the UI. This is a texture that can be provided by a resource pack.

public record Charm(net.minecraft.network.chat.Component name, net.minecraft.network.chat.Component description, Color color, ResourceWithFallback icon) extends Record
A Charm is a toggle that all players can unlock for different benefits. They are stored in the PlayerPartyStorage and can be checked for in various places in the code to provide benefits to the player.
For example, the Shiny Charm provides a higher chance of a shiny Pokemon spawning around the player.
These are provided through the datapack registry system, and can be added to through datapacks. They are stored in the "charms" registry.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.resources.ResourceKey<Charm>
     
    static final com.mojang.serialization.Codec<Charm>
     
    static final net.minecraft.resources.ResourceKey<Charm>
     
    static final net.minecraft.resources.ResourceKey<Charm>
     
    static final net.minecraft.resources.ResourceKey<Charm>
     
    static final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<Charm>>
     
    static final net.minecraft.resources.ResourceKey<Charm>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Charm(net.minecraft.network.chat.Component name, net.minecraft.network.chat.Component description, Color color, ResourceWithFallback icon)
    Creates an instance of a Charm record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the color record component.
    net.minecraft.network.chat.Component
    Returns the value of the description record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the icon record component.
    net.minecraft.network.chat.Component
    Returns the value of the name 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
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<Charm> CODEC
    • REGISTRY_KEY

      public static final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<Charm>> REGISTRY_KEY
    • SHINY_CHARM

      public static final net.minecraft.resources.ResourceKey<Charm> SHINY_CHARM
    • OVAL_CHARM

      public static final net.minecraft.resources.ResourceKey<Charm> OVAL_CHARM
    • MARK_CHARM

      public static final net.minecraft.resources.ResourceKey<Charm> MARK_CHARM
    • CATCHING_CHARM

      public static final net.minecraft.resources.ResourceKey<Charm> CATCHING_CHARM
    • EXP_CHARM

      public static final net.minecraft.resources.ResourceKey<Charm> EXP_CHARM
  • Constructor Details

    • Charm

      public Charm(net.minecraft.network.chat.Component name, net.minecraft.network.chat.Component description, Color color, ResourceWithFallback icon)
      Creates an instance of a Charm record class.
      Parameters:
      name - the value for the name record component
      description - the value for the description record component
      color - the value for the color record component
      icon - the value for the icon record component
  • Method Details

    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • name

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

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

      public Color color()
      Returns the value of the color record component.
      Returns:
      the value of the color record component
    • icon

      public ResourceWithFallback icon()
      Returns the value of the icon record component.
      Returns:
      the value of the icon record component