2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/projectile/EntityTippedArrow.java
|
|
|
|
+++ b/net/minecraft/world/entity/projectile/EntityTippedArrow.java
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -142,6 +142,25 @@
|
2016-03-03 02:43:58 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // CraftBukkit start accessor methods
|
|
|
|
+ public void refreshEffects() {
|
2021-11-21 23:00:00 +01:00
|
|
|
+ this.getEntityData().set(EntityTippedArrow.ID_EFFECT_COLOR, PotionUtil.getColor((Collection) PotionUtil.getAllEffects(this.potion, (Collection) this.effects)));
|
2016-03-03 02:43:58 +01:00
|
|
|
+ }
|
|
|
|
+
|
2021-11-21 23:00:00 +01:00
|
|
|
+ public String getPotionType() {
|
2022-12-07 17:00:00 +01:00
|
|
|
+ return BuiltInRegistries.POTION.getKey(this.potion).toString();
|
2016-03-03 02:43:58 +01:00
|
|
|
+ }
|
|
|
|
+
|
2021-11-21 23:00:00 +01:00
|
|
|
+ public void setPotionType(String string) {
|
2022-12-07 17:00:00 +01:00
|
|
|
+ this.potion = BuiltInRegistries.POTION.get(new net.minecraft.resources.MinecraftKey(string));
|
2021-11-21 23:00:00 +01:00
|
|
|
+ this.getEntityData().set(EntityTippedArrow.ID_EFFECT_COLOR, PotionUtil.getColor((Collection) PotionUtil.getAllEffects(this.potion, (Collection) this.effects)));
|
2016-03-03 02:43:58 +01:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean isTipped() {
|
2021-06-11 07:00:00 +02:00
|
|
|
+ return !(this.effects.isEmpty() && this.potion == Potions.EMPTY);
|
2016-03-03 02:43:58 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
+
|
2017-05-14 04:00:00 +02:00
|
|
|
public int getColor() {
|
2021-06-11 07:00:00 +02:00
|
|
|
return (Integer) this.entityData.get(EntityTippedArrow.ID_EFFECT_COLOR);
|
2016-03-03 02:43:58 +01:00
|
|
|
}
|
2023-03-14 17:30:00 +01:00
|
|
|
@@ -212,7 +231,7 @@
|
2018-07-20 08:04:37 +02:00
|
|
|
mobeffect = (MobEffect) iterator.next();
|
2023-03-14 17:30:00 +01:00
|
|
|
entityliving.addEffect(new MobEffect(mobeffect.getEffect(), Math.max(mobeffect.mapDuration((i) -> {
|
|
|
|
return i / 8;
|
|
|
|
- }), 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity);
|
|
|
|
+ }), 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
|
2018-07-20 08:04:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.effects.isEmpty()) {
|
2023-03-14 17:30:00 +01:00
|
|
|
@@ -220,7 +239,7 @@
|
2018-07-20 08:04:37 +02:00
|
|
|
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
mobeffect = (MobEffect) iterator.next();
|
2021-06-11 07:00:00 +02:00
|
|
|
- entityliving.addEffect(mobeffect, entity);
|
|
|
|
+ entityliving.addEffect(mobeffect, entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
|
2018-07-20 08:04:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|