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 skin manager leaking client world #469

Merged
merged 1 commit into from
Jan 9, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ public class FixesConfig {
@Config.DefaultBoolean(true)
public static boolean fixWorldServerLeakingUnloadedEntities;

@Config.Comment("Fix skin manager leaking client world")
@Config.DefaultBoolean(true)
public static boolean fixSkinManagerLeakingClientWorld;

@Config.Comment("Increase the maximum network packet size from the default of 2MiB")
@Config.DefaultBoolean(true)
public static boolean increasePacketSizeLimit;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ public enum Mixins {
FIX_WORLD_SERVER_LEAKING_UNLOADED_ENTITIES(new Builder("Fix world server leaking unloaded entities")
.setPhase(Phase.EARLY).setSide(Side.BOTH).addMixinClasses("minecraft.MixinWorldServerUpdateEntities")
.setApplyIf(() -> FixesConfig.fixWorldServerLeakingUnloadedEntities).addTargetedMod(TargetedMod.VANILLA)),
FIX_SKIN_MANAGER_CLIENT_WORLD_LEAK(new Builder("Fix skin manager client world leak").setPhase(Phase.EARLY)
.setSide(Side.CLIENT).addMixinClasses("minecraft.MixinSkinManager$2")
.setApplyIf(() -> FixesConfig.fixSkinManagerLeakingClientWorld).addTargetedMod(TargetedMod.VANILLA)),

FIX_REDSTONE_TORCH_WORLD_LEAK(new Builder("Fix world leak in redstone torch").setPhase(Phase.EARLY)
.setSide(Side.BOTH).addMixinClasses("minecraft.MixinBlockRedstoneTorch")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.mitchej123.hodgepodge.mixins.early.minecraft;

import net.minecraft.client.resources.SkinManager;

import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(targets = "net.minecraft.client.resources.SkinManager$2")
public class MixinSkinManager$2 {

@Shadow(aliases = "field_152636_b", remap = false)
@Mutable
@Final
SkinManager.SkinAvailableCallback val$p_152789_3_;

@SuppressWarnings("UnresolvedMixinReference")
@Inject(
method = "func_152634_a()V",
at = @At(
value = "INVOKE",
target = "net/minecraft/client/resources/SkinManager$SkinAvailableCallback.func_152121_a(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;)V",
shift = At.Shift.AFTER,
by = 1))
private void hodgepodge$clearReference(CallbackInfo ignored) {
val$p_152789_3_ = null;
}
}