Merge 1.16 into 1.18

This commit is contained in:
embeddedt 2023-10-24 12:45:35 -04:00
commit c5a5b01bfb
4 changed files with 35 additions and 11 deletions

View File

@ -37,11 +37,11 @@ public abstract class SoundBufferLibraryMixin {
if(notification.getCause() == RemovalCause.REPLACED && notification.getValue() == cache.get(notification.getKey()))
return;
notification.getValue().thenAccept(SoundBuffer::discardAlBuffer);
if(debugDynamicSoundLoading) {
K k = notification.getKey();
if(k == null)
return;
ModernFix.LOGGER.warn("Evicted sound {}", k);
}
if(!debugDynamicSoundLoading)
return;
K k = notification.getKey();
if(k == null)
return;
ModernFix.LOGGER.warn("Evicted sound {}", k);
}
}

View File

@ -156,6 +156,7 @@ public class ModernFixEarlyConfig {
private static final ImmutableMap<String, Boolean> DEFAULT_SETTING_OVERRIDES = new DefaultSettingMapBuilder()
.put("mixin.perf.dynamic_resources", false)
.putConditionally(() -> !isFabric, "mixin.perf.async_jei", false)
.put("mixin.perf.dynamic_sounds", false)
.put("mixin.perf.dynamic_block_codecs", false)
.put("mixin.feature.direct_stack_trace", false)
@ -206,7 +207,6 @@ public class ModernFixEarlyConfig {
/* Mod compat */
disableIfModPresent("mixin.perf.thread_priorities", "smoothboot", "threadtweak");
disableIfModPresent("mixin.perf.boost_worker_count", "smoothboot", "threadtweak");
disableIfModPresent("mixin.perf.async_jei", "modernui");
disableIfModPresent("mixin.perf.compress_biome_container", "chocolate", "betterendforge" ,"skyblockbuilder", "modern_beta");
disableIfModPresent("mixin.bugfix.mc218112", "performant");
disableIfModPresent("mixin.bugfix.remove_block_chunkloading", "performant");

View File

@ -2,7 +2,6 @@ package org.embeddedt.modernfix.dynamicresources;
import com.google.common.collect.ImmutableSet;
import com.mojang.math.Transformation;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.ItemOverrides;
import net.minecraft.client.renderer.block.model.ItemTransforms;
@ -22,6 +21,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
@ -85,7 +85,7 @@ public class DynamicBakedModelProvider implements Map<ResourceLocation, BakedMod
public DynamicBakedModelProvider(ModelBakery bakery, Map<Triple<ResourceLocation, Transformation, Boolean>, BakedModel> cache) {
this.bakery = bakery;
this.bakedCache = cache;
this.permanentOverrides = Collections.synchronizedMap(new Object2ObjectOpenHashMap<>());
this.permanentOverrides = new ConcurrentHashMap<>();
if(currentInstance == null)
currentInstance = this;
}
@ -109,12 +109,12 @@ public class DynamicBakedModelProvider implements Map<ResourceLocation, BakedMod
@Override
public boolean containsKey(Object o) {
return permanentOverrides.getOrDefault(o, SENTINEL) != null;
return o != null && permanentOverrides.getOrDefault(o, SENTINEL) != null;
}
@Override
public boolean containsValue(Object o) {
return permanentOverrides.containsValue(o) || bakedCache.containsValue(o);
return o != null && (permanentOverrides.containsValue(o) || bakedCache.containsValue(o));
}
private static boolean isVanillaTopLevelModel(ResourceLocation location) {
@ -164,6 +164,9 @@ public class DynamicBakedModelProvider implements Map<ResourceLocation, BakedMod
@Override
public BakedModel put(ResourceLocation resourceLocation, BakedModel bakedModel) {
if(resourceLocation == null)
return null;
BakedModel m = permanentOverrides.put(resourceLocation, bakedModel);
if(m != null)
return m;
@ -173,6 +176,9 @@ public class DynamicBakedModelProvider implements Map<ResourceLocation, BakedMod
@Override
public BakedModel remove(Object o) {
if(o == null)
return null;
BakedModel m = permanentOverrides.remove(o);
if(m != null)
return m;

View File

@ -0,0 +1,18 @@
package org.embeddedt.modernfix.forge.mixin.bugfix.file_dialog_title;
import net.minecraft.client.gui.screens.worldselection.WorldGenSettingsComponent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;
@Mixin(WorldGenSettingsComponent.class)
public class WorldGenSettingsComponentMixin {
/**
* @author embeddedt
* @reason Do not provide resource pack-controlled string to TinyFD
*/
@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)
private CharSequence sanitizeTitleString(CharSequence original) {
return "Select settings file (.json)";
}
}