-
Notifications
You must be signed in to change notification settings - Fork 8
/
LootContext.ts
99 lines (93 loc) · 4.48 KB
/
LootContext.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
export const enum LootContext {
BlockEntity,
BlockState,
DamageSource,
DirectKillerEntity,
ExplosionRadius,
KillerEntity,
LastDamagePlayer,
Origin,
ThisEntity,
Tool
}
export type LootContextRegistration = { requires: LootContext[], allows: LootContext[] }
export const LootTableTypes = new Map<string, LootContextRegistration>([
['minecraft:advancement_entity', { requires: [LootContext.Origin, LootContext.ThisEntity], allows: [] }],
['minecraft:advancement_reward', { requires: [LootContext.Origin, LootContext.ThisEntity], allows: [] }],
['minecraft:barter', { requires: [LootContext.ThisEntity], allows: [] }],
['minecraft:block', { requires: [LootContext.BlockState, LootContext.Origin, LootContext.Tool], allows: [LootContext.BlockEntity, LootContext.ExplosionRadius, LootContext.ThisEntity] }],
['minecraft:chest', { requires: [LootContext.Origin], allows: [LootContext.ThisEntity] }],
['minecraft:command', { requires: [LootContext.Origin], allows: [LootContext.ThisEntity] }],
['minecraft:empty', { requires: [], allows: [] }],
['minecraft:entity', { requires: [LootContext.DamageSource, LootContext.Origin, LootContext.ThisEntity], allows: [LootContext.DirectKillerEntity, LootContext.KillerEntity, LootContext.LastDamagePlayer] }],
['minecraft:fishing', { requires: [LootContext.Origin, LootContext.Tool], allows: [LootContext.ThisEntity] }],
['minecraft:generic', { requires: [LootContext.DamageSource, LootContext.BlockEntity, LootContext.BlockState, LootContext.DirectKillerEntity, LootContext.ExplosionRadius, LootContext.KillerEntity, LootContext.LastDamagePlayer, LootContext.Origin, LootContext.ThisEntity, LootContext.Tool], allows: [] }],
['minecraft:gift', { requires: [LootContext.Origin, LootContext.ThisEntity], allows: [] }],
['minecraft:selector', { requires: [LootContext.Origin], allows: [LootContext.ThisEntity] }]
])
/**
* A map from loot entity sources to an array of their required context.
*/
export const LootEntitySources = new Map<string, LootContext[]>([
['direct_killer', [LootContext.DirectKillerEntity]],
['killer', [LootContext.KillerEntity]],
['killer_player', [LootContext.KillerEntity]],
['this', [LootContext.ThisEntity]]
])
/**
* A map from loot copy sources to an array of their required context.
*/
export const LootCopySources = new Map<string, LootContext[]>([
['block_entity', [LootContext.BlockEntity]],
['direct_killer', [LootContext.DirectKillerEntity]],
['killer', [LootContext.KillerEntity]],
['killer_player', [LootContext.KillerEntity]],
['this', [LootContext.ThisEntity]]
])
/**
* A map from loot condition IDs to an array of their required context.
*/
export const LootConditions = new Map<string, LootContext[]>([
['minecraft:alternative', []],
['minecraft:block_state_property', [LootContext.BlockState]],
['minecraft:damage_source_properties', [LootContext.DamageSource]],
['minecraft:entity_properties', [LootContext.Origin]],
['minecraft:entity_scores', []],
['minecraft:inverted', []],
['minecraft:killed_by_player', [LootContext.LastDamagePlayer]],
['minecraft:location_check', []],
['minecraft:match_tool', [LootContext.Tool]],
['minecraft:random_chance', []],
['minecraft:random_chance_with_looting', [LootContext.KillerEntity]],
['minecraft:reference', []],
['minecraft:survives_explosion', [LootContext.ExplosionRadius]],
['minecraft:table_bonus', [LootContext.Tool]],
['minecraft:time_check', []],
['minecraft:weather_check', []]
])
/**
* A map from loot function IDs to an array of their required context.
*/
export const LootFunctions = new Map<string, LootContext[]>([
['minecraft:apply_bonus', [LootContext.Tool]],
['minecraft:copy_name', []],
['minecraft:copy_nbt', []],
['minecraft:copy_state', [LootContext.BlockState]],
['minecraft:enchant_randomly', []],
['minecraft:enchant_with_levels', []],
['minecraft:exploration_map', [LootContext.Origin]],
['minecraft:explosion_decay', []],
['minecraft:fill_player_head', []],
['minecraft:furnace_smelt', []],
['minecraft:limit_count', []],
['minecraft:looting_enchant', [LootContext.KillerEntity]],
['minecraft:set_attributes', []],
['minecraft:set_contents', []],
['minecraft:set_count', []],
['minecraft:set_damage', []],
['minecraft:set_loot_table', []],
['minecraft:set_lore', []],
['minecraft:set_name', []],
['minecraft:set_nbt', []],
['minecraft:set_stew_effect', []]
])