--- a/net/minecraft/world/entity/projectile/EntityShulkerBullet.java +++ b/net/minecraft/world/entity/projectile/EntityShulkerBullet.java @@ -60,7 +60,20 @@ this.finalTarget = entity; this.currentMoveDirection = EnumDirection.UP; this.selectNextMoveDirection(enumdirection_enumaxis); + projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit + } + + // CraftBukkit start + public Entity getTarget() { + return this.finalTarget; + } + + public void setTarget(Entity e) { + this.finalTarget = e; + this.currentMoveDirection = EnumDirection.UP; + this.selectNextMoveDirection(EnumDirection.EnumAxis.X); } + // CraftBukkit end @Override public SoundCategory getSoundSource() { @@ -225,7 +238,7 @@ MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity); if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { - this.onHit(movingobjectposition); + this.preOnHit(movingobjectposition); // CraftBukkit - projectile hit event } } @@ -294,7 +307,7 @@ if (entity instanceof EntityLiving) { EntityLiving entityliving1 = (EntityLiving) entity; - entityliving1.addEffect(new MobEffect(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this)); + entityliving1.addEffect(new MobEffect(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit } } @@ -325,6 +338,11 @@ @Override public boolean hurt(DamageSource damagesource, float f) { + // CraftBukkit start + if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false)) { + return false; + } + // CraftBukkit end if (!this.level().isClientSide) { this.playSound(SoundEffects.SHULKER_BULLET_HURT, 1.0F, 1.0F); ((WorldServer) this.level()).sendParticles(Particles.CRIT, this.getX(), this.getY(), this.getZ(), 15, 0.2D, 0.2D, 0.2D, 0.0D);