Paper/nms-patches/EntityTippedArrow.patch

47 lines
2.0 KiB
Diff
Raw Normal View History

--- a/net/minecraft/server/EntityTippedArrow.java
+++ b/net/minecraft/server/EntityTippedArrow.java
2018-12-25 22:00:00 +01:00
@@ -115,6 +115,25 @@
}
}
+ // CraftBukkit start accessor methods
+ public void refreshEffects() {
2018-08-26 04:00:00 +02:00
+ this.getDataWatcher().set(EntityTippedArrow.g, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects))));
+ }
+
+ public String getType() {
2018-08-26 04:00:00 +02:00
+ return IRegistry.POTION.getKey(this.potionRegistry).toString();
+ }
+
+ public void setType(String string) {
2018-08-26 04:00:00 +02:00
+ 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() {
2016-11-17 02:41:03 +01:00
+ return !(this.effects.isEmpty() && this.potionRegistry == Potions.EMPTY);
+ }
+ // CraftBukkit end
+
2017-05-14 04:00:00 +02:00
public int getColor() {
2018-12-06 00:00:00 +01:00
return (Integer) this.datawatcher.get(EntityTippedArrow.g);
}
2018-12-25 22:00:00 +01:00
@@ -179,7 +198,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()) {
2018-12-25 22:00:00 +01:00
@@ -187,7 +206,7 @@
while (iterator.hasNext()) {
mobeffect = (MobEffect) iterator.next();
- entityliving.addEffect(mobeffect);
+ entityliving.addEffect(mobeffect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
}
}