-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathBiome.java
More file actions
208 lines (135 loc) · 6.5 KB
/
Biome.java
File metadata and controls
208 lines (135 loc) · 6.5 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
package org.bukkit.block;
import com.google.common.base.Preconditions;
import io.papermc.paper.InternalAPIBridge;
import io.papermc.paper.registry.RegistryAccess;
import io.papermc.paper.registry.RegistryElement;
import io.papermc.paper.registry.RegistryKey;
import java.util.Locale;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.key.KeyPattern;
import org.bukkit.Bukkit;
import org.bukkit.FeatureFlag;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.util.OldEnum;
import org.jetbrains.annotations.NotNull;
/**
* Holds all accepted Biomes in the server.
* <p>
* The Biomes listed in this interface are present in the default server
* or can be enabled via a {@link FeatureFlag}.
* There may be additional biomes present in the server, for example from a {@link io.papermc.paper.datapack.Datapack}
* which can be accessed via {@link io.papermc.paper.registry.RegistryAccess#getRegistry(RegistryKey)} and {@link RegistryKey#BIOME}.
*/
public interface Biome extends RegistryElement<Biome>, OldEnum<Biome>, Keyed, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
// Start generate - Biome
Biome BADLANDS = getBiome("badlands");
Biome BAMBOO_JUNGLE = getBiome("bamboo_jungle");
Biome BASALT_DELTAS = getBiome("basalt_deltas");
Biome BEACH = getBiome("beach");
Biome BIRCH_FOREST = getBiome("birch_forest");
Biome CHERRY_GROVE = getBiome("cherry_grove");
Biome COLD_OCEAN = getBiome("cold_ocean");
Biome CRIMSON_FOREST = getBiome("crimson_forest");
Biome DARK_FOREST = getBiome("dark_forest");
Biome DEEP_COLD_OCEAN = getBiome("deep_cold_ocean");
Biome DEEP_DARK = getBiome("deep_dark");
Biome DEEP_FROZEN_OCEAN = getBiome("deep_frozen_ocean");
Biome DEEP_LUKEWARM_OCEAN = getBiome("deep_lukewarm_ocean");
Biome DEEP_OCEAN = getBiome("deep_ocean");
Biome DESERT = getBiome("desert");
Biome DRIPSTONE_CAVES = getBiome("dripstone_caves");
Biome END_BARRENS = getBiome("end_barrens");
Biome END_HIGHLANDS = getBiome("end_highlands");
Biome END_MIDLANDS = getBiome("end_midlands");
Biome ERODED_BADLANDS = getBiome("eroded_badlands");
Biome FLOWER_FOREST = getBiome("flower_forest");
Biome FOREST = getBiome("forest");
Biome FROZEN_OCEAN = getBiome("frozen_ocean");
Biome FROZEN_PEAKS = getBiome("frozen_peaks");
Biome FROZEN_RIVER = getBiome("frozen_river");
Biome GROVE = getBiome("grove");
Biome ICE_SPIKES = getBiome("ice_spikes");
Biome JAGGED_PEAKS = getBiome("jagged_peaks");
Biome JUNGLE = getBiome("jungle");
Biome LUKEWARM_OCEAN = getBiome("lukewarm_ocean");
Biome LUSH_CAVES = getBiome("lush_caves");
Biome MANGROVE_SWAMP = getBiome("mangrove_swamp");
Biome MEADOW = getBiome("meadow");
Biome MUSHROOM_FIELDS = getBiome("mushroom_fields");
Biome NETHER_WASTES = getBiome("nether_wastes");
Biome OCEAN = getBiome("ocean");
Biome OLD_GROWTH_BIRCH_FOREST = getBiome("old_growth_birch_forest");
Biome OLD_GROWTH_PINE_TAIGA = getBiome("old_growth_pine_taiga");
Biome OLD_GROWTH_SPRUCE_TAIGA = getBiome("old_growth_spruce_taiga");
Biome PALE_GARDEN = getBiome("pale_garden");
Biome PLAINS = getBiome("plains");
Biome RIVER = getBiome("river");
Biome SAVANNA = getBiome("savanna");
Biome SAVANNA_PLATEAU = getBiome("savanna_plateau");
Biome SMALL_END_ISLANDS = getBiome("small_end_islands");
Biome SNOWY_BEACH = getBiome("snowy_beach");
Biome SNOWY_PLAINS = getBiome("snowy_plains");
Biome SNOWY_SLOPES = getBiome("snowy_slopes");
Biome SNOWY_TAIGA = getBiome("snowy_taiga");
Biome SOUL_SAND_VALLEY = getBiome("soul_sand_valley");
Biome SPARSE_JUNGLE = getBiome("sparse_jungle");
Biome STONY_PEAKS = getBiome("stony_peaks");
Biome STONY_SHORE = getBiome("stony_shore");
Biome SUNFLOWER_PLAINS = getBiome("sunflower_plains");
Biome SWAMP = getBiome("swamp");
Biome TAIGA = getBiome("taiga");
Biome THE_END = getBiome("the_end");
Biome THE_VOID = getBiome("the_void");
Biome WARM_OCEAN = getBiome("warm_ocean");
Biome WARPED_FOREST = getBiome("warped_forest");
Biome WINDSWEPT_FOREST = getBiome("windswept_forest");
Biome WINDSWEPT_GRAVELLY_HILLS = getBiome("windswept_gravelly_hills");
Biome WINDSWEPT_HILLS = getBiome("windswept_hills");
Biome WINDSWEPT_SAVANNA = getBiome("windswept_savanna");
Biome WOODED_BADLANDS = getBiome("wooded_badlands");
// End generate - Biome
/**
* Represents a custom Biome
*
* @deprecated Biome is no longer an enum, custom biomes will have their own biome instance.
*/
@Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
Biome CUSTOM = InternalAPIBridge.get().constructLegacyCustomBiome();
@NotNull
private static Biome getBiome(@NotNull @KeyPattern.Value String key) {
return RegistryAccess.registryAccess().getRegistry(RegistryKey.BIOME).getOrThrow(Key.key(Key.MINECRAFT_NAMESPACE, key));
}
/**
* @param name of the biome.
* @return the biome with the given name.
* @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead.
*/
@NotNull
@Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Biome valueOf(@NotNull String name) {
if ("CUSTOM".equals(name)) {
return Biome.CUSTOM;
}
final NamespacedKey key = NamespacedKey.fromString(name.toLowerCase(Locale.ROOT));
Biome biome = key == null ? null : Bukkit.getUnsafe().get(RegistryKey.BIOME, key);
Preconditions.checkArgument(biome != null, "No biome found with the name %s", name);
return biome;
}
/**
* @return an array of all known biomes.
* @deprecated use {@link Registry#stream()}.
*/
@NotNull
@Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Biome[] values() {
return RegistryAccess.registryAccess().getRegistry(RegistryKey.BIOME).stream().toArray(Biome[]::new);
}
// Paper start
@Override
default @NotNull String translationKey() {
return "biome.minecraft." + this.getKey().getKey();
}
// Paper end
}