#Trying to create a crop without creating a separate seed item, like vanilla carrots and potatoes

8 messages · Page 1 of 1 (latest)

glacial thistle
#

I'm getting started with kubejs today and have already made most of the new crops I want and everything is going well so far. I am running into an issue with the last one though - I want this sweet potato crop to function just like a vanilla potato, but kubejs keeps creating a seed item instead of using the sweet potato itself to plant the crop. How can I get this to work? Here are the relevant parts of my current script:

// Sweet potato item
        event.create("sweet_potato").food(food => {
    food
        .hunger(3)
        .saturation(0.5)
    })

//Sweet potato crop
        event.create("sweet_potato_crop", "crop")
    .age(7, builder => {
        builder
        .shape(0, 0, 0, 0, 16, 4, 16)
        .shape(1, 0, 0, 0, 16, 4, 16)
        .shape(2, 0, 0, 0, 16, 6, 16)
        .shape(3, 0, 0, 0, 16, 6, 16)
        .shape(4, 0, 0, 0, 16, 6, 16)
        .shape(5, 0, 0, 0, 16, 6, 16)
        .shape(6, 0, 0, 0, 16, 6, 16)
        .shape(7, 0, 0, 0, 16, 14, 16)
    })
    .survive((state, level, pos) => {
        const FARMLAND = Java.loadClass('net.minecraft.world.level.block.FarmBlock')
        let blockState = level.getBlockState(pos.below())
        let mcBlock = blockState.block
        if (mcBlock instanceof FARMLAND) {
        return true
        }
        else return false
    })
    .growTick((tickevent) => 5)
    .dropSeed(true)
    .crop("kubejs:sweet_potato", 3)
    .texture(0, "kubejs:block/soybeans_stage0")
    .texture(1, "kubejs:block/soybeans_stage0")
    .texture(2, "kubejs:block/soybeans_stage1")
    .texture(3, "kubejs:block/soybeans_stage1")
    .texture(4, "kubejs:block/soybeans_stage1")
    .texture(5, "kubejs:block/soybeans_stage1")
    .texture(6, "kubejs:block/soybeans_stage1")
    .texture(7, "kubejs:block/soybeans_stage3")
    .tagBlock('minecraft:mineable/pickaxe')
    .item((seedItem) => {
        seedItem.texture("kubejs:sweet_potato")
    })
solar steppeBOT
#

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

mental sentinelBOT
#

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)
})
mental sentinelBOT
tawdry fiber
#

Hey im trying to do smthn similar rn, did you ever figure this out?

keen notch
#

@tawdry fiber @glacial thistle did u?

#

figure this out