From cba7da5495199737c5ff4a6d62e7fff89fdefee6 Mon Sep 17 00:00:00 2001 From: radmanplays <95340057+radmanplays@users.noreply.github.com> Date: Sat, 14 Sep 2024 14:55:49 +0330 Subject: [PATCH] Update npcspawner.js --- examplemods/npcspawner.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/examplemods/npcspawner.js b/examplemods/npcspawner.js index 113dba7..d5770da 100644 --- a/examplemods/npcspawner.js +++ b/examplemods/npcspawner.js @@ -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");