#Can I replace vanilla block drops?
1 messages · Page 1 of 1 (latest)
Initialize a block break event, getEnties Around block. Use component "minecraft:item" to entities to get ItemStack. Check if item as same as typeId with block.
If u want relace item u shoud remove this item then Dimension.spawnItem() to spawn new item
Thank you!
const dim = block.dimension;
dim.getEntities({type: "minecraft:item", location: block.location,maxDistance: 2}).forEach((itemEntity) => {
const item = itemEntity.getComponent("minecraft:item").itemStack
// do something
})
To spawn to item
const newItem = new ItemStack(type, amount)
dim.spawnItem(newItem, block.location)