#How can I check if a block is being broken with the correct tools?

10 messages · Page 1 of 1 (latest)

cursive osprey
#

I have the following script...

BlockEvents.broken(event => {
    const {block, player} = event;
    if ( !player ) return;

    console.info(player.getUseItem());
    console.info(player.handSlots[0].get );
    
    if ( block.equals( 'phantasm:crystal_spike' ) || block.equals('phantasm:crystal_spike_tip') ) {
        event.block.popItem('phantasm:crystal_spike_tip');
    }
});

I'd like for the item to drop only if the block was broken with the correct tools, how would I do that?

It would also be nice if it didn't drop the item in creative but that doesn't really matter.

warm stratusBOT
#

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

cursive osprey
#

Also what would be a good way to make specific blocks have gravity on them like sand?

cursive osprey
#

How come this doesn't work?

flint pollen
#

i < 65

#

js is different compared to other languages

#

the for loop only stops if that is true

#

so just do i > 65

cursive osprey
#

Ah okay, thanks!