85 lines
2.6 KiB
Java
85 lines
2.6 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.mojang.authlib.GameProfile
|
|
*/
|
|
package net.minecraft.client.player;
|
|
|
|
import com.mojang.authlib.GameProfile;
|
|
import net.minecraft.client.multiplayer.ClientLevel;
|
|
import net.minecraft.client.player.AbstractClientPlayer;
|
|
import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
|
|
import net.minecraft.util.profiling.Profiler;
|
|
import net.minecraft.util.profiling.Zone;
|
|
import net.minecraft.world.damagesource.DamageSource;
|
|
import net.minecraft.world.phys.Vec3;
|
|
|
|
public class RemotePlayer
|
|
extends AbstractClientPlayer {
|
|
private Vec3 lerpDeltaMovement = Vec3.ZERO;
|
|
private int lerpDeltaMovementSteps;
|
|
|
|
public RemotePlayer(ClientLevel level, GameProfile gameProfile) {
|
|
super(level, gameProfile);
|
|
this.noPhysics = true;
|
|
}
|
|
|
|
@Override
|
|
public boolean shouldRenderAtSqrDistance(double distance) {
|
|
double size = this.getBoundingBox().getSize() * 10.0;
|
|
if (Double.isNaN(size)) {
|
|
size = 1.0;
|
|
}
|
|
return distance < (size *= 64.0 * RemotePlayer.getViewScale()) * size;
|
|
}
|
|
|
|
@Override
|
|
public boolean hurtClient(DamageSource source) {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public void tick() {
|
|
super.tick();
|
|
this.calculateEntityAnimation(false);
|
|
}
|
|
|
|
@Override
|
|
public void aiStep() {
|
|
if (this.isInterpolating()) {
|
|
this.getInterpolation().interpolate();
|
|
}
|
|
if (this.lerpHeadSteps > 0) {
|
|
this.lerpHeadRotationStep(this.lerpHeadSteps, this.lerpYHeadRot);
|
|
--this.lerpHeadSteps;
|
|
}
|
|
if (this.lerpDeltaMovementSteps > 0) {
|
|
this.addDeltaMovement(new Vec3((this.lerpDeltaMovement.x - this.getDeltaMovement().x) / (double)this.lerpDeltaMovementSteps, (this.lerpDeltaMovement.y - this.getDeltaMovement().y) / (double)this.lerpDeltaMovementSteps, (this.lerpDeltaMovement.z - this.getDeltaMovement().z) / (double)this.lerpDeltaMovementSteps));
|
|
--this.lerpDeltaMovementSteps;
|
|
}
|
|
this.updateSwingTime();
|
|
this.updateBob();
|
|
try (Zone ignored = Profiler.get().zone("push");){
|
|
this.pushEntities();
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void lerpMotion(Vec3 movement) {
|
|
this.lerpDeltaMovement = movement;
|
|
this.lerpDeltaMovementSteps = this.getType().updateInterval() + 1;
|
|
}
|
|
|
|
@Override
|
|
protected void updatePlayerPose() {
|
|
}
|
|
|
|
@Override
|
|
public void recreateFromPacket(ClientboundAddEntityPacket packet) {
|
|
super.recreateFromPacket(packet);
|
|
this.setOldPosAndRot();
|
|
}
|
|
}
|
|
|