#Right clicking block with bare hand drops item.

38 messages · Page 1 of 1 (latest)

mystic raven
#

Hey all!

I am trying have it so when I right click a block with an empty hand it drops an item

So by that I mean when you have an empty hand and right click let's say dirt for example and item will drop from the dirt into the world.

I have tried this myself and could not find anything in the Wiki but I am pretty bad a reading haha if there is a way to add a chance too? I tried to in the other screenshot but it stopped it dropping fully.

Any help would be massively appreciated.

pseudo cairnBOT
#

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

gilded cryptBOT
#

You can write your code in a codeblock by typing it between the codeblock delimiters:
Note that these are backticks, not apostrophes

```js :arrow_left:

ServerEvents.recipes(event => {
event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})

``` :arrow_left:

This example will look like this:

ServerEvents.recipes(event => {
  event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
royal mist
#

Also please use 'event' not 'Check'

#

At least don't use capitals

#

Also in the second screenshot, what is c?

mystic raven
#

c is a temp variable to store the random chance calculated just after it

royal mist
#

Ohh that syntax

#

Mb doing too much GDscript atm and got confused

#

Also

gilded cryptBOT
#

You can find your KubeJS server log in /minecraft/logs/kubejs/server.log.
If you are on 1.18 or 1.16 it will be called server.txt.
Please send it if asked, as it contains helpful information.

mystic raven
gilded cryptBOT
#

Paste version of server.log from @mystic raven

mystic raven
#

Have been doing some testing hence you may seem unusual stuff in there

royal mist
#

Send the log which relates to that code

mystic raven
#

OH haha my bad

#

wait no it should be there

royal mist
#

That has an add Drop error

#

And you never used add drop

mystic raven
#

Yeah I will revert and reload to get new logs

royal mist
#

Thanks

#

It's late for me so I might not respond today

#

If you haven't been helped already and I don't respond, I'll help tomorrow

mystic raven
gilded cryptBOT
#

Paste version of server.log from @mystic raven

royal mist
#

No errors hmm

#

Have you right clicked the block

#

Before sending the log

#

The event has to be triggered for it to throw an error

#

Might also want to add a say and a log function

#

For debugging

#

To make sure the event is triggering your code

mystic raven
#

Sorry I am not looking for an error, the give works, but it teleports to the inventory I want it to drop on the ground sorry if that was unclear

austere yarrow
#
event.block.popItemFromFace(Item.of('diamond'), 'up')
royal mist
mystic raven
#

Thank you all so much :) will be testing it today

#

Works perfectly appreciiate the help