Skip to content

Commit 8290964

Browse files
committed
Merge 1.16 into 1.18
2 parents 2a1685a + 383d40e commit 8290964

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

common/src/main/java/org/embeddedt/modernfix/core/ModernFixMixinPlugin.java

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,13 @@ private void applyBlockStateCacheScan(ClassNode targetClass) {
166166
"getFluidState", "method_26227", "m_60819_", "func_204520_s"
167167
);
168168
Map<String, MethodNode> injectorMethodNames = new HashMap<>();
169+
Map<String, MethodNode> allMethods = new HashMap<>();
169170
Map<String, String> injectorMixinSource = new HashMap<>();
170171
String descriptor = Type.getDescriptor(MixinMerged.class);
171172
for(MethodNode m : targetClass.methods) {
172173
if((m.access & Opcodes.ACC_STATIC) != 0)
173174
continue;
175+
allMethods.put(m.name, m);
174176
Set<AnnotationNode> seenNodes = new HashSet<>();
175177
if(m.invisibleAnnotations != null) {
176178
for(AnnotationNode ann : m.invisibleAnnotations) {
@@ -217,8 +219,35 @@ private void applyBlockStateCacheScan(ClassNode targetClass) {
217219
}
218220
}
219221
Set<String> accessedFieldNames = new HashSet<>();
220-
// We now know all methods that have been injected into initCache. See what fields they write to
221-
injectorMethodNames.forEach((name, method) -> {
222+
223+
// Make a map of all injected methods called by initCache
224+
Map<String, MethodNode> writingMethods = new HashMap<>(injectorMethodNames);
225+
writingMethods.keySet().retainAll(cacheCalledInjectors);
226+
227+
// Recursively check the injected methods for any methods they may call
228+
int previousSize = 0;
229+
Set<String> checkedCalls = new HashSet<>();
230+
while(writingMethods.size() > previousSize) {
231+
previousSize = writingMethods.size();
232+
List<String> keysToCheck = new ArrayList<>(writingMethods.keySet());
233+
for(String name : keysToCheck) {
234+
if(!checkedCalls.add(name))
235+
continue;
236+
for(AbstractInsnNode n : writingMethods.get(name).instructions) {
237+
if(n instanceof MethodInsnNode) {
238+
MethodInsnNode invokeNode = (MethodInsnNode)n;
239+
if(invokeNode.owner.equals(targetClass.name)) {
240+
MethodNode theMethod = allMethods.get(invokeNode.name);
241+
if(theMethod != null)
242+
writingMethods.put(invokeNode.name, theMethod);
243+
}
244+
}
245+
}
246+
}
247+
}
248+
249+
// We now know all methods that have been injected into initCache, and their callers. See what fields they write to
250+
writingMethods.forEach((name, method) -> {
222251
if(cacheCalledInjectors.contains(name)) {
223252
for(AbstractInsnNode n : method.instructions) {
224253
if(n instanceof FieldInsnNode) {

common/src/main/resources/assets/modernfix/lang/ja_jp.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
"modernfix.jei_load": "JEIを読み込み中... しばらく時間がかかる可能性があります。",
55
"modernfix.no_lazydfu": "LazyDFUがインストールされていません。Minecraftが古いバージョンのゲームデータを更新する必要がある場合、目立つラグが発生する可能性があります。",
66
"modernfix.no_ferritecore": "FerriteCoreがインストールされていません。メモリ使用量は非常に高くなります。",
7+
"modernfix.connectedness_dynresoruces": "ConnectednessとModernFixのダイナミックリソースオプションは互換性がありません。ModernFixの設定でConnectednessを削除するか、ダイナミックリソースを無効にしてください。",
78
"modernfix.perf_mod_warning": "Modをインストールすることをお勧めしますが、警告はModernFixの設定で無効にできます。",
89
"modernfix.config": "ModernFixによるmixinの設定",
910
"modernfix.config.done_restart": "完了 (再起動が必要)",
11+
"modernfix.config.wiki": "wikiを開く",
12+
"modernfix.message.reload_config": "MODコンフィグファイルの変更が検出されました。保存が完了していないファイルのロードを防ぐため、/mfrc を実行してリロードをトリガーする必要があります。",
1013
"modernfix.option.on": "オン",
1114
"modernfix.option.off": "オフ",
1215
"modernfix.option.disabled": "無効",

0 commit comments

Comments
 (0)