SPIGOT-5877: Add scaffolding for custom dimensions and biomes
By: Martoph <sager1018@gmail.com>
This commit is contained in:
@@ -954,6 +954,7 @@ public class CraftWorld implements World {
|
||||
|
||||
@Override
|
||||
public void setBiome(int x, int y, int z, Biome bio) {
|
||||
Preconditions.checkArgument(bio != Biome.CUSTOM, "Cannot set the biome to %s", bio);
|
||||
BiomeBase bb = CraftBlock.biomeToBiomeBase(getHandle().r().b(IRegistry.ay), bio);
|
||||
BlockPosition pos = new BlockPosition(x, 0, z);
|
||||
if (this.world.isLoaded(pos)) {
|
||||
|
||||
@@ -499,11 +499,12 @@ public class CraftBlock implements Block {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Registry.BIOME.get(CraftNamespacedKey.fromMinecraft(registry.getKey(base)));
|
||||
Biome biome = Registry.BIOME.get(CraftNamespacedKey.fromMinecraft(registry.getKey(base)));
|
||||
return (biome == null) ? Biome.CUSTOM : biome;
|
||||
}
|
||||
|
||||
public static BiomeBase biomeToBiomeBase(IRegistry<BiomeBase> registry, Biome bio) {
|
||||
if (bio == null) {
|
||||
if (bio == null || bio == Biome.CUSTOM) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
|
||||
|
||||
@Override
|
||||
public void setBiome(int x, int y, int z, Biome bio) {
|
||||
Preconditions.checkArgument(bio != Biome.CUSTOM, "Cannot set the biome to %s", bio);
|
||||
biome.setBiome(x >> 2, y >> 2, z >> 2, CraftBlock.biomeToBiomeBase((IRegistry<BiomeBase>) biome.registry, bio));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user