diff options
Diffstat (limited to 'src/main')
4 files changed, 37 insertions, 0 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/CottonInventoryController.java b/src/main/java/io/github/cottonmc/cotton/gui/CottonInventoryController.java index 2721ff3..21a1dcb 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/CottonInventoryController.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/CottonInventoryController.java @@ -22,6 +22,9 @@ import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.SlotActionType; import net.minecraft.world.World; +/** + * A screen handler-based GUI description for GUIs with slots. + */ public class CottonInventoryController extends ScreenHandler implements GuiDescription { protected Inventory blockInventory; diff --git a/src/main/java/io/github/cottonmc/cotton/gui/EmptyInventory.java b/src/main/java/io/github/cottonmc/cotton/gui/EmptyInventory.java index 84eee0f..7376c92 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/EmptyInventory.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/EmptyInventory.java @@ -4,6 +4,9 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.Inventory; import net.minecraft.item.ItemStack; +/** + * An empty inventory that cannot hold any items. + */ public class EmptyInventory implements Inventory { public static final EmptyInventory INSTANCE = new EmptyInventory(); diff --git a/src/main/java/io/github/cottonmc/cotton/gui/GuiDescription.java b/src/main/java/io/github/cottonmc/cotton/gui/GuiDescription.java index 3239179..a0b75cc 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/GuiDescription.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/GuiDescription.java @@ -8,6 +8,15 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.screen.PropertyDelegate; +/** + * A GUI description represents a GUI without depending on screens. + * + * <p>GUI descriptions contain the root panel and the property delegate of the GUI. + * They also manage the focused widget. + * + * @see io.github.cottonmc.cotton.gui.client.LightweightGuiDescription + * @see CottonInventoryController + */ public interface GuiDescription { public WPanel getRootPanel(); public int getTitleColor(); diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java index 3367b1d..17b88c1 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java @@ -348,6 +348,16 @@ public abstract class WAbstractSlider extends WWidget { : (ch == GLFW.GLFW_KEY_RIGHT || ch == GLFW.GLFW_KEY_UP); } + /** + * The direction enum represents all four directions a slider can face. + * + * <p>For example, a slider whose value grows towards the right faces right. + * + * <p>The default direction for vertical sliders is {@link #UP} and + * the one for horizontal sliders is {@link #RIGHT}. + * + * @since 2.0.0 + */ public enum Direction { UP(Axis.VERTICAL, false), DOWN(Axis.VERTICAL, true), @@ -362,10 +372,22 @@ public abstract class WAbstractSlider extends WWidget { this.inverted = inverted; } + /** + * Gets the direction's axis. + * + * @return the axis + */ public Axis getAxis() { return axis; } + /** + * Returns whether this slider is inverted. + * + * <p>An inverted slider will have reversed keyboard control. + * + * @return whether this slider is inverted + */ public boolean isInverted() { return inverted; } |