fixed bugs, memory leaks, etc

This commit is contained in:
bbldrizzy committed 2026-10-23 08:36:42 +01:00
1 parent aa4f6b6ddc
commit c3f8f23c1d
124 files changed
+1060 -420

No files matched your search

@@ -44,6 +44,7 @@ public class EnemyFaker extends Module {
&& event.getPlayerName() != null
&& event.getSkinTextures() != null
&& !this.fakeName.getValue().isEmpty()
&& mc.getNetworkHandler() != null
&& mc.getNetworkHandler().getPlayerListEntry(this.target.getUuid()) != null
&& mc.getNetworkHandler().getPlayerListEntry(this.target.getUuid()).getProfile() != null) {
if (event.getPlayerName()
@@ -86,7 +87,12 @@ public class EnemyFaker extends Module {
@Subscribe
public void onClientTick(ClientTickEvent event) {
for (PlayerEntity player : mc.world.getPlayers()) {
if (mc.world == null || mc.player == null) {
this.target = null;
return;
}
for (PlayerEntity player : new ArrayList<>(mc.world.getPlayers())) {
if (!player.equals(mc.player) && (player.isDead() || !player.isAlive())) {
mc.world.removeEntity(player.getId(), RemovalReason.DISCARDED);
}
@@ -96,25 +102,50 @@ public class EnemyFaker extends Module {
if (this.update.getValue()) {
this.update.setValue(false);
if (!this.fakeName.getValue().isEmpty()) {
UUID uuid = MojangApi.fetchUuid(this.fakeName.getValue().toString());
if (uuid != null) {
GameProfile profile = MojangApi.fetchProfile(uuid);
CompletableFuture skinFuture = mc.getSkinProvider().fetchSkinTextures(profile);
skinFuture.thenAccept(skinResult -> {
if (((java.util.Optional)skinResult).isPresent()) {
this.fakeSkin = (SkinTextures)((java.util.Optional)skinResult).get();
mc.player.sendMessage(Text.of("Fake skin updated to: " + this.fakeName.getValue()), false);
} else {
mc.player.sendMessage(Text.of("Failed to fetch skin for: " + this.fakeName.getValue()), false);
}
});
}
String requestedName = this.fakeName.getValue().toString();
// Mojang lookups block for several seconds on a bad connection, never do them on the game thread
Thread lookup = new Thread(() -> {
UUID uuid = MojangApi.fetchUuid(requestedName);
GameProfile profile = uuid == null ? null : MojangApi.fetchProfile(uuid);
if (profile != null) {
mc.execute(() -> this.applyFakeSkin(profile, requestedName));
}
}, "Prestige-SkinLookup");
lookup.setDaemon(true);
lookup.start();
}
}
}
private void applyFakeSkin(GameProfile profile, String requestedName) {
if (!this.isEnabled()) {
return;
}
CompletableFuture skinFuture = mc.getSkinProvider().fetchSkinTextures(profile);
skinFuture.thenAccept(skinResult -> {
if (((java.util.Optional)skinResult).isPresent()) {
this.fakeSkin = (SkinTextures)((java.util.Optional)skinResult).get();
if (mc.player != null) {
mc.player.sendMessage(Text.of("Fake skin updated to: " + requestedName), false);
}
} else if (mc.player != null) {
mc.player.sendMessage(Text.of("Failed to fetch skin for: " + requestedName), false);
}
});
}
@Override
public void onDisable() {
this.target = null;
this.fakeSkin = null;
}
public static PlayerEntity findClosestEnemy() {
PlayerEntity closest = null;
if (mc.world == null || mc.player == null) {
return null;
}
for (PlayerEntity player : new ArrayList<>(mc.world.getPlayers())) {
if (!player.equals(mc.player)