MechOrigin / NTC2

9 stars 10 forks source link

Overworld Portal item does not teleport the correct user #77

Open AaronOziel opened 2 years ago

AaronOziel commented 2 years ago

When using the kubejs "Overworld Portal" item while on a server, the item teleports the player closest to world spawn instead of teleporting the activating player. I can see you may have tried to fix this issue with scoreboard shenanigans:

if(id.contains('kubejs') & id.contains('overworld_portal')) {
        event.server.scheduleInTicks(1, event.server, function (callback) {

            callback.data.runCommand('/execute in ntc_dimension:ntc_dimension as @p run tp 1.5 127 1.5')

            // callback.data.runCommand('/scoreboard objectives add OverworldPortal minecraft.used:kubejs.overworld_portal')
            // callback.data.runCommand('/execute run scoreboard players add @p OverworldPortal 1')
            // callback.data.runCommand('/execute as @r at @s if entity @s[scores={OverworldPortal=1..},nbt={SelectedItem:{id:"kubejs:overworld_portal",Count:1b}}] in ntc_dimension:ntc_dimension as @p run tp 1.5 127 1.5')
            // callback.data.runCommand('/scoreboard players reset @p OverworldPortal')
          })
    }

But currently as @p run tp 1.5 127 1.5 picks whoever is closest to ntc_dimension 0, 0