From 9f0a7201a1cb1052a65c20f5bff3b987da048194 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> Date: Thu, 14 Apr 2016 17:49:11 -0500 Subject: [PATCH] Water mobs should only spawn in the water Closes GH-199 --- ...-mobs-should-only-spawn-in-the-water.patch | 28 +++++++++++++++++++ scripts/importmcdev.sh | 1 + 2 files changed, 29 insertions(+) create mode 100644 Spigot-Server-Patches/Water-mobs-should-only-spawn-in-the-water.patch diff --git a/Spigot-Server-Patches/Water-mobs-should-only-spawn-in-the-water.patch b/Spigot-Server-Patches/Water-mobs-should-only-spawn-in-the-water.patch new file mode 100644 index 0000000000..18164c9a35 --- /dev/null +++ b/Spigot-Server-Patches/Water-mobs-should-only-spawn-in-the-water.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zach Brown <1254957+zachbr@users.noreply.github.com> +Date: Thu, 14 Apr 2016 17:48:56 -0500 +Subject: [PATCH] Water mobs should only spawn in the water + + +diff --git a/src/main/java/net/minecraft/server/EntityWaterAnimal.java b/src/main/java/net/minecraft/server/EntityWaterAnimal.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/EntityWaterAnimal.java ++++ b/src/main/java/net/minecraft/server/EntityWaterAnimal.java +@@ -0,0 +0,0 @@ public abstract class EntityWaterAnimal extends EntityInsentient implements IAni + } + + public boolean cF() { +- return true; ++ // Paper start - Don't let water mobs spawn in non-water blocks ++ // Based around EntityAnimal's implementation ++ int i = MathHelper.floor(this.locX); ++ int j = MathHelper.floor(this.getBoundingBox().b); // minY of bounding box ++ int k = MathHelper.floor(this.locZ); ++ Block below = this.world.getType(new BlockPosition(i, j, k).down()).getBlock(); ++ ++ return below == Blocks.WATER || below == Blocks.FLOWING_WATER; ++ // Paper end + } + + public boolean canSpawn() { +-- \ No newline at end of file diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index 7ae6cbeb08..8273de1ad3 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -51,6 +51,7 @@ import DataBits import DataConverterMaterialId import EULA import EntitySquid +import EntityWaterAnimal import FileIOThread import ItemBlock import PacketPlayInResourcePackStatus