From 46600fdeeff4e716da16954451ef8aa61f4446e6 Mon Sep 17 00:00:00 2001 From: Dragon-Seeker Date: Mon, 16 Sep 2024 17:12:03 -0500 Subject: [PATCH 1/2] [ui] Fix incorrect logic with BaseOwoHandledScreen slot methods --- .../owo/ui/base/BaseOwoHandledScreen.java | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/wispforest/owo/ui/base/BaseOwoHandledScreen.java b/src/main/java/io/wispforest/owo/ui/base/BaseOwoHandledScreen.java index 2eaaf5bb..17f544f0 100644 --- a/src/main/java/io/wispforest/owo/ui/base/BaseOwoHandledScreen.java +++ b/src/main/java/io/wispforest/owo/ui/base/BaseOwoHandledScreen.java @@ -87,6 +87,25 @@ protected void init() { } } + /** + * Moves the slot with the given index off the screen + * to prevent player intractability when disabled or enabled + * + * @param index The index of the slot to disable + */ + protected void hideSlot(int index) { + hideSlot(this.handler.slots.get(index)); + } + + /** + * Moves the slot off the screen to prevent player + * intractability when disabled or enabled + */ + protected void hideSlot(Slot slot) { + ((SlotAccessor) slot).owo$setX(-300); + ((SlotAccessor) slot).owo$setY(-300); + } + /** * Disable the slot at the given index. Note * that this is hard override and the slot cannot @@ -95,7 +114,7 @@ protected void init() { * @param index The index of the slot to disable */ protected void disableSlot(int index) { - ((OwoSlotExtension) this.handler.slots.get(index)).owo$setDisabledOverride(true); + this.disableSlot(this.handler.slots.get(index)); } /** @@ -115,7 +134,7 @@ protected void disableSlot(Slot slot) { * @param index The index of the slot to enable */ protected void enableSlot(int index) { - ((OwoSlotExtension) this.handler.slots.get(index)).owo$setDisabledOverride(false); + this.enableSlot(this.handler.slots.get(index)); } /** @@ -124,15 +143,23 @@ protected void enableSlot(int index) { * a slot that is disabled through its own will */ protected void enableSlot(Slot slot) { - ((OwoSlotExtension) slot).owo$setDisabledOverride(true); + ((OwoSlotExtension) slot).owo$setDisabledOverride(false); } + /** + * @return whether the given slot is enabled or disabled + * using the {@link OwoSlotExtension} disabling functionality + */ protected boolean isSlotEnabled(int index) { - return ((OwoSlotExtension) this.handler.slots.get(index)).owo$getDisabledOverride(); + return isSlotEnabled(this.handler.slots.get(index)); } + /** + * @return whether the given slot is enabled or disabled + * using the {@link OwoSlotExtension} disabling functionality + */ protected boolean isSlotEnabled(Slot slot) { - return ((OwoSlotExtension) slot).owo$getDisabledOverride(); + return !((OwoSlotExtension) slot).owo$getDisabledOverride(); } /** From 2f860a6315cd93feb63cd12e9348f927d5e228fc Mon Sep 17 00:00:00 2001 From: glisco Date: Wed, 23 Oct 2024 22:00:47 +0200 Subject: [PATCH 2/2] [ui] remove hideSlot methods --- .../owo/ui/base/BaseOwoHandledScreen.java | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/main/java/io/wispforest/owo/ui/base/BaseOwoHandledScreen.java b/src/main/java/io/wispforest/owo/ui/base/BaseOwoHandledScreen.java index 17f544f0..e015f960 100644 --- a/src/main/java/io/wispforest/owo/ui/base/BaseOwoHandledScreen.java +++ b/src/main/java/io/wispforest/owo/ui/base/BaseOwoHandledScreen.java @@ -87,25 +87,6 @@ protected void init() { } } - /** - * Moves the slot with the given index off the screen - * to prevent player intractability when disabled or enabled - * - * @param index The index of the slot to disable - */ - protected void hideSlot(int index) { - hideSlot(this.handler.slots.get(index)); - } - - /** - * Moves the slot off the screen to prevent player - * intractability when disabled or enabled - */ - protected void hideSlot(Slot slot) { - ((SlotAccessor) slot).owo$setX(-300); - ((SlotAccessor) slot).owo$setY(-300); - } - /** * Disable the slot at the given index. Note * that this is hard override and the slot cannot