Closed fettered closed 2 years ago
Hello, thanks for the suggestion, can you provide an example of which plugin would need you to manually add a specific NBT tag to the ItemsAdder item? Recipes won't match anyway since I doubt that the other plugin will correctly detect the item anyway because it also contains other NBT data (the ItemsAdder internal data) not only the other plugin NBT, so the match will fail anyway
I will provide an example of the config of a plugin I'm using right now which handles this. I will also post an example command containing some NBT tag fluff which still functions in the scope of the plugin.
config: This config is referenced in listeners to figure out which MC items to apply plugin logic to. It looks for a master key, and assigns different behaviors to each item which are identified by their differing values (david vs hpaxe).
`debug-mode: true tag-key: "conditional-items"
conditional-items: item1: holding-item: material: "IRON_SWORD" tag-value: "david" conditions: UP_swords: 5 # Higher than 100 levels item2: holding-item: material: "DIAMOND_AXE" tag-value: "hpaxe" conditions: UP_axes: 5 # Higher than 5 lvls`
Command: This command creates an axe with a custom name, custom attribute affect, and then contains 2 custom NBT tags. conditional-items:hpaxe is what triggers plugin logic, while fluff:useless does nothing but get stored on the item
/give @p diamond_axe{display:{Name:'[{"text":"test"}]'},AttributeModifiers:[{AttributeName:"generic.max_health",Amount:10,Operation:0,UUID:[I;-121315,21216,13745,-42432],Name:"generic.max_health"}],conditional-items:"hpaxe",fluff:"useless"} 1
I don't know how itemsadder handles NBT stuff, but appending hooks to the end which are ignored by itemsadder shouldn't break anything.
Basically you want a special tag called NBT which allows you to paste all this NBT stuff {display:{Name:'[{"text":"test"}]'},AttributeModifiers:[{AttributeName:"generic.max_health",Amount:10,Operation:0,UUID:[I;-121315,21216,13745,-42432],Name:"generic.max_health"}],conditional-items:"hpaxe",fluff:"useless"}
and tell itemsadder to overwrite its own data adding the missing keys?
(or in this case only {conditional-items:"hpaxe",fluff:"useless"}
)
I don't see how this would overwrite items adder data, the point is that its encapsulated.
I don't see how this would overwrite items adder data, the point is that its encapsulated.
It's simple, you can give attribute max_health to any itemsAdder item. so only this part could be for some integrations: {conditional-items:"hpaxe",fluff:"useless"}
2.4.18 update will introduce this new feature.
https://itemsadder.devs.beer/plugin-usage/adding-content/advanced/custom-nbt
nbt: '{conditional-items:"hpaxe",fluff:"useless", test:{another:{asdasd:"aaaaa"}}}'
items:
example_item:
display_name: display-name-example_item
permission: example_item
nbt: '{conditional-items:"hpaxe",fluff:"useless", test:{another:{asdasd:"aaaaa"}}}'
resource:
material: DIAMOND_SWORD
generate: true
textures:
- item/example_item.png
durability:
max_custom_durability: 1324
Problem: The problem is that without custom NBT tags, it isn't very easy (or often possible) to create recipes that output items other plugins can differentiate. This severely limits the flexibility in an otherwise highly customizable plugin.
Solution: Add a field in item configs that allows custom tags to be created. Examples in the details section below.
Alternatives: Using namespaces in the other plugin's configs, but this generally doesn't work as many plugins simply don't support it.
Details: An example of the new config made by slightly modifying the preview config on the spigot main page: items: example_item: display_name: display-name-example_item permission: example_item resource: material: DIAMOND_SWORD generate: true textures:
Below is a give command I've been using for testing with other plugins. It is only temporary, as I will need a recipe to give to players.
/give @p iron_sword{tag-key:"value"} 1