|
| 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 | +} |
0 commit comments