From 319013857d3eb9a64171d64e453f36dd0641447f Mon Sep 17 00:00:00 2001 From: Senmori Date: Thu, 23 Mar 2017 12:42:01 -0400 Subject: [PATCH] Add Chunk.isSlimeChunk to check if a chunk can spawn slimes --- src/main/java/org/bukkit/craftbukkit/CraftChunk.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index e3d9bdc377..0cc838ccfb 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); }