1.9 KiB
UIComponent.y
Set right margin. See margin(int) method for more information about restrictions.
keybind
public UIComponent keybind(int keyCode, java.lang.String action, java.lang.String label)
Add a keybind with no modifiers. See keybind(int, String, String, boolean, boolean) for proper example.
keybind
public UIComponent keybind(int keyCode, java.lang.String action, java.lang.String label, boolean ctrl)
Add a keybind with optional Control modifier. See keybind(int, String, String, boolean, boolean) for proper example.
keybind
public UIComponent keybind(int keyCode, java.lang.String action, java.lang.String label, boolean ctrl, boolean shift)
Add a keybind with optional Control and/or Shift modifier(s). See keybind(int, String, String, boolean, boolean) for proper example.
keybind
public UIComponent keybind(int keyCode, java.lang.String action, java.lang.String label, boolean ctrl, boolean shift, boolean alt)
Add a keybind optionally with Control, Shift, and Alt key modifiers (i.e. while holding).
// For more reference, check this page to find the list of all key codes: // https://minecraft.fandom.com/wiki/Key_codes/Keyboard1 // function main(c) { var ui = mappet.createUI(c, "handler").background(); var button = ui.icon("upload").id("icon");
// 203 = Arrow left ui.getCurrent().keybind(203, "left", "Change icon to left"); // 205 = Arrow right ui.getCurrent().keybind(205, "right", "Change icon to right"); button.rxy(0.5, 0.5).wh(20, 20).anchor(0.5); c.getSubject().openUI(ui); }
function handler(c) { var uiContext = c.getSubject().getUIContext(); var key = uiContext.getHotkey();
if (key === "left") { uiContext.get("icon").icon("leftload");