spigot/CraftBukkit-Patches/0097-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch
2018-07-22 12:00:00 +10:00

47 lines
2.1 KiB
Diff

From 2cb18ab5e022d854ed3bba6ecc29f71231bb3893 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 5515a30b7..4e132eabb 100644
--- a/src/main/java/net/minecraft/server/EntityOcelot.java
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java
@@ -10,6 +10,7 @@ public class EntityOcelot extends EntityTameableAnimal {
private static final MinecraftKey bI = new MinecraftKey("cat");
private PathfinderGoalAvoidTarget<EntityHuman> bJ;
private PathfinderGoalTempt bK;
+ public boolean spawnBonus = true; // Spigot
public EntityOcelot(World world) {
super(EntityTypes.OCELOT, world);
@@ -234,7 +235,7 @@ public class EntityOcelot extends EntityTameableAnimal {
@Nullable
public GroupDataEntity prepare(DifficultyDamageScaler difficultydamagescaler, @Nullable GroupDataEntity groupdataentity, @Nullable NBTTagCompound nbttagcompound) {
groupdataentity = super.prepare(difficultydamagescaler, groupdataentity, nbttagcompound);
- if (this.getCatType() == 0 && this.world.random.nextInt(7) == 0) {
+ if (spawnBonus && this.getCatType() == 0 && 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 a5dd39348..0b2a9d09d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1211,6 +1211,12 @@ public class CraftWorld implements World {
}
if (entity != null) {
+ // Spigot start
+ if (entity instanceof EntityOcelot)
+ {
+ ( (EntityOcelot) entity ).spawnBonus = false;
+ }
+ // Spigot end
return entity;
}
--
2.17.1