hytopia 0.3.13 → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,260 +3,113 @@
3
3
  {
4
4
  "id": 1,
5
5
  "name": "bricks",
6
- "textureUri": "blocks/bricks.png",
7
- "isCustom": false
6
+ "textureUri": "blocks/bricks.png"
8
7
  },
9
8
  {
10
9
  "id": 2,
11
10
  "name": "clay",
12
- "textureUri": "blocks/clay.png",
13
- "isCustom": false
11
+ "textureUri": "blocks/clay.png"
14
12
  },
15
13
  {
16
14
  "id": 3,
17
- "name": "coal-ore",
18
- "textureUri": "blocks/coal-ore.png",
19
- "isCustom": false
15
+ "name": "diamond-ore",
16
+ "textureUri": "blocks/diamond-ore.png"
20
17
  },
21
18
  {
22
19
  "id": 4,
23
- "name": "cobblestone",
24
- "textureUri": "blocks/cobblestone.png",
25
- "isCustom": false
20
+ "name": "dirt",
21
+ "textureUri": "blocks/dirt.png"
26
22
  },
27
23
  {
28
24
  "id": 5,
29
- "name": "creep",
30
- "textureUri": "blocks/creep.png",
31
- "isCustom": false
25
+ "name": "dragons-stone",
26
+ "textureUri": "blocks/dragons-stone.png"
32
27
  },
33
28
  {
34
29
  "id": 6,
35
- "name": "diamond-block",
36
- "textureUri": "blocks/diamond-block.png",
37
- "isCustom": false
30
+ "name": "glass",
31
+ "textureUri": "blocks/glass.png"
38
32
  },
39
33
  {
40
34
  "id": 7,
41
- "name": "diamond-ore",
42
- "textureUri": "blocks/diamond-ore.png",
43
- "isCustom": false
35
+ "name": "grass",
36
+ "textureUri": "blocks/grass"
44
37
  },
45
38
  {
46
39
  "id": 8,
47
- "name": "dirt",
48
- "textureUri": "blocks/dirt.png",
49
- "isCustom": false
40
+ "name": "gravel",
41
+ "textureUri": "blocks/gravel.png"
50
42
  },
51
43
  {
52
44
  "id": 9,
53
- "name": "dragon_block",
54
- "textureUri": "blocks/dragon_block",
55
- "isCustom": false
45
+ "name": "ice",
46
+ "textureUri": "blocks/ice.png"
56
47
  },
57
48
  {
58
49
  "id": 10,
59
- "name": "dragons-stone",
60
- "textureUri": "blocks/dragons-stone.png",
61
- "isCustom": false
50
+ "name": "infected-shadowrock",
51
+ "textureUri": "blocks/infected-shadowrock.png"
62
52
  },
63
53
  {
64
54
  "id": 11,
65
- "name": "emerald-block",
66
- "textureUri": "blocks/emerald-block.png",
67
- "isCustom": false
55
+ "name": "log-side",
56
+ "textureUri": "blocks/log"
68
57
  },
69
58
  {
70
59
  "id": 12,
71
- "name": "emerald-ore",
72
- "textureUri": "blocks/emerald-ore.png",
73
- "isCustom": false
60
+ "name": "log-top",
61
+ "textureUri": "blocks/log"
74
62
  },
75
63
  {
76
64
  "id": 13,
77
- "name": "ghost-dirt",
78
- "textureUri": "blocks/ghost-dirt.png",
79
- "isCustom": false
65
+ "name": "mossy-coblestone",
66
+ "textureUri": "blocks/mossy-coblestone.png"
80
67
  },
81
68
  {
82
69
  "id": 14,
83
- "name": "glass",
84
- "textureUri": "blocks/glass.png",
85
- "isCustom": false
70
+ "name": "nuit",
71
+ "textureUri": "blocks/nuit.png"
86
72
  },
87
73
  {
88
74
  "id": 15,
89
- "name": "gold-ore",
90
- "textureUri": "blocks/gold-ore.png",
91
- "isCustom": false
75
+ "name": "oak-leaves",
76
+ "textureUri": "blocks/oak-leaves.png"
92
77
  },
93
78
  {
94
79
  "id": 16,
95
- "name": "grass",
96
- "textureUri": "blocks/grass",
97
- "isCustom": false
80
+ "name": "oak-planks",
81
+ "textureUri": "blocks/oak-planks.png"
98
82
  },
99
83
  {
100
84
  "id": 17,
101
- "name": "gravel",
102
- "textureUri": "blocks/gravel.png",
103
- "isCustom": false
85
+ "name": "sand",
86
+ "textureUri": "blocks/sand.png"
104
87
  },
105
88
  {
106
89
  "id": 18,
107
- "name": "ice",
108
- "textureUri": "blocks/ice.png",
109
- "isCustom": false
90
+ "name": "shadowrock",
91
+ "textureUri": "blocks/shadowrock.png"
110
92
  },
111
93
  {
112
94
  "id": 19,
113
- "name": "infected-shadowrock-core",
114
- "textureUri": "blocks/infected-shadowrock-core.png",
115
- "isCustom": false
95
+ "name": "stone",
96
+ "textureUri": "blocks/stone.png"
116
97
  },
117
98
  {
118
99
  "id": 20,
119
- "name": "infected-shadowrock",
120
- "textureUri": "blocks/infected-shadowrock.png",
121
- "isCustom": false
122
- },
123
- {
124
- "id": 21,
125
- "name": "iron-ore",
126
- "textureUri": "blocks/iron-ore.png",
127
- "isCustom": false
128
- },
129
- {
130
- "id": 22,
131
- "name": "lava",
132
- "textureUri": "blocks/lava.png",
133
- "isCustom": false
134
- },
135
- {
136
- "id": 23,
137
- "name": "log",
138
- "textureUri": "blocks/log",
139
- "isCustom": false
140
- },
141
- {
142
- "id": 24,
143
- "name": "mossy-coblestone",
144
- "textureUri": "blocks/mossy-coblestone.png",
145
- "isCustom": false
146
- },
147
- {
148
- "id": 25,
149
- "name": "nuit-leaves",
150
- "textureUri": "blocks/nuit-leaves.png",
151
- "isCustom": false
152
- },
153
- {
154
- "id": 26,
155
- "name": "nuit",
156
- "textureUri": "blocks/nuit.png",
157
- "isCustom": false
158
- },
159
- {
160
- "id": 27,
161
- "name": "oak-leaves",
162
- "textureUri": "blocks/oak-leaves.png",
163
- "isCustom": false
164
- },
165
- {
166
- "id": 28,
167
- "name": "oak-planks",
168
- "textureUri": "blocks/oak-planks.png",
169
- "isCustom": false
170
- },
171
- {
172
- "id": 29,
173
- "name": "sand-light",
174
- "textureUri": "blocks/sand-light.png",
175
- "isCustom": false
176
- },
177
- {
178
- "id": 30,
179
- "name": "sand",
180
- "textureUri": "blocks/sand.png",
181
- "isCustom": false
182
- },
183
- {
184
- "id": 31,
185
- "name": "sandstone-light",
186
- "textureUri": "blocks/sandstone-light.png",
187
- "isCustom": false
188
- },
189
- {
190
- "id": 32,
191
- "name": "sandstone",
192
- "textureUri": "blocks/sandstone.png",
193
- "isCustom": false
194
- },
195
- {
196
- "id": 33,
197
- "name": "shadow-pebble",
198
- "textureUri": "blocks/shadow-pebble.png",
199
- "isCustom": false
200
- },
201
- {
202
- "id": 34,
203
- "name": "shadowrock",
204
- "textureUri": "blocks/shadowrock.png",
205
- "isCustom": false
206
- },
207
- {
208
- "id": 35,
209
- "name": "snow",
210
- "textureUri": "blocks/snow.png",
211
- "isCustom": false
212
- },
213
- {
214
- "id": 36,
215
100
  "name": "stone-bricks",
216
- "textureUri": "blocks/stone-bricks.png",
217
- "isCustom": false
101
+ "textureUri": "blocks/stone-bricks.png"
218
102
  },
219
103
  {
220
- "id": 37,
221
- "name": "stone",
222
- "textureUri": "blocks/stone.png",
223
- "isCustom": false
224
- },
225
- {
226
- "id": 38,
227
- "name": "swirl-rune",
228
- "textureUri": "blocks/swirl-rune.png",
229
- "isCustom": false
230
- },
231
- {
232
- "id": 39,
104
+ "id": 21,
233
105
  "name": "void-sand",
234
- "textureUri": "blocks/void-sand.png",
235
- "isCustom": false
106
+ "textureUri": "blocks/void-sand.png"
236
107
  },
237
108
  {
238
- "id": 40,
239
- "name": "void_grass",
240
- "textureUri": "blocks/void_grass",
241
- "isCustom": false
242
- },
243
- {
244
- "id": 41,
245
- "name": "voidsoil",
246
- "textureUri": "blocks/voidsoil.png",
247
- "isCustom": false
248
- },
249
- {
250
- "id": 42,
251
- "name": "water-flow",
252
- "textureUri": "blocks/water-flow.png",
253
- "isCustom": false
254
- },
255
- {
256
- "id": 43,
109
+ "id": 22,
257
110
  "name": "water-still",
258
111
  "textureUri": "blocks/water-still.png",
259
- "isCustom": false
112
+ "isLiquid": true
260
113
  }
261
114
  ],
262
115
  "blocks": {
@@ -2767,6 +2620,5 @@
2767
2620
  "3,2,-11": 19,
2768
2621
  "3,3,-11": 19,
2769
2622
  "-1,1,12": 11
2770
- },
2771
- "entities": {}
2623
+ }
2772
2624
  }
@@ -0,0 +1,102 @@
1
+ <!--
2
+ This is a basic boilerplate example of how to implement simple game UI,
3
+ and also configure additional buttons for mobile compatibility.
4
+ -->
5
+
6
+ <script>
7
+ // Handle interact button touch / untouch
8
+ const mobileInteractButton = document.getElementById('mobile-interact-button');
9
+ mobileInteractButton.addEventListener('touchstart', e => {
10
+ e.preventDefault(); // Prevents mobile highlight/select/copy popup behaviors
11
+ mobileInteractButton.classList.add('active'); // more immediate feedback to add/remove active class
12
+ hytopia.pressInput('ml', true);
13
+ });
14
+
15
+ mobileInteractButton.addEventListener('touchend', e => {
16
+ e.preventDefault();
17
+ mobileInteractButton.classList.remove('active');
18
+ hytopia.pressInput('ml', false);
19
+ });
20
+
21
+ // Handle jump button touch / untouch
22
+ const mobileJumpButton = document.getElementById('mobile-jump-button');
23
+ mobileJumpButton.addEventListener('touchstart', e => {
24
+ e.preventDefault();
25
+ mobileJumpButton.classList.add('active');
26
+ hytopia.pressInput(' ', true);
27
+ });
28
+
29
+ mobileJumpButton.addEventListener('touchend', e => {
30
+ e.preventDefault();
31
+ mobileJumpButton.classList.remove('active');
32
+ hytopia.pressInput(' ', false);
33
+ });
34
+ </script>
35
+
36
+ <!--
37
+ HYTOPIA allows you to build completely custom UI uses HTML, CSS and Javascript.
38
+ You can build simple UIs, to highly complex ones. UI capabilities are as powerful
39
+ as building a regaulr web page - there are no limitations on what you can do.
40
+
41
+ Remember, HYTOPIA sandboxes your UI & UI scripts, so external network requests or
42
+ other unsafe actions likely won't work as you expect in production.
43
+ -->
44
+
45
+ <div class="mobile-controls">
46
+ <a id="mobile-interact-button" class="mobile-button">
47
+ <img src="{{CDN_ASSETS_URL}}/icons/target.png" />
48
+ </a>
49
+
50
+ <a id="mobile-jump-button" class="mobile-button">
51
+ <img src="{{CDN_ASSETS_URL}}/icons/jump.png" />
52
+ </a>
53
+ </div>
54
+
55
+ <style>
56
+ /* By default, we hide the mobile controls */
57
+ .mobile-controls {
58
+ display: none;
59
+ }
60
+
61
+ /*
62
+ We can use the body.mobile class to detect if we're on a mobile device.
63
+ HYTOPIA will always add this class to the body element when running on a mobile device.
64
+ */
65
+ body.mobile .mobile-controls { /* If this css selector matches because we're on mobile, show the mobile controls */
66
+ display: flex;
67
+ gap: 14px;
68
+ position: fixed;
69
+ bottom: 40px;
70
+ right: 40px;
71
+ }
72
+
73
+ /* You can configure and style your buttons however you'd like. This is a minimalistic starting point. */
74
+ .mobile-button {
75
+ background-color: rgba(0, 0, 0, 0.5);
76
+ border-radius: 50%;
77
+ align-items: center;
78
+ justify-content: center;
79
+ display: flex;
80
+ width: 50px;
81
+ height: 50px;
82
+ transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
83
+ will-change: transform, background-color;
84
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
85
+ font-family: 'Inter', sans-serif;
86
+ font-size: 14px;
87
+ font-weight: bold;
88
+ color: rgba(255, 255, 255, 0.8);
89
+ text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
90
+ }
91
+
92
+ .mobile-button img {
93
+ width: 22px;
94
+ height: 22px;
95
+ }
96
+
97
+ .mobile-button.active {
98
+ transform: scale(0.92);
99
+ background-color: rgba(0, 0, 0, 0.75);
100
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
101
+ }
102
+ </style>
@@ -87,6 +87,9 @@ startServer(world => {
87
87
 
88
88
  playerEntity.spawn(world, { x: 0, y: 10, z: 0 });
89
89
 
90
+ // Load our game UI for this player
91
+ player.ui.load('ui/index.html');
92
+
90
93
  // Send a nice welcome message that only the player who joined will see ;)
91
94
  world.chatManager.sendPlayerMessage(player, 'Welcome to the game!', '00FF00');
92
95
  world.chatManager.sendPlayerMessage(player, 'Use WASD to move around.');
@@ -0,0 +1,3 @@
1
+ # mobile-controls
2
+
3
+ A simple demonstration showing how to create a mobile user interface for phones and tablets.