|
| 1 | +use ::java::data::loot::LootPool |
| 2 | +use ::java::data::loot::LootPoolEntry |
| 3 | +use ::java::data::loot::LootContextType |
| 4 | +use ::java::data::loot::LootCondition |
| 5 | + |
| 6 | +dispatch minecraft:resource[loot-table-modifier:loot_modifier] to struct { |
| 7 | + actions: [Action], |
| 8 | + predicate: Predicate, |
| 9 | +} |
| 10 | + |
| 11 | +struct Action { |
| 12 | + type: #[id] ActionType, |
| 13 | + ...loot-table-modifier:loot_modifier_action_types[[type]], |
| 14 | +} |
| 15 | + |
| 16 | +struct Predicate { |
| 17 | + type: #[id] PredicateType, |
| 18 | + ...loot-table-modifier:loot_modifier_predicate_types[[type]], |
| 19 | +} |
| 20 | + |
| 21 | +enum(string) ActionType { |
| 22 | + PoolAdd = "loot-table-modifier:pool_add", |
| 23 | + PoolRemove = "loot-table-modifier:pool_remove", |
| 24 | + |
| 25 | + |
| 26 | + EntryAdd = "loot-table-modifier:entry_add", |
| 27 | + EntryRemove = "loot-table-modifier:entry_remove", |
| 28 | + |
| 29 | + EntryItemSet = "loot-table-modifier:entry_item_set", |
| 30 | + |
| 31 | + |
| 32 | + ConditionAdd = "loot-table-modifier:condition_add" |
| 33 | +} |
| 34 | + |
| 35 | +enum(string) PredicateType { |
| 36 | + Inverted = "loot-table-modifier:inverted", |
| 37 | + AnyOf = "loot-table-modifier:any_of", |
| 38 | + AllOf = "loot-table-modifier:all_of", |
| 39 | + |
| 40 | + |
| 41 | + EntryItem = "loot-table-modifier:entry_item", |
| 42 | + |
| 43 | + |
| 44 | + Table = "loot-table-modifier:table", |
| 45 | +} |
| 46 | + |
| 47 | + |
| 48 | +/// Utils |
| 49 | +struct Pattern { |
| 50 | + regexPattern: #[regex_pattern] string, |
| 51 | +} |
| 52 | + |
| 53 | +type LiteralOrPattern<T> = ( |
| 54 | + #[misode_member_name="Literal"] T | |
| 55 | + #[misode_member_name="Regex pattern"] Pattern | |
| 56 | +) |
| 57 | + |
| 58 | + |
| 59 | +/// Actions |
| 60 | + |
| 61 | +dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:pool_add] to struct { |
| 62 | + pools: [LootPool], |
| 63 | +} |
| 64 | +dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:pool_remove] to struct { |
| 65 | + |
| 66 | +} |
| 67 | + |
| 68 | + |
| 69 | +dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:entry_add] to struct { |
| 70 | + entries: [LootPoolEntry], |
| 71 | +} |
| 72 | +dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:entry_remove] to struct { |
| 73 | + |
| 74 | +} |
| 75 | + |
| 76 | +dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:entry_item_set] to struct { |
| 77 | + name: #[id="item"] string, |
| 78 | + canReplaceEntry?: boolean, |
| 79 | +} |
| 80 | + |
| 81 | + |
| 82 | +dispatch loot-table-modifier:loot_modifier_action_types[loot-table-modifier:condition_add] to struct { |
| 83 | + conditions: [LootCondition], |
| 84 | + includePools?: boolean, |
| 85 | + includeEntries?: boolean, |
| 86 | +} |
| 87 | + |
| 88 | + |
| 89 | +/// Predicates |
| 90 | + |
| 91 | +/// # op |
| 92 | +dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:inverted] to struct { |
| 93 | + term: Predicate, |
| 94 | +} |
| 95 | + |
| 96 | +dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:any_of] to struct { |
| 97 | + terms: [Predicate], |
| 98 | +} |
| 99 | + |
| 100 | +dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:all_of] to struct { |
| 101 | + terms: [Predicate], |
| 102 | +} |
| 103 | + |
| 104 | +/// # entry |
| 105 | +dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:entry_item] to struct { |
| 106 | + name: LiteralOrPattern<#[id="item"] string>, |
| 107 | +} |
| 108 | + |
| 109 | +/// # table |
| 110 | +dispatch loot-table-modifier:loot_modifier_predicate_types[loot-table-modifier:table] to struct { |
| 111 | + identifiers?: [LiteralOrPattern<#[id="loot_table"] string>], |
| 112 | + types?: [LiteralOrPattern<LootContextType>], |
| 113 | +} |
0 commit comments