#doesnt set torch block unless it has not facing orientation

17 messages · Page 1 of 1 (latest)

torpid swift
#

for whatever reason the script only works if the torch is up right and isnt facing any direction on the side of a block

BlockEvents.rightClicked('hardcore_torches:unlit_torch', e=> {
    const failChance = 0.7;
    const fireStarter = 'kubejs:fire_plough';

    const {player, block, item, hand} = e;
    const {properties} = block;

    if(hand == 'OFF_HAND' || item != fireStarter) return;

    const {x, y, z} = block;

    if(Math.random() > failChance) {
        player.swing();
        player.server.runCommandSilent(`playsound entity.blaze.shoot player @p ${x} ${y} ${z}`);
        block.set('hardcore_torches:lit_torch'), {facing: properties.get('facing')};
        player.damageHeldItem();
    }
    else {
        player.level.spawnParticles('minecraft:large_smoke', true, x+0.5, y, z+0.5, 0, 0.25, 0, 3, 0.1)
        player.server.runCommandSilent(`playsound block.fire.extinguish player @p ${x} ${y} ${z}`);
        player.damageHeldItem();
    }
})
proud crestBOT
#

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

normal hill
#

thats the code i wrote for campfire

#

you mean only works for main hand?

#

"up right" is kinda funny lol

#

i dont think torch have same properties as campfire

#
  1. make the code a function, and use if...else, so it won't trigger twice in a row. that would work for both mainhand and offhand
  2. use e.server.tell(properties) to check all available properties of that block
#

the second step would provide you enough information

#

in that ticket, you said "doc", and all the properties of that block is the doc you need

torpid swift
torpid swift
#

i thought the only property would be facing becuz jade seemed to tell me so

normal hill
#

i mean, create a independent script, just for testing

#
BlockEvents.rightClicked(e => {
    e.server.tell(e.block.properties)
})
#

forget about the hand check, since you can only use one hand in your modpack