forked from jbaragry/mcpi-scratch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
200 lines (155 loc) · 8.99 KB
/
index.html
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href='https://fonts.googleapis.com/css?family=Architects+Daughter' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen">
<link rel="stylesheet" type="text/css" href="stylesheets/github-light.css" media="screen">
<link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<title>mcpi-scratch by jbaragry</title>
</head>
<body>
<header>
<div class="inner">
<h1>mcpi-scratch</h1>
<h2>ScratchX extension application to manipulate Minecraft throught the Pi Protocol api</h2>
<a href="https://github.com/jbaragry/mcpi-scratch" class="button"><small>View project on</small> GitHub</a>
</div>
</header>
<div id="content-wrapper">
<div class="inner clearfix">
<section id="main-content">
<h1>
<a id="mcpi-scratch" class="anchor" href="#mcpi-scratch" aria-hidden="true"><span class="octicon octicon-link"></span></a>MCPI-Scratch</h1>
<p>A ScratchX extension application for the Minecraft Pi Protocol</p>
<h1>
<a id="introduction" class="anchor" href="#introduction" aria-hidden="true"><span class="octicon octicon-link"></span></a>Introduction</h1>
<p>MCPI-Scratch lets you write Scratch scripts to manipulate Minecraft. </p>
<p>More specifically, its an extension application for the <a href="http://scratchx.org">ScratchX</a> online editor that allows you to use blocks that represent the <a href="http://wiki.vg/Minecraft_Pi_Protocol">Minecraft Pi Protocol</a> API. It actually uses a slightly cut-down version of the API specified by the <a href="http://dev.bukkit.org/bukkit-plugins/raspberryjuice/">RaspberryJuice</a> mod which allows it to connect to both:</p>
<ul>
<li>Minecraft Pi Edition</li>
<li>CraftBukkit server with the RaspberryJuice mod</li>
</ul>
<p>A more detailed description of how it works is provided in <a href="http://niphophila.blogspot.com/2014/09/mcpi-scratch-scratch-extension.html">this blog entry</a></p>
<p>You might also want to have a look at the documentation at ScriptCraft which has a nice <a href="https://github.com/walterhiggins/ScriptCraft/blob/master/docs/YoungPersonsGuideToProgrammingMinecraft.md">The Young Person's Guide to Programming in Minecraft</a>. It has lots of general tips, for example on how to set up a flat world in CraftBukkit, before getting into its own javascript specific API. </p>
<p>See also the excellent set of tutorials for <a href="http://www.stuffaboutcode.com/2013/04/minecraft-pi-edition-api-tutorial.html">programming with the Pi Edition API</a>. Its written for Python but the information can be easily applied to Scratch.</p>
<p>You will also want to keep this <a href="http://www.stuffaboutcode.com/p/minecraft-api-reference.html">reference for block IDs and metadata</a> handy.</p>
<p>To make it easier for Scrachers to get up and going, I've chosen to include the Minecraft Pi Edition API in this distribution. I don't think it violates the <a href="https://account.mojang.com/documents/minecraft_eula">Minecraft EULA</a> but it may be that I need to remove it later and you add it yourself.</p>
<p>The API is the one from <a href="http://minecraft.gamepedia.com/Pi_Edition">Minecraft Pi Edition</a> and not the modded API from RaspberryJuice. But it might be worth changing to that one later if it gives extra functionality.</p>
<h1>
<a id="installation" class="anchor" href="#installation" aria-hidden="true"><span class="octicon octicon-link"></span></a>Installation</h1>
<p>Download and install this project distribution. The application <code>mcpi-scratch.py</code> is a bridge between ScratchX and your Minecraft server</p>
<p>You need to run this application on the same machine as the browser you use to access ScratchX</p>
<p>Minecraft can either be runnnig on the same machine or on another machine which you can specify as a startup parameter. MCPI-Scratch expects Minecraft to be listening on the default port for the Minecraft Pi Protocol - <code>4711</code></p>
<p>MCPI-Scratch takes an optional command-line argument for the host of the minecraft server or minecraft pi edition</p>
<pre><code>$ python ./mcpi-scratch.py -h
usage: mcpi-scratch.py [-h] [-m HOST]
scratch2MinecraftPi is a Scratch2 extension helper app to allow Scratch
programs to manipulate Minecraft through the Pi protocol
optional arguments:
-h, --help show this help message and exit
-m HOST hostname/IP for the machine running Minecraft. Default is
localhost
</code></pre>
<h1>
<a id="getting-started" class="anchor" href="#getting-started" aria-hidden="true"><span class="octicon octicon-link"></span></a>Getting Started</h1>
<p>Start the applications in the following order:</p>
<ol>
<li><p>Make sure you have Python installed</p></li>
<li>
<p>Start Minecraft.
This must be running before you start MCPI-Scratch because the application attempts to create a connection on startup and will fail if Minecraft is not running. You can use either:</p>
<ul>
<li>Minecraft Pi Edition or </li>
<li>CraftBukkit server with the RaspberryJuice mod + plus the Minecraft launcher to start a client to connect to the server
<ul>
<li>There's a nice blog about setting up this env at <a href="http://www.stuffaboutcode.com/2013/06/programming-minecraft-with-bukkit.html">StuffAboutCode</a>
</li>
</ul>
</li>
</ul>
</li>
<li><p>Start MCPI-Scratch
The application attempts to connect to localhost by default. Use the <code>-m host</code> cmd-line arg to specify minecraft running on another machine
$ python ./mcpi-scratch.py
or
$ python ./mcpi-scratch.py -m 192.168.1.117 (the IP for your RPi or CraftBukkit server)</p></li>
<li><p>Open <a href="http://scratchx.org">ScratchX</a> with a browser.
You can copy this url <code>https://rawgit.com/jbaragry/mcpi-scratch/master/mcpi-scratch.js</code> to use in ScratchX<br/>
Alternatively you can open <code>MCPI-Scrarch</code> <a href="http://http://scratchx.org/?url=https://rawgit.com/jbaragry/mcpi-scratch/master/mcpi-scratch.js">directly in ScratchX</a></p></li>
</ol>
<h1>
<a id="scratch-blocks" class="anchor" href="#scratch-blocks" aria-hidden="true"><span class="octicon octicon-link"></span></a>Scratch Blocks</h1>
<p>MCPI-Scratch supports the following Blocks</p>
<ul>
<li>setPlayerPos:
<ul>
<li>set the Player's x,y,z coordinates (in minecraft, the y coordinate is the vertical plane [height])</li>
</ul>
</li>
<li>postToChat:
<ul>
<li>post a string to the chat window</li>
</ul>
</li>
<li>postPlayerPosToChat:
<ul>
<li>post a Player's x,y,z coords to the chat window. Useful to have on the scratch canvas so that you can easily find where you are</li>
</ul>
</li>
<li>setBlock:
<ul>
<li>set a block at the x,y,z coordinates. The blockType (e.g., WOOL) and metadata (e.g., colour) can also be set. The coords can be absolute or relative the player position </li>
</ul>
</li>
<li>setBlocks:
<ul>
<li>set a collection of blocks between 2 x,y,z coordinates. BlockType and metadata can also be set.</li>
</ul>
</li>
<li>setLine:
<ul>
<li>set a line of blocks between to x,z coordinates at a particular height (y). BlockType and metadata can also be set</li>
</ul>
</li>
<li>setCircle:
<ul>
<li>set a circle with center at x,z coordinates and at a particular height (y). BlockType and metadata can also be set</li>
</ul>
</li>
</ul>
<h1>
<a id="changelog" class="anchor" href="#changelog" aria-hidden="true"><span class="octicon octicon-link"></span></a>Changelog</h1>
<p>See the README file on the project github page</p>
</section>
<aside id="sidebar">
<a href="https://github.com/jbaragry/mcpi-scratch/zipball/master" class="button">
<small>Download</small>
.zip file
</a>
<a href="https://github.com/jbaragry/mcpi-scratch/tarball/master" class="button">
<small>Download</small>
.tar.gz file
</a>
<p class="repo-owner"><a href="https://github.com/jbaragry/mcpi-scratch"></a> is maintained by <a href="https://github.com/jbaragry">jbaragry</a>.</p>
<p>This page was generated by <a href="https://pages.github.com">GitHub Pages</a> using the Architect theme by <a href="https://twitter.com/jasonlong">Jason Long</a>.</p>
</aside>
</div>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-64375414-1");
pageTracker._trackPageview();
} catch(err) {}
</script>
</body>
</html>