Skip to content

Commit 9098d70

Browse files
committed
wip: environmental attributes api
1 parent ceefdf7 commit 9098d70

File tree

9 files changed

+643
-1
lines changed

9 files changed

+643
-1
lines changed
Lines changed: 349 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,349 @@
1+
package io.papermc.paper.registry.keys;
2+
3+
import static net.kyori.adventure.key.Key.key;
4+
5+
import io.papermc.paper.annotation.GeneratedClass;
6+
import io.papermc.paper.registry.RegistryKey;
7+
import io.papermc.paper.registry.TypedKey;
8+
import io.papermc.paper.world.attribute.EnvironmentalAttributeType;
9+
import net.kyori.adventure.key.Key;
10+
import org.jspecify.annotations.NullMarked;
11+
12+
/**
13+
* Vanilla keys for {@link RegistryKey#ENVIRONMENT_ATTRIBUTE}.
14+
*
15+
* @apiNote The fields provided here are a direct representation of
16+
* what is available from the vanilla game source. They may be
17+
* changed (including removals) on any Minecraft version
18+
* bump, so cross-version compatibility is not provided on the
19+
* same level as it is on most of the other API.
20+
*/
21+
@SuppressWarnings({
22+
"unused",
23+
"SpellCheckingInspection"
24+
})
25+
@NullMarked
26+
@GeneratedClass
27+
public final class EnvironmentAttributeKeys {
28+
/**
29+
* {@code minecraft:audio/ambient_sounds}
30+
*
31+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
32+
*/
33+
public static final TypedKey<EnvironmentalAttributeType<?>> AUDIO_AMBIENT_SOUNDS = create(key("audio/ambient_sounds"));
34+
35+
/**
36+
* {@code minecraft:audio/background_music}
37+
*
38+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
39+
*/
40+
public static final TypedKey<EnvironmentalAttributeType<?>> AUDIO_BACKGROUND_MUSIC = create(key("audio/background_music"));
41+
42+
/**
43+
* {@code minecraft:audio/firefly_bush_sounds}
44+
*
45+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
46+
*/
47+
public static final TypedKey<EnvironmentalAttributeType<?>> AUDIO_FIREFLY_BUSH_SOUNDS = create(key("audio/firefly_bush_sounds"));
48+
49+
/**
50+
* {@code minecraft:audio/music_volume}
51+
*
52+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
53+
*/
54+
public static final TypedKey<EnvironmentalAttributeType<?>> AUDIO_MUSIC_VOLUME = create(key("audio/music_volume"));
55+
56+
/**
57+
* {@code minecraft:gameplay/baby_villager_activity}
58+
*
59+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
60+
*/
61+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_BABY_VILLAGER_ACTIVITY = create(key("gameplay/baby_villager_activity"));
62+
63+
/**
64+
* {@code minecraft:gameplay/bed_rule}
65+
*
66+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
67+
*/
68+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_BED_RULE = create(key("gameplay/bed_rule"));
69+
70+
/**
71+
* {@code minecraft:gameplay/bees_stay_in_hive}
72+
*
73+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
74+
*/
75+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_BEES_STAY_IN_HIVE = create(key("gameplay/bees_stay_in_hive"));
76+
77+
/**
78+
* {@code minecraft:gameplay/can_pillager_patrol_spawn}
79+
*
80+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
81+
*/
82+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_CAN_PILLAGER_PATROL_SPAWN = create(key("gameplay/can_pillager_patrol_spawn"));
83+
84+
/**
85+
* {@code minecraft:gameplay/can_start_raid}
86+
*
87+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
88+
*/
89+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_CAN_START_RAID = create(key("gameplay/can_start_raid"));
90+
91+
/**
92+
* {@code minecraft:gameplay/cat_waking_up_gift_chance}
93+
*
94+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
95+
*/
96+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_CAT_WAKING_UP_GIFT_CHANCE = create(key("gameplay/cat_waking_up_gift_chance"));
97+
98+
/**
99+
* {@code minecraft:gameplay/creaking_active}
100+
*
101+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
102+
*/
103+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_CREAKING_ACTIVE = create(key("gameplay/creaking_active"));
104+
105+
/**
106+
* {@code minecraft:gameplay/eyeblossom_open}
107+
*
108+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
109+
*/
110+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_EYEBLOSSOM_OPEN = create(key("gameplay/eyeblossom_open"));
111+
112+
/**
113+
* {@code minecraft:gameplay/fast_lava}
114+
*
115+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
116+
*/
117+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_FAST_LAVA = create(key("gameplay/fast_lava"));
118+
119+
/**
120+
* {@code minecraft:gameplay/increased_fire_burnout}
121+
*
122+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
123+
*/
124+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_INCREASED_FIRE_BURNOUT = create(key("gameplay/increased_fire_burnout"));
125+
126+
/**
127+
* {@code minecraft:gameplay/monsters_burn}
128+
*
129+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
130+
*/
131+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_MONSTERS_BURN = create(key("gameplay/monsters_burn"));
132+
133+
/**
134+
* {@code minecraft:gameplay/nether_portal_spawns_piglin}
135+
*
136+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
137+
*/
138+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_NETHER_PORTAL_SPAWNS_PIGLIN = create(key("gameplay/nether_portal_spawns_piglin"));
139+
140+
/**
141+
* {@code minecraft:gameplay/piglins_zombify}
142+
*
143+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
144+
*/
145+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_PIGLINS_ZOMBIFY = create(key("gameplay/piglins_zombify"));
146+
147+
/**
148+
* {@code minecraft:gameplay/respawn_anchor_works}
149+
*
150+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
151+
*/
152+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_RESPAWN_ANCHOR_WORKS = create(key("gameplay/respawn_anchor_works"));
153+
154+
/**
155+
* {@code minecraft:gameplay/sky_light_level}
156+
*
157+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
158+
*/
159+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_SKY_LIGHT_LEVEL = create(key("gameplay/sky_light_level"));
160+
161+
/**
162+
* {@code minecraft:gameplay/snow_golem_melts}
163+
*
164+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
165+
*/
166+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_SNOW_GOLEM_MELTS = create(key("gameplay/snow_golem_melts"));
167+
168+
/**
169+
* {@code minecraft:gameplay/surface_slime_spawn_chance}
170+
*
171+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
172+
*/
173+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_SURFACE_SLIME_SPAWN_CHANCE = create(key("gameplay/surface_slime_spawn_chance"));
174+
175+
/**
176+
* {@code minecraft:gameplay/turtle_egg_hatch_chance}
177+
*
178+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
179+
*/
180+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_TURTLE_EGG_HATCH_CHANCE = create(key("gameplay/turtle_egg_hatch_chance"));
181+
182+
/**
183+
* {@code minecraft:gameplay/villager_activity}
184+
*
185+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
186+
*/
187+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_VILLAGER_ACTIVITY = create(key("gameplay/villager_activity"));
188+
189+
/**
190+
* {@code minecraft:gameplay/water_evaporates}
191+
*
192+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
193+
*/
194+
public static final TypedKey<EnvironmentalAttributeType<?>> GAMEPLAY_WATER_EVAPORATES = create(key("gameplay/water_evaporates"));
195+
196+
/**
197+
* {@code minecraft:visual/ambient_particles}
198+
*
199+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
200+
*/
201+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_AMBIENT_PARTICLES = create(key("visual/ambient_particles"));
202+
203+
/**
204+
* {@code minecraft:visual/cloud_color}
205+
*
206+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
207+
*/
208+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_CLOUD_COLOR = create(key("visual/cloud_color"));
209+
210+
/**
211+
* {@code minecraft:visual/cloud_fog_end_distance}
212+
*
213+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
214+
*/
215+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_CLOUD_FOG_END_DISTANCE = create(key("visual/cloud_fog_end_distance"));
216+
217+
/**
218+
* {@code minecraft:visual/cloud_height}
219+
*
220+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
221+
*/
222+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_CLOUD_HEIGHT = create(key("visual/cloud_height"));
223+
224+
/**
225+
* {@code minecraft:visual/default_dripstone_particle}
226+
*
227+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
228+
*/
229+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_DEFAULT_DRIPSTONE_PARTICLE = create(key("visual/default_dripstone_particle"));
230+
231+
/**
232+
* {@code minecraft:visual/fog_color}
233+
*
234+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
235+
*/
236+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_FOG_COLOR = create(key("visual/fog_color"));
237+
238+
/**
239+
* {@code minecraft:visual/fog_end_distance}
240+
*
241+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
242+
*/
243+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_FOG_END_DISTANCE = create(key("visual/fog_end_distance"));
244+
245+
/**
246+
* {@code minecraft:visual/fog_start_distance}
247+
*
248+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
249+
*/
250+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_FOG_START_DISTANCE = create(key("visual/fog_start_distance"));
251+
252+
/**
253+
* {@code minecraft:visual/moon_angle}
254+
*
255+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
256+
*/
257+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_MOON_ANGLE = create(key("visual/moon_angle"));
258+
259+
/**
260+
* {@code minecraft:visual/moon_phase}
261+
*
262+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
263+
*/
264+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_MOON_PHASE = create(key("visual/moon_phase"));
265+
266+
/**
267+
* {@code minecraft:visual/sky_color}
268+
*
269+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
270+
*/
271+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_SKY_COLOR = create(key("visual/sky_color"));
272+
273+
/**
274+
* {@code minecraft:visual/sky_fog_end_distance}
275+
*
276+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
277+
*/
278+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_SKY_FOG_END_DISTANCE = create(key("visual/sky_fog_end_distance"));
279+
280+
/**
281+
* {@code minecraft:visual/sky_light_color}
282+
*
283+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
284+
*/
285+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_SKY_LIGHT_COLOR = create(key("visual/sky_light_color"));
286+
287+
/**
288+
* {@code minecraft:visual/sky_light_factor}
289+
*
290+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
291+
*/
292+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_SKY_LIGHT_FACTOR = create(key("visual/sky_light_factor"));
293+
294+
/**
295+
* {@code minecraft:visual/star_angle}
296+
*
297+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
298+
*/
299+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_STAR_ANGLE = create(key("visual/star_angle"));
300+
301+
/**
302+
* {@code minecraft:visual/star_brightness}
303+
*
304+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
305+
*/
306+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_STAR_BRIGHTNESS = create(key("visual/star_brightness"));
307+
308+
/**
309+
* {@code minecraft:visual/sun_angle}
310+
*
311+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
312+
*/
313+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_SUN_ANGLE = create(key("visual/sun_angle"));
314+
315+
/**
316+
* {@code minecraft:visual/sunrise_sunset_color}
317+
*
318+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
319+
*/
320+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_SUNRISE_SUNSET_COLOR = create(key("visual/sunrise_sunset_color"));
321+
322+
/**
323+
* {@code minecraft:visual/water_fog_color}
324+
*
325+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
326+
*/
327+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_WATER_FOG_COLOR = create(key("visual/water_fog_color"));
328+
329+
/**
330+
* {@code minecraft:visual/water_fog_end_distance}
331+
*
332+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
333+
*/
334+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_WATER_FOG_END_DISTANCE = create(key("visual/water_fog_end_distance"));
335+
336+
/**
337+
* {@code minecraft:visual/water_fog_start_distance}
338+
*
339+
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
340+
*/
341+
public static final TypedKey<EnvironmentalAttributeType<?>> VISUAL_WATER_FOG_START_DISTANCE = create(key("visual/water_fog_start_distance"));
342+
343+
private EnvironmentAttributeKeys() {
344+
}
345+
346+
private static TypedKey<EnvironmentalAttributeType<?>> create(final Key key) {
347+
return TypedKey.create(RegistryKey.ENVIRONMENT_ATTRIBUTE, key);
348+
}
349+
}

paper-api/src/main/java/io/papermc/paper/registry/RegistryKey.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import io.papermc.paper.datacomponent.DataComponentType;
44
import io.papermc.paper.dialog.Dialog;
55
import io.papermc.paper.registry.tag.TagKey;
6+
import io.papermc.paper.world.attribute.EnvironmentalAttributeType;
67
import net.kyori.adventure.key.Key;
78
import net.kyori.adventure.key.KeyPattern;
89
import net.kyori.adventure.key.Keyed;
@@ -132,6 +133,11 @@ public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
132133
* @see io.papermc.paper.registry.keys.GameRuleKeys
133134
*/
134135
RegistryKey<GameRule<?>> GAME_RULE = create("game_rule");
136+
/**
137+
* Built-in registry for environmental attribute types.
138+
* @see io.papermc.paper.registry.keys.EnvironmentAttributeKeys
139+
*/
140+
RegistryKey<EnvironmentalAttributeType<?>> ENVIRONMENT_ATTRIBUTE = create("environment_attribute");
135141

136142
/* ********************** *
137143
* Data-driven Registries *
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package io.papermc.paper.world.attribute;
2+
3+
import org.bukkit.Keyed;
4+
import org.jetbrains.annotations.ApiStatus;
5+
import org.jspecify.annotations.NullMarked;
6+
7+
@NullMarked
8+
@ApiStatus.Experimental
9+
@ApiStatus.NonExtendable
10+
public interface EnvironmentalAttributeType<T> extends Keyed {
11+
12+
T getDefaultValue();
13+
14+
}

0 commit comments

Comments
 (0)