#Editing items from mobs that passively drop items to a different item using kubejs

8 messages · Page 1 of 1 (latest)

kindred ether
#

I want to change it so the bears from alex's mobs don't drop the fur item from alex's mobs, but sticks instead ( as a test )
How would I go about this using kubejs? The system works similarly to how a chicken lays eggs afaik.

prime kelpBOT
#

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

final umbraBOT
#

LootJS is an addon for KubeJS that allows modifying loot from all sources dynamically (much nicer than loot tables)!
It also supports removing loot added by mods, unlike KubeJS' current loot table events.

kindred ether
#

ive looked through lootjs, but im still unsure how to do it, since all of it seems to editing or adding onto drop-loot-tables, and not stuff like editing the item a chicken lays

sleek cipher
#

i can only think of 1 way of doing this - i have no clue if this will actually work with multiple grizzly bears in the world, like it will delete all bear furs that are near a grizzly bear, but when spawning the stick it might just choose a random bear then spawn the stick there rather than the one it deletes the fur from, although with kubejs im sure you can figure out a way to "store" the original bears position then tweak the commands below to match the stored entity.

execute at @e.... = executes the command at the given entities position
run kill @e.... = runs the command /kill killing the item bear fur within a distance of 2 blocks from the entities position
run summon minecraft:item = summons a item entity with the nbt given at the entities position

/execute at @e[type=alexsmobs:grizzly_bear] run kill @e[type=item,nbt={Item:{id:"alexsmobs:bear_fur"}},distance=..2]

/execute at @e[type=alexsmobs:grizzly_bear] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:stick"}}

kindred ether
#

that feels v hacky though yeah

kindred ether
#

Hi, If anyone else is wondering or looking for a similar issue, I did eventually get this working, here's how :
( used the code from here ) #1128707148210257940 message

EntityEvents.spawned('minecraft:item', event => {
    if (event.entity.item == 'alexsmobs:bear_fur') {
        event.entity.setItem('naturalist:bear_fur')
        console.log(event.entity)
    }
})```