mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 02:55:47 +01:00
Implemented block.getBiome
This commit is contained in:
parent
603156ea29
commit
f71e2b4ed3
@ -1,6 +1,7 @@
|
||||
|
||||
package org.bukkit.craftbukkit;
|
||||
|
||||
import net.minecraft.server.MobSpawnerBase;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
@ -265,4 +266,37 @@ public class CraftBlock implements Block {
|
||||
return new CraftBlockState(this);
|
||||
}
|
||||
}
|
||||
|
||||
public Biome getBiome() {
|
||||
// TODO: This may not be 100% accurate; investigate into getting per-block instead of per-chunk
|
||||
MobSpawnerBase base = world.getHandle().a().a(chunk.getX(), chunk.getZ());
|
||||
|
||||
if (base == MobSpawnerBase.a) {
|
||||
return Biome.RAINFOREST;
|
||||
} else if (base == MobSpawnerBase.b) {
|
||||
return Biome.SWAMPLAND;
|
||||
} else if (base == MobSpawnerBase.c) {
|
||||
return Biome.SEASONAL_FOREST;
|
||||
} else if (base == MobSpawnerBase.d) {
|
||||
return Biome.FOREST;
|
||||
} else if (base == MobSpawnerBase.e) {
|
||||
return Biome.SAVANNA;
|
||||
} else if (base == MobSpawnerBase.f) {
|
||||
return Biome.SHRUBLAND;
|
||||
} else if (base == MobSpawnerBase.g) {
|
||||
return Biome.TAIGA;
|
||||
} else if (base == MobSpawnerBase.h) {
|
||||
return Biome.DESERT;
|
||||
} else if (base == MobSpawnerBase.i) {
|
||||
return Biome.PLAINS;
|
||||
} else if (base == MobSpawnerBase.j) {
|
||||
return Biome.ICE_DESERT;
|
||||
} else if (base == MobSpawnerBase.k) {
|
||||
return Biome.TUNDRA;
|
||||
} else if (base == MobSpawnerBase.l) {
|
||||
return Biome.HELL;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user