--- a/net/minecraft/world/entity/projectile/ShulkerBullet.java +++ b/net/minecraft/world/entity/projectile/ShulkerBullet.java @@ -59,9 +59,22 @@ this.moveTo(d0, d1, d2, this.getYRot(), this.getXRot()); this.finalTarget = entity; this.currentMoveDirection = Direction.UP; - this.selectNextMoveDirection(direction_axis); + this.selectNextMoveDirection(axis); + projectileSource = (org.bukkit.entity.LivingEntity) shooter.getBukkitEntity(); // CraftBukkit } + // CraftBukkit start + public Entity getTarget() { + return this.finalTarget; + } + + public void setTarget(Entity e) { + this.finalTarget = e; + this.currentMoveDirection = Direction.UP; + this.selectNextMoveDirection(Direction.Axis.X); + } + // CraftBukkit end + @Override @Override public SoundSource getSoundSource() { @@ -230,8 +237,8 @@ HitResult hitresult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); - if (hitresult.getType() != HitResult.Type.MISS) { - this.onHit(hitresult); + if (movingobjectposition.getType() != HitResult.EnumMovingObjectType.MISS) { + this.preOnHit(movingobjectposition); // CraftBukkit - projectile hit event } } @@ -305,7 +307,7 @@ if (entity instanceof LivingEntity) { LivingEntity livingentity1 = (LivingEntity) entity; - livingentity1.addEffect(new MobEffectInstance(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this)); + entityliving1.addEffect(new MobEffectInstance(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit } } @@ -338,8 +337,12 @@ } @Override - @Override - public boolean hurt(DamageSource damagesource, float f) { + public boolean hurt(DamageSource source, float amount) { + // CraftBukkit start + if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, source, amount, false)) { + return false; + } + // CraftBukkit end if (!this.level().isClientSide) { this.playSound(SoundEvents.SHULKER_BULLET_HURT, 1.0F, 1.0F); ((ServerLevel) this.level()).sendParticles(ParticleTypes.CRIT, this.getX(), this.getY(), this.getZ(), 15, 0.2D, 0.2D, 0.2D, 0.0D);