#item replacer

15 messages · Page 1 of 1 (latest)

proud pelican
#

how to replace items in inventory with others

mint brambleBOT
#

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

supple nest
#

event.player.inventory.setStackInSlot(<slot number>, <Itemstack>) if you want to overwrite the item in a slot

proud pelican
#

how do i start it?

#

PlayerEvents

#

EntityEvents?

#

PickupEvent???

supple nest
#

depends on what you want to achieve

proud pelican
#

i want an item to be replaced whenever its in his iventory

#

mabye when inventory changes

#

so it even works when u run /give command

supple nest
#

then you should listen to the the inventory changed event and then do:

if(event.item.id == "minecraft:stone"){
  event.entity.inventory.setStackInSlot(event.slot, Item.of(""))
}

idk if this is the best way but should work

proud pelican
#

like this PlayerEvents.inventoryChanged
if(event.item.id == "minecraft:stone"){
event.entity.inventory.setStackInSlot(event.slot, Item.of(""))
}

#
  PlayerEvents.inventoryChanged
  if(event.item.id == "minecraft:stone"){
    event.entity.inventory.setStackInSlot(event.slot, Item.of(""))
  }
#

doesnt work