Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void aiStep() {
- if (this.noJumpDelay > 0) {
- --this.noJumpDelay;
- }
- if (this.isControlledByLocalInstance()) {
- this.lerpSteps = 0;
- this.syncPacketPositionCodec(this.getX(), this.getY(), this.getZ());
- }
- if (this.lerpSteps > 0) {
- this.lerpPositionAndRotationStep(this.lerpSteps, this.lerpX, this.lerpY, this.lerpZ, this.lerpYRot, this.lerpXRot);
- --this.lerpSteps;
- } else if (!this.isEffectiveAi()) {
- this.setDeltaMovement(this.getDeltaMovement().scale(0.98D));
- }
- if (this.lerpHeadSteps > 0) {
- this.lerpHeadRotationStep(this.lerpHeadSteps, this.lerpYHeadRot);
- --this.lerpHeadSteps;
- }
- Vec3 vec3 = this.getDeltaMovement();
- double d0 = vec3.x;
- double d1 = vec3.y;
- double d2 = vec3.z;
- if (Math.abs(vec3.x) < 0.003D) {
- d0 = 0.0D;
- }
- if (Math.abs(vec3.y) < 0.003D) {
- d1 = 0.0D;
- }
- if (Math.abs(vec3.z) < 0.003D) {
- d2 = 0.0D;
- }
- this.setDeltaMovement(d0, d1, d2);
- this.level().getProfiler().push("ai");
- if (this.isImmobile()) {
- this.jumping = false;
- this.xxa = 0.0F;
- this.zza = 0.0F;
- } else if (this.isEffectiveAi()) {
- this.level().getProfiler().push("newAi");
- this.serverAiStep();
- this.level().getProfiler().pop();
- }
- this.level().getProfiler().pop();
- this.level().getProfiler().push("jump");
- if (this.jumping && this.isAffectedByFluids()) {
- double d3;
- var fluidType = this.getMaxHeightFluidType();
- if (!fluidType.isAir())
- d3 = this.getFluidTypeHeight(fluidType);
- else
- if (this.isInLava()) {
- d3 = this.getFluidHeight(FluidTags.LAVA);
- } else {
- d3 = this.getFluidHeight(FluidTags.WATER);
- }
- boolean flag = this.isInWater() && d3 > 0.0D;
- double d4 = this.getFluidJumpThreshold();
- if (!flag || this.onGround() && !(d3 > d4)) {
- if (!this.isInLava() || this.onGround() && !(d3 > d4)) {
- if (fluidType.isAir() || this.onGround() && !(d3 > d4)) {
- if ((this.onGround() || flag && d3 <= d4) && this.noJumpDelay == 0) {
- this.jumpFromGround();
- this.noJumpDelay = 10;
- }
- } else this.jumpInFluid(fluidType);
- } else {
- this.jumpInFluid(net.minecraftforge.common.ForgeMod.LAVA_TYPE.get());
- }
- } else {
- this.jumpInFluid(net.minecraftforge.common.ForgeMod.WATER_TYPE.get());
- }
- } else {
- this.noJumpDelay = 0;
- }
- this.level().getProfiler().pop();
- this.level().getProfiler().push("travel");
- this.xxa *= 0.98F;
- this.zza *= 0.98F;
- this.updateFallFlying();
- AABB aabb = this.getBoundingBox();
- Vec3 vec31 = new Vec3((double)this.xxa, (double)this.yya, (double)this.zza);
- if (this.hasEffect(MobEffects.SLOW_FALLING) || this.hasEffect(MobEffects.LEVITATION)) {
- this.resetFallDistance();
- }
- label104: {
- LivingEntity livingentity = this.getControllingPassenger();
- if (livingentity instanceof Player player) {
- if (this.isAlive()) {
- this.travelRidden(player, vec31);
- break label104;
- }
- }
- this.travel(vec31);
- }
- this.level().getProfiler().pop();
- this.level().getProfiler().push("freezing");
- if (!this.level().isClientSide && !this.isDeadOrDying()) {
- int i = this.getTicksFrozen();
- if (this.isInPowderSnow && this.canFreeze()) {
- this.setTicksFrozen(Math.min(this.getTicksRequiredToFreeze(), i + 1));
- } else {
- this.setTicksFrozen(Math.max(0, i - 2));
- }
- }
- this.removeFrost();
- this.tryAddFrost();
- if (!this.level().isClientSide && this.tickCount % 40 == 0 && this.isFullyFrozen() && this.canFreeze()) {
- this.hurt(this.damageSources().freeze(), 1.0F);
- }
- this.level().getProfiler().pop();
- this.level().getProfiler().push("push");
- if (this.autoSpinAttackTicks > 0) {
- --this.autoSpinAttackTicks;
- this.checkAutoSpinAttack(aabb, this.getBoundingBox());
- }
- this.pushEntities();
- this.level().getProfiler().pop();
- if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
- this.hurt(this.damageSources().drown(), 1.0F);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement