Im trying to make an item that allows a person to change their team from A to B and from B to A. This however i cannot figure out how to do with the finishUsing function inside item registry setup. Anyone able to help me out as the wiki doesnt show any information regarding console functions, things you could do inside finishUsing function or anything related to teams.
Current code looks as following
StartupEvents.registry('item', event => {
event.create('orb_of_altering_reality')
.maxStackSize(1)
.glow(true)
.tooltip('$7The ability to swap teams lies within the orb')
.tooltip('$7can you really betray your fellow comrades though?')
.useAnimation('block')
.useDuration(itemstack => 60)
.use((level, player, hand) => true)
.finishUsing((itemstack, level, entity) => {
const effects = entity.potionEffects
effects.add('minecraft:haste', 120 * 20)
itemstack.shrink(1)
return itemstack
})
})