Interface ICheckboxWidget

All Known Implementing Classes:
WidgetCheckBox, WidgetKeybindCheckBox

public interface ICheckboxWidget
Represents a checkbox widget which can have a key bound to toggle it; use this to create a checkbox to toggle a toggleable upgrade on & off.

Do not implement this class yourself; you can create & retrieve instances of it via IClientArmorRegistry.makeKeybindingCheckBox(ResourceLocation, int, int, int, Consumer). This would typically be done in IOptionPage.populateGui(IGuiScreen).

  • Method Summary

    Modifier and Type
    Method
    Description
    default net.minecraft.client.gui.components.AbstractWidget
    Convenience method to cast this to a Widget, suitable for passing to IGuiScreen.addWidget(AbstractWidget), or calling other Widget methods on it.
    default net.minecraft.resources.ResourceLocation
    Get the upgrade ID for this checkbox; the upgrade that is toggled when the checkbox is clicked.
    boolean
    Is this checkbox currently checked?
    withOwnerUpgradeID(net.minecraft.resources.ResourceLocation owningId)
    Set the upgrade ID of the owning upgrade.
  • Method Details

    • isChecked

      boolean isChecked()
      Is this checkbox currently checked?
      Returns:
      true if checked, false if not
    • asWidget

      default net.minecraft.client.gui.components.AbstractWidget asWidget()
      Convenience method to cast this to a Widget, suitable for passing to IGuiScreen.addWidget(AbstractWidget), or calling other Widget methods on it.
      Returns:
      this checkbox as a Widget
    • getUpgradeId

      default net.minecraft.resources.ResourceLocation getUpgradeId()
      Get the upgrade ID for this checkbox; the upgrade that is toggled when the checkbox is clicked.
      Returns:
      the upgrade ID
    • withOwnerUpgradeID

      default ICheckboxWidget withOwnerUpgradeID(net.minecraft.resources.ResourceLocation owningId)
      Set the upgrade ID of the owning upgrade. Use this for sub-controls, e.g. the builder mode setting on jet boots.
      Parameters:
      owningId - the upgrade ID of the owning upgrade
      Returns:
      this widget, for fluency