Skip to content

Commit

Permalink
Update npcspawner.js
Browse files Browse the repository at this point in the history
  • Loading branch information
radmanplays authored Sep 14, 2024
1 parent 3cace5c commit cba7da5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions examplemods/npcspawner.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
const world = event.sender.getServerForPlayer();
const playerPos = event.sender.getPosition();

// Create a fake player entity
const FakePlayerClass = ModAPI.reflect.getClassById("com.mojang.authlib.GameProfile");
const fakeProfile = FakePlayerClass.constructors[2](
null, ModAPI.util.str("Steve")
// Create a fake "null" UUID as a string
const nullUUID = "00000000-0000-0000-0000-000000000000";

// Create a fake player entity with a string-based UUID
const GameProfileClass = ModAPI.reflect.getClassById("com.mojang.authlib.GameProfile");
const fakeProfile = GameProfileClass.constructors[2](
nullUUID, ModAPI.util.str("Steve")
);

const EntityPlayerMPClass = ModAPI.reflect.getClassById("net.minecraft.entity.player.EntityPlayerMP");
Expand Down

0 comments on commit cba7da5

Please sign in to comment.