#Throwable fire charges

34 messages · Page 1 of 1 (latest)

limpid kernel
#

Is there any method to implement fire charges being able to be used like ghasts do with their fire balls? Just like right-clicking them and disabling their vanilla behaviour.

opaque cometBOT
#

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

limpid kernel
#

@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

half mesa
#
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]}`)
    }
})
limpid kernel
#

woah!

#

Thanks! gonna try it

half mesa
#

👍

#

Oh make sure its runCommandSilent so that it doesnt flood the console

limpid kernel
#

[Server thread/ERROR]: items/fire_charge.js#6: Error occurred while handling event 'ItemEvents.rightClicked': ReferenceError: "Vec3" is not defined.

#

Im getting this

half mesa
# limpid kernel [Server thread/ERROR]: items/fire_charge.js#6: Error occurred while handling eve...

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

verbal kelp
#

I remember writing something back in 1.14 for this.
Not sure I could dig it up again though

limpid kernel
half mesa
#

Oh i think i may know why

limpid kernel
#

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

half mesa
limpid kernel
#

Yeap

half mesa
#

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 shrug

limpid kernel
#

Alright, Im completely clueless as you can see but now I remember having this in some experiments I've done previously

half mesa
#

replied to wrong message

limpid kernel
#

Woahhhhh

#

This could be a football feint

#

Hahaha

#

Thanks!!!