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) { 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": "無効",