#drop raw beef nearby sheep then it turn into cooked beef

1 messages · Page 1 of 1 (latest)

sinful goblet
#

:

analog lake
#

code, where

sinful goblet
#

hmm i need help with example code

#

which cm?

sinful goblet
#

explain more pls

unreal torrent
#

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

grave stag
# sinful goblet :

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

sinful goblet
#

what's typeId of cooked beef?

#

check if raw beef on ground then replace with the cooked

unreal torrent
#
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();
});
grave stag
#

it's alot easier to do it with script and this is a script channel

unreal torrent
#

as I said before, this is #1067535382285135923 not #1067869288859447416, if he wanted it with commands he would’ve asked there.

grave stag
#

script easier

unreal torrent
#

it’s way easier with script api

unreal torrent
zenith juniperBOT
#
No Errors

No errors in [code](#1165159708651438080 message)