Skip to content

Instantly share code, notes, and snippets.

@haveyouwantto
Last active May 15, 2021 18:44
Show Gist options
  • Save haveyouwantto/f2e0009e2f6c7b1cf2d5377a1cee8755 to your computer and use it in GitHub Desktop.
Save haveyouwantto/f2e0009e2f6c7b1cf2d5377a1cee8755 to your computer and use it in GitHub Desktop.
Minecraft Function Generator
<html>
<body>
<script type="text/javascript">
function sier(){
let z = 0
for (z = -50; z < 50; z++) {
let zs = z
draw(z)
}
}
function draw(z) {
for (let x = -50; x < 50; x++) {
let y = x ^ z
setTile(x,y,z,"redstone_block")
}
}
function setTile(x,y,z,id){
document.write("setblock ~"+x+" ~"+y+" ~"+z+" "+id+"<br>")
}
function qiuling(x, y, z, r, l) {
y--
let pi = Math.PI * 0.5
l = l * 0.7
let a = 1.4
let b = 4
let c = 7
let d = Math.random() * 30 + 20
let a1 = Math.random() * 300000
let a2 = Math.random() * 50000000
let a3 = Math.random() * 8000
for (let m = -r; m < r; m++) {
for (let n = -r; n < r; n++) {
let ls = (Math.cos(pi * m / r) * Math.cos(pi * n / r)) * l - (Math.sin(pi * m * a / r + b) * Math.cos(pi * n * a / r + c)) * l * 0.25 + (Math.cos(pi * m * a * 2 / r + b * d) + Math.sin(pi * n * a * 2 / r + c * d)) * l * 0.2 - (Math.sin(pi * m * a * 3 / r + b * d * 2) * Math.sin(pi * n * a * 3 / r + c * d * 2)) * l * 0.15
if (ls > 0) {
setlongblock(x+m, y, z + n, ls)
}
}
}
}
function setlongblock(x, y, z, l) {
for (let i = 0; i <= l; i++) {
if (i > 3) setTile(x, y + l - i, z, "stone")
else if (i > 0) setTile(x, y + l - i, z, "dirt")
else if (i == 0) setTile(x, y + l, z, "grass")
}
}
qiuling(1395,4,317,20,10)
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment