Java Reference
In-Depth Information
BuildAHouse/src/buildahouse/MyHouse.java
package buildahouse;
public class MyHouse {
public static void build_me() {
// Declare width
// Set width to the number of blocks
// Declare height
// Set height to the number of blocks
BuildAHouse.buildMyHouse(width, height);
}
}
If you try to compile and install that with ./build.sh like we did with HelloWorld ,
you'll get two errors:
$ cd Desktop
$ cd code/BuildAHouse
$ ./build.sh
Compiling with javac...
src/buildahouse/MyHouse.java:10: cannot find symbol
symbol : variable width
location: class buildahouse.MyHouse
BuildAHouse.buildMyHouse(width, height);
^
src/buildahouse/MyHouse.java:10: cannot find symbol
symbol : variable height
location: class buildahouse.MyHouse
BuildAHouse.buildMyHouse(width, height);
^
2 errors
And that's your first mission: declare and set an int variable named width and
an int variable named height , and set them to something reasonable for a house,
perhaps no smaller than 5 blocks high and 5 blocks wide. Or maybe 10×10
if you're feeling spacious.
Delete those comment lines and replace them with your two variables for width
and height . Save the file, and then go ahead and run build.sh again:
$ ./build.sh
Compiling with javac...
Creating jar file...
Deploying jar to /Users/andy/Desktop/server/plugins...
Completed Successfully.
Stop and restart your server, then connect (or reconnect) your Minecraft
client. Pick a nice-looking spot in the Minecraft landscape, and type the
command /buildahouse .
 
 
Search WWH ::




Custom Search