A
📎 1 file 1,029 chars
📄
pasted-code-1776513853200.txt
txt 26 lines
▶
I want to create a fake player (NPC) that joins the game and behaves in a creepy, mysterious way.

Behavior:

When the fake player spawns, it should automatically detect and focus on the nearest real player.
It should move toward that player but maintain a distance:
Maximum distance: 60 blocks
Minimum distance: 15 blocks
If the fake player is farther than 60 blocks, it should move closer.
If it is within 15 blocks, it must stop moving and only look at the player, constantly tracking their position.

Appearance & Identity:

The fake player should have a strange, unknown-looking name (using glitched or unusual Unicode characters if possible).
The overall vibe should feel unsettling, eerie, and mysterious.

Reactions:

When hit: send the message "stop" in chat
When below 50% health: send "STOP" in chat
Upon death:
First send: "You shouldn't have done that"
Then send: "You will pay"

Goal:
The fake player should create a spooky and unsettling experience for real players, as if it’s watching and reacting intelligently.
Kodari AI
KodariApr 18 at 12:13 pm 73,879 (v2)
CreeperNPC
A Fabric 1.21.4 mod that spawns a mysterious fake player NPC that stalks the nearest real player. The NPC has a glitched Unicode name, maintains a 15–60 block distance range (closing in when too far, watching when close), and reacts intelligently to player interactions: sending "stop" in chat when hit, "STOP" at below 50% health, and ominous final messages on death. Creates a genuinely unsettling experience.

Planning before writing:

  • FakePlayerEntity extends ServerPlayerEntity with a DummyNetworkHandler to avoid NPEs — runs its own AI tick (movement + rotation) and overrides damage/onDeath for dialogue reactions

  • DummyNetworkHandler extends ServerPlayNetworkHandler with no-op tick(), sendPacket(), disconnect(), and isConnectionOpen() = true to prevent the server from ejecting our NPC

  • NpcManager singleton handles spawn-on-join, player-list packets for new joiners, scheduled death messages, and the per-tick AI dispatch

  • CreeperNpcMod wires ServerPlayConnectionEvents.JOIN + ServerTickEvents.END_SERVER_TICK into NpcManager

CreeperNPC
A Fabric 1.21.4 mod that spawns a mysterious fake player NPC that silently stalks the nearest real player. It maintains a 15–60 block range (approaching when too far, watching when close), sports a glitched Unicode name for an eerie aesthetic, and reacts to player interactions with unsettling chat messages: "stop" when hit, "STOP" below 50% health, and final ominous words on death. Designed to create a genuinely creepy, intelligent-feeling presence.

Here’s a summary of what was built:

CreeperNPC — 9 files, zero mixins needed.

File
Role
FakePlayerEntity
Extends
ServerPlayerEntity
; custom
tick()
runs movement AI +
baseTick()
, overrides
damage()
for “stop”/“STOP” reactions and
onDeath()
for delayed final messages
DummyNetworkHandler
Extends
ServerPlayNetworkHandler
with all network methods no-op’d and
isConnectionOpen()
returning
true
so the server never ejects the NPC
NpcManager
Singleton; spawns NPC on first player join, sends
PlayerListS2CPacket
(tab-list visibility),
PlayerRemoveS2CPacket
on death, and drains a scheduled-message queue each server tick for the 3-second delayed death message
CreeperNpcMod
Wires
ServerPlayConnectionEvents.JOIN
and
ServerTickEvents.END_SERVER_TICK

Behaviour at a glance:

  • Spawns 30 blocks from the first real player to join, positioned on the surface

  • Every tick: finds nearest real player → looks at them; if distance > 15 moves at 0.15 blocks/tick toward them, clamping exactly at 15; ground-snaps via MOTION_BLOCKING heightmap

  • Hit → broadcasts <N̷ U̵L̶L̸> stop; drops below 50% HP once → STOP; killed → "You shouldn't have done that" immediately then "You will pay" after 3 seconds (60 ticks)

A

The compilation failed with this error:

code
Compilation failed with 6 error(s):

ERROR in src/main/java/com/example/creepernpc/FakePlayerEntity.java at line 25: incompatible types: ConnectedClientData cannot be converted to SyncedClientOptions
        super(server, world, profile, ConnectedClientData.createDefault(profile, false));
                                                                       ^

ERROR in src/main/java/com/example/creepernpc/NpcManager.java at line 51: method entryFromPlayer in class PlayerListS2CPacket cannot be applied to given types;
                PlayerListS2CPacket.entryFromPlayer(
                                   ^

ERROR in src/main/java/com/example/creepernpc/NpcManager.java at line 63: method entryFromPlayer in class PlayerListS2CPacket cannot be applied to given types;
                PlayerListS2CPacket.entryFromPlayer(
                                   ^

ERROR in   src/main/java/com/example/creepernpc/NpcManager.java at line 51: method entryFromPlayer in class PlayerListS2CPacket cannot be applied to given types;
                  PlayerListS2CPacket.entryFromPlayer(
                                     ^

ERROR in   src/main/java/com/example/creepernpc/NpcManager.java at line 63: method entryFromPlayer in class PlayerListS2CPacket cannot be applied to given types;
                  PlayerListS2CPacket.entryFromPlayer(
                                     ^

ERROR in   src/main/java/com/example/creepernpc/FakePlayerEntity.java at line 25: incompatible types: ConnectedClientData cannot be converted to SyncedClientOptions
          super(server, world, profile, ConnectedClientData.createDefault(profile, false));
                                                                         ^


=== COMPILATION ERROR ANALYSIS ===

TYPE MISMATCHES:
  - incompatible types: ConnectedClientData cannot be converted to SyncedClientOptions
  - incompatible types: ConnectedClientData cannot be converted to SyncedClientOptions
ACTION: Fix variable types or casting

FILES TO INVESTIGATE:
  - src/main/java/com/example/creepernpc/FakePlayerEntity.java
  - src/main/java/com/example/creepernpc/NpcManager.java
  -   src/main/java/com/example/creepernpc/NpcManager.java
  -   src/main/java/com/example/creepernpc/FakePlayerEntity.java

Please fix this error by creating a new artifact with the corrected code.

A

The compilation failed with this error:

code
Compilation failed with 6 error(s):

ERROR in src/main/java/com/example/creepernpc/FakePlayerEntity.java at line 25: incompatible types: ConnectedClientData cannot be converted to SyncedClientOptions
        super(server, world, profile, ConnectedClientData.createDefault(profile, false));
                                                                       ^

ERROR in src/main/java/com/example/creepernpc/NpcManager.java at line 51: method entryFromPlayer in class PlayerListS2CPacket cannot be applied to given types;
                PlayerListS2CPacket.entryFromPlayer(
                                   ^

ERROR in src/main/java/com/example/creepernpc/NpcManager.java at line 63: method entryFromPlayer in class PlayerListS2CPacket cannot be applied to given types;
                PlayerListS2CPacket.entryFromPlayer(
                                   ^

ERROR in   src/main/java/com/example/creepernpc/NpcManager.java at line 51: method entryFromPlayer in class PlayerListS2CPacket cannot be applied to given types;
                  PlayerListS2CPacket.entryFromPlayer(
                                     ^

ERROR in   src/main/java/com/example/creepernpc/NpcManager.java at line 63: method entryFromPlayer in class PlayerListS2CPacket cannot be applied to given types;
                  PlayerListS2CPacket.entryFromPlayer(
                                     ^

ERROR in   src/main/java/com/example/creepernpc/FakePlayerEntity.java at line 25: incompatible types: ConnectedClientData cannot be converted to SyncedClientOptions
          super(server, world, profile, ConnectedClientData.createDefault(profile, false));
                                                                         ^


=== COMPILATION ERROR ANALYSIS ===

TYPE MISMATCHES:
  - incompatible types: ConnectedClientData cannot be converted to SyncedClientOptions
  - incompatible types: ConnectedClientData cannot be converted to SyncedClientOptions
ACTION: Fix variable types or casting

FILES TO INVESTIGATE:
  - src/main/java/com/example/creepernpc/FakePlayerEntity.java
  - src/main/java/com/example/creepernpc/NpcManager.java
  -   src/main/java/com/example/creepernpc/NpcManager.java
  -   src/main/java/com/example/creepernpc/FakePlayerEntity.java

Please fix this error by creating a new artifact with the corrected code.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
10 381
src/client/java/com/example/creepernpc/CreeperNpcClient.java
package com.example.creepernpc;

import net.fabricmc.api.ClientModInitializer;

public class CreeperNpcClient implements ClientModInitializer {
    @Override
    public void onInitializeClient() {
    }
}