#Custom crop registry and configure in LootJS

5 messages · Page 1 of 1 (latest)

rain flower
#

How do I add the seed as a real item instead of a virtual one so that it can be handled in LootJS? I need this to adjust the drop rate
My code:

StartupEvents.registry('block', event => {
    event.create('my_crop', 'crop')
        .displayName('My Crop')
        .crop('kubejs:my_crop_seed')
        .age(3, builder => {
            builder
                .shape(0, 0, 0, 0, 16, 2, 16)
                .shape(1, 0, 0, 0, 16, 4, 16)
                .shape(2, 0, 0, 0, 16, 6, 16)
                .shape(3, 0, 0, 0, 16, 8, 16)
        })

        .item(seedItem => {
            seedItem.texture('kubejs:item/my_crop_seed').displayName('§6My crop Seed')
        })
})

if I try to add a seed as a drop using LootJS like here, I get this error

LootJS.modifiers(event => {
    event.addBlockModifier('kubejs:my_crop')
    .randomChance(1)
    .addLoot("kubejs:grown_plant")

    event.addBlockModifier('kubejs:my_crop')
    .randomChance(0.1)
    .addLoot("kubejs:my_crop_seed")
})
[02:08:25] [ERROR] ! server_scripts:crop.js#9: [LootEntry.of()] Invalid item stack, returning empty stack: kubejs:my_crop_seed
[02:08:25] [ERROR] ! server_scripts:crop.js#9: - Consider using `LootEntry.empty()` if you want to create an empty loot entry.

I would also like to check that the age of the plant already has a certain value and only then drop the desired item, I did not find a competent solution on this matter

pallid craterBOT
#

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

celest ermine
#

The seed Item probably also has the id kubejs:my_crop, so you can try to add that as a drop

gritty kayak
#

@rain flower you ever figure this out? rn im trying to make it only drop the crop items if its age = 3 but i cant figure out how

rain flower
#

up