-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathBiomeProvider.java
More file actions
106 lines (100 loc) · 4.05 KB
/
BiomeProvider.java
File metadata and controls
106 lines (100 loc) · 4.05 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
package org.bukkit.generator;
import java.util.List;
import java.util.Optional;
import org.bukkit.block.Biome;
import org.jetbrains.annotations.NotNull;
/**
* Class for providing biomes.
*/
public abstract class BiomeProvider {
/**
* Return the Biome which should be present at the provided location.
* <p>
* Notes:
* <p>
* This method <b>must</b> be completely thread safe and able to handle
* multiple concurrent callers.
* <p>
* This method should only return biomes which are present in the list
* returned by {@link #getBiomes(WorldInfo)}
* <p>
* This method should <b>never</b> return {@link Biome#CUSTOM}.
*
* @param worldInfo The world info of the world the biome will be used for
* @param x The X-coordinate from world origin
* @param y The Y-coordinate from world origin
* @param z The Z-coordinate from world origin
* @return Biome for the given location
*/
@NotNull
public abstract Biome getBiome(@NotNull WorldInfo worldInfo, int x, int y, int z);
/**
* Return the Biome which should be present at the provided location.
* <p>
* Notes:
* <p>
* This method <b>must</b> be completely thread safe and able to handle
* multiple concurrent callers.
* <p>
* This method should only return biomes which are present in the list
* returned by {@link #getBiomes(WorldInfo)}
* <p>
* This method should <b>never</b> return {@link Biome#CUSTOM}.
* Only this method is called if both this and
* {@link #getBiome(WorldInfo, int, int, int)} are overridden.
*
* @param worldInfo The world info of the world the biome will be used for
* @param x The X-coordinate from world origin
* @param y The Y-coordinate from world origin
* @param z The Z-coordinate from world origin
* @param biomeParameterPoint The parameter point that is provided by default
* for this location (contains temperature, humidity,
* continentalness, erosion, depth and weirdness)
* @return Biome for the given location
* @see #getBiome(WorldInfo, int, int, int)
*/
@NotNull
public Biome getBiome(@NotNull WorldInfo worldInfo, int x, int y, int z, @NotNull BiomeParameterPoint biomeParameterPoint) {
return getBiome(worldInfo, x, y, z);
}
/**
* Return a biome for structure placement searching (e.g. stronghold ring
* position computation), bypassing expensive biome pipeline evaluation.
* <p>
* Implementations may return a coarse approximation sufficient to determine
* whether a position is eligible for a structure (e.g. land vs ocean).
* Return {@link Optional#empty()} to fall back to the full
* {@link #getBiome(WorldInfo, int, int, int)} path.
* <p>
* This is called from {@code findBiomeHorizontal} which runs on background
* executor threads. Implementations must be thread-safe.
*
* @param worldInfo The world info of the world being searched
* @param x The X block coordinate
* @param z The Z block coordinate
* @return An optional biome for fast structure placement eligibility
* checking, or empty to use the full pipeline
*/
@NotNull
public Optional<Biome> getStructurePlacementBiome(@NotNull WorldInfo worldInfo, int x, int z) {
return Optional.empty();
}
/**
* Returns a list with every biome the {@link BiomeProvider} will use for
* the given world.
* <p>
* Notes:
* <p>
* This method only gets called once, when the world is loaded. Returning
* another list or modifying the values from the initial returned list later
* one, are not respected.
* <p>
* This method should <b>never</b> return a list which contains
* {@link Biome#CUSTOM}.
*
* @param worldInfo The world info of the world the list will be used for
* @return A list with every biome the {@link BiomeProvider} uses
*/
@NotNull
public abstract List<Biome> getBiomes(@NotNull WorldInfo worldInfo);
}