From eee26ef56cf776e1c0eec3342e761ec6f0603b81 Mon Sep 17 00:00:00 2001 From: OffsetMonkey538 <71213040+OffsetMonkey538@users.noreply.github.com> Date: Mon, 16 Jun 2025 16:09:05 +0300 Subject: [PATCH 1/6] Loot Table Modifier loot_modifier generator Should support everything currently implemented --- public/mcdoc/loot-table-modifier.mcdoc | 101 +++++++++++++++++++++++++ src/config.json | 7 ++ 2 files changed, 108 insertions(+) create mode 100644 public/mcdoc/loot-table-modifier.mcdoc diff --git a/public/mcdoc/loot-table-modifier.mcdoc b/public/mcdoc/loot-table-modifier.mcdoc new file mode 100644 index 00000000..51181cdd --- /dev/null +++ b/public/mcdoc/loot-table-modifier.mcdoc @@ -0,0 +1,101 @@ +use ::java::data::loot::LootPool +use ::java::data::loot::LootContextType + +dispatch minecraft:resource[loot-table-modifier:loot_modifier] to struct { + actions: ( + Action | + [Action] + ), + predicates: ( + Predicate | + [Predicate] + ), +} + +struct Action { + type: #[id] ActionType, + ...loot-table-modifier:loot_modifier_action_types[[type]], +} + +struct Predicate { + type: #[id] PredicateType, + ...loot-table-modifier:loot_modifier_predicate_types[[type]], +} + +enum(string) ActionType { + AddPool = "loot-table-modifier:add_pool", + RemovePool = "loot-table-modifier:remove_pool", + + SetItem = "loot-table-modifier:set_item", +} + +enum(string) PredicateType { + Inverted = "loot-table-modifier:inverted", + AnyOf = "loot-table-modifier:any_of", + AllOf = "loot-table-modifier:all_of", + + ItemEntry = "loot-table-modifier:item_entry", + LootTable = "loot-table-modifier:loot_table", +} + + +/// Utils +struct Pattern { + regexPattern: #[regex_pattern] string +} + + +/// Actions + +dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:add_pool] to struct { + pools: [LootPool], +} + +dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:remove_pool] to struct { + +} + + +dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:set_item] to struct { + name: #[id="item"] string, + canReplaceEntry?: boolean, +} + + +/// Predicates + +/// # op +dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:inverted] to struct { + term: Predicate, +} + +dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:any_of] to struct { + terms: ( + Predicate | + [Predicate] + ) +} + +dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:all_of] to struct { + terms: ( + Predicate | + [Predicate] + ) +} + +/// # entry +dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:item_entry] to struct { + name: (#[id="item"] string | Pattern), +} + +/// # table +dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:loot_table] to struct { + identifiers?: ( + (#[id="loot_table"] string | Pattern) | + [(#[id="loot_table"] string | Pattern)] + ), + types?: ( + (LootContextType | Pattern) | + [(LootContextType | Pattern)] + ), +} diff --git a/src/config.json b/src/config.json index 576575de..3758e7b5 100644 --- a/src/config.json +++ b/src/config.json @@ -808,6 +808,13 @@ "path": "create", "tags": ["partners"], "dependency": "create" + }, + { + "id": "loot-table-modifier:loot_modifier", + "url": "loot-table-modifier/loot_modifier", + "path": "loot-table-modifier", + "tags": ["partners"], + "dependency": "loot-table-modifier" } ], "legacyGuides": [ From 7c8bef146d1ed2fbc4806864b16df7a88bde3e40 Mon Sep 17 00:00:00 2001 From: OffsetMonkey538 <71213040+OffsetMonkey538@users.noreply.github.com> Date: Mon, 16 Jun 2025 17:41:56 +0300 Subject: [PATCH 2/6] Translation keys --- src/locales/en.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/locales/en.json b/src/locales/en.json index b528dd65..9597bfab 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -89,6 +89,7 @@ "generator.jukebox_song": "Jukebox Song", "generator.lang": "Language", "generator.loot_table": "Loot Table", + "generator.loot-table-modifier:loot_modifier": "Loot Modifier", "generator.model": "Model", "generator.texture_meta": "Texture Metadata", "generator.neoforge:biome_modifier": "Biome Modifier", @@ -198,6 +199,7 @@ "partner.fabric": "Fabric", "partner.immersive_weathering": "Immersive Weathering", "partner.lithostitched": "Lithostitched", + "partner.loot-table-modifier": "Loot Table Modifier", "partner.neoforge": "NeoForge", "partner.obsidian": "Obsidian", "partner.ohthetreesyoullgrow": "Oh The Trees You'll Grow", From bb683ee380f52704e02ab579d97cf0a3126b088d Mon Sep 17 00:00:00 2001 From: OffsetMonkey538 <71213040+OffsetMonkey538@users.noreply.github.com> Date: Tue, 17 Jun 2025 11:56:52 +0300 Subject: [PATCH 3/6] Make 'actions' and 'predicates' always a list Seems simpler to understand and a list of one entry behaves exactly the same --- public/mcdoc/loot-table-modifier.mcdoc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/public/mcdoc/loot-table-modifier.mcdoc b/public/mcdoc/loot-table-modifier.mcdoc index 51181cdd..12ed2d0f 100644 --- a/public/mcdoc/loot-table-modifier.mcdoc +++ b/public/mcdoc/loot-table-modifier.mcdoc @@ -2,14 +2,8 @@ use ::java::data::loot::LootPool use ::java::data::loot::LootContextType dispatch minecraft:resource[loot-table-modifier:loot_modifier] to struct { - actions: ( - Action | - [Action] - ), - predicates: ( - Predicate | - [Predicate] - ), + actions: [Action], + predicates: [Predicate], } struct Action { From 4b08fe5c80b25953d3cf5355cb4db28743af2955 Mon Sep 17 00:00:00 2001 From: OffsetMonkey538 <71213040+OffsetMonkey538@users.noreply.github.com> Date: Fri, 4 Jul 2025 21:26:48 +0300 Subject: [PATCH 4/6] Update loot-table-modifier.mcdoc Should match currently latest commit --- public/mcdoc/loot-table-modifier.mcdoc | 30 ++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/public/mcdoc/loot-table-modifier.mcdoc b/public/mcdoc/loot-table-modifier.mcdoc index 12ed2d0f..2f3a085a 100644 --- a/public/mcdoc/loot-table-modifier.mcdoc +++ b/public/mcdoc/loot-table-modifier.mcdoc @@ -17,10 +17,13 @@ struct Predicate { } enum(string) ActionType { - AddPool = "loot-table-modifier:add_pool", - RemovePool = "loot-table-modifier:remove_pool", + PoolAdd = "loot-table-modifier:pool_add", + PoolRemove = "loot-table-modifier:pool_remove", - SetItem = "loot-table-modifier:set_item", + + EntryAdd = "loot-table-modifier:entry_add", + + EntryItemSet = "loot-table-modifier:entry_item_set", } enum(string) PredicateType { @@ -28,8 +31,8 @@ enum(string) PredicateType { AnyOf = "loot-table-modifier:any_of", AllOf = "loot-table-modifier:all_of", - ItemEntry = "loot-table-modifier:item_entry", - LootTable = "loot-table-modifier:loot_table", + EntryItem = "loot-table-modifier:entry_item", + Table = "loot-table-modifier:table", } @@ -41,16 +44,21 @@ struct Pattern { /// Actions -dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:add_pool] to struct { +dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:pool_add] to struct { pools: [LootPool], } -dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:remove_pool] to struct { - +dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:pool_remove] to struct { + entries: [LootPoolEntry] } -dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:set_item] to struct { +dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:entry_add] to struct { + name: #[id="item"] string, + canReplaceEntry?: boolean, +} + +dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:entry_item_set] to struct { name: #[id="item"] string, canReplaceEntry?: boolean, } @@ -78,12 +86,12 @@ dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:a } /// # entry -dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:item_entry] to struct { +dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:entry_item] to struct { name: (#[id="item"] string | Pattern), } /// # table -dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:loot_table] to struct { +dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:table] to struct { identifiers?: ( (#[id="loot_table"] string | Pattern) | [(#[id="loot_table"] string | Pattern)] From 26b99b21be5e6b7d98580295668d16fedd0b303f Mon Sep 17 00:00:00 2001 From: OffsetMonkey538 <71213040+OffsetMonkey538@users.noreply.github.com> Date: Mon, 7 Jul 2025 11:16:34 +0300 Subject: [PATCH 5/6] Fix loot modifier path in datapack being incorrect --- src/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.json b/src/config.json index 3758e7b5..37fd7daf 100644 --- a/src/config.json +++ b/src/config.json @@ -812,7 +812,7 @@ { "id": "loot-table-modifier:loot_modifier", "url": "loot-table-modifier/loot_modifier", - "path": "loot-table-modifier", + "path": "loot-table-modifier/loot_modifier", "tags": ["partners"], "dependency": "loot-table-modifier" } From 2171cdba59de63c41921c9677fac9725fb03c961 Mon Sep 17 00:00:00 2001 From: OffsetMonkey538 <71213040+OffsetMonkey538@users.noreply.github.com> Date: Mon, 7 Jul 2025 15:26:50 +0300 Subject: [PATCH 6/6] Match v2 alpha 1 --- public/mcdoc/loot-table-modifier.mcdoc | 37 +++++++++++--------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/public/mcdoc/loot-table-modifier.mcdoc b/public/mcdoc/loot-table-modifier.mcdoc index 2f3a085a..a56dc5ef 100644 --- a/public/mcdoc/loot-table-modifier.mcdoc +++ b/public/mcdoc/loot-table-modifier.mcdoc @@ -3,7 +3,7 @@ use ::java::data::loot::LootContextType dispatch minecraft:resource[loot-table-modifier:loot_modifier] to struct { actions: [Action], - predicates: [Predicate], + predicate: Predicate, } struct Action { @@ -22,6 +22,7 @@ enum(string) ActionType { EntryAdd = "loot-table-modifier:entry_add", + EntryRemove = "loot-table-modifier:entry_remove", EntryItemSet = "loot-table-modifier:entry_item_set", } @@ -31,14 +32,17 @@ enum(string) PredicateType { AnyOf = "loot-table-modifier:any_of", AllOf = "loot-table-modifier:all_of", + EntryItem = "loot-table-modifier:entry_item", + + Table = "loot-table-modifier:table", } /// Utils struct Pattern { - regexPattern: #[regex_pattern] string + regexPattern: #[regex_pattern] string, } @@ -47,15 +51,16 @@ struct Pattern { dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:pool_add] to struct { pools: [LootPool], } - dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:pool_remove] to struct { - entries: [LootPoolEntry] + } dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:entry_add] to struct { - name: #[id="item"] string, - canReplaceEntry?: boolean, + entries: [LootPoolEntry], +} +dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:entry_remove] to struct { + } dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:entry_item_set] to struct { @@ -72,17 +77,11 @@ dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:i } dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:any_of] to struct { - terms: ( - Predicate | - [Predicate] - ) + terms: [Predicate], } dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:all_of] to struct { - terms: ( - Predicate | - [Predicate] - ) + terms: [Predicate], } /// # entry @@ -92,12 +91,6 @@ dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:e /// # table dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:table] to struct { - identifiers?: ( - (#[id="loot_table"] string | Pattern) | - [(#[id="loot_table"] string | Pattern)] - ), - types?: ( - (LootContextType | Pattern) | - [(LootContextType | Pattern)] - ), + identifiers?: [(#[id="loot_table"] string | Pattern)], + types?: [(LootContextType | Pattern)], }