Skip to content

Commit

Permalink
Merge pull request #305 from Dragon-Seeker/1.21-HandledScreenFixes
Browse files Browse the repository at this point in the history
[1.21] Fix incorrect logic with BaseOwoHandledScreen slot methods
  • Loading branch information
gliscowo authored Oct 23, 2024
2 parents 5137438 + 2f860a6 commit 6be8b83
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/main/java/io/wispforest/owo/ui/base/BaseOwoHandledScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,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));
}

/**
Expand All @@ -115,7 +115,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));
}

/**
Expand All @@ -124,15 +124,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();
}

/**
Expand Down

0 comments on commit 6be8b83

Please sign in to comment.