#Placing Item as Block

19 messages · Page 1 of 1 (latest)

zealous elm
#

I know this question is probably asked a lot, but is it possible to have an item place a block when rightclicked? Like with the kelp item places a kelp block
It would also be great if it fired Forge's EntityPlaceEvent, that's the main reason i'm asking here and not using something like Lychee to do it instead. Thanks!

lapis sentinelBOT
#

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

zealous elm
#

I guess i just can't figure out BlockItem is all

wintry shale
#

StartupEvents.registry("block", ... automatically registers an item unless otherwise intentionally disabled via noItem() method

#

I'm pretty sure you can also modify the item by using the .item(item => {}) callback method on the block builder

zealous elm
#

True

#

I guess the main thing I want is for the item to render as an item and not as block in the inventory

#

The block is a cross so the model is still 2D in the inventory, but i'd like it to show a specific item texture

#

Like vanilla kelp does

#

if that makes any sense at all lmao

zealous elm
#

Well this didn't work, but i prolly did it wrong lolStartupEvents.registry('block', event => { event.create('sculk_kelp_plant_top') .displayName('Abyssal Kelp') .soundType('grass') .hardness(0.0) .resistance(0.0) .lightLevel(0.4) .renderType('cutout') .noCollision() .notSolid() .waterlogged() .model('kubejs:block/sculk_kelp_top') .tagBlock('forge:plant/water') .tagBlock('c:water_plant') .item(item => { item.texture('kubejs:item/sculk_kelp') }) })

wintry shale
#

I think you can do .model("namespace:item/model_name") on the item builder?

#

You just need to create a model for it

#

??utils

lost wharfBOT
# wintry shale ??utils

Misodes is an amazing collection of datapack (and resource pack!) json generators for everything from loot tables to models, dimensions, biomes and other worldgen things.

wintry shale
#

If your item is just a texture, make the model parent "item/generated"

zealous elm
#

ah i see.item(item => { item.modelJson({ "parent": "minecraft:item/generated", "textures": { "layer0": "kubejs:item/sculk_kelp" } }) })

#

This worked, thank you so much! Way easier