Allow unloading unused structures
This commit is contained in:
parent
ad7bc8829b
commit
274c41d637
|
|
@ -47,7 +47,7 @@ public class ModernFixEarlyConfig {
|
|||
this.addMixinRule("bugfix.concurrency", true);
|
||||
this.addMixinRule("bugfix.edge_chunk_not_saved", true);
|
||||
this.addMixinRule("bugfix.packet_leak", false);
|
||||
this.addMixinRule("bugfix.structure_manager_crash", true);
|
||||
this.addMixinRule("perf.dynamic_structure_manager", true);
|
||||
this.addMixinRule("bugfix.mc218112", true);
|
||||
this.addMixinRule("bugfix.chunk_deadlock", true);
|
||||
this.addMixinRule("bugfix.chunk_deadlock.valhesia", modPresent("valhelsia_structures"));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package org.embeddedt.modernfix.mixin.bugfix.structure_manager_crash;
|
||||
package org.embeddedt.modernfix.mixin.perf.dynamic_structure_manager;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.mojang.datafixers.DataFixer;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
|
|
@ -14,7 +16,6 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
@Mixin(StructureManager.class)
|
||||
|
|
@ -24,6 +25,10 @@ public class StructureManagerMixin {
|
|||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void makeStructuresSafe(ResourceManager arg, LevelStorageSource.LevelStorageAccess arg2, DataFixer dataFixer, CallbackInfo ci) {
|
||||
this.structureRepository = Collections.synchronizedMap(this.structureRepository);
|
||||
/* Structures needing to be reloaded is not a huge issue since we optimize loading them already */
|
||||
Cache<ResourceLocation, StructureTemplate> structureCache = CacheBuilder.newBuilder()
|
||||
.softValues()
|
||||
.build();
|
||||
this.structureRepository = structureCache.asMap();
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
"refmap": "modernfix.refmap.json",
|
||||
"mixins": [
|
||||
"bugfix.edge_chunk_not_saved.ChunkManagerMixin",
|
||||
"bugfix.structure_manager_crash.StructureManagerMixin",
|
||||
"perf.dynamic_structure_manager.StructureManagerMixin",
|
||||
"bugfix.tf_cme_on_load.TwilightForestModMixin",
|
||||
"bugfix.refinedstorage.te_bug.ItemExternalStorageProviderMixin",
|
||||
"bugfix.refinedstorage.te_bug.FluidExternalStorageProviderMixin",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user