summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityOcelot.patch
blob: 0ec9bbaacbc6cea3574c12ec50437b5af9c1b4b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--- ../work/decompile-8eb82bde/net/minecraft/server/EntityOcelot.java	2014-12-10 18:34:37.228492560 +0000
+++ src/main/java/net/minecraft/server/EntityOcelot.java	2014-12-10 18:33:29.824493292 +0000
@@ -51,7 +51,7 @@
     }
 
     protected boolean isTypeNotPersistent() {
-        return !this.isTamed() && this.ticksLived > 2400;
+        return !this.isTamed() /*&& this.ticksLived > 2400*/; // CraftBukkit
     }
 
     protected void aW() {
@@ -95,15 +95,20 @@
     public boolean r(Entity entity) {
         return entity.damageEntity(DamageSource.mobAttack(this), 3.0F);
     }
-
+    
+    /* CraftBukkit start
+    // Function disabled as it has no special function anymore after
+    //   setSitting is disabled.
     public boolean damageEntity(DamageSource damagesource, float f) {
         if (this.isInvulnerable(damagesource)) {
             return false;
         } else {
-            this.bk.setSitting(false);
+            // CraftBukkit - moved into EntityLiving.d(DamageSource, float)
+            // this.bk.setSitting(false);
             return super.damageEntity(damagesource, f);
         }
     }
+    // CraftBukkit end */
 
     protected void dropDeathLoot(boolean flag, int i) {}
 
@@ -124,7 +129,8 @@
             }
 
             if (!this.world.isStatic) {
-                if (this.random.nextInt(3) == 0) {
+                // CraftBukkit - added event call and isCancelled check
+                if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
                     this.setTamed(true);
                     this.setCatType(1 + this.world.random.nextInt(3));
                     this.setOwnerUUID(entityhuman.getUniqueID().toString());
@@ -231,7 +237,7 @@
 
                 entityocelot.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
                 entityocelot.setAgeRaw(-24000);
-                this.world.addEntity(entityocelot);
+                this.world.addEntity(entityocelot, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.OCELOT_BABY); // CraftBukkit - add SpawnReason
             }
         }