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
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.
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
FieldsModifier and TypeFieldDescriptionstatic 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
ConstructorsConstructorDescriptionCharm(net.minecraft.network.chat.Component name, net.minecraft.network.chat.Component description, Color color, ResourceWithFallback icon) Creates an instance of aCharmrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncolor()Returns the value of thecolorrecord component.net.minecraft.network.chat.ComponentReturns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.icon()Returns the value of theiconrecord component.net.minecraft.network.chat.Componentname()Returns the value of thenamerecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
-
REGISTRY_KEY
public static final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<Charm>> REGISTRY_KEY -
SHINY_CHARM
-
OVAL_CHARM
-
MARK_CHARM
-
CATCHING_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 aCharmrecord class.- Parameters:
name- the value for thenamerecord componentdescription- the value for thedescriptionrecord componentcolor- the value for thecolorrecord componenticon- the value for theiconrecord component
-
-
Method Details
-
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 withObjects::equals(Object,Object). -
name
public net.minecraft.network.chat.Component name()Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
description
public net.minecraft.network.chat.Component description()Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
color
Returns the value of thecolorrecord component.- Returns:
- the value of the
colorrecord component
-
icon
Returns the value of theiconrecord component.- Returns:
- the value of the
iconrecord component
-