From 37724d76966f54691cc3a86c60c766add006435a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BE=8A=E7=BE=BD=E3=81=A1=E3=82=83=E3=82=93?= <108245985+u7f8au7fbd@users.noreply.github.com> Date: Sat, 19 Aug 2023 11:08:17 +0900 Subject: [PATCH 1/2] Update Japanese (#221) --- common/src/main/resources/assets/modernfix/lang/ja_jp.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/src/main/resources/assets/modernfix/lang/ja_jp.json b/common/src/main/resources/assets/modernfix/lang/ja_jp.json index 81103546..e50c1689 100644 --- a/common/src/main/resources/assets/modernfix/lang/ja_jp.json +++ b/common/src/main/resources/assets/modernfix/lang/ja_jp.json @@ -4,9 +4,12 @@ "modernfix.jei_load": "JEIを読み込み中... しばらく時間がかかる可能性があります。", "modernfix.no_lazydfu": "LazyDFUがインストールされていません。Minecraftが古いバージョンのゲームデータを更新する必要がある場合、目立つラグが発生する可能性があります。", "modernfix.no_ferritecore": "FerriteCoreがインストールされていません。メモリ使用量は非常に高くなります。", + "modernfix.connectedness_dynresoruces": "ConnectednessとModernFixのダイナミックリソースオプションは互換性がありません。ModernFixの設定でConnectednessを削除するか、ダイナミックリソースを無効にしてください。", "modernfix.perf_mod_warning": "Modをインストールすることをお勧めしますが、警告はModernFixの設定で無効にできます。", "modernfix.config": "ModernFixによるmixinの設定", "modernfix.config.done_restart": "完了 (再起動が必要)", + "modernfix.config.wiki": "wikiを開く", + "modernfix.message.reload_config": "MODコンフィグファイルの変更が検出されました。保存が完了していないファイルのロードを防ぐため、/mfrc を実行してリロードをトリガーする必要があります。", "modernfix.option.on": "オン", "modernfix.option.off": "オフ", "modernfix.option.disabled": "無効", From 383d40e42067252ac2c9ec84f3cea1840d31c398 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Sat, 19 Aug 2023 14:58:07 -0400 Subject: [PATCH 2/2] Detect mixins with calls to other merged methods Related: #222 --- .../modernfix/core/ModernFixMixinPlugin.java | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/org/embeddedt/modernfix/core/ModernFixMixinPlugin.java b/common/src/main/java/org/embeddedt/modernfix/core/ModernFixMixinPlugin.java index c61492a3..9e0354d5 100644 --- a/common/src/main/java/org/embeddedt/modernfix/core/ModernFixMixinPlugin.java +++ b/common/src/main/java/org/embeddedt/modernfix/core/ModernFixMixinPlugin.java @@ -166,11 +166,13 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin { "getFluidState", "method_26227", "m_60819_", "func_204520_s" ); Map injectorMethodNames = new HashMap<>(); + Map allMethods = new HashMap<>(); Map injectorMixinSource = new HashMap<>(); String descriptor = Type.getDescriptor(MixinMerged.class); for(MethodNode m : targetClass.methods) { if((m.access & Opcodes.ACC_STATIC) != 0) continue; + allMethods.put(m.name, m); Set seenNodes = new HashSet<>(); if(m.invisibleAnnotations != null) { for(AnnotationNode ann : m.invisibleAnnotations) { @@ -217,8 +219,35 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin { } } Set accessedFieldNames = new HashSet<>(); - // We now know all methods that have been injected into initCache. See what fields they write to - injectorMethodNames.forEach((name, method) -> { + + // Make a map of all injected methods called by initCache + Map writingMethods = new HashMap<>(injectorMethodNames); + writingMethods.keySet().retainAll(cacheCalledInjectors); + + // Recursively check the injected methods for any methods they may call + int previousSize = 0; + Set checkedCalls = new HashSet<>(); + while(writingMethods.size() > previousSize) { + previousSize = writingMethods.size(); + List keysToCheck = new ArrayList<>(writingMethods.keySet()); + for(String name : keysToCheck) { + if(!checkedCalls.add(name)) + continue; + for(AbstractInsnNode n : writingMethods.get(name).instructions) { + if(n instanceof MethodInsnNode) { + MethodInsnNode invokeNode = (MethodInsnNode)n; + if(invokeNode.owner.equals(targetClass.name)) { + MethodNode theMethod = allMethods.get(invokeNode.name); + if(theMethod != null) + writingMethods.put(invokeNode.name, theMethod); + } + } + } + } + } + + // We now know all methods that have been injected into initCache, and their callers. See what fields they write to + writingMethods.forEach((name, method) -> { if(cacheCalledInjectors.contains(name)) { for(AbstractInsnNode n : method.instructions) { if(n instanceof FieldInsnNode) {