1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
--- 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);
|