diff options
author | Senmori <thesenmori@gmail.com> | 2017-03-23 12:42:01 -0400 |
---|---|---|
committer | md_5 <git@md-5.net> | 2017-03-24 15:17:47 +1100 |
commit | 319013857d3eb9a64171d64e453f36dd0641447f (patch) | |
tree | 5973c73e4dc085b5ef19de99bb85d7622b2198d8 /src | |
parent | 4959e46f537a7b5d3a2c25e04b6b106d324048d2 (diff) | |
download | craftbukkit-319013857d3eb9a64171d64e453f36dd0641447f.tar craftbukkit-319013857d3eb9a64171d64e453f36dd0641447f.tar.gz craftbukkit-319013857d3eb9a64171d64e453f36dd0641447f.tar.lz craftbukkit-319013857d3eb9a64171d64e453f36dd0641447f.tar.xz craftbukkit-319013857d3eb9a64171d64e453f36dd0641447f.zip |
Add Chunk.isSlimeChunk to check if a chunk can spawn slimes
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftChunk.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index e3d9bdc3..0cc838cc 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit; import java.lang.ref.WeakReference; import java.util.Arrays; +import java.util.Random; import net.minecraft.server.*; import org.bukkit.Chunk; @@ -129,6 +130,12 @@ public class CraftChunk implements Chunk { return getWorld().unloadChunk(getX(), getZ()); } + @Override + public boolean isSlimeChunk() { + // 987234911L is deterimined in EntitySlime when seeing if a slime can spawn in a chunk + return getHandle().a(987234911L).nextInt(10) == 0; + } + public boolean unload(boolean save) { return getWorld().unloadChunk(getX(), getZ(), save); } |