From 667c7993dcea8b09bdffcad9956b353f054ad6e2 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Mon, 17 Jun 2024 00:07:02 +0900 Subject: Update to 1.21 --- .../rei/RoughlyEnoughItemsCoreClient.java | 4 +- .../shedaniel/rei/RoughlyEnoughItemsNetwork.java | 16 +-- .../shedaniel/rei/impl/client/REIRuntimeImpl.java | 4 +- .../rei/impl/client/config/ConfigManagerImpl.java | 2 +- .../collapsible/CollapsibleConfigManager.java | 2 +- .../client/config/entries/FilteringScreen.java | 18 ++- .../rules/FilteringRuleTypeRegistryImpl.java | 6 +- .../rei/impl/client/gui/InternalTextures.java | 14 +-- .../config/components/ConfigOptionValueWidget.java | 2 +- .../gui/config/components/ConfigSearchWidget.java | 4 +- .../gui/config/options/AllREIConfigCategories.java | 2 +- .../config/options/preview/TooltipPreviewer.java | 13 +- .../performance/entry/SubCategoryListEntry.java | 2 +- .../gui/screen/AbstractDisplayViewingScreen.java | 5 +- .../gui/screen/DefaultDisplayViewingScreen.java | 5 +- .../SearchFilterSyntaxHighlightingScreen.java | 18 ++- .../gui/screen/UncertainDisplayViewingScreen.java | 4 +- .../collapsible/CollapsibleEntriesScreen.java | 7 +- .../screen/collapsible/CollapsibleEntryWidget.java | 18 ++- .../CustomCollapsibleEntrySelectionScreen.java | 14 +-- .../gui/screen/generic/OptionEntriesScreen.java | 2 +- .../gui/toast/CopyRecipeIdentifierToast.java | 2 +- .../gui/toast/ExportRecipeIdentifierToast.java | 2 +- .../client/gui/widget/CatchingExceptionUtils.java | 7 +- .../gui/widget/CraftableFilterButtonWidget.java | 6 +- .../client/gui/widget/DisplayTooltipComponent.java | 2 +- .../widget/DynamicErrorFreeEntryListWidget.java | 131 ++++++++++----------- .../rei/impl/client/gui/widget/HoleWidget.java | 31 ++--- .../impl/client/gui/widget/InternalWidgets.java | 2 +- .../impl/client/gui/widget/UpdatedListWidget.java | 2 +- .../gui/widget/basewidgets/ButtonWidget.java | 4 +- .../basewidgets/FillRectangleDrawableConsumer.java | 18 ++- .../gui/widget/basewidgets/TextFieldWidget.java | 18 ++- .../basewidgets/TexturedDrawableConsumer.java | 13 +- .../gui/widget/entrylist/CachingEntryRenderer.java | 8 +- .../widget/entrylist/CollapsedEntriesTooltip.java | 5 +- .../favorites/history/DisplayHistoryWidget.java | 31 ++--- .../panel/FadingFavoritesPanelButton.java | 6 +- .../gui/widget/region/RegionRenderingDebugger.java | 7 +- .../screen/DefaultScreenOverlayRenderer.java | 4 +- .../client/search/method/DefaultInputMethod.java | 2 +- .../search/method/InputMethodRegistryImpl.java | 4 +- .../impl/client/transfer/MissingStacksTooltip.java | 6 +- .../common/category/CategoryIdentifierImpl.java | 2 +- .../entry/DeferringEntryTypeProviderImpl.java | 2 +- .../common/transfer/SlotAccessorRegistryImpl.java | 2 +- .../impl/init/RoughlyEnoughItemsInitializer.java | 4 +- .../client/runtime/DefaultClientRuntimePlugin.java | 10 +- .../runtime/HideIngredientsFromTagsPlugin.java | 4 +- .../plugin/client/runtime/InputMethodWatcher.java | 2 +- .../common/runtime/DefaultRuntimePlugin.java | 6 +- 51 files changed, 227 insertions(+), 278 deletions(-) (limited to 'runtime/src/main/java') diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java index 8d748f704..f25e40735 100644 --- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java +++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java @@ -148,7 +148,7 @@ public class RoughlyEnoughItemsCoreClient { ClientInternals.attachInstance((BiFunction>, Supplier, FavoriteEntry>) DelegatingFavoriteEntryProviderImpl::new, "delegateFavoriteEntry"); ClientInternals.attachInstance((Function>) (object) -> { String type = object.getString(FavoriteEntry.TYPE_KEY); - ResourceLocation id = new ResourceLocation(type); + ResourceLocation id = ResourceLocation.parse(type); FavoriteEntryType entryType = FavoriteEntryType.registry().get(id); if (entryType == null) return DataResult.error(() -> "Unknown favorite type: " + id + ", json: " + object); return entryType.read(object); @@ -314,7 +314,7 @@ public class RoughlyEnoughItemsCoreClient { private void registerEvents() { Minecraft client = Minecraft.getInstance(); - final ResourceLocation recipeButtonTex = new ResourceLocation("textures/gui/recipe_button.png"); + final ResourceLocation recipeButtonTex = ResourceLocation.withDefaultNamespace("textures/gui/recipe_button.png"); MutableLong startReload = new MutableLong(-1); MutableLong endReload = new MutableLong(-1); PRE_UPDATE_RECIPES.register(recipeManager -> { diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java index 71c49dca9..399850cf2 100644 --- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java +++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java @@ -60,14 +60,14 @@ import java.util.List; import java.util.Map; public class RoughlyEnoughItemsNetwork { - public static final ResourceLocation DELETE_ITEMS_PACKET = new ResourceLocation("roughlyenoughitems", "delete_item"); - public static final ResourceLocation CREATE_ITEMS_PACKET = new ResourceLocation("roughlyenoughitems", "create_item"); - public static final ResourceLocation CREATE_ITEMS_HOTBAR_PACKET = new ResourceLocation("roughlyenoughitems", "create_item_hotbar"); - public static final ResourceLocation CREATE_ITEMS_GRAB_PACKET = new ResourceLocation("roughlyenoughitems", "create_item_grab"); - public static final ResourceLocation CREATE_ITEMS_MESSAGE_PACKET = new ResourceLocation("roughlyenoughitems", "ci_msg"); - public static final ResourceLocation MOVE_ITEMS_PACKET = new ResourceLocation("roughlyenoughitems", "move_items"); - public static final ResourceLocation MOVE_ITEMS_NEW_PACKET = new ResourceLocation("roughlyenoughitems", "move_items_new"); - public static final ResourceLocation NOT_ENOUGH_ITEMS_PACKET = new ResourceLocation("roughlyenoughitems", "og_not_enough"); + public static final ResourceLocation DELETE_ITEMS_PACKET = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "delete_item"); + public static final ResourceLocation CREATE_ITEMS_PACKET = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "create_item"); + public static final ResourceLocation CREATE_ITEMS_HOTBAR_PACKET = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "create_item_hotbar"); + public static final ResourceLocation CREATE_ITEMS_GRAB_PACKET = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "create_item_grab"); + public static final ResourceLocation CREATE_ITEMS_MESSAGE_PACKET = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "ci_msg"); + public static final ResourceLocation MOVE_ITEMS_PACKET = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "move_items"); + public static final ResourceLocation MOVE_ITEMS_NEW_PACKET = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "move_items_new"); + public static final ResourceLocation NOT_ENOUGH_ITEMS_PACKET = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "og_not_enough"); public static void onInitialize() { NetworkManager.registerReceiver(NetworkManager.c2s(), DELETE_ITEMS_PACKET, Collections.singletonList(new SplitPacketTransformer()), (buf, context) -> { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/REIRuntimeImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/REIRuntimeImpl.java index fad1fdf6c..33eccf0ab 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/REIRuntimeImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/REIRuntimeImpl.java @@ -64,8 +64,8 @@ import static me.shedaniel.rei.impl.client.gui.widget.entrylist.EntryListWidget. @ApiStatus.Internal @Environment(EnvType.CLIENT) public class REIRuntimeImpl implements REIRuntime { - private static final ResourceLocation DISPLAY_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/display.png"); - private static final ResourceLocation DISPLAY_TEXTURE_DARK = new ResourceLocation("roughlyenoughitems", "textures/gui/display_dark.png"); + private static final ResourceLocation DISPLAY_TEXTURE = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/display.png"); + private static final ResourceLocation DISPLAY_TEXTURE_DARK = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/display_dark.png"); @ApiStatus.Internal public static boolean isWithinRecipeViewingScreen = false; private ScreenOverlayImpl overlay; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java index 61f94a829..af3720cec 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java @@ -87,7 +87,7 @@ public class ConfigManagerImpl implements ConfigManager { return new JsonPrimitive(location == null ? null : location.toString()); }); builder.registerDeserializer(String.class, ResourceLocation.class, (value, marshaller) -> { - return value == null ? null : new ResourceLocation(value); + return value == null ? null : ResourceLocation.parse(value); }); // CheatingMode diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/collapsible/CollapsibleConfigManager.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/collapsible/CollapsibleConfigManager.java index 1a7781111..ebe6ee330 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/collapsible/CollapsibleConfigManager.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/collapsible/CollapsibleConfigManager.java @@ -82,7 +82,7 @@ public class CollapsibleConfigManager { } public static final class CustomGroup { - public ResourceLocation id = new ResourceLocation("missingno"); + public ResourceLocation id = ResourceLocation.withDefaultNamespace("missingno"); public String name = "Invalid"; public List> stacks = new ArrayList<>(); 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 7b4886390..0d3db41b0 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 @@ -26,10 +26,7 @@ package me.shedaniel.rei.impl.client.config.entries; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.BufferBuilder; -import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.Tesselator; -import com.mojang.blaze3d.vertex.VertexFormat; +import com.mojang.blaze3d.vertex.*; import me.shedaniel.clothconfig2.ClothConfigInitializer; import me.shedaniel.clothconfig2.api.ScissorsHandler; import me.shedaniel.clothconfig2.api.scroll.ScrollingContainer; @@ -253,17 +250,16 @@ public class FilteringScreen extends Screen { ScissorsHandler.INSTANCE.removeLastScissor(); Tesselator tesselator = Tesselator.getInstance(); - BufferBuilder buffer = tesselator.getBuilder(); + BufferBuilder buffer = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(770, 771, 0, 1); RenderSystem.setShader(GameRenderer::getPositionTexColorShader); Matrix4f matrix = graphics.pose().last().pose(); - buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); - buffer.vertex(matrix, 0, bounds.y + 4, 0.0F).uv(0.0F, 1.0F).color(0, 0, 0, 0).endVertex(); - buffer.vertex(matrix, width, bounds.y + 4, 0.0F).uv(1.0F, 1.0F).color(0, 0, 0, 0).endVertex(); - buffer.vertex(matrix, width, bounds.y, 0.0F).uv(1.0F, 0.0F).color(0, 0, 0, 255).endVertex(); - buffer.vertex(matrix, 0, bounds.y, 0.0F).uv(0.0F, 0.0F).color(0, 0, 0, 255).endVertex(); - tesselator.end(); + buffer.addVertex(matrix, 0, bounds.y + 4, 0.0F).setUv(0.0F, 1.0F).setColor(0, 0, 0, 0); + buffer.addVertex(matrix, width, bounds.y + 4, 0.0F).setUv(1.0F, 1.0F).setColor(0, 0, 0, 0); + buffer.addVertex(matrix, width, bounds.y, 0.0F).setUv(1.0F, 0.0F).setColor(0, 0, 0, 255); + buffer.addVertex(matrix, 0, bounds.y, 0.0F).setUv(0.0F, 0.0F).setColor(0, 0, 0, 255); + BufferUploader.drawWithShader(buffer.buildOrThrow()); RenderSystem.disableBlend(); this.backButton.render(graphics, mouseX, mouseY, delta); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/FilteringRuleTypeRegistryImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/FilteringRuleTypeRegistryImpl.java index befadebc2..9ceee11c9 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/FilteringRuleTypeRegistryImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/FilteringRuleTypeRegistryImpl.java @@ -42,9 +42,9 @@ public class FilteringRuleTypeRegistryImpl extends AbstractList> types = HashBiMap.create(); public FilteringRuleTypeRegistryImpl() { - register(new ResourceLocation("roughlyenoughitems", "search"), SearchFilteringRuleType.INSTANCE); - register(new ResourceLocation("roughlyenoughitems", "manual"), ManualFilteringRuleType.INSTANCE); - register(new ResourceLocation("roughlyenoughitems", "basic"), BasicFilteringRuleType.INSTANCE); + register(ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "search"), SearchFilteringRuleType.INSTANCE); + register(ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "manual"), ManualFilteringRuleType.INSTANCE); + register(ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "basic"), BasicFilteringRuleType.INSTANCE); } @Override diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/InternalTextures.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/InternalTextures.java index 58636bb9e..96e5b4eac 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/InternalTextures.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/InternalTextures.java @@ -26,12 +26,12 @@ package me.shedaniel.rei.impl.client.gui; import net.minecraft.resources.ResourceLocation; public class InternalTextures { - public static final ResourceLocation ARROW_LEFT_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/arrow_left.png"); - public static final ResourceLocation ARROW_RIGHT_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/arrow_right.png"); - public static final ResourceLocation ARROW_LEFT_SMALL_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/arrow_left_small.png"); - public static final ResourceLocation ARROW_RIGHT_SMALL_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/arrow_right_small.png"); - public static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/recipecontainer.png"); - public static final ResourceLocation CHEST_GUI_TEXTURE_DARK = new ResourceLocation("roughlyenoughitems", "textures/gui/recipecontainer_dark.png"); + public static final ResourceLocation ARROW_LEFT_TEXTURE = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/arrow_left.png"); + public static final ResourceLocation ARROW_RIGHT_TEXTURE = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/arrow_right.png"); + public static final ResourceLocation ARROW_LEFT_SMALL_TEXTURE = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/arrow_left_small.png"); + public static final ResourceLocation ARROW_RIGHT_SMALL_TEXTURE = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/arrow_right_small.png"); + public static final ResourceLocation CHEST_GUI_TEXTURE = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/recipecontainer.png"); + public static final ResourceLocation CHEST_GUI_TEXTURE_DARK = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/recipecontainer_dark.png"); @Deprecated(forRemoval = true) - public static final ResourceLocation LEGACY_DIRT = new ResourceLocation("textures/block/dirt.png"); + public static final ResourceLocation LEGACY_DIRT = ResourceLocation.withDefaultNamespace("textures/block/dirt.png"); } 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 a469a95b5..1e2a67292 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 @@ -114,7 +114,7 @@ public class ConfigOptionValueWidget { return Widgets.concatWithBounds(() -> new Rectangle(-label.getBounds().width, 0, label.getBounds().width + 8, 14), label, Widgets.createDrawableWidget((graphics, mouseX, mouseY, delta) -> matrix[0] = graphics.pose().last().pose()), - Widgets.withTranslate(Widgets.createTexturedWidget(new ResourceLocation("roughlyenoughitems:textures/gui/config/selector.png"), + 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) ); } 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 f910d88e0..40986fc47 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 @@ -85,7 +85,7 @@ public class ConfigSearchWidget { } }, Widgets.withTranslate(label, 0, 0.5, 0), - Widgets.createTexturedWidget(new ResourceLocation("roughlyenoughitems:textures/gui/config/search_options.png"), new Rectangle(3, 3, 16, 16), 0, 0, 1, 1, 1, 1) + Widgets.createTexturedWidget(ResourceLocation.parse("roughlyenoughitems:textures/gui/config/search_options.png"), new Rectangle(3, 3, 16, 16), 0, 0, 1, 1, 1, 1) ); } @@ -126,7 +126,7 @@ public class ConfigSearchWidget { return false; } }, - Widgets.createTexturedWidget(new ResourceLocation("roughlyenoughitems:textures/gui/config/search_options.png"), bounds, 0, 0, 1, 1, 1, 1) + Widgets.createTexturedWidget(ResourceLocation.parse("roughlyenoughitems:textures/gui/config/search_options.png"), bounds, 0, 0, 1, 1, 1, 1) ), translatable("config.rei.texts.search_options")); } 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 40e94ae10..9f2b659d1 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 @@ -33,7 +33,7 @@ import static me.shedaniel.rei.impl.client.gui.config.options.ConfigUtils.transl public interface AllREIConfigCategories { static OptionCategory make(String key) { - return OptionCategory.of(key, new ResourceLocation("roughlyenoughitems:textures/gui/config/" + key + ".png"), + return OptionCategory.of(key, ResourceLocation.parse("roughlyenoughitems:textures/gui/config/" + key + ".png"), translatable("config.rei.categories." + key), translatable("config.rei.categories." + key + ".desc")); } 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 cfe3386aa..c1234fe9d 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 @@ -79,9 +79,8 @@ public class TooltipPreviewer { graphics.pose().translate(0, 0, -400); Tesselator tesselator = Tesselator.getInstance(); - BufferBuilder bufferBuilder = tesselator.getBuilder(); RenderSystem.setShader(GameRenderer::getPositionColorShader); - bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); + BufferBuilder bufferBuilder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); Matrix4f matrix4f = graphics.pose().last().pose(); fillGradient(matrix4f, bufferBuilder, tX - 3, tY - 4, tX + tWidth + 3, tY - 3, 400, -267386864, -267386864); fillGradient(matrix4f, bufferBuilder, tX - 3, tY + tHeight + 3, tX + tWidth + 3, tY + tHeight + 4, 400, -267386864, -267386864); @@ -95,7 +94,7 @@ public class TooltipPreviewer { RenderSystem.enableDepthTest(); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); - BufferUploader.drawWithShader(bufferBuilder.end()); + BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); RenderSystem.disableBlend(); graphics.pose().translate(0, 0, 400); @@ -118,9 +117,9 @@ public class TooltipPreviewer { float k = (float) (color2 >> 16 & 0xFF) / 255.0F; float l = (float) (color2 >> 8 & 0xFF) / 255.0F; float m = (float) (color2 & 0xFF) / 255.0F; - builder.vertex(pose, (float) x2, (float) y1, (float) blitOffset).color(g, h, i, f).endVertex(); - builder.vertex(pose, (float) x1, (float) y1, (float) blitOffset).color(g, h, i, f).endVertex(); - builder.vertex(pose, (float) x1, (float) y2, (float) blitOffset).color(k, l, m, j).endVertex(); - builder.vertex(pose, (float) x2, (float) y2, (float) blitOffset).color(k, l, m, j).endVertex(); + builder.addVertex(pose, (float) x2, (float) y1, (float) blitOffset).setColor(g, h, i, f); + builder.addVertex(pose, (float) x1, (float) y1, (float) blitOffset).setColor(g, h, i, f); + builder.addVertex(pose, (float) x1, (float) y2, (float) blitOffset).setColor(k, l, m, j); + builder.addVertex(pose, (float) x2, (float) y2, (float) blitOffset).setColor(k, l, m, j); } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/performance/entry/SubCategoryListEntry.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/performance/entry/SubCategoryListEntry.java index 322c6cf5a..21c3f5120 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/performance/entry/SubCategoryListEntry.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/performance/entry/SubCategoryListEntry.java @@ -47,7 +47,7 @@ import java.util.List; @Environment(EnvType.CLIENT) public class SubCategoryListEntry extends PerformanceScreen.PerformanceEntry implements Expandable { - private static final ResourceLocation CONFIG_TEX = new ResourceLocation("cloth-config2", "textures/gui/cloth_config.png"); + private static final ResourceLocation CONFIG_TEX = ResourceLocation.fromNamespaceAndPath("cloth-config2", "textures/gui/cloth_config.png"); private final List entries; private final CategoryLabelWidget widget; private final List children; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/AbstractDisplayViewingScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/AbstractDisplayViewingScreen.java index 86ea00243..c8323b368 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/AbstractDisplayViewingScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/AbstractDisplayViewingScreen.java @@ -412,10 +412,9 @@ public abstract class AbstractDisplayViewingScreen extends Screen implements Dis int y1 = y + 13 + (i / w) * entrySize; i++; if (i / w > 5) { - MultiBufferSource.BufferSource source = MultiBufferSource.immediate(Tesselator.getInstance().getBuilder()); Component text = Component.literal("+" + (widget.getEntries().size() - w * 6 + 1)).withStyle(ChatFormatting.GRAY); - font.drawInBatch(text, x1 + entrySize / 2 - font.width(text) / 2, y1 + entrySize / 2 - 1, -1, true, graphics.pose().last().pose(), source, Font.DisplayMode.NORMAL, 0, 15728880); - source.endBatch(); + font.drawInBatch(text, x1 + entrySize / 2 - font.width(text) / 2, y1 + entrySize / 2 - 1, -1, true, graphics.pose().last().pose(), graphics.bufferSource(), Font.DisplayMode.NORMAL, 0, 15728880); + graphics.flush(); break; } else { entry.render(graphics, new Rectangle(x1, y1, entrySize, entrySize), -1000, -1000, 0); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java index 278ecd2e1..dab319fe6 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java @@ -345,12 +345,11 @@ public class DefaultDisplayViewingScreen extends AbstractDisplayViewingScreen { if (bounds.contains(mouseX, mouseY)) { graphics.fillGradient(bounds.x, bounds.y, bounds.getMaxX(), bounds.getMaxY(), 1744822402, 1744822402); Component text = Component.translatable("text.rei.release_export", export.getLocalizedName().plainCopy().getString()); - MultiBufferSource.BufferSource immediate = MultiBufferSource.immediate(Tesselator.getInstance().getBuilder()); graphics.pose().pushPose(); graphics.pose().translate(0.0D, 0.0D, 10.0D); Matrix4f matrix4f = graphics.pose().last().pose(); - font.drawInBatch(text.getVisualOrderText(), bounds.getCenterX() - font.width(text) / 2f, bounds.getCenterY() - 4.5f, 0xff000000, false, matrix4f, immediate, Font.DisplayMode.NORMAL, 0, 15728880); - immediate.endBatch(); + font.drawInBatch(text.getVisualOrderText(), bounds.getCenterX() - font.width(text) / 2f, bounds.getCenterY() - 4.5f, 0xff000000, false, matrix4f, graphics.bufferSource(), Font.DisplayMode.NORMAL, 0, 15728880); + graphics.flush(); graphics.pose().popPose(); } else { graphics.fillGradient(bounds.x, bounds.y, bounds.getMaxX(), bounds.getMaxY(), 1744830463, 1744830463); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/SearchFilterSyntaxHighlightingScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/SearchFilterSyntaxHighlightingScreen.java index 6a0be5926..47851ed43 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/SearchFilterSyntaxHighlightingScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/SearchFilterSyntaxHighlightingScreen.java @@ -24,10 +24,7 @@ package me.shedaniel.rei.impl.client.gui.screen; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.BufferBuilder; -import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.Tesselator; -import com.mojang.blaze3d.vertex.VertexFormat; +import com.mojang.blaze3d.vertex.*; import me.shedaniel.rei.impl.client.gui.InternalTextures; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; @@ -50,16 +47,15 @@ public class SearchFilterSyntaxHighlightingScreen extends Screen { protected void renderHoleBackground(GuiGraphics graphics, int y1, int y2, int tint, int alpha1, int alpha2) { Tesselator tesselator = Tesselator.getInstance(); - BufferBuilder buffer = tesselator.getBuilder(); RenderSystem.setShaderTexture(0, InternalTextures.LEGACY_DIRT); Matrix4f matrix = graphics.pose().last().pose(); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShader(GameRenderer::getPositionTexColorShader); - buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); - buffer.vertex(matrix, 0, y2, 0.0F).uv(0.0F, y2 / 32.0F).color(tint, tint, tint, alpha2).endVertex(); - buffer.vertex(matrix, this.width, y2, 0.0F).uv(this.width / 32.0F, y2 / 32.0F).color(tint, tint, tint, alpha2).endVertex(); - buffer.vertex(matrix, this.width, y1, 0.0F).uv(this.width / 32.0F, y1 / 32.0F).color(tint, tint, tint, alpha1).endVertex(); - buffer.vertex(matrix, 0, y1, 0.0F).uv(0.0F, y1 / 32.0F).color(tint, tint, tint, alpha1).endVertex(); - tesselator.end(); + BufferBuilder buffer = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); + buffer.addVertex(matrix, 0, y2, 0.0F).setUv(0.0F, y2 / 32.0F).setColor(tint, tint, tint, alpha2); + buffer.addVertex(matrix, this.width, y2, 0.0F).setUv(this.width / 32.0F, y2 / 32.0F).setColor(tint, tint, tint, alpha2); + buffer.addVertex(matrix, this.width, y1, 0.0F).setUv(this.width / 32.0F, y1 / 32.0F).setColor(tint, tint, tint, alpha1); + buffer.addVertex(matrix, 0, y1, 0.0F).setUv(0.0F, y1 / 32.0F).setColor(tint, tint, tint, alpha1); + BufferUploader.drawWithShader(buffer.buildOrThrow()); } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/UncertainDisplayViewingScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/UncertainDisplayViewingScreen.java index c621477b3..6370d18a1 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/UncertainDisplayViewingScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/UncertainDisplayViewingScreen.java @@ -53,8 +53,8 @@ import java.util.List; @ApiStatus.Internal public class UncertainDisplayViewingScreen extends Screen { - private static final ResourceLocation DEFAULT = new ResourceLocation("roughlyenoughitems", "textures/gui/screenshot_default.png"); - private static final ResourceLocation COMPOSITE = new ResourceLocation("roughlyenoughitems", "textures/gui/screenshot_composite.png"); + private static final ResourceLocation DEFAULT = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/screenshot_default.png"); + private static final ResourceLocation COMPOSITE = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/screenshot_composite.png"); private final List widgets; protected long start; protected long duration; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntriesScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntriesScreen.java index cdba4de56..861104ca1 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntriesScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntriesScreen.java @@ -118,7 +118,7 @@ public class CollapsibleEntriesScreen extends Screen { { Component addText = Component.literal(" + "); addRenderableWidget(new Button(width - 4 - 20, 4, 20, 20, addText, $ -> { - setupCustom(new ResourceLocation("custom:" + UUID.randomUUID()), "", new ArrayList<>(), this.configObject, () -> { + setupCustom(ResourceLocation.parse("custom:" + UUID.randomUUID()), "", new ArrayList<>(), this.configObject, () -> { this.prepareWidgets(configObject); this.dirty = true; }); @@ -185,11 +185,10 @@ public class CollapsibleEntriesScreen extends Screen { Component debugText = Component.literal(String.format("%s fps", minecraft.fpsString.split(" ")[0])); int stringWidth = font.width(debugText); graphics.fillGradient(minecraft.screen.width - stringWidth - 2, 32, minecraft.screen.width, 32 + font.lineHeight + 2, -16777216, -16777216); - MultiBufferSource.BufferSource immediate = MultiBufferSource.immediate(Tesselator.getInstance().getBuilder()); graphics.pose().pushPose(); Matrix4f matrix = graphics.pose().last().pose(); - font.drawInBatch(debugText.getVisualOrderText(), minecraft.screen.width - stringWidth, 32 + 2, -1, false, matrix, immediate, Font.DisplayMode.NORMAL, 0, 15728880); - immediate.endBatch(); + font.drawInBatch(debugText.getVisualOrderText(), minecraft.screen.width - stringWidth, 32 + 2, -1, false, matrix, graphics.bufferSource(), Font.DisplayMode.NORMAL, 0, 15728880); + graphics.flush(); graphics.pose().popPose(); } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntryWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntryWidget.java index d814495b0..909e2dee8 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntryWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntryWidget.java @@ -24,10 +24,7 @@ package me.shedaniel.rei.impl.client.gui.screen.collapsible; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.BufferBuilder; -import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.Tesselator; -import com.mojang.blaze3d.vertex.VertexFormat; +import com.mojang.blaze3d.vertex.*; import me.shedaniel.clothconfig2.ClothConfigInitializer; import me.shedaniel.clothconfig2.api.animator.ProgressValueAnimator; import me.shedaniel.clothconfig2.api.animator.ValueAnimator; @@ -260,18 +257,17 @@ public class CollapsibleEntryWidget extends WidgetWithBounds { if (this.stacks.size() > rowSize * 3) { Tesselator tesselator = Tesselator.getInstance(); - BufferBuilder buffer = tesselator.getBuilder(); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.setShader(GameRenderer::getPositionColorShader); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); Matrix4f matrix = graphics.pose().last().pose(); - buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); - buffer.vertex(matrix, this.x + 1, this.y + this.height - 1, 0.0F).color(0xFF000000).endVertex(); - buffer.vertex(matrix, this.x + this.width - 1, this.y + this.height - 1, 0.0F).color(0xFF000000).endVertex(); - buffer.vertex(matrix, this.x + this.width - 1, this.y + this.height - 40, 0.0F).color(0x00000000).endVertex(); - buffer.vertex(matrix, this.x + 1, this.y + this.height - 40, 0.0F).color(0x00000000).endVertex(); - tesselator.end(); + BufferBuilder buffer = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR); + buffer.addVertex(matrix, this.x + 1, this.y + this.height - 1, 0.0F).setColor(0xFF000000); + buffer.addVertex(matrix, this.x + this.width - 1, this.y + this.height - 1, 0.0F).setColor(0xFF000000); + buffer.addVertex(matrix, this.x + this.width - 1, this.y + this.height - 40, 0.0F).setColor(0x00000000); + buffer.addVertex(matrix, this.x + 1, this.y + this.height - 40, 0.0F).setColor(0x00000000); + BufferUploader.drawWithShader(buffer.buildOrThrow()); RenderSystem.disableBlend(); } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/selection/CustomCollapsibleEntrySelectionScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/selection/CustomCollapsibleEntrySelectionScreen.java index 70edcb4b7..114cc47f9 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/selection/CustomCollapsibleEntrySelectionScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/selection/CustomCollapsibleEntrySelectionScreen.java @@ -41,7 +41,6 @@ import me.shedaniel.rei.api.client.search.SearchFilter; 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.InternalTextures; 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.EntryWidget; @@ -247,17 +246,16 @@ public class CustomCollapsibleEntrySelectionScreen extends Screen { ScissorsHandler.INSTANCE.removeLastScissor(); Tesselator tesselator = Tesselator.getInstance(); - BufferBuilder buffer = tesselator.getBuilder(); RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(770, 771, 0, 1); RenderSystem.setShader(GameRenderer::getPositionTexColorShader); Matrix4f matrix = graphics.pose().last().pose(); - buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); - buffer.vertex(matrix, 0, bounds.y + 4, 0.0F).uv(0.0F, 1.0F).color(0, 0, 0, 0).endVertex(); - buffer.vertex(matrix, width, bounds.y + 4, 0.0F).uv(1.0F, 1.0F).color(0, 0, 0, 0).endVertex(); - buffer.vertex(matrix, width, bounds.y, 0.0F).uv(1.0F, 0.0F).color(0, 0, 0, 255).endVertex(); - buffer.vertex(matrix, 0, bounds.y, 0.0F).uv(0.0F, 0.0F).color(0, 0, 0, 255).endVertex(); - tesselator.end(); + BufferBuilder buffer = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); + buffer.addVertex(matrix, 0, bounds.y + 4, 0.0F).setUv(0.0F, 1.0F).setColor(0, 0, 0, 0); + buffer.addVertex(matrix, width, bounds.y + 4, 0.0F).setUv(1.0F, 1.0F).setColor(0, 0, 0, 0); + buffer.addVertex(matrix, width, bounds.y, 0.0F).setUv(1.0F, 0.0F).setColor(0, 0, 0, 255); + buffer.addVertex(matrix, 0, bounds.y, 0.0F).setUv(0.0F, 0.0F).setColor(0, 0, 0, 255); + BufferUploader.drawWithShader(buffer.buildOrThrow()); RenderSystem.disableBlend(); this.backButton.render(graphics, mouseX, mouseY, delta); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/generic/OptionEntriesScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/generic/OptionEntriesScreen.java index 9618d987b..3235297a4 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/generic/OptionEntriesScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/generic/OptionEntriesScreen.java @@ -270,7 +270,7 @@ public abstract class OptionEntriesScreen extends Screen { } public static class SubListEntry extends ListEntry { - private static final ResourceLocation CONFIG_TEX = new ResourceLocation("cloth-config2", "textures/gui/cloth_config.png"); + private static final ResourceLocation CONFIG_TEX = ResourceLocation.fromNamespaceAndPath("cloth-config2", "textures/gui/cloth_config.png"); private final CategoryLabelWidget widget; private final List rules; private final List children; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/toast/CopyRecipeIdentifierToast.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/toast/CopyRecipeIdentifierToast.java index 7b6f3c473..c3122d0e1 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/toast/CopyRecipeIdentifierToast.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/toast/CopyRecipeIdentifierToast.java @@ -35,7 +35,7 @@ import org.jetbrains.annotations.Nullable; @ApiStatus.Internal public class CopyRecipeIdentifierToast implements Toast { - protected static final ResourceLocation TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/toasts.png"); + protected static final ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/toasts.png"); private String title; private String subtitle; private long startTime; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/toast/ExportRecipeIdentifierToast.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/toast/ExportRecipeIdentifierToast.java index e738ba10a..6692b61b1 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/toast/ExportRecipeIdentifierToast.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/toast/ExportRecipeIdentifierToast.java @@ -35,7 +35,7 @@ import org.jetbrains.annotations.Nullable; @ApiStatus.Internal public class ExportRecipeIdentifierToast implements Toast { - protected static final ResourceLocation TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/toasts.png"); + protected static final ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPath("roughlyenoughitems", "textures/gui/toasts.png"); private String title; private String subtitle; private long startTime; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CatchingExceptionUtils.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CatchingExceptionUtils.java index f05a08268..5d36d6f39 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CatchingExceptionUtils.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CatchingExceptionUtils.java @@ -27,6 +27,7 @@ import me.shedaniel.rei.impl.client.gui.error.ErrorsEntryListWidget; import me.shedaniel.rei.impl.client.gui.error.ErrorsScreen; import me.shedaniel.rei.impl.client.util.CrashReportUtils; import net.minecraft.CrashReport; +import net.minecraft.ReportType; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.language.I18n; import net.minecraft.network.chat.Component; @@ -45,13 +46,13 @@ public class CatchingExceptionUtils { File reportsFolder = new File(Minecraft.getInstance().gameDirectory, "crash-reports"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss"); File crashReportFile = new File(reportsFolder, "crash-" + format.format(new Date()) + "-client.txt"); - report.saveToFile(crashReportFile); - Bootstrap.realStdoutPrintln(report.getFriendlyReport()); + report.saveToFile(crashReportFile.toPath(), ReportType.CRASH); + Bootstrap.realStdoutPrintln(report.getFriendlyReport(ReportType.CRASH)); List components = new ArrayList<>(); components.add(Component.literal(I18n.get("text.rei.crash.description", report.getTitle()))); components.add((Function) width -> new ErrorsEntryListWidget.LinkEntry(Component.translatable("text.rei.crash.crash_report"), crashReportFile.toURI().toString(), width)); components.add(Component.empty()); - components.add(Component.literal(report.getFriendlyReport().replace("\t", " "))); + components.add(Component.literal(report.getFriendlyReport(ReportType.CRASH).replace("\t", " "))); Minecraft.getInstance().setScreen(new ErrorsScreen(Component.translatable("text.rei.crash.title"), components, null, false)); } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CraftableFilterButtonWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CraftableFilterButtonWidget.java index 7c4be3db9..d2adbccc4 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CraftableFilterButtonWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CraftableFilterButtonWidget.java @@ -142,13 +142,13 @@ public class CraftableFilterButtonWidget { InternalLogger.getInstance().error("Failed to dispose input method", throwable); } - ConfigManagerImpl.getInstance().getConfig().setInputMethodId(new ResourceLocation("rei:default")); + ConfigManagerImpl.getInstance().getConfig().setInputMethodId(ResourceLocation.parse("rei:default")); }).join(); double[] progress = {0}; CompletableFuture future = pair.getValue().prepare(service, p -> progress[0] = Mth.clamp(p, 0, 1)).whenComplete((unused, throwable) -> { if (throwable != null) { InternalLogger.getInstance().error("Failed to prepare input method", throwable); - ConfigManagerImpl.getInstance().getConfig().setInputMethodId(new ResourceLocation("rei:default")); + ConfigManagerImpl.getInstance().getConfig().setInputMethodId(ResourceLocation.parse("rei:default")); } else { ConfigManagerImpl.getInstance().getConfig().setInputMethodId(pair.getKey()); } @@ -160,7 +160,7 @@ public class CraftableFilterButtonWidget { }, () -> { Minecraft.getInstance().setScreen(screen); InternalLogger.getInstance().error("Failed to prepare input method: cancelled"); - ConfigManagerImpl.getInstance().getConfig().setInputMethodId(new ResourceLocation("rei:default")); + ConfigManagerImpl.getInstance().getConfig().setInputMethodId(ResourceLocation.parse("rei:default")); future.cancel(Platform.isFabric()); service.shutdown(); }); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/DisplayTooltipComponent.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/DisplayTooltipComponent.java index 21a80773f..33a885c75 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/DisplayTooltipComponent.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/DisplayTooltipComponent.java @@ -99,7 +99,7 @@ public class DisplayTooltipComponent implements TooltipComponent, ClientTooltipC graphics.pose().pushPose(); Rectangle transformedBounds = MatrixUtils.transform(MatrixUtils.inverse(graphics.pose().last().pose()), new Rectangle(x + 2, y + 2, bounds.width, bounds.height)); Point mouse = MatrixUtils.transform(graphics.pose().last().pose(), PointHelper.ofMouse()); - craftingResult.renderer.render(graphics, mouse.x, mouse.y, Minecraft.getInstance().getDeltaFrameTime(), + craftingResult.renderer.render(graphics, mouse.x, mouse.y, Minecraft.getInstance().getTimer().getRealtimeDeltaTicks(), widgets, transformedBounds, display.provideInternalDisplay()); graphics.pose().popPose(); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/DynamicErrorFreeEntryListWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/DynamicErrorFreeEntryListWidget.java index ff93a2659..353ee22b0 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/DynamicErrorFreeEntryListWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/DynamicErrorFreeEntryListWidget.java @@ -25,10 +25,7 @@ package me.shedaniel.rei.impl.client.gui.widget; import com.google.common.collect.Lists; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.BufferBuilder; -import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.Tesselator; -import com.mojang.blaze3d.vertex.VertexFormat; +import com.mojang.blaze3d.vertex.*; import me.shedaniel.rei.api.client.gui.AbstractContainerEventHandler; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -221,7 +218,18 @@ public abstract class DynamicErrorFreeEntryListWidget 0) { int int_9 = ((this.bottom - this.top) * (this.bottom - this.top)) / this.getMaxScrollPosition(); int_9 = Mth.clamp(int_9, 32, this.bottom - this.top - 8); @@ -298,20 +293,20 @@ public abstract class DynamicErrorFreeEntryListWidget