@Override public boolean shouldExecute() { EntityMoveHelper moveHelper = this.dino.getMoveHelper(); if (!moveHelper.isUpdating()) { return true; } else { double moveX = moveHelper.getX() - this.dino.posX; double moveY = moveHelper.getY() - this.dino.posY; double moveZ = moveHelper.getZ() - this.dino.posZ; double distance = moveX * moveX + moveY * moveY + moveZ * moveZ; return distance < 1.0D || distance > 3600.0D; } }
public void setMovementSpeed(double newSpeed) { getNavigator().setSpeed(newSpeed); moveHelper.setMoveTo(moveHelper.getX(), moveHelper.getY(), moveHelper.getZ(), newSpeed); }
protected float getJumpUpwardsMotion() { if (!collidedHorizontally && (!moveHelper.isUpdating() || moveHelper.getY() <= posY + 0.5D)) { Path path = navigator.getPath(); if (path != null && path.getCurrentPathIndex() < path.getCurrentPathLength()) { Vec3d vec3d = path.getPosition(this); if (vec3d.y > posY + 0.5D) return 0.5F; } return moveHelper.getSpeed() <= 0.6D ? 0.5F : 0.5F; } else { return 0.5F; } }
@Override public void updateAITasks() { if (currentMoveTypeDuration > 0) { --currentMoveTypeDuration; } if (onGround) { if (!wasOnGround) { setJumping(false); checkLandingDelay(); } EntityGrasshopper.GrasshopperJumpHelper grasshopperjumphelper = (EntityGrasshopper.GrasshopperJumpHelper) jumpHelper; if (!grasshopperjumphelper.getIsJumping()) { if (moveHelper.isUpdating() && currentMoveTypeDuration == 0) { Path path = navigator.getPath(); Vec3d vec3d = new Vec3d(moveHelper.getX(), moveHelper.getY(), moveHelper.getZ()); if (path != null && path.getCurrentPathIndex() < path.getCurrentPathLength()) vec3d = path.getPosition(this); calculateRotationYaw(vec3d.x, vec3d.z); startJumping(); } } else if (!grasshopperjumphelper.canJump()) enableJumpControl(); } wasOnGround = onGround; }