#Swap item drop with another item, WITHOUT use of loot tables

10 messages · Page 1 of 1 (latest)

bleak geyser
#

This is going to be a very specific problem.
There's a mod in my modpack that has an item i want to replace with another item. Some cases it has a loot table i can simply modify with a datapack, but there's a couple instances where the item drops and there's no relevant loot table for it happening.
My only guess is that it is, for some reason, hard-coded to drop X item from Y source.

With that being said, i know it's possible to kill any instance of a specific item entity, but is it possible to SWAP OUT item entities in a similar way?
To be more specific;
When item X is dropped, the item X entity is cleared, and replaced with a drop of item Z.

upper sparrowBOT
#

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

shy atlas
#

are you trying to make it so that players cannot get an item when picking it up?
cuz then you could use the inventory changed event and swap out the item there quite easily

bleak geyser
#

I'm trying to make it so that all instances of Item_X are replaced with Item_Y.
Item_X is dropped by certain mobs and blocks, but those mobs and blocks do not have loot tables when i looked inside the mod using 7zip. So i can't simply just edit the loot tables, since they don't exist.

shy atlas
#

so... is that a yes to my question? im confused

bleak geyser
#

I do not want the item to exist, let alone be picked up.
Instead, any time the item appears, i want it deleted, and replaced with a different, separate item.

shy atlas
#

ok so that was a very long and unnecessary way of saying yes

#

...

#
PlayerEvents.inventoryChanged('item id to replace', e => {
  e.item.id = 'new item id'
})
bleak geyser
#

Does this go in server_scripts?