Bug Closed · Resolved

NBT elements are not merged correctly

#10042 opened by gthoro 6 days ago

gthororeported this bug

According to wiki elements from templates should merge together except the ones with value, but this is not the case with NBT tags. This example:

TemplateA:
  Hidden: true
  NBT:
    PublicBukkitValues:
      auraskills:item_multipliers:
        auraskills:auraskills/foraging: double/50.0

TemplateB:
  Hidden: true
  NBT:
    PublicBukkitValues:
      auraskills:item_multipliers:
        auraskills:auraskills/farming: double/50.0

Item1:
  Id: PAPER
  Template: TemplateA,TemplateB
  Display: Item 1

Item2:
  Id: PAPER
  Template: TemplateB,TemplateA
  Display: Item 2

Produces following result:

minecraft:paper[custom_name={color: "white", italic: 0b, text: "Item 1"},custom_data={PublicBukkitValues: {"auraskills:item_multipliers": {"auraskills:auraskills/farming": 50.0d}, "mythicmobs:type": "Item1"}}]

minecraft:paper[custom_name={color: "white", italic: 0b, text: "Item 2"},custom_data={PublicBukkitValues: {"auraskills:item_multipliers": {"auraskills:auraskills/foraging": 50.0d}, "mythicmobs:type": "Item2"}}]

Rightmost template overwrites all NBT tags set by other templates. Templates are powerful feature that can allow items to be build by composing them "by feature" - I have created many templates for various things (not being able to repair or scrap item in our custom systems, AuraSkills modifiers/stats or BetonQuest tag for quest item, all of them requires specific tag in NBT/PublicBukkitValues). This allows to compose item by using minimal amount of code:

Chapter2Reward_EtherealReaverSword:
  Id: golden_sword
  Template: T4_Sword,Unrepairable,Unscrappable,Fighting50
  Display: <dark_purple>Rozdzieracz Dusz
  Model: 8761000
  Lore:
    Description: Klinga zrodzona z cierpienia tysiąca rozdartych dusz. Każda z nich pragnie zemsty.
  Stats:
    - ATTACK_DAMAGE 15 ADDITIVE
    - LIFESTEAL_CHANCE 0.2 ADDITIVE
    - LIFESTEAL_POWER 0.1 ADDITIVE

This gives such item a baseline of our tier 4 sword (durability, rarity, tooltip style, lore template, augments), marks item as unrepairable and unscrappable (which also adds entry to item lore) and adds 50% fighting skill multiplier (which also adds this stat to lore). It works fine except that unrepairable and unscrappable tags are not present on the item, only fighting multiplier is.

Sign in to join the discussion.