-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
83 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/net/mcbrawls/sgui/mixin/BackendSimpleGuiMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package net.mcbrawls.sgui.mixin; | ||
|
||
import eu.pb4.sgui.api.gui.GuiInterface; | ||
import eu.pb4.sgui.api.gui.SlotGuiInterface; | ||
import eu.pb4.sgui.api.gui.layered.LayeredGui; | ||
import net.mcbrawls.sgui.ParentedGui; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.Unique; | ||
|
||
@Mixin(targets = { "eu.pb4.sgui.api.gui.layered.BackendSimpleGui" }, remap = false) | ||
public abstract class BackendSimpleGuiMixin implements SlotGuiInterface, ParentedGui { | ||
@Shadow @Final public LayeredGui gui; | ||
|
||
@Unique | ||
@Override | ||
public @Nullable GuiInterface getParent() { | ||
return ParentedGui.Companion.getGuiParent(this.gui); | ||
} | ||
|
||
@Unique | ||
@Override | ||
public void setParent(@Nullable GuiInterface parent) { | ||
ParentedGui.Companion.setGuiParent(this.gui, parent); | ||
} | ||
|
||
@Override | ||
public void onClose() { | ||
GuiInterface firstParent = ParentedGui.Companion.getFirstParent(this.gui); | ||
if (firstParent != null && !firstParent.canPlayerClose()) { | ||
firstParent.open(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package net.mcbrawls.sgui.mixin; | ||
|
||
import eu.pb4.sgui.api.gui.BaseSlotGui; | ||
import eu.pb4.sgui.api.gui.GuiInterface; | ||
import eu.pb4.sgui.api.gui.SlotGuiInterface; | ||
import net.mcbrawls.sgui.ParentedGui; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
|
||
@Mixin(BaseSlotGui.class) | ||
public abstract class BaseSlotMixin implements SlotGuiInterface, ParentedGui { | ||
@Unique | ||
@Nullable | ||
private GuiInterface parent = null; | ||
|
||
@Unique | ||
@Override | ||
public @Nullable GuiInterface getParent() { | ||
return this.parent; | ||
} | ||
|
||
@Unique | ||
@Override | ||
public void setParent(@Nullable GuiInterface parent) { | ||
this.parent = parent; | ||
} | ||
|
||
@Override | ||
public void onClose() { | ||
GuiInterface firstParent = ParentedGui.Companion.getFirstParent(this); | ||
if (firstParent != null && !firstParent.canPlayerClose()) { | ||
firstParent.open(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
accessWidener v2 named |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters