Record Class ChunkResult.Fail<T>

java.lang.Object
java.lang.Record
net.minecraft.server.level.ChunkResult.Fail<T>
All Implemented Interfaces:
ChunkResult<T>
Enclosing interface:
ChunkResult<T>

public static record ChunkResult.Fail<T>(Supplier<String> error) extends Record implements ChunkResult<T>
  • Field Details

    • error

      private final Supplier<String> error
      The field for the error record component.
  • Constructor Details

    • Fail

      public Fail(Supplier<String> error)
      Creates an instance of a Fail record class.
      Parameters:
      error - the value for the error record component
  • Method Details

    • isSuccess

      public boolean isSuccess()
      Specified by:
      isSuccess in interface ChunkResult<T>
    • orElse

      @Nullable public T orElse(@Nullable T p_330895_)
      Specified by:
      orElse in interface ChunkResult<T>
    • getError

      public String getError()
      Specified by:
      getError in interface ChunkResult<T>
    • ifSuccess

      public ChunkResult<T> ifSuccess(Consumer<T> p_331855_)
      Specified by:
      ifSuccess in interface ChunkResult<T>
    • map

      public <R> ChunkResult<R> map(Function<T,R> p_333275_)
      Specified by:
      map in interface ChunkResult<T>
    • orElseThrow

      public <E extends Throwable> T orElseThrow(Supplier<E> p_331734_) throws E
      Specified by:
      orElseThrow in interface ChunkResult<T>
      Throws:
      E
    • 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.
    • error

      public Supplier<String> error()
      Returns the value of the error record component.
      Returns:
      the value of the error record component