Enum Class GameType

java.lang.Object
java.lang.Enum<GameType>
net.minecraft.world.level.GameType
All Implemented Interfaces:
Serializable, Comparable<GameType>, Constable, StringRepresentable

public enum GameType extends Enum<GameType> implements StringRepresentable
  • Enum Constant Details

    • SURVIVAL

      public static final GameType SURVIVAL
    • CREATIVE

      public static final GameType CREATIVE
    • ADVENTURE

      public static final GameType ADVENTURE
    • SPECTATOR

      public static final GameType SPECTATOR
  • Field Details

  • Constructor Details

    • GameType

      private GameType(int p_46390_, String p_46391_)
  • Method Details

    • values

      public static GameType[] 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 GameType 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
    • getId

      public int getId()
    • getName

      public String getName()
    • getSerializedName

      public String getSerializedName()
      Specified by:
      getSerializedName in interface StringRepresentable
    • getLongDisplayName

      public Component getLongDisplayName()
    • getShortDisplayName

      public Component getShortDisplayName()
    • updatePlayerAbilities

      public void updatePlayerAbilities(Abilities p_46399_)
    • isBlockPlacingRestricted

      public boolean isBlockPlacingRestricted()
    • isCreative

      public boolean isCreative()
    • isSurvival

      public boolean isSurvival()
    • byId

      public static GameType byId(int p_46394_)
    • byName

      public static GameType byName(String p_46401_)
    • byName

      @Nullable @Contract("_,!null->!null;_,null->_") public static GameType byName(String p_46403_, @Nullable GameType p_46404_)
    • getNullableId

      public static int getNullableId(@Nullable GameType p_151496_)
    • byNullableId

      @Nullable public static GameType byNullableId(int p_151498_)