#Is this possible?

1 messages · Page 1 of 1 (latest)

verbal notch
#

Hi all, in my modpack I am seeking to have a "fossilized acorn" of sorts that when placed on dirt will place as a random sapling is this possible?
If so anyone know examples of how I would go about doing it? I'd also like to do the same with farmland and it placing crops

proper pelicanBOT
#

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

verbal notch
#

Please chuck me a ping if youre able to help

tropic vale
#

I would do it with BlockEvents.rightClicked('minecraft:dirt', event => {})

#
if(event.item.id === 'kubejs:fossilized_acorn' && event.block.up.id === 'minecraft:air') {
  let arr = ['minecraft:oak_sapling', '...']
  event.block.up.set(arr[Math.random() * arr.length])
}```
#

Something like that

#

@verbal notch

#

(in server events)

verbal notch
#

Will that do it on any block or only ones saplings can be planted on?

pearl umbra
#

Only "minecraft:dirt"

tropic vale
#

See event call, thats where you specify what block it goes on

#

If you need multiple you can do ...rightClicked(['minecraft:dirt', 'minecraft:grass_block'], event => ... etc

pearl umbra
#

And don`t forget to remove "acorn item" from hand.

verbal notch
hidden coyote
#

event.item.count-- (or event.item.shrink() is a thing aswell?)

tropic vale
#

Oh right, yes, that

hidden coyote
#
BlockEvents.rightClicked(['minecraft:dirt', 'minecraft:grass_block', '...'], event => { 
    const {item, block} = event
    if(item.id === 'kubejs:fossilized_acorn' && block.up.id === 'minecraft:air') {
        let arr = ['minecraft:oak_sapling', '...']
        block.up.set(arr[Math.random() * arr.length])
        item.count--
      }
})```

like so then (just putting everything together whats being tossed in here)
tropic vale
#

I wouldnt leave the ... In lel

hidden coyote