Add some experimental brush commands.

/br set <shape> <radius> <pattern>
/br deform <shape> <expression>
/br scatter <shape> <density> <generator>
/br apply <shape> <generator>

<shape> can be: cuboid, cyl[inder], sphere

<density> is 0-100

<generator> can be:
forest|tree <type>
item <item>[:<data>] (ONLY WORKS ON FORGE)

Examples:

/br deform cuboid 5 y-=0.2
/br scatter sphere 5 100 minecraft:dye:15
This commit is contained in:
sk89q
2015-10-26 23:14:30 -07:00
parent b19cd9bec4
commit 935de4c93d
59 changed files with 2239 additions and 99 deletions

View File

@ -25,6 +25,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BaseItem;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.BlockType;
@ -32,6 +33,7 @@ import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.function.mask.BlockMask;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import javax.annotation.Nullable;
@ -45,6 +47,11 @@ public abstract class AbstractWorld implements World {
private final PriorityQueue<QueuedEffect> effectQueue = new PriorityQueue<QueuedEffect>();
private int taskId = -1;
@Override
public boolean useItem(Vector position, BaseItem item, Direction face) {
return false;
}
@Override
public final boolean setBlockType(Vector position, int type) {
try {

View File

@ -25,11 +25,13 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BaseItem;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.TreeGenerator;
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.world.registry.WorldData;
@ -80,6 +82,15 @@ public interface World extends Extent {
*/
Mask createLiquidMask();
/**
* Use the given item on the block at the given location on the given side.
*
* @param item The item
* @param face The face
* @return Whether it succeeded
*/
boolean useItem(Vector position, BaseItem item, Direction face);
/**
* @deprecated Use {@link #getLazyBlock(Vector)}
*/

View File

@ -0,0 +1,46 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser 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 Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.world.registry;
import com.sk89q.worldedit.blocks.BaseItem;
import javax.annotation.Nullable;
public interface ItemRegistry {
/**
* Create a new item using its ID.
*
* @param id the id
* @return the item, which may be null if no item exists
*/
@Nullable
BaseItem createFromId(String id);
/**
* Create a new item using its legacy numeric ID.
*
* @param id the id
* @return the item, which may be null if no item exists
*/
@Nullable
BaseItem createFromId(int id);
}

View File

@ -27,6 +27,7 @@ public class LegacyWorldData implements WorldData {
private static final LegacyWorldData INSTANCE = new LegacyWorldData();
private final LegacyBlockRegistry blockRegistry = new LegacyBlockRegistry();
private final NullItemRegistry itemRegistry = new NullItemRegistry();
private final NullEntityRegistry entityRegistry = new NullEntityRegistry();
private final NullBiomeRegistry biomeRegistry = new NullBiomeRegistry();
@ -41,6 +42,11 @@ public class LegacyWorldData implements WorldData {
return blockRegistry;
}
@Override
public ItemRegistry getItemRegistry() {
return itemRegistry;
}
@Override
public EntityRegistry getEntityRegistry() {
return entityRegistry;

View File

@ -0,0 +1,40 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser 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 Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.world.registry;
import com.sk89q.worldedit.blocks.BaseItem;
import javax.annotation.Nullable;
public class NullItemRegistry implements ItemRegistry {
@Nullable
@Override
public BaseItem createFromId(String id) {
return null;
}
@Nullable
@Override
public BaseItem createFromId(int id) {
return null;
}
}

View File

@ -32,6 +32,13 @@ public interface WorldData {
*/
BlockRegistry getBlockRegistry();
/**
* Get the item registry.
*
* @return the item registry
*/
ItemRegistry getItemRegistry();
/**
* Get the entity registry.
*