Fix mod list - #592
Conversation
| + protected boolean drawTopBottomShadow(Tessellator tessellator) | ||
| + { | ||
| + return true; | ||
| + } | ||
| + | ||
| + protected int getScrollThumbHeight() | ||
| + { | ||
| + int viewHeight = this.bottom - this.top; | ||
| + return MathHelper.clamp(viewHeight * viewHeight / this.getContentHeight(), 32, viewHeight - 8); | ||
| + } | ||
| + | ||
| + protected int getListLeft() | ||
| + { | ||
| + return this.left + this.width / 2 - this.getListWidth() / 2; | ||
| + } | ||
| + | ||
| + protected int getListRight() | ||
| + { | ||
| + return this.left + this.width / 2 + this.getListWidth() / 2; | ||
| + } | ||
| + | ||
| + protected int getListEntryLeft() | ||
| + { | ||
| + return this.getListLeft() + 2; |
There was a problem hiding this comment.
一定要在patches加那麼多方法?
原版是固定卡位置在中间的,不 patch 没法控制 layout,就会像当前这样左边空出来一点,很丑。
Override 也是可以的,但是你在 refactor 的时候把这些删了,就不考虑了。
There was a problem hiding this comment.
每個用
GuiSlot的不會突然出錯嗎?
这里的计算方法是和原版一致的,除非真的有人 mixin 这个特定的赋值,不然一般不会出错。
There was a problem hiding this comment.
GuiTextField也是
这个确实可以考虑继续写在 Override,看你了。
我觉得可以当作原版的 Bug 处理,在更新一点的 MC 版本这几个地方都补上 callback 了。
| this.parentScreen = parent; | ||
| if (!loaded) { | ||
| PlatformUtils.getAllModData().forEach(data -> CACHED_MODS.put(data.getModId(), new ModData(data))); | ||
| PlatformUtils.getAllModData().forEach(data -> CACHED_MODS.put(data.getModId().toLowerCase(Locale.ENGLISH), new ModData(data))); |
There was a problem hiding this comment.
ModContainer#getModId 只能回小寫的英文字母
There was a problem hiding this comment.
ModContainer#getModId只能回小寫的英文字母
对于 FML 这样的自定义 ModContainer 不成立。
| // Forge's mod list may get mixin in late phase, which leads to crash | ||
| // Use an interface to avoid this | ||
| if (ModListConfig.enable && gui instanceof LegacyModListScreen modList) |
There was a problem hiding this comment.
你有在這裡崩潰過?
破坏 late mixin 不划算,做一个 interface 也不是很 hack,也比反射好,我认为是可以接受的。
There was a problem hiding this comment.
| if (ModListConstants.OWNER_MOD_ID.equals(event.getModID())) | ||
| { | ||
| ConfigManager.sync(ModListConfig.class); |
There was a problem hiding this comment.
這跟寫在
ForgeModContainer有啥差別?
ForgeModContainer 不会调用这个 sync 事件,导致游戏内修改不会同步到文件里。开发和生产都会出这个问题。
| public static boolean hasConfigForMod(String modid) | ||
| { | ||
| return asm_data.containsKey(modid); | ||
| return asm_data.containsKey(modid) || MOD_CONFIG_CLASSES.containsKey(modid); |
There was a problem hiding this comment.
???
Fix mod list's config not available in Cleanroom runClient and not synced in production.
Cleanroom 开发环境 asm_data 有问题,丢 key,运行 cleanroomClient 可以看到模组列表里 Cleanroom 的配置按钮是灰色的。
This PR solves several issues caused by the refactor in #589.
@Overridemethods in patches.cleanroomClientand not synced in production.