summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityParrot.patch
blob: 2ea16e1648358f5730e4a6df0bbe0e40a30c36e3 (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
--- a/net/minecraft/server/EntityParrot.java
+++ b/net/minecraft/server/EntityParrot.java
@@ -16,14 +16,14 @@
 public class EntityParrot extends EntityPerchable implements EntityBird {
 
     private static final DataWatcherObject<Integer> bL = DataWatcher.a(EntityParrot.class, DataWatcherRegistry.b);
-    private static final Predicate<EntityInsentient> bM = new Predicate() {
+    private static final Predicate<EntityInsentient> bM = new Predicate<EntityInsentient>() { // CraftBukkit - decompile error
         public boolean test(@Nullable EntityInsentient entityinsentient) {
             return entityinsentient != null && EntityParrot.bP.containsKey(entityinsentient.P());
         }
     };
     private static final Item bN = Items.COOKIE;
     private static final Set<Item> bO = Sets.newHashSet(new Item[] { Items.WHEAT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.BEETROOT_SEEDS});
-    private static final Map<EntityTypes<?>, SoundEffect> bP = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
+    private static final Map<EntityTypes<?>, SoundEffect> bP = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error
         hashmap.put(EntityTypes.BLAZE, SoundEffects.ENTITY_PARROT_IMITATE_BLAZE);
         hashmap.put(EntityTypes.CAVE_SPIDER, SoundEffects.ENTITY_PARROT_IMITATE_SPIDER);
         hashmap.put(EntityTypes.CREEPER, SoundEffects.ENTITY_PARROT_IMITATE_CREEPER);
@@ -170,7 +170,7 @@
             }
 
             if (!this.world.isClientSide) {
-                if (this.random.nextInt(10) == 0) {
+                if (this.random.nextInt(10) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit
                     this.c(entityhuman);
                     this.s(true);
                     this.world.broadcastEntityEffect(this, (byte) 7);
@@ -186,7 +186,7 @@
                 itemstack.subtract(1);
             }
 
-            this.addEffect(new MobEffect(MobEffects.POISON, 900));
+            this.addEffect(new MobEffect(MobEffects.POISON, 900), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // CraftBukkit
             if (entityhuman.u() || !this.bl()) {
                 this.damageEntity(DamageSource.playerAttack(entityhuman), Float.MAX_VALUE);
             }
@@ -306,7 +306,8 @@
             return false;
         } else {
             if (this.goalSit != null) {
-                this.goalSit.setSitting(false);
+                // CraftBukkit - moved into EntityLiving.d(DamageSource, float)
+                // this.goalSit.setSitting(false);
             }
 
             return super.damageEntity(damagesource, f);