Structure blocks in Minecraft
[ad_1]
Save mode allows players to highlight a structure in the world and save it to memory, a level file, or a separate file. In the GUI, players can enter the name of the structure, which cannot contain capital letters or special characters but can have underscores and hyphens. In Bedrock Edition, the structure name has the “mystructure:” prefix by default.
Players can also enter the X, Y, and Z values for the structure’s relative position based on the position of the structure block. This sets the origin of the structure outline. The maximum allowed distance from the structure block in Java Edition is 48 blocks in any direction, while in Bedrock Edition, it is 64 blocks horizontally and 256 blocks vertically.
The GUI also includes the option to show invisible blocks, which displays them as small colored cubes. In Java Edition, invisible blocks are shown as white, while in Bedrock Edition, they are shown as green, blue, or red, depending on the axis. The maximum structure size is 48x48x48 in Java Edition and 64x256x64 in Bedrock Edition.
To save the structure, players can click the “Save” button. In Java Edition, this saves the structure to a file, with the name of the structure being the name of the file. Players can save structures to a local folder or share them with other players by sending them the file. The structure block is a very useful tool in creating detailed Minecraft worlds.
div>
]+?>|
|<\/p>)/img, ""));
}
for(var i=0; i < toReplace.length; i++) {
html = html.replace(matches[i], toReplace[i]);
}
}
return html;
}
function getSanitizedHeadingHTML(infoInput, slug) {
if(!infoInput) {
return "";
}
//ignore content if it has only whitespaces (\n,
etc)
if(infoInput.textContent.trim() === '' && !infoInput.innerHTML.match(/
|<\/p>)/img, "")); } for(var i=0; i < toReplace.length; i++) { html = html.replace(matches[i], toReplace[i]); } } return html; } function setIdToHeadingsTag(html,slug){ var counter = 0; var h2Matches = html.match(/
(.*?)<\/h3>/g);
if(h3Matches != null){
var resultH3 = html.match(/(.*?)<\/h3>/g).map(function(val) {
return val.replace(' 1) {
var parser = new DOMParser();
html = parser.parseFromString(content, 'text/html');
html = html.querySelector('body').getElementsByTagName('p');
}
var para = new Array();
for (var index = 0; index < html.length; index++) {
if (html[index].innerText != undefined && html[index].innerText != "" && html[index].innerText.length > 1 && html[index].innerHTML.indexOf(" 0) appendPart(0, selectionStart);
var fakeRange = appendPart(selectionStart, selectionEnd);
if(textLen > selectionEnd) appendPart(selectionEnd, textLen);
// Styles to inherit the font styles of the element
fakeClone.style.cssText = cssDefaultStyles;
// Styles to position the text node at the desired position
fakeClone.style.position = "absolute";
fakeClone.style.top = topPos + "px";
fakeClone.style.left = 38 + "px";
fakeClone.style.width = width + "px";
fakeClone.style.height = height + "px";
$('#editor').appendChild(fakeClone);
var returnValue = fakeRange.getBoundingClientRect(); //Get rect
var arrOfValues = [];
if (returnValue.height > 21) { // height of fakeRange > max height of fakeRange in single line
// split into multiple spans and return all spans
var words = fakeRange.innerText.split(" ");
var newFakeRange = document.createElement('span');
newFakeRange.style.cssText = cssDefaultStyles;
newFakeRange.textContent = words[0];
fakeClone.replaceChild(newFakeRange, fakeRange);
arrOfValues.push(newFakeRange.getBoundingClientRect());
for(var i = 1; i < words.length; i++) {
var fakeRangeSubPart1 = document.createElement('span');
fakeRangeSubPart1.style.cssText = cssDefaultStyles;
fakeRangeSubPart1.textContent = " ";
newFakeRange.parentNode.insertBefore(fakeRangeSubPart1, newFakeRange.nextSibling);
arrOfValues.push(fakeRangeSubPart1.getBoundingClientRect());
var fakeRangeSubPart2 = document.createElement('span');
fakeRangeSubPart2.style.cssText = cssDefaultStyles;
fakeRangeSubPart2.textContent = words[i];
fakeRangeSubPart1.parentNode.insertBefore(fakeRangeSubPart2, fakeRangeSubPart1.nextSibling);
arrOfValues.push(fakeRangeSubPart2.getBoundingClientRect());
newFakeRange = fakeRangeSubPart2;
}
fakeClone.parentNode.removeChild(fakeClone);
return arrOfValues;
}
fakeClone.parentNode.removeChild(fakeClone);
return returnValue;
// Local functions for readability of the previous code
function appendPart(start, end){
var span = document.createElement("span");
span.style.cssText = cssDefaultStyles; //Force styles to prevent unexpected results
span.textContent = text.substring(start, end);
fakeClone.appendChild(span);
return span;
}
// Computing offset position
function getInputOffset(){
var body = document.body,
win = document.defaultView,
docElem = document.documentElement,
box = document.createElement(tagName);
box = input.getBoundingClientRect();
var editorOffset = $('#editor').getBoundingClientRect().top;
var clientTop = docElem.clientTop || body.clientTop || 0,
clientLeft = docElem.clientLeft || body.clientLeft || 0,
scrollTop = win.pageYOffset || docElem.scrollTop || body.scrollTop,
scrollLeft = win.pageXOffset || docElem.scrollLeft || body.scrollLeft;
return {
top : box.top + scrollTop - clientTop - editorOffset,
left: box.left + scrollLeft - clientLeft
};
}
function getInputCSS(prop, isnumber){
var val = document.defaultView.getComputedStyle(input, null).getPropertyValue(prop);
return isnumber ? parseFloat(val) : val;
}
}
function showMessageToUserInToolbar(message, type) {
var color="#a8bece";
if(type === "success") {
color = "green";
}
if(type === "warning") {
color = "#bfbf2f";
}
if(type === "error") {
color = "red";
}
$("#message-to-user-toolbar").style.color = color;
$("#message-to-user-toolbar").innerText = message;
}
function removeMessageFromToolbar() {
$("#message-to-user-toolbar").innerText = "";
}
function isValidURL(str) {
var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
'(\\#[-a-z\\d_]*)?$','i'); // fragment locator
return !!pattern.test(str);
}
1) { var parser = new DOMParser(); html = parser.parseFromString(content, 'text/html'); html = html.querySelector('body').getElementsByTagName('p'); } var para = new Array(); for (var index = 0; index < html.length; index++) { if (html[index].innerText != undefined && html[index].innerText != "" && html[index].innerText.length > 1 && html[index].innerHTML.indexOf(" 0) appendPart(0, selectionStart); var fakeRange = appendPart(selectionStart, selectionEnd); if(textLen > selectionEnd) appendPart(selectionEnd, textLen); // Styles to inherit the font styles of the element fakeClone.style.cssText = cssDefaultStyles; // Styles to position the text node at the desired position fakeClone.style.position = "absolute"; fakeClone.style.top = topPos + "px"; fakeClone.style.left = 38 + "px"; fakeClone.style.width = width + "px"; fakeClone.style.height = height + "px"; $('#editor').appendChild(fakeClone); var returnValue = fakeRange.getBoundingClientRect(); //Get rect var arrOfValues = []; if (returnValue.height > 21) { // height of fakeRange > max height of fakeRange in single line // split into multiple spans and return all spans var words = fakeRange.innerText.split(" "); var newFakeRange = document.createElement('span'); newFakeRange.style.cssText = cssDefaultStyles; newFakeRange.textContent = words[0]; fakeClone.replaceChild(newFakeRange, fakeRange); arrOfValues.push(newFakeRange.getBoundingClientRect()); for(var i = 1; i < words.length; i++) { var fakeRangeSubPart1 = document.createElement('span'); fakeRangeSubPart1.style.cssText = cssDefaultStyles; fakeRangeSubPart1.textContent = " "; newFakeRange.parentNode.insertBefore(fakeRangeSubPart1, newFakeRange.nextSibling); arrOfValues.push(fakeRangeSubPart1.getBoundingClientRect()); var fakeRangeSubPart2 = document.createElement('span'); fakeRangeSubPart2.style.cssText = cssDefaultStyles; fakeRangeSubPart2.textContent = words[i]; fakeRangeSubPart1.parentNode.insertBefore(fakeRangeSubPart2, fakeRangeSubPart1.nextSibling); arrOfValues.push(fakeRangeSubPart2.getBoundingClientRect()); newFakeRange = fakeRangeSubPart2; } fakeClone.parentNode.removeChild(fakeClone); return arrOfValues; } fakeClone.parentNode.removeChild(fakeClone); return returnValue; // Local functions for readability of the previous code function appendPart(start, end){ var span = document.createElement("span"); span.style.cssText = cssDefaultStyles; //Force styles to prevent unexpected results span.textContent = text.substring(start, end); fakeClone.appendChild(span); return span; } // Computing offset position function getInputOffset(){ var body = document.body, win = document.defaultView, docElem = document.documentElement, box = document.createElement(tagName); box = input.getBoundingClientRect(); var editorOffset = $('#editor').getBoundingClientRect().top; var clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, scrollTop = win.pageYOffset || docElem.scrollTop || body.scrollTop, scrollLeft = win.pageXOffset || docElem.scrollLeft || body.scrollLeft; return { top : box.top + scrollTop - clientTop - editorOffset, left: box.left + scrollLeft - clientLeft }; } function getInputCSS(prop, isnumber){ var val = document.defaultView.getComputedStyle(input, null).getPropertyValue(prop); return isnumber ? parseFloat(val) : val; } } function showMessageToUserInToolbar(message, type) { var color="#a8bece"; if(type === "success") { color = "green"; } if(type === "warning") { color = "#bfbf2f"; } if(type === "error") { color = "red"; } $("#message-to-user-toolbar").style.color = color; $("#message-to-user-toolbar").innerText = message; } function removeMessageFromToolbar() { $("#message-to-user-toolbar").innerText = ""; } function isValidURL(str) { var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name '((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path '(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string '(\\#[-a-z\\d_]*)?$','i'); // fragment locator return !!pattern.test(str); }
"; } entityList = entityList + "Don't want to link
"; entityList = entityList + "Close
"; dropdownElem.innerHTML = entityList; var entityLinks = dropdownElem.getElementsByClassName("entity-links"); for (var j = 0; j < entityLinks.length; j++) { entityLinks[j].addEventListener("click", linkEntity); } var dismissDropdown = dropdownElem.getElementsByClassName("dismiss-dropdown")[0]; dismissDropdown.addEventListener("click", dismissSuggestionDropdown); var closeDropdown = dropdownElem.getElementsByClassName("close-dropdown")[0]; closeDropdown.addEventListener("click", closeSuggestionDropdown); } else { var noResults = "No Results Found
Dismiss
"; dropdownElem.innerHTML = noResults; var dismissDropdown = dropdownElem.getElementsByClassName("dismiss-dropdown")[0]; dismissDropdown.addEventListener("click", dismissSuggestionDropdown); } entityElem.parentNode.insertBefore(dropdownElem, entityElem.nextSibling); var popupXPosition = elementXPosition; if (elementPosInScreen > 75) { popupXPosition = elementXPosition - dropdownElem.offsetWidth; } dropdownElem.style.left = Math.round(popupXPosition) + "px"; dropdownElem.style.top = Math.round(dropdownElem.offsetTop + entityElem.offsetHeight) + "px"; } function closeSuggestionDropdown(event) { var dropdownContent = event.target.parentElement; addClass(dropdownContent, "hidden"); } function removeOtherDropdowns() { var allDropdown = $all('.dropdown-content'); for (var i = 0; i < allDropdown.length; i++) { allDropdown[i].remove(); } } function dismissSuggestionDropdown(event) { var linkedElem = event.target.parentElement.previousElementSibling; if (hasClass(linkedElem, 'entity-link')) { linkedElem.removeAttribute('class'); linkedElem.removeAttribute('id'); linkedElem.removeAttribute('tabindex'); linkedElem.removeEventListener("click", onEntityClicked); } event.target.parentElement.remove(); } // update link in preview along with updating in quill function linkEntity(event) { var node; if (event.target.className == 'entity-links') { node = event.target; } else { node = event.target.parentElement; } var entityLink = node.dataset.link; var linkedElem = node.parentElement.previousElementSibling; var parentOfElem = linkedElem.parentElement; var newElem = document.createElement('a'); newElem.setAttribute('href', entityLink); newElem.setAttribute('target', "_blank"); newElem.setAttribute('rel', "noopener noreferrer"); newElem.setAttribute('data-mce-href', entityLink); newElem.innerText = linkedElem.innerText; parentOfElem.replaceChild(newElem, linkedElem); node.parentElement.remove(); // Process preview html and remove the unwanted tags such as link suggestion and set it as html var previewHTML = getPreviewContent(); var resultHTML = ""; var htmlFormatted = stringToHTML(previewHTML); var allTags = htmlFormatted.querySelectorAll("body > *"); var replacedKeywords = []; for (var tag of allTags) { // ignore toc if (tag.classList.contains("toc-info--holder")) { continue; } var linkSuggestionsTags = tag.getElementsByClassName('entity-link'); for (var i = linkSuggestionsTags.length - 1; i > -1; i--) { var linkSuggestionsTag = linkSuggestionsTags[i]; var textNode = document.createTextNode(linkSuggestionsTag.innerText); linkSuggestionsTags[i].parentNode.replaceChild(textNode, linkSuggestionsTag); } resultHTML = resultHTML + tag.outerHTML; } mainEditor.setContent(resultHTML); } var loadEmbedScriptsAsync = function() { loadScriptAsync(" function() { twttr.widgets.load() }); loadScriptAsync(" function() { if (typeof(instgrm) != 'undefined') instgrm.Embeds.process() }); loadScriptAsync(" function() { FB.init({ status: false, version: 'v2.9', cookie: true, xfbml: true }); FB.XFBML.parse(); }); loadScriptAsync(" function() {}); loadScriptAsync(" function() {}); // ref: const script = document.createElement('script'); script.async = true; script.dataset.pinBuild = 'pinterestBuild'; script.src=" document.body.appendChild(script); } function processQuillHTML(processedData) { if (!processedData) return ""; processedData = processedData.replace(/\u200b/g, ''); processedData = processedData.replace(/\u00a0/g, ' '); // replace with space if (processedData.trim() === "
") { return ""; } processedData = processedData.replace(/
<p><\/p>/g, '
'); processedData = processedData.replace(/
<p><\/p><\/p>$/, '
<\/p>'); return processedData } function showFaqEditor(faqAnsEle) { // TODO: wait and invoke editor with text chosenFaqAnsEle = faqAnsEle; if (!faqEditor) { return; } removeClass($(".faq-editor-popup"), "hidden"); var preloadText = chosenFaqAnsEle.innerHTML; faqEditor.undoManager.reset(); faqEditor.setContent(preloadText); } function closeFaqEditor() { addClass($(".faq-editor-popup"), "hidden"); } function saveFaqContent() { closeFaqEditor(); chosenFaqAnsEle.innerHTML = tinyMCEEditorHelpersInstance.prepareContentForSave(faqEditor.getContent()); chosenFaqAnsEle = null; } function initTinyMCEForFAQ() { tinymce.init({ selector: "div#faq-editor", plugins: "sk-custom-link wordcount", toolbar: "undo redo | sk-custom-link", menubar: "", quickbars_selection_toolbar: "sk-custom-link", quickbars_insert_toolbar: "", toolbar_sticky: true, height: "100%", resize: false, keep_styles: false, allow_unsafe_link_target: true, newline_behavior: "default", invalid_elements: "script", branding: false, content_style: "a.sponsored_link { color: #d32f2f !important; }", setup: function(editor) { editor.on("init", function(e) { faqEditor = editor; }); }, }); }
script>[ad_2]
Comments are closed.