ServerEvents.tick(event => {
const targetDimension = 'minecraft:the_end';
const teleportY = 80;
event.server.level.getEntities().forEach(entity => {
if (entity.getY() > 200) {
entity.teleportTo(targetDimension, entity.getX(), teleportY, entity.getX(), entity.getYaw(), 0);
}
});
});```
I keep getting the error
[12:59:05] [ERROR] ! addonpack_ss:kubejs_scripts/earthorbit.js#6: Error in 'ServerEvents.tick': TypeError: Cannot call method "getEntities" of undefined
#getEntites
27 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
iirc it's just event.level
also you have the .getX() twice
you probably want getX() and getZ()
ah thank you I just noticed that XD
Unfortunately it still doesn't work, same error
'ServerEvents.tick': TypeError: Cannot call method "getEntities" of undefined
oh yeah sorry server tick has no "default" level
you would need to do event.server.getLevel('minecraft:the_end')
Where would I put that
Sorry I'm still kinda new to this
where you currently have event.server.level
but what are you trying to achieve with this?
and why?
go above y = 200 and teleport to another dimension and the goal is to try make some sort of compatbility between Valk skies and Ad astra
I've already sorted the oxygen issues
tried to sort the freezing xD
ok, this will be the dimension you would need to go above to go to the target dimension
also you may want to run this only every second instead
I figured that also every second?
also do you really want to do this for all entities and not only players
wdym
Yeah because I'm trying to target the valk skies ship entities
I didn't know it could be run every second is all
Also it works now thank you
this is probably what you want and only runs every second, the dimension where the teleport takes place from is the overworld
ServerEvents.tick(event => {
let level = event.server.getLevel('minecraft:overworld')
if(level.time % 20 != 0) return
const targetDimension = 'minecraft:the_end'
const teleportY = 80
level.getEntities().forEach(entity => {
if (entity.getY() > 200) {
entity.teleportTo(targetDimension, entity.getX(), teleportY, entity.getZ(), entity.getYaw(), 0)
}
})
})
Ticket closed!
Hi, VS2 Ships aren't entities