#Throwable fire charges
34 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
@ivory cypress sorry to trouble but I've been searching in the discord and found your script, which is really neat
Would be too difficult to make them simpler?
Ignore this if its an inconvenience
ItemEvents.rightClicked(event => {
if (event.item.id == "minecraft:fire_charge") {
let player = event.player
let PITCH = player.pitch * 3.14159/180
let YAW = player.yaw * 3.14159/180
let vec = new Vec3(-Math.sin(YAW)*Math.cos(PITCH), -Math.sin(PITCH), Math.cos(YAW)*Math.cos(PITCH));
event.server.runCommand(`execute at ${player.username} run summon minecraft:fireball ~ ~ ~ {Motion:[${vec.x()}d,${vec.y()}d,${vec.z()}d]}`)
}
})
[Server thread/ERROR]: items/fire_charge.js#6: Error occurred while handling event 'ItemEvents.rightClicked': ReferenceError: "Vec3" is not defined.
Im getting this
And changed it
Weird.
Try this code,
const $Vec3 = Java.loadClass(`net.minecraft.world.phys.Vec3`)
ItemEvents.rightClicked(event => {
if (event.item.id == "minecraft:fire_charge") {
let player = event.player
let PITCH = player.pitch * 3.14159/180
let YAW = player.yaw * 3.14159/180
let vec = new $Vec3(-Math.sin(YAW)*Math.cos(PITCH), -Math.sin(PITCH), Math.cos(YAW)*Math.cos(PITCH));
event.server.runCommandSilent(`execute at ${player.username} run summon minecraft:fireball ~ ~ ~ {Motion:[${vec.x()}d,${vec.y()}d,${vec.z()}d]}`)
}
})
It loads the Vec3 class
I remember writing something back in 1.14 for this.
Not sure I could dig it up again though
Working! But it decelarates and gets stucked midair
Yeah thats happening for me too, idk why
Oh i think i may know why
Cool
: )
And sorry to ask for this too, but it would be the best to replace this script on top of the right_click vanilla function
Still can be used as always
As in remove its ability to be used as a firestarter?
Yeap
just add event.cancel() at the end of the script and it should do that
const $Vec3 = Java.loadClass(`net.minecraft.world.phys.Vec3`)
ItemEvents.rightClicked(event => {
if (event.item.id == "minecraft:fire_charge") {
let explosionPower = 4
let player = event.player
let PITCH = player.pitch * 3.14159/180
let YAW = player.yaw * 3.14159/180
let vec = new $Vec3(-Math.sin(YAW)*Math.cos(PITCH), -Math.sin(PITCH), Math.cos(YAW)*Math.cos(PITCH));
event.server.runCommandSilent(`execute at ${player.username} run summon minecraft:fireball ~ ~ ~
{
ExplosionPower:${explosionPower},
power:[${vec.x()}d,${vec.y()}d,${vec.z()}d],
Motion:[${vec.x()}d,${vec.y()}d,${vec.z()}d]
}`)
}
})
This isnt quite what I had in mind for fixing the speed but hey it works 
Alright, Im completely clueless as you can see but now I remember having this in some experiments I've done previously
