Remove stub injector methods

This commit is contained in:
Jesse Boyd 2018-08-13 02:36:39 +10:00
parent fa06ff357e
commit e7c27b08bf
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
124 changed files with 241 additions and 411 deletions

View File

@ -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());

View File

@ -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

View File

@ -180,8 +180,4 @@ public class Commands {
return command.anyFlags();
}
}
public static Class<Commands> inject() {
return Commands.class;
}
}

View File

@ -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);
}

View File

@ -80,9 +80,4 @@ public class RandomTransform extends SelectTransform {
public RandomCollection<ResettableExtent> getCollection() {
return collection;
}
public static Class<?> inject() {
return RandomPattern.class;
}
}

View File

@ -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;
}
}

View File

@ -425,7 +425,5 @@ public final class CompoundTag extends Tag {
return bldr.toString();
}
public static Class<?> inject() {
return CompoundTag.class;
}
}

View File

@ -201,7 +201,5 @@ public class CompoundTagBuilder {
return new CompoundTagBuilder();
}
public static Class<?> inject() {
return CompoundTagBuilder.class;
}
}

View File

@ -419,8 +419,6 @@ public final class ListTag<T extends Tag> extends Tag {
return bldr.toString();
}
public static Class<?> inject() {
return ListTag.class;
}
}

View File

@ -611,7 +611,5 @@ public final class NBTInputStream implements Closeable {
}
}
public static Class<?> inject() {
return NBTInputStream.class;
}
}

View File

@ -409,7 +409,5 @@ public final class NBTOutputStream implements Closeable {
if (os instanceof Flushable) ((Flushable) os).flush();
}
public static Class<?> inject() {
return NBTOutputStream.class;
}
}

View File

@ -35,9 +35,7 @@ public abstract class Tag {
return getValue();
}
public static Class<?> inject() {
return Tag.class;
}
}

View File

@ -19,7 +19,9 @@
package com.sk89q.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
@ -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;
}
}

View File

@ -3320,7 +3320,5 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
world.setWeather(weatherType, duration);
}
public static Class<?> inject() {
return EditSession.class;
}
}

View File

@ -1369,7 +1369,5 @@ public class LocalSession implements TextureHolder {
this.transform = transform;
}
public static Class<?> inject() {
return LocalSession.class;
}
}

View File

@ -910,7 +910,5 @@ public class Vector extends Vector2D implements Comparable<Vector>, Serializable
this.z = stream.readDouble();
}
public static Class<?> inject() {
return Vector.class;
}
}

View File

@ -868,7 +868,5 @@ public class BrushCommands extends BrushProcessor {
.setSize(radius);
}
public static Class<?> inject() {
return BrushCommands.class;
}
}

View File

@ -508,7 +508,5 @@ public class BrushOptionsCommands extends MethodCommands {
BBC.BRUSH_SIZE.send(player);
}
public static Class<?> inject() {
return BrushOptionsCommands.class;
}
}

View File

@ -595,7 +595,5 @@ public class ClipboardCommands extends MethodCommands {
BBC.CLIPBOARD_CLEARED.send(player);
}
public static Class<?> inject() {
return ClipboardCommands.class;
}
}

View File

@ -134,7 +134,5 @@ public class FlattenedClipboardTransform {
return new FlattenedClipboardTransform(original, transform);
}
public static Class<?> inject() {
return FlattenedClipboardTransform.class;
}
}

View File

@ -298,7 +298,5 @@ public class HistoryCommands extends MethodCommands {
BBC.COMMAND_HISTORY_CLEAR.send(player);
}
public static Class<?> inject() {
return HistoryCommands.class;
}
}

View File

@ -231,7 +231,5 @@ public class NavigationCommands {
return forceGlass || (config.navigationUseGlass && !forceFlight);
}
public static Class<?> inject() {
return NavigationCommands.class;
}
}

View File

@ -313,7 +313,5 @@ public class OptionsCommands {
}
}
public static Class<?> inject() {
return OptionsCommands.class;
}
}

View File

@ -789,7 +789,5 @@ public class RegionCommands extends MethodCommands {
BBC.COMMAND_FLORA.send(player, ground.getAffected());
}
public static Class<?> inject() {
return RegionCommands.class;
}
}

View File

@ -636,7 +636,5 @@ public class SchematicCommands extends MethodCommands {
});
}
public static Class<?> inject() {
return SchematicCommands.class;
}
}

View File

@ -219,7 +219,5 @@ public class ScriptingCommands {
}
}
public static Class<?> inject() {
return ScriptingCommands.class;
}
}

View File

@ -821,7 +821,5 @@ public class SelectionCommands {
session.dispatchCUISelection(player);
}
public static Class<?> inject() {
return SelectionCommands.class;
}
}

View File

@ -183,7 +183,5 @@ public class ToolCommands {
BBC.TOOL_LRBUILD_INFO.send(player, secondary, primary);
}
public static Class<?> inject() {
return ToolCommands.class;
}
}

View File

@ -189,8 +189,6 @@ public class SelectionCommand extends SimpleCommand<Operation> {
return locals.get(Actor.class).hasPermission(permission);
}
public static Class<?> inject() {
return SelectionCommand.class;
}
}

View File

@ -59,7 +59,5 @@ public class AreaPickaxe implements BlockTool {
return true;
}
public static Class<?> inject() {
return AreaPickaxe.class;
}
}

View File

@ -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);

View File

@ -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() {
@ -70,7 +69,7 @@ public class FloatingTreeRemover implements BlockTool {
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;
}

View File

@ -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;
}
}

View File

@ -63,7 +63,5 @@ public class RecursivePickaxe implements BlockTool {
return true;
}
public static Class<?> inject() {
return RecursivePickaxe.class;
}
}

View File

@ -63,7 +63,5 @@ public class SinglePickaxe implements BlockTool {
return true;
}
public static Class<?> inject() {
return SinglePickaxe.class;
}
}

View File

@ -65,8 +65,6 @@ public class GravityBrush implements Brush {
}
}
public static Class<?> inject() {
return GravityBrush.class;
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

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

View File

@ -176,7 +176,5 @@ public class EditSessionEvent extends Event implements Cancellable {
return clone;
}
public static Class<?> inject() {
return EditSessionEvent.class;
}
}

View File

@ -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;

View File

@ -163,7 +163,5 @@ public class DefaultMaskParser extends FaweParser<Mask> {
}
}
public static Class<?> inject() {
return DefaultMaskParser.class;
}
}

View File

@ -146,7 +146,5 @@ public class DefaultTransformParser extends FaweParser<ResettableExtent> {
}
}
public static Class<?> inject() {
return HashTagPatternParser.class;
}
}

View File

@ -135,7 +135,5 @@ public class HashTagPatternParser extends FaweParser<Pattern> {
}
}
public static Class<?> inject() {
return HashTagPatternParser.class;
}
}

View File

@ -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));
}
}

View File

@ -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;

View File

@ -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();
}
}

View File

@ -522,7 +522,5 @@ public final class CommandManager {
return commandLog;
}
public static Class<?> inject() {
return CommandManager.class;
}
}

View File

@ -521,8 +521,6 @@ public class PlatformManager {
}
}
public static Class<?> inject() {
return PlatformManager.class;
}
}

View File

@ -285,7 +285,5 @@ public class AbstractDelegateExtent implements LightingExtent {
}
}
public static Class<?> inject() {
return AbstractDelegateExtent.class;
}
}

View File

@ -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;
}
}

View File

@ -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

View File

@ -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();
}
}

View File

@ -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;
}

View File

@ -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) {

View File

@ -558,7 +558,5 @@ public enum ClipboardFormat {
return newEnum;
}
public static Class<?> inject() {
return ClipboardFormat.class;
}
}

View File

@ -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 {

View File

@ -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);

View File

@ -117,7 +117,5 @@ public class BlockBagExtent extends AbstractDelegateExtent {
return getExtent().setBlock(x, y, z, block);
}
public static Class<?> inject() {
return BlockBagExtent.class;
}
}

View File

@ -268,7 +268,5 @@ public class BlockTransformExtent extends ResettableExtent {
return super.setBlock(location, transformFastInverse((BlockState) block));
}
public static Class<?> inject() {
return BlockTransformExtent.class;
}
}

View File

@ -106,7 +106,5 @@ public class CombinedRegionFunction implements RegionFunction {
}
public static Class<?> inject() {
return CombinedRegionFunction.class;
}
}

View File

@ -54,8 +54,6 @@ public class BlockReplace implements RegionFunction {
return pattern.apply(extent, position, position);
}
public static Class<?> inject() {
return BlockReplace.class;
}
}

View File

@ -119,8 +119,6 @@ public class ExtentBlockCopy implements RegionFunction {
return state;
}
public static Class<?> inject() {
return ExtentBlockCopy.class;
}
}

View File

@ -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:

View File

@ -203,8 +203,6 @@ public class ExtentEntityCopy implements EntityFunction {
return state;
}
public static Class<?> inject() {
return ExtentEntityCopy.class;
}
}

View File

@ -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) {

View File

@ -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

View File

@ -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();
}
/**

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -196,7 +196,5 @@ public class BlockMask extends AbstractExtentMask {
return null;
}
public static Class<?> inject() {
return BlockMask.class;
}
}

View File

@ -153,7 +153,5 @@ public final class Masks {
}
}
public static Class<?> inject() {
return Masks.class;
}
}

View File

@ -87,7 +87,5 @@ public class OffsetMask extends AbstractMask {
}
}
public static Class<?> inject() {
return OffsetMask.class;
}
}

View File

@ -28,7 +28,5 @@ public class SolidBlockMask extends BlockTypeMask {
return null;
}
public static Class<?> inject() {
return SolidBlockMask.class;
}
}

View File

@ -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;
}
}

View File

@ -377,7 +377,5 @@ public class ForwardExtentCopy implements Operation {
public void addStatusMessages(List<String> messages) {
}
public static Class<?> inject() {
return ForwardExtentCopy.class;
}
}

View File

@ -80,7 +80,5 @@ public final class Operations {
return;
}
public static Class<?> inject() {
return Operations.class;
}
}

View File

@ -6,7 +6,5 @@ public abstract class AbstractPattern implements Pattern, Serializable {
public AbstractPattern() {
}
public static Class<?> inject() {
return AbstractPattern.class;
}
}

View File

@ -49,7 +49,5 @@ public class ClipboardPattern extends AbstractPattern {
return clipboard.getBlock(mutable);
}
public static Class<?> inject() {
return ClipboardPattern.class;
}
}

View File

@ -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;
}
}

View File

@ -215,7 +215,5 @@ public abstract class BreadthFirstSearch implements Operation {
public void cancel() {
}
public static Class<?> inject() {
return BreadthFirstSearch.class;
}
}

View File

@ -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;
}
}

View File

@ -83,7 +83,5 @@ public class EntityVisitor implements Operation {
messages.add(BBC.VISITOR_ENTITY.format(getAffected()));
}
public static Class<?> inject() {
return Operations.class;
}
}

View File

@ -100,8 +100,6 @@ public class FlatRegionVisitor implements Operation {
messages.add(BBC.VISITOR_FLAT.format(getAffected()));
}
public static Class<?> inject() {
return Operations.class;
}
}

View File

@ -132,7 +132,5 @@ public class LayerVisitor implements Operation {
public void addStatusMessages(final List<String> messages) {
}
public static Class<?> inject() {
return Operations.class;
}
}

View File

@ -52,8 +52,6 @@ public class NonRisingVisitor extends RecursiveVisitor {
directions.add(new Vector(0, -1, 0));
}
public static Class<?> inject() {
return NonRisingVisitor.class;
}
}

View File

@ -60,7 +60,5 @@ public class RecursiveVisitor extends BreadthFirstSearch {
return this.mask.test(to);
}
public static Class<?> inject() {
return RecursiveVisitor.class;
}
}

View File

@ -198,7 +198,5 @@ public class RegionVisitor implements Operation {
messages.add(BBC.VISITOR_BLOCK.format(getAffected()));
}
public static Class<?> inject() {
return Operations.class;
}
}

View File

@ -385,8 +385,6 @@ public class WorldEditBinding extends BindingHelper {
}
}
public static Class<?> inject() {
return WorldEditBinding.class;
}
}

View File

@ -165,8 +165,6 @@ public class Expression {
this.environment = environment;
}
public static Class<?> inject() {
return Expression.class;
}
}

View File

@ -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;
}
}

View File

@ -121,7 +121,5 @@ public class Function extends Node {
return this;
}
public static Class<?> inject() {
return Function.class;
}
}

View File

@ -489,7 +489,5 @@ public final class Functions {
return queryInternal(type, data, typeId, dataValue);
}
public static Class<?> inject() {
return Functions.class;
}
}

View File

@ -288,8 +288,6 @@ public class HeightMap {
return blocksChanged;
}
public static Class<?> inject() {
return HeightMap.class;
}
}

View File

@ -256,7 +256,5 @@ public class KochanekBartelsInterpolation implements Interpolation {
return (int) Math.floor(position);
}
public static Class<?> inject() {
return KochanekBartelsInterpolation.class;
}
}

View File

@ -324,7 +324,5 @@ public class AffineTransform implements Transform, Serializable {
mutable = new MutableBlockVector();
}
public static Class<?> inject() {
return AffineTransform.class;
}
}

View File

@ -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;
}
}

View File

@ -278,7 +278,5 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion
}
}
public static Class<?> inject() {
return ConvexPolyhedralRegionSelector.class;
}
}

View File

@ -312,7 +312,5 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
return "cuboid";
}
public static Class<?> inject() {
return CuboidRegionSelector.class;
}
}

View File

@ -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