geforkt von Mirrors/FastAsyncWorldEdit
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
|
// 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
|
// so the earliest we can do this is in WorldInit
|
||||||
setupTags();
|
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));
|
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent(platform));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"deprecation", "unchecked"})
|
@SuppressWarnings({"deprecation", "unchecked"})
|
||||||
private void initializeRegistries() {
|
private void initializeRegistries() {
|
||||||
/* // FAWE start - move Biomes to their own method
|
// FAWE start - move Biomes to their own method. Initialize biomes twice to allow for the registry to be present for
|
||||||
for (Biome biome : Biome.values()) {
|
// plugins requiring WE biomes during startup, as well as allowing custom biomes loaded later on to be present in WE.
|
||||||
String lowerCaseBiomeName = biome.name().toLowerCase(Locale.ROOT);
|
setupBiomes();
|
||||||
BiomeType.REGISTRY.register("minecraft:" + lowerCaseBiomeName, new BiomeType("minecraft:" + lowerCaseBiomeName));
|
|
||||||
}
|
|
||||||
// FAWE end
|
// FAWE end
|
||||||
|
/*
|
||||||
|
|
||||||
// Block & Item
|
// Block & Item
|
||||||
for (Material material : Material.values()) {
|
for (Material material : Material.values()) {
|
||||||
@ -311,16 +311,13 @@ public class WorldEditPlugin extends JavaPlugin {
|
|||||||
// FAWE start
|
// FAWE start
|
||||||
private void setupBiomes() {
|
private void setupBiomes() {
|
||||||
if (this.adapter.value().isPresent()) {
|
if (this.adapter.value().isPresent()) {
|
||||||
// We don't know which world is the one with the data packs
|
// Biomes are stored globally in the server. Registries are not kept per-world in Minecraft.
|
||||||
// so we just loop over them. Doesn't hurt
|
// The WorldServer get-registries method simply delegates to the MinecraftServer method.
|
||||||
for (org.bukkit.World world : Bukkit.getWorlds()) {
|
for (final NamespacedKey biome : ((BukkitImplAdapter<?>) adapter.value().get()).getRegisteredBiomes()) {
|
||||||
// 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
|
if (BiomeType.REGISTRY.get(biome.toString()) == null) { // only register once
|
||||||
BiomeType.REGISTRY.register(biome.toString(), new BiomeType(biome.toString()));
|
BiomeType.REGISTRY.register(biome.toString(), new BiomeType(biome.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
LOGGER.warn("Failed to load biomes via adapter (not present). Will load via bukkit");
|
LOGGER.warn("Failed to load biomes via adapter (not present). Will load via bukkit");
|
||||||
for (Biome biome : Biome.values()) {
|
for (Biome biome : Biome.values()) {
|
||||||
|
@ -311,10 +311,9 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
|
|||||||
/**
|
/**
|
||||||
* Returns an iterable of all biomes known to the server.
|
* 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.
|
* @return all biomes known to the server.
|
||||||
*/
|
*/
|
||||||
default Iterable<NamespacedKey> getRegisteredBiomes(World world) {
|
default Iterable<NamespacedKey> getRegisteredBiomes() {
|
||||||
return Arrays.stream(Biome.values())
|
return Arrays.stream(Biome.values())
|
||||||
.map(Keyed::getKey)
|
.map(Keyed::getKey)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
Binäre Datei nicht angezeigt.
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren