Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix more client-side memory leaks #544

Merged
merged 6 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ All changes are toggleable via config files.
* **Improved Player Tick:** Improves AoA player ticking by only sending inventory changes when necessary
* **Arcane Archives**
* **Duplication Fixes:** Fixes various duplication exploits
* **Bibliocraft**
* **Disable Version Check:** Fixes client-side memory leak by disabling version check
* **Binnie's Mods**
* **Gather Windfall:** Allows Forestry farms to pick up ExtraTrees fruit
* **Biomes O' Plenty**
Expand All @@ -309,8 +311,9 @@ All changes are toggleable via config files.
* **Collective**
* **Memory Leak Fix:** Fixes memory leak when unloading worlds/switching dimensions
* **Compact Machines**
* **Invisible Wall Render Fix:** Fixes some compact machine walls being invisible if [Nothirium](https://www.curseforge.com/minecraft/mc-mods/nothirium) 0.2.x (and up) or [Vintagium](https://github.com/Asek3/sodium-1.12) is installed
* **Allowed Spawns Improvement:** Improves server performance by properly controlling spawn checks (effectiveness depends on CM's config)
* **Invisible Wall Render Fix:** Fixes some compact machine walls being invisible if [Nothirium](https://www.curseforge.com/minecraft/mc-mods/nothirium) 0.2.x (and up) or [Vintagium](https://github.com/Asek3/sodium-1.12) is installed
* **Memory Leak Fix:** Fixes client-side memory leak associated with miniaturization recipes
* **Effortless Building**
* **Block Transmutation Fix:** Fixes Effortless Building ignoring Metadata when checking for items in inventory
* **Elementary Staffs**
Expand All @@ -321,6 +324,8 @@ All changes are toggleable via config files.
* **Sprinting Integration:** Configurable consumption of feathers when the player is sprinting
* **Emojicord**
* **Emoji Context:** Improves emoji context calculation to improve fps when rendering a lot of text
* **Ender IO**
* **Replace Obelisk Renderer:** Fixes client-side memory leak by replacing obelisk renderer with a simpler one
* **Ender Storage**
* **Fix Frequency Tracking:** Fixes storage frequencies being tracked multiple times
* **Epic Siege Mod**
Expand Down Expand Up @@ -348,6 +353,8 @@ All changes are toggleable via config files.
* **Sticky Pedestal Compatibility:** Enables compatibility between Infernal Mobs' Sticky effect and Reliquary's Pedestal
* **Iron Backpacks**
* **Duplication Fixes:** Fixes various duplication exploits
* **Iron Chests**
* **Replace Crystal Chest/Shulker Renderer:** Fixes client-side memory leak by replacing the crystal chest/shulker box renderer with a simpler one (Note: Disables stack size rendering)
* **Item Stages**
* **Ingredient Matching:** Changes item matching code to CraftTweaker's ingredient matching system, fixes item NBT issues
* **Mekanism**
Expand Down
2 changes: 2 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ final def mod_dependencies = [
'curse.maven:autoreglib-250363:2746011' : [debug_quark],
'curse.maven:baubles-227083:2518667' : [debug_astral_sorcery, debug_bewitchment, debug_botania, debug_thaumcraft, debug_thaumic_wonders],
'curse.maven:bewitchment-285439:3044569' : [debug_bewitchment],
'curse.maven:bibliocraft-228027:3647708' : [debug_bibliocraft],
'curse.maven:binnies-mods-223525:2916129' : [debug_binnies_mods],
'curse.maven:biomes-o-plenty-220318:2842510' : [debug_biomes_o_plenty],
'curse.maven:blood-magic-224791:2822288' : [debug_blood_magic],
Expand Down Expand Up @@ -91,6 +92,7 @@ final def mod_dependencies = [
'curse.maven:hwyla-253449:2568751' : [debug_hwyla],
'curse.maven:industrialcraft-242638:3078604' : [debug_industrialcraft],
'curse.maven:ironbackpacks-227049:2564573' : [debug_iron_backpacks],
'curse.maven:ironchests-228756:2747935' : [debug_iron_chests],
'curse.maven:mantle-74924:2713386' : [debug_tinkers_construct],
'curse.maven:mcjtylib-233105:2745846' : [debug_rftools],
'curse.maven:mekanism-268560:2835175' : [debug_mekanism],
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ debug_arcane_archives = false
debug_astral_sorcery = false
debug_atomicstrykers_infernal_mobs = false
debug_bewitchment = false
debug_bibliocraft = false
debug_binnies_mods = false
debug_biomes_o_plenty = false
debug_blood_magic = false
Expand All @@ -36,6 +37,7 @@ debug_hwyla = false
debug_industrial_foregoing = false
debug_industrialcraft = false
debug_iron_backpacks = false
debug_iron_chests = false
debug_mekanism = false
debug_modular_routers = false
debug_mrtjpcore = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public class UTConfigMods
@Config.Name("Advent of Ascension")
public static final AOACategory AOA = new AOACategory();

@Config.LangKey("cfg.universaltweaks.modintegration.bibliocraft")
@Config.Name("BiblioCraft")
public static final BiblioCraftCategory BIBLIOCRAFT = new BiblioCraftCategory();

@Config.LangKey("cfg.universaltweaks.modintegration.bop")
@Config.Name("Biomes O' Plenty")
public static final BiomesOPlentyCategory BIOMES_O_PLENTY = new BiomesOPlentyCategory();
Expand Down Expand Up @@ -91,6 +95,10 @@ public class UTConfigMods
@Config.Name("Emojicord")
public static final EmojicordCategory EMOJICORD = new EmojicordCategory();

@Config.LangKey("cfg.universaltweaks.modintegration.enderio")
@Config.Name("Ender IO")
public static final EnderIOCategory ENDER_IO = new EnderIOCategory();

@Config.LangKey("cfg.universaltweaks.modintegration.enderstorage")
@Config.Name("Ender Storage")
public static final EnderStorageCategory ENDER_STORAGE = new EnderStorageCategory();
Expand Down Expand Up @@ -127,6 +135,10 @@ public class UTConfigMods
@Config.Name("Iron Backpacks")
public static final IronBackpacksCategory IRON_BACKPACKS = new IronBackpacksCategory();

@Config.LangKey("cfg.universaltweaks.modintegration.ironchests")
@Config.Name("Iron Chests")
public static final IronChestsCategory IRON_CHESTS = new IronChestsCategory();

@Config.LangKey("cfg.universaltweaks.modintegration.itemstages")
@Config.Name("Item Stages")
public static final ItemStagesCategory ITEM_STAGES = new ItemStagesCategory();
Expand Down Expand Up @@ -306,6 +318,14 @@ public static class AOACategory
public boolean utImprovedPlayerTickToggle = true;
}

public static class BiblioCraftCategory
{
@Config.RequiresMcRestart
@Config.Name("Disable Version Check")
@Config.Comment("Fixes client-side memory leak by disabling version check")
public boolean utDisableVersionCheckToggle = true;
}

public static class BiomesOPlentyCategory
{
@Config.RequiresMcRestart
Expand Down Expand Up @@ -399,11 +419,6 @@ public static class CollectiveCategory

public static class CompactMachinesCoreCategory
{
@Config.RequiresMcRestart
@Config.Name("Invisible Wall Render Fix")
@Config.Comment("Fixes some compact machine walls being invisible if Nothirium 0.2.x (and up) or Vintagium is installed")
public boolean utCMRenderFixToggle = true;

@Config.RequiresMcRestart
@Config.Name("Allowed Spawns Improvement")
@Config.Comment
Expand All @@ -413,6 +428,16 @@ public static class CompactMachinesCoreCategory
"Does nothing if both config values are true"
})
public boolean utAllowedSpawnsImprovementToggle = true;

@Config.RequiresMcRestart
@Config.Name("Invisible Wall Render Fix")
@Config.Comment("Fixes some compact machine walls being invisible if Nothirium 0.2.x (and up) or Vintagium is installed")
public boolean utCMRenderFixToggle = true;

@Config.RequiresMcRestart
@Config.Name("Memory Leak Fix")
@Config.Comment("Fixes client-side memory leak associated with miniaturization recipes")
public boolean utMemoryLeakFixToggle = true;
}

public static class EffortlessBuildingCategory
Expand Down Expand Up @@ -465,6 +490,14 @@ public static class EmojicordCategory
public boolean utEmojiContextToggle = true;
}

public static class EnderIOCategory
{
@Config.RequiresMcRestart
@Config.Name("Replace Obelisk Renderer")
@Config.Comment("Fixes client-side memory leak by replacing obelisk renderer with a simpler one")
public boolean utReplaceItemRenderer = true;
}

public static class EnderStorageCategory
{
@Config.RequiresMcRestart
Expand Down Expand Up @@ -620,6 +653,18 @@ public static class IronBackpacksCategory
public boolean utDuplicationFixesToggle = true;
}

public static class IronChestsCategory
{
@Config.RequiresMcRestart
@Config.Name("Replace Crystal Chest/Shulker Renderer")
@Config.Comment
({
"Fixes client-side memory leak by replacing the crystal chest/shulker box renderer with a simpler one",
"Note: Stack sizes are not rendered, similar to modern versions of this mod"
})
public boolean utReplaceItemRenderer = true;
}

public static class ItemStagesCategory
{
@Config.RequiresMcRestart
Expand Down Expand Up @@ -1047,7 +1092,7 @@ public static class TinkersConstructCategory

@Config.LangKey("cfg.universaltweaks.modintegration.tcon.toolcustomization")
@Config.Name("Tool Customization")
public final TinkersConstructCategory.ToolCustomizationCategory TOOL_CUSTOMIZATION = new TinkersConstructCategory.ToolCustomizationCategory();
public final ToolCustomizationCategory TOOL_CUSTOMIZATION = new ToolCustomizationCategory();

public static class ToolCustomizationCategory
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ public class UTMixinLoader implements ILateMixinLoader
private static final Map<String, Supplier<Boolean>> clientsideMixinConfigs = ImmutableMap.copyOf(new HashMap<String, Supplier<Boolean>>()
{
{
put("mixins.mods.bibliocraft.json", () -> loaded("bibliocraft") && UTConfigMods.BIBLIOCRAFT.utDisableVersionCheckToggle);
put("mixins.mods.cbmultipart.client.json", () -> loaded("forgemultipartcbe") && UTConfigMods.CB_MULTIPART.utMemoryLeakFixToggle);
put("mixins.mods.compactmachines.memory.json", () -> loaded("compactmachines3") && UTConfigMods.COMPACT_MACHINES.utMemoryLeakFixToggle);
put("mixins.mods.compactmachines.render.json", () -> loaded("compactmachines3") && UTConfigMods.COMPACT_MACHINES.utCMRenderFixToggle);
put("mixins.mods.crafttweaker.json", () -> loaded("crafttweaker"));
put("mixins.mods.enderio.json", () -> loaded("enderio") && UTConfigMods.ENDER_IO.utReplaceItemRenderer);
put("mixins.mods.hwyla.json", () -> loaded("waila"));
put("mixins.mods.ironchests.json", () -> loaded("ironchest") && UTConfigMods.IRON_CHESTS.utReplaceItemRenderer);
put("mixins.mods.modularrouters.json", () -> loaded("modularrouters") && UTConfigMods.MODULAR_ROUTERS.utParticleThreadToggle);
put("mixins.mods.roost.json", () -> loaded("roost") && loaded("contenttweaker"));
put("mixins.mods.storagedrawers.client.json", () -> loaded("storagedrawers"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package mod.acgaming.universaltweaks.mods.bibliocraft.mixin;

import jds.bibliocraft.BiblioCraft;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

// Courtesy of jchung01
@Mixin(value = BiblioCraft.class, remap = false)
public class UTBiblioCraftMixin
{
/**
* @reason Skip version checking because it retains the first WorldClient
*/
@Inject(method = "postInitClient", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/eventhandler/EventBus;register(Ljava/lang/Object;)V", ordinal = 0, shift = At.Shift.AFTER), cancellable = true)
private void utDisableVersionCheck(CallbackInfo ci)
{
ci.cancel();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package mod.acgaming.universaltweaks.mods.compactmachines.render;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.GameType;
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.WorldType;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraftforge.fml.common.Loader;

import io.netty.util.collection.LongObjectHashMap;
import io.netty.util.collection.LongObjectMap;

public class DummyWorld
{
public static final WorldSettings DEFAULT_SETTINGS = new WorldSettings(1L, GameType.SURVIVAL, true, false, WorldType.DEFAULT);
public static final boolean isAlfheimLoaded = Loader.isModLoaded("alfheim");

public static class DummyChunkProvider implements IChunkProvider
{
private final World world;
private final LongObjectMap<Chunk> loadedChunks = new LongObjectHashMap<>();

public DummyChunkProvider(World world) {
this.world = world;
}

@Nullable
@Override
public Chunk getLoadedChunk(int x, int z) {
return loadedChunks.get(ChunkPos.asLong(x, z));
}

@Nonnull
@Override
public Chunk provideChunk(int x, int z) {
long chunkKey = ChunkPos.asLong(x, z);
if (loadedChunks.containsKey(chunkKey))
return loadedChunks.get(chunkKey);
Chunk chunk = new Chunk(world, x, z);
loadedChunks.put(chunkKey, chunk);
return chunk;
}

@Override
public boolean tick() {
for (Chunk chunk : loadedChunks.values()) {
chunk.onTick(false);
}
return !loadedChunks.isEmpty();
}

@Nonnull
@Override
public String makeString() {
return "Dummy";
}

@Override
public boolean isChunkGeneratedAt(int x, int z) {
return true;
}
}
}
Loading
Loading