#How do i replace block when placed
14 messages · Page 1 of 1 (latest)
well if you want to affect a block when being right-clicked by an item, you could use this code:
ItemEvents.rightClicked('item_id', event => {
const { player, item, target: {block} } = event
...
})
as for things like smelting, not 100% sure, but it sounds possible
where should i put the block id?
you could just do something like if (block.id != 'your_custom_block_id') return
then put all of the block-affecting code after
what about the nbt inventory data and its state
what do you mean
you mean like the torch?
for flint and steel you can just damage it. there should be a damage method
as for the torch, you can decrease its total count by one
for example i want to replace the vanilla container with my custom container but also transfer the inventory that was inside the vanilla container to my custom container