Maybe fixed memory issues

This commit is contained in:
kirillsaint 2023-10-08 14:02:50 +06:00
parent 845f853a61
commit 41f9a51699
2 changed files with 24 additions and 4 deletions

View File

@ -9,6 +9,7 @@ import net.minecraft.network.play.server.S48PacketResourcePackSend;
import net.minecraft.util.IChatComponent;
import net.silentclient.client.event.impl.EntityDamageEvent;
import net.silentclient.client.hooks.NetHandlerPlayClientHook;
import net.silentclient.client.utils.Players;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.*;
@ -31,6 +32,7 @@ public class NetHandlerPlayClientMixin {
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;displayGuiScreen(Lnet/minecraft/client/gui/GuiScreen;)V")
)
private GuiScreen skipTerrainScreen(GuiScreen original) {
Players.reload();
return null;
}

View File

@ -19,7 +19,7 @@ public class Players {
public static final Map<String, PlayerResponse.Account> playersCache = new WeakHashMap<>();
public static void reload() {
// playersCache.clear();
playersCache.clear();
}
public static String getPlayerStatus(boolean isMainPlayer, String name, UUID id, AbstractClientPlayer playerRow) {
@ -117,10 +117,28 @@ public class Players {
Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer);
}
}
if(playersCache.containsKey(account.getUsername())) {
playersCache.remove(account.getUsername());
if(Minecraft.getMinecraft().theWorld != null && getPlayerEntityByName(account.original_username) != null) {
Client.logger.info("Account processing: " + account.getUsername());
if(playersCache.containsKey(account.getUsername())) {
playersCache.remove(account.getUsername());
}
playersCache.put(account.getUsername(), account);
}
playersCache.put(account.getUsername(), account);
}
public static EntityPlayer getPlayerEntityByName(String name)
{
for (int i = 0; i < Minecraft.getMinecraft().theWorld.playerEntities.size(); ++i)
{
EntityPlayer entityplayer = (EntityPlayer)Minecraft.getMinecraft().theWorld.playerEntities.get(i);
if (name.equalsIgnoreCase(entityplayer.getName()))
{
return entityplayer;
}
}
return null;
}
public static PlayerResponse getAccount(String name) {