mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 08:57:35 +01:00
Water mobs should only spawn in the water
Closes GH-199
This commit is contained in:
parent
da7320fc42
commit
8ccd31ed38
@ -0,0 +1,30 @@
|
||||
From d4985b594d55ee94ef5b68677eda3496d6cd8149 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
|
||||
index f4764da..2aa0391 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
|
||||
}
|
||||
|
||||
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() {
|
||||
--
|
||||
2.8.0
|
||||
|
@ -51,6 +51,7 @@ import DataBits
|
||||
import DataConverterMaterialId
|
||||
import EULA
|
||||
import EntitySquid
|
||||
import EntityWaterAnimal
|
||||
import FileIOThread
|
||||
import ItemBlock
|
||||
import PacketPlayInResourcePackStatus
|
||||
|
Loading…
Reference in New Issue
Block a user