Skip to content

Commit c5a5b01

Browse files
committed
Merge 1.16 into 1.18
2 parents 4b8ec82 + 6740857 commit c5a5b01

File tree

4 files changed

+35
-11
lines changed

4 files changed

+35
-11
lines changed

common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/dynamic_sounds/SoundBufferLibraryMixin.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ private <K extends ResourceLocation, V extends CompletableFuture<SoundBuffer>> v
3737
if(notification.getCause() == RemovalCause.REPLACED && notification.getValue() == cache.get(notification.getKey()))
3838
return;
3939
notification.getValue().thenAccept(SoundBuffer::discardAlBuffer);
40-
if(debugDynamicSoundLoading) {
41-
K k = notification.getKey();
42-
if(k == null)
43-
return;
44-
ModernFix.LOGGER.warn("Evicted sound {}", k);
45-
}
40+
if(!debugDynamicSoundLoading)
41+
return;
42+
K k = notification.getKey();
43+
if(k == null)
44+
return;
45+
ModernFix.LOGGER.warn("Evicted sound {}", k);
4646
}
4747
}

common/src/main/java/org/embeddedt/modernfix/core/config/ModernFixEarlyConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ public DefaultSettingMapBuilder put(String key, Boolean value) {
156156

157157
private static final ImmutableMap<String, Boolean> DEFAULT_SETTING_OVERRIDES = new DefaultSettingMapBuilder()
158158
.put("mixin.perf.dynamic_resources", false)
159+
.putConditionally(() -> !isFabric, "mixin.perf.async_jei", false)
159160
.put("mixin.perf.dynamic_sounds", false)
160161
.put("mixin.perf.dynamic_block_codecs", false)
161162
.put("mixin.feature.direct_stack_trace", false)
@@ -206,7 +207,6 @@ private ModernFixEarlyConfig(File file) {
206207
/* Mod compat */
207208
disableIfModPresent("mixin.perf.thread_priorities", "smoothboot", "threadtweak");
208209
disableIfModPresent("mixin.perf.boost_worker_count", "smoothboot", "threadtweak");
209-
disableIfModPresent("mixin.perf.async_jei", "modernui");
210210
disableIfModPresent("mixin.perf.compress_biome_container", "chocolate", "betterendforge" ,"skyblockbuilder", "modern_beta");
211211
disableIfModPresent("mixin.bugfix.mc218112", "performant");
212212
disableIfModPresent("mixin.bugfix.remove_block_chunkloading", "performant");

common/src/main/java/org/embeddedt/modernfix/dynamicresources/DynamicBakedModelProvider.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.google.common.collect.ImmutableSet;
44
import com.mojang.math.Transformation;
5-
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
65
import net.minecraft.client.renderer.block.model.BakedQuad;
76
import net.minecraft.client.renderer.block.model.ItemOverrides;
87
import net.minecraft.client.renderer.block.model.ItemTransforms;
@@ -22,6 +21,7 @@
2221
import org.jetbrains.annotations.Nullable;
2322

2423
import java.util.*;
24+
import java.util.concurrent.ConcurrentHashMap;
2525
import java.util.function.BiFunction;
2626
import java.util.stream.Collectors;
2727

@@ -85,7 +85,7 @@ public ItemOverrides getOverrides() {
8585
public DynamicBakedModelProvider(ModelBakery bakery, Map<Triple<ResourceLocation, Transformation, Boolean>, BakedModel> cache) {
8686
this.bakery = bakery;
8787
this.bakedCache = cache;
88-
this.permanentOverrides = Collections.synchronizedMap(new Object2ObjectOpenHashMap<>());
88+
this.permanentOverrides = new ConcurrentHashMap<>();
8989
if(currentInstance == null)
9090
currentInstance = this;
9191
}
@@ -109,12 +109,12 @@ public boolean isEmpty() {
109109

110110
@Override
111111
public boolean containsKey(Object o) {
112-
return permanentOverrides.getOrDefault(o, SENTINEL) != null;
112+
return o != null && permanentOverrides.getOrDefault(o, SENTINEL) != null;
113113
}
114114

115115
@Override
116116
public boolean containsValue(Object o) {
117-
return permanentOverrides.containsValue(o) || bakedCache.containsValue(o);
117+
return o != null && (permanentOverrides.containsValue(o) || bakedCache.containsValue(o));
118118
}
119119

120120
private static boolean isVanillaTopLevelModel(ResourceLocation location) {
@@ -164,6 +164,9 @@ public BakedModel get(Object o) {
164164

165165
@Override
166166
public BakedModel put(ResourceLocation resourceLocation, BakedModel bakedModel) {
167+
if(resourceLocation == null)
168+
return null;
169+
167170
BakedModel m = permanentOverrides.put(resourceLocation, bakedModel);
168171
if(m != null)
169172
return m;
@@ -173,6 +176,9 @@ public BakedModel put(ResourceLocation resourceLocation, BakedModel bakedModel)
173176

174177
@Override
175178
public BakedModel remove(Object o) {
179+
if(o == null)
180+
return null;
181+
176182
BakedModel m = permanentOverrides.remove(o);
177183
if(m != null)
178184
return m;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.embeddedt.modernfix.forge.mixin.bugfix.file_dialog_title;
2+
3+
import net.minecraft.client.gui.screens.worldselection.WorldGenSettingsComponent;
4+
import org.spongepowered.asm.mixin.Mixin;
5+
import org.spongepowered.asm.mixin.injection.At;
6+
import org.spongepowered.asm.mixin.injection.ModifyArg;
7+
8+
@Mixin(WorldGenSettingsComponent.class)
9+
public class WorldGenSettingsComponentMixin {
10+
/**
11+
* @author embeddedt
12+
* @reason Do not provide resource pack-controlled string to TinyFD
13+
*/
14+
@ModifyArg(method = "*", at = @At(value = "INVOKE", target = "Lorg/lwjgl/util/tinyfd/TinyFileDialogs;tinyfd_openFileDialog(Ljava/lang/CharSequence;Ljava/lang/CharSequence;Lorg/lwjgl/PointerBuffer;Ljava/lang/CharSequence;Z)Ljava/lang/String;", remap = false), index = 0)
15+
private CharSequence sanitizeTitleString(CharSequence original) {
16+
return "Select settings file (.json)";
17+
}
18+
}

0 commit comments

Comments
 (0)