java.lang.Object
java.lang.Record
com.github.minecraftschurlimods.arsmagicalegacy.api.spell.PrefabSpell
All Implemented Interfaces:
IPrefabSpell

public record PrefabSpell(net.minecraft.network.chat.Component name, ISpell spell, net.minecraft.resources.ResourceLocation icon) extends Record implements IPrefabSpell
  • Field Summary

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

    Constructors
    Constructor
    Description
    PrefabSpell(net.minecraft.network.chat.Component name, ISpell spell, net.minecraft.resources.ResourceLocation icon)
    Creates an instance of a PrefabSpell record class.
  • Method Summary

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

    • SPELL_PREFAB_NAME

      public static final String SPELL_PREFAB_NAME
      See Also:
    • REGISTRY_KEY

      public static final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<PrefabSpell>> REGISTRY_KEY
    • DIRECT_CODEC

      public static final com.mojang.serialization.Codec<PrefabSpell> DIRECT_CODEC
    • REFERENCE_CODEC

      public static final com.mojang.serialization.Codec<net.minecraft.core.Holder<PrefabSpell>> REFERENCE_CODEC
    • LIST_CODEC

      public static final com.mojang.serialization.Codec<net.minecraft.core.HolderSet<PrefabSpell>> LIST_CODEC
  • Constructor Details

    • PrefabSpell

      public PrefabSpell(net.minecraft.network.chat.Component name, ISpell spell, net.minecraft.resources.ResourceLocation icon)
      Creates an instance of a PrefabSpell record class.
      Parameters:
      name - the value for the name record component
      spell - the value for the spell record component
      icon - the value for the icon record component
  • Method Details

    • makeSpell

      public net.minecraft.world.item.ItemStack makeSpell()
      Specified by:
      makeSpell in interface IPrefabSpell
      Returns:
      A spell item stack built from this prefab spell.
    • 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.
      Specified by:
      name in interface IPrefabSpell
      Returns:
      the value of the name record component
    • spell

      public ISpell spell()
      Returns the value of the spell record component.
      Specified by:
      spell in interface IPrefabSpell
      Returns:
      the value of the spell record component
    • icon

      public net.minecraft.resources.ResourceLocation icon()
      Returns the value of the icon record component.
      Specified by:
      icon in interface IPrefabSpell
      Returns:
      the value of the icon record component