O'Reilly logo

Learn to Program with Minecraft Plugins, 2nd Edition by Andy Hunt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Plugin: BuildAHouse

I’ve got a plugin already set up for you; all you need to do is declare some variables and you can give the /buildahouse command.

First make your way to the downloaded code, and into the BuildAHouse plugin:

 
$ ​cd Desktop
 
$ ​cd code/BuildAHouse/src/buildahouse
 
$ ​ls
 
BuildAHouse.java MyHouse.java

You’re going to edit the file MyHouse.java, which is one small part of this whole plugin (don’t look at the rest yet!). Right now it looks like this:

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required