Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-07 00:22:51 +02:00
Load default biomes into registry at earliest convenience, then load custom biomes later.
Dieser Commit ist enthalten in:
Ursprung
563ad7761a
Commit
f412796f28
@ -236,18 +236,18 @@ public class WorldEditPlugin extends JavaPlugin {
|
||||
// datapacks aren't loaded until just before the world is, and bukkit has no event for this
|
||||
// so the earliest we can do this is in WorldInit
|
||||
setupTags();
|
||||
setupBiomes(); // FAWE - load biomes later
|
||||
setupBiomes(); // FAWE - load biomes later. Initialize biomes twice to allow for the registry to be present for
|
||||
// plugins requiring WE biomes during startup, as well as allowing custom biomes loaded later on to be present in WE.
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent(platform));
|
||||
}
|
||||
|
||||
@SuppressWarnings({"deprecation", "unchecked"})
|
||||
private void initializeRegistries() {
|
||||
/* // FAWE start - move Biomes to their own method
|
||||
for (Biome biome : Biome.values()) {
|
||||
String lowerCaseBiomeName = biome.name().toLowerCase(Locale.ROOT);
|
||||
BiomeType.REGISTRY.register("minecraft:" + lowerCaseBiomeName, new BiomeType("minecraft:" + lowerCaseBiomeName));
|
||||
}
|
||||
// FAWE start - move Biomes to their own method. Initialize biomes twice to allow for the registry to be present for
|
||||
// plugins requiring WE biomes during startup, as well as allowing custom biomes loaded later on to be present in WE.
|
||||
setupBiomes();
|
||||
// FAWE end
|
||||
/*
|
||||
|
||||
// Block & Item
|
||||
for (Material material : Material.values()) {
|
||||
@ -311,14 +311,11 @@ public class WorldEditPlugin extends JavaPlugin {
|
||||
// FAWE start
|
||||
private void setupBiomes() {
|
||||
if (this.adapter.value().isPresent()) {
|
||||
// We don't know which world is the one with the data packs
|
||||
// so we just loop over them. Doesn't hurt
|
||||
for (org.bukkit.World world : Bukkit.getWorlds()) {
|
||||
// cast is needed, thanks to raw types <3
|
||||
for (final NamespacedKey biome : ((BukkitImplAdapter<?>) adapter.value().get()).getRegisteredBiomes(world)) {
|
||||
if (BiomeType.REGISTRY.get(biome.toString()) == null) { // only register once
|
||||
BiomeType.REGISTRY.register(biome.toString(), new BiomeType(biome.toString()));
|
||||
}
|
||||
// Biomes are stored globally in the server. Registries are not kept per-world in Minecraft.
|
||||
// The WorldServer get-registries method simply delegates to the MinecraftServer method.
|
||||
for (final NamespacedKey biome : ((BukkitImplAdapter<?>) adapter.value().get()).getRegisteredBiomes()) {
|
||||
if (BiomeType.REGISTRY.get(biome.toString()) == null) { // only register once
|
||||
BiomeType.REGISTRY.register(biome.toString(), new BiomeType(biome.toString()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -311,10 +311,9 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
|
||||
/**
|
||||
* Returns an iterable of all biomes known to the server.
|
||||
*
|
||||
* @param world the world to load the registered biomes from.
|
||||
* @return all biomes known to the server.
|
||||
*/
|
||||
default Iterable<NamespacedKey> getRegisteredBiomes(World world) {
|
||||
default Iterable<NamespacedKey> getRegisteredBiomes() {
|
||||
return Arrays.stream(Biome.values())
|
||||
.map(Keyed::getKey)
|
||||
.collect(Collectors.toList());
|
||||
|
Binäre Datei nicht angezeigt.
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren