revert some changes

This commit is contained in:
Jesse Boyd 2019-04-05 15:48:41 +11:00
parent 94d5d8df8e
commit be5541b61b
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
18 changed files with 29 additions and 51 deletions

View File

@ -84,8 +84,9 @@ public class BukkitBlockRegistry extends BundledBlockRegistry {
@Nullable
@Override
public Map<String, ? extends Property<?>> getProperties(BlockType blockType) {
if (WorldEditPlugin.getInstance().getBukkitImplAdapter() != null) {
return WorldEditPlugin.getInstance().getBukkitImplAdapter().getProperties(blockType);
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
if (adapter != null) {
return adapter.getProperties(blockType);
}
return super.getProperties(blockType);
}

View File

@ -300,7 +300,7 @@ public class RegionCommands extends MethodCommands {
@Command(
aliases = { "/replace", "/re", "/rep" },
usage = "[from-block] <to-block>",
usage = "[from-mask] <to-pattern>",
desc = "Replace all blocks in the selection with another",
flags = "f",
min = 1,

View File

@ -669,7 +669,7 @@ public class SelectionCommands {
@Command(
aliases = {"/count"},
usage = "<block>",
usage = "<mask>",
desc = "Counts the number of a certain type of block",
flags = "d",
min = 1,

View File

@ -104,7 +104,7 @@ public class ToolCommands {
@Command(
aliases = {"repl"},
usage = "<block>",
usage = "<pattern>",
desc = "Block replacer tool",
min = 1,
max = 1

View File

@ -372,7 +372,7 @@ public class UtilityCommands extends MethodCommands {
@Command(
aliases = {"/removenear", "removenear"},
usage = "<block> [size]",
usage = "<mask> [size]",
desc = "Remove blocks near you.",
min = 1,
max = 2

View File

@ -37,7 +37,7 @@ public class CylinderBrush implements Brush {
@Override
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
if (pattern == null) {
pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState());
pattern = (BlockTypes.COBBLESTONE.getDefaultState());
}
editSession.makeCylinder(position, pattern, size, size, height, true);
}

View File

@ -37,7 +37,7 @@ public class HollowCylinderBrush implements Brush {
@Override
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
if (pattern == null) {
pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState());
pattern = (BlockTypes.COBBLESTONE.getDefaultState());
}
editSession.makeCylinder(position, pattern, size, size, height, false);
}

View File

@ -31,7 +31,7 @@ public class HollowSphereBrush implements Brush {
@Override
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
if (pattern == null) {
pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState());
pattern = (BlockTypes.COBBLESTONE.getDefaultState());
}
editSession.makeSphere(position, pattern, size, size, size, false);
}

View File

@ -31,7 +31,7 @@ public class SphereBrush implements Brush {
@Override
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
if (pattern == null) {
pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState());
pattern = (BlockTypes.COBBLESTONE.getDefaultState());
}
editSession.makeSphere(position, pattern, size, size, size, true);
}

View File

@ -69,10 +69,10 @@ public class BlockCategoryPatternParser extends InputParser<Pattern> {
if (anyState) {
blocks.stream().flatMap(blockType -> blockType.getAllStates().stream()).forEach(state ->
randomPattern.add(new BlockPattern(state), 1.0));
randomPattern.add((state), 1.0));
} else {
for (BlockType blockType : blocks) {
randomPattern.add(new BlockPattern(blockType.getDefaultState()), 1.0);
randomPattern.add((blockType.getDefaultState()), 1.0);
}
}

View File

@ -44,7 +44,7 @@ public class RandomStatePatternParser extends InputParser<Pattern> {
context.setPreferringWildcard(wasFuzzy);
if (block.getStates().size() == block.getBlockType().getPropertyMap().size()) {
// they requested random with *, but didn't leave any states empty - simplify
return new BlockPattern(block);
return (block);
} else {
return null; // only should happen if parseLogic changes
}

View File

@ -34,7 +34,7 @@ public class SingleBlockPatternParser extends InputParser<Pattern> {
@Override
public Pattern parseFromInput(String input, ParserContext context) throws InputParseException {
return new BlockPattern(worldEdit.getBlockFactory().parseFromInput(input, context));
return (worldEdit.getBlockFactory().parseFromInput(input, context));
}
}

View File

@ -84,9 +84,9 @@ public class FloraGenerator implements RegionFunction {
*/
public static Pattern getDesertPattern() {
RandomPattern pattern = new RandomPattern();
pattern.add(new BlockPattern(BlockTypes.DEAD_BUSH.getDefaultState()), 30);
pattern.add(new BlockPattern(BlockTypes.CACTUS.getDefaultState()), 20);
pattern.add(new BlockPattern(BlockTypes.AIR.getDefaultState()), 300);
pattern.add((BlockTypes.DEAD_BUSH.getDefaultState()), 30);
pattern.add((BlockTypes.CACTUS.getDefaultState()), 20);
pattern.add((BlockTypes.AIR.getDefaultState()), 300);
return pattern;
}
@ -97,9 +97,9 @@ 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.POPPY.getDefaultState()), 5);
pattern.add(new BlockPattern(BlockTypes.DANDELION.getDefaultState()), 5);
pattern.add((BlockTypes.GRASS.getDefaultState()), 300);
pattern.add((BlockTypes.POPPY.getDefaultState()), 5);
pattern.add((BlockTypes.DANDELION.getDefaultState()), 5);
return pattern;
}

View File

@ -208,6 +208,6 @@ public class GardenPatchGenerator implements RegionFunction {
* @return a melon pattern
*/
public static Pattern getMelonPattern() {
return new BlockPattern(BlockTypes.MELON.getDefaultState());
return (BlockTypes.MELON.getDefaultState());
}
}

View File

@ -564,10 +564,7 @@ public class BlockVector2 {
@Override
public int hashCode() {
int hash = 17;
hash = 31 * hash + Integer.hashCode(x);
hash = 31 * hash + Integer.hashCode(z);
return hash;
return (x << 16) ^ z;
}
@Override

View File

@ -629,11 +629,7 @@ public class BlockVector3 {
@Override
public int hashCode() {
int hash = 17;
hash = 31 * hash + Integer.hashCode(x);
hash = 31 * hash + Integer.hashCode(y);
hash = 31 * hash + Integer.hashCode(z);
return hash;
return (x ^ (z << 12)) ^ (y << 24);
}
@Override

View File

@ -491,7 +491,7 @@ public class Vector2 {
@Override
public int hashCode() {
return ((int) getX() ^ ((int) getZ() << 16));
return (((int) x) << 16) ^ ((int) z);
}
@Override

View File

@ -40,21 +40,6 @@ public class Vector3 {
public static final Vector3 ONE = new Vector3(1, 1, 1);
public static Vector3 at(double x, double y, double z) {
// switch for efficiency on typical cases
// in MC y is rarely 0/1 on selections
int yTrunc = (int) y;
switch (yTrunc) {
case 0:
if (x == 0 && y == 0 && z == 0) {
return ZERO;
}
break;
case 1:
if (x == 1 && y == 1 && z == 1) {
return ONE;
}
break;
}
return new Vector3(x, y, z);
}
@ -647,15 +632,14 @@ public class Vector3 {
@Override
public int hashCode() {
int hash = 17;
hash = 31 * hash + Double.hashCode(x);
hash = 31 * hash + Double.hashCode(y);
hash = 31 * hash + Double.hashCode(z);
return hash;
return (((int) x) ^ (((int) z) << 12)) ^ (((int) y) << 24);
}
@Override
public String toString() {
String x = (getX() == getBlockX() ? "" + getBlockX() : "" + getX());
String y = (getY() == getBlockY() ? "" + getBlockY() : "" + getY());
String z = (getZ() == getBlockZ() ? "" + getBlockZ() : "" + getZ());
return "(" + x + ", " + y + ", " + z + ")";
}