Allow NPCs to push other entities
This commit is contained in:
parent
65c7e7c28c
commit
626b6d6b42
|
@ -72,7 +72,7 @@ public class ScoreboardTrait extends Trait {
|
|||
if (SUPPORT_COLLIDABLE_SETOPTION && npc.data().has(NPC.COLLIDABLE_METADATA)) {
|
||||
try {
|
||||
team.setOption(Option.COLLISION_RULE,
|
||||
(boolean) npc.data().get(NPC.COLLIDABLE_METADATA) ? OptionStatus.ALWAYS : OptionStatus.NEVER);
|
||||
npc.data().<Boolean> get(NPC.COLLIDABLE_METADATA) ? OptionStatus.ALWAYS : OptionStatus.NEVER);
|
||||
} catch (NoSuchMethodError e) {
|
||||
SUPPORT_COLLIDABLE_SETOPTION = false;
|
||||
} catch (NoClassDefFoundError e) {
|
||||
|
|
|
@ -302,6 +302,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
if (this.hurtTicks > 0) {
|
||||
this.hurtTicks -= 1;
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
cs();
|
||||
}
|
||||
tickPotionEffects();
|
||||
this.ba = this.aZ;
|
||||
this.aP = this.aO;
|
||||
|
|
|
@ -367,6 +367,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
if (this.hurtTicks > 0) {
|
||||
this.hurtTicks -= 1;
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
ct();
|
||||
}
|
||||
tickPotionEffects();
|
||||
this.aZ = this.aY;
|
||||
this.aO = this.aN;
|
||||
|
|
|
@ -393,6 +393,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
if (this.hurtTicks > 0) {
|
||||
this.hurtTicks -= 1;
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
cB();
|
||||
}
|
||||
tickPotionEffects();
|
||||
this.aZ = this.aY;
|
||||
this.aO = this.aN;
|
||||
|
|
|
@ -368,6 +368,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
if (this.hurtTicks > 0) {
|
||||
this.hurtTicks -= 1;
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
cN();
|
||||
}
|
||||
tickPotionEffects();
|
||||
this.bc = this.bb;
|
||||
this.aR = this.aQ;
|
||||
|
|
|
@ -372,6 +372,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
if (this.hurtTicks > 0) {
|
||||
this.hurtTicks -= 1;
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
collideNearby();
|
||||
}
|
||||
tickPotionEffects();
|
||||
this.aW = this.aV;
|
||||
this.aL = this.aK;
|
||||
|
|
|
@ -373,6 +373,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
if (this.hurtTicks > 0) {
|
||||
this.hurtTicks -= 1;
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
collideNearby();
|
||||
}
|
||||
tickPotionEffects();
|
||||
this.aU = this.aT;
|
||||
this.aJ = this.aI;
|
||||
|
|
|
@ -403,6 +403,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
if (this.hurtTicks > 0) {
|
||||
this.hurtTicks -= 1;
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
collideNearby();
|
||||
}
|
||||
tickPotionEffects();
|
||||
this.aM = this.aL;
|
||||
this.aB = this.aA;
|
||||
|
|
|
@ -214,6 +214,9 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||
setLastHurtByMob((LivingEntity) null);
|
||||
}
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
pushEntities();
|
||||
}
|
||||
tickEffects();
|
||||
this.animStepO = this.animStep;
|
||||
this.yBodyRotO = this.yBodyRot;
|
||||
|
|
|
@ -218,6 +218,10 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||
}
|
||||
}
|
||||
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
pushEntities();
|
||||
}
|
||||
|
||||
tickEffects();
|
||||
this.animStepO = this.animStep;
|
||||
this.yBodyRotO = this.yBodyRot;
|
||||
|
@ -375,9 +379,7 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||
|
||||
@Override
|
||||
public boolean isPushable() {
|
||||
return npc == null ? super.isPushable()
|
||||
: npc.data().has(NPC.COLLIDABLE_METADATA) ? npc.data().<Boolean> get(NPC.COLLIDABLE_METADATA)
|
||||
: !npc.isProtected();
|
||||
return npc == null ? super.isPushable() : npc.data().<Boolean> get(NPC.COLLIDABLE_METADATA, !npc.isProtected());
|
||||
}
|
||||
|
||||
private void moveOnCurrentHeading() {
|
||||
|
@ -509,8 +511,8 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||
|
||||
public void updateAI() {
|
||||
controllerMove.tick();
|
||||
controllerLook.a();
|
||||
controllerJump.b();
|
||||
controllerLook.tick();
|
||||
controllerJump.tick();
|
||||
}
|
||||
|
||||
private void updatePackets(boolean navigating) {
|
||||
|
|
|
@ -10,7 +10,7 @@ public class PlayerControllerJump {
|
|||
this.b = entityinsentient;
|
||||
}
|
||||
|
||||
public void b() {
|
||||
public void tick() {
|
||||
this.b.setJumping(this.a);
|
||||
this.a = false;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class PlayerLookControl {
|
|||
this.control = new PlayerBodyControl(this.a);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
public void tick() {
|
||||
if (!this.a.getNavigation().isDone()) {
|
||||
// TODO: use Citizens AI?
|
||||
// this.a.yHeadRot = Mth.rotateIfNecessary(this.a.yHeadRot, this.a.yBodyRot, 75);
|
||||
|
|
|
@ -311,6 +311,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||
if (this.hurtTicks > 0) {
|
||||
this.hurtTicks -= 1;
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
bL();
|
||||
}
|
||||
bi();
|
||||
this.aU = this.aT;
|
||||
this.aJ = this.aI;
|
||||
|
|
Loading…
Reference in New Issue