mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
Add Chunk.isSlimeChunk to check if a chunk can spawn slimes
By: Senmori <thesenmori@gmail.com>
This commit is contained in:
parent
f37ad64b75
commit
34fe9e8377
1 changed files with 7 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue