#Cooldown + doesnt work as intented

15 messages · Page 1 of 1 (latest)

echo bison
#

This code basicly work but only only for solid wall that is placed inside of the compactmachine and not for walls, floor and roof

    if(e.hand == 'OFF_HAND') return
        if (e.player.isCrouching() && e.player.mainHandItem == Item.getEmpty()) {
            e.block.popItem('kubejs:dirt_chunk')
        }  
})```

Also i would like to add little cooldown, like 0.5 sec, to it but i didn't find anything about cooldown at wiki or anywhere.
thank so much for help!
forest sapphireBOT
#

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

stone meteorBOT
#

[➤](#1270787882411495444 message)

event.player.addItemCooldown('minecraft:stone', 20)```
upbeat basin
#

↑item cooldown
↓script cooldown

global.throttle = (temp => (entity, tick, identifier) => {
    const {age, uuid} = entity;
    const key = `${uuid}${identifier}`;
    const now = temp[key];
    if(!now || age - now >= tick){
        temp[key] = age;
        return false;
    };
    return true;
})({})

example usage:

if(global.throttle(event.player, 10, 'idk')) return; //10 tick cooldown
echo bison
# stone meteor

this one as i see is for item use, i need like cooldown between when the popItem() "work"

#

if(global.throttle(event.player, 10, 'idk')) return;
worked ❤️ thank you but my problem with "solid_wall" is still here and i dont know how could i solve it if the block is placed inside the cube it works but on wall it does not

upbeat basin
#

use their id as argument

#
BlockEvents.leftClicked(['compactmachines:solid_wall', 'asdasd', 'asdasd2'], e => {
#

also, it's better to open two tickets for two problems

#

i'm kinda not sure what that means

#

i've never used tech mods

echo bison
echo bison
#

well i tried everything that came to my mind and i searched the whole discord but nothing works unfortunately.

#

imma close it but if you find something i would love to hear it please!