diff --git a/src/main/java/io/github/gaming32/worldhost/gui/screen/AddFriendScreen.java b/src/main/java/io/github/gaming32/worldhost/gui/screen/AddFriendScreen.java index e29f066..27b4795 100644 --- a/src/main/java/io/github/gaming32/worldhost/gui/screen/AddFriendScreen.java +++ b/src/main/java/io/github/gaming32/worldhost/gui/screen/AddFriendScreen.java @@ -165,11 +165,7 @@ public void render( //#endif int mouseX, int mouseY, float delta ) { - //#if MC < 1.20.2 - //$$ renderBackground(context); - //#else - renderBackground(context, mouseX, mouseY, delta); - //#endif + whRenderBackground(context, mouseX, mouseY, delta); drawCenteredString(context, font, title, width / 2, 20, 0xffffff); drawString(context, font, FRIEND_USERNAME_TEXT, width / 2 - 100, 50, 0xa0a0a0); usernameField.render(context, mouseX, mouseY, delta); diff --git a/src/main/java/io/github/gaming32/worldhost/gui/screen/FriendsScreen.java b/src/main/java/io/github/gaming32/worldhost/gui/screen/FriendsScreen.java index b893f3f..d0cd5d2 100644 --- a/src/main/java/io/github/gaming32/worldhost/gui/screen/FriendsScreen.java +++ b/src/main/java/io/github/gaming32/worldhost/gui/screen/FriendsScreen.java @@ -29,6 +29,10 @@ //$$ import com.mojang.blaze3d.vertex.PoseStack; //#endif +//#if MC >= 1.20.2 +import net.minecraft.client.renderer.RenderType; +//#endif + public class FriendsScreen extends WorldHostScreen { public static final Component ADD_FRIEND_TEXT = Components.translatable("world-host.add_friend"); private static final Component ADD_SILENTLY_TEXT = Components.translatable("world-host.friends.add_silently"); @@ -140,11 +144,7 @@ public void render( //#endif int mouseX, int mouseY, float delta ) { - //#if MC < 1.20.2 - //$$ renderBackground(context); - //#else - renderBackground(context, mouseX, mouseY, delta); - //#endif + whRenderBackground(context, mouseX, mouseY, delta); list.render(context, mouseX, mouseY, delta); drawCenteredString(context, font, title, width / 2, 15, 0xffffff); if (WorldHost.BEDROCK_SUPPORT) { @@ -178,6 +178,20 @@ public FriendsList(int i, int j, int k, int l, int m) { super(FriendsScreen.this.minecraft, i, j, k, l, m); } + //#if MC >= 1.20.2 + @Override + protected void renderDecorations(@NotNull GuiGraphics graphics, int mouseX, int mouseY) { + super.renderDecorations(graphics, mouseX, mouseY); + graphics.setColor(0.25f, 0.25f, 0.25f, 1f); + graphics.blit(BACKGROUND_LOCATION, x0, 0, 0f, 0f, width, y0, 32, 32); + graphics.blit(BACKGROUND_LOCATION, x0, y1, 0f, y1, width, height - y1, 32, 32); + graphics.setColor(1f, 1f, 1f, 1f); + graphics.fillGradient(RenderType.guiOverlay(), x0, y0, x1, y0 + 4, 0xff000000, 0, 0); + graphics.fillGradient(RenderType.guiOverlay(), x0, y1 - 4, x1, y1, 0, 0xff000000, 0); + } + + //#endif + @Override public void setSelected(@Nullable FriendsEntry entry) { super.setSelected(entry); diff --git a/src/main/java/io/github/gaming32/worldhost/gui/screen/JoiningWorldHostScreen.java b/src/main/java/io/github/gaming32/worldhost/gui/screen/JoiningWorldHostScreen.java index 1ce8e4d..46b5f9a 100644 --- a/src/main/java/io/github/gaming32/worldhost/gui/screen/JoiningWorldHostScreen.java +++ b/src/main/java/io/github/gaming32/worldhost/gui/screen/JoiningWorldHostScreen.java @@ -46,11 +46,7 @@ public void render( //#endif int mouseX, int mouseY, float delta ) { - //#if MC < 1.20.2 - //$$ renderBackground(context); - //#else - renderBackground(context, mouseX, mouseY, delta); - //#endif + whRenderBackground(context, mouseX, mouseY, delta); drawCenteredString(context, font, status, width / 2, height / 2 - 50, 0xffffff); super.render(context, mouseX, mouseY, delta); } diff --git a/src/main/java/io/github/gaming32/worldhost/gui/screen/OnlineFriendsScreen.java b/src/main/java/io/github/gaming32/worldhost/gui/screen/OnlineFriendsScreen.java index a654795..d4025c2 100644 --- a/src/main/java/io/github/gaming32/worldhost/gui/screen/OnlineFriendsScreen.java +++ b/src/main/java/io/github/gaming32/worldhost/gui/screen/OnlineFriendsScreen.java @@ -186,11 +186,7 @@ public void render( int mouseX, int mouseY, float delta ) { tooltip = null; - //#if MC < 1.20.2 - //$$ renderBackground(context); - //#else - renderBackground(context, mouseX, mouseY, delta); - //#endif + whRenderBackground(context, mouseX, mouseY, delta); list.render(context, mouseX, mouseY, delta); drawCenteredString(context, font, title, width / 2, 15, 0xffffff); super.render(context, mouseX, mouseY, delta); diff --git a/src/main/java/io/github/gaming32/worldhost/gui/screen/WorldHostConfigScreen.java b/src/main/java/io/github/gaming32/worldhost/gui/screen/WorldHostConfigScreen.java index 7347ebf..2161925 100644 --- a/src/main/java/io/github/gaming32/worldhost/gui/screen/WorldHostConfigScreen.java +++ b/src/main/java/io/github/gaming32/worldhost/gui/screen/WorldHostConfigScreen.java @@ -146,11 +146,7 @@ public void render( //#endif int mouseX, int mouseY, float delta ) { - //#if MC < 1.20.2 - //$$ renderBackground(context); - //#else - renderBackground(context, mouseX, mouseY, delta); - //#endif + whRenderBackground(context, mouseX, mouseY, delta); super.render(context, mouseX, mouseY, delta); drawCenteredString(context, font, title, width / 2, 15, 0xffffff); diff --git a/src/main/java/io/github/gaming32/worldhost/gui/screen/WorldHostScreen.java b/src/main/java/io/github/gaming32/worldhost/gui/screen/WorldHostScreen.java index 0406079..c48e1e8 100644 --- a/src/main/java/io/github/gaming32/worldhost/gui/screen/WorldHostScreen.java +++ b/src/main/java/io/github/gaming32/worldhost/gui/screen/WorldHostScreen.java @@ -372,4 +372,34 @@ public static void sendRepeatEvents(@SuppressWarnings("unused") boolean sendRepe //$$ Minecraft.getInstance().keyboardHandler.setSendRepeatsToGui(sendRepeatEvents); //#endif } + + @Override + public void renderBackground( + @NotNull + //#if MC < 1.20.0 + //$$ PoseStack context + //#else + GuiGraphics context + //#endif + //#if MC >= 1.20.2 + , int mouseX, int mouseY, float delta + //#endif + ) { + } + + public void whRenderBackground( + @NotNull + //#if MC < 1.20.0 + //$$ PoseStack context, + //#else + GuiGraphics context, + //#endif + int mouseX, int mouseY, float delta + ) { + //#if MC < 1.20.2 + //$$ super.renderBackground(context); + //#else + super.renderBackground(context, mouseX, mouseY, delta); + //#endif + } }