From e1809045a90f73c9c11f10982abec7d37e998360 Mon Sep 17 00:00:00 2001 From: Juuxel <6596629+Juuxel@users.noreply.github.com> Date: Sat, 9 May 2020 14:11:31 +0300 Subject: Docs --- .../cotton/gui/CottonInventoryController.java | 3 +++ .../github/cottonmc/cotton/gui/EmptyInventory.java | 3 +++ .../github/cottonmc/cotton/gui/GuiDescription.java | 9 +++++++++ .../cotton/gui/widget/WAbstractSlider.java | 22 ++++++++++++++++++++++ 4 files changed, 37 insertions(+) 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. + * + *
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. + * + *
For example, a slider whose value grows towards the right faces right. + * + *
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. + * + *
An inverted slider will have reversed keyboard control. + * + * @return whether this slider is inverted + */ public boolean isInverted() { return inverted; } -- cgit