-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from KasugaLibGroup/gui
fix: gui
- Loading branch information
Showing
9 changed files
with
74 additions
and
31 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
27 changes: 27 additions & 0 deletions
27
src/main/java/kasuga/lib/core/client/frontend/commands/GuiScreenHelper.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,27 @@ | ||
package kasuga.lib.core.client.frontend.commands; | ||
|
||
import com.mojang.blaze3d.systems.RenderSystem; | ||
import kasuga.lib.KasugaLib; | ||
import kasuga.lib.core.client.frontend.gui.GuiInstance; | ||
import kasuga.lib.core.client.frontend.gui.GuiScreen; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.resources.ResourceLocation; | ||
|
||
import java.util.UUID; | ||
|
||
public class GuiScreenHelper { | ||
public static void attach(UUID instanceId){ | ||
GuiInstance instance = KasugaLib.STACKS.GUI.orElseThrow().getInstanceById(instanceId).get(); | ||
if(instance == null) | ||
return; | ||
RenderSystem.recordRenderCall(()->{ | ||
Minecraft.getInstance().setScreen(new GuiScreen(instance)); | ||
}); | ||
} | ||
|
||
public static void createAndAttach(ResourceLocation location){ | ||
RenderSystem.recordRenderCall(()->{ | ||
Minecraft.getInstance().setScreen(KasugaLib.STACKS.GUI.get().create(location).createScreen()); | ||
}); | ||
} | ||
} |
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
4 changes: 3 additions & 1 deletion
4
src/main/java/kasuga/lib/core/client/frontend/gui/layout/LayoutEngines.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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
package kasuga.lib.core.client.frontend.gui.layout; | ||
|
||
import kasuga.lib.core.client.frontend.common.layouting.LayoutEngine; | ||
import kasuga.lib.core.client.frontend.gui.layout.yoga.YogaLayoutEngine; | ||
import net.minecraftforge.common.util.Lazy; | ||
|
||
public class LayoutEngines { | ||
public static YogaLayoutEngine YOGA = new YogaLayoutEngine(); | ||
public static Lazy<LayoutEngine> YOGA = Lazy.of(YogaLayoutEngine::new); | ||
} |
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
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