Add in-game patch descriptions

This commit is contained in:
embeddedt 2023-07-03 17:04:20 -04:00
parent dd4a72a6f9
commit 18f78b9624
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
5 changed files with 190 additions and 7 deletions

View File

@ -0,0 +1,46 @@
package org.embeddedt.modernfix.screen;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.util.FormattedCharSequence;
public class ModernFixOptionInfoScreen extends Screen {
private final Screen lastScreen;
private final Component description;
public ModernFixOptionInfoScreen(Screen lastScreen, String optionName) {
super(new TextComponent(optionName));
this.lastScreen = lastScreen;
this.description = new TranslatableComponent("modernfix.option." + optionName);
}
@Override
protected void init() {
super.init();
this.addButton(new Button(this.width / 2 - 100, this.height - 29, 200, 20, CommonComponents.GUI_DONE, (button) -> {
this.minecraft.setScreen(lastScreen);
}));
}
private void drawMultilineString(PoseStack mStack, Font fr, Component str, int x, int y) {
for(FormattedCharSequence s : fr.split(str, this.width - 50)) {
fr.drawShadow(mStack, s, (float)x, (float)y, 16777215);
y += fr.lineHeight;
}
}
@Override
public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTicks) {
this.renderBackground(poseStack);
drawCenteredString(poseStack, this.font, this.title, this.width / 2, 8, 16777215);
this.drawMultilineString(poseStack, this.minecraft.font, description, 10, 50);
super.render(poseStack, mouseX, mouseY, partialTicks);
}
}

View File

@ -7,6 +7,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
@ -14,10 +15,13 @@ import net.minecraft.network.chat.TranslatableComponent;
import org.embeddedt.modernfix.ModernFix;
import org.embeddedt.modernfix.core.ModernFixMixinPlugin;
import org.embeddedt.modernfix.core.config.Option;
import org.embeddedt.modernfix.platform.ModernFixPlatformHooks;
import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
public class OptionList extends ContainerObjectSelectionList<OptionList.Entry> {
@ -26,6 +30,8 @@ public class OptionList extends ContainerObjectSelectionList<OptionList.Entry> {
private static final Component OPTION_ON = new TranslatableComponent("modernfix.option.on").withStyle(style -> style.withColor(ChatFormatting.GREEN));
private static final Component OPTION_OFF = new TranslatableComponent("modernfix.option.off").withStyle(style -> style.withColor(ChatFormatting.RED));
private static final Set<String> OPTIONS_MISSING_HELP = new HashSet<>();
private ModernFixConfigScreen mainScreen;
@ -36,7 +42,14 @@ public class OptionList extends ContainerObjectSelectionList<OptionList.Entry> {
int maxW = 0;
Map<String, Option> optionMap = ModernFixMixinPlugin.instance.config.getOptionMap();
List<String> sortedKeys = optionMap.keySet().stream().filter(key -> !key.equals("mixin.core")).sorted().collect(Collectors.toList());
List<String> sortedKeys = optionMap.keySet().stream().filter(key -> {
int dotCount = 0;
for(char c : key.toCharArray()) {
if(c == '.')
dotCount++;
}
return dotCount >= 2;
}).sorted().collect(Collectors.toList());
for(String key : sortedKeys) {
Option option = optionMap.get(key);
int w = this.minecraft.font.width(key);
@ -58,12 +71,13 @@ public class OptionList extends ContainerObjectSelectionList<OptionList.Entry> {
private final String name;
private final Button toggleButton;
private final Button helpButton;
private final Option option;
public OptionEntry(String optionName, Option option) {
this.name = optionName;
this.option = option;
this.toggleButton = new Button(0, 0, 95, 20, new TextComponent(""), (arg) -> {
this.toggleButton = new Button(0, 0, 55, 20, new TextComponent(""), (arg) -> {
this.option.setEnabled(!this.option.isEnabled(), !this.option.isUserDefined());
try {
ModernFixMixinPlugin.instance.config.save();
@ -76,6 +90,14 @@ public class OptionList extends ContainerObjectSelectionList<OptionList.Entry> {
ModernFix.LOGGER.error("Unable to save config", e);
}
});
this.helpButton = new Button(75, 0, 20, 20, new TextComponent("?"), (arg) -> {
Minecraft.getInstance().setScreen(new ModernFixOptionInfoScreen(mainScreen, optionName));
});
if(!I18n.exists("modernfix.option." + optionName)) {
this.helpButton.active = false;
if(ModernFixPlatformHooks.isDevEnv() && OPTIONS_MISSING_HELP.add(optionName))
ModernFix.LOGGER.warn("Missing help for {}", optionName);
}
}
@Override
@ -88,6 +110,9 @@ public class OptionList extends ContainerObjectSelectionList<OptionList.Entry> {
this.toggleButton.y = top;
this.toggleButton.setMessage(getOptionMessage(this.option));
this.toggleButton.render(matrixStack, mouseX, mouseY, partialTicks);
this.helpButton.x = left + 175 + 55;
this.helpButton.y = top;
this.helpButton.render(matrixStack, mouseX, mouseY, partialTicks);
}
private Component getOptionMessage(Option option) {
@ -96,15 +121,23 @@ public class OptionList extends ContainerObjectSelectionList<OptionList.Entry> {
@Override
public List<? extends GuiEventListener> children() {
return ImmutableList.of(this.toggleButton);
return ImmutableList.of(this.toggleButton, this.helpButton);
}
public boolean mouseClicked(double mouseX, double mouseY, int button) {
return this.toggleButton.mouseClicked(mouseX, mouseY, button);
for(GuiEventListener listener : children()) {
if(listener.mouseClicked(mouseX, mouseY, button))
return true;
}
return false;
}
public boolean mouseReleased(double mouseX, double mouseY, int button) {
return this.toggleButton.mouseReleased(mouseX, mouseY, button);
for(GuiEventListener listener : children()) {
if(listener.mouseReleased(mouseX, mouseY, button))
return true;
}
return false;
}
}

View File

@ -9,5 +9,51 @@
"modernfix.option.off": "off",
"modernfix.config.not_default": " (modified)",
"asynclocator.map.locating": "Map (Locating...)",
"asynclocator.map.none": "Map (No nearby feature found)"
"asynclocator.map.none": "Map (No nearby feature found)",
"modernfix.option.mixin.perf.async_jei": "1.16 only. **A key optimization.** Patches JEI to perform its reloading on a background thread, completely eliminating the long delay it adds to world loading.",
"modernfix.option.mixin.perf.async_locator": "1.16 only. Backports the Async Locator mod's patches to eliminate server freezes associated with `/locate`, loot table generation, etc.",
"modernfix.option.mixin.perf.biome_zoomer": "1.16 only. Minor optimization to improve the performance of the biome zoomer using logic from 1.18.",
"modernfix.option.mixin.perf.blast_search_trees": "All versions. If REI or JEI are installed, construction of the vanilla search trees for creative searching is disabled, and searching is instead done using these mods' search implementations. This saves several seconds during world loading, and probably also saves some RAM as well (although I have not measured).",
"modernfix.option.mixin.perf.boost_worker_count": "1.16 only. Removes the hardcoded cap on worker thread count, similarly to what Mojang did in 1.18.",
"modernfix.option.mixin.perf.cache_blockstate_cache_arrays": "All versions. Avoids creating fresh copies of enum arrays each time a blockstate cache is initialized. Minor optimization, but easy to do.",
"modernfix.option.mixin.perf.cache_model_materials": "All versions. Memoizes the `RenderMaterial` (texture) collection and dependency list that models return instead of requiring them to be recalculated on each request. Helps accelerate the model load/bake process.",
"modernfix.option.mixin.perf.cache_strongholds": "All versions. Saves the generated list of stronghold positions with the world, instead of regenerating it on every world load. Saves a little bit of time on 1.16, and quite a bit more on 1.18 and 1.19.",
"modernfix.option.mixin.perf.cache_upgraded_structures": "All versions. Many mods ship outdated structure files, which requires the game to upgrade them using DFU every single time they are loaded. This can be quite slow. This patch adds logic to instead save the upgraded version of the structure, and reuse it on the next load. To handle the case that the mod changes a structure file but not the name, the original file's hash is compared against the cached version, and if they do not match the structure will be upgraded again.",
"modernfix.option.mixin.perf.compress_biome_container": "1.16 only. Minor optimization borrowed from Hydrogen, which attempts to save space in the biome container when possible. This gets disabled automatically if conflicting mods like BetterEnd or Chocolate are installed.",
"modernfix.option.mixin.perf.datapack_reload_exceptions": "All versions. Reduces log spam and possibly slightly improves loading speed by not printing the stacktraces for some commonly thrown exceptions during datapack reload (e.g. missing items in loot tables/recipes). The message is still printed.",
"modernfix.option.mixin.perf.dedicated_reload_executor": "All versions. Moves resource pack and data pack reloading to a dedicated worker pool instead of using the default `Worker-Main` threads. This allows mods to Smooth Boot to still potentially improve singleplayer performance at runtime while not slowing down launch due to a limited thread count.",
"modernfix.option.mixin.perf.deduplicate_location": "All versions, but disabled by default due to load time impact. Deduplicates resource location namespaces and paths. This saves RAM but also increases the cost of constructing a new `ResourceLocation` by quite a bit.",
"modernfix.option.mixin.perf.dynamic_dfu": "All versions. Modifies DFU initialization to happen the first time something needs to be upgraded. This sounds similar to LazyDFU but is distinctly implemented, as it avoids loading *any* DFU classes/data structures, while LazyDFU only disables rule optimization. Essentially, this option is a safer version of DataFixerSlayer as it will still load DFU when needed.\n\nYou should typically continue to use LazyDFU even with this option enabled, as otherwise DFU rule optimization will cause lag.",
"modernfix.option.mixin.perf.dynamic_resources": "All versions. See https://github.com/embeddedt/ModernFix/wiki/Dynamic-Resources-FAQ.",
"modernfix.option.mixin.perf.dynamic_structure_manager": "All versions. Allows the game to unload structure files after generation concludes instead of keeping them loaded forever.",
"modernfix.option.mixin.perf.fast_registry_validation": "All versions. Forge needlessly looks up a method via reflection every single time a registry is validated. This patch simply caches the returned value since it will be the same every time.",
"modernfix.option.mixin.perf.faster_font_loading": "All versions. Optimizes the font renderer to load fonts faster, speeding up resource reload.",
"modernfix.option.mixin.perf.faster_item_rendering": "All versions. Avoids rendering the sides of items in GUIs. (Yes, vanilla appears to do that.)\n\nThis can triple FPS with a mod like REI/JEI installed on weaker GPUs, if enough items are visible. Disabled by default since it's new and not tested much, but should be safe. The most likely issue is items being completely invisible in GUIs, or appearing flat in the world.",
"modernfix.option.mixin.perf.faster_texture_loading": "All versions pre 1.19.4. Avoids reading textures twice (the first time using a very slow code path) and instead does one faster load (similar to 1.19.3+).",
"modernfix.option.mixin.perf.faster_texture_stitching": "All versions. Enables the game to use a faster texture stitching system originally written by SuperCoder79 for lwjgl3ify on 1.7.10, which can save some time during loading. Rarely, it's been reported to cause weird artifacts on blocks or in GUIs, this may be a Sodium bug.",
"modernfix.option.mixin.perf.jeresources_startup": "1.16 only. Optimizes Just Enough Resources to not needlessly recreate villager entities many times for the same profession, which saves time during JEI startup.",
"modernfix.option.mixin.perf.kubejs": "1.16 only. Optimizations to KubeJS to avoid needless `ItemStack` copying, etc., which reduces the time taken to load datapacks.",
"modernfix.option.mixin.perf.model_optimizations": "All versions. Implements optimizations to speed up the model loading process.",
"modernfix.option.mixin.perf.nbt_memory_usage": "All versions. Uses a more efficient backing map for compound NBT tags that deduplicates key names and also uses an array map for very small compounds. This reduces the overhead of storing many compound tags in memory.",
"modernfix.option.mixin.perf.nuke_empty_chunk_sections": "1.16 only, inspired by Hydrogen. Avoids storing chunk sections that are full of air in memory, instead marking them as empty.",
"modernfix.option.mixin.perf.reduce_blockstate_cache_rebuilds": "All versions. **A key optimization.** Newer Minecraft versions (after 1.12) implemented a blockstate cache system that caches frequently used information about a blockstate, such as whether it is solid, its collision shape, etc. Rebuilding this cache is quite fast in vanilla (it takes only a second or two) but is quite slow with many mods installed, as there are many more blockstates present in the game which all must have their caches rebuilt.\n\nThis problem is exacerbated by Forge as the cache is rebuilt at many points when the data would almost certainly be unused before the next rebuild. Examples include right before reaching the main menu (during the \"Freezing data\" stage), as well as multiple (!) times when a world is being loaded.\n\nModernFix solves this performance bottleneck by instead making cache rebuilds lazy. Each blockstate rebuilds its cache the first time the data would be accessed. At any point when vanilla or Forge would attempt to rebuild caches for all blockstates, this is redirected to simply invalidate the cache on each blockstate instead.\n\nThis should not have any impact on TPS after startup concludes.",
"modernfix.option.mixin.perf.remove_biome_temperature_cache": "All versions. Removes the biome temperature cache as Lithium does on modern versions.",
"modernfix.option.mixin.perf.resourcepacks": "All versions. **A key optimization.** Launches on modern versions are heavily bottlenecked by filesystem access. Many requests are frequently made to resource packs to list resources or check if a given resource exists, and each of these result in a very slow file API call.\n\nModernFix completely eliminates most of the bottleneck here by simply caching a listing of all resources that exist within mod-provided and vanilla resourcepacks. The cache is rebuilt on resource reload (except for the vanilla resources, since they should never change while the game is running).\n\nThere are no known compatibility issues with this patch except for OptiFine (its CTM resources do not load correctly). However I do not recommend using OptiFine in any scenario, as it adds several minutes to launch time by itself and is not tested with ModernFix at all.",
"modernfix.option.mixin.perf.reuse_datapacks": "1.16 only. Attempts to speed up switching between singleplayer worlds by skipping the datapack reload when possible. May cause compatibility issues with some mods, but is currently enabled by default.",
"modernfix.option.mixin.perf.rewrite_registry": "All versions. **Currently semi-broken.** Aggressively replaces some internals of the Forge registry system with faster versions, however it currently causes freezes when loading some modpacks. Off by default for obvious reasons.",
"modernfix.option.mixin.perf.skip_first_datapack_reload": "1.16 & 1.19 only. **A key optimization.**\n\nIn the middle of the 1.16 development cycle, Forge patched the game to reload datapacks twice when loading an existing world, in order to fix an issue with biome ID shifting. Unfortunately, datapack reloads often take upwards of 30 seconds and so this very severely affects world loading times.\n\nModernFix makes the necessary changes to avoid this reload, based on the unfinished Forge PR #8163.\n\nThis change was removed by Forge in 1.18, but then a similar patch was added *again* in 1.19 to fix mod datapacks not being loaded when creating new singleplayer worlds. Fortunately, the issue is localized to the world creation screen in 1.19, and existing worlds only require a single reload. However, this still doubles the length of the lag spike when clicking \"Create New World\" in 1.19, and so ModernFix again makes changes to not perform a redundant reload.",
"modernfix.option.mixin.perf.state_definition_construct": "All versions. Enabled only if FerriteCore is installed. Takes advantage of FerriteCore's handling of blockstates to speed up their creation. This can help speed up launch with mods that add lots of blockstates, such as furniture mods.",
"modernfix.option.mixin.perf.sync_executor_sleep": "All versions. Avoids having the main thread spin idly consuming one CPU core while waiting for the modloading workers to finish.",
"modernfix.option.mixin.perf.thread_priorities": "All versions. Adjusts the worker and server thread priorities to be lower than the client thread. This helps improve FPS stability on machines with few CPU cores, provided that the Java implementation in use respects priorities.",
"modernfix.option.mixin.perf.use_integrated_resources": "Mostly for 1.16. Patches JEResources to use the integrated server's loot table data if playing singleplayer, rather than pointlessly reloading loot tables. Saves a couple more seconds during JEI startup.",
"modernfix.option.mixin.bugfix.concurrency": "The patches in this group fix concurrency-related issues within Minecraft and/or Forge. Most of them result in rare, hard-to-diagnose crashes during loading.",
"modernfix.option.mixin.bugfix.edge_chunk_not_saved": "This option is a port of SuperCoder's Chunk Saving Fix mod (because I didn't realize it was already available for Forge at the time).",
"modernfix.option.mixin.bugfix.mc218112": "This option fixes a deadlock that can occur if an exception is thrown while processing entity data. Vanilla does not correctly unlock the data manager when it should. This is tracked as MC-218112 on the bug tracker, and was fixed by Mojang in 1.17.",
"modernfix.option.mixin.bugfix.packet_leak": "**Experimental**, not enabled by default. An attempted fix for the memory leak issue that occurs after playing long enough on 1.16.",
"modernfix.option.mixin.bugfix.paper_chunk_patches": "1.18 and newer. **A key optimization.** Ports a patch from Paper that fixes issues on 1.17 with chunkloading requiring huge amounts of memory and generating many `CompletableFuture` instances. 1.18+ are now able to load worlds on only 400MB of memory like 1.16 could.",
"modernfix.option.mixin.bugfix.tf_cme_on_load": "Patches Twilight Forest to perform non-thread-safe client setup using the main thread as it should, rather than the FML worker thread.",
"modernfix.option.mixin.feature.branding": "Adds ModernFix to the branding list on the title screen, and also to the F3 screen.",
"modernfix.option.mixin.feature.direct_stack_trace": "Normally off, can be enabled to force the raw stack trace to be dumped to the log when a crash occurs. Occasionally vanilla's crash report system fails to work properly and gives an entirely irrelevant stack trace/report.",
"modernfix.option.mixin.feature.measure_time": "Uses a couple injections to measure world load time, datapack reload time, resource reload time, bootstrap time, and adds the necessary hooks to enable vanilla's unused profiler logic for resource reloading if so configured.",
"modernfix.option.mixin.feature.spam_thread_dump": "**To be used for debugging purposes only.** Causes a thread dump to be output to the log every 60 seconds. This can help to diagnose unexplained freezes during loading/gameplay."
}

View File

@ -9,5 +9,50 @@
"modernfix.option.off": "关闭",
"modernfix.config.not_default": " (已修改)",
"asynclocator.map.locating": "地图(定位中……)",
"asynclocator.map.none": "地图(未能在附近找到相关地物)"
"asynclocator.map.none": "地图(未能在附近找到相关地物)",
"modernfix.option.mixin.perf.async_jei": "仅 1.16。一项关键优化。对 JEI 进行了调整,让其重载运行于后台线程,完全消除了它在载入世界时造成的巨大延迟。",
"modernfix.option.mixin.perf.biome_zoomer": "仅 1.16。使用 1.18 版本的逻辑进行微优化,提高生物群系过渡生成的性能。",
"modernfix.option.mixin.perf.async_locator": "仅 1.16。移植了 Async Locator 模组的补丁,以消除与 `/locate`、战利品表生成等相关事物的服务器冻结现象。",
"modernfix.option.mixin.perf.blast_search_trees": "全版本共有。如果安装了 REI 或者 JEI原版创造模式物品栏的搜索功能构建将被禁用取而代之地是这两种模组中的搜索实现。这在加载世界时会节省几秒钟并可能虽然 embeddedt 没有测试)会降低一些内存。",
"modernfix.option.mixin.perf.boost_worker_count": "仅 1.16。移除被硬编码的工作线程数量上限,类似于 Mojang 在 1.18 中所做的。",
"modernfix.option.mixin.perf.cache_blockstate_cache_arrays": "全版本共有。避免每次初始化方块状态缓存时对枚举数组进行的一次复制。次要的优化,但很容易做到。",
"modernfix.option.mixin.perf.cache_model_materials": "全版本共有。记录`RenderMaterial`(纹理)集合和模型返回的依赖列表,而不是要求它们在每次请求中都重复计算一次,有助于加快模型加载/烘焙进程。",
"modernfix.option.mixin.perf.cache_strongholds": "全版本共有。将生成的要塞位置列表与世界一起保存,而非再每次加载世界时都重新生成。在 1.16 版本中可以减少一点世界加载时间,在 1.18 和 1.19 中减少的会更多。",
"modernfix.option.mixin.perf.cache_upgraded_structures": "全版本共有。许多模组的结构文件已经过时,这就要求游戏在每次加载它们时都要用 DFU 来升级它们。这个升级过程可能是相当慢的。此补丁添加了一些逻辑,保存结构的升级版本,并在下次加载时直接重新使用它们。为了处理模组改变了结构文件但没有改变名称的情况,原始文件的哈希值将与被缓存的版本进行比较,若不匹配,该结构将被再次升级。",
"modernfix.option.mixin.perf.compress_biome_container": "仅 1.16。来自 Hydrogen 的微优化,会在可能时下试图节省生物群系容器的空间。如果安装了 BetterEnd 或 Chocolate Fix 这两个冲突的模组,此功能会被自动禁用。",
"modernfix.option.mixin.perf.datapack_reload_exceptions": "全版本共有。通过不打印数据包重载过程中一些常见的异常(如战利品表/配方中的物品丢失)的堆栈跟踪,减少日志刷屏,稍微提高了启动速度。只是不打印堆栈,一条异常消息依然会被打印出来。",
"modernfix.option.mixin.perf.dedicated_reload_executor": "全版本共有。将资源包和数据包的重载给转移到一个专门的工作线程,而不是使用默认的工作主线程。这让 Smooth Boot 模组在运行时仍然可能提高单人游戏的性能,同时不会因为线程数量限制减慢启动速度。",
"modernfix.option.mixin.perf.deduplicate_location": "全版本共有,但由于会影响加载时间,默认禁用。重复使用资源位置的命名空间和路径。这节省了内存,但也稍稍增加了构建新资源位置的成本。",
"modernfix.option.mixin.perf.dynamic_dfu": "全版本共有。修改了 DFU 的初始化,使其仅在第一次需要升级数据时加载。这听起来跟 DFU 载入优化相似,但实际的实现其实是截然不同的,因为它能避免加载*任何*DFU的类/数据结构,而 DFU 载入优化只是禁用其规则优化。本质上说,这是一个 DataFixerSlayer 的安全版本,因为它仍然会在需要时加载 DFU。\n\n即使启用了这个选项你也应该继续使用 DFU 载入优化,否则 DFU 规则的优化依然会导致延迟。",
"modernfix.option.mixin.perf.dynamic_structure_manager": "全版本共有。允许游戏在生成结束后停载结构文件,而非永远保持它们的加载。",
"modernfix.option.mixin.perf.fast_registry_validation": "全版本共有。Forge 在每次验证注册时都通过反射来查找一个方法,这个补丁简单地缓存了方法的返回值,因为它每次都是一样的。",
"modernfix.option.mixin.perf.faster_font_loading": "全版本共有。优化字体渲染器,以更快地加载字体,加快资源重载速度。",
"modernfix.option.mixin.perf.faster_item_rendering": "全版本共有。避免在 GUI 中渲染物品的侧面。(是的,原版就是这样做的。)\n\n如果你的 GPU 不是很好,又安装了 REI/JEI 这样的模组,当在 GUI 中有足够多的物品显示时,这可以使 FPS 增加三倍。由于此优化刚刚诞生,没有经过很多测试,所以默认情况下是禁用的,但应是能安全使用的。最有可能的问题是物品在 GUI 中完全不可见,或者在世界中显示为平面。",
"modernfix.option.mixin.perf.faster_texture_loading": "所有 1.19.4 之前的版本。避免读取两次纹理资源(第一次读取使用的是非常慢的文件路径),使用更快的第二次读取逻辑(类似于 1.19.3+)。",
"modernfix.option.mixin.perf.faster_texture_stitching": "全版本共有。使游戏能够使用一个效率更高的纹理缝合系统,该系统最初由 SuperCoder79 在 1.7.0 上为 lwjgl3ify 编写,可以减少一点加载时间。有时候,有人报告说这会在方块或 GUI 上引起奇怪的显示假象,但这可能是 Sodium 的 bug。",
"modernfix.option.mixin.perf.jeresources_startup": "仅 1.16。优化了 Just Enough Resources让其不需要为同一职业多次创建村民实体这在 JEI 启动时可以节省时间。",
"modernfix.option.mixin.perf.kubejs": "仅 1.16。对 KubeJS 进行了优化以避免不必要的 ItemStack 复制等,减少了数据包加载时间。",
"modernfix.option.mixin.perf.model_optimizations": "全版本共有。通过优化以加快模型加载过程。",
"modernfix.option.mixin.perf.nbt_memory_usage": "全版本共有。对 NBT 标签使用一个更加高效的 backing map重复使用键名对小型 NBT 也使用数组 Map。这减少了在内存中存储许多 NBT 标签的开销。",
"modernfix.option.mixin.perf.nuke_empty_chunk_sections": "仅 1.16。灵感来自 Hydrogen。避免在内存中存储充满空气的区块部分而是将其标记为空。",
"modernfix.option.mixin.perf.reduce_blockstate_cache_rebuilds": "全版本共有。一项关键优化。较新的 MC1.12 以上)实现了一个方块状态缓存系统,它可以缓存方块状态的常用信息,譬如其是否为实体,它的碰撞箱形状等等。重建此缓存在原版中是相当快速的(只要一两秒钟),但在安装了许多模组后就相当慢了,因为游戏中多了很多其它的方块状态,它们的缓存都需要被其重建。\n\n在 Forge 的影响下这个问题变得更加严重因为缓存虽在很多地方被重建但这些数据在下一次重建前几乎肯定不会被用到。这种情况一般出现在到达主菜单之前在“Freezing data”阶段以及在加载世界时会出现很多次。\n\n通过让缓存的重建变得懒惰现代化修复解决了这个性能瓶颈问题。每个方块状态在第一次访问数据时都会重建其缓存。原版或 Forge 试图重建所有方块状态缓存时的行为会被重定向为简单地使每个方块状态的缓存失效。\n\n这应不会对启动后的 TPS 产生任何影响。",
"modernfix.option.mixin.perf.remove_biome_temperature_cache": "全版本共有。移除生物群系温度缓存以减少内存占用,就像新版本的锂所做的那样。",
"modernfix.option.mixin.perf.resourcepacks": "全版本共有。一项关键优化。高版本的启动受到了文件系统访问的严重限制。资源包经常接受到很多请求,要列出资源或检查一项给定的资源是否存在,而每次请求都会调用一个效率极低的文件 API。\n\n现代化修复通过简单地缓存模组和原版提供的所有资源的列表完全消除了此处的大部分限制。缓存在资源重载时会进行重建除了原版资源因为它们在游戏运行时不应改变。\n\n除了高清修复它的连接纹理资源不能正确加载此补丁没有已知的兼容问题。但 embeddedt 不建议在任何情况下使用高清修复,因为它本身就会增加几分钟的启动时间,而且根本没有与现代化修复进行过任何测试。",
"modernfix.option.mixin.perf.reuse_datapacks": "仅 1.16。试图通过在可能的情况下跳过数据包重载来加快单人世界切换/重进时的速度。可能会导致一些模组的兼容性问题,但目前是默认启用的。",
"modernfix.option.mixin.perf.rewrite_registry": "全版本共有。**目前处于半崩溃状态。**非常暴力地使用更快地版本替换了 Forge 注册系统的一些内部结构,但目前在加载一些整合包时导致冻结。显而易见,默认关闭。",
"modernfix.option.mixin.perf.skip_first_datapack_reload": "仅 1.16 & 1.19。一项关键优化。\n\n在 1.16 开发周期的中期, Forge 对游戏打了补丁,在加载现有世界时重载两次数据包,来解决生物群系 ID 转移的问题。不幸地是,数据包重载往往需要 30 秒以上的时间,所以这非常严重地影响了世界加载时间。\n\n现代化修复在未完成的 Forge PR #8163 基础上做了必要的修改来避免这种重载。\n\n此改动在 1.18 版本被 Forge 删除,但随后又在 1.19 版本中添加了一个类似补丁,来修复创建新单人世界时无法加载模组数据包的问题。幸运的是,此问题在 1.19 版本中被定为到了世界创建界面,现有的世界只需要重载一次。然而,这依然使得 1.19 版本中点击“创建新世界”时的延迟峰值长度增加了一倍,因此现代化修复再次做出修改,不执行多余的重载。",
"modernfix.option.mixin.perf.state_definition_construct": "全版本共有。只在安装 FerriteCore 时启用。利用 FerriteCore 对 BlockState 的处理,加快 BlockState 的创建速度。这有助于在你安装了有大量 BlockState 的模组(例如家具模组)时加快启动速度。",
"modernfix.option.mixin.perf.sync_executor_sleep": "全版本共有。避免了主线程在等待模组加载工作完成时空转,消耗一个 CPU 核心。",
"modernfix.option.mixin.perf.thread_priorities": "全版本共有。调整工作线程和服务端线程的优先级,使其低于客户端线程。这有助于提供 CPU 核心少的机器游戏时的 FPS 稳定性,只要其使用的 Java 实现尊重优先级。",
"modernfix.option.mixin.perf.use_integrated_resources": "主要针对 1.16 版本。为 Just Enough Resources 打补丁,以便于在玩单人游戏时使用集成服务器的战利品表数据,而不是无意义地重载战利品表。可以减少几秒钟的 JEI 启动时间。",
"modernfix.option.mixin.bugfix.concurrency": "此补丁修复了 MC 和/或 Forge 中的一些并发问题。其中大部分问题都会导致在加载过程中出现罕见的、难以诊断的崩溃。",
"modernfix.option.mixin.bugfix.edge_chunk_not_saved": "此项是 SuperCoder 的 Chunk Saving Fix 模组的移植(因为 embeddedt 当时并没有意识到 Chunk Saving Fix 原来有 Forge 版本)。",
"modernfix.option.mixin.bugfix.mc218112": "此项修复了在处理实体数据抛出异常时可能的死锁问题。原版在应该解锁数据管理器时不能正常解锁。问题追踪器链接MC-218112由 Mojang 在 1.17 中修复。",
"modernfix.option.mixin.bugfix.packet_leak": "实现性的,默认禁用。尝试修复在 1.16 版本上长时间游玩后出现的内存泄漏问题。",
"modernfix.option.mixin.bugfix.paper_chunk_patches": "仅 1.18+。**一项关键优化**。移植了 Paper 的一个补丁,修复了 1.17 版本中区块加载需要大量内存和产生许多 `CompletableFuture` 实例的问题。1.18 以上版本现在能够像 1.16 版本那样在只有 400MB 的内存中加载世界。",
"modernfix.option.mixin.bugfix.tf_cme_on_load": "对暮色森林进行了调整,使用主线程执行非线程安全的客户端设置,而非 FML 工作线程。",
"modernfix.option.mixin.feature.branding": "将现代化修复相关信息添加到标题页和 F3 屏幕中。",
"modernfix.option.mixin.feature.direct_stack_trace": "通常是关闭的,当崩溃发生时,可以启用它来强制将原始堆栈跟踪转储到日志里。因为原版的崩溃报告系统偶尔不能正常工作,只能给出一个完全不相关的堆栈跟踪/报告。",
"modernfix.option.mixin.feature.measure_time": "若启用,现代化修复会借助几个注入来记录世界加载时间、数据包重载时间、资源重载时间、启动时间,并添加必要的挂钩以启用原版未使用的分析器逻辑来进行资源重载。",
"modernfix.option.mixin.feature.spam_thread_dump": "**仅用于调试**。每 60 秒向日志输出一个线程数据导出。这可以帮助诊断加载/游戏过程中无法解释的冻结现象。"
}

View File

@ -0,0 +1,13 @@
#!/usr/bin/python3
import re
with open('Summary-of-Patches.md', 'r') as file:
data = file.read().rstrip()
matches = re.findall(r"## `(.*?)`((?:(?!\n#).)*)", data, re.DOTALL)
for m in matches:
option_name = m[0].strip()
option_desc = m[1].strip().replace("\n", "\\n").replace('"', '\\"')
print(f" \"modernfix.option.mixin.{m[0].strip()}\": \"{option_desc}\",")