Skip to content

Commit 7140024

Browse files
Thermoo Environment Registries Generators (#754)
* setup thermoo generator * constant provider * seasons provider types * light threshold * weather providers * leaf providers * precipitation enum and validate relative humidity * fix for dropdown of env component types * fix temperature unit enum * fix seasonal provider * environment definition mcdoc * temperature effect set up * add other temperature effect types * add custom loot conditions * add a doc comment to priority * add temperature effect 1.20 format
1 parent 6cae533 commit 7140024

File tree

3 files changed

+276
-0
lines changed

3 files changed

+276
-0
lines changed

public/mcdoc/thermoo.mcdoc

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
use ::java::data::worldgen::biome::Precipitation
2+
use ::java::util::attribute::AttributeOperation
3+
use ::java::data::util::MinMaxBounds
4+
5+
dispatch minecraft:resource[thermoo:environment_provider] to struct EnvironmentProvider {
6+
type: #[id] EnvironmentProviderType,
7+
...thermoo:environment_provider_type[[type]],
8+
}
9+
10+
type BiomeHolderList = (#[id(registry="worldgen/biome",tags="allowed")] string | [#[id="worldgen/biome"] string])
11+
12+
dispatch minecraft:resource[thermoo:environment] to struct Environment {
13+
biomes: BiomeHolderList,
14+
exclude_biomes?: BiomeHolderList,
15+
provider: EnvironmentProviderOrReference,
16+
/// Defaults to `1000`. Higher priority environments will be applied first, lower priority environments are applied last.
17+
priority?: int
18+
}
19+
20+
dispatch minecraft:resource[thermoo:temperature_effect] to struct TemperatureEffect {
21+
type: #[id] TemperatureEffectType,
22+
config: struct {
23+
...thermoo:temperature_effect_type[[%parent.type]]
24+
}
25+
}
26+
27+
dispatch minecraft:resource[thermoo:predicate] to struct ThermooPredicate {
28+
condition: #[id] ThermooLootConditionType,
29+
...thermoo:loot_condition_type[[condition]]
30+
}
31+
32+
type EnvironmentProviderOrReference = (
33+
#[id="thermoo:environment_provider"] string |
34+
EnvironmentProvider
35+
)
36+
37+
enum(string) EnvironmentProviderType {
38+
Constant = "thermoo:constant",
39+
TemperateSeasonal = "thermoo:seasonal/temperate",
40+
TropicalSeasonal = "thermoo:seasonal/tropical",
41+
LightThreshold = "thermoo:light_threshold",
42+
WeatherState = "thermoo:weather_state",
43+
PrecipitationType = "thermoo:precipitation_type",
44+
TemperatureShift = "thermoo:temperature_shift",
45+
Modify = "thermoo:modify",
46+
}
47+
48+
enum(string) TemperatureEffectType {
49+
Empty = "thermoo:empty",
50+
StatusEffect = "thermoo:status_effect",
51+
AttributeModifier = "thermoo:attribute_modifier",
52+
ScalingAttributeModifier = "thermoo:scaling_attribute_modifier",
53+
Damage = "thermoo:damage",
54+
Function = "thermoo:function",
55+
Sequence = "thermoo:sequence",
56+
FreezeDamageLegacy = "thermoo:freeze_damage_legacy",
57+
}
58+
59+
enum(string) ThermooLootConditionType {
60+
Temperature = "thermoo:temperature",
61+
Soaked = "thermoo:soaked",
62+
}
63+
64+
enum(string) EnvironmentComponentType {
65+
Temperature = "thermoo:temperature",
66+
RelativeHumidity = "thermoo:relative_humidity",
67+
}
68+
69+
struct EnvironmentComponentMap {
70+
[EnvironmentComponentType]: thermoo:environment_component[[%key]],
71+
}
72+
73+
enum(string) TemperatureUnit {
74+
Celsius = "celsius",
75+
Kelvin = "kelvin",
76+
Fahrenheit = "fahrenheit",
77+
Rankine = "rankine",
78+
}
79+
80+
type TemperatureRecord = (
81+
double |
82+
struct {
83+
value: double,
84+
unit: TemperatureUnit,
85+
}
86+
)
87+
88+
dispatch thermoo:environment_component[thermoo:temperature] to TemperatureRecord
89+
90+
dispatch thermoo:environment_component[thermoo:relative_humidity] to double @ 0..1
91+
92+
dispatch thermoo:environment_provider_type[thermoo:constant] to struct {
93+
components: EnvironmentComponentMap,
94+
}
95+
96+
enum(string) TemperateSeason {
97+
Spring = "spring",
98+
Summer = "summer",
99+
Autumn = "autumn",
100+
Winter = "winter",
101+
}
102+
103+
enum(string) TropicalSeason {
104+
Wet = "wet",
105+
Dry = "dry",
106+
}
107+
108+
dispatch thermoo:environment_provider_type[thermoo:seasonal/temperate] to struct {
109+
/// Must contain at least one entry.
110+
seasons: struct {
111+
[TemperateSeason]: EnvironmentProviderOrReference
112+
},
113+
/// If specified, the `fallback_season` must be a member of the `seasons` field.
114+
fallback_season?: TemperateSeason,
115+
}
116+
117+
dispatch thermoo:environment_provider_type[thermoo:seasonal/tropical] to struct {
118+
/// Must contain at least one entry.
119+
seasons: struct {
120+
[TropicalSeason]: EnvironmentProviderOrReference
121+
},
122+
/// If specified, the `fallback_season` must be a member of the `seasons` field.
123+
fallback_season?: TropicalSeason,
124+
}
125+
126+
dispatch thermoo:environment_provider_type[thermoo:light_threshold] to struct {
127+
light_type?: ("block" | "sky"),
128+
/// Only applies if `light_type` is `sky`.
129+
apply_ambient_darkness?: boolean,
130+
threshold: int @ 0..15,
131+
above: EnvironmentProviderOrReference,
132+
below: EnvironmentProviderOrReference,
133+
}
134+
135+
dispatch thermoo:environment_provider_type[thermoo:weather_state] to struct {
136+
clear?: EnvironmentProviderOrReference,
137+
rain?: EnvironmentProviderOrReference,
138+
thunder?: EnvironmentProviderOrReference,
139+
}
140+
141+
dispatch thermoo:environment_provider_type[thermoo:precipitation_type] to struct {
142+
precipitation_type: struct {
143+
[Precipitation]?: EnvironmentProviderOrReference,
144+
}
145+
}
146+
147+
dispatch thermoo:environment_provider_type[thermoo:temperature_shift] to struct {
148+
shift: TemperatureRecord
149+
}
150+
151+
dispatch thermoo:environment_provider_type[thermoo:modify] to struct {
152+
modifiers: (
153+
[#[id(registry="thermoo:environment_provider")] string] @ 1.. |
154+
#[id(registry="thermoo:environment_provider",tags="allowed")] string |
155+
)
156+
}
157+
158+
dispatch thermoo:temperature_effect_type[thermoo:empty] to struct {
159+
160+
}
161+
162+
struct StatusEffectEntry {
163+
type: #[id="mob_effect"] string,
164+
duration?: int @ 1..,
165+
amplifier: int @ 0..
166+
}
167+
168+
dispatch thermoo:temperature_effect_type[thermoo:status_effect] to struct {
169+
effects: [StatusEffectEntry]
170+
}
171+
172+
#[since="1.21"]
173+
dispatch thermoo:temperature_effect_type[thermoo:attribute_modifier] to struct {
174+
value: float,
175+
attribute_type: #[id="attribute"] string,
176+
/// Used when equipping and unequipping the item to identify which modifier to add or remove from the entity.
177+
id: #[id="attribute_modifier"] string,
178+
operation: AttributeOperation
179+
}
180+
181+
dispatch thermoo:temperature_effect_type[thermoo:scaling_attribute_modifier] to struct {
182+
/// Default value of `1.0`.
183+
scale?: float,
184+
attribute_type: #[id="attribute"] string,
185+
/// Used when equipping and unequipping the item to identify which modifier to add or remove from the entity.
186+
#[since="1.21"]
187+
id: #[id="attribute_modifier"] string,
188+
operation: (
189+
#[until="1.20.5"] ("addition" | "multiply_base" | "multiply_total") |
190+
#[since="1.20.5"] AttributeOperation |
191+
),
192+
193+
#[until="1.21"]
194+
name: string,
195+
#[until="1.21"]
196+
modifier_uuid: #[uuid] string
197+
}
198+
199+
dispatch thermoo:temperature_effect_type[thermoo:damage] to struct {
200+
amount: float @ 0<..,
201+
damage_interval: int @ 1..,
202+
damage_type: #[id="damage_type"] string,
203+
}
204+
205+
#[until="1.20.2"]
206+
dispatch thermoo:temperature_effect_type[thermoo:freeze_damage_legacy] to struct {
207+
amount: float @ 0<..,
208+
damage_interval: int @ 1..,
209+
}
210+
211+
#[since="1.21"]
212+
dispatch thermoo:temperature_effect_type[thermoo:function] to struct {
213+
function: #[id="function"] string,
214+
/// Interpreted as an SNBT string. Required if and only if the specified `function` is a macro function.
215+
arguments?: string,
216+
/// Defaults to `20`.
217+
interval?: int @ 1..,
218+
/// Defaults to `2`.
219+
permission_level?: int @ 0..4,
220+
}
221+
222+
#[since="1.21"]
223+
dispatch thermoo:temperature_effect_type[thermoo:sequence] to struct {
224+
children: [TemperatureEffect]
225+
}
226+
227+
dispatch thermoo:loot_condition_type[thermoo:temperature] to struct {
228+
value?: MinMaxBounds<int>,
229+
scale?: MinMaxBounds<double>,
230+
}
231+
232+
dispatch thermoo:loot_condition_type[thermoo:soaked] to struct {
233+
value?: MinMaxBounds<int>,
234+
scale?: MinMaxBounds<double>,
235+
}

src/config.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,42 @@
808808
"path": "create",
809809
"tags": ["partners"],
810810
"dependency": "create"
811+
},
812+
{
813+
"id": "thermoo:environment_provider",
814+
"url": "thermoo/environment_provider",
815+
"path": "thermoo/environment_provider",
816+
"tags": ["partners"],
817+
"dependency": "thermoo",
818+
"wiki": "https://thermoo.thedeathlycow.com/datapacks/environment_provider_definition/",
819+
"minVersion": "1.21.1"
820+
},
821+
{
822+
"id": "thermoo:environment",
823+
"url": "thermoo/environment",
824+
"path": "thermoo/environment",
825+
"tags": ["partners"],
826+
"dependency": "thermoo",
827+
"wiki": "https://thermoo.thedeathlycow.com/datapacks/environment_definition/",
828+
"minVersion": "1.21.1"
829+
},
830+
{
831+
"id": "thermoo:temperature_effect",
832+
"url": "thermoo/temperature_effect",
833+
"path": "thermoo/temperature_effect",
834+
"tags": ["partners"],
835+
"dependency": "thermoo",
836+
"wiki": "https://thermoo.thedeathlycow.com/datapacks/temperature_effect_definition/",
837+
"minVersion": "1.20.1"
838+
},
839+
{
840+
"id": "thermoo:predicate",
841+
"url": "thermoo/predicate",
842+
"path": "thermoo/predicate",
843+
"tags": ["partners"],
844+
"dependency": "thermoo",
845+
"wiki": "https://thermoo.thedeathlycow.com/datapacks/loot_condition/",
846+
"minVersion": "1.21.1"
811847
}
812848
],
813849
"legacyGuides": [

src/locales/en.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@
132132
"generator.test_instance": "Test Instance",
133133
"generator.test_environment": "Test Environment",
134134
"generator.text_component": "Text Component",
135+
"generator.thermoo:environment_provider": "Environment Provider",
136+
"generator.thermoo:environment": "Environment",
137+
"generator.thermoo:temperature_effect": "Temperature Effect",
138+
"generator.thermoo:predicate": "Thermoo Predicates",
135139
"generator.trial_spawner": "Trial Spawner",
136140
"generator.trim_material": "Trim Material",
137141
"generator.trim_pattern": "Trim Pattern",
@@ -202,6 +206,7 @@
202206
"partner.obsidian": "Obsidian",
203207
"partner.ohthetreesyoullgrow": "Oh The Trees You'll Grow",
204208
"partner.sky_aesthetics": "Sky Aesthetics",
209+
"partner.thermoo": "Thermoo",
205210
"presets": "Presets",
206211
"presets.no_results": "No presets",
207212
"presets.no_results_for_query": "No presets for this query",

0 commit comments

Comments
 (0)