Record Class DifficultyButtons

java.lang.Object
java.lang.Record
net.minecraft.client.gui.screens.options.DifficultyButtons

public record DifficultyButtons(LayoutElement layout, CycleButton<Difficulty> difficultyButton, LockIconButton lockButton, Level level) extends Record
  • Field Details

    • layout

      private final LayoutElement layout
      The field for the layout record component.
    • difficultyButton

      private final CycleButton<Difficulty> difficultyButton
      The field for the difficultyButton record component.
    • lockButton

      private final LockIconButton lockButton
      The field for the lockButton record component.
    • level

      private final Level level
      The field for the level record component.
  • Constructor Details

    • DifficultyButtons

      public DifficultyButtons(LayoutElement layout, CycleButton<Difficulty> difficultyButton, LockIconButton lockButton, Level level)
      Creates an instance of a DifficultyButtons record class.
      Parameters:
      layout - the value for the layout record component
      difficultyButton - the value for the difficultyButton record component
      lockButton - the value for the lockButton record component
      level - the value for the level record component
  • Method Details

    • create

      public static DifficultyButtons create(Minecraft minecraft, Level level, Screen screen)
    • refresh

      public void refresh(Minecraft minecraft)
    • isDifficultyLocked

      private static boolean isDifficultyLocked(Level level)
    • playerHasPermissionToChangeDifficulty

      private static boolean playerHasPermissionToChangeDifficulty(Minecraft minecraft)
    • onLockCallback

      private static void onLockCallback(boolean result, Minecraft minecraft, Screen screen, CycleButton<Difficulty> difficultyButton, LockIconButton lockButton)
    • 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.
    • layout

      public LayoutElement layout()
      Returns the value of the layout record component.
      Returns:
      the value of the layout record component
    • difficultyButton

      public CycleButton<Difficulty> difficultyButton()
      Returns the value of the difficultyButton record component.
      Returns:
      the value of the difficultyButton record component
    • lockButton

      public LockIconButton lockButton()
      Returns the value of the lockButton record component.
      Returns:
      the value of the lockButton record component
    • level

      public Level level()
      Returns the value of the level record component.
      Returns:
      the value of the level record component