Repository navigation
Updater
Thallium's Updater is a powerful tool for updating the player's items.
It runs whenever the player relogs or runs /trigger tl.update, sorts through every slot in the player's inventory, allowing to check for item predicates (most of the time, a custom data id), replacing that slot with a given item.
It then takes the old components from that slot and re-adds them, the components chosen mostly being defined by a default list. (Dropdown)
minecraft:enchantments
minecraft:stored_enchantments
minecraft:damage
minecraft:repair_cost
minecraft:custom_name
minecraft:bundle_contents
minecraft:charged_projectiles
This can be modified with Arguments.
Updater functionality is controlled by a loot table, run by a function tag.
loot replace entity @s contents loot thallium:updater
This loot table should output depending on the item in the contents slot of the entity running it, taking the count from that entity's thallium.dummy score.
Expand
{
"pools": [
{
"entries": [
{
"type": "minecraft:loot_table",
"value": "thallium:items/trinket_pouch",
"modifier": [
{
"type": "minecraft:set_count",
"count": {
"type": "minecraft:score",
"target": "this",
"score": "thallium.dummy"
}
}
],
"condition": {
"type": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"slots": {
"contents": {
"predicates": {
"minecraft:custom_data": {
"thallium": {
"id": "trinket_pouch"
}
}
}
}
}
}
}
}
],
"rolls": 1.0
}
]
}
More entries can be added to support more items, and that is everything required for basic updater functionality.
More default preserved components can easily be added by hooking to a function tag.
function thallium:technical/updater/preserve_components {"value":"minecraft:custom_data.foo.bar"}
Preserved components can be more finely controlled per-item with arguments, added to the output item itself with custom data.
Expand
{
"pools": [
{
"entries": [
{
"type": "minecraft:loot_table",
"value": "thallium:items/thallium_ingot",
"modifier": [
{
"type": "minecraft:set_count",
"count": {
"type": "minecraft:score",
"target": "this",
"score": "thallium.dummy"
}
},
{
"type": "minecraft:set_custom_data",
"tag": {
"thallium": {
"updater_args": {
"preserve_components": [
{
"value": "minecraft:custom_data.thallium.foobar"
},
{
"value": "minecraft:custom_data.thallium.barbaz"
}
],
"discard_components": [
{
"value": "minecraft:enchantments"
}
]
}
}
}
}
],
"condition": {
"type": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"slots": {
"contents": {
"predicates": {
"minecraft:custom_data": {
"thallium": {
"id": "thallium_ingot"
}
}
}
}
}
}
}
}
],
"rolls": 1.0
}
]
}
Anything included in preserve_components will act exactly like it would as a universal preserved component, but it will only apply to that item.
Anything included in discard_components will be entirely discarded, even if it's included in the default list.
It's important that the format is used correctly, with the component being a string in the value field of its own object.