mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Added pine tree tool.
This commit is contained in:
parent
39914155b6
commit
df836d285d
@ -1882,7 +1882,7 @@ public class EditSession {
|
||||
*
|
||||
* @param basePos
|
||||
*/
|
||||
private void makePineTree(Vector basePos) throws MaxChangedBlocksException {
|
||||
public void makePineTree(Vector basePos) throws MaxChangedBlocksException {
|
||||
int trunkHeight = (int) Math.floor(Math.random() * 2) + 3;
|
||||
int height = (int) Math.floor(Math.random() * 5) + 8;
|
||||
|
||||
|
@ -125,6 +125,7 @@ public class WorldEditController {
|
||||
commands.put("/none", "Switch to no tool");
|
||||
commands.put("/info", "Switch to the info tool");
|
||||
commands.put("/tree", "Switch to the tree tool");
|
||||
commands.put("/pinetree", "Switch to the pine tree tool");
|
||||
commands.put("/bigtree", "Switch to the big tree tool");
|
||||
commands.put("/repl", "[ID] - Switch to the block replacer tool");
|
||||
commands.put("/brush", "[ID] <Radius> <NoReplace?> - Switch to the sphere brush tool");
|
||||
@ -684,6 +685,13 @@ public class WorldEditController {
|
||||
player.print("Big tree tool equipped. Right click with a pickaxe.");
|
||||
return true;
|
||||
|
||||
// Pine tree tool
|
||||
} else if (split[0].equalsIgnoreCase("/pinetree")) {
|
||||
checkArgs(split, 0, 0, split[0]);
|
||||
session.setRightClickMode(new PineTreePlanter());
|
||||
player.print("Pine tree tree tool equipped. Right click with a pickaxe.");
|
||||
return true;
|
||||
|
||||
// Info tool
|
||||
} else if (split[0].equalsIgnoreCase("/info")) {
|
||||
checkArgs(split, 0, 0, split[0]);
|
||||
|
49
src/com/sk89q/worldedit/superpickaxe/PineTreePlanter.java
Normal file
49
src/com/sk89q/worldedit/superpickaxe/PineTreePlanter.java
Normal file
@ -0,0 +1,49 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.superpickaxe;
|
||||
|
||||
import com.sk89q.worldedit.*;
|
||||
|
||||
/**
|
||||
* Plants a pine tree.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class PineTreePlanter implements SuperPickaxeMode {
|
||||
@Override
|
||||
public boolean act(ServerInterface server, LocalConfiguration config,
|
||||
LocalPlayer player, LocalSession session, WorldVector clicked) {
|
||||
|
||||
LocalWorld world = clicked.getWorld();
|
||||
EditSession editSession =
|
||||
new EditSession(server, world, session.getBlockChangeLimit());
|
||||
|
||||
try {
|
||||
editSession.makePineTree(clicked.add(0, 1, 0));
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user