平滑无人机视角

This commit is contained in:
Atsuihsio 2024-07-24 17:21:05 +08:00
parent d09ac6d5cb
commit d4dbd87637
2 changed files with 7 additions and 8 deletions

View file

@ -190,7 +190,7 @@ public class DroneEntity extends PathfinderMob implements GeoEntity {
double y = vec.y; double y = vec.y;
double z = vec.z; double z = vec.z;
this.setDeltaMovement(Mth.clamp(1.04 * x ,-0.8,0.8), y, Mth.clamp(1.04 * z,-0.8,0.8)); this.setDeltaMovement(Mth.clamp(1.06 * x ,-0.95,0.95), y, Mth.clamp(1.06 * z,-0.95,0.95));
this.refreshDimensions(); this.refreshDimensions();
} }
@ -256,7 +256,7 @@ public class DroneEntity extends PathfinderMob implements GeoEntity {
if (stack.getOrCreateTag().getBoolean("Using")) { if (stack.getOrCreateTag().getBoolean("Using")) {
this.setYRot(control.getYRot()); this.setYRot(control.getYRot());
this.yRotO = this.getYRot(); this.yRotO = this.getYRot();
this.setXRot(control.getXRot()); this.setXRot(Mth.clamp(control.getXRot(),-25,95));
this.setRot(this.getYRot(), this.getXRot()); this.setRot(this.getYRot(), this.getXRot());
this.yBodyRot = control.getYRot(); this.yBodyRot = control.getYRot();
this.yHeadRot = control.getYRot(); this.yHeadRot = control.getYRot();
@ -307,12 +307,12 @@ public class DroneEntity extends PathfinderMob implements GeoEntity {
public static AttributeSupplier.Builder createAttributes() { public static AttributeSupplier.Builder createAttributes() {
AttributeSupplier.Builder builder = Mob.createMobAttributes(); AttributeSupplier.Builder builder = Mob.createMobAttributes();
builder = builder.add(Attributes.MOVEMENT_SPEED, 1); builder = builder.add(Attributes.MOVEMENT_SPEED, 0.1);
builder = builder.add(Attributes.MAX_HEALTH, 10); builder = builder.add(Attributes.MAX_HEALTH, 20);
builder = builder.add(Attributes.ARMOR, 0); builder = builder.add(Attributes.ARMOR, 0);
builder = builder.add(Attributes.ATTACK_DAMAGE, 0); builder = builder.add(Attributes.ATTACK_DAMAGE, 0);
builder = builder.add(Attributes.FOLLOW_RANGE, 64); builder = builder.add(Attributes.FOLLOW_RANGE, 64);
builder = builder.add(Attributes.FLYING_SPEED, 10); builder = builder.add(Attributes.FLYING_SPEED, 0.1);
return builder; return builder;
} }

View file

@ -43,9 +43,8 @@ public abstract class MixinCamera {
.stream().filter(e -> e.getStringUUID().equals(stack.getOrCreateTag().getString("LinkedDrone"))).findFirst().orElse(null); .stream().filter(e -> e.getStringUUID().equals(stack.getOrCreateTag().getString("LinkedDrone"))).findFirst().orElse(null);
if (drone != null) { if (drone != null) {
setRotation(drone.getViewYRot(partialTicks), drone.getViewXRot(partialTicks));
setRotation(drone.getYRot(), drone.getXRot()); setPosition(Mth.lerp(partialTicks, drone.xo, drone.getX()) + 0.18 * drone.getLookAngle().x, Mth.lerp(partialTicks, drone.yo, drone.getY()) + 0.075, Mth.lerp(partialTicks, drone.zo, drone.getZ()) + 0.18 * drone.getLookAngle().z);
setPosition(drone.getX() + 0.18 * drone.getLookAngle().x, drone.getY() + drone.getEyeHeight(), drone.getZ() + 0.18 * drone.getLookAngle().z);
info.cancel(); info.cancel();
} }
} }