Skip to content

Modify Item NBT Tag

Potato Destroyer edited this page Mar 24, 2018 · 3 revisions

Modify Item NBT Tag

ItemStack(Material.PAPER).modifyNBT {
	addTag {
		type = NBTType.AttackDamage
		amount = 233.0
	}
	removeTagByType(NBTType.MovementSpeed)
	removeTagByIndex(0)
	clearAllTags()
}.operateMeta {
	displayName = "Banana"
}

modify NBT

modifyNBT function provides dsl to modify NBT Tag.

add tag

addTag{} has these properties.

type can be assigned these values:

  • AttackDamage
  • AttackSpeed
  • MaxHealth
  • MovementSpeed
  • Armor
  • Luck

slot can be assigned these values:

  • MainHand
  • OffHand
  • Feet
  • Legs
  • Chest
  • Head

This dsl also has operation , uuidLesat , uuidMost option properties.
operation assigns Multiplicative represents amount is a % value.

remove tag by index

remove nbt tag by index.

clear all tags

clear all nbt tags.

remove tag by type

remove all tags belong to this type.

operate Meta

This function provides a scope to access class ItemMeta. Meanwhile, we also have operateBookMeta and operateBannerMeta to operate item meta.

Clone this wiki locally