mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 04:17:44 +01:00
Implemented block.getBiome
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
a5f424708d
commit
79190cff6c
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
package org.bukkit.craftbukkit;
|
package org.bukkit.craftbukkit;
|
||||||
|
|
||||||
|
import net.minecraft.server.MobSpawnerBase;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||||
@ -265,4 +266,37 @@ public class CraftBlock implements Block {
|
|||||||
return new CraftBlockState(this);
|
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