PaperMC/paper-server/nms-patches/net/minecraft/world/entity/projectile/EntityTippedArrow.patch
CraftBukkit/Spigot 43702a9e10 Update to Minecraft 1.18-pre5
By: md_5 <git@md-5.net>
2021-11-22 09:00:00 +11:00

46 lines
2.1 KiB
Diff

--- 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.getEntityData().set(EntityTippedArrow.ID_EFFECT_COLOR, PotionUtil.getColor((Collection) PotionUtil.getAllEffects(this.potion, (Collection) this.effects)));
+ }
+
+ public String getPotionType() {
+ return IRegistry.POTION.getKey(this.potion).toString();
+ }
+
+ public void setPotionType(String string) {
+ this.potion = IRegistry.POTION.get(new net.minecraft.resources.MinecraftKey(string));
+ this.getEntityData().set(EntityTippedArrow.ID_EFFECT_COLOR, PotionUtil.getColor((Collection) PotionUtil.getAllEffects(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.getEffect(), Math.max(mobeffect.getDuration() / 8, 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity);
+ entityliving.addEffect(new MobEffect(mobeffect.getEffect(), Math.max(mobeffect.getDuration() / 8, 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), 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
}
}