Remove stub injector methods

This commit is contained in:
Jesse Boyd
2018-08-13 02:36:39 +10:00
parent fa06ff357e
commit e7c27b08bf
124 changed files with 241 additions and 411 deletions
@@ -221,8 +221,6 @@ public class BukkitAdapter {
return Material.getMaterial(itemType.getId().replace("minecraft:", "").toUpperCase());
}
private static boolean test;
/**
* Create a Bukkit Material form a WorldEdit BlockType
*
@@ -314,7 +312,7 @@ public class BukkitAdapter {
* @param itemStack The Bukkit ItemStack
* @return The WorldEdit BlockState
*/
public static BlockStateHolder asBlockState(ItemStack itemStack) {
public static BlockState asBlockState(ItemStack itemStack) {
checkNotNull(itemStack);
if (itemStack.getType().isBlock()) {
return adapt(itemStack.getType().createBlockData());
@@ -34,6 +34,7 @@ import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.gamemode.GameMode;
import com.sk89q.worldedit.world.gamemode.GameModes;
import jdk.nashorn.internal.ir.Block;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@@ -67,11 +68,11 @@ public class BukkitPlayer extends AbstractPlayerActor {
}
@Override
public BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException {
public BlockState getBlockInHand(HandSide handSide) throws WorldEditException {
ItemStack itemStack = handSide == HandSide.MAIN_HAND
? player.getInventory().getItemInMainHand()
: player.getInventory().getItemInOffHand();
return new BaseBlock(BukkitAdapter.asBlockState(itemStack));
return BukkitAdapter.asBlockState(itemStack);
}
@Override
@@ -180,8 +180,4 @@ public class Commands {
return command.anyFlags();
}
}
public static Class<Commands> inject() {
return Commands.class;
}
}
@@ -216,7 +216,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
main = new DifferentialArray(new int[getArea()]);
int stone = BlockTypes.STONE.getInternalId();
int grass = BlockTypes.GRASS.getInternalId();
int grass = BlockTypes.GRASS_BLOCK.getInternalId();
Arrays.fill(main.getIntArray(), stone);
Arrays.fill(floor.getIntArray(), grass);
}
@@ -80,9 +80,4 @@ public class RandomTransform extends SelectTransform {
public RandomCollection<ResettableExtent> getCollection() {
return collection;
}
public static Class<?> inject() {
return RandomPattern.class;
}
}
@@ -36,8 +36,4 @@ public class DFSRecursiveVisitor extends DFSVisitor {
public boolean isVisitable(final Vector from, final Vector to) {
return this.mask.test(to);
}
public static Class<?> inject() {
return RecursiveVisitor.class;
}
}
@@ -425,7 +425,5 @@ public final class CompoundTag extends Tag {
return bldr.toString();
}
public static Class<?> inject() {
return CompoundTag.class;
}
}
@@ -201,7 +201,5 @@ public class CompoundTagBuilder {
return new CompoundTagBuilder();
}
public static Class<?> inject() {
return CompoundTagBuilder.class;
}
}
@@ -419,8 +419,6 @@ public final class ListTag<T extends Tag> extends Tag {
return bldr.toString();
}
public static Class<?> inject() {
return ListTag.class;
}
}
@@ -611,7 +611,5 @@ public final class NBTInputStream implements Closeable {
}
}
public static Class<?> inject() {
return NBTInputStream.class;
}
}
@@ -409,7 +409,5 @@ public final class NBTOutputStream implements Closeable {
if (os instanceof Flushable) ((Flushable) os).flush();
}
public static Class<?> inject() {
return NBTOutputStream.class;
}
}
@@ -35,9 +35,7 @@ public abstract class Tag {
return getValue();
}
public static Class<?> inject() {
return Tag.class;
}
}
@@ -19,7 +19,9 @@
package com.sk89q.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
@@ -32,7 +34,7 @@ public final class StringUtil {
/**
* Trim a string if it is longer than a certain length.
*
*
* @param str the stirng
* @param len the length to trim to
* @return a new string
@@ -47,7 +49,7 @@ public final class StringUtil {
/**
* Join an array of strings into a string.
*
*
* @param str the string array
* @param delimiter the delimiter
* @param initialIndex the initial index to start form
@@ -66,7 +68,7 @@ public final class StringUtil {
/**
* Join an array of strings into a string.
*
*
* @param str the string array
* @param delimiter the delimiter
* @param initialIndex the initial index to start form
@@ -74,7 +76,7 @@ public final class StringUtil {
* @return a new string
*/
public static String joinQuotedString(String[] str, String delimiter,
int initialIndex, String quote) {
int initialIndex, String quote) {
if (str.length == 0) {
return "";
}
@@ -90,7 +92,7 @@ public final class StringUtil {
/**
* Join an array of strings into a string.
*
*
* @param str the string array
* @param delimiter the delimiter
* @return a new string
@@ -101,7 +103,7 @@ public final class StringUtil {
/**
* Join an array of strings into a string.
*
*
* @param str an array of objects
* @param delimiter the delimiter
* @param initialIndex the initial index to start form
@@ -120,7 +122,7 @@ public final class StringUtil {
/**
* Join an array of strings into a string.
*
*
* @param str a list of integers
* @param delimiter the delimiter
* @param initialIndex the initial index to start form
@@ -217,7 +219,7 @@ public final class StringUtil {
* calculated). (Note that the arrays aren't really copied anymore, just
* switched...this is clearly much better than cloning an array or doing
* a System.arraycopy() each time through the outer loop.)
*
*
* Effectively, the difference between the two implementations is this
* one does not cause an out of memory condition when calculating the LD
* over two very large strings.
@@ -301,4 +303,24 @@ public final class StringUtil {
return type;
}
}
public static List<String> parseListInQuotes(String[] input, char delimiter, char quoteOpen, char quoteClose) {
List<String> parsableBlocks = new ArrayList<>();
StringBuilder buffer = new StringBuilder();
for (String split : input) {
if (split.indexOf(quoteOpen) != -1 && split.indexOf(quoteClose) == -1) {
buffer.append(split).append(delimiter);
} else if (split.indexOf(quoteClose) != -1 && split.indexOf(quoteOpen) == -1) {
buffer.append(split);
parsableBlocks.add(buffer.toString());
buffer = new StringBuilder();
} else if (buffer.length() == 0) {
parsableBlocks.add(split);
} else {
buffer.append(split).append(delimiter);
}
}
return parsableBlocks;
}
}
@@ -3320,7 +3320,5 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
world.setWeather(weatherType, duration);
}
public static Class<?> inject() {
return EditSession.class;
}
}
@@ -1369,7 +1369,5 @@ public class LocalSession implements TextureHolder {
this.transform = transform;
}
public static Class<?> inject() {
return LocalSession.class;
}
}
@@ -910,7 +910,5 @@ public class Vector extends Vector2D implements Comparable<Vector>, Serializable
this.z = stream.readDouble();
}
public static Class<?> inject() {
return Vector.class;
}
}
@@ -868,7 +868,5 @@ public class BrushCommands extends BrushProcessor {
.setSize(radius);
}
public static Class<?> inject() {
return BrushCommands.class;
}
}
@@ -508,7 +508,5 @@ public class BrushOptionsCommands extends MethodCommands {
BBC.BRUSH_SIZE.send(player);
}
public static Class<?> inject() {
return BrushOptionsCommands.class;
}
}
@@ -595,7 +595,5 @@ public class ClipboardCommands extends MethodCommands {
BBC.CLIPBOARD_CLEARED.send(player);
}
public static Class<?> inject() {
return ClipboardCommands.class;
}
}
@@ -134,7 +134,5 @@ public class FlattenedClipboardTransform {
return new FlattenedClipboardTransform(original, transform);
}
public static Class<?> inject() {
return FlattenedClipboardTransform.class;
}
}
@@ -298,7 +298,5 @@ public class HistoryCommands extends MethodCommands {
BBC.COMMAND_HISTORY_CLEAR.send(player);
}
public static Class<?> inject() {
return HistoryCommands.class;
}
}
@@ -231,7 +231,5 @@ public class NavigationCommands {
return forceGlass || (config.navigationUseGlass && !forceFlight);
}
public static Class<?> inject() {
return NavigationCommands.class;
}
}
@@ -313,7 +313,5 @@ public class OptionsCommands {
}
}
public static Class<?> inject() {
return OptionsCommands.class;
}
}
@@ -789,7 +789,5 @@ public class RegionCommands extends MethodCommands {
BBC.COMMAND_FLORA.send(player, ground.getAffected());
}
public static Class<?> inject() {
return RegionCommands.class;
}
}
@@ -636,7 +636,5 @@ public class SchematicCommands extends MethodCommands {
});
}
public static Class<?> inject() {
return SchematicCommands.class;
}
}
@@ -219,7 +219,5 @@ public class ScriptingCommands {
}
}
public static Class<?> inject() {
return ScriptingCommands.class;
}
}
@@ -821,7 +821,5 @@ public class SelectionCommands {
session.dispatchCUISelection(player);
}
public static Class<?> inject() {
return SelectionCommands.class;
}
}
@@ -183,7 +183,5 @@ public class ToolCommands {
BBC.TOOL_LRBUILD_INFO.send(player, secondary, primary);
}
public static Class<?> inject() {
return ToolCommands.class;
}
}
@@ -189,8 +189,6 @@ public class SelectionCommand extends SimpleCommand<Operation> {
return locals.get(Actor.class).hasPermission(permission);
}
public static Class<?> inject() {
return SelectionCommand.class;
}
}
@@ -59,7 +59,5 @@ public class AreaPickaxe implements BlockTool {
return true;
}
public static Class<?> inject() {
return AreaPickaxe.class;
}
}
@@ -499,9 +499,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
return act(BrushAction.SECONDARY, server, config, player, session);
}
public static Class<?> inject() {
return BrushTool.class;
}
public void setScrollAction(ScrollAction scrollAction) {
this.getContext().setScrollAction(scrollAction);
@@ -24,16 +24,16 @@ import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.world.block.BlockCategories;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockCategories;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import java.util.HashSet;
import java.util.LinkedList;
@@ -44,7 +44,6 @@ import java.util.Set;
* to anything else)
*/
public class FloatingTreeRemover implements BlockTool {
private static final BlockStateHolder AIR = BlockTypes.AIR.getDefaultState();
private int rangeSq;
public FloatingTreeRemover() {
@@ -67,10 +66,10 @@ public class FloatingTreeRemover implements BlockTool {
@Override
public boolean actPrimary(Platform server, LocalConfiguration config,
Player player, LocalSession session, Location clicked) {
Player player, LocalSession session, Location clicked) {
final World world = (World) clicked.getExtent();
final BlockStateHolder state = world.getBlock(clicked.toVector());
final BlockState state = world.getBlock(clicked.toVector());
if (!isTreeBlock(state.getBlockType())) {
player.printError("That's not a tree.");
@@ -87,9 +86,9 @@ public class FloatingTreeRemover implements BlockTool {
}
for (Vector blockVector : blockSet) {
final BlockStateHolder otherState = editSession.getBlock(blockVector);
final BlockState otherState = editSession.getBlock(blockVector);
if (isTreeBlock(otherState.getBlockType())) {
editSession.setBlock(blockVector, AIR);
editSession.setBlock(blockVector, BlockTypes.AIR.getDefaultState());
}
}
} catch (MaxChangedBlocksException e) {
@@ -134,7 +133,7 @@ public class FloatingTreeRemover implements BlockTool {
}
if (visited.add(next)) {
BlockStateHolder state = world.getBlock(next);
BlockState state = world.getBlock(next);
if (state.getBlockType() == BlockTypes.AIR || state.getBlockType() == BlockTypes.SNOW) {
continue;
}
@@ -154,4 +153,4 @@ public class FloatingTreeRemover implements BlockTool {
return visited;
}
}
}
@@ -54,7 +54,7 @@ public class FloodFillTool implements BlockTool {
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
World world = (World) clicked.getExtent();
BlockType initialType = world.getLazyBlock(clicked.toVector()).getBlockType();
BlockType initialType = world.getBlockType(clicked.toVector());
if (initialType.getMaterial().isAir()) {
return true;
@@ -67,7 +67,7 @@ public class FloodFillTool implements BlockTool {
EditSession editSession = session.createEditSession(player);
try {
recurse(server, editSession, world, clicked.toVector().toBlockVector(),
recurse(editSession, world, clicked.toVector().toBlockVector(),
clicked.toVector(), range, initialType, new HashSet<BlockVector>());
} catch (WorldEditException e) {
throw new RuntimeException(e);
@@ -77,7 +77,7 @@ public class FloodFillTool implements BlockTool {
return true;
}
private void recurse(Platform server, EditSession editSession, World world, BlockVector pos, Vector origin, int size, BlockType initialType,
private void recurse(EditSession editSession, World world, BlockVector pos, Vector origin, int size, BlockType initialType,
Set<BlockVector> visited) throws WorldEditException {
if (origin.distance(pos) > size || visited.contains(pos)) {
@@ -92,21 +92,19 @@ public class FloodFillTool implements BlockTool {
return;
}
recurse(server, editSession, world, pos.add(1, 0, 0).toBlockVector(),
recurse(editSession, world, pos.add(1, 0, 0).toBlockVector(),
origin, size, initialType, visited);
recurse(server, editSession, world, pos.add(-1, 0, 0).toBlockVector(),
recurse(editSession, world, pos.add(-1, 0, 0).toBlockVector(),
origin, size, initialType, visited);
recurse(server, editSession, world, pos.add(0, 0, 1).toBlockVector(),
recurse(editSession, world, pos.add(0, 0, 1).toBlockVector(),
origin, size, initialType, visited);
recurse(server, editSession, world, pos.add(0, 0, -1).toBlockVector(),
recurse(editSession, world, pos.add(0, 0, -1).toBlockVector(),
origin, size, initialType, visited);
recurse(server, editSession, world, pos.add(0, 1, 0).toBlockVector(),
recurse(editSession, world, pos.add(0, 1, 0).toBlockVector(),
origin, size, initialType, visited);
recurse(server, editSession, world, pos.add(0, -1, 0).toBlockVector(),
recurse(editSession, world, pos.add(0, -1, 0).toBlockVector(),
origin, size, initialType, visited);
}
public static Class<?> inject() {
return FloodFillTool.class;
}
}
@@ -63,7 +63,5 @@ public class RecursivePickaxe implements BlockTool {
return true;
}
public static Class<?> inject() {
return RecursivePickaxe.class;
}
}
@@ -63,7 +63,5 @@ public class SinglePickaxe implements BlockTool {
return true;
}
public static Class<?> inject() {
return SinglePickaxe.class;
}
}
@@ -65,8 +65,6 @@ public class GravityBrush implements Brush {
}
}
public static Class<?> inject() {
return GravityBrush.class;
}
}
@@ -39,7 +39,7 @@ public class HollowCylinderBrush implements Brush {
@Override
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
if (pattern == null) {
pattern = new BlockPattern(new BaseBlock(BlockTypes.COBBLESTONE));
pattern = BlockTypes.COBBLESTONE.getDefaultState();
}
editSession.makeCylinder(position, pattern, size, size, height, false);
}
@@ -33,7 +33,7 @@ public class HollowSphereBrush implements Brush {
@Override
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
if (pattern == null) {
pattern = new BlockPattern(new BaseBlock(BlockTypes.COBBLESTONE));
pattern = BlockTypes.COBBLESTONE.getDefaultState();
}
editSession.makeSphere(position, pattern, size, size, size, false);
}
@@ -71,7 +71,7 @@ public interface Player extends Entity, Actor {
*
* @return the item id of the item the player is holding
*/
BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException;
BlockState getBlockInHand(HandSide handSide) throws WorldEditException;
/**
* Gives the player an item.
@@ -176,7 +176,5 @@ public class EditSessionEvent extends Event implements Cancellable {
return clone;
}
public static Class<?> inject() {
return EditSessionEvent.class;
}
}
@@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.factory;
import com.sk89q.util.StringUtil;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
@@ -62,7 +63,8 @@ public class BlockFactory extends AbstractFactory<BlockStateHolder> {
*/
public Set<BlockStateHolder> parseFromListInput(String input, ParserContext context) throws InputParseException {
Set<BlockStateHolder> blocks = new HashSet<>();
for (String token : input.split(",")) {
String[] splits = input.split(",");
for (String token : StringUtil.parseListInQuotes(splits, ',', '[', ']')) {
blocks.add(parseFromInput(token, context));
}
return blocks;
@@ -163,7 +163,5 @@ public class DefaultMaskParser extends FaweParser<Mask> {
}
}
public static Class<?> inject() {
return DefaultMaskParser.class;
}
}
@@ -146,7 +146,5 @@ public class DefaultTransformParser extends FaweParser<ResettableExtent> {
}
}
public static Class<?> inject() {
return HashTagPatternParser.class;
}
}
@@ -135,7 +135,5 @@ public class HashTagPatternParser extends FaweParser<Pattern> {
}
}
public static Class<?> inject() {
return HashTagPatternParser.class;
}
}
@@ -42,7 +42,6 @@ public final class PatternFactory extends AbstractFactory<Pattern> {
parsers.add(new HashTagPatternParser(worldEdit));
parsers.add(new SingleBlockPatternParser(worldEdit));
parsers.add(new RandomPatternParser(worldEdit));
}
}
@@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.factory;
import com.sk89q.util.StringUtil;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockState;
@@ -40,7 +41,8 @@ class RandomPatternParser extends InputParser<Pattern> {
BlockFactory blockRegistry = worldEdit.getBlockFactory();
RandomPattern randomPattern = new RandomPattern();
for (String token : input.split(",")) {
String[] splits = input.split(",");
for (String token : StringUtil.parseListInQuotes(splits, ',', '[', ']')) {
BlockStateHolder block;
double chance;
@@ -368,12 +368,12 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
}
@Override
public BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException {
public BlockState getBlockInHand(HandSide handSide) throws WorldEditException {
final ItemType typeId = getItemInHand(handSide).getType();
if (typeId.hasBlockType()) {
return new BaseBlock(typeId.getBlockType());
return typeId.getBlockType().getDefaultState();
} else {
return new BaseBlock(BlockTypes.AIR);
return BlockTypes.AIR.getDefaultState();
}
}
@@ -522,7 +522,5 @@ public final class CommandManager {
return commandLog;
}
public static Class<?> inject() {
return CommandManager.class;
}
}
@@ -521,8 +521,6 @@ public class PlatformManager {
}
}
public static Class<?> inject() {
return PlatformManager.class;
}
}
@@ -285,7 +285,5 @@ public class AbstractDelegateExtent implements LightingExtent {
}
}
public static Class<?> inject() {
return AbstractDelegateExtent.class;
}
}
@@ -86,8 +86,6 @@ public class MaskingExtent extends AbstractDelegateExtent {
return mask.test(mutable.setComponents(x, y, z)) && super.setBiome(x, y, z, biome);
}
public static Class<?> inject() {
return MaskingExtent.class;
}
}
@@ -83,7 +83,7 @@ public class NullExtent implements Extent {
@Override
public BlockState getLazyBlock(Vector position) {
return new LazyBlock(BlockTypes.AIR, this, position);
return BlockTypes.AIR.getDefaultState();
}
@Override
@@ -49,8 +49,6 @@ import java.util.Map;
*/
public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pattern {
private static final BlockStateHolder AIR = BlockTypes.AIR.getDefaultState();
private final Map<BlockVector, BlockStateHolder> buffer = new LinkedHashMap<>();
private final Mask mask;
private Vector min = null;
@@ -110,7 +108,7 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat
if (block != null) {
return block;
} else {
return AIR;
return BlockTypes.AIR.getDefaultState();
}
}
@@ -21,17 +21,13 @@ package com.sk89q.worldedit.extent.cache;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.blocks.LazyBlock;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
/**
* Returns the same cached {@link BaseBlock} for repeated calls to
* {@link #getLazyBlock(Vector)} with the same position.
* Returns the same cached {@link BlockState} for repeated calls to
* {@link #getBlock(Vector)} with the same position.
*/
public class LastAccessExtentCache extends AbstractDelegateExtent {
@@ -47,13 +43,13 @@ public class LastAccessExtentCache extends AbstractDelegateExtent {
}
@Override
public BlockState getLazyBlock(Vector position) {
public BlockState getBlock(Vector position) {
BlockVector blockVector = position.toBlockVector();
CachedBlock lastBlock = this.lastBlock;
if (lastBlock != null && lastBlock.position.equals(blockVector)) {
return lastBlock.block;
} else {
BlockState block = super.getLazyBlock(position);
BlockState block = super.getBlock(position);
this.lastBlock = new CachedBlock(blockVector, block);
return block;
}
@@ -69,4 +65,4 @@ public class LastAccessExtentCache extends AbstractDelegateExtent {
}
}
}
}
@@ -252,9 +252,7 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
return null;
}
public static Class<?> inject() {
return BlockArrayClipboard.class;
}
@Override
public int getLight(int x, int y, int z) {
@@ -558,7 +558,5 @@ public enum ClipboardFormat {
return newEnum;
}
public static Class<?> inject() {
return ClipboardFormat.class;
}
}
@@ -103,9 +103,7 @@ public class SchematicReader implements ClipboardReader {
return expected.cast(test);
}
public static Class<?> inject() {
return SchematicReader.class;
}
@Override
public void close() throws IOException {
@@ -38,7 +38,7 @@ public abstract class BlockBag {
public void storeDroppedBlock(BlockState blockState) throws BlockBagException {
BlockState dropped = blockState; // TODO BlockType.getBlockBagItem(id, data);
if (dropped == null) return;
if (dropped.getBlockType() == BlockTypes.AIR) return;
if (dropped.getBlockType().getMaterial().isAir()) return;
storeBlock(dropped);
}
@@ -52,29 +52,9 @@ public abstract class BlockBag {
public void fetchPlacedBlock(BlockState blockState) throws BlockBagException {
try {
// Blocks that can't be fetched...
// TODO switch (id) {
// case BlockTypesBEDROCK:
// case BlockTypesGOLD_ORE:
// case BlockTypesIRON_ORE:
// case BlockTypesCOAL_ORE:
// case BlockTypesDIAMOND_ORE:
// case BlockTypesTNT:
// case BlockTypesMOB_SPAWNER:
// case BlockTypesCROPS:
// case BlockTypesREDSTONE_ORE:
// case BlockTypesGLOWING_REDSTONE_ORE:
// case BlockTypesSNOW:
// case BlockTypesLIGHTSTONE:
// case BlockTypesPORTAL:
// throw new UnplaceableBlockException();
//
// case BlockTypesWATER:
// case BlockTypesSTATIONARY_WATER:
// case BlockTypesLAVA:
// case BlockTypesSTATIONARY_LAVA:
// // Override liquids
// return;
// }
if (blockState.getBlockType().getMaterial().isReplacedDuringPlacement()) {
return;
}
fetchBlock(blockState);
} catch (OutOfBlocksException e) {
BlockState placed = blockState;// TODO BlockType.getBlockBagItem(id, data);
@@ -117,7 +117,5 @@ public class BlockBagExtent extends AbstractDelegateExtent {
return getExtent().setBlock(x, y, z, block);
}
public static Class<?> inject() {
return BlockBagExtent.class;
}
}
@@ -268,7 +268,5 @@ public class BlockTransformExtent extends ResettableExtent {
return super.setBlock(location, transformFastInverse((BlockState) block));
}
public static Class<?> inject() {
return BlockTransformExtent.class;
}
}
@@ -106,7 +106,5 @@ public class CombinedRegionFunction implements RegionFunction {
}
public static Class<?> inject() {
return CombinedRegionFunction.class;
}
}
@@ -54,8 +54,6 @@ public class BlockReplace implements RegionFunction {
return pattern.apply(extent, position, position);
}
public static Class<?> inject() {
return BlockReplace.class;
}
}
@@ -119,8 +119,6 @@ public class ExtentBlockCopy implements RegionFunction {
return state;
}
public static Class<?> inject() {
return ExtentBlockCopy.class;
}
}
@@ -52,7 +52,7 @@ public class Naturalizer implements LayerFunction {
public Naturalizer(EditSession editSession) {
checkNotNull(editSession);
this.editSession = editSession;
this.mask = new BlockTypeMask(editSession, BlockTypes.GRASS, BlockTypes.DIRT, BlockTypes.STONE);
this.mask = new BlockTypeMask(editSession, BlockTypes.GRASS_BLOCK, BlockTypes.DIRT, BlockTypes.STONE);
}
/**
@@ -75,7 +75,7 @@ public class Naturalizer implements LayerFunction {
affected++;
switch (depth) {
case 0:
editSession.setBlock(position, BlockTypes.GRASS);
editSession.setBlock(position, BlockTypes.GRASS_BLOCK);
break;
case 1:
case 2:
@@ -203,8 +203,6 @@ public class ExtentEntityCopy implements EntityFunction {
return state;
}
public static Class<?> inject() {
return ExtentEntityCopy.class;
}
}
@@ -96,7 +96,7 @@ public class FloraGenerator implements RegionFunction {
*/
public static Pattern getTemperatePattern() {
RandomPattern pattern = new RandomPattern();
pattern.add(new BlockPattern(BlockTypes.GRASS.getDefaultState()), 300);
pattern.add(new BlockPattern(BlockTypes.GRASS_BLOCK.getDefaultState()), 300);
pattern.add(new BlockPattern(BlockTypes.POPPY.getDefaultState()), 5);
pattern.add(new BlockPattern(BlockTypes.DANDELION.getDefaultState()), 5);
return pattern;
@@ -106,7 +106,7 @@ public class FloraGenerator implements RegionFunction {
public boolean apply(Vector position) throws WorldEditException {
BlockStateHolder block = editSession.getBlock(position);
if (block.getBlockType() == BlockTypes.GRASS) {
if (block.getBlockType() == BlockTypes.GRASS_BLOCK) {
editSession.setBlock(position.add(0, 1, 0), temperatePattern.apply(position));
return true;
} else if (block.getBlockType() == BlockTypes.SAND) {
@@ -53,7 +53,7 @@ public class ForestGenerator implements RegionFunction {
BlockStateHolder block = editSession.getBlock(position);
BlockType t = block.getBlockType();
if (t == BlockTypes.GRASS || t == BlockTypes.DIRT) {
if (t == BlockTypes.GRASS_BLOCK || t == BlockTypes.DIRT) {
treeType.generate(editSession, position.add(0, 1, 0));
return true;
} else if (t == BlockTypes.TALL_GRASS || t == BlockTypes.DEAD_BUSH || t == BlockTypes.POPPY || t == BlockTypes.DANDELION) { // TODO: This list needs to be moved
@@ -163,7 +163,7 @@ public class GardenPatchGenerator implements RegionFunction {
position = position.add(0, 1, 0);
}
if (editSession.getBlock(position.add(0, -1, 0)).getBlockType() != BlockTypes.GRASS) {
if (editSession.getBlock(position.add(0, -1, 0)).getBlockType() != BlockTypes.GRASS_BLOCK) {
return false;
}
@@ -187,7 +187,7 @@ public class GardenPatchGenerator implements RegionFunction {
* @return a pumpkin pattern
*/
public static Pattern getPumpkinPattern() {
return new BlockPattern(BlockTypes.CARVED_PUMPKIN.getDefaultState());
return BlockTypes.PUMPKIN.getDefaultState();
}
/**
@@ -1,25 +1,61 @@
/*
* 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.function.mask;
import com.google.common.base.Preconditions;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.extent.Extent;
/**
* An abstract implementation of {@link Mask} that takes uses an {@link Extent}.
*/
public abstract class AbstractExtentMask extends AbstractMask {
private transient Extent extent;
private Extent extent;
/**
* Construct a new mask.
*
* @param extent the extent
*/
protected AbstractExtentMask(Extent extent) {
this.setExtent(extent);
setExtent(extent);
}
/**
* Get the extent.
*
* @return the extent
*/
public Extent getExtent() {
return this.extent;
return extent;
}
/**
* Set the extent.
*
* @param extent the extent
*/
public void setExtent(Extent extent) {
Preconditions.checkNotNull(extent);
checkNotNull(extent);
this.extent = extent;
}
public static Class<?> inject() {
return AbstractExtentMask.class;
}
}
}
@@ -25,7 +25,5 @@ import java.io.Serializable;
* A base class of {@link Mask} that all masks should inherit from.
*/
public abstract class AbstractMask implements Mask, Serializable {
public static Class<?> inject() {
return AbstractMask.class;
}
}
@@ -196,7 +196,5 @@ public class BlockMask extends AbstractExtentMask {
return null;
}
public static Class<?> inject() {
return BlockMask.class;
}
}
@@ -153,7 +153,5 @@ public final class Masks {
}
}
public static Class<?> inject() {
return Masks.class;
}
}
@@ -87,7 +87,5 @@ public class OffsetMask extends AbstractMask {
}
}
public static Class<?> inject() {
return OffsetMask.class;
}
}
@@ -28,7 +28,5 @@ public class SolidBlockMask extends BlockTypeMask {
return null;
}
public static Class<?> inject() {
return SolidBlockMask.class;
}
}
@@ -114,7 +114,5 @@ public class ChangeSetExecutor implements Operation {
return new ChangeSetExecutor(changeSet, Type.REDO, context, null, 0);
}
public static Class<?> inject() {
return ChangeSetExecutor.class;
}
}
@@ -377,7 +377,5 @@ public class ForwardExtentCopy implements Operation {
public void addStatusMessages(List<String> messages) {
}
public static Class<?> inject() {
return ForwardExtentCopy.class;
}
}
@@ -80,7 +80,5 @@ public final class Operations {
return;
}
public static Class<?> inject() {
return Operations.class;
}
}
@@ -6,7 +6,5 @@ public abstract class AbstractPattern implements Pattern, Serializable {
public AbstractPattern() {
}
public static Class<?> inject() {
return AbstractPattern.class;
}
}
@@ -49,7 +49,5 @@ public class ClipboardPattern extends AbstractPattern {
return clipboard.getBlock(mutable);
}
public static Class<?> inject() {
return ClipboardPattern.class;
}
}
@@ -72,8 +72,6 @@ public class RandomPattern extends AbstractPattern {
return collection.next(get.getBlockX(), get.getBlockY(), get.getBlockZ()).apply(extent, set, get);
}
public static Class<?> inject() {
return RandomPattern.class;
}
}
@@ -215,7 +215,5 @@ public abstract class BreadthFirstSearch implements Operation {
public void cancel() {
}
public static Class<?> inject() {
return BreadthFirstSearch.class;
}
}
@@ -69,7 +69,5 @@ public class DownwardVisitor extends RecursiveVisitor {
return ((fromY == this.baseY) || (to.getBlockY() - from.getBlockY() < 0)) && super.isVisitable(from, to);
}
public static Class<?> inject() {
return DownwardVisitor.class;
}
}
@@ -83,7 +83,5 @@ public class EntityVisitor implements Operation {
messages.add(BBC.VISITOR_ENTITY.format(getAffected()));
}
public static Class<?> inject() {
return Operations.class;
}
}
@@ -100,8 +100,6 @@ public class FlatRegionVisitor implements Operation {
messages.add(BBC.VISITOR_FLAT.format(getAffected()));
}
public static Class<?> inject() {
return Operations.class;
}
}
@@ -132,7 +132,5 @@ public class LayerVisitor implements Operation {
public void addStatusMessages(final List<String> messages) {
}
public static Class<?> inject() {
return Operations.class;
}
}
@@ -52,8 +52,6 @@ public class NonRisingVisitor extends RecursiveVisitor {
directions.add(new Vector(0, -1, 0));
}
public static Class<?> inject() {
return NonRisingVisitor.class;
}
}
@@ -60,7 +60,5 @@ public class RecursiveVisitor extends BreadthFirstSearch {
return this.mask.test(to);
}
public static Class<?> inject() {
return RecursiveVisitor.class;
}
}
@@ -198,7 +198,5 @@ public class RegionVisitor implements Operation {
messages.add(BBC.VISITOR_BLOCK.format(getAffected()));
}
public static Class<?> inject() {
return Operations.class;
}
}
@@ -385,8 +385,6 @@ public class WorldEditBinding extends BindingHelper {
}
}
public static Class<?> inject() {
return WorldEditBinding.class;
}
}
@@ -165,8 +165,6 @@ public class Expression {
this.environment = environment;
}
public static Class<?> inject() {
return Expression.class;
}
}
@@ -34,7 +34,5 @@ public interface ExpressionEnvironment {
int getBlockTypeRel(double x, double y, double z);
int getBlockDataRel(double x, double y, double z);
public static Class<?> inject() {
return ExpressionEnvironment.class;
}
}
@@ -121,7 +121,5 @@ public class Function extends Node {
return this;
}
public static Class<?> inject() {
return Function.class;
}
}
@@ -489,7 +489,5 @@ public final class Functions {
return queryInternal(type, data, typeId, dataValue);
}
public static Class<?> inject() {
return Functions.class;
}
}
@@ -288,8 +288,6 @@ public class HeightMap {
return blocksChanged;
}
public static Class<?> inject() {
return HeightMap.class;
}
}
@@ -256,7 +256,5 @@ public class KochanekBartelsInterpolation implements Interpolation {
return (int) Math.floor(position);
}
public static Class<?> inject() {
return KochanekBartelsInterpolation.class;
}
}
@@ -324,7 +324,5 @@ public class AffineTransform implements Transform, Serializable {
mutable = new MutableBlockVector();
}
public static Class<?> inject() {
return AffineTransform.class;
}
}
@@ -655,7 +655,5 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
return new CuboidRegion(origin.subtract(size), origin.add(size));
}
public static Class<?> inject() {
return CuboidRegion.class;
}
}
@@ -278,7 +278,5 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion
}
}
public static Class<?> inject() {
return ConvexPolyhedralRegionSelector.class;
}
}
@@ -312,7 +312,5 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
return "cuboid";
}
public static Class<?> inject() {
return CuboidRegionSelector.class;
}
}
@@ -284,7 +284,5 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
return "cuboid";
}
public static Class<?> inject() {
return CylinderRegionSelector.class;
}
}

Some files were not shown because too many files have changed in this diff Show More