Record Class LevelSettings

java.lang.Object
java.lang.Record
net.minecraft.world.level.LevelSettings

public record LevelSettings(String levelName, GameType gameType, LevelSettings.DifficultySettings difficultySettings, boolean allowCommands, WorldDataConfiguration dataConfiguration, com.mojang.serialization.Lifecycle lifecycle) extends Record
  • Field Details

    • levelName

      private final String levelName
      The field for the levelName record component.
    • gameType

      private final GameType gameType
      The field for the gameType record component.
    • difficultySettings

      private final LevelSettings.DifficultySettings difficultySettings
      The field for the difficultySettings record component.
    • allowCommands

      private final boolean allowCommands
      The field for the allowCommands record component.
    • dataConfiguration

      private final WorldDataConfiguration dataConfiguration
      The field for the dataConfiguration record component.
    • lifecycle

      private final com.mojang.serialization.Lifecycle lifecycle
      The field for the lifecycle record component.
  • Constructor Details

    • LevelSettings

      public LevelSettings(String levelName, GameType gameType, LevelSettings.DifficultySettings difficultySettings, boolean allowCommands, WorldDataConfiguration dataConfiguration)
    • LevelSettings

      public LevelSettings(String levelName, GameType gameType, LevelSettings.DifficultySettings difficultySettings, boolean allowCommands, WorldDataConfiguration dataConfiguration, com.mojang.serialization.Lifecycle lifecycle)
      Creates an instance of a LevelSettings record class.
      Parameters:
      levelName - the value for the levelName record component
      gameType - the value for the gameType record component
      difficultySettings - the value for the difficultySettings record component
      allowCommands - the value for the allowCommands record component
      dataConfiguration - the value for the dataConfiguration record component
      lifecycle - the value for the lifecycle record component
  • Method Details

    • parse

      public static LevelSettings parse(com.mojang.serialization.Dynamic<?> input, WorldDataConfiguration loadConfig)
    • withGameType

      public LevelSettings withGameType(GameType gameType)
    • withDifficulty

      public LevelSettings withDifficulty(Difficulty difficulty)
    • withDifficultyLock

      public LevelSettings withDifficultyLock(boolean locked)
    • withDataConfiguration

      public LevelSettings withDataConfiguration(WorldDataConfiguration dataConfiguration)
    • withLifecycle

      public LevelSettings withLifecycle(com.mojang.serialization.Lifecycle lifecycle)
    • copy

      public LevelSettings copy()
    • getLifecycle

      public com.mojang.serialization.Lifecycle getLifecycle()
    • 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 the compare method from their corresponding wrapper classes.
      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.
    • levelName

      public String levelName()
      Returns the value of the levelName record component.
      Returns:
      the value of the levelName record component
    • gameType

      public GameType gameType()
      Returns the value of the gameType record component.
      Returns:
      the value of the gameType record component
    • difficultySettings

      public LevelSettings.DifficultySettings difficultySettings()
      Returns the value of the difficultySettings record component.
      Returns:
      the value of the difficultySettings record component
    • allowCommands

      public boolean allowCommands()
      Returns the value of the allowCommands record component.
      Returns:
      the value of the allowCommands record component
    • dataConfiguration

      public WorldDataConfiguration dataConfiguration()
      Returns the value of the dataConfiguration record component.
      Returns:
      the value of the dataConfiguration record component
    • lifecycle

      public com.mojang.serialization.Lifecycle lifecycle()
      Returns the value of the lifecycle record component.
      Returns:
      the value of the lifecycle record component