java.lang.Object
at.petrak.hexcasting.api.casting.iota.Iota
Direct Known Subclasses:
BooleanIota, ContinuationIota, DoubleIota, EntityIota, GarbageIota, ListIota, NullIota, PatternIota, Vec3Iota

public abstract class Iota extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final @NotNull Object
     
    protected final @NotNull IotaType<?>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Iota(@NotNull IotaType<?> type, @NotNull Object payload)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    net.minecraft.network.chat.Component
     
    boolean
    Returns whether this iota is possible to execute (i.e.
    @NotNull at.petrak.hexcasting.api.casting.eval.CastResult
    execute(at.petrak.hexcasting.api.casting.eval.vm.CastingVM vm, net.minecraft.server.level.ServerLevel world, at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation continuation)
    This method is called when this iota is executed (i.e.
    @NotNull IotaType<?>
     
    int
     
    abstract boolean
     
    abstract @NotNull net.minecraft.nbt.Tag
    Serialize this under the data tag.
    int
    This method is called to determine whether the iota is above the max serialisation depth/serialisation count limits.
    @Nullable Iterable<Iota>
    This method is called to determine whether the iota is above the max serialisation depth/serialisation count limits.
    static boolean
    Helper method to see if either iota tolerates the other.
    protected abstract boolean
    Compare this to another object, within a tolerance.
    static boolean
    Helper method to see if two iotas have the same type.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • payload

      @NotNull protected final @NotNull Object payload
    • type

      @NotNull protected final @NotNull IotaType<?> type
  • Constructor Details

    • Iota

      protected Iota(@NotNull @NotNull IotaType<?> type, @NotNull @NotNull Object payload)
  • Method Details

    • getType

      @NotNull public @NotNull IotaType<?> getType()
    • isTruthy

      public abstract boolean isTruthy()
    • toleratesOther

      protected abstract boolean toleratesOther(Iota that)
      Compare this to another object, within a tolerance.
    • serialize

      @NotNull public abstract @NotNull net.minecraft.nbt.Tag serialize()
      Serialize this under the data tag.

      You probably don't want to call this directly; use IotaType.serialize(at.petrak.hexcasting.api.casting.iota.Iota).

    • execute

      @NotNull public @NotNull at.petrak.hexcasting.api.casting.eval.CastResult execute(at.petrak.hexcasting.api.casting.eval.vm.CastingVM vm, net.minecraft.server.level.ServerLevel world, at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation continuation)
      This method is called when this iota is executed (i.e. Hermes is run on a list containing it, unescaped). By default it will return a CastResult indicating an error has occurred.
    • executable

      public boolean executable()
    • subIotas

      @Nullable public @Nullable Iterable<Iota> subIotas()
      This method is called to determine whether the iota is above the max serialisation depth/serialisation count limits. It should return every "iota" that is a subelement of this iota. For example, if you implemented a Map<Iota, Iota>, then it should be an iterable over the keys *and* values of the map. If you implemented a typed List<Double> iota for some reason, you should instead override size().
    • size

      public int size()
      This method is called to determine whether the iota is above the max serialisation depth/serialisation count limits. This is an alternative to deriving subIotas for if your Iota is a datastructure of variable size over something that doesn't make sense to convert to an Iota iterable, such as ContinuationIota, or a typed List<Double>. It should return "1" per "iota sized" unit of memory that it would occupy. Easy option, return the element count of your data structure.
    • depth

      public int depth()
    • display

      public net.minecraft.network.chat.Component display()
    • typesMatch

      public static boolean typesMatch(Iota a, Iota b)
      Helper method to see if two iotas have the same type.
    • tolerates

      public static boolean tolerates(Iota a, Iota b)
      Helper method to see if either iota tolerates the other.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object