Enum Class EventResult

java.lang.Object
java.lang.Enum<EventResult>
net.fabricmc.fabric.api.util.EventResult
All Implemented Interfaces:
Serializable, Comparable<EventResult>, Constable, net.minecraft.util.StringRepresentable

public enum EventResult extends Enum<EventResult> implements net.minecraft.util.StringRepresentable
Represents a result of an event that controls execution of some action.
  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>

    Nested classes/interfaces inherited from interface net.minecraft.util.StringRepresentable

    net.minecraft.util.StringRepresentable.EnumCodec<E>, net.minecraft.util.StringRepresentable.StringRepresentableCodec<S>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Prevents further event handling, while allowing related action.
    Prevents further event handling, while also preventing related action.
    Continues execution of further events.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<EventResult>
     

    Fields inherited from interface net.minecraft.util.StringRepresentable

    PRE_BUILT_MAP_THRESHOLD
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks whatever action should be allowed.
    boolean
    allowAction(boolean passResult)
    Checks whatever action should be allowed, with custom return value for PASS.
    Value of this enum as string.
    Returns the enum constant of this class with the specified name.
    static EventResult[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • ALLOW

      public static final EventResult ALLOW
      Prevents further event handling, while allowing related action.
    • PASS

      public static final EventResult PASS
      Continues execution of further events. In case of being returned by a final callback, it might either act the same as ALLOW or execute additional logic to determine the outcome.
    • DENY

      public static final EventResult DENY
      Prevents further event handling, while also preventing related action.
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<EventResult> CODEC
  • Method Details

    • values

      public static EventResult[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static EventResult valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • allowAction

      public boolean allowAction()
      Checks whatever action should be allowed.
      Returns:
      true if it's allowed, otherwise false.
    • allowAction

      public boolean allowAction(boolean passResult)
      Checks whatever action should be allowed, with custom return value for PASS.
      Returns:
      true if it's allowed, otherwise false.
    • getSerializedName

      public String getSerializedName()
      Value of this enum as string.
      Specified by:
      getSerializedName in interface net.minecraft.util.StringRepresentable
      Returns:
      lowercase name of the value.