{"id":844,"date":"2019-06-12T21:58:43","date_gmt":"2019-06-12T19:58:43","guid":{"rendered":"https:\/\/mineprogramming.org\/?p=844"},"modified":"2019-06-12T21:59:28","modified_gmt":"2019-06-12T19:59:28","slug":"liquids","status":"publish","type":"post","link":"https:\/\/mineprogramming.org\/en\/liquids\/","title":{"rendered":"\u0416\u0438\u0434\u043a\u043e\u0441\u0442\u0438 \u0432 Inner Core, \u0438\u043b\u0438 \u043a\u0430\u043a \u044f \u041d\u0415 \u0438\u0437\u043c\u0435\u043d\u0438\u043b \u043c\u0438\u0440 \u043c\u043e\u0434\u0434\u0438\u043d\u0433\u0430 MCPE"},"content":{"rendered":"\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"597\" src=\"https:\/\/mineprogramming.org\/wp-content\/uploads\/2019\/06\/liquids-1024x597.png\" alt=\"\" class=\"wp-image-845\" srcset=\"https:\/\/mineprogramming.org\/wp-content\/uploads\/2019\/06\/liquids-1024x597.png 1024w, https:\/\/mineprogramming.org\/wp-content\/uploads\/2019\/06\/liquids-300x175.png 300w, https:\/\/mineprogramming.org\/wp-content\/uploads\/2019\/06\/liquids-768x448.png 768w, https:\/\/mineprogramming.org\/wp-content\/uploads\/2019\/06\/liquids.png 1456w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u0421 \u0441\u0430\u043c\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Inner Core \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0430 \u043e\u0434\u043d\u0430 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 &#8211; \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0436\u0438\u0434\u043a\u043e\u0441\u0442\u0435\u0439. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u0440\u043e \u0441\u0432\u043e\u044e \u043f\u043e\u043f\u044b\u0442\u043a\u0443 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043b\u0430\u0443\u043d\u0447\u0435\u0440\u0430. <\/p>\n\n\n\n<!--more-->\n\n\n\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043f\u043e \u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0436\u0438\u0434\u043a\u043e\u0441\u0442\u0438 \u043d\u0435 \u0431\u044b\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043b\u0430\u0443\u043d\u0447\u0435\u0440\u0430. \u0416\u0438\u0434\u043a\u043e\u0441\u0442\u0438 \u0432 \u041c\u0430\u0439\u043d\u043a\u0440\u0430\u0444\u0442\u0435 &#8211; \u0431\u043b\u043e\u043a\u0438, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 ID. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 1.0.3, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d Inner Core, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e ID \u0431\u043b\u043e\u043a\u043e\u0432 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0435 \u0436\u0438\u0434\u043a\u043e\u0441\u0442\u0438 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c \u0434\u0440\u0430\u0433\u043e\u0446\u0435\u043d\u043d\u044b\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 ID \u0431\u043b\u043e\u043a\u043e\u0432. <\/p>\n\n\n\n<p>\u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c <a href=\"https:\/\/wiki.mineprogramming.org\/index.php\/InnerCore\/%D0%92%D0%B8%D0%B7%D1%83%D0%B0%D0%BB%D1%8C%D0%BD%D0%B0%D1%8F_%D1%81%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BB%D1%8F%D1%8E%D1%89%D0%B0%D1%8F_ICRender\">ICRender<\/a> \u0438 <a href=\"https:\/\/wiki.mineprogramming.org\/index.php\/InnerCore\/%D0%A0%D0%B5%D0%BD%D0%B4%D0%B5%D1%80_%D0%B1%D0%BB%D0%BE%D0%BA%D0%BE%D0%B2\">BlockRenderer<\/a>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043b\u0430\u0441\u0441\u0443 <a href=\"https:\/\/wiki.mineprogramming.org\/index.php\/InnerCore\/%D0%9A%D0%BB%D0%B0%D1%81%D1%81_RenderMesh\">RenderMesh<\/a>, \u0432 Inner Core \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0431\u043b\u043e\u043a\u0438 \u043b\u044e\u0431\u043e\u0439 \u0444\u043e\u0440\u043c\u044b \u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430. \u0414\u043b\u044f \u043c\u0435\u043d\u044f \u044d\u0442\u043e \u0441\u0442\u0430\u043b\u043e \u043d\u0438\u0442\u043e\u0447\u043a\u043e\u0439 \u043d\u0430\u0434\u0435\u0436\u0434\u044b \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 \u0436\u0438\u0434\u043a\u043e\u0441\u0442\u0438. \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u044f \u0441\u0434\u0435\u043b\u0430\u043b &#8211; \u044d\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;pre lang=\"Javascript\">function buildFlowMesh(texture, direction, from, to){\n    var mesh = new RenderMesh();\n    mesh.setBlockTexture(texture.name, texture.data || 0);\n    \n    var vertices = [\n        [\n            [0, 0, 0],\n            [0, from, 0],\n            [1, 0, 0],\n        ],[ \n            [1, from, 0],\n            [1, 0, 0],\n            [0, from, 0],\n        ],[ \n            [0, 0, 0],\n            [0, 0, 1],\n            [0, from, 0],\n        ],[ \n            [0, to, 1],\n            [0, from, 0],\n            [0, 0, 1],\n        ],[ \n            [1, 0, 1],\n            [1, 0, 0],\n            [0, 0, 1],\n        ],[  \n            [1, 0, 1],\n            [0, 0, 1],\n            [1, 0, 0],\n        ],[  \n            [0, 0, 1],\n            [1, 0, 1],\n            [0, to, 1],\n        ],[  \n            [1, to, 1],\n            [0, to, 1],\n            [1, 0, 1],\n        ],[  \n            [1, 0, 0],\n            [1, from, 0],\n            [1, 0, 1],\n        ],[  \n            [1, to, 1],\n            [1, 0, 1],\n            [1, from, 0],\n        ],[  \n            [0, from, 0],\n            [0, to, 1],\n            [1, from, 0],\n        ],[  \n            [1, to, 1],\n            [1, from, 0],\n            [0, to, 1]\n        ]\n    ];\n    \n    let rotation = getRotationMatrix(direction);\n    \n    for(var i = 0; i &lt; vertices.length; i++){\n        var vertex = vertices[i];\n        let coords = numbers.matrix.multiply(vertex, rotation);\n        if(direction == 2 || direction == 3){\n            for(var j = 0; j &lt; 3; j++){\n                coords[j][0] += 1;\n                coords[j][2] += 1;\n            }\n        }\n        if(direction == 0 || direction == 2){\n            mesh.addVertex(coords[0][0], coords[0][1], coords[0][2], i % 2, i % 2);\n            mesh.addVertex(coords[1][0], coords[1][1], coords[1][2], (i + 1) % 2, i % 2);\n            mesh.addVertex(coords[2][0], coords[2][1], coords[2][2], i % 2, (i + 1) % 2);\n        } else {\n            mesh.addVertex(coords[0][0], coords[0][1], coords[0][2], i % 2, i % 2);\n            mesh.addVertex(coords[2][0], coords[2][1], coords[2][2], i % 2, (i + 1) % 2);\n            mesh.addVertex(coords[1][0], coords[1][1], coords[1][2], (i + 1) % 2, i % 2);\n        }\n        \n    }\n    \n    mesh.rebuild();\n    return mesh;\n}\n\nfunction getRotationMatrix(direction){\n    switch(direction){\n        case 0: return [[1, 0, 0], [0, 1, 0], [0, 0, 1]];\n        case 1: return [[0, 0, 1], [0, 1, 0], [1, 0, 0]];\n        case 2: return [[-1, 0, 0], [0, 1, 0], [0, 0, -1]];\n        case 3: return [[0, 0, -1], [0, 1, 0], [-1, 0, 0]];\n    }\n}&lt;\/pre><\/code><\/pre>\n\n\n\n<p>\u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u043d\u0434\u0435\u0440 \u043d\u0430\u043a\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430 \u043f\u043e\u0434 \u043b\u044e\u0431\u044b\u043c \u0443\u0433\u043b\u043e\u043c, \u0443\u043a\u0430\u0437\u0430\u0432 \u0432\u044b\u0441\u043e\u0442\u0443 (\u0432 \u0447\u0430\u0441\u0442\u044f\u0445 \u043e\u0442 \u0446\u0435\u043b\u043e\u0433\u043e) \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043f\u0443\u043d\u043a\u0442\u043e\u043c \u0431\u044b\u043b\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u0435\u043d\u0434\u0435\u0440\u044b \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043e\u0432 \u0438 \u0441\u043a\u043b\u043e\u043d\u043e\u0432. \u0414\u043b\u044f \u0440\u0430\u0441\u0441\u0447\u0451\u0442\u0430 \u0438\u0445 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 fluidity (\u0442\u0435\u043a\u0443\u0447\u0435\u0441\u0442\u044c) &#8211; \u0447\u0435\u043c \u043e\u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0435, \u0442\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u0435\u0447\u044c \u0436\u0438\u0434\u043a\u043e\u0441\u0442\u044c, \u0438 \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u043e\u0433\u0438\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0434\u0435\u0442\u0430\u043b\u0438. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;pre lang=\"Javascript\">var models = [];\n\/\/ Partial liquid\nvar step = 15 \/ fluidity;\nfor(var i = 0; i &lt; fluidity; i++){\n    for(var j = 0; j &lt; 4; j++){\n        let render = new ICRender.Model();\n        render.addEntry(buildFlowMesh(texture, j, (i + 1) * step, i * step));\n        models.push(render);\n    }        \n}\n        \n\/\/ Full liquid\nlet render = new ICRender.Model();\nrender.addEntry(buildFlowMesh(texture, 3, 15\/16, 15\/16));\nmodels.push(render);\n        \nBlockRenderer.setStaticICRender(BlockID.liquidFlow, 0, render);\nBlockRenderer.setStaticICRender(BlockID.liquidSource, 0, render);\nBlockRenderer.enableCoordMapping(BlockID.liquidFlow, 0, render);&lt;\/pre><\/code><\/pre>\n\n\n\n<p>\u0422\u0443\u0442 \u043c\u044b \u043d\u0430\u0431\u0438\u0440\u0430\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u043c\u0430\u043f\u043f\u0430\u0442\u044c (\u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c) \u043d\u0430 \u0431\u043b\u043e\u043a\u0438 \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u0445. <\/p>\n\n\n\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0438 \u0442\u0435\u0447\u0435\u043d\u0438\u0439 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0434\u0432\u0430 \u0431\u043b\u043e\u043a\u0430: \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 (\u043a\u0430\u043a \u0438 \u0441 \u0432\u0430\u043d\u0438\u043b\u044c\u043d\u044b\u043c\u0438 \u0436\u0438\u0434\u043a\u043e\u0441\u0442\u044f\u043c\u0438). \u0410 \u0432\u043e\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0435\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0448\u0430\u0442\u044c \u0443\u0436\u0435 \u0440\u0435\u043d\u0434\u0435\u0440. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;pre lang=\"Javascript\">var BLOCK_TYPE_LIQUID = Block.createSpecialType({\n    base: 8,\n    opaque: false\n}, \"liquid\");\n\n\nIDRegistry.genBlockID(\"liquidSource\");\nBlock.createBlock(\"liquidSource\", [\n    {name: \"Liquid Source\", inCreative: false}\n], BLOCK_TYPE_LIQUID);\n\n\nIDRegistry.genBlockID(\"liquidFlow\");\nBlock.createBlock(\"liquidFlow\", [\n    {name: \"Liquid Flow\", inCreative: false}\n], BLOCK_TYPE_LIQUID);&lt;\/pre><\/code><\/pre>\n\n\n\n<p>\u0418 \u0432\u043e\u0442 \u0442\u0443\u0442 \u0443\u0436\u0435 \u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 <a href=\"https:\/\/wiki.mineprogramming.org\/index.php\/InnerCore\/%D0%9A%D0%BB%D0%B0%D1%81%D1%81_RenderMesh\">RenderMesh<\/a> &#8211; \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u0438. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u044d\u0442\u043e \u043c\u0435\u043d\u044f \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u043e \u0438 \u044f \u043d\u0430\u0447\u0430\u043b \u043f\u0440\u043e\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0436\u0438\u0434\u043a\u043e\u0441\u0442\u0435\u0439. \u0412\u043a\u0440\u0430\u0442\u0446\u0435, \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n\n\n\n<ul><li>\u041f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u0436\u0438\u0434\u043a\u043e\u0441\u0442\u0438 \u0438\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u0431\u043b\u043e\u043a\u0430 \u0440\u044f\u0434\u043e\u043c \u0441 \u0436\u0438\u0434\u043a\u043e\u0441\u0442\u044c\u044e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0436\u0438\u0434\u043a\u043e\u0441\u0442\u0438 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439.<\/li><li>\u0412 \u0442\u0438\u043a\u0435 \u0440\u0430\u0437 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 (\u0438\u043b\u0438 \u0432 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0436\u0438\u0434\u043a\u043e\u0441\u0442\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438) \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0432\u0441\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0431\u043b\u043e\u043a\u0438:<ul><li>\u0415\u0441\u043b\u0438 \u0431\u043b\u043e\u043a &#8211; \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a, \u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u043e\u0437\u0434\u0443\u0445 \u0431\u043b\u043e\u043a\u043e\u043c \u0442\u0435\u0447\u0435\u043d\u0438\u044f \u0441\u043d\u0438\u0437\u0443 \u0438 \u043f\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u0430\u043c. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0431\u043b\u043e\u043a\u0443 \u0437\u0430\u0434\u0430\u0442\u044c \u0443\u0440\u043e\u0432\u0435\u043d\u044c (\u0432 \u0447\u0430\u0441\u0442\u044f\u0445 \u043e\u0442 \u0435\u0434\u0438\u043d\u0438\u0446\u044b) \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u0443 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430.<\/li><li>\u0415\u0441\u043b\u0438 \u0431\u043b\u043e\u043a &#8211; \u0442\u0435\u0447\u0435\u043d\u0438\u0435, \u0442\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u043c. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442\u0443, \u044d\u0442\u043e\u0442 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u043c\u0435\u043d\u044c\u0448\u0438\u0439, \u0447\u0435\u043c \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0439 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0439. \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c, \u0442\u043e \u0441\u043d\u0438\u0437\u0443 \u0438 \u043f\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u0430\u043c \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u043e\u0437\u0434\u0443\u0445 \u043d\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f. <\/li><li>\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0431\u043b\u043e\u043a \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439.<\/li><li>\u0412\u0441\u0435 \u0432\u043d\u043e\u0432\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439. <\/li><\/ul><\/li><\/ul>\n\n\n\n<p>\u042d\u0442\u0430 \u0441\u0445\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043d\u043e \u043e\u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0443 \u043b\u0430\u0432\u044b \u0438 \u0432\u043e\u0434\u044b \u0432 \u041c\u0430\u0439\u043d\u043a\u0440\u0430\u0444\u0442\u0435.<\/p>\n\n\n\n<p>\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043f\u043e\u0441\u043b\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 &#8211; \u0443\u0433\u043b\u043e\u0432\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438. \u0412\u0435\u0434\u044c \u0441\u043a\u043b\u043e\u043d \u0432\u043e\u0434\u044b \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u044f\u043c\u043e\u0439. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u043b \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0442\u0430\u043a:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"597\" src=\"https:\/\/mineprogramming.org\/wp-content\/uploads\/2019\/06\/liquids2-1024x597.png\" alt=\"\" class=\"wp-image-847\" srcset=\"https:\/\/mineprogramming.org\/wp-content\/uploads\/2019\/06\/liquids2-1024x597.png 1024w, https:\/\/mineprogramming.org\/wp-content\/uploads\/2019\/06\/liquids2-300x175.png 300w, https:\/\/mineprogramming.org\/wp-content\/uploads\/2019\/06\/liquids2-768x448.png 768w, https:\/\/mineprogramming.org\/wp-content\/uploads\/2019\/06\/liquids2.png 1456w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u0410 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043e\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438 \u0442\u0430\u043a\u0438\u043c:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"1024\" height=\"597\" src=\"https:\/\/mineprogramming.org\/wp-content\/uploads\/2019\/06\/liquids3-1024x597.png\" alt=\"\" class=\"wp-image-848\" srcset=\"https:\/\/mineprogramming.org\/wp-content\/uploads\/2019\/06\/liquids3-1024x597.png 1024w, https:\/\/mineprogramming.org\/wp-content\/uploads\/2019\/06\/liquids3-300x175.png 300w, https:\/\/mineprogramming.org\/wp-content\/uploads\/2019\/06\/liquids3-768x448.png 768w, https:\/\/mineprogramming.org\/wp-content\/uploads\/2019\/06\/liquids3.png 1456w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u043e \u0435\u0449\u0451 \u043d\u0435 \u0441\u0430\u043c\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0432\u043e\u0434\u0430. \u0415\u0441\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043a\u043e\u0433\u0434\u0430 \u0432\u0435\u0440\u0445\u043d\u044f\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043f\u043b\u043e\u0441\u043a\u0430\u044f, \u0430 \u0438\u043c\u0435\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0440\u0435\u0431\u0440\u043e. <\/p>\n\n\n\n<p>\u041a\u0440\u043e\u043c\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0441 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u0432\u044f\u0437\u043a\u043e\u0441\u0442\u044c\u044e. \u042f \u0432\u0438\u0436\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u043c \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0438 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0438\u0433\u0440\u043e\u043a\u0430 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0440\u0435\u0436\u0438\u043c\u0430 \u043f\u043e\u043b\u0451\u0442\u0430. <\/p>\n\n\n\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0436\u0438\u0434\u043a\u043e\u0441\u0442\u0435\u0439 \u0432 Inner Core \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0441\u0438\u043b, \u0447\u0435\u043c \u044f \u043c\u043e\u0433 \u043e\u0436\u0438\u0434\u0430\u0442\u044c, \u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u044f \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438. \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u043f\u0435\u0440\u0435\u043d\u044f\u0442\u044c \u044d\u0441\u0442\u0430\u0444\u0435\u0442\u0443 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c \u043d\u0430\u0447\u0430\u0442\u043e\u0435 \u043c\u043d\u043e\u0439, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u0438 (\u043d\u0435 \u0437\u043d\u0430\u044e \u043a\u0430\u043a \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e-\u0440\u0443\u0441\u0441\u043a\u0438) feel free to use it as you like.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;pre lang=\"Javascript\">LIBRARY({\n    name: \"LiquidLib\",\n    version: 1,\n    shared: true,\n    api: \"CoreEngine\"\n});\n\n\nIMPORT(\"numbers.js\");\n\n\nvar BLOCK_TYPE_LIQUID = Block.createSpecialType({\n    base: 8,\n    opaque: false\n}, \"liquid\");\n\n\nIDRegistry.genBlockID(\"liquidSource\");\nBlock.createBlock(\"liquidSource\", [\n    {name: \"Liquid Source\", inCreative: false}\n], BLOCK_TYPE_LIQUID);\n\n\nIDRegistry.genBlockID(\"liquidFlow\");\nBlock.createBlock(\"liquidFlow\", [\n    {name: \"Liquid Flow\", inCreative: false}\n], BLOCK_TYPE_LIQUID);\n\n\nvar LiquidLib = {\n    liquids: {},\n    \/*\n     * Creates liquid block\n     * @param liquidId string liquid id registered using LiquidRegistry\n     * @param texture texture information\n     * @param fluidity determines how many blocks will liquid level \n     * reduce before stopping\n     *\/\n    registerLiquid: function(liquidId, texture, fluidity){\n        if(!LiquidRegistry.isExists(liquidId)){\n            throw new Excepion(\"Liquid id doesn't exist!\");\n        }\n        \n        var models = [];\n        var step = 15 \/ fluidity;\n        for(var i = 0; i &lt; fluidity; i++){\n            for(var j = 0; j &lt; 4; j++){\n                let render = new ICRender.Model();\n                render.addEntry(buildFlowMesh(texture, j, (i + 1) * step, i * step));\n                models.push(render);\n            }\n            \n        }\n        \n        \/\/ full liquid\n        let render = new ICRender.Model();\n        render.addEntry(buildFlowMesh(texture, 3, 15\/16, 15\/16));\n        models.push(render);\n        \n        BlockRenderer.setStaticICRender(BlockID.liquidFlow, 0, render);\n        BlockRenderer.setStaticICRender(BlockID.liquidSource, 0, render);\n        BlockRenderer.enableCoordMapping(BlockID.liquidFlow, 0, render);\n        \n        \n        LiquidLib.liquids[liquidId] = {\n            fluidity: fluidity,\n            models: models\n        }\n    }\n};\n\n\nfunction buildFlowMesh(texture, direction, from, to){\n    var mesh = new RenderMesh();\n    mesh.setBlockTexture(texture.name, texture.data || 0);\n    \n    var vertices = [\n        [\n            [0, 0, 0],\n            [0, from, 0],\n            [1, 0, 0],\n        ],[ \n            [1, from, 0],\n            [1, 0, 0],\n            [0, from, 0],\n        ],[ \n            [0, 0, 0],\n            [0, 0, 1],\n            [0, from, 0],\n        ],[ \n            [0, to, 1],\n            [0, from, 0],\n            [0, 0, 1],\n        ],[ \n            [1, 0, 1],\n            [1, 0, 0],\n            [0, 0, 1],\n        ],[  \n            [1, 0, 1],\n            [0, 0, 1],\n            [1, 0, 0],\n        ],[  \n            [0, 0, 1],\n            [1, 0, 1],\n            [0, to, 1],\n        ],[  \n            [1, to, 1],\n            [0, to, 1],\n            [1, 0, 1],\n        ],[  \n            [1, 0, 0],\n            [1, from, 0],\n            [1, 0, 1],\n        ],[  \n            [1, to, 1],\n            [1, 0, 1],\n            [1, from, 0],\n        ],[  \n            [0, from, 0],\n            [0, to, 1],\n            [1, from, 0],\n        ],[  \n            [1, to, 1],\n            [1, from, 0],\n            [0, to, 1]\n        ]\n    ];\n    \n    let rotation = getRotationMatrix(direction);\n    \n    for(var i = 0; i &lt; vertices.length; i++){\n        var vertex = vertices[i];\n        let coords = numbers.matrix.multiply(vertex, rotation);\n        if(direction == 2 || direction == 3){\n            for(var j = 0; j &lt; 3; j++){\n                coords[j][0] += 1;\n                coords[j][2] += 1;\n            }\n        }\n        if(direction == 0 || direction == 2){\n            mesh.addVertex(coords[0][0], coords[0][1], coords[0][2], i % 2, i % 2);\n            mesh.addVertex(coords[1][0], coords[1][1], coords[1][2], (i + 1) % 2, i % 2);\n            mesh.addVertex(coords[2][0], coords[2][1], coords[2][2], i % 2, (i + 1) % 2);\n        } else {\n            mesh.addVertex(coords[0][0], coords[0][1], coords[0][2], i % 2, i % 2);\n            mesh.addVertex(coords[2][0], coords[2][1], coords[2][2], i % 2, (i + 1) % 2);\n            mesh.addVertex(coords[1][0], coords[1][1], coords[1][2], (i + 1) % 2, i % 2);\n        }\n        \n    }\n    \n    mesh.rebuild();\n    return mesh;\n}\n\nfunction getRotationMatrix(direction){\n    switch(direction){\n        case 0: return [[1, 0, 0], [0, 1, 0], [0, 0, 1]];\n        case 1: return [[0, 0, 1], [0, 1, 0], [1, 0, 0]];\n        case 2: return [[-1, 0, 0], [0, 1, 0], [0, 0, -1]];\n        case 3: return [[0, 0, -1], [0, 1, 0], [-1, 0, 0]];\n    }\n}\n\n\nvar SIDES = [\n    [1, 0, 0],\n    [0, 1, 0],\n    [0, 0, 1],\n    [-1, 0, 0],\n    [0, -1, 0],\n    [0, 0, -1]\n];\n\n\nvar LiquidUpdater = {\n    blocks: [],\n    updates: [],\n    \n    update: function(x, y, z){\n        updates.push({x: x, y: y, z: z});\n    },\n    \n    tick: function(){\n        \n    }\n}\n\n\nCallback.addCallback(\"tick\", function(){\n    LiquidUpdater.tick();\n});\n\n\nLiquidRegistry.registerLiquid(\"myLiquid\", \"My Liquid\", []);\nLiquidLib.registerLiquid(\"myLiquid\", {name: \"my_liquid\"}, 16);\n\nCallback.addCallback(\"ItemUse\", function(coords, item, block){\n    let x = coords.relative.x;\n    let y = coords.relative.y;\n    let z = coords.relative.z;\n    if(item.id == 280){\n        World.setBlock(x, y, z, BlockID.liquidSource, 0);  \n        LiquidUpdater.blocks.push({x: x, y: y, z: z, id: \"myLiquid\"});\n        LiquidUpdater.update(x, y, z);\n    }\n});\n\nEXPORT(\"LiquidLib\", LiquidLib);&lt;\/pre><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u0421 \u0441\u0430\u043c\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Inner Core \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0430 \u043e\u0434\u043d\u0430 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 &#8211; \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0436\u0438\u0434\u043a\u043e\u0441\u0442\u0435\u0439. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u0440\u043e \u0441\u0432\u043e\u044e \u043f\u043e\u043f\u044b\u0442\u043a\u0443 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043b\u0430\u0443\u043d\u0447\u0435\u0440\u0430.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[],"translation":{"provider":"WPGlobus","version":"2.6.8","language":"en","enabled_languages":["ru","en"],"languages":{"ru":{"title":true,"content":true,"excerpt":false},"en":{"title":false,"content":false,"excerpt":false}}},"_links":{"self":[{"href":"https:\/\/mineprogramming.org\/en\/wp-json\/wp\/v2\/posts\/844"}],"collection":[{"href":"https:\/\/mineprogramming.org\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mineprogramming.org\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mineprogramming.org\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mineprogramming.org\/en\/wp-json\/wp\/v2\/comments?post=844"}],"version-history":[{"count":3,"href":"https:\/\/mineprogramming.org\/en\/wp-json\/wp\/v2\/posts\/844\/revisions"}],"predecessor-version":[{"id":850,"href":"https:\/\/mineprogramming.org\/en\/wp-json\/wp\/v2\/posts\/844\/revisions\/850"}],"wp:attachment":[{"href":"https:\/\/mineprogramming.org\/en\/wp-json\/wp\/v2\/media?parent=844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mineprogramming.org\/en\/wp-json\/wp\/v2\/categories?post=844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mineprogramming.org\/en\/wp-json\/wp\/v2\/tags?post=844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}