Remove speed setting code in controllermove

This commit is contained in:
fullwall 2024-04-15 22:12:20 +08:00
parent d3c0205d9e
commit edb4f78ceb
13 changed files with 19 additions and 59 deletions

View File

@ -4,7 +4,6 @@ import java.util.Random;
import net.citizensnpcs.nms.v1_10_R1.entity.EntityHumanNPC;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_10_R1.AttributeInstance;
import net.minecraft.server.v1_10_R1.ControllerMove;
import net.minecraft.server.v1_10_R1.EntityInsentient;
import net.minecraft.server.v1_10_R1.EntityLiving;
@ -82,10 +81,7 @@ public class PlayerControllerMove extends ControllerMove {
float f = (float) Math.toDegrees(Math.atan2(d1, d0)) - 90.0F;
this.a.yaw = a(this.a.yaw, f, 90.0F);
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
float movement = (float) (this.e * speed.getValue());
this.a.l(movement);
this.a.bg = movement;
this.a.bg = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
if (a instanceof EntitySlime && h-- <= 0) {
this.h = new Random().nextInt(20) + 10;
this.h /= 3;

View File

@ -4,7 +4,6 @@ import java.util.Random;
import net.citizensnpcs.nms.v1_11_R1.entity.EntityHumanNPC;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_11_R1.AttributeInstance;
import net.minecraft.server.v1_11_R1.ControllerMove;
import net.minecraft.server.v1_11_R1.EntityInsentient;
import net.minecraft.server.v1_11_R1.EntityLiving;
@ -84,10 +83,7 @@ public class PlayerControllerMove extends ControllerMove {
float f = (float) Math.toDegrees(Math.atan2(d1, d0)) - 90.0F;
this.a.yaw = a(this.a.yaw, f, 90.0F);
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
float movement = (float) (this.e * speed.getValue());
this.a.l(movement);
this.a.bf = movement;
this.a.bf = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
if (a instanceof EntitySlime && h-- <= 0) {
this.h = new Random().nextInt(20) + 10;
this.h /= 3;

View File

@ -4,7 +4,6 @@ import java.util.Random;
import net.citizensnpcs.nms.v1_12_R1.entity.EntityHumanNPC;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_12_R1.AttributeInstance;
import net.minecraft.server.v1_12_R1.ControllerMove;
import net.minecraft.server.v1_12_R1.EntityInsentient;
import net.minecraft.server.v1_12_R1.EntityLiving;
@ -47,10 +46,7 @@ public class PlayerControllerMove extends ControllerMove {
float f = (float) Math.toDegrees(Math.atan2(d1, d0)) - 90.0F;
this.a.yaw = a(this.a.yaw, f, 90.0F);
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
float movement = (float) (this.e * speed.getValue());
this.a.k(movement);
this.a.bg = movement;
this.a.bg = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
if (a instanceof EntitySlime && h-- <= 0) {
this.h = new Random().nextInt(20) + 10;
this.h /= 3;

View File

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

View File

@ -4,7 +4,6 @@ import java.util.Random;
import net.citizensnpcs.nms.v1_14_R1.entity.EntityHumanNPC;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_14_R1.AttributeInstance;
import net.minecraft.server.v1_14_R1.ControllerMove;
import net.minecraft.server.v1_14_R1.EntityInsentient;
import net.minecraft.server.v1_14_R1.EntityLiving;
@ -48,10 +47,7 @@ public class PlayerControllerMove extends ControllerMove {
float f = (float) Math.toDegrees(Math.atan2(d1, d0)) - 90.0F;
this.a.yaw = a(this.a.yaw, f, 90.0F);
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
float movement = (float) (this.e * speed.getValue());
this.a.o(movement);
this.a.bd = movement;
this.a.bd = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
if (a instanceof EntitySlime && h-- <= 0) {
this.h = new Random().nextInt(20) + 10;
this.h /= 3;

View File

@ -4,7 +4,6 @@ import java.util.Random;
import net.citizensnpcs.nms.v1_15_R1.entity.EntityHumanNPC;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_15_R1.AttributeInstance;
import net.minecraft.server.v1_15_R1.ControllerMove;
import net.minecraft.server.v1_15_R1.EntityInsentient;
import net.minecraft.server.v1_15_R1.EntityLiving;
@ -48,10 +47,7 @@ public class PlayerControllerMove extends ControllerMove {
float f = (float) Math.toDegrees(Math.atan2(d1, d0)) - 90.0F;
this.a.yaw = a(this.a.yaw, f, 90.0F);
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
float movement = (float) (this.e * speed.getValue());
this.a.o(movement);
this.a.bb = movement;
this.a.bb = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
if (a instanceof EntitySlime && h-- <= 0) {
this.h = new Random().nextInt(20) + 10;
this.h /= 3;

View File

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

View File

@ -7,7 +7,6 @@ import net.minecraft.util.Mth;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.control.MoveControl;
import net.minecraft.world.entity.monster.Slime;
@ -104,10 +103,7 @@ public class EntityMoveControl extends MoveControl {
this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot());
}
AttributeInstance speed = this.entity.getAttribute(Attributes.MOVEMENT_SPEED);
float movement = (float) (this.speed * speed.getValue());
this.entity.setSpeed(movement);
this.entity.zza = movement;
this.entity.zza = (float) (this.speed * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
if (entity instanceof Slime && jumpTicks-- <= 0) {
this.jumpTicks = new Random().nextInt(20) + 10;
if (((Slime) entity).isAggressive()) {

View File

@ -102,9 +102,7 @@ public class EntityMoveControl extends MoveControl {
this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot());
}
float movement = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
this.entity.setSpeed(movement);
this.entity.zza = movement;
this.entity.zza = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
if (entity instanceof Slime && jumpTicks-- <= 0) {
this.jumpTicks = new Random().nextInt(20) + 10;
if (((Slime) entity).isAggressive()) {

View File

@ -102,9 +102,7 @@ public class EntityMoveControl extends MoveControl {
this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot());
}
float movement = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
this.entity.setSpeed(movement);
this.entity.zza = movement;
this.entity.zza = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
if (entity instanceof Slime && jumpTicks-- <= 0) {
this.jumpTicks = new Random().nextInt(20) + 10;
if (((Slime) entity).isAggressive()) {

View File

@ -137,21 +137,21 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
detectEquipmentUpdatesPublic();
noPhysics = isSpectator();
if (isSpectator()) {
this.onGround = false;
onGround = false;
}
pushEntities();
if (npc.useMinecraftAI()) {
foodData.tick(this);
}
if (npc.data().get(NPC.Metadata.PICKUP_ITEMS, false)) {
if (this.takeXpDelay > 0) {
--this.takeXpDelay;
if (takeXpDelay > 0) {
--takeXpDelay;
}
AABB axisalignedbb;
if (this.isPassenger() && !this.getVehicle().isRemoved()) {
axisalignedbb = this.getBoundingBox().minmax(this.getVehicle().getBoundingBox()).inflate(1.0, 0.0, 1.0);
if (isPassenger() && !getVehicle().isRemoved()) {
axisalignedbb = getBoundingBox().minmax(this.getVehicle().getBoundingBox()).inflate(1.0, 0.0, 1.0);
} else {
axisalignedbb = this.getBoundingBox().inflate(1.0, 0.5, 1.0);
axisalignedbb = getBoundingBox().inflate(1.0, 0.5, 1.0);
}
for (Entity entity : level().getEntities(this, axisalignedbb)) {
entity.playerTouch(this);
@ -210,7 +210,7 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
@Override
public ServerStatsCounter getStats() {
return this.statsCache == null ? statsCache = new EmptyServerStatsCounter() : statsCache;
return statsCache == null ? statsCache = new EmptyServerStatsCounter() : statsCache;
}
@Override

View File

@ -101,9 +101,7 @@ public class EntityMoveControl extends MoveControl {
this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot());
}
float movement = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
this.entity.setSpeed(movement);
this.entity.zza = movement;
this.entity.zza = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
if (entity instanceof Slime && jumpTicks-- <= 0) {
this.jumpTicks = new Random().nextInt(20) + 10;
if (((Slime) entity).isAggressive()) {

View File

@ -4,7 +4,6 @@ import java.util.Random;
import net.citizensnpcs.nms.v1_8_R3.entity.EntityHumanNPC;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_8_R3.AttributeInstance;
import net.minecraft.server.v1_8_R3.ControllerMove;
import net.minecraft.server.v1_8_R3.EntityInsentient;
import net.minecraft.server.v1_8_R3.EntityLiving;
@ -82,10 +81,7 @@ public class PlayerControllerMove extends ControllerMove {
float f = (float) Math.toDegrees(Math.atan2(dZ, dX)) - 90.0F;
this.a.yaw = a(this.a.yaw, f, 90.0F);
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
float movement = (float) (this.e * speed.getValue());
this.a.k(movement);
this.a.ba = movement;
this.a.ba = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
if (a instanceof EntitySlime && h-- <= 0) {
this.h = new Random().nextInt(20) + 10;
this.h /= 3;