Skip to content

Commit

Permalink
Fix skin manager leaking client world (#469)
Browse files Browse the repository at this point in the history
Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
  • Loading branch information
Glease authored Jan 9, 2025
1 parent cc56f5b commit 3601891
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
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;
}
}

0 comments on commit 3601891

Please sign in to comment.