90% of ad revenue goes to creators. Go ad-free while supporting creators with Modrinth Plus. Subscribe today!
FabricScreenLayers is modelled after Minecraft Forge's GuiScreenLayering logic using mixins. Provides utility to layer minecraft gui screens on top of one another.
Examples Usages:
To add a screen on top of another screen:
ScreenLayerManager.pushLayer(new CustomScreen());
To remove a screen:
ScreenLayerManager.popLayer();
To clear all screens:
ScreenLayerManager.clearLayers();
When translating a screen or item on the screen for sizing.
It is important to use ScreenLayerManager.getFarPlane()
so it does not break mods using layers.
RenderSystem.clear(GL_DEPTH_BUFFER_BIT, Minecraft.ON_OSX);
Matrix4f matrix4f = new Matrix4f().setOrtho(0.0F, (float) width, (float) height, 0.0F, 100.0F, ScreenLayerManager.getFarPlane());
RenderSystem.setProjectionMatrix(matrix4f);
PoseStack posestack = RenderSystem.getModelViewStack();
posestack.setIdentity();
posestack.translate(0.0D, 0.0D, 1000.0F - ScreenLayerManager.getFarPlane());
Details
Licensed MIT
Published 2 years ago
Updated a year ago