From bbf4c43a1ed431c94c2a95e67ea8494a8007cdee Mon Sep 17 00:00:00 2001 From: shedaniel Date: Wed, 23 Jul 2025 20:50:25 +0200 Subject: Port to 1.21.6 (#1907) * Port to 1.21.6 * Fix tooltip Z-rendering * Fix config screen * Add workflow --- .../rei/RoughlyEnoughItemsCoreClient.java | 2 +- .../shedaniel/rei/RoughlyEnoughItemsNetwork.java | 6 +- .../rei/impl/client/config/ConfigObjectImpl.java | 11 - .../client/config/addon/ConfigAddonsScreen.java | 4 +- .../config/entries/ConfigureCategoriesScreen.java | 9 +- .../config/entries/FilteringRulesScreen.java | 4 +- .../client/config/entries/FilteringScreen.java | 15 +- .../filtering/rules/SearchFilteringRuleType.java | 4 +- .../rei/impl/client/gui/ScreenOverlayImpl.java | 9 +- .../impl/client/gui/config/REIConfigScreen.java | 2 +- .../components/ConfigCategoryEntryWidget.java | 14 +- .../gui/config/components/ConfigGroupWidget.java | 18 +- .../config/components/ConfigOptionValueWidget.java | 6 +- .../gui/config/components/ConfigOptionWidget.java | 8 +- .../gui/config/components/ConfigSearchWidget.java | 8 +- .../gui/config/options/AllREIConfigCategories.java | 2 +- .../gui/config/options/AllREIConfigGroups.java | 5 +- .../gui/config/options/AllREIConfigOptions.java | 2 - .../config/options/preview/InterfacePreviewer.java | 4 +- .../config/options/preview/TooltipPreviewer.java | 32 +-- .../client/gui/credits/CreditsEntryListWidget.java | 2 +- .../client/gui/dragging/CurrentDraggingStack.java | 9 - .../client/gui/error/ErrorsEntryListWidget.java | 42 +-- .../rei/impl/client/gui/error/ErrorsScreen.java | 8 +- .../client/gui/hints/ImportantWarningsWidget.java | 22 +- .../rei/impl/client/gui/modules/MenuHolder.java | 3 +- .../client/gui/modules/entries/SubMenuEntry.java | 10 +- .../client/gui/modules/entries/TextMenuEntry.java | 2 +- .../gui/modules/entries/ToggleMenuEntry.java | 11 +- .../gui/performance/DisplayRegistryInfoScreen.java | 2 - .../performance/entry/PerformanceEntryImpl.java | 2 - .../performance/entry/SubCategoryListEntry.java | 6 +- .../gui/screen/AbstractDisplayViewingScreen.java | 22 +- .../gui/screen/CompositeDisplayViewingScreen.java | 8 +- .../gui/screen/DefaultDisplayViewingScreen.java | 68 +++-- .../rei/impl/client/gui/screen/ScreenWithMenu.java | 3 - .../gui/screen/UncertainDisplayViewingScreen.java | 8 +- .../client/gui/screen/WarningAndErrorScreen.java | 2 +- .../collapsible/CollapsibleEntriesScreen.java | 12 +- .../screen/collapsible/CollapsibleEntryWidget.java | 52 ++-- .../CustomCollapsibleEntrySelectionScreen.java | 20 +- .../gui/screen/generic/OptionEntriesScreen.java | 6 +- .../gui/toast/CopyRecipeIdentifierToast.java | 6 +- .../gui/toast/ExportRecipeIdentifierToast.java | 6 +- .../gui/widget/BatchedEntryRendererManager.java | 285 --------------------- .../impl/client/gui/widget/ConfigButtonWidget.java | 7 +- .../gui/widget/CraftableFilterButtonWidget.java | 6 +- .../gui/widget/DefaultDisplayChoosePageWidget.java | 3 - .../gui/widget/DelegateWidgetWithTranslate.java | 41 ++- .../client/gui/widget/DisplayCompositeWidget.java | 26 +- .../client/gui/widget/DisplayTooltipComponent.java | 16 +- .../widget/DynamicErrorFreeEntryListWidget.java | 25 +- .../impl/client/gui/widget/EntryHighlighter.java | 7 +- .../client/gui/widget/EntryRendererManager.java | 111 ++++++++ .../rei/impl/client/gui/widget/EntryWidget.java | 8 +- .../rei/impl/client/gui/widget/HoleWidget.java | 8 +- .../impl/client/gui/widget/InternalWidgets.java | 4 +- .../rei/impl/client/gui/widget/ListWidget.java | 8 +- .../rei/impl/client/gui/widget/OverflowWidget.java | 10 +- .../impl/client/gui/widget/PaddedCenterWidget.java | 8 +- .../rei/impl/client/gui/widget/PaddedWidget.java | 8 +- .../client/gui/widget/ScrollableViewWidget.java | 4 +- .../impl/client/gui/widget/TabContainerWidget.java | 20 +- .../rei/impl/client/gui/widget/TabWidget.java | 11 +- .../rei/impl/client/gui/widget/VStackWidget.java | 8 +- .../client/gui/widget/VanillaWrappedWidget.java | 4 +- .../client/gui/widget/basewidgets/ArrowWidget.java | 8 +- .../gui/widget/basewidgets/BurningFireWidget.java | 8 +- .../gui/widget/basewidgets/ButtonWidget.java | 4 +- .../basewidgets/FillRectangleDrawableConsumer.java | 16 +- .../client/gui/widget/basewidgets/PanelWidget.java | 4 +- .../gui/widget/basewidgets/TextFieldWidget.java | 25 +- .../basewidgets/TexturedDrawableConsumer.java | 21 +- .../gui/widget/entrylist/CachingEntryRenderer.java | 47 +--- .../entrylist/CollapsedEntriesBorderRenderer.java | 6 +- .../widget/entrylist/CollapsedEntriesTooltip.java | 12 +- .../gui/widget/entrylist/EntryListStackEntry.java | 6 - .../gui/widget/entrylist/EntryListWidget.java | 8 +- .../widget/entrylist/PaginatedEntryListWidget.java | 30 +-- .../widget/entrylist/ScrolledEntryListWidget.java | 8 +- .../gui/widget/favorites/history/DisplayEntry.java | 40 ++- .../favorites/history/DisplayHistoryWidget.java | 47 +--- .../panel/FadingFavoritesPanelButton.java | 8 +- .../gui/widget/favorites/panel/FavoritesPanel.java | 6 +- .../panel/FavoritesTogglePanelButton.java | 14 +- .../panel/rows/FavoritesPanelEntriesRow.java | 2 - .../impl/client/gui/widget/hint/HintWidget.java | 25 +- .../gui/widget/region/EntryStacksRegionWidget.java | 5 +- .../gui/widget/region/RegionEntryWidget.java | 9 +- .../gui/widget/region/RegionRenderingDebugger.java | 9 +- .../gui/widget/search/OverlaySearchField.java | 27 +- .../screen/DefaultScreenOverlayRenderer.java | 13 +- .../impl/client/transfer/MissingStacksTooltip.java | 14 +- .../plugin/client/entry/FluidEntryDefinition.java | 59 +---- .../plugin/client/entry/ItemEntryDefinition.java | 112 +------- .../client/runtime/DefaultClientRuntimePlugin.java | 18 +- 96 files changed, 543 insertions(+), 1193 deletions(-) delete mode 100644 runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/BatchedEntryRendererManager.java create mode 100644 runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryRendererManager.java (limited to 'runtime/src/main/java/me') diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java index 69275ebc9..107522bc4 100644 --- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java +++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java @@ -236,7 +236,7 @@ public class RoughlyEnoughItemsCoreClient { Minecraft client = Minecraft.getInstance(); NetworkManager.registerReceiver(NetworkManager.s2c(), RoughlyEnoughItemsNetwork.CREATE_ITEMS_MESSAGE_PACKET, (buf, context) -> { - ItemStack stack = buf.readJsonWithCodec(ItemStack.OPTIONAL_CODEC); + ItemStack stack = buf.readLenientJsonWithCodec(ItemStack.OPTIONAL_CODEC); String player = buf.readUtf(32767); if (client.player != null) { client.player.displayClientMessage(Component.literal(I18n.get("text.rei.cheat_items").replaceAll("\\{item_name}", EntryStacks.of(stack.copy()).asFormattedText().getString()).replaceAll("\\{item_count}", stack.copy().getCount() + "").replaceAll("\\{player_name}", player)), false); diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java index 511decbd6..99fd2cfca 100644 --- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java +++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java @@ -90,7 +90,7 @@ public class RoughlyEnoughItemsNetwork { player.displayClientMessage(Component.translatable("text.rei.no_permission_cheat").withStyle(ChatFormatting.RED), false); return; } - ItemStack stack = buf.readJsonWithCodec(ItemStack.OPTIONAL_CODEC); + ItemStack stack = buf.readLenientJsonWithCodec(ItemStack.OPTIONAL_CODEC); if (player.getInventory().add(stack.copy())) { RegistryFriendlyByteBuf newBuf = new RegistryFriendlyByteBuf(Unpooled.buffer(), player.registryAccess()); newBuf.writeJsonWithCodec(ItemStack.OPTIONAL_CODEC, stack.copy()); @@ -108,7 +108,7 @@ public class RoughlyEnoughItemsNetwork { } AbstractContainerMenu menu = player.containerMenu; - ItemStack itemStack = buf.readJsonWithCodec(ItemStack.OPTIONAL_CODEC); + ItemStack itemStack = buf.readLenientJsonWithCodec(ItemStack.OPTIONAL_CODEC); ItemStack stack = itemStack.copy(); if (!menu.getCarried().isEmpty() && ItemStack.isSameItemSameComponents(menu.getCarried(), stack)) { stack.setCount(Mth.clamp(stack.getCount() + menu.getCarried().getCount(), 1, stack.getMaxStackSize())); @@ -128,7 +128,7 @@ public class RoughlyEnoughItemsNetwork { player.displayClientMessage(Component.translatable("text.rei.no_permission_cheat").withStyle(ChatFormatting.RED), false); return; } - ItemStack stack = buf.readJsonWithCodec(ItemStack.OPTIONAL_CODEC); + ItemStack stack = buf.readLenientJsonWithCodec(ItemStack.OPTIONAL_CODEC); int hotbarSlotId = buf.readVarInt(); if (hotbarSlotId >= 0 && hotbarSlotId < 9) { AbstractContainerMenu menu = player.containerMenu; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java index 4b500fa1f..7a0c0e1de 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java @@ -108,11 +108,6 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { return basics.cheatingStyle == ItemCheatingStyle.GRAB; } - @Override - public boolean isFavoritesAnimated() { - return !basics.reduceMotion; - } - @Override public boolean isReducedMotion() { return basics.reduceMotion; @@ -294,11 +289,6 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { advanced.tooltips.displayIMEHints = displayIMEHints; } - @Override - public boolean doesFastEntryRendering() { - return advanced.miscellaneous.newFastEntryRendering; - } - @Override public boolean doesCacheEntryRendering() { return advanced.miscellaneous.cachingFastEntryRendering; @@ -737,7 +727,6 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { @Comment("Declares whether arrows in containers should be clickable.") public boolean clickableRecipeArrows = true; public boolean registerRecipesInAnotherThread = true; - public boolean newFastEntryRendering = true; public boolean cachingFastEntryRendering = false; public boolean cachingDisplayLookup = true; public CategorySettings categorySettings = new CategorySettings(); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/addon/ConfigAddonsScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/addon/ConfigAddonsScreen.java index 6b973084a..2bc1e1f5a 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/addon/ConfigAddonsScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/addon/ConfigAddonsScreen.java @@ -35,7 +35,7 @@ import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.navigation.FocusNavigationEvent; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.RenderPipelines; import net.minecraft.locale.Language; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; @@ -130,7 +130,7 @@ public class ConfigAddonsScreen extends Screen { @Override public void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float delta) { super.renderWidget(graphics, mouseX, mouseY, delta); - graphics.blit(RenderType::guiTextured, InternalTextures.CHEST_GUI_TEXTURE, getX() + 3, getY() + 3, 0, 0, 14, 14, 256, 256); + graphics.blit(RenderPipelines.GUI_TEXTURED, InternalTextures.CHEST_GUI_TEXTURE, getX() + 3, getY() + 3, 0, 0, 14, 14, 256, 256); } }; } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ConfigureCategoriesScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ConfigureCategoriesScreen.java index f1d0c3ac2..cefe6d493 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ConfigureCategoriesScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ConfigureCategoriesScreen.java @@ -249,10 +249,7 @@ public class ConfigureCategoriesScreen extends Screen { } Minecraft client = Minecraft.getInstance(); - graphics.pose().pushPose(); - graphics.pose().translate(0, 0, 100); configuration.getCategory().getIcon().render(graphics, new Rectangle(x + 2, y, 16, 16), mouseY, mouseY, delta); - graphics.pose().popPose(); int xPos = x + 22; { Component title = configuration.getCategory().getTitle(); @@ -279,14 +276,16 @@ public class ConfigureCategoriesScreen extends Screen { { Component subtitle = Component.translatable("config.roughlyenoughitems.configureCategories.visibility." + shown) .withStyle(shown ? ChatFormatting.GREEN : ChatFormatting.RED); - int i = graphics.drawString(client.font, subtitle.getVisualOrderText(), xPos, y + 22, 8421504); + graphics.drawString(client.font, subtitle, xPos, y + 22, 8421504); + int i = xPos + client.font.width(subtitle); visibilityToggleButton.getPoint().setLocation(i + 3, y + 22); visibilityToggleButton.render(graphics, mouseX, mouseY, delta); } if (shown) { Component subtitle = Component.translatable("config.roughlyenoughitems.filtering.filteringQuickCraftCategories.configure." + filteringQuickCraftCategories.getOrDefault(configuration.getCategoryIdentifier(), configuration.isQuickCraftingEnabledByDefault())) .withStyle(ChatFormatting.GRAY); - int i = graphics.drawString(client.font, subtitle.getVisualOrderText(), xPos, y + 32, 8421504); + graphics.drawString(client.font, subtitle, xPos, y + 32, 8421504); + int i = xPos + client.font.width(subtitle); quickCraftToggleButton.getPoint().setLocation(i + 3, y + 32); quickCraftToggleButton.render(graphics, mouseX, mouseY, delta); } else { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringRulesScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringRulesScreen.java index 34b10136f..62e52d7f7 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringRulesScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringRulesScreen.java @@ -45,7 +45,7 @@ import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.RenderPipelines; import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.locale.Language; import net.minecraft.network.chat.Component; @@ -189,7 +189,7 @@ public class FilteringRulesScreen extends Screen { @Override public void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float delta) { super.renderWidget(graphics, mouseX, mouseY, delta); - graphics.blit(RenderType::guiTextured, InternalTextures.CHEST_GUI_TEXTURE, getX() + 3, getY() + 3, 0, 0, 14, 14, 256, 256); + graphics.blit(RenderPipelines.GUI_TEXTURED, InternalTextures.CHEST_GUI_TEXTURE, getX() + 3, getY() + 3, 0, 0, 14, 14, 256, 256); } }; { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java index 0e322a879..c6da89b94 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java @@ -25,7 +25,6 @@ package me.shedaniel.rei.impl.client.config.entries; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -import com.mojang.blaze3d.vertex.VertexConsumer; import me.shedaniel.clothconfig2.ClothConfigInitializer; import me.shedaniel.clothconfig2.api.scroll.ScrollingContainer; import me.shedaniel.math.Point; @@ -40,7 +39,7 @@ import me.shedaniel.rei.api.client.search.SearchProvider; import me.shedaniel.rei.api.common.entry.EntrySerializer; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.impl.client.gui.ScreenOverlayImpl; -import me.shedaniel.rei.impl.client.gui.widget.BatchedEntryRendererManager; +import me.shedaniel.rei.impl.client.gui.widget.EntryRendererManager; import me.shedaniel.rei.impl.client.gui.widget.EntryWidget; import me.shedaniel.rei.impl.client.gui.widget.UpdatedListWidget; import me.shedaniel.rei.impl.client.gui.widget.search.OverlaySearchField; @@ -50,13 +49,11 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.util.Mth; import net.minecraft.world.item.Item; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; -import org.joml.Matrix4f; import java.util.ArrayList; import java.util.Collections; @@ -223,7 +220,7 @@ public class FilteringScreen extends Screen { int skip = Math.max(0, Mth.floor(scrolling.scrollAmount() / (float) entrySize())); int nextIndex = skip * innerBounds.width / entrySize(); int i = nextIndex; - BatchedEntryRendererManager manager = new BatchedEntryRendererManager<>(); + EntryRendererManager manager = new EntryRendererManager<>(); for (; i < entryStacks.size(); i++) { EntryStack stack = entryStacks.get(i); FilteringListEntry entry = entries.get(nextIndex); @@ -237,24 +234,22 @@ public class FilteringScreen extends Screen { manager.render(graphics, mouseX, mouseY, delta); updatePosition(delta); scrolling.renderScrollBar(graphics, 0, REIRuntime.getInstance().isDarkThemeEnabled() ? 0.8F : 1F); - graphics.pose().pushPose(); - graphics.pose().translate(0, 0, 300); this.searchField.render(graphics, mouseX, mouseY, delta); this.selectAllButton.render(graphics, mouseX, mouseY, delta); this.selectNoneButton.render(graphics, mouseX, mouseY, delta); this.hideButton.render(graphics, mouseX, mouseY, delta); this.showButton.render(graphics, mouseX, mouseY, delta); - graphics.pose().popPose(); graphics.disableScissor(); - graphics.drawSpecial(source -> { + // TODO: add back border + /*graphics.drawSpecial(source -> { Matrix4f matrix = graphics.pose().last().pose(); VertexConsumer buffer = source.getBuffer(RenderType.gui()); buffer.addVertex(matrix, 0, bounds.y + 4, 0.0F).setColor(0, 0, 0, 0); buffer.addVertex(matrix, width, bounds.y + 4, 0.0F).setColor(0, 0, 0, 0); buffer.addVertex(matrix, width, bounds.y, 0.0F).setColor(0, 0, 0, 255); buffer.addVertex(matrix, 0, bounds.y, 0.0F).setColor(0, 0, 0, 255); - }); + });*/ this.backButton.render(graphics, mouseX, mouseY, delta); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/SearchFilteringRuleType.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/SearchFilteringRuleType.java index cfe4999e0..13a347fed 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/SearchFilteringRuleType.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/SearchFilteringRuleType.java @@ -31,7 +31,7 @@ import me.shedaniel.rei.api.client.search.SearchFilter; import me.shedaniel.rei.api.client.search.SearchProvider; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.impl.client.gui.screen.generic.OptionEntriesScreen; -import me.shedaniel.rei.impl.client.gui.widget.BatchedEntryRendererManager; +import me.shedaniel.rei.impl.client.gui.widget.EntryRendererManager; import me.shedaniel.rei.impl.client.gui.widget.EntryWidget; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; @@ -144,7 +144,7 @@ public enum SearchFilteringRuleType implements FilteringRuleType manager = new BatchedEntryRendererManager<>(); + EntryRendererManager manager = new EntryRendererManager<>(); int entrySize = entrySize(); int width = entryWidth / entrySize; int i = 0; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/ScreenOverlayImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/ScreenOverlayImpl.java index fe905b5cc..99e5d2dc6 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/ScreenOverlayImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/ScreenOverlayImpl.java @@ -25,7 +25,6 @@ package me.shedaniel.rei.impl.client.gui; import com.google.common.collect.Lists; import com.mojang.blaze3d.platform.Window; -import com.mojang.blaze3d.systems.RenderSystem; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.math.impl.PointHelper; @@ -243,7 +242,6 @@ public abstract class ScreenOverlayImpl extends ScreenOverlay { EntryHighlighter.render(graphics); } if (!hasSpace()) return; - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); this.renderWidgets(graphics, mouseX, mouseY, delta); if (ConfigObject.getInstance().areClickableRecipeArrowsEnabled()) { Screen screen = Minecraft.getInstance().screen; @@ -304,15 +302,9 @@ public abstract class ScreenOverlayImpl extends ScreenOverlay { else if (widget instanceof OverlaySearchField field) field.laterRender(graphics, mouseX, mouseY, delta); } - graphics.pose().pushPose(); - graphics.pose().translate(0, 0, 500); menuHolder.lateRender(graphics, mouseX, mouseY, delta); - graphics.pose().popPose(); if (choosePageWidget != null) { - graphics.pose().pushPose(); - graphics.pose().translate(0, 0, 500); graphics.fillGradient(0, 0, window.getGuiScaledWidth(), window.getGuiScaledHeight(), -1072689136, -804253680); - graphics.pose().popPose(); choosePageWidget.render(graphics, mouseX, mouseY, delta); } } @@ -325,6 +317,7 @@ public abstract class ScreenOverlayImpl extends ScreenOverlay { if (REIRuntime.getInstance().isOverlayVisible()) { menuHolder.afterRender(); } + graphics.renderDeferredTooltip(); } public void renderTooltip(GuiGraphics graphics, Tooltip tooltip) { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/REIConfigScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/REIConfigScreen.java index e9a766c5d..a845ea440 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/REIConfigScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/REIConfigScreen.java @@ -419,7 +419,7 @@ public class REIConfigScreen extends Screen implements ConfigAccess { this.widgets.remove(this.menuWidget); } this.menu = menu; - this.widgets.add(this.menuWidget = Widgets.withTranslate(menu, 0, 0, 300)); + this.widgets.add(this.menuWidget = menu); } @Override diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java index 1716578a5..b4d4d8170 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java @@ -36,7 +36,7 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.util.FormattedCharSequence; -import org.joml.Matrix4f; +import org.joml.Matrix3x2f; import static me.shedaniel.rei.api.client.gui.widgets.Widget.scissor; @@ -54,7 +54,7 @@ public class ConfigCategoryEntryWidget { return Widgets.concatWithBounds( bounds, label, - hasDescription ? Widgets.withTranslate(Widgets.withTranslate(descriptionLabel, new Matrix4f().scale(0.75f, 0.75f, 0.75f)), 21, 5 + 10, 0) : Widgets.noOp(), + hasDescription ? Widgets.withTranslate(Widgets.withTranslate(descriptionLabel, new Matrix3x2f().scale(0.75f, 0.75f)), 21, 5 + 10) : Widgets.noOp(), Widgets.createTexturedWidget(category.getIcon(), new Rectangle(3, hasDescription ? 5 : 3, 16, 16), 0, 0, 1, 1, 1, 1) ); } @@ -77,15 +77,15 @@ public class ConfigCategoryEntryWidget { try (CloseableScissors scissors = scissor(graphics, new Rectangle(x, y, width, y + 9))) { Font font = Minecraft.getInstance().font; int textWidth = font.width(text); - textWidth = MatrixUtils.transform(MatrixUtils.inverse(graphics.pose().last().pose()), new Rectangle(0, 0, textWidth, 100)).width; - width = MatrixUtils.transform(MatrixUtils.inverse(graphics.pose().last().pose()), new Rectangle(0, 0, width, 100)).width; + textWidth = MatrixUtils.transform(MatrixUtils.inverse(graphics.pose()), new Rectangle(0, 0, textWidth, 100)).width; + width = MatrixUtils.transform(MatrixUtils.inverse(graphics.pose()), new Rectangle(0, 0, width, 100)).width; if (textWidth > width && !ConfigUtils.isReducedMotion()) { - graphics.pose().pushPose(); + graphics.pose().pushMatrix(); float textX = (System.currentTimeMillis() % ((textWidth + 10) * textWidth / 3)) / (float) textWidth * 3; - graphics.pose().translate(-textX, 0, 0); + graphics.pose().translate(-textX, 0); graphics.drawString(font, text, x + width - textWidth - 10, y, color); graphics.drawString(font, text, x + width, y, color); - graphics.pose().popPose(); + graphics.pose().popMatrix(); } else { graphics.drawString(font, text, x, y, color); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigGroupWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigGroupWidget.java index 3fc908a54..2484a0bc4 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigGroupWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigGroupWidget.java @@ -41,7 +41,7 @@ import me.shedaniel.rei.impl.client.gui.text.TextTransformations; import net.minecraft.client.Minecraft; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Nullable; -import org.joml.Matrix4f; +import org.joml.Matrix3x2f; import java.util.*; import java.util.function.IntConsumer; @@ -80,7 +80,7 @@ public class ConfigGroupWidget { if (location == PreviewLocation.RIGHT) { WidgetWithBounds original = _create(access, entry, halfWidth); Widget background = createBackgroundSlot(() -> new Rectangle(halfWidth + 2, 0, width - halfWidth - 4, original.getBounds().height)); - Widget right = Widgets.withTranslate(pair.getRight().create(access, entry, width - halfWidth - 4, () -> original.getBounds().height), halfWidth + 2, 0, 0); + Widget right = Widgets.withTranslate(pair.getRight().create(access, entry, width - halfWidth - 4, () -> original.getBounds().height), halfWidth + 2, 0); contents = Widgets.concatWithBounds(() -> new Rectangle(0, 0, width, original.getBounds().height), original, background, right); } else { WidgetWithBounds original = _create(access, entry, width); @@ -89,11 +89,11 @@ public class ConfigGroupWidget { Widget background = createBackgroundSlot(widget::getBounds); if (location == PreviewLocation.TOP) { - WidgetWithBounds translatedOriginal = Widgets.withTranslate(original, () -> new Matrix4f().translate(0, widget.getBounds().height + 4, 0)); + WidgetWithBounds translatedOriginal = Widgets.withTranslate(original, () -> new Matrix3x2f().translate(0, widget.getBounds().height + 4)); contents = Widgets.concatWithBounds(() -> new Rectangle(0, 0, width, widget.getBounds().height + 4 + translatedOriginal.getBounds().height), translatedOriginal, background, widget); } else { contents = Widgets.concatWithBounds(() -> new Rectangle(0, 0, width, original.getBounds().getMaxY() + 2 + widget.getBounds().height), original, - Widgets.withTranslate(Widgets.concat(background, widget), () -> new Matrix4f().translate(0, original.getBounds().getMaxY() + 4, 0))); + Widgets.withTranslate(Widgets.concat(background, widget), () -> new Matrix3x2f().translate(0, original.getBounds().getMaxY() + 4))); } } } else { @@ -103,7 +103,7 @@ public class ConfigGroupWidget { return Widgets.concatWithBounds( () -> new Rectangle(0, 0, width, groupTitle.getBounds().getMaxY() + contents.getBounds().height), groupTitle, - Widgets.withTranslate(contents, () -> new Matrix4f().translate(0, groupTitle.getBounds().getMaxY(), 0)) + Widgets.withTranslate(contents, () -> new Matrix3x2f().translate(0, groupTitle.getBounds().getMaxY())) ); } @@ -145,23 +145,23 @@ public class ConfigGroupWidget { private record WidgetComposite( Widget widget, Supplier bounds, - Matrix4f translation + Matrix3x2f translation ) { public static WidgetComposite of(WidgetWithBounds widget) { - Matrix4f translation = new Matrix4f(); + Matrix3x2f translation = new Matrix3x2f(); return new WidgetComposite(Widgets.withTranslate(widget, translation), () -> MatrixUtils.transform(translation, widget.getBounds()), translation); } public static WidgetComposite ofNonAccounting(Widget widget) { - return new WidgetComposite(widget, Rectangle::new, new Matrix4f()); + return new WidgetComposite(widget, Rectangle::new, new Matrix3x2f()); } } private static void recalculateHeight(List widgets, IntConsumer setHeight) { int height = 0; for (WidgetComposite widget : widgets) { - widget.translation().set(new Matrix4f().translate(0, height, 0)); + widget.translation().set(new Matrix3x2f().translate(0, height)); height = Math.max(height, widget.bounds().get().getMaxY()); } setHeight.accept(height); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionValueWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionValueWidget.java index 4f9a83e96..a55207541 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionValueWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionValueWidget.java @@ -89,7 +89,7 @@ public class ConfigOptionValueWidget { .color(0xFFE0E0E0) .hoveredColor(0xFFE0E0E0) .onRender((poses, l) -> { - if (MatrixUtils.transform(poses.pose().last().pose(), l.getBounds()).contains(PointHelper.ofMouse())) { + if (MatrixUtils.transform(poses.pose(), l.getBounds()).contains(PointHelper.ofMouse())) { l.setMessage(text[0].copy().withStyle(ChatFormatting.UNDERLINE)); } else { l.setMessage(text[0]); @@ -112,7 +112,7 @@ public class ConfigOptionValueWidget { return Widgets.concatWithBounds(() -> new Rectangle(-label.getBounds().width, 0, label.getBounds().width + 8, 14), label, Widgets.withTranslate(Widgets.createTexturedWidget(ResourceLocation.parse("roughlyenoughitems:textures/gui/config/selector.png"), - new Rectangle(1, 1, 4, 6), 0, 0, 1, 1, 1, 1), 0, 0.5, 0) + new Rectangle(1, 1, 4, 6), 0, 0, 1, 1, 1, 1), 0, 0.5) ); } @@ -121,7 +121,7 @@ public class ConfigOptionValueWidget { BiConsumer render = label.getOnRender(); label.onRender((poses, $) -> { render.accept(poses, $); - bounds.setBounds(MatrixUtils.transform(poses.pose().last().pose(), label.getBounds())); + bounds.setBounds(MatrixUtils.transform(poses.pose(), label.getBounds())); }); int noOfOptions = selection.getOptions().size(); if (noOfOptions == 2) { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionWidget.java index 015dc1c75..94c2bddf3 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigOptionWidget.java @@ -43,7 +43,7 @@ import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.network.chat.MutableComponent; import net.minecraft.util.FormattedCharSequence; import org.jetbrains.annotations.Nullable; -import org.joml.Matrix4f; +import org.joml.Matrix3x2f; import java.util.ArrayList; import java.util.List; @@ -62,7 +62,7 @@ public class ConfigOptionWidget { .leftAligned() .rainbow(Objects.equals(option.getId(), AllREIConfigOptions.RAINBOW.getId()))); WidgetWithBounds optionValue = ConfigOptionValueWidget.create(access, option, width - 10 - fieldNameLabel.getBounds().width); - widgets.add(Widgets.withTranslate(optionValue, () -> new Matrix4f().translate(width - optionValue.getBounds().width - optionValue.getBounds().x, 0, 0))); + widgets.add(Widgets.withTranslate(optionValue, () -> new Matrix3x2f().translate(width - optionValue.getBounds().width - optionValue.getBounds().x, 0))); widgets.add(new WidgetWithBounds() { final MutableComponent description = Util.make(() -> { MutableComponent description = option.getDescription().copy(); @@ -85,7 +85,7 @@ public class ConfigOptionWidget { @Nullable WidgetWithBounds preview = null; boolean previewVisible = false; - Matrix4f previewTranslation = new Matrix4f(); + Matrix3x2f previewTranslation = new Matrix3x2f(); final NumberAnimator previewHeight = ValueAnimator.ofFloat() .withConvention(() -> previewVisible ? preview.getBounds().getHeight() : 0f, ValueAnimator.typicalTransitionTime()); boolean nextLinePreview = false; @@ -128,7 +128,7 @@ public class ConfigOptionWidget { if (this.preview != null && this.previewHeight.value() > 0.1f) { Rectangle rectangle = new Rectangle(0, 24 + 12 * split.size() - (nextLinePreview ? 0 : 12), width, this.previewHeight.value()); graphics.enableScissor(rectangle.x, rectangle.y, rectangle.getMaxX(), rectangle.getMaxY()); - this.previewTranslation = new Matrix4f().translate(0, 12 + 12 * split.size(), 100); + this.previewTranslation = new Matrix3x2f().translate(0, 12 + 12 * split.size()); this.preview.render(graphics, mouseX, mouseY, delta); graphics.disableScissor(); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigSearchWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigSearchWidget.java index 9d811892f..5d31a6206 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigSearchWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigSearchWidget.java @@ -84,7 +84,7 @@ public class ConfigSearchWidget { return new Rectangle(-1, -1, width.getAsInt() + 2, 21); } }, - Widgets.withTranslate(label, 0, 0.5, 0), + Widgets.withTranslate(label, 0, 0.5), Widgets.createTexturedWidget(ResourceLocation.parse("roughlyenoughitems:textures/gui/config/search_options.png"), new Rectangle(3, 3, 16, 16), 0, 0, 1, 1, 1, 1) ); } @@ -97,8 +97,8 @@ public class ConfigSearchWidget { @Override public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { boolean hovering = containsMouse(mouseX, mouseY); - graphics.pose().pushPose(); - graphics.pose().translate(-0.5, -0.5, 0); + graphics.pose().pushMatrix(); + graphics.pose().translate(-0.5f, -0.5f); for (Widget widget : List.of(Widgets.createFilledRectangle(new Rectangle(-1, -1, 18, 18), hovering ? 0x50FFFFFF : 0x25FFFFFF), Widgets.createFilledRectangle(new Rectangle(-3, -3, 22, 1), hovering ? 0x90FFFFFF : 0x45FFFFFF), Widgets.createFilledRectangle(new Rectangle(-3, 18, 22, 1), hovering ? 0x90FFFFFF : 0x45FFFFFF), @@ -106,7 +106,7 @@ public class ConfigSearchWidget { Widgets.createFilledRectangle(new Rectangle(18, -2, 1, 20), hovering ? 0x90FFFFFF : 0x45FFFFFF))) { widget.render(graphics, mouseX, mouseY, delta); } - graphics.pose().popPose(); + graphics.pose().popMatrix(); } @Override diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigCategories.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigCategories.java index 0204516e8..d94623230 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigCategories.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigCategories.java @@ -70,7 +70,7 @@ public interface AllREIConfigCategories { .add(CHEATS_CHEATS) .add(CHEATS_ADVANCED); OptionCategory PERFORMANCE = make("performance") - .add(PERFORMANCE_RENDERING) + /*.add(PERFORMANCE_RENDERING)*/ .add(PERFORMANCE_RELOAD); OptionCategory DEBUG = make("debug") .add(DEBUG_PERFORMANCE); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigGroups.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigGroups.java index bdb5a8168..adac70c7e 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigGroups.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigGroups.java @@ -110,9 +110,8 @@ public interface AllREIConfigGroups { .add(CHEATS_AMOUNT); OptionGroup CHEATS_ADVANCED = make("cheats.advanced") .add(GIVE_COMMAND); - OptionGroup PERFORMANCE_RENDERING = make("performance.rendering") - .add(BATCHED_RENDERING) - /*.add(CACHED_RENDERING)*/; + /*OptionGroup PERFORMANCE_RENDERING = make("performance.rendering") + .add(CACHED_RENDERING);*/ OptionGroup PERFORMANCE_RELOAD = make("performance.reload") .add(RELOAD_THREAD) .add(CACHED_DISPLAY_LOOKUP); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigOptions.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigOptions.java index 30a673e38..8648c0db2 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigOptions.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/AllREIConfigOptions.java @@ -248,8 +248,6 @@ public interface AllREIConfigOptions { .enumOptions(); CompositeOption GIVE_COMMAND = make("cheats.give_command", i -> i.advanced.commands.giveCommand, (i, v) -> i.advanced.commands.giveCommand = v) .string(); - CompositeOption BATCHED_RENDERING = make("performance.batched_rendering", i -> i.advanced.miscellaneous.newFastEntryRendering, (i, v) -> i.advanced.miscellaneous.newFastEntryRendering = v) - .enabledDisabled(); CompositeOption CACHED_RENDERING = make("performance.cached_rendering", i -> i.advanced.miscellaneous.cachingFastEntryRendering, (i, v) -> i.advanced.miscellaneous.cachingFastEntryRendering = v) .enabledDisabled(); CompositeOption RELOAD_THREAD = make("performance.reload_thread", i -> i.advanced.miscellaneous.registerRecipesInAnotherThread, (i, v) -> i.advanced.miscellaneous.registerRecipesInAnotherThread = v) diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/InterfacePreviewer.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/InterfacePreviewer.java index e314ba4c0..fc6420d25 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/InterfacePreviewer.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/InterfacePreviewer.java @@ -43,7 +43,7 @@ import me.shedaniel.rei.impl.client.gui.widget.basewidgets.PanelWidget; import net.minecraft.Util; import net.minecraft.world.item.Items; import org.jetbrains.annotations.Nullable; -import org.joml.Matrix4f; +import org.joml.Matrix3x2f; import java.util.ArrayList; import java.util.List; @@ -65,7 +65,7 @@ public class InterfacePreviewer { base.getBounds().setBounds(2, 2, width - 4, height.getAsInt() - 4); return base; }), - Widgets.withTranslate(widget, () -> new Matrix4f().translate(0, (height.getAsInt() - widget.getBounds().height) / 2, 0)) + Widgets.withTranslate(widget, () -> new Matrix3x2f().translate(0, (height.getAsInt() - widget.getBounds().height) / 2)) ); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/TooltipPreviewer.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/TooltipPreviewer.java index daadcc968..4c99a4d79 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/TooltipPreviewer.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/options/preview/TooltipPreviewer.java @@ -36,7 +36,6 @@ import me.shedaniel.rei.impl.client.gui.config.options.AllREIConfigOptions; import me.shedaniel.rei.impl.client.gui.config.options.ConfigUtils; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.RenderType; import net.minecraft.client.resources.language.I18n; import net.minecraft.util.FormattedCharSequence; import net.minecraft.world.item.ItemStack; @@ -71,35 +70,28 @@ public class TooltipPreviewer { int minHeight = components.stream().mapToInt(component -> components.get(0) == component && components.size() >= 2 ? 2 + 10 : 10).sum() + 4; int tX = Math.max(6, (width - minWidth) / 2), tWidth = Math.min(width - 12, minWidth), tY = 24 + 4, tHeight = Math.min(minHeight, height == null ? 100000 : height.getAsInt() - tY - 4); - graphics.pose().pushPose(); - graphics.pose().translate(0, height == null ? 4 : Math.max(0, (height.getAsInt() - (tY + tHeight)) / 2), 400); + graphics.pose().pushMatrix(); + graphics.pose().translate(0, height == null ? 4 : Math.max(0, (height.getAsInt() - (tY + tHeight)) / 2)); bounds.setSize(width, height == null ? tY + tHeight + 12 : height.getAsInt()); stack.getRenderer().render(stack, graphics, new Rectangle(width / 2 - 12, 0, 24, 24), mouseX, mouseY, delta); - graphics.pose().translate(0, 0, -400); int finalTY = tY; - graphics.drawSpecial(source -> { - VertexConsumer buffer = source.getBuffer(RenderType.gui()); - Matrix4f matrix4f = graphics.pose().last().pose(); - fillGradient(matrix4f, buffer, tX - 3, finalTY - 4, tX + tWidth + 3, finalTY - 3, 400, -267386864, -267386864); - fillGradient(matrix4f, buffer, tX - 3, finalTY + tHeight + 3, tX + tWidth + 3, finalTY + tHeight + 4, 400, -267386864, -267386864); - fillGradient(matrix4f, buffer, tX - 3, finalTY - 3, tX + tWidth + 3, finalTY + tHeight + 3, 400, -267386864, -267386864); - fillGradient(matrix4f, buffer, tX - 4, finalTY - 3, tX - 3, finalTY + tHeight + 3, 400, -267386864, -267386864); - fillGradient(matrix4f, buffer, tX + tWidth + 3, finalTY - 3, tX + tWidth + 4, finalTY + tHeight + 3, 400, -267386864, -267386864); - fillGradient(matrix4f, buffer, tX - 3, finalTY - 3 + 1, tX - 3 + 1, finalTY + tHeight + 3 - 1, 400, 1347420415, 1344798847); - fillGradient(matrix4f, buffer, tX + tWidth + 2, finalTY - 3 + 1, tX + tWidth + 3, finalTY + tHeight + 3 - 1, 400, 1347420415, 1344798847); - fillGradient(matrix4f, buffer, tX - 3, finalTY - 3, tX + tWidth + 3, finalTY - 3 + 1, 400, 1347420415, 1347420415); - fillGradient(matrix4f, buffer, tX - 3, finalTY + tHeight + 2, tX + tWidth + 3, finalTY + tHeight + 3, 400, 1344798847, 1344798847); - }); - - graphics.pose().translate(0, 0, 400); + graphics.fillGradient(tX - 3, finalTY - 4, tX + tWidth + 3, finalTY - 3, -267386864, -267386864); + graphics.fillGradient(tX - 3, finalTY + tHeight + 3, tX + tWidth + 3, finalTY + tHeight + 4, -267386864, -267386864); + graphics.fillGradient(tX - 3, finalTY - 3, tX + tWidth + 3, finalTY + tHeight + 3, -267386864, -267386864); + graphics.fillGradient(tX - 4, finalTY - 3, tX - 3, finalTY + tHeight + 3, -267386864, -267386864); + graphics.fillGradient(tX + tWidth + 3, finalTY - 3, tX + tWidth + 4, finalTY + tHeight + 3, -267386864, -267386864); + graphics.fillGradient(tX - 3, finalTY - 3 + 1, tX - 3 + 1, finalTY + tHeight + 3 - 1, 1347420415, 1344798847); + graphics.fillGradient(tX + tWidth + 2, finalTY - 3 + 1, tX + tWidth + 3, finalTY + tHeight + 3 - 1, 1347420415, 1344798847); + graphics.fillGradient(tX - 3, finalTY - 3, tX + tWidth + 3, finalTY - 3 + 1, 1347420415, 1347420415); + graphics.fillGradient(tX - 3, finalTY + tHeight + 2, tX + tWidth + 3, finalTY + tHeight + 3, 1344798847, 1344798847); for (int i = 0; i < components.size(); i++) { graphics.drawString(Minecraft.getInstance().font, components.get(i), tX + 2, tY + 2, -1, false); tY += 10 + (i == 0 ? 2 : 0); } - graphics.pose().popPose(); + graphics.pose().popMatrix(); }), bounds); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/credits/CreditsEntryListWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/credits/CreditsEntryListWidget.java index a38e17c3a..b198b0b25 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/credits/CreditsEntryListWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/credits/CreditsEntryListWidget.java @@ -150,7 +150,7 @@ public class CreditsEntryListWidget extends UpdatedListWidget= x && mouseX <= x + entryWidth && mouseY >= y && mouseY <= y + entryHeight; if (contains) { - graphics.renderTooltip(Minecraft.getInstance().font, Component.literal("Click to open link."), mouseX, mouseY); + graphics.setTooltipForNextFrame(Minecraft.getInstance().font, Component.literal("Click to open link."), mouseX, mouseY); int yy = y; for (FormattedCharSequence textSp : textSplit) { FormattedCharSequence underlined = characterVisitor -> { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/dragging/CurrentDraggingStack.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/dragging/CurrentDraggingStack.java index 4d032dfb8..977d977b4 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/dragging/CurrentDraggingStack.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/dragging/CurrentDraggingStack.java @@ -83,8 +83,6 @@ public class CurrentDraggingStack extends Widget implements LateRenderable, Drag } if (entry.dragging) { - graphics.pose().pushPose(); - graphics.pose().translate(0, 0, 600); entry.point.update(delta); entry.dimension.update(delta); int width = entry.component.getWidth(); @@ -93,7 +91,6 @@ public class CurrentDraggingStack extends Widget implements LateRenderable, Drag entry.point.setTo(new FloatingPoint(mouseX - mouseStartOffset.x * width, mouseY - mouseStartOffset.y * height), reducedMotion ? 0 : 30); entry.dimension.setTo(new FloatingDimension(width, height), reducedMotion ? 0 : 700); entry.component.render(graphics, getCurrentBounds(), mouseX, mouseY, delta); - graphics.pose().popPose(); VoxelShape shape = entry.getBoundsProvider().bounds(); ShapeBounds shapeBounds = new ShapeBounds(shape); @@ -122,10 +119,7 @@ public class CurrentDraggingStack extends Widget implements LateRenderable, Drag iterator.remove(); } else { bounds.shape.forAllBoxes((x1, y1, z1, x2, y2, z2) -> { - graphics.pose().pushPose(); - graphics.pose().translate(0, 0, 500); graphics.fillGradient((int) x1, (int) y1, (int) x2, (int) y2, 0xfdff6b | (bounds.alpha.intValue() << 24), 0xfdff6b | (bounds.alpha.intValue() << 24)); - graphics.pose().popPose(); }); } } @@ -140,10 +134,7 @@ public class CurrentDraggingStack extends Widget implements LateRenderable, Drag if (value.width < 2 || value.height < 2 || (Math.abs(value.x - target.x) <= 1.3 && Math.abs(value.y - target.y) <= 1.3 && Math.abs(value.width - target.width) <= 1 && Math.abs(value.height - target.height) <= 1)) { iterator.remove(); } else { - graphics.pose().pushPose(); - graphics.pose().translate(0, 0, 600); renderBackEntry.component.render(graphics, value.getBounds(), mouseX, mouseY, delta); - graphics.pose().popPose(); } } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/error/ErrorsEntryListWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/error/ErrorsEntryListWidget.java index e7228efa6..3cf51dce1 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/error/ErrorsEntryListWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/error/ErrorsEntryListWidget.java @@ -35,7 +35,7 @@ import net.minecraft.client.gui.components.events.ContainerEventHandler; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.RenderPipelines; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.network.chat.Component; @@ -47,8 +47,8 @@ import net.minecraft.util.FormattedCharSequence; import net.minecraft.util.Mth; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; -import org.joml.Matrix4f; -import org.joml.Vector4f; +import org.joml.Matrix3x2f; +import org.joml.Vector3f; import java.net.URI; import java.net.URISyntaxException; @@ -181,12 +181,12 @@ public class ErrorsEntryListWidget extends DynamicSmoothScrollingEntryListWidget public static class ScaledEntry extends Entry implements ContainerEventHandler { public final Entry entry; public final float scale; - public final Matrix4f transform; + public final Matrix3x2f transform; public ScaledEntry(Entry entry, float scale) { this.entry = entry; this.scale = scale; - this.transform = new Matrix4f().scale(scale, scale, scale); + this.transform = new Matrix3x2f().scale(scale, scale); } public Entry getEntry() { @@ -194,22 +194,22 @@ public class ErrorsEntryListWidget extends DynamicSmoothScrollingEntryListWidget return entry; } - private Vector4f transformMouse(double mouseX, double mouseY) { - Vector4f mouse = new Vector4f((float) mouseX, (float) mouseY, 0, 1); + private Vector3f transformMouse(double mouseX, double mouseY) { + Vector3f mouse = new Vector3f((float) mouseX, (float) mouseY, 1); transform.transform(mouse); return mouse; } @Override public void render(GuiGraphics graphics, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isSelected, float delta) { - Vector4f mouse = transformMouse(mouseX, mouseY); - graphics.pose().pushPose(); - graphics.pose().last().pose().mul(transform); + Vector3f mouse = transformMouse(mouseX, mouseY); + graphics.pose().pushMatrix(); + graphics.pose().mul(transform); - Vector4f pos = new Vector4f(x, y, 0, 1); - pos.mul(new Matrix4f().scale(1 / scale, 1 / scale, 1 / scale)); + Vector3f pos = new Vector3f(x, y, 1); + pos.mul(new Matrix3x2f().scale(1 / scale, 1 / scale)); getEntry().render(graphics, index, Math.round(pos.y()), Math.round(pos.x()), Math.round(entryWidth / scale), Math.round(entryHeight / scale), (int) mouse.x(), (int) mouse.y(), isSelected, delta); - graphics.pose().popPose(); + graphics.pose().popMatrix(); } @Override @@ -229,31 +229,31 @@ public class ErrorsEntryListWidget extends DynamicSmoothScrollingEntryListWidget @Override public boolean isMouseOver(double mouseX, double mouseY) { - Vector4f mouse = transformMouse(mouseX, mouseY); + Vector3f mouse = transformMouse(mouseX, mouseY); return super.isMouseOver(mouse.x(), mouse.y()); } @Override public boolean mouseClicked(double d, double e, int i) { - Vector4f mouse = transformMouse(d, e); + Vector3f mouse = transformMouse(d, e); return super.mouseClicked(mouse.x(), mouse.y(), i); } @Override public boolean mouseReleased(double d, double e, int i) { - Vector4f mouse = transformMouse(d, e); + Vector3f mouse = transformMouse(d, e); return super.mouseReleased(mouse.x(), mouse.y(), i); } @Override public boolean mouseDragged(double d, double e, int i, double f, double g) { - Vector4f mouse = transformMouse(d, e); + Vector3f mouse = transformMouse(d, e); return super.mouseDragged(mouse.x(), mouse.y(), i, f, g); } @Override public boolean mouseScrolled(double d, double e, double amountX, double amountY) { - Vector4f mouse = transformMouse(d, e); + Vector3f mouse = transformMouse(d, e); return super.mouseScrolled(mouse.x(), mouse.y(), amountX, amountY); } @@ -316,7 +316,7 @@ public class ErrorsEntryListWidget extends DynamicSmoothScrollingEntryListWidget if (style.getHoverEvent() != null) { HoverEvent hoverEvent = style.getHoverEvent(); if (hoverEvent instanceof HoverEvent.ShowText(Component component)) { - graphics.renderTooltip(Minecraft.getInstance().font, Minecraft.getInstance().font.split(component, Math.max(this.width / 2, 200)), x, y); + graphics.setTooltipForNextFrame(Minecraft.getInstance().font, Minecraft.getInstance().font.split(component, Math.max(this.width / 2, 200)), x, y); } } } @@ -400,7 +400,7 @@ public class ErrorsEntryListWidget extends DynamicSmoothScrollingEntryListWidget width = (entryWidth - 6) / 2; this.height = (int) ((double) width * ((double) image.getHeight() / (double) image.getWidth())); graphics.fill(x, y, x + width, y + height + 2, 0xFFFFFFFF); - graphics.innerBlit(RenderType::guiTextured, id, x + 1, x + width - 1, y + 1, y + height + 1, 0, 0, 1, 0, 1); + graphics.innerBlit(RenderPipelines.GUI_TEXTURED, id, x + 1, x + width - 1, y + 1, y + height + 1, 0, 0, 1, 0, 1); } @Override @@ -425,7 +425,7 @@ public class ErrorsEntryListWidget extends DynamicSmoothScrollingEntryListWidget public void render(GuiGraphics graphics, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isSelected, float delta) { contains = mouseX >= x && mouseX <= x + entryWidth && mouseY >= y && mouseY <= y + entryHeight; if (contains) { - graphics.renderTooltip(Minecraft.getInstance().font, Component.literal("Click to open link."), mouseX, mouseY); + graphics.setTooltipForNextFrame(Minecraft.getInstance().font, Component.literal("Click to open link."), mouseX, mouseY); int yy = y; for (FormattedCharSequence textSp : textSplit) { FormattedCharSequence underlined = characterVisitor -> { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/error/ErrorsScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/error/ErrorsScreen.java index 956d85b02..0084c732b 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/error/ErrorsScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/error/ErrorsScreen.java @@ -28,8 +28,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractButton; import net.minecraft.client.gui.components.Button; -import net.minecraft.client.gui.screens.GenericMessageScreen; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.network.chat.Component; import org.jetbrains.annotations.ApiStatus; @@ -88,12 +88,12 @@ public class ErrorsScreen extends Screen { private void exit() { boolean localServer = this.minecraft.isLocalServer(); - this.minecraft.level.disconnect(); + this.minecraft.level.disconnect(ClientLevel.DEFAULT_QUIT_MESSAGE); if (localServer) { - this.minecraft.disconnect(new GenericMessageScreen(Component.translatable("menu.savingLevel"))); + this.minecraft.disconnectWithSavingScreen(); } else { - this.minecraft.disconnect(); + this.minecraft.disconnectWithProgressScreen(); } System.exit(-1); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/hints/ImportantWarningsWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/hints/ImportantWarningsWidget.java index 66daf5c3f..8ce9a93a3 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/hints/ImportantWarningsWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/hints/ImportantWarningsWidget.java @@ -24,7 +24,6 @@ package me.shedaniel.rei.impl.client.gui.hints; import me.shedaniel.math.Rectangle; -import me.shedaniel.rei.RoughlyEnoughItemsCoreClient; import me.shedaniel.rei.api.client.ClientHelper; import me.shedaniel.rei.api.client.gui.config.DisplayPanelLocation; import me.shedaniel.rei.api.client.gui.widgets.WidgetWithBounds; @@ -90,28 +89,27 @@ public class ImportantWarningsWidget extends WidgetWithBounds { public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { if (!visible) return; - graphics.pose().pushPose(); - graphics.pose().translate(0, 0, 900); + graphics.pose().pushMatrix(); graphics.fill(bounds.x - 5, bounds.y - 5, bounds.getMaxX() + 5, bounds.getMaxY() + 5, 0x90111111); int y = bounds.y; for (Component text : texts) { - graphics.pose().pushPose(); - graphics.pose().translate(bounds.x, y, 0); - graphics.pose().scale(0.5f, 0.5f, 1); + graphics.pose().pushMatrix(); + graphics.pose().translate(bounds.x, y); + graphics.pose().scale(0.5f, 0.5f);