Override teleport method in Shulker rather than blocking tick

This commit is contained in:
fullwall 2024-03-03 18:07:25 +08:00
parent 40c6b4b85e
commit a24064ddae
11 changed files with 68 additions and 42 deletions

View File

@ -155,10 +155,9 @@ public class ShulkerController extends MobEntityController {
@Override @Override
public void m() { public void m() {
super.m();
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else {
super.m();
} }
} }
@ -177,6 +176,11 @@ public class ShulkerController extends MobEntityController {
} }
} }
@Override
protected boolean o() {
return npc == null || npc.useMinecraftAI() ? super.o() : false;
}
@Override @Override
protected EntityAIBodyControl s() { protected EntityAIBodyControl s() {
return npc == null ? super.s() : new EntityAIBodyControl(this); return npc == null ? super.s() : new EntityAIBodyControl(this);

View File

@ -66,10 +66,9 @@ public class ShulkerController extends MobEntityController {
@Override @Override
public void A_() { public void A_() {
super.A_();
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else {
super.A_();
} }
} }
@ -177,6 +176,11 @@ public class ShulkerController extends MobEntityController {
} }
} }
@Override
protected boolean o() {
return npc == null || npc.useMinecraftAI() ? super.o() : false;
}
@Override @Override
protected EntityAIBodyControl s() { protected EntityAIBodyControl s() {
return npc == null ? super.s() : new EntityAIBodyControl(this); return npc == null ? super.s() : new EntityAIBodyControl(this);

View File

@ -77,10 +77,9 @@ public class ShulkerController extends MobEntityController {
@Override @Override
public void B_() { public void B_() {
super.B_();
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else {
super.B_();
} }
} }
@ -184,6 +183,11 @@ public class ShulkerController extends MobEntityController {
} }
} }
@Override
protected boolean p() {
return npc == null || npc.useMinecraftAI() ? super.p() : false;
}
@Override @Override
protected EntityAIBodyControl s() { protected EntityAIBodyControl s() {
return npc == null ? super.s() : new EntityAIBodyControl(this); return npc == null ? super.s() : new EntityAIBodyControl(this);

View File

@ -182,6 +182,11 @@ public class ShulkerController extends MobEntityController {
return NMSImpl.isLeashed(npc, super::isLeashed, this); return NMSImpl.isLeashed(npc, super::isLeashed, this);
} }
@Override
protected boolean l() {
return npc == null || npc.useMinecraftAI() ? super.l() : false;
}
@Override @Override
public void movementTick() { public void movementTick() {
if (npc == null) { if (npc == null) {
@ -220,18 +225,17 @@ public class ShulkerController extends MobEntityController {
@Override @Override
public void tick() { public void tick() {
super.tick();
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else {
super.tick();
} }
} }
@Override @Override
public boolean z_() { public boolean z_() {
if (npc == null || !npc.isFlyable()) if (npc == null || !npc.isFlyable()) {
return super.z_(); return super.z_();
else } else
return false; return false;
} }

View File

@ -186,6 +186,11 @@ public class ShulkerController extends MobEntityController {
return NMSImpl.isLeashed(npc, super::isLeashed, this); return NMSImpl.isLeashed(npc, super::isLeashed, this);
} }
@Override
protected boolean l() {
return npc == null || npc.useMinecraftAI() ? super.l() : false;
}
@Override @Override
public void movementTick() { public void movementTick() {
if (npc == null) { if (npc == null) {
@ -207,10 +212,9 @@ public class ShulkerController extends MobEntityController {
@Override @Override
public void tick() { public void tick() {
super.tick();
if (npc != null) { if (npc != null) {
npc.update(); npc.update();
} else {
super.tick();
} }
} }

View File

@ -187,6 +187,11 @@ public class ShulkerController extends MobEntityController {
return NMSImpl.isLeashed(npc, super::isLeashed, this); return NMSImpl.isLeashed(npc, super::isLeashed, this);
} }
@Override
protected boolean l() {
return npc == null || npc.useMinecraftAI() ? super.l() : false;
}
@Override @Override
public void movementTick() { public void movementTick() {
if (npc == null || npc.useMinecraftAI()) { if (npc == null || npc.useMinecraftAI()) {
@ -208,14 +213,10 @@ public class ShulkerController extends MobEntityController {
@Override @Override
public void tick() { public void tick() {
super.tick();
if (npc != null) { if (npc != null) {
NMSImpl.updateMinecraftAIState(npc, this); NMSImpl.updateMinecraftAIState(npc, this);
if (npc.useMinecraftAI()) {
super.tick();
}
npc.update(); npc.update();
} else {
super.tick();
} }
} }

View File

@ -124,6 +124,11 @@ public class ShulkerController extends MobEntityController {
return NMS.getJumpPower(npc, super.dJ()); return NMS.getJumpPower(npc, super.dJ());
} }
@Override
protected boolean eK() {
return npc == null || npc.useMinecraftAI() ? super.eK() : false;
}
@Override @Override
public void g(Vec3D vec3d) { public void g(Vec3D vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -208,14 +213,10 @@ public class ShulkerController extends MobEntityController {
@Override @Override
public void tick() { public void tick() {
super.tick();
if (npc != null) { if (npc != null) {
NMSImpl.updateMinecraftAIState(npc, this); NMSImpl.updateMinecraftAIState(npc, this);
if (npc.useMinecraftAI()) {
super.tick();
}
npc.update(); npc.update();
} else {
super.tick();
} }
} }

View File

@ -199,16 +199,17 @@ public class ShulkerController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
protected boolean teleportSomewhere() {
return npc == null || npc.useMinecraftAI() ? super.teleportSomewhere() : false;
}
@Override @Override
public void tick() { public void tick() {
super.tick();
if (npc != null) { if (npc != null) {
NMSImpl.updateMinecraftAIState(npc, this); NMSImpl.updateMinecraftAIState(npc, this);
if (npc.useMinecraftAI()) {
super.tick();
}
npc.update(); npc.update();
} else {
super.tick();
} }
} }

View File

@ -200,6 +200,11 @@ public class ShulkerController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
protected boolean teleportSomewhere() {
return npc == null || npc.useMinecraftAI() ? super.teleportSomewhere() : false;
}
@Override @Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) { public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null) if (npc == null)
@ -209,14 +214,10 @@ public class ShulkerController extends MobEntityController {
@Override @Override
public void tick() { public void tick() {
super.tick();
if (npc != null) { if (npc != null) {
NMSImpl.updateMinecraftAIState(npc, this); NMSImpl.updateMinecraftAIState(npc, this);
if (npc.useMinecraftAI()) {
super.tick();
}
npc.update(); npc.update();
} else {
super.tick();
} }
} }

View File

@ -201,6 +201,11 @@ public class ShulkerController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
protected boolean teleportSomewhere() {
return npc == null || npc.useMinecraftAI() ? super.teleportSomewhere() : false;
}
@Override @Override
public Entity teleportTo(ServerLevel worldserver, PositionImpl location) { public Entity teleportTo(ServerLevel worldserver, PositionImpl location) {
if (npc == null) if (npc == null)
@ -210,14 +215,10 @@ public class ShulkerController extends MobEntityController {
@Override @Override
public void tick() { public void tick() {
super.tick();
if (npc != null) { if (npc != null) {
NMSImpl.updateMinecraftAIState(npc, this); NMSImpl.updateMinecraftAIState(npc, this);
if (npc.useMinecraftAI()) {
super.tick();
}
npc.update(); npc.update();
} else {
super.tick();
} }
} }

View File

@ -200,6 +200,11 @@ public class ShulkerController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
protected boolean teleportSomewhere() {
return npc == null || npc.useMinecraftAI() ? super.teleportSomewhere() : false;
}
@Override @Override
public Entity teleportTo(ServerLevel worldserver, Vec3 location) { public Entity teleportTo(ServerLevel worldserver, Vec3 location) {
if (npc == null) if (npc == null)
@ -209,14 +214,10 @@ public class ShulkerController extends MobEntityController {
@Override @Override
public void tick() { public void tick() {
super.tick();
if (npc != null) { if (npc != null) {
NMSImpl.updateMinecraftAIState(npc, this); NMSImpl.updateMinecraftAIState(npc, this);
if (npc.useMinecraftAI()) {
super.tick();
}
npc.update(); npc.update();
} else {
super.tick();
} }
} }