JSFiddle - React, Tailwind, and code Playground
by Drath
HTML
<pre></pre>
JavaScript
$(function () {
var template = ["", "cobblestone", "cobblestone", "cobblestone", "", "cobblestone", "cobblestone", "stonewall", "cobblestone", "cobblestone", "", "cobblestone", "cobblestone", "cobblestone", ""];
var countX = 0;
var countY = 0;
$('pre').append("tiles: [\n");
for (var i = 0; i <= template.length; i++) {
if (countX === 5) {
countX = 0;
countY++;
}
if (template[i]) {
$('pre').append("\t{\n");
$('pre').append("\t\ttileId: '" + template[i] + "',\n");
$('pre').append("\t\tx: " + countX + ",\n");
$('pre').append("\t\ty: " + countY + "\n");
$('pre').append("\t},\n");
}
countX++;
}
$('pre').append("]");
});