-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ui] store Hud addition/removal tasks in order and process the queue …
…at the beginning of every frame while in a world (#213)
- Loading branch information
Showing
3 changed files
with
67 additions
and
32 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
30 changes: 30 additions & 0 deletions
30
src/main/java/io/wispforest/owo/ui/event/ClientRenderCallback.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,30 @@ | ||
package io.wispforest.owo.ui.event; | ||
|
||
import net.fabricmc.fabric.api.event.Event; | ||
import net.fabricmc.fabric.api.event.EventFactory; | ||
import net.minecraft.client.MinecraftClient; | ||
|
||
public interface ClientRenderCallback { | ||
|
||
/** | ||
* Invoked just before the client's window enters the 'Render' phase, after the client | ||
* has ticked and cleared the render task queue | ||
*/ | ||
Event<ClientRenderCallback> BEFORE = EventFactory.createArrayBacked(ClientRenderCallback.class, callbacks -> (client) -> { | ||
for (var callback : callbacks) { | ||
callback.onRender(client); | ||
} | ||
}); | ||
|
||
/** | ||
* Called just after the client has finished rendering and drawing the | ||
* current frame and swapped buffers | ||
*/ | ||
Event<ClientRenderCallback> AFTER = EventFactory.createArrayBacked(ClientRenderCallback.class, callbacks -> (client) -> { | ||
for (var callback : callbacks) { | ||
callback.onRender(client); | ||
} | ||
}); | ||
|
||
void onRender(MinecraftClient client); | ||
} |
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