PaperMC/paper-server/nms-patches/net/minecraft/world/entity/projectile/EntityShulkerBullet.patch
CraftBukkit/Spigot 9ee989ea81 Update to Minecraft 1.18.2
By: md_5 <git@md-5.net>
2022-03-01 02:00:00 +11:00

54 lines
2.3 KiB
Diff

--- a/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
+++ b/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
@@ -59,8 +59,21 @@
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() {
return SoundCategory.HOSTILE;
@@ -224,7 +237,7 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
- this.onHit(movingobjectposition);
+ this.preOnHit(movingobjectposition); // CraftBukkit - projectile hit event
}
}
@@ -291,7 +304,7 @@
if (flag) {
this.doEnchantDamageEffects(entityliving, entity);
if (entity instanceof EntityLiving) {
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this));
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
}
}
@@ -317,6 +330,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);