PaperMC/CraftBukkit-Patches/0120-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch
2016-03-03 03:46:56 -06:00

47 lines
2 KiB
Diff

From 3231bb87a8c52c07b52f2ae1c8afa5ebadb6fbb8 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thinkofdeath@spigotmc.org>
Date: Sat, 19 Jul 2014 12:49:48 +0100
Subject: [PATCH] Don't spawn bonus ocelots when plugins spawn ocelots
diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java
index 06ace47..f74d1b9 100644
--- a/src/main/java/net/minecraft/server/EntityOcelot.java
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java
@@ -7,6 +7,7 @@ public class EntityOcelot extends EntityTameableAnimal {
private static final DataWatcherObject<Integer> bz = DataWatcher.a(EntityOcelot.class, DataWatcherRegistry.b);
private PathfinderGoalAvoidTarget<EntityHuman> bA;
private PathfinderGoalTempt bB;
+ public boolean spawnBonus = true; // Spigot
public EntityOcelot(World world) {
super(world);
@@ -229,7 +230,7 @@ public class EntityOcelot extends EntityTameableAnimal {
public GroupDataEntity prepare(DifficultyDamageScaler difficultydamagescaler, GroupDataEntity groupdataentity) {
groupdataentity = super.prepare(difficultydamagescaler, groupdataentity);
- if (this.world.random.nextInt(7) == 0) {
+ if (spawnBonus && this.world.random.nextInt(7) == 0) { // Spigot
for (int i = 0; i < 2; ++i) {
EntityOcelot entityocelot = new EntityOcelot(this.world);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 2b3569d..c0d7ac5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1107,6 +1107,12 @@ public class CraftWorld implements World {
}
if (entity != null) {
+ // Spigot start
+ if (entity instanceof EntityOcelot)
+ {
+ ( (EntityOcelot) entity ).spawnBonus = false;
+ }
+ // Spigot end
return entity;
}
--
2.5.0