Java Reference
In-Depth Information
How Do I Get a Piece of Leather?
For testing or just playing you might not have a piece of leather handy. Here's how
to get one:
•Go into creative mode by typing
/gamemodec
.
•Press
E
.
•The icon in the upper-right corner is a search bar; click it.
•Start typing
leather
, and you should see the Leather material appear.
•Click it once, then click again on your hotbar (the bottom row of slots in the
inventory) to put it there.
•Close your inventory by pressing the escape key,
Esc
.
•Press the corresponding number (1 through 9) to select the box where you put
the leather.
When you try to go into creative mode you might see an error saying that you don't
have permission. In that case, you'll need to “op” yourself—that is, give yourself
operator privileges.
import
com.pragprog.ahmine.ez.EZPlugin;
public class
CowTask
extends
ServerTask {
private
Cow cow;
public
CowTask(Cow myCow) {
super(Canary.getServer(), 0, true);
// delay, isContinuous
cow = myCow;
}
public void
run() {
if
(cow.isOnGround()) {
Location loc = cow.getLocation();
cow.setHealth(0);
cow.kill();
cow.getWorld().makeExplosion(cow,
loc.getX(), loc.getY(), loc.getZ(),
2.0f, true);
Canary.getServer().removeSynchronousTask(this);
}
else
{
cow.setFireTicks(600);
cow.setHealth((
float
)cow.getMaxHealth());
}
}
}