Record Class WaypointProvider

java.lang.Object
java.lang.Record
net.thewinnt.cutscenes.path.point.WaypointProvider
All Implemented Interfaces:
PointProvider

public record WaypointProvider(String name, int searchRadius, WaypointProvider.SortType sorting, net.minecraft.world.phys.Vec3 offset, Optional<PointProvider> fallback) extends Record implements PointProvider
  • Constructor Details

    • WaypointProvider

      public WaypointProvider(String name, int searchRadius, WaypointProvider.SortType sorting, net.minecraft.world.phys.Vec3 offset, Optional<PointProvider> fallback)
      Creates an instance of a WaypointProvider record class.
      Parameters:
      name - the value for the name record component
      searchRadius - the value for the searchRadius record component
      sorting - the value for the sorting record component
      offset - the value for the offset record component
      fallback - the value for the fallback record component
  • Method Details

    • getPoint

      public net.minecraft.world.phys.Vec3 getPoint(net.minecraft.world.level.Level level, net.minecraft.world.phys.Vec3 cutsceneStart)
      Description copied from interface: PointProvider
      Returns the point this PointProvider represents.
      Specified by:
      getPoint in interface PointProvider
      Parameters:
      level - the level the point is being obtained in.
      cutsceneStart - the starting position of the cutscene
      Returns:
      a point, relative to the starting position, or a rotation relative to the starting rotation
      See Also:
    • toNetwork

      public void toNetwork(net.minecraft.network.FriendlyByteBuf buf)
      Description copied from interface: PointProvider
      Writes this point provider's properties to network, so that it can be fully reconstructed later.
      Specified by:
      toNetwork in interface PointProvider
      See Also:
    • getSerializer

      Specified by:
      getSerializer in interface PointProvider
      Returns:
      the serializer associated with this point provider's type. Ideally, this should always be the same object.
    • shouldCache

      public boolean shouldCache()
      Specified by:
      shouldCache in interface PointProvider
      Returns:
      whether this point's value should be cached before starting the cutscene
    • fromNetwork

      public static WaypointProvider fromNetwork(net.minecraft.network.FriendlyByteBuf buf)
    • fromJSON

      public static WaypointProvider fromJSON(com.google.gson.JsonObject obj)
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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 String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • searchRadius

      public int searchRadius()
      Returns the value of the searchRadius record component.
      Returns:
      the value of the searchRadius record component
    • sorting

      public WaypointProvider.SortType sorting()
      Returns the value of the sorting record component.
      Returns:
      the value of the sorting record component
    • offset

      public net.minecraft.world.phys.Vec3 offset()
      Returns the value of the offset record component.
      Returns:
      the value of the offset record component
    • fallback

      public Optional<PointProvider> fallback()
      Returns the value of the fallback record component.
      Returns:
      the value of the fallback record component