Aragon Houska

hey, could you make me a mod, that will make ghosts of players that go out of render distance? with their skin, nametag, also highlight them through blocks, the server has a proxy, i need you to clear all of the ghosts when i switch a server (like donutsmp / lifesteal.net), where there are "shards", things you just go through and it teleports you to another back-end server through a proxy

Kodari AI
KodariOct 13 at 12:17 pm 4
GhostPlayerTrail
A Fabric mod for Minecraft 1.21.1 that creates ghost replicas of players when they leave render distance. Ghosts display the player's skin, nametag, and are highlighted through blocks with a glowing outline. The mod detects proxy-based server switches (like DonutSMP or Lifesteal.net shards) and automatically clears all active ghosts upon cross-server teleportation, preventing ghost accumulation from previous backend servers. Ghosts are client-side only, synced via custom packets, and despawn when the original player returns to render distance or the connection changes.
  1. Track player entities when they unload and retain their skin/profile data.

  2. Render retained players as translucent ghosts with nametags and through-wall visibility.

  3. Clear tracked ghosts on disconnect, world/backend changes, and client shutdown.

  4. Create the Fabric 1.21.11 project files and register the client entrypoint.

Created a client-only Fabric 1.21.11 mod. When another player unloads beyond render distance, their skin and nametag are retained and rendered as a translucent ghost with a magenta outline visible through blocks. Their ghost disappears if they come back into range.

Ghosts clear on disconnect, world changes, respawn, game join, and server position corrections. A position correction can also clear them during an ordinary server correction; a proxy handoff with no corresponding client-visible packet cannot be detected generically. No server-side installation is required.

Aragon Houska

you sure its gonna work if i switch shard? like on Lifesteal.net?

Kodari AI
KodariOct 13 at 12:19 pm 1

Not guaranteed for Lifesteal specifically. I should have been clearer: the mod clears ghosts when the client receives a detectable reset, such as a world change or respawn. If Lifesteal switches shards behind the proxy without sending one of those signals, the client-only mod may not know the backend changed, and ghosts could remain.

So it should clear if the shard transition triggers one of those events, but I can’t promise it will for every Lifesteal shard switch without testing that transition.

Aragon Houska

are you able to look at videos? i can record it

Kodari AI
KodariOct 13 at 12:21 pm 1

Yes—upload the recording here. If you can, include a few seconds before entering the shard, the transition itself, and what the ghosts look like afterward. I can use that to tell whether the client gets a detectable reset and adjust the clearing logic.

Aragon Houska

would it be possible to check the shard change by looking at TAB? in the middle down theres lifesteal-(and a number, which is the shard)

1 image attached
Kodari AI
KodariOct 13 at 12:26 pm 1
  1. Check the existing ghost reset hooks and how the client receives the TAB footer.

  2. Add shard-name change detection and clear ghosts when the displayed shard changes.

  3. Keep existing reset behavior intact.

Yes. I’ve updated the mod to watch the TAB footer for lifesteal-<number> and clear ghosts when that shard number changes—for example, from lifesteal-6 to lifesteal-7. This relies on the server sending the updated footer to the client.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
8 274
src/client/java/net/kodari/playerghosts/PlayerGhostsClient.java
package net.kodari.playerghosts;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientEntityEvents;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientWorldEvents;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.entity.EntityRenderManager;
import net.minecraft.client.render.entity.state.EntityRenderState;
import net.minecraft.client.render.entity.state.PlayerEntityRenderState;
import net.minecraft.client.render.command.OrderedRenderCommandQueue;
import net.minecraft.client.render.state.CameraRenderState;
import net.minecraft.client.render.state.WorldRenderState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.player.SkinTextures;
import net.minecraft.text.Text;

public final class PlayerGhostsClient implements ClientModInitializer {
    private static final Map<UUID, Ghost> GHOSTS = new LinkedHashMap<>();

    @Override
    public void onInitializeClient() {
        ClientEntityEvents.ENTITY_UNLOAD.register((entity, world) -> {
            if (entity instanceof AbstractClientPlayerEntity player && !player.isMainPlayer()) {
                GHOSTS.put(player.getUuid(), new Ghost(
                        player,
                        world,
                        player.getSkin(),
                        player.getName(),
                        player.getDisplayName()
                ));
            }
        });

        ClientEntityEvents.ENTITY_LOAD.register((entity, world) -> {
            if (entity instanceof AbstractClientPlayerEntity player && !player.isMainPlayer()) {
                GHOSTS.remove(player.getUuid());
            }
        });

        ClientPlayConnectionEvents.JOIN.register((handler, sender, client) -> clearGhosts());
        ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> clearGhosts());
        ClientWorldEvents.AFTER_CLIENT_WORLD_CHANGE.register((client, world) -> clearGhosts());
    }

    public static void clearGhosts() {
        GHOSTS.clear();
    }

    public static void renderGhosts(WorldRenderState renderStates, MatrixStack matrices, OrderedRenderCommandQueue queue) {
        MinecraftClient client = MinecraftClient.getInstance();
        if (client.world == null || GHOSTS.isEmpty()) {
            return;
        }

        CameraRenderState cameraState = renderStates.cameraRenderState;
        EntityRenderManager renderManager = client.getEntityRenderDispatcher();
        float tickDelta = client.getRenderTickCounter().getTickProgress(false);

        for (Ghost ghost : GHOSTS.values()) {
            if (ghost.world != client.world) {
                continue;
            }

            EntityRenderState entityState = renderManager.getAndUpdateRenderState(ghost.player, tickDelta);
            if (!(entityState instanceof PlayerEntityRenderState state)) {
                continue;
            }

            state.skinTextures = ghost.skin;
            state.playerName = ghost.playerName;
            state.displayName = ghost.displayName;
            state.invisible = true;
            state.invisibleToPlayer = false;
            state.outlineColor = 0xFFFF55FF;

            renderManager.render(
                    state,
                    cameraState,
                    state.x - cameraState.pos.x,
                    state.y - cameraState.pos.y,
                    state.z - cameraState.pos.z,
                    matrices,
                    queue
            );
        }
    }

    private record Ghost(
            AbstractClientPlayerEntity player,
            ClientWorld world,
            SkinTextures skin,
            Text playerName,
            Text displayName
    ) {
    }
}