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

46 lines
1.7 KiB
Diff
Raw Normal View History

2021-03-15 23:00:00 +01:00
--- a/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
+++ b/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
@@ -58,8 +58,21 @@
this.target = entity;
this.dir = EnumDirection.UP;
this.a(enumdirection_enumaxis);
+ projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
}
+ // CraftBukkit start
+ public Entity getTarget() {
+ return this.target;
+ }
+
+ public void setTarget(Entity e) {
+ this.target = e;
+ this.dir = EnumDirection.UP;
+ this.a(EnumDirection.EnumAxis.X);
+ }
+ // CraftBukkit end
+
@Override
public SoundCategory getSoundCategory() {
return SoundCategory.HOSTILE;
2021-03-15 23:00:00 +01:00
@@ -280,7 +293,7 @@
if (flag) {
this.a(entityliving, entity);
if (entity instanceof EntityLiving) {
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.LEVITATION, 200));
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.LEVITATION, 200), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
}
}
2021-03-15 23:00:00 +01:00
@@ -306,6 +319,11 @@
@Override
public boolean damageEntity(DamageSource damagesource, float f) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false)) {
+ return false;
+ }
+ // CraftBukkit end
if (!this.world.isClientSide) {
this.playSound(SoundEffects.ENTITY_SHULKER_BULLET_HURT, 1.0F, 1.0F);
((WorldServer) this.world).a(Particles.CRIT, this.locX(), this.locY(), this.locZ(), 15, 0.2D, 0.2D, 0.2D, 0.0D);