move anonymous overrides into witherskull class

This commit is contained in:
granny
2023-06-20 17:08:25 -07:00
parent ffab9f8e45
commit d22455b2a3
8 changed files with 54 additions and 43 deletions

View File

@@ -2950,7 +2950,7 @@ index 92666c48620078623a451fbf68f673cb9f81c4b5..5a2eb6775ecb3b01fd136c796258395b
this.dragonFight.updateDragon(this);
}
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
index f69e0b11be74ac83694f59999b3f07a318410c19..2a8f6b1fb7f3aac3100e5dc9ee64c53c0edd165b 100644
index f69e0b11be74ac83694f59999b3f07a318410c19..10da1bc9374a4178a38dd101bf173a77216101fa 100644
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -84,16 +84,30 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
@@ -2985,7 +2985,7 @@ index f69e0b11be74ac83694f59999b3f07a318410c19..2a8f6b1fb7f3aac3100e5dc9ee64c53c
this.setHealth(this.getMaxHealth());
this.xpReward = 50;
}
@@ -108,13 +122,119 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
@@ -108,13 +122,113 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
return navigationflying;
}
@@ -3081,13 +3081,7 @@ index f69e0b11be74ac83694f59999b3f07a318410c19..2a8f6b1fb7f3aac3100e5dc9ee64c53c
+ double headX = getHeadX(head);
+ double headY = getHeadY(head);
+ double headZ = getHeadZ(head);
+ WitherSkull skull = new WitherSkull(level(), this, x - headX, y - headY, z - headZ) {
+ @Override
+ public boolean canHitEntity(Entity target) {
+ // do not hit rider
+ return target != rider && super.canHitEntity(target);
+ }
+ };
+ WitherSkull skull = new WitherSkull(level(), this, x - headX, y - headY, z - headZ);
+ skull.setPosRaw(headX, headY, headZ);
+ level().addFreshEntity(skull);
+ }
@@ -3105,7 +3099,7 @@ index f69e0b11be74ac83694f59999b3f07a318410c19..2a8f6b1fb7f3aac3100e5dc9ee64c53c
this.targetSelector.addGoal(1, new HurtByTargetGoal(this, new Class[0]));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, LivingEntity.class, 0, false, false, WitherBoss.LIVING_ENTITY_SELECTOR));
}
@@ -256,6 +376,16 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
@@ -256,6 +370,16 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
@Override
protected void customServerAiStep() {
@@ -3122,7 +3116,7 @@ index f69e0b11be74ac83694f59999b3f07a318410c19..2a8f6b1fb7f3aac3100e5dc9ee64c53c
int i;
if (this.getInvulnerableTicks() > 0) {
@@ -576,11 +706,11 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
@@ -576,11 +700,11 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
}
public int getAlternativeTarget(int headIndex) {
@@ -5182,6 +5176,23 @@ index cc0a3d9794d05b6bc6ab05f4f2ab8d83134b181d..e1f918d0bd2a70db1aba8bda8717149f
Vec3 vec3 = pos.add(velocity);
HitResult hitResult = world.clip(new ClipContext(pos, vec3, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, entity));
if (hitResult.getType() != HitResult.Type.MISS) {
diff --git a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
index 80b86d5dd68c3d288a1a61ea8aa1cba9d899aa1c..71916a0e55f12a2cbb2bee85ededd15126e1c451 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java
@@ -107,6 +107,12 @@ public class WitherSkull extends AbstractHurtingProjectile {
}
+ @Override
+ public boolean canHitEntity(Entity target) {
+ // do not hit rider
+ return target != this.getRider() && super.canHitEntity(target);
+ }
+
@Override
public boolean isPickable() {
return false;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index fc0dc8e607cc24020106ea1af92b4421a5f9393d..7d744d5b6a9e593e657233b2192f2837bf360deb 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java