[ci skip] Add container render events (#240)

This commit is contained in:
shedaniel
2022-04-15 12:39:44 +08:00
committed by GitHub
parent 8d142d6a20
commit 2c818cf492
4 changed files with 101 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ import dev.architectury.hooks.client.screen.ScreenAccess;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import java.util.List;
@@ -58,6 +59,14 @@ public interface ClientGuiEvent {
* @see ScreenRenderPost#render(Screen, PoseStack, int, int, float)
*/
Event<ScreenRenderPost> RENDER_POST = EventFactory.createLoop();
/**
* @see ContainerScreenRenderBackground#render(AbstractContainerScreen, PoseStack, int, int, float)
*/
Event<ContainerScreenRenderBackground> RENDER_CONTAINER_BACKGROUND = EventFactory.createEventResult();
/**
* @see ContainerScreenRenderForeground#render(AbstractContainerScreen, PoseStack, int, int, float)
*/
Event<ContainerScreenRenderForeground> RENDER_CONTAINER_FOREGROUND = EventFactory.createLoop();
/**
* @see SetScreen#modifyScreen(Screen)
*/
@@ -145,6 +154,36 @@ public interface ClientGuiEvent {
void render(Screen screen, PoseStack matrices, int mouseX, int mouseY, float delta);
}
@Environment(EnvType.CLIENT)
interface ContainerScreenRenderBackground {
/**
* Invoked after a container screen's background are rendered.
* Equivalent to Forge's {@code ContainerScreenEvent.DrawBackground} event.
*
* @param screen The screen.
* @param matrices The pose stack.
* @param mouseX The scaled x-coordinate of the mouse cursor.
* @param mouseY The scaled y-coordinate of the mouse cursor.
* @param delta The current tick delta.
*/
void render(AbstractContainerScreen<?> screen, PoseStack matrices, int mouseX, int mouseY, float delta);
}
@Environment(EnvType.CLIENT)
interface ContainerScreenRenderForeground {
/**
* Invoked after a screen has finished rendering most of the foreground, but before any floating widgets are rendered.
* Equivalent to Forge's {@code ContainerScreenEvent.DrawForeground} event.
*
* @param screen The screen.
* @param matrices The pose stack.
* @param mouseX The scaled x-coordinate of the mouse cursor.
* @param mouseY The scaled y-coordinate of the mouse cursor.
* @param delta The current tick delta.
*/
void render(AbstractContainerScreen<?> screen, PoseStack matrices, int mouseX, int mouseY, float delta);
}
@Environment(EnvType.CLIENT)
interface SetScreen {
/**