3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 20:40:07 +01:00
Paper/CraftBukkit-Patches/0135-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch

48 Zeilen
2.0 KiB
Diff

2015-01-16 04:58:23 +01:00
From 175d15493a98ca909ff64169a7fbde7bdfc2c793 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 a6b72d8..0f5d09b 100644
--- a/src/main/java/net/minecraft/server/EntityOcelot.java
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java
2014-11-28 02:17:45 +01:00
@@ -6,6 +6,7 @@ public class EntityOcelot extends EntityTameableAnimal {
2014-11-28 02:17:45 +01:00
private PathfinderGoalAvoidTarget bm;
private PathfinderGoalTempt bn;
+ public boolean spawnBonus = true; // Spigot
public EntityOcelot(World world) {
2014-11-28 02:17:45 +01:00
super(world);
@@ -231,7 +232,7 @@ public class EntityOcelot extends EntityTameableAnimal {
2014-11-28 02:17:45 +01:00
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
2015-01-16 04:58:23 +01:00
index f07d87d..e06d2cd 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
2015-01-16 04:58:23 +01:00
@@ -1084,6 +1084,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) {
2014-11-28 02:17:45 +01:00
((EntityInsentient) entity).prepare(getHandle().E(new BlockPosition(entity)), (GroupDataEntity) null);
}
--
2.1.0