Merge remote-tracking branch 'origin/main' into 1.18
This commit is contained in:
commit
945027295a
|
|
@ -1,33 +0,0 @@
|
|||
package org.embeddedt.modernfix.common.mixin.bugfix.edge_chunk_not_saved;
|
||||
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
import net.minecraft.world.level.chunk.ImposterProtoChunk;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.server.level.ChunkHolder;
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/* https://github.com/SuperCoder7979/chunksavingfix-fabric/blob/main/src/main/java/supercoder79/chunksavingfix/mixin/MixinThreadedAnvilChunkStorage.java */
|
||||
@Mixin(ChunkMap.class)
|
||||
public class ChunkManagerMixin {
|
||||
// TODO: hits both at the moment- check and re-evaluate
|
||||
@ModifyArg(method = "saveAllChunks(Z)V", at = @At(value = "INVOKE", target = "Ljava/util/stream/Stream;filter(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;", ordinal = 0), require = 0)
|
||||
private Predicate<ChunkHolder> alwaysAccessibleFlush(Predicate<ChunkHolder> chunkHolder) {
|
||||
return c -> true;
|
||||
}
|
||||
@ModifyArg(method = "saveAllChunks(Z)V", at = @At(value = "INVOKE", target = "Ljava/util/stream/Stream;filter(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;", ordinal = 1), require = 0)
|
||||
private Predicate<ChunkAccess> allowProtoChunkFlush(Predicate<ChunkAccess> chunk) {
|
||||
return c -> c instanceof ProtoChunk || c instanceof ImposterProtoChunk || c instanceof LevelChunk;
|
||||
}
|
||||
|
||||
@Redirect(method = "saveChunkIfNeeded", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ChunkHolder;wasAccessibleSinceLastSave()Z"), require = 0)
|
||||
private boolean alwaysAccessible(ChunkHolder chunkHolder) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -59,6 +59,8 @@ public class ModernFixEarlyConfig {
|
|||
private final Set<String> mixinOptions = new ObjectOpenHashSet<>();
|
||||
private final Map<String, String> mixinsMissingMods = new Object2ObjectOpenHashMap<>();
|
||||
|
||||
public static boolean isFabric = false;
|
||||
|
||||
public Map<String, String> getPermanentlyDisabledMixins() {
|
||||
return mixinsMissingMods;
|
||||
}
|
||||
|
|
@ -71,6 +73,8 @@ public class ModernFixEarlyConfig {
|
|||
if(stream == null)
|
||||
continue;
|
||||
try(Reader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) {
|
||||
if(configFile.contains("fabric"))
|
||||
isFabric = true;
|
||||
JsonObject configObject = (JsonObject)new JsonParser().parse(reader);
|
||||
JsonArray mixinList = configObject.getAsJsonArray("mixins");
|
||||
String packageName = configObject.get("package").getAsString().replace('.', '/');
|
||||
|
|
@ -178,15 +182,20 @@ public class ModernFixEarlyConfig {
|
|||
disableIfModPresent("mixin.perf.thread_priorities", "smoothboot");
|
||||
disableIfModPresent("mixin.perf.boost_worker_count", "smoothboot");
|
||||
disableIfModPresent("mixin.perf.async_jei", "modernui");
|
||||
disableIfModPresent("mixin.perf.compress_biome_container", "chocolate", "betterendforge");
|
||||
disableIfModPresent("mixin.perf.compress_biome_container", "chocolate", "betterendforge" ,"skyblockbuilder");
|
||||
disableIfModPresent("mixin.bugfix.mc218112", "performant");
|
||||
disableIfModPresent("mixin.bugfix.remove_block_chunkloading", "performant");
|
||||
disableIfModPresent("mixin.bugfix.paper_chunk_patches", "c2me");
|
||||
// DimThread makes changes to the server chunk manager (understandably), C2ME probably does the same
|
||||
disableIfModPresent("mixin.bugfix.chunk_deadlock", "c2me", "dimthread");
|
||||
disableIfModPresent("mixin.perf.reuse_datapacks", "tac");
|
||||
disableIfModPresent("mixin.launch.class_search_cache", "optifine");
|
||||
disableIfModPresent("mixin.perf.faster_texture_stitching", "optifine");
|
||||
disableIfModPresent("mixin.perf.datapack_reload_exceptions", "cyanide");
|
||||
disableIfModPresent("mixin.perf.faster_texture_loading", "stitch", "optifine", "changed");
|
||||
if(isFabric) {
|
||||
disableIfModPresent("mixin.bugfix.packet_leak", "memoryleakfix");
|
||||
}
|
||||
}
|
||||
|
||||
private void disableIfModPresent(String configName, String... ids) {
|
||||
|
|
|
|||
|
|
@ -141,6 +141,7 @@ public class CanonizingStringMap<T> implements Map<String, T> {
|
|||
}
|
||||
|
||||
public static <T> CanonizingStringMap<T> deepCopy(CanonizingStringMap<T> inputMap, Function<T, T> deepCopier) {
|
||||
Objects.requireNonNull(deepCopier);
|
||||
Object2ObjectMap<String, T> copiedBackingMap;
|
||||
int size = inputMap.backingMap.size();
|
||||
if(size > GROWTH_THRESHOLD) {
|
||||
|
|
@ -148,7 +149,8 @@ public class CanonizingStringMap<T> implements Map<String, T> {
|
|||
} else
|
||||
copiedBackingMap = new Object2ObjectArrayMap<>(size);
|
||||
inputMap.backingMap.object2ObjectEntrySet().forEach(entry -> {
|
||||
copiedBackingMap.put(entry.getKey(), deepCopier.apply(entry.getValue()));
|
||||
if(entry.getKey() != null && entry.getValue() != null)
|
||||
copiedBackingMap.put(entry.getKey(), deepCopier.apply(entry.getValue()));
|
||||
});
|
||||
return new CanonizingStringMap<>(copiedBackingMap);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user