Record Class Ritual<T>

java.lang.Object
java.lang.Record
at.minecraftschurli.mods.arsmagicalegacy.api.ritual.Ritual<T>
Type Parameters:
T - The trigger context type.
Record Components:
requirements - The passive requirements of the ritual.
trigger - The active trigger of the ritual. May itself contain requirements.
effects - The effects to perform when the ritual is successfully triggered.

public record Ritual<T>(List<RitualRequirement> requirements, RitualTrigger<T> trigger, List<RitualEffect> effects) extends Record
Represents a ritual. A ritual can be triggered, in which case it performs the ritual effect.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<net.minecraft.core.Holder<Ritual<?>>>
     
    static final com.mojang.serialization.Codec<Ritual<?>>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Ritual(List<RitualRequirement> requirements, RitualTrigger<T> trigger, List<RitualEffect> effects)
    Creates an instance of a Ritual record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the effects record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    static <T> void
    perform(com.mojang.serialization.MapCodec<? extends T> codec, @Nullable net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 vec, T context)
    Performs all rituals of the given codec type.
    void
    perform(@Nullable net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 vec, T context)
    Performs the ritual.
    Returns the value of the requirements record component.
    final String
    Returns a string representation of this record class.
    Returns the value of the trigger record component.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • DIRECT_CODEC

      public static final com.mojang.serialization.Codec<Ritual<?>> DIRECT_CODEC
    • CODEC

      public static final com.mojang.serialization.Codec<net.minecraft.core.Holder<Ritual<?>>> CODEC
  • Constructor Details

  • Method Details

    • perform

      public void perform(@Nullable net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 vec, T context)
      Performs the ritual.
      Parameters:
      player - The Player triggering the ritual.
      level - The Level the ritual is triggered in.
      vec - The Vec3 the ritual is triggered at.
      context - The trigger context to use.
    • perform

      public static <T> void perform(com.mojang.serialization.MapCodec<? extends T> codec, @Nullable net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 vec, T context)
      Performs all rituals of the given codec type.
      Type Parameters:
      T - The trigger context type.
      Parameters:
      codec - The MapCodec to check.
      player - The Player triggering the rituals.
      level - The Level the rituals are triggered in.
      vec - The Vec3 the rituals are triggered at.
      context - The trigger context to use.
    • 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.
    • requirements

      public List<RitualRequirement> requirements()
      Returns the value of the requirements record component.
      Returns:
      the value of the requirements record component
    • trigger

      public RitualTrigger<T> trigger()
      Returns the value of the trigger record component.
      Returns:
      the value of the trigger record component
    • effects

      public List<RitualEffect> effects()
      Returns the value of the effects record component.
      Returns:
      the value of the effects record component