-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_index.html
More file actions
146 lines (136 loc) · 5.15 KB
/
Copy path_index.html
File metadata and controls
146 lines (136 loc) · 5.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Play creative mode Minecraft right from your browser!">
<meta name="keywords" content="Khan Academy, Programs, Search">
<meta property="og:title" content="MineKhan"/>
<meta property="og:description" content="Play creative mode Minecraft right from your browser!"/>
<meta property="og:image" content="https://www.khanacademy.org/computer-programming/minekhan/5647155001376768/5308848032661504.png"/>
<title>MineKhan</title>
<!-- Icon -->
<link rel="shortcut icon" type="image/ico" href="https://willard.fun/assets/minekhan.ico">
<!-- CSS Styles -->
<link rel="stylesheet" href="src/css/_main.css">
</head>
<body>
<!-- Text so that Lighthouse believes the page is loaded and to provide search terms. -->
<div id="background-text">
<h1>MineKhan</h1>
<p>Play MineKhan online! This game is a free Minecraft clone developed on <a href="https://www.khanacademy.org/computer-programming/minekhan/5647155001376768">Khan Academy</a>, and later moved to my own website so that I could take advantage of multiplayer servers. The front-end code is completely open source and maintained on <a href="https://github.com/Willard21/MineKhan">GitHub</a>, where contributions are welcome.</p>
</div>
<canvas id="overlay" tabindex="0" width="600" height="600" class="corner background"></canvas>
<canvas id="webgl-canvas" class="corner"></canvas>
<input type="text" id="savebox" class="hidden" spellcheck="false" style="position: absolute; top: 10px; left: 10px; z-index: 1;">
<input type="text" id="boxcentertop" class="hidden" spellcheck="false">
<div id="quota" class="hidden"></div>
<div id="onhover" class="hidden"></div>
<div id="chat" class="hidden"></div>
<input id="chatbar" class="hidden" list="commands">
<datalist id="commands">
<option>/ban</option>
<option>/online</option>
</datalist>
<p id="savedirections" class="hidden" style="position: absolute; top: 40px; left: 10px; z-index: 1; background-color: rgba(255, 255, 255, 0.3);">
To share your world on KA, copy/paste the saveString<br>
from this box into the code on line 295.<br>
var loadString = "Your Code Here";<br>
Then save the program as a Spin-off.
</p>
<div class="world-select hidden" id="worlds"></div>
<p id="message" class="hidden" style="position: absolute; top: 10px; right: 10px; z-index: 1; text-align: right; background-color: rgba(255, 255, 255, 0.3);"></p>
<span class="hidden" id="loading-text"></span>
<div id="inv-container" class="hidden">
<div id="inv-scroll">
<!-- This is very very important: canvases need that tabindex thing to capture keyboard events. Idk why. But I spent hours trying to figure it out. -->
<canvas id="container" tabindex="0"></canvas>
</div>
<canvas id="inventory" tabindex="0"></canvas>
</div>
<canvas id="hotbar" class="hidden"></canvas>
<script>
// Khan Academy instructions:
// Place save code here to load your world. Make extra sure you got it copied so you don't paste in the wrong thing and delete your world on accident lol
window.parent.loadString = ""
window.parent.exports = {}
</script>
<!-- JavaScript -->
<script type="module" src="src/js/_main.js"></script>
</body>
</html>
<!-- function hcyl(bottom, height, radius, id) {
let radsq = radius * radius
let innerRadsq = (radius - 1.2) * (radius - 1.2)
height += bottom
for (let x = -radius; x <= radius; x++) {
for (let y = bottom; y < height; y++) {
for (let z = -radius; z <= radius; z++) {
let d = x * x + z * z
if (d < radsq && d >= innerRadsq) {
world.setBlock(p2.x + x, p2.y + y, p2.z + z, id)
}
}
}
}
}
function cyl(bottom, height, radius, id) {
let radsq = radius * radius
height += bottom
for (let x = -radius; x <= radius; x++) {
for (let y = bottom; y < height; y++) {
for (let z = -radius; z <= radius; z++) {
let d = x * x + z * z
if (d < radsq) {
world.setBlock(p2.x + x, p2.y + y, p2.z + z, id)
}
}
}
}
}
function sphereoid(w, h, d, id) {
let w2 = w * w
let h2 = h * h
let d2 = d * d
let w3 = (w - 1.5) * (w - 1.5)
let h3 = (h - 1.5) * (h - 1.5)
let d3 = (d - 1.5) * (d - 1.5)
for (let y = -h; y < h; y++) {
for (let x = -w; x <= w; x++) {
for (let z = -d; z <= d; z++) {
let n = x * x / w2 + y * y / h2 + z * z / d2
let n2 = x * x / w3 + y * y / h3 + z * z / d3
if (n < 1 && n2 >= 1) {
world.setBlock(p2.x + x, p2.y + y, p2.z + z, id)
}
}
}
}
}
function sleep(ms) {
return new Promise(resolve => setTimeout(() => resolve(), ms))
}
async function asphereoid(w, h, d, id) {
let px = p2.x
let py = p2.y
let pz = p2.z
let w2 = w * w
let h2 = h * h
let d2 = d * d
let w3 = (w - 1.5) * (w - 1.5)
let h3 = (h - 1.5) * (h - 1.5)
let d3 = (d - 1.5) * (d - 1.5)
for (let y = -h; y < h; y++) {
for (let x = -w; x <= w; x++) {
for (let z = -d; z <= d; z++) {
let n = x * x / w2 + y * y / h2 + z * z / d2
let n2 = x * x / w3 + y * y / h3 + z * z / d3
if (n < 1 && n2 >= 1) {
world.setBlock(px + x, py + y, pz + z, id)
await sleep(10)
}
}
}
}
}
-->