#drop raw beef nearby sheep then it turn into cooked beef
1 messages · Page 1 of 1 (latest)
code, where
explain more pls
or since this is a scripting channel, use the .getEntities() method to get the items and then get the EntityItemComponent to figure the item type id and then remove it and spawn a new one instead
you can do entitySpawn check if it's a item, then get the entities near it and see if it's a sheep then spawn a new beef item at the raw beef location then kill the raw beef item
what's typeId of cooked beef?
check if raw beef on ground then replace with the cooked
world.afterEvents.entitySpawn.subscribe(({ entity }) => {
const itemStack = entity.getComponent("minecraft:item")?.itemStack;
if (
entity.typeId != "minecraft:item"
|| itemStack?.typeId != "minecraft:raw_beef"
) return;
const item = new ItemStack("minecraft:cooked_beef", itemStack.amount);
const eItem = entity.dimension.spawnItem(itemStack, entity.location);
eItem.applyImpulse(entity.getVelocity());
entity.remove();
});
it's alot easier to do it with script and this is a script channel
as I said before, this is #1067535382285135923 not #1067869288859447416, if he wanted it with commands he would’ve asked there.
script easier
it’s way easier with script api
i wrote this code in mobile and fixed some issues before you finished your command
No errors in [code](#1165159708651438080 message)