{"id":341621,"date":"2022-11-23T15:00:56","date_gmt":"2022-11-23T15:00:56","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=341621"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=341621","title":{"rendered":"<span>\u041f\u0438\u0448\u0435\u043c \u0431\u043e\u0442\u0430 \u043d\u0430 JavaScript \u0434\u043b\u044f Minecraft (1.8-1.18) \/ \u0427\u0430\u0441\u0442\u044c 10-14<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435, \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u0425\u0430\u0431\u0440\u0430! \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u0442\u0430 \u0434\u043b\u044f Minecraft(1.8 &#8212; 1.18) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 mineflayer. \u0421 \u043f\u0440\u043e\u0448\u043b\u044b\u043c\u0438 \u0443\u0440\u043e\u043a\u0430\u043c\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f <a href=\"https:\/\/habr.com\/ru\/post\/695372\/\" rel=\"noopener noreferrer nofollow\">\u0422\u0423\u0422<\/a>.<\/p>\n<h2>\u0427\u0430\u0441\u0442\u044c 10 (\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043a\u043e\u0440\u043e\u0432\u0430\u043c\u0438)<\/h2>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0b3\/5cb\/d9c\/0b35cbd9c869c4e5ebe43822e3a037fb.png\" width=\"1094\" height=\"779\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0b3\/5cb\/d9c\/0b35cbd9c869c4e5ebe43822e3a037fb.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>async function startMilking().<\/code> \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043d\u0430\u0448\u0435\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0438\u043b\u044c\u0442\u0440\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u043a\u043e\u0440\u043e\u0432\u0430 \u0432\u0437\u0440\u043e\u0441\u043b\u043e\u0439. \u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u0442\u0451\u043d\u044b\u0448\u0435\u043c, \u0442\u043e \u0431\u043e\u0442 \u043c\u043e\u043b\u043e\u043a\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u0430\u0432\u0438\u043c \u0434\u0438\u0441\u0442\u0430\u043d\u0446\u0438\u044e \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u043e\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u043e\u043b\u043e\u043a\u043e, \u0441\u0442\u0430\u0432\u0438\u043c  &lt; 5 \u0431\u043b\u043e\u043a\u043e\u0432: <\/p>\n<pre><code class=\"javascript\">e.position.distanceTo(bot.entity.position) &lt; 5  bot.on('spawn', async function () {      await startMilking()          async function startMilking() {              setTimeout(async function () {                  let nearbyCows = Object.values(bot.entities).filter(e => e.name == 'cow' &amp;&amp; e.position.distanceTo(bot.entity.position) &lt; 5 &amp;&amp; !e.metadata[16]);                 let cow = nearbyCows[Math.floor(Math.random() * nearbyCows.length)];                 await bot.lookAt(cow.position, false)                  let empty_bucket = bot.inventory.items().filter(item => item.name == 'bucket')[0];                  \/\/ \u041d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c                  if (!empty_bucket) {                     console.log('[\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435] \u0412 \u043c\u043e\u0435\u043c \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0435 \u043d\u0435\u0442 \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u0432\u0435\u0434\u0440\u0430');                     return startMilking();                     await startMilking();                 }, 2000)              }         });<\/code><\/pre>\n<h2>\u0427\u0430\u0441\u0442\u044c 11 (\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0435\u0434\u044b, \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u044f, \u043e\u043f\u044b\u0442\u0430, \u0443\u0440\u043e\u0432\u043d\u044f)<\/h2>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/637dd87061ecc8ef4a7ae3b4\" data-style=\"\" id=\"637dd87061ecc8ef4a7ae3b4\" width=\"\"><\/div>\n<p>\u0412\u0432\u0435\u0434\u044f \u0432 \u0447\u0430\u0442: \u0417\u0434\u043e\u0440\u043e\u0432\u044c\u0435, \u0415\u0434\u0430, \u041e\u043f\u044b\u0442, \u0423\u0440\u043e\u0432\u0435\u043d\u044c , \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"javascript\">bot.on('chat', function (username, message) {      if (message === \"\u0417\u0434\u043e\u0440\u043e\u0432\u044c\u0435\") {          bot.chat('\u0423 \u043c\u0435\u043d\u044f ' + bot.health.toFixed(0) + ' \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435')     }      if (message === \"\u0415\u0434\u0430\") {          bot.chat(`\u0423 \u043c\u0435\u043d\u044f ` + bot.food + ` \u0435\u0434\u044b`)     }      if (message === \"\u041e\u043f\u044b\u0442\") {          bot.chat(\"\u0423 \u043c\u0435\u043d\u044f \" + bot.experience.points.toFixed(0) + \" \u043e\u043f\u044b\u0442\u0430\")     }      if (message === \"\u0423\u0440\u043e\u0432\u0435\u043d\u044c\") {          bot.chat('\u0423 \u043c\u0435\u043d\u044f ' + bot.experience.level.toFixed(0) + ' \u0443\u0440\u043e\u0432\u0435\u043d\u044c')     } });<\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a60\/147\/55e\/a6014755e7bc12155930d3c998d58262.png\" width=\"390\" height=\"193\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a60\/147\/55e\/a6014755e7bc12155930d3c998d58262.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0427\u0430\u0441\u0442\u044c 12 (\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u044d\u043a\u0438\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u0442\u043e\u0442\u0435\u043c\u0430)<\/h2>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/927\/54e\/186\/92754e18629ee4ebb8baf78e16a5dbc6.png\" width=\"737\" height=\"493\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/927\/54e\/186\/92754e18629ee4ebb8baf78e16a5dbc6.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 : <code>npm i mineflayer-auto-totem --save.<\/code> <\/p>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434:<\/p>\n<pre><code class=\"javascript\">bot.loadPlugin(autototem)  bot.on(\"physicsTick\",async() =>{bot.autototem.equip()})<\/code><\/pre>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443 \u0432\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a \u0432\u043e\u043f\u0440\u043e\u0441, \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043b\u0430\u0433\u0438\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u0415\u0441\u043b\u0438 \u0443  \u0431\u043e\u0442\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u044f\u0442\u044c\u0441\u044f 0 , \u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 equip() \u0438 \u0442\u043e\u0442\u0435\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432 \u0440\u0443\u043a\u0435 \u0431\u043e\u0442\u0430. \u0422\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0432\u0441\u0435 \u0442\u043e\u0442\u0435\u043c\u044b \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0430\u0442\u0441\u044f.<\/p>\n<h2>\u0427\u0430\u0441\u0442\u044c 13 (\u0420\u0430\u0434\u0430\u0440)<\/h2>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7bc\/cc4\/fad\/7bccc4fadab2b61f4607ea401f21cb80.png\" width=\"400\" height=\"399\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7bc\/cc4\/fad\/7bccc4fadab2b61f4607ea401f21cb80.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0440\u0430\u0441\u043d\u044b\u043c \u043c\u0430\u0440\u043a\u0435\u0440\u043e\u043c \u043e\u0442\u043c\u0435\u0447\u0435\u043d \u0431\u043e\u0442, \u0430 \u0437\u0435\u043b\u0451\u043d\u044b\u043c \u0438\u0433\u0440\u043e\u043a.<\/p>\n<p>\u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"javascript\">const radarPlugin = require('mineflayer-radar')(mineflayer);  radarPlugin(bot, options);<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u041f\u041a\u041c \u043d\u0430 <code>'mineflayer-radar',<\/code> \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0443\u043d\u043a\u0442, \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430 \u0438 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d \u043f\u043e\u0440\u0442 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0435\u0433\u043e. \u0412 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e 22355.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d23\/8d6\/c28\/d238d6c2869e21c18d4b28f11a8f715f.png\" width=\"395\" height=\"109\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d23\/8d6\/c28\/d238d6c2869e21c18d4b28f11a8f715f.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438 \u043f\u0438\u0448\u0435\u043c localhost:22355. \u0420\u0430\u0434\u0430\u0440 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<h2>\u0427\u0430\u0441\u0442\u044c 14 (Web-\u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u044c)<\/h2>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5f6\/c4e\/b45\/5f6c4eb45a59a222327aada2d34396e3.png\" width=\"609\" height=\"522\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5f6\/c4e\/b45\/5f6c4eb45a59a222327aada2d34396e3.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043a\u0430\u0447\u0430\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d, \u0432\u043f\u0438\u0448\u0435\u043c \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b <code>npm install mineflayer-web-inventory.<\/code><\/p>\n<p><code>const inventoryViewer = require('mineflayer-web-inventory')<\/code><\/p>\n<p><code>inventoryViewer(bot)<\/code><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0431\u043e\u0442\u0430 \u043f\u0438\u0448\u0435\u043c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 localhost:3000 \u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0437\u0430 \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0451\u043c. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u043b\u0430\u0433\u0438\u043d\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434.<\/p>\n<pre><code class=\"javascript\">let options = { port: PORT,webPath: PATH,express: EXPRESS,app: APP, http: HTTP,io: IO,startOnLoad: BOOLEAN,windowUpdateDebounceTime: INT}   inventoryViewer(bot, options)<\/code><\/pre>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/701056\/\"> https:\/\/habr.com\/ru\/post\/701056\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435, \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u0425\u0430\u0431\u0440\u0430! \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u0442\u0430 \u0434\u043b\u044f Minecraft(1.8 &#8212; 1.18) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 mineflayer. \u0421 \u043f\u0440\u043e\u0448\u043b\u044b\u043c\u0438 \u0443\u0440\u043e\u043a\u0430\u043c\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f <a href=\"https:\/\/habr.com\/ru\/post\/695372\/\" rel=\"noopener noreferrer nofollow\">\u0422\u0423\u0422<\/a>.<\/p>\n<h2>\u0427\u0430\u0441\u0442\u044c 10 (\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043a\u043e\u0440\u043e\u0432\u0430\u043c\u0438)<\/h2>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>async function startMilking().<\/code> \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043d\u0430\u0448\u0435\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0438\u043b\u044c\u0442\u0440\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u043a\u043e\u0440\u043e\u0432\u0430 \u0432\u0437\u0440\u043e\u0441\u043b\u043e\u0439. \u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u0442\u0451\u043d\u044b\u0448\u0435\u043c, \u0442\u043e \u0431\u043e\u0442 \u043c\u043e\u043b\u043e\u043a\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u0430\u0432\u0438\u043c \u0434\u0438\u0441\u0442\u0430\u043d\u0446\u0438\u044e \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u043e\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u043e\u043b\u043e\u043a\u043e, \u0441\u0442\u0430\u0432\u0438\u043c  &lt; 5 \u0431\u043b\u043e\u043a\u043e\u0432: <\/p>\n<pre><code class=\"javascript\">e.position.distanceTo(bot.entity.position) &lt; 5  bot.on('spawn', async function () {      await startMilking()          async function startMilking() {              setTimeout(async function () {                  let nearbyCows = Object.values(bot.entities).filter(e => e.name == 'cow' &amp;&amp; e.position.distanceTo(bot.entity.position) &lt; 5 &amp;&amp; !e.metadata[16]);                 let cow = nearbyCows[Math.floor(Math.random() * nearbyCows.length)];                 await bot.lookAt(cow.position, false)                  let empty_bucket = bot.inventory.items().filter(item => item.name == 'bucket')[0];                  \/\/ \u041d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c                  if (!empty_bucket) {                     console.log('[\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435] \u0412 \u043c\u043e\u0435\u043c \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0435 \u043d\u0435\u0442 \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u0432\u0435\u0434\u0440\u0430');                     return startMilking();                     await startMilking();                 }, 2000)              }         });<\/code><\/pre>\n<h2>\u0427\u0430\u0441\u0442\u044c 11 (\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0435\u0434\u044b, \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u044f, \u043e\u043f\u044b\u0442\u0430, \u0443\u0440\u043e\u0432\u043d\u044f)<\/h2>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/637dd87061ecc8ef4a7ae3b4\" data-style=\"\" id=\"637dd87061ecc8ef4a7ae3b4\" width=\"\"><\/div>\n<p>\u0412\u0432\u0435\u0434\u044f \u0432 \u0447\u0430\u0442: \u0417\u0434\u043e\u0440\u043e\u0432\u044c\u0435, \u0415\u0434\u0430, \u041e\u043f\u044b\u0442, \u0423\u0440\u043e\u0432\u0435\u043d\u044c , \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"javascript\">bot.on('chat', function (username, message) {      if (message === \"\u0417\u0434\u043e\u0440\u043e\u0432\u044c\u0435\") {          bot.chat('\u0423 \u043c\u0435\u043d\u044f ' + bot.health.toFixed(0) + ' \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435')     }      if (message === \"\u0415\u0434\u0430\") {          bot.chat(`\u0423 \u043c\u0435\u043d\u044f ` + bot.food + ` \u0435\u0434\u044b`)     }      if (message === \"\u041e\u043f\u044b\u0442\") {          bot.chat(\"\u0423 \u043c\u0435\u043d\u044f \" + bot.experience.points.toFixed(0) + \" \u043e\u043f\u044b\u0442\u0430\")     }      if (message === \"\u0423\u0440\u043e\u0432\u0435\u043d\u044c\") {          bot.chat('\u0423 \u043c\u0435\u043d\u044f ' + bot.experience.level.toFixed(0) + ' \u0443\u0440\u043e\u0432\u0435\u043d\u044c')     } });<\/code><\/pre>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<h2>\u0427\u0430\u0441\u0442\u044c 12 (\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u044d\u043a\u0438\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u0442\u043e\u0442\u0435\u043c\u0430)<\/h2>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 : <code>npm i mineflayer-auto-totem --save.<\/code> <\/p>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434:<\/p>\n<pre><code class=\"javascript\">bot.loadPlugin(autototem)  bot.on(\"physicsTick\",async() =>{bot.autototem.equip()})<\/code><\/pre>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443 \u0432\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a \u0432\u043e\u043f\u0440\u043e\u0441, \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043b\u0430\u0433\u0438\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u0415\u0441\u043b\u0438 \u0443  \u0431\u043e\u0442\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u044f\u0442\u044c\u0441\u044f 0 , \u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 equip() \u0438 \u0442\u043e\u0442\u0435\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432 \u0440\u0443\u043a\u0435 \u0431\u043e\u0442\u0430. \u0422\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0432\u0441\u0435 \u0442\u043e\u0442\u0435\u043c\u044b \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0430\u0442\u0441\u044f.<\/p>\n<h2>\u0427\u0430\u0441\u0442\u044c 13 (\u0420\u0430\u0434\u0430\u0440)<\/h2>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0440\u0430\u0441\u043d\u044b\u043c \u043c\u0430\u0440\u043a\u0435\u0440\u043e\u043c \u043e\u0442\u043c\u0435\u0447\u0435\u043d \u0431\u043e\u0442, \u0430 \u0437\u0435\u043b\u0451\u043d\u044b\u043c \u0438\u0433\u0440\u043e\u043a.<\/p>\n<p>\u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"javascript\">const radarPlugin = require('mineflayer-radar')(mineflayer);  radarPlugin(bot, options);<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u041f\u041a\u041c \u043d\u0430 <code>'mineflayer-radar',<\/code> \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0443\u043d\u043a\u0442, \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430 \u0438 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d \u043f\u043e\u0440\u0442 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0435\u0433\u043e. \u0412 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e 22355.<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438 \u043f\u0438\u0448\u0435\u043c localhost:22355. \u0420\u0430\u0434\u0430\u0440 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<h2>\u0427\u0430\u0441\u0442\u044c 14 (Web-\u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u044c)<\/h2>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043a\u0430\u0447\u0430\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d, \u0432\u043f\u0438\u0448\u0435\u043c \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b <code>npm install mineflayer-web-inventory.<\/code><\/p>\n<p><code>const inventoryViewer = require('mineflayer-web-inventory')<\/code><\/p>\n<p><code>inventoryViewer(bot)<\/code><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0431\u043e\u0442\u0430 \u043f\u0438\u0448\u0435\u043c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 localhost:3000 \u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0437\u0430 \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0451\u043c. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u043b\u0430\u0433\u0438\u043d\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434.<\/p>\n<pre><code class=\"javascript\">let options = { port: PORT,webPath: PATH,express: EXPRESS,app: APP, http: HTTP,io: IO,startOnLoad: BOOLEAN,windowUpdateDebounceTime: INT}   inventoryViewer(bot, options)<\/code><\/pre>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/701056\/\"> https:\/\/habr.com\/ru\/post\/701056\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-341621","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/341621","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=341621"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/341621\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=341621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=341621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=341621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}