PaperMC/paper-server/nms-patches/net/minecraft/world/entity/projectile/EntityTippedArrow.patch

47 lines
2 KiB
Diff
Raw Normal View History

2021-03-15 23:00:00 +01:00
--- a/net/minecraft/world/entity/projectile/EntityTippedArrow.java
+++ b/net/minecraft/world/entity/projectile/EntityTippedArrow.java
@@ -142,6 +142,25 @@
}
}
+ // CraftBukkit start accessor methods
+ public void refreshEffects() {
+ this.getDataWatcher().set(EntityTippedArrow.ID_EFFECT_COLOR, PotionUtil.a((Collection) PotionUtil.a(this.potion, (Collection) this.effects)));
+ }
+
+ public String getType() {
+ return IRegistry.POTION.getKey(this.potion).toString();
+ }
+
+ public void setType(String string) {
+ this.potion = IRegistry.POTION.get(new net.minecraft.resources.MinecraftKey(string));
+ this.getDataWatcher().set(EntityTippedArrow.ID_EFFECT_COLOR, PotionUtil.a((Collection) PotionUtil.a(this.potion, (Collection) this.effects)));
+ }
+
+ public boolean isTipped() {
+ return !(this.effects.isEmpty() && this.potion == Potions.EMPTY);
+ }
+ // CraftBukkit end
+
public int getColor() {
return (Integer) this.entityData.get(EntityTippedArrow.ID_EFFECT_COLOR);
}
@@ -210,7 +229,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()), entity);
+ entityliving.addEffect(new MobEffect(mobeffect.getMobEffect(), Math.max(mobeffect.getDuration() / 8, 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isShowParticles()), entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
}
if (!this.effects.isEmpty()) {
@@ -218,7 +237,7 @@
while (iterator.hasNext()) {
mobeffect = (MobEffect) iterator.next();
- entityliving.addEffect(mobeffect, entity);
+ entityliving.addEffect(mobeffect, entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
}
}