Skip to content

Loot Table Modifier generator #758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions public/mcdoc/loot-table-modifier.mcdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
use ::java::data::loot::LootPool
use ::java::data::loot::LootContextType

dispatch minecraft:resource[loot-table-modifier:loot_modifier] to struct {
actions: [Action],
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 {
PoolAdd = "loot-table-modifier:pool_add",
PoolRemove = "loot-table-modifier:pool_remove",


EntryAdd = "loot-table-modifier:entry_add",
EntryRemove = "loot-table-modifier:entry_remove",

EntryItemSet = "loot-table-modifier:entry_item_set",
}

enum(string) PredicateType {
Inverted = "loot-table-modifier:inverted",
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,
}


/// Actions

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 {

}


dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:entry_add] to struct {
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 {
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],
}

dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:all_of] to struct {
terms: [Predicate],
}

/// # entry
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:table] to struct {
identifiers?: [(#[id="loot_table"] string | Pattern)],
types?: [(LootContextType | Pattern)],
}
7 changes: 7 additions & 0 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/loot_modifier",
"tags": ["partners"],
"dependency": "loot-table-modifier"
}
],
"legacyGuides": [
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down