#Entityjs OnCollision Target Execute a comman

20 messages · Page 1 of 1 (latest)

terse imp
#

The following command works fine for certain things, but when I try to make the entity that collides with the main entity (the target) execute a command — like moving 10 blocks upward or teleporting to another dimension using execute — it doesn’t work.

iron zephyrBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

terse imp
#
    event.modify("minecraft:creeper", modifyBuilder => {
        modifyBuilder.onEntityCollision(context => {
            const { entity, target } = context
            console.log(entity)
        })
    })
})```
#

@subtle lava help

#

Also, the bug I found is that when I rotate an entity — in my case I'm doing it with this command:
/execute as @e[type=portals:herobrine,limit=1,sort=nearest] at @s run tp @s ~ ~ ~ ~10 ~
sometimes the rotation takes longer to apply or gets skipped. I thought it was a Minecraft issue, but it doesn't happen with entities like armor stands

harsh spadeBOT
#

You can write your code in a codeblock by typing it between the codeblock delimiters:
Note that these are backticks, not apostrophes

```js :arrow_left:

ServerEvents.recipes(event => {
event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})

``` :arrow_left:

This example will look like this:

ServerEvents.recipes(event => {
  event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
subtle lava
#

as for teleporting the target you should instead use the built in teleportTo method js target.teleportTo("minecraft:overworld", target.x,target.y + 10, target.z,target.yaw,target.pitch)

#

here you can specify rotation with yaw/pitch as well which should solve your other issue

terse imp
subtle lava
#

ok, also make sure you're using global functions if you want to reload your script without having to restart every time

#

not sure if i showed you those yet

terse imp
terse imp
terse imp
# subtle lava

Yeah, I’ve restarted Minecraft more times this month than in all the years I’ve been playing it 💀

subtle lava
#

😭

#

welp, now you can save time lol

terse imp
# subtle lava welp, now you can save time lol

Yep, maybe I should’ve opened a thread about global functions When I saw them for the first time, I could’ve saved so many hours xDDD and about the script — it worked perfectly! Thank you so much, you’re doing an amazing job with EntityJS, and congrats on reaching a million!