Add setSpeed calls to fix armorstand not working with movecontrol

This commit is contained in:
fullwall 2024-10-19 20:01:27 +08:00
parent 78f7ee15a4
commit 2247a81150
26 changed files with 32 additions and 5 deletions

View File

@ -61,6 +61,7 @@ public class ArmorStandController extends MobEntityController {
public EntityArmorStandNPC(World world, NPC npc) { public EntityArmorStandNPC(World world, NPC npc) {
super(world); super(world);
this.npc = (CitizensNPC) npc; this.npc = (CitizensNPC) npc;
NMS.setStepHeight(getBukkitEntity(), 1);
} }
@Override @Override

View File

@ -82,6 +82,7 @@ public class PlayerControllerMove extends ControllerMove {
this.a.yaw = a(this.a.yaw, f, 90.0F); this.a.yaw = a(this.a.yaw, f, 90.0F);
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw); NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
this.a.bg = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue()); this.a.bg = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
this.a.l(this.a.bg);
if (a instanceof EntitySlime && h-- <= 0) { if (a instanceof EntitySlime && h-- <= 0) {
this.h = new Random().nextInt(20) + 10; this.h = new Random().nextInt(20) + 10;
this.h /= 3; this.h /= 3;

View File

@ -59,6 +59,7 @@ public class ArmorStandController extends MobEntityController {
public EntityArmorStandNPC(World world, NPC npc) { public EntityArmorStandNPC(World world, NPC npc) {
super(world); super(world);
this.npc = (CitizensNPC) npc; this.npc = (CitizensNPC) npc;
NMS.setStepHeight(getBukkitEntity(), 1);
} }
@Override @Override

View File

@ -84,6 +84,7 @@ public class PlayerControllerMove extends ControllerMove {
this.a.yaw = a(this.a.yaw, f, 90.0F); this.a.yaw = a(this.a.yaw, f, 90.0F);
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw); NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
this.a.bf = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue()); this.a.bf = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
this.a.l(this.a.bf);
if (a instanceof EntitySlime && h-- <= 0) { if (a instanceof EntitySlime && h-- <= 0) {
this.h = new Random().nextInt(20) + 10; this.h = new Random().nextInt(20) + 10;
this.h /= 3; this.h /= 3;

View File

@ -60,6 +60,7 @@ public class ArmorStandController extends MobEntityController {
public EntityArmorStandNPC(World world, NPC npc) { public EntityArmorStandNPC(World world, NPC npc) {
super(world); super(world);
this.npc = (CitizensNPC) npc; this.npc = (CitizensNPC) npc;
NMS.setStepHeight(getBukkitEntity(), 1);
} }
@Override @Override

View File

@ -47,6 +47,7 @@ public class PlayerControllerMove extends ControllerMove {
this.a.yaw = a(this.a.yaw, f, 90.0F); this.a.yaw = a(this.a.yaw, f, 90.0F);
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw); NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
this.a.bg = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue()); this.a.bg = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
this.a.k(this.a.bg);
if (a instanceof EntitySlime && h-- <= 0) { if (a instanceof EntitySlime && h-- <= 0) {
this.h = new Random().nextInt(20) + 10; this.h = new Random().nextInt(20) + 10;
this.h /= 3; this.h /= 3;

View File

@ -62,6 +62,7 @@ public class ArmorStandController extends MobEntityController {
public EntityArmorStandNPC(World world, NPC npc) { public EntityArmorStandNPC(World world, NPC npc) {
super(world); super(world);
this.npc = (CitizensNPC) npc; this.npc = (CitizensNPC) npc;
NMS.setStepHeight(getBukkitEntity(), 1);
} }
@Override @Override

View File

@ -49,6 +49,7 @@ public class PlayerControllerMove extends ControllerMove {
this.a.yaw = a(this.a.yaw, f, 90.0F); this.a.yaw = a(this.a.yaw, f, 90.0F);
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw); NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
this.a.bj = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue()); this.a.bj = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
this.a.o(this.a.bj);
if (a instanceof EntitySlime && h-- <= 0) { if (a instanceof EntitySlime && h-- <= 0) {
this.h = new Random().nextInt(20) + 10; this.h = new Random().nextInt(20) + 10;
this.h /= 3; this.h /= 3;

View File

@ -64,6 +64,7 @@ public class ArmorStandController extends MobEntityController {
public EntityArmorStandNPC(EntityTypes<? extends EntityArmorStand> types, World world, NPC npc) { public EntityArmorStandNPC(EntityTypes<? extends EntityArmorStand> types, World world, NPC npc) {
super(types, world); super(types, world);
this.npc = (CitizensNPC) npc; this.npc = (CitizensNPC) npc;
NMS.setStepHeight(getBukkitEntity(), 1);
} }
@Override @Override

View File

@ -48,6 +48,7 @@ public class PlayerControllerMove extends ControllerMove {
this.a.yaw = a(this.a.yaw, f, 90.0F); this.a.yaw = a(this.a.yaw, f, 90.0F);
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw); NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
this.a.bd = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getBaseValue()); this.a.bd = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getBaseValue());
this.a.o(this.a.bd);
if (a instanceof EntitySlime && h-- <= 0) { if (a instanceof EntitySlime && h-- <= 0) {
this.h = new Random().nextInt(20) + 10; this.h = new Random().nextInt(20) + 10;
this.h /= 3; this.h /= 3;

View File

@ -57,6 +57,7 @@ public class ArmorStandController extends MobEntityController {
public EntityArmorStandNPC(EntityTypes<? extends EntityArmorStand> types, World world, NPC npc) { public EntityArmorStandNPC(EntityTypes<? extends EntityArmorStand> types, World world, NPC npc) {
super(types, world); super(types, world);
this.npc = (CitizensNPC) npc; this.npc = (CitizensNPC) npc;
NMS.setStepHeight(getBukkitEntity(), 1);
} }
@Override @Override

View File

@ -48,6 +48,7 @@ public class PlayerControllerMove extends ControllerMove {
this.a.yaw = a(this.a.yaw, f, 90.0F); this.a.yaw = a(this.a.yaw, f, 90.0F);
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw); NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
this.a.bb = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getBaseValue()); this.a.bb = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getBaseValue());
this.a.o(this.a.bb);
if (a instanceof EntitySlime && h-- <= 0) { if (a instanceof EntitySlime && h-- <= 0) {
this.h = new Random().nextInt(20) + 10; this.h = new Random().nextInt(20) + 10;
this.h /= 3; this.h /= 3;

View File

@ -50,8 +50,8 @@ public class ArmorStandController extends MobEntityController {
public static class EntityArmorStandNPC extends EntityArmorStand implements NPCHolder, ForwardingMobAI { public static class EntityArmorStandNPC extends EntityArmorStand implements NPCHolder, ForwardingMobAI {
private MobAI ai; private MobAI ai;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityArmorStandNPC(EntityTypes<? extends EntityArmorStand> types, World world) { public EntityArmorStandNPC(EntityTypes<? extends EntityArmorStand> types, World world) {
this(types, world, null); this(types, world, null);
} }
@ -61,6 +61,7 @@ public class ArmorStandController extends MobEntityController {
this.npc = (CitizensNPC) npc; this.npc = (CitizensNPC) npc;
if (npc != null) { if (npc != null) {
ai = new BasicMobAI(this); ai = new BasicMobAI(this);
NMS.setStepHeight(getBukkitEntity(), 1);
} }
} }

View File

@ -49,6 +49,7 @@ public class EntityMoveControl extends ControllerMove {
this.a.yaw = a(this.a.yaw, f, 90.0F); this.a.yaw = a(this.a.yaw, f, 90.0F);
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw); NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
this.a.aT = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getBaseValue()); this.a.aT = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getBaseValue());
this.a.q(this.a.aT);
if (a instanceof EntitySlime && h-- <= 0) { if (a instanceof EntitySlime && h-- <= 0) {
this.h = new Random().nextInt(20) + 10; this.h = new Random().nextInt(20) + 10;
if (((EntitySlime) a).isAggressive()) { if (((EntitySlime) a).isAggressive()) {

View File

@ -49,8 +49,8 @@ public class ArmorStandController extends MobEntityController {
public static class EntityArmorStandNPC extends ArmorStand implements NPCHolder, ForwardingMobAI { public static class EntityArmorStandNPC extends ArmorStand implements NPCHolder, ForwardingMobAI {
private MobAI ai; private MobAI ai;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityArmorStandNPC(EntityType<? extends ArmorStand> types, Level level) { public EntityArmorStandNPC(EntityType<? extends ArmorStand> types, Level level) {
this(types, level, null); this(types, level, null);
} }
@ -60,6 +60,7 @@ public class ArmorStandController extends MobEntityController {
this.npc = (CitizensNPC) npc; this.npc = (CitizensNPC) npc;
if (ai != null) { if (ai != null) {
ai = new BasicMobAI(this); ai = new BasicMobAI(this);
NMS.setStepHeight(getBukkitEntity(), 1);
} }
} }

View File

@ -109,6 +109,7 @@ public class EntityMoveControl extends MoveControl {
NMS.setHeadYaw(entity.getBukkitEntity(), entity.getYRot()); NMS.setHeadYaw(entity.getBukkitEntity(), entity.getYRot());
} }
this.entity.zza = (float) (this.speed * entity.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue()); this.entity.zza = (float) (this.speed * entity.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue());
this.entity.setSpeed(this.entity.zza);
if (entity instanceof Slime && jumpTicks-- <= 0) { if (entity instanceof Slime && jumpTicks-- <= 0) {
this.jumpTicks = new Random().nextInt(20) + 10; this.jumpTicks = new Random().nextInt(20) + 10;
if (((Slime) entity).isAggressive()) { if (((Slime) entity).isAggressive()) {

View File

@ -51,8 +51,8 @@ public class ArmorStandController extends MobEntityController {
public static class EntityArmorStandNPC extends ArmorStand implements NPCHolder, ForwardingMobAI { public static class EntityArmorStandNPC extends ArmorStand implements NPCHolder, ForwardingMobAI {
private MobAI ai; private MobAI ai;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityArmorStandNPC(EntityType<? extends ArmorStand> types, Level level) { public EntityArmorStandNPC(EntityType<? extends ArmorStand> types, Level level) {
this(types, level, null); this(types, level, null);
} }
@ -62,6 +62,7 @@ public class ArmorStandController extends MobEntityController {
this.npc = (CitizensNPC) npc; this.npc = (CitizensNPC) npc;
if (npc != null) { if (npc != null) {
ai = new BasicMobAI(this); ai = new BasicMobAI(this);
NMS.setStepHeight(getBukkitEntity(), 1);
} }
} }

View File

@ -109,6 +109,7 @@ public class EntityMoveControl extends MoveControl {
NMS.setHeadYaw(entity.getBukkitEntity(), entity.getYRot()); NMS.setHeadYaw(entity.getBukkitEntity(), entity.getYRot());
} }
this.entity.zza = (float) (this.speedMod * entity.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue()); this.entity.zza = (float) (this.speedMod * entity.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue());
this.entity.setSpeed(this.entity.zza);
if (entity instanceof Slime && jumpTicks-- <= 0) { if (entity instanceof Slime && jumpTicks-- <= 0) {
this.jumpTicks = new Random().nextInt(20) + 10; this.jumpTicks = new Random().nextInt(20) + 10;
if (((Slime) entity).isAggressive()) { if (((Slime) entity).isAggressive()) {

View File

@ -51,8 +51,8 @@ public class ArmorStandController extends MobEntityController {
public static class EntityArmorStandNPC extends ArmorStand implements NPCHolder, ForwardingMobAI { public static class EntityArmorStandNPC extends ArmorStand implements NPCHolder, ForwardingMobAI {
private MobAI ai; private MobAI ai;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityArmorStandNPC(EntityType<? extends ArmorStand> types, Level level) { public EntityArmorStandNPC(EntityType<? extends ArmorStand> types, Level level) {
this(types, level, null); this(types, level, null);
} }
@ -62,6 +62,7 @@ public class ArmorStandController extends MobEntityController {
this.npc = (CitizensNPC) npc; this.npc = (CitizensNPC) npc;
if (npc != null) { if (npc != null) {
ai = new BasicMobAI(this); ai = new BasicMobAI(this);
NMS.setStepHeight(getBukkitEntity(), 1);
} }
} }

View File

@ -111,6 +111,7 @@ public class EntityMoveControl extends MoveControl {
NMS.setHeadYaw(entity.getBukkitEntity(), entity.getYRot()); NMS.setHeadYaw(entity.getBukkitEntity(), entity.getYRot());
} }
this.entity.zza = (float) (this.speedMod * entity.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue()); this.entity.zza = (float) (this.speedMod * entity.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue());
this.entity.setSpeed(this.entity.zza);
if (entity instanceof Slime && jumpTicks-- <= 0) { if (entity instanceof Slime && jumpTicks-- <= 0) {
this.jumpTicks = new Random().nextInt(20) + 10; this.jumpTicks = new Random().nextInt(20) + 10;
if (((Slime) entity).isAggressive()) { if (((Slime) entity).isAggressive()) {

View File

@ -51,6 +51,7 @@ public class ArmorStandController extends MobEntityController {
private MobAI ai; private MobAI ai;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityArmorStandNPC(EntityType<? extends ArmorStand> types, Level level) { public EntityArmorStandNPC(EntityType<? extends ArmorStand> types, Level level) {
this(types, level, null); this(types, level, null);
} }
@ -60,6 +61,7 @@ public class ArmorStandController extends MobEntityController {
this.npc = (CitizensNPC) npc; this.npc = (CitizensNPC) npc;
if (npc != null) { if (npc != null) {
ai = new BasicMobAI(this); ai = new BasicMobAI(this);
NMS.setStepHeight(getBukkitEntity(), 1);
} }
} }

View File

@ -107,6 +107,7 @@ public class EntityMoveControl extends MoveControl {
NMS.setHeadYaw(entity.getBukkitEntity(), entity.getYRot()); NMS.setHeadYaw(entity.getBukkitEntity(), entity.getYRot());
} }
this.entity.zza = (float) (this.speedMod * entity.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue()); this.entity.zza = (float) (this.speedMod * entity.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue());
this.entity.setSpeed(entity.zza);
if (entity instanceof Slime && jumpTicks-- <= 0) { if (entity instanceof Slime && jumpTicks-- <= 0) {
this.jumpTicks = new Random().nextInt(20) + 10; this.jumpTicks = new Random().nextInt(20) + 10;
if (((Slime) entity).isAggressive()) { if (((Slime) entity).isAggressive()) {

View File

@ -49,8 +49,8 @@ public class ArmorStandController extends MobEntityController {
public static class EntityArmorStandNPC extends ArmorStand implements NPCHolder, ForwardingMobAI { public static class EntityArmorStandNPC extends ArmorStand implements NPCHolder, ForwardingMobAI {
private MobAI ai; private MobAI ai;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityArmorStandNPC(EntityType<? extends ArmorStand> types, Level level) { public EntityArmorStandNPC(EntityType<? extends ArmorStand> types, Level level) {
this(types, level, null); this(types, level, null);
} }
@ -60,6 +60,7 @@ public class ArmorStandController extends MobEntityController {
this.npc = (CitizensNPC) npc; this.npc = (CitizensNPC) npc;
if (npc != null) { if (npc != null) {
ai = new BasicMobAI(this); ai = new BasicMobAI(this);
NMS.setStepHeight(getBukkitEntity(), 1);
} }
} }

View File

@ -107,6 +107,7 @@ public class EntityMoveControl extends MoveControl {
NMS.setHeadYaw(entity.getBukkitEntity(), entity.getYRot()); NMS.setHeadYaw(entity.getBukkitEntity(), entity.getYRot());
} }
this.entity.zza = (float) (this.speedMod * entity.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue()); this.entity.zza = (float) (this.speedMod * entity.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue());
this.entity.setSpeed(entity.zza);
if (entity instanceof Slime && jumpTicks-- <= 0) { if (entity instanceof Slime && jumpTicks-- <= 0) {
this.jumpTicks = new Random().nextInt(20) + 10; this.jumpTicks = new Random().nextInt(20) + 10;
if (((Slime) entity).isAggressive()) { if (((Slime) entity).isAggressive()) {

View File

@ -58,6 +58,7 @@ public class ArmorStandController extends MobEntityController {
public EntityArmorStandNPC(World world, NPC npc) { public EntityArmorStandNPC(World world, NPC npc) {
super(world); super(world);
this.npc = (CitizensNPC) npc; this.npc = (CitizensNPC) npc;
NMS.setStepHeight(getBukkitEntity(), 1);
} }
@Override @Override

View File

@ -81,6 +81,7 @@ public class PlayerControllerMove extends ControllerMove {
this.a.yaw = a(this.a.yaw, f, 90.0F); this.a.yaw = a(this.a.yaw, f, 90.0F);
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw); NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
this.a.ba = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue()); this.a.ba = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
this.a.k(this.a.ba);
if (a instanceof EntitySlime && h-- <= 0) { if (a instanceof EntitySlime && h-- <= 0) {
this.h = new Random().nextInt(20) + 10; this.h = new Random().nextInt(20) + 10;
this.h /= 3; this.h /= 3;