#Entityjs OnCollision Target Execute a comman
20 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
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
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)
})
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
Alright, I’m about to test it — I launched Minecraft without placing the script in the right spot 😅
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
Yeah, but I don’t really understand them well yet — I’m going to learn them so this doesn’t happen again😅
well worth using lol
Alright, they’re not as hard as I thought
Yeah, I’ve restarted Minecraft more times this month than in all the years I’ve been playing it 💀
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!
Ticket closed!