summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityTippedArrow.patch
blob: 5628df2096cf28c31d431e1085637d7c651ec7e3 (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
--- a/net/minecraft/server/EntityTippedArrow.java
+++ b/net/minecraft/server/EntityTippedArrow.java
@@ -116,6 +116,25 @@
         }
     }
 
+    // CraftBukkit start accessor methods
+    public void refreshEffects() {
+        this.getDataWatcher().set(EntityTippedArrow.g, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects))));
+    }
+
+    public String getType() {
+        return IRegistry.POTION.getKey(this.potionRegistry).toString();
+    }
+
+    public void setType(String string) {
+        this.potionRegistry = IRegistry.POTION.get(new MinecraftKey(string));
+        this.datawatcher.set(EntityTippedArrow.g, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects))));
+    }
+
+    public boolean isTipped() {
+        return !(this.effects.isEmpty() && this.potionRegistry == Potions.EMPTY);
+    }
+    // CraftBukkit end
+
     public int getColor() {
         return ((Integer) this.datawatcher.get(EntityTippedArrow.g)).intValue();
     }
@@ -180,7 +199,7 @@
 
         while (iterator.hasNext()) {
             mobeffect = (MobEffect) iterator.next();
-            entityliving.addEffect(new MobEffect(mobeffect.getMobEffect(), Math.max(mobeffect.getDuration() / 8, 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isShowParticles()));
+            entityliving.addEffect(new MobEffect(mobeffect.getMobEffect(), Math.max(mobeffect.getDuration() / 8, 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isShowParticles()), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
         }
 
         if (!this.effects.isEmpty()) {
@@ -188,7 +207,7 @@
 
             while (iterator.hasNext()) {
                 mobeffect = (MobEffect) iterator.next();
-                entityliving.addEffect(mobeffect);
+                entityliving.addEffect(mobeffect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
             }
         }