craftbukkit/nms-patches/net/minecraft/world/entity/projectile/EntityTippedArrow.patch

47 lines
2.1 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/entity/projectile/EntityTippedArrow.java
+++ b/net/minecraft/world/entity/projectile/EntityTippedArrow.java
2021-06-11 15:00:00 +10:00
@@ -142,6 +142,25 @@
}
}
+ // CraftBukkit start accessor methods
+ public void refreshEffects() {
2021-11-22 09:00:00 +11:00
+ this.getEntityData().set(EntityTippedArrow.ID_EFFECT_COLOR, PotionUtil.getColor((Collection) PotionUtil.getAllEffects(this.potion, (Collection) this.effects)));
+ }
+
2021-11-22 09:00:00 +11:00
+ public String getPotionType() {
2022-12-08 03:00:00 +11:00
+ return BuiltInRegistries.POTION.getKey(this.potion).toString();
+ }
+
2021-11-22 09:00:00 +11:00
+ public void setPotionType(String string) {
2022-12-08 03:00:00 +11:00
+ this.potion = BuiltInRegistries.POTION.get(new net.minecraft.resources.MinecraftKey(string));
2021-11-22 09:00:00 +11:00
+ this.getEntityData().set(EntityTippedArrow.ID_EFFECT_COLOR, PotionUtil.getColor((Collection) PotionUtil.getAllEffects(this.potion, (Collection) this.effects)));
+ }
+
+ public boolean isTipped() {
2021-06-11 15:00:00 +10:00
+ return !(this.effects.isEmpty() && this.potion == Potions.EMPTY);
+ }
+ // CraftBukkit end
+
2017-05-14 12:00:00 +10:00
public int getColor() {
2021-06-11 15:00:00 +10:00
return (Integer) this.entityData.get(EntityTippedArrow.ID_EFFECT_COLOR);
}
2021-06-11 15:00:00 +10:00
@@ -210,7 +229,7 @@
while (iterator.hasNext()) {
mobeffect = (MobEffect) iterator.next();
2021-11-22 09:00:00 +11:00
- 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()) {
2021-06-11 15:00:00 +10:00
@@ -218,7 +237,7 @@
while (iterator.hasNext()) {
mobeffect = (MobEffect) iterator.next();
2021-06-11 15:00:00 +10:00
- entityliving.addEffect(mobeffect, entity);
+ entityliving.addEffect(mobeffect, entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
}
}