Paper/Spigot-Server-Patches/0116-Water-mobs-should-only-spawn-in-the-water.patch

31 lines
1.2 KiB
Diff
Raw Normal View History

2017-01-06 22:45:59 +01:00
From d153a3ef0f9c66361c449f0175123a8239fc9a32 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.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
2016-11-17 03:23:38 +01:00
index 90d33af..2515557 100644
--- a/src/main/java/net/minecraft/server/EntityWaterAnimal.java
+++ b/src/main/java/net/minecraft/server/EntityWaterAnimal.java
@@ -11,7 +11,15 @@ public abstract class EntityWaterAnimal extends EntityInsentient implements IAni
}
2016-11-17 03:23:38 +01:00
public boolean cM() {
- 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 block = this.world.getType(new BlockPosition(i, j, k)).getBlock();
+
+ return block == Blocks.WATER || block == Blocks.FLOWING_WATER;
+ // Paper end
}
public boolean canSpawn() {
--
2016-12-11 00:50:31 +01:00
2.9.3