Skip to content

Commit

Permalink
More ender dragon fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Mar 29, 2023
1 parent efff2ff commit d8b7a37
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 20 deletions.
Expand Up @@ -108,7 +108,7 @@ protected boolean dealDamage(DamageSource source, float f) {

Vec3D old = new Vec3D(motX, motY, motZ);
boolean res = super.dealDamage(source, f);
if (getDragonControllerManager().a() == DragonControllerPhase.k) {
if (getDragonControllerManager().a().getControllerPhase() == DragonControllerPhase.k) {
motX = old.x;
motY = old.y;
motZ = old.z;
Expand Down Expand Up @@ -158,7 +158,11 @@ public void n() {
if (npc != null) {
npc.update();
}
if (npc != null && getHealth() > 0) {
if (npc != null) {
if (getDragonControllerManager().a().getControllerPhase() == DragonControllerPhase.j) {
setHealth(0F);
return;
}
if (this.c < 0) {
for (int i = 0; i < this.b.length; ++i) {
this.b[i][0] = this.yaw;
Expand Down
Expand Up @@ -108,7 +108,7 @@ protected boolean dealDamage(DamageSource source, float f) {

Vec3D old = new Vec3D(motX, motY, motZ);
boolean res = super.dealDamage(source, f);
if (getDragonControllerManager().a() == DragonControllerPhase.k) {
if (getDragonControllerManager().a().getControllerPhase() == DragonControllerPhase.k) {
motX = old.x;
motY = old.y;
motZ = old.z;
Expand Down Expand Up @@ -159,7 +159,11 @@ public void n() {
if (npc != null) {
npc.update();
}
if (npc != null && getHealth() > 0) {
if (npc != null) {
if (getDragonControllerManager().a().getControllerPhase() == DragonControllerPhase.j) {
setHealth(0F);
return;
}
if (this.c < 0) {
for (int i = 0; i < this.b.length; ++i) {
this.b[i][0] = this.yaw;
Expand Down
Expand Up @@ -108,7 +108,7 @@ protected boolean dealDamage(DamageSource source, float f) {

Vec3D old = new Vec3D(motX, motY, motZ);
boolean res = super.dealDamage(source, f);
if (getDragonControllerManager().a() == DragonControllerPhase.k) {
if (getDragonControllerManager().a().getControllerPhase() == DragonControllerPhase.k) {
motX = old.x;
motY = old.y;
motZ = old.z;
Expand Down Expand Up @@ -159,7 +159,11 @@ public void n() {
if (npc != null) {
npc.update();
}
if (npc != null && getHealth() > 0) {
if (npc != null) {
if (getDragonControllerManager().a().getControllerPhase() == DragonControllerPhase.j) {
setHealth(0F);
return;
}
if (this.c < 0) {
for (int i = 0; i < this.b.length; ++i) {
this.b[i][0] = this.yaw;
Expand Down
Expand Up @@ -124,7 +124,7 @@ protected boolean dealDamage(DamageSource source, float f) {

Vec3D old = new Vec3D(motX, motY, motZ);
boolean res = super.dealDamage(source, f);
if (getDragonControllerManager().a() == DragonControllerPhase.HOVER) {
if (getDragonControllerManager().a().getControllerPhase() == DragonControllerPhase.HOVER) {
motX = old.x;
motY = old.y;
motZ = old.z;
Expand Down Expand Up @@ -170,7 +170,11 @@ public void movementTick() {
if (npc != null) {
npc.update();
}
if (npc != null && getHealth() > 0) {
if (npc != null) {
if (getDragonControllerManager().a().getControllerPhase() == DragonControllerPhase.DYING) {
setHealth(0F);
return;
}
if (this.c < 0) {
for (int i = 0; i < this.b.length; ++i) {
this.b[i][0] = this.yaw;
Expand Down
Expand Up @@ -115,7 +115,7 @@ protected boolean dealDamage(DamageSource source, float f) {

Vec3D old = getMot();
boolean res = super.dealDamage(source, f);
if (getDragonControllerManager().a() == DragonControllerPhase.HOVER) {
if (getDragonControllerManager().a().getControllerPhase() == DragonControllerPhase.HOVER) {
setMot(old);
}
return res;
Expand Down Expand Up @@ -167,7 +167,11 @@ public void movementTick() {
if (npc != null) {
npc.update();
}
if (npc != null && getHealth() > 0) {
if (npc != null) {
if (getDragonControllerManager().a().getControllerPhase() == DragonControllerPhase.DYING) {
setHealth(0F);
return;
}
if (this.d < 0) {
for (int i = 0; i < this.c.length; ++i) {
this.c[i][0] = this.yaw;
Expand Down
Expand Up @@ -108,7 +108,7 @@ protected boolean dealDamage(DamageSource source, float f) {

Vec3D old = getMot();
boolean res = super.dealDamage(source, f);
if (getDragonControllerManager().a() == DragonControllerPhase.HOVER) {
if (getDragonControllerManager().a().getControllerPhase() == DragonControllerPhase.HOVER) {
setMot(old);
}
return res;
Expand Down Expand Up @@ -161,7 +161,11 @@ public void movementTick() {
npc.update();
NMSImpl.updateMinecraftAIState(npc, this);
}
if (npc != null && !npc.useMinecraftAI() && getHealth() > 0) {
if (npc != null && !npc.useMinecraftAI()) {
if (getDragonControllerManager().a().getControllerPhase() == DragonControllerPhase.DYING) {
setHealth(0F);
return;
}
if (this.d < 0) {
for (int i = 0; i < this.c.length; ++i) {
this.c[i][0] = this.yaw;
Expand Down
Expand Up @@ -108,7 +108,7 @@ protected boolean dealDamage(DamageSource source, float f) {

Vec3D old = getMot();
boolean res = super.dealDamage(source, f);
if (getDragonControllerManager().a() == DragonControllerPhase.HOVER) {
if (getDragonControllerManager().a().getControllerPhase() == DragonControllerPhase.HOVER) {
setMot(old);
}
return res;
Expand Down Expand Up @@ -161,7 +161,11 @@ public void movementTick() {
npc.update();
NMSImpl.updateMinecraftAIState(npc, this);
}
if (npc != null && !npc.useMinecraftAI() && !dl()) {
if (npc != null && !npc.useMinecraftAI()) {
if (dl()) {
setHealth(0F);
return;
}
if (this.d < 0) {
for (int i = 0; i < this.c.length; ++i) {
this.c[i][0] = this.yaw;
Expand Down
Expand Up @@ -64,7 +64,11 @@ public void aiStep() {
npc.update();
NMSImpl.updateMinecraftAIState(npc, this);
}
if (npc != null && !npc.useMinecraftAI() && !isDeadOrDying()) {
if (npc != null && !npc.useMinecraftAI()) {
if (isDeadOrDying()) {
setHealth(0F);
return;
}
if (this.posPointer < 0) {
for (int i = 0; i < this.positions.length; ++i) {
this.positions[i][0] = this.getYRot();
Expand Down Expand Up @@ -214,7 +218,7 @@ protected boolean reallyHurt(DamageSource source, float f) {

Vec3 old = getDeltaMovement();
boolean res = super.reallyHurt(source, f);
if (getPhaseManager().getCurrentPhase() == EnderDragonPhase.HOVERING) {
if (getPhaseManager().getCurrentPhase().getPhase() == EnderDragonPhase.HOVERING) {
setDeltaMovement(old);
}
return res;
Expand Down
Expand Up @@ -66,7 +66,11 @@ public void aiStep() {
npc.update();
NMSImpl.updateMinecraftAIState(npc, this);
}
if (npc != null && !npc.useMinecraftAI() && !isDeadOrDying()) {
if (npc != null && !npc.useMinecraftAI()) {
if (isDeadOrDying()) {
setHealth(0F);
return;
}
if (this.posPointer < 0) {
for (int i = 0; i < this.positions.length; ++i) {
this.positions[i][0] = this.getYRot();
Expand Down Expand Up @@ -216,7 +220,7 @@ protected boolean reallyHurt(DamageSource source, float f) {

Vec3 old = getDeltaMovement();
boolean res = super.reallyHurt(source, f);
if (getPhaseManager().getCurrentPhase() == EnderDragonPhase.HOVERING) {
if (getPhaseManager().getCurrentPhase().getPhase() == EnderDragonPhase.HOVERING) {
setDeltaMovement(old);
}
return res;
Expand Down
Expand Up @@ -67,7 +67,11 @@ public void aiStep() {
npc.update();

}
if (npc != null && !npc.useMinecraftAI() && !isDeadOrDying()) {
if (npc != null && !npc.useMinecraftAI()) {
if (isDeadOrDying()) {
setHealth(0F);
return;
}
if (this.posPointer < 0) {
for (int i = 0; i < this.positions.length; ++i) {
this.positions[i][0] = this.getYRot();
Expand Down Expand Up @@ -218,7 +222,7 @@ protected boolean reallyHurt(DamageSource source, float f) {

Vec3 old = getDeltaMovement();
boolean res = super.reallyHurt(source, f);
if (getPhaseManager().getCurrentPhase() == EnderDragonPhase.HOVERING) {
if (getPhaseManager().getCurrentPhase().getPhase() == EnderDragonPhase.HOVERING) {
setDeltaMovement(old);
}
return res;
Expand Down

0 comments on commit d8b7a37

Please sign in to comment.