Hello. First time trying KubeJs! Im trying to get a player's entity data. Specifically a modded value.
The value is "apotheosis:world_tier" which using /data. I got to see my current value is:
"apotheosis:world_tier": "haven".
Im trying to use it to disable mob spawns depending on this value. However. Im not sure if I can access the player's data during these events.
Here's what I have tried so far:
EntityEvents.spawned("minecraft:zombie", event =>{
// Get the player's WorldTier
var nbt = event.player.getCompound(world_tier)
let playerTier = event.player.world_tier;
event.server.tell('worldTier: ' + playerTier);
console.log('log test');
if(playerTier == 'haven'){
event.cancel();
}
});
However. it errors at trying to use the object event.player since that value is null:
Error in 'EntityEvents.spawned': dev.latvian.mods.rhino.EcmaError: TypeError: Cannot call method "getCompound" of null
Im assuming thats not how I access the player object. Any tips?