3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-16 19:40:07 +01:00
Paper/nms-patches/EntityTippedArrow.patch
2019-12-11 09:00:00 +11:00

47 Zeilen
2.0 KiB
Diff

--- a/net/minecraft/server/EntityTippedArrow.java
+++ b/net/minecraft/server/EntityTippedArrow.java
@@ -122,6 +122,25 @@
}
}
+ // CraftBukkit start accessor methods
+ public void refreshEffects() {
+ this.getDataWatcher().set(EntityTippedArrow.COLOR, 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.getDataWatcher().set(EntityTippedArrow.COLOR, 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.COLOR);
}
@@ -189,7 +208,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()) {
@@ -197,7 +216,7 @@
while (iterator.hasNext()) {
mobeffect = (MobEffect) iterator.next();
- entityliving.addEffect(mobeffect);
+ entityliving.addEffect(mobeffect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
}
}