Paper/CraftBukkit-Patches/0159-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch
Zach Brown 7b0c576798 Restructure PaperSpigot as a new set of modules
Allows us much greater control over the Spigot portion of the code
and makes us more "proper"
Credit to @Dmck2b for originally passing the idea along a while back
2014-07-21 15:46:54 -05:00

48 lines
1.9 KiB
Diff

From ad8430edf44f21bd3d33b746962a019be888c20d 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 1f15e40..8abbcdf 100644
--- a/src/main/java/net/minecraft/server/EntityOcelot.java
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
public class EntityOcelot extends EntityTameableAnimal {
+ public boolean spawnBonus = true; // Spigot
private PathfinderGoalTempt bq;
public EntityOcelot(World world) {
@@ -238,7 +239,7 @@ public class EntityOcelot extends EntityTameableAnimal {
public GroupDataEntity prepare(GroupDataEntity groupdataentity) {
groupdataentity = super.prepare(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 d9e3436..d60a79a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1056,6 +1056,12 @@ public class CraftWorld implements World {
}
if (entity != null) {
+ // Spigot start
+ if (entity instanceof EntityOcelot)
+ {
+ ( (EntityOcelot) entity ).spawnBonus = false;
+ }
+ // Spigot end
if (entity instanceof EntityInsentient) {
((EntityInsentient) entity).prepare((GroupDataEntity) null);
}
--
1.9.1