Abstracted all block IDs to BlockID and item ids to ItemType. Overloaded recently changed methods for compatibility and cleaned a few things up.

This commit is contained in:
Wizjany 2011-09-03 12:54:20 -04:00
parent 8c0d0f9ed4
commit 4c00a24c1d
30 changed files with 873 additions and 652 deletions

View File

@ -173,7 +173,17 @@ public class CuboidClipboard {
/** /**
* Flip the clipboard. * Flip the clipboard.
* *
* @param dir * @param dir direction to flip
*/
public void flip(FlipDirection dir) {
flip(dir, false);
}
/**
* Flip the clipboard.
*
* @param dir direction to flip
* @param aroundPlayer flip the offset around the player
*/ */
public void flip(FlipDirection dir, boolean aroundPlayer) { public void flip(FlipDirection dir, boolean aroundPlayer) {
final int width = getWidth(); final int width = getWidth();
@ -186,24 +196,16 @@ public class CuboidClipboard {
for (int xs = 0; xs < wid; ++xs) { for (int xs = 0; xs < wid; ++xs) {
for (int z = 0; z < length; ++z) { for (int z = 0; z < length; ++z) {
for (int y = 0; y < height; ++y) { for (int y = 0; y < height; ++y) {
final BaseBlock a = data[xs][y][z]; BaseBlock old = data[xs][y][z].flip(dir);
//System.out.println(xs+"/"+y+"/"+z+": "+a.getType()); data[xs][y][z] = data[width - xs - 1][y][z].flip(dir);
a.flip(dir); data[width - xs - 1][y][z] = old;
if (xs == width - xs - 1)
continue;
final BaseBlock b = data[width - xs - 1][y][z];
b.flip(dir);
data[xs][y][z] = b;
data[width - xs - 1][y][z] = a;
} }
} }
} }
if (aroundPlayer) if (aroundPlayer) {
offset = offset.setX(1 - offset.getX() - width); offset = offset.setX(1 - offset.getX() - width);
}
break; break;
@ -212,23 +214,16 @@ public class CuboidClipboard {
for (int zs = 0; zs < len; ++zs) { for (int zs = 0; zs < len; ++zs) {
for (int x = 0; x < width; ++x) { for (int x = 0; x < width; ++x) {
for (int y = 0; y < height; ++y) { for (int y = 0; y < height; ++y) {
final BaseBlock a = data[x][y][zs]; BaseBlock old = data[x][y][zs].flip(dir);
a.flip(dir); data[x][y][zs] = data[x][y][length - zs - 1].flip(dir);
data[x][y][length - zs - 1] = old;
if (zs == length - zs - 1)
continue;
final BaseBlock b = data[x][y][length - zs - 1];
b.flip(dir);
data[x][y][zs] = b;
data[x][y][length - zs - 1] = a;
} }
} }
} }
if (aroundPlayer) if (aroundPlayer) {
offset = offset.setZ(1 - offset.getZ() - length); offset = offset.setZ(1 - offset.getZ() - length);
}
break; break;
@ -237,23 +232,16 @@ public class CuboidClipboard {
for (int ys = 0; ys < hei; ++ys) { for (int ys = 0; ys < hei; ++ys) {
for (int x = 0; x < width; ++x) { for (int x = 0; x < width; ++x) {
for (int z = 0; z < length; ++z) { for (int z = 0; z < length; ++z) {
final BaseBlock a = data[x][ys][z]; BaseBlock old = data[x][ys][z].flip(dir);
a.flip(dir); data[x][ys][z] = data[x][height - ys - 1][z].flip(dir);
data[x][height - ys - 1][z] = old;
if (ys == height - ys - 1)
continue;
final BaseBlock b = data[x][height - ys - 1][z];
b.flip(dir);
data[x][ys][z] = b;
data[x][height - ys - 1][z] = a;
} }
} }
} }
if (aroundPlayer) if (aroundPlayer) {
offset = offset.setY(1 - offset.getY() - height); offset = offset.setY(1 - offset.getY() - height);
}
break; break;
} }

View File

@ -18,7 +18,6 @@
*/ */
package com.sk89q.worldedit; package com.sk89q.worldedit;
import java.util.Arrays;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
@ -182,7 +181,7 @@ public class EditSession {
world.clearContainerBlockContents(pt); world.clearContainerBlockContents(pt);
// Ice turns until water so this has to be done first // Ice turns until water so this has to be done first
} else if (existing == BlockID.ICE) { } else if (existing == BlockID.ICE) {
world.setBlockType(pt, 0); world.setBlockType(pt, BlockID.AIR);
} }
int id = block.getType(); int id = block.getType();
@ -342,7 +341,7 @@ public class EditSession {
&& getBlockData(pt) == block.getData()); && getBlockData(pt) == block.getData());
// Destroy torches, etc. first // Destroy torches, etc. first
} else if (BlockType.shouldPlaceLast(getBlockType(pt))) { } else if (BlockType.shouldPlaceLast(getBlockType(pt))) {
rawSetBlock(pt, new BaseBlock(0)); rawSetBlock(pt, new BaseBlock(BlockID.AIR));
} else { } else {
queueAfter.put(pt.toBlockVector(), block); queueAfter.put(pt.toBlockVector(), block);
return !(getBlockType(pt) == block.getType() return !(getBlockType(pt) == block.getType()
@ -504,8 +503,7 @@ public class EditSession {
/** /**
* Set the maximum number of blocks that can be changed. * Set the maximum number of blocks that can be changed.
* *
* @param maxBlocks * @param maxBlocks -1 to disable
* -1 to disable
*/ */
public void setBlockChangeLimit(int maxBlocks) { public void setBlockChangeLimit(int maxBlocks) {
if (maxBlocks < -1) { if (maxBlocks < -1) {
@ -818,8 +816,8 @@ public class EditSession {
for (int y = oY; y <= maxY; ++y) { for (int y = oY; y <= maxY; ++y) {
Vector pt = new Vector(x, y, z); Vector pt = new Vector(x, y, z);
if (getBlockType(pt) != 0) { if (getBlockType(pt) != BlockID.AIR) {
setBlock(pt, new BaseBlock(0)); setBlock(pt, new BaseBlock(BlockID.AIR));
++affected; ++affected;
} }
} }
@ -853,8 +851,8 @@ public class EditSession {
for (int y = oY; y >= minY; --y) { for (int y = oY; y >= minY; --y) {
Vector pt = new Vector(x, y, z); Vector pt = new Vector(x, y, z);
if (getBlockType(pt) != 0) { if (getBlockType(pt) != BlockID.AIR) {
setBlock(pt, new BaseBlock(0)); setBlock(pt, new BaseBlock(BlockID.AIR));
++affected; ++affected;
} }
} }
@ -876,7 +874,7 @@ public class EditSession {
public int removeNear(Vector pos, int blockType, int size) public int removeNear(Vector pos, int blockType, int size)
throws MaxChangedBlocksException { throws MaxChangedBlocksException {
int affected = 0; int affected = 0;
BaseBlock air = new BaseBlock(0); BaseBlock air = new BaseBlock(BlockID.AIR);
int minX = pos.getBlockX() - size; int minX = pos.getBlockX() - size;
int maxX = pos.getBlockX() + size; int maxX = pos.getBlockX() + size;
@ -1633,7 +1631,8 @@ public class EditSession {
int type = getBlockType(cur); int type = getBlockType(cur);
// Check block type // Check block type
if (type != 8 && type != 9 && type != 10 && type != 11) { if (type != BlockID.WATER && type != BlockID.STATIONARY_WATER
&& type != BlockID.LAVA && type != BlockID.STATIONARY_LAVA) {
continue; continue;
} }
@ -1661,7 +1660,7 @@ public class EditSession {
} }
} }
if (setBlock(cur, new BaseBlock(0))) { if (setBlock(cur, new BaseBlock(BlockID.AIR))) {
++affected; ++affected;
} }
} }
@ -1707,7 +1706,7 @@ public class EditSession {
int type = getBlockType(cur); int type = getBlockType(cur);
// Check block type // Check block type
if (type != moving && type != stationary && type != 0) { if (type != moving && type != stationary && type != BlockID.AIR) {
continue; continue;
} }
@ -1919,6 +1918,74 @@ public class EditSession {
return affected; return affected;
} }
/**
* Makes a sphere or ellipsoid.
*
* @param pos Center of the sphere or ellipsoid
* @param block The block pattern to use
* @param radiusX The sphere/ellipsoid's largest north/south extent
* @param radiusY The sphere/ellipsoid's largest up/down extent
* @param radiusZ The sphere/ellipsoid's largest east/west extent
* @param filled If false, only a shell will be generated.
* @return number of blocks changed
* @throws MaxChangedBlocksException
*/
public int makeSphere(Vector pos, Pattern block, double radius, boolean filled) throws MaxChangedBlocksException {
int affected = 0;
radius += 0.5;
final double radiusSq = radius*radius;
final double radius1Sq = (radius - 1)*(radius - 1);
final int ceilRadius = (int) Math.ceil(radius);
for (int x = 0; x <= ceilRadius; ++x) {
for (int y = 0; y <= ceilRadius; ++y) {
for (int z = 0; z <= ceilRadius; ++z) {
double dSq = lengthSq(x, y, z);
if (dSq > radiusSq) {
continue;
}
if (!filled) {
if (dSq < radius1Sq
|| (lengthSq(x + 1, y, z) <= radiusSq
&& lengthSq(x, y + 1, z) <= radiusSq
&& lengthSq(x, y, z + 1) <= radiusSq)) {
continue;
}
}
if (setBlock(pos.add(x, y, z), block)) {
++affected;
}
if (setBlock(pos.add(-x, y, z), block)) {
++affected;
}
if (setBlock(pos.add(x, -y, z), block)) {
++affected;
}
if (setBlock(pos.add(x, y, -z), block)) {
++affected;
}
if (setBlock(pos.add(-x, -y, z), block)) {
++affected;
}
if (setBlock(pos.add(x, -y, -z), block)) {
++affected;
}
if (setBlock(pos.add(-x, y, -z), block)) {
++affected;
}
if (setBlock(pos.add(-x, -y, -z), block)) {
++affected;
}
}
}
}
return affected;
}
/** /**
* Makes a sphere or ellipsoid. * Makes a sphere or ellipsoid.
* *
@ -1950,31 +2017,33 @@ public class EditSession {
forX: forX:
for (int x = 0; x <= ceilRadiusX; ++x) { for (int x = 0; x <= ceilRadiusX; ++x) {
final double xn = nextXn; final double xn = nextXn;
nextXn = (x+1)*invRadiusX; nextXn = (x + 1) * invRadiusX;
double nextYn = 0; double nextYn = 0;
forY: forY:
for (int y = 0; y <= ceilRadiusY; ++y) { for (int y = 0; y <= ceilRadiusY; ++y) {
final double yn = nextYn; final double yn = nextYn;
nextYn = (y+1)*invRadiusY; nextYn = (y + 1) * invRadiusY;
double nextZn = 0; double nextZn = 0;
forZ: forZ:
for (int z = 0; z <= ceilRadiusZ; ++z) { for (int z = 0; z <= ceilRadiusZ; ++z) {
final double zn = nextZn; final double zn = nextZn;
nextZn = (z+1)*invRadiusZ; nextZn = (z + 1) * invRadiusZ;
double distanceSq = lengthSq(xn, yn, zn); double distanceSq = lengthSq(xn, yn, zn);
if (distanceSq > 1) { if (distanceSq > 1) {
if (z == 0) { if (z == 0) {
if (y == 0) if (y == 0) {
break forX; break forX;
}
break forY; break forY;
} }
break forZ; break forZ;
} }
if (!filled) { if (!filled) {
if (lengthSq(nextXn, yn, zn) <= 1 && lengthSq(xn, nextYn, zn) <= 1 && lengthSq(xn, yn, nextZn) <= 1) if (lengthSq(nextXn, yn, zn) <= 1 && lengthSq(xn, nextYn, zn) <= 1 && lengthSq(xn, yn, nextZn) <= 1) {
continue; continue;
}
} }
if (setBlock(pos.add(x, y, z), block)) { if (setBlock(pos.add(x, y, z), block)) {
@ -2009,7 +2078,7 @@ public class EditSession {
} }
private static final double lengthSq(double x, double y, double z) { private static final double lengthSq(double x, double y, double z) {
return x*x + y*y + z*z; return (x * x) + (y * y) + (z * z);
} }
/** /**
@ -2121,8 +2190,8 @@ public class EditSession {
int oy = pos.getBlockY(); int oy = pos.getBlockY();
int oz = pos.getBlockZ(); int oz = pos.getBlockZ();
BaseBlock ice = new BaseBlock(79); BaseBlock ice = new BaseBlock(BlockID.ICE);
BaseBlock snow = new BaseBlock(78); BaseBlock snow = new BaseBlock(BlockID.SNOW);
int ceilRadius = (int) Math.ceil(radius); int ceilRadius = (int) Math.ceil(radius);
for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) { for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) {
@ -2136,34 +2205,13 @@ public class EditSession {
int id = getBlockType(pt); int id = getBlockType(pt);
// Snow should not cover these blocks // Snow should not cover these blocks
if (id == 6 // Saplings if (BlockType.canPassThrough(id)
|| id == 10 // Lava && !(id == BlockID.WATER || id == BlockID.STATIONARY_WATER)) {
|| id == 11 // Lava
|| id == 37 // Yellow flower
|| id == 38 // Red rose
|| id == 39 // Brown mushroom
|| id == 40 // Red mushroom
|| id == 44 // Step
|| id == 50 // Torch
|| id == 51 // Fire
|| id == 53 // Wood steps
|| id == 55 // Redstone wire
|| id == 59 // Crops
|| (id >= 63 && id <= 72) || id == 75 // Redstone
// torch
|| id == 76 // Redstone torch
|| id == 77 // Stone button
|| id == 78 // Snow
|| id == 79 // Ice
|| id == 81 // Cactus
|| id == 83 // Reed
|| id == 85 // Fence
|| id == 90) { // Portal
break; break;
} }
// Ice! // Ice!
if (id == 8 || id == 9) { if (id == BlockID.WATER || id == BlockID.STATIONARY_WATER) {
if (setBlock(pt, ice)) { if (setBlock(pt, ice)) {
++affected; ++affected;
} }
@ -2171,7 +2219,7 @@ public class EditSession {
} }
// Cover // Cover
if (id != 0) { if (id != BlockID.AIR) {
if (y == 127) { // Too high! if (y == 127) { // Too high!
break; break;
} }
@ -2188,42 +2236,6 @@ public class EditSession {
return affected; return affected;
} }
private static final Set<Integer> greenIgnoreBlockIds = new HashSet<Integer>(Arrays.asList(
BlockID.AIR,
BlockID.BROWN_MUSHROOM,
BlockID.DEAD_BUSH,
BlockID.DETECTOR_RAIL,
BlockID.FENCE,
BlockID.FIRE,
BlockID.IRON_DOOR,
BlockID.LADDER,
BlockID.LEVER,
BlockID.LONG_GRASS,
BlockID.MINECART_TRACKS,
BlockID.PORTAL,
BlockID.POWERED_RAIL,
BlockID.RED_FLOWER,
BlockID.RED_MUSHROOM,
BlockID.REDSTONE_REPEATER_OFF,
BlockID.REDSTONE_REPEATER_ON,
BlockID.REDSTONE_TORCH_OFF,
BlockID.REDSTONE_TORCH_ON,
BlockID.REDSTONE_WIRE,
BlockID.REED,
BlockID.SAPLING,
BlockID.SIGN_POST,
BlockID.SNOW,
BlockID.STONE_BUTTON,
BlockID.STONE_PRESSURE_PLATE,
BlockID.TORCH,
BlockID.TRAP_DOOR,
BlockID.WALL_SIGN,
BlockID.WEB,
BlockID.WOODEN_DOOR,
BlockID.WOODEN_PRESSURE_PLATE,
BlockID.YELLOW_FLOWER
));
/** /**
* Green. * Green.
* *
@ -2254,8 +2266,9 @@ public class EditSession {
Vector pt = new Vector(x, y, z); Vector pt = new Vector(x, y, z);
int id = getBlockType(pt); int id = getBlockType(pt);
if (greenIgnoreBlockIds.contains(id)) if (BlockType.canPassThrough(id)) {
continue; continue;
}
if (id == BlockID.DIRT) { if (id == BlockID.DIRT) {
if (setBlock(pt, grass)) { if (setBlock(pt, grass)) {
@ -2294,8 +2307,8 @@ public class EditSession {
*/ */
private void makePumpkinPatch(Vector basePos) private void makePumpkinPatch(Vector basePos)
throws MaxChangedBlocksException { throws MaxChangedBlocksException {
// BaseBlock logBlock = new BaseBlock(17); // BaseBlock logBlock = new BaseBlock(BlockID.LOG);
BaseBlock leavesBlock = new BaseBlock(18); BaseBlock leavesBlock = new BaseBlock(BlockID.LEAVES);
// setBlock(basePos.subtract(0, 1, 0), logBlock); // setBlock(basePos.subtract(0, 1, 0), logBlock);
setBlockIfAir(basePos, leavesBlock); setBlockIfAir(basePos, leavesBlock);
@ -2314,49 +2327,58 @@ public class EditSession {
*/ */
private void makePumpkinPatchVine(Vector basePos, Vector pos) private void makePumpkinPatchVine(Vector basePos, Vector pos)
throws MaxChangedBlocksException { throws MaxChangedBlocksException {
if (pos.distance(basePos) > 4) if (pos.distance(basePos) > 4) return;
return; if (getBlockType(pos) != 0) return;
if (getBlockType(pos) != 0)
return;
for (int i = -1; i > -3; --i) { for (int i = -1; i > -3; --i) {
Vector testPos = pos.add(0, i, 0); Vector testPos = pos.add(0, i, 0);
if (getBlockType(testPos) == 0) { if (getBlockType(testPos) == BlockID.AIR) {
pos = testPos; pos = testPos;
} else { } else {
break; break;
} }
} }
setBlockIfAir(pos, new BaseBlock(18)); setBlockIfAir(pos, new BaseBlock(BlockID.LEAVES));
int t = prng.nextInt(4); int t = prng.nextInt(4);
int h = prng.nextInt(3) - 1; int h = prng.nextInt(3) - 1;
BaseBlock log = new BaseBlock(BlockID.LOG);
BaseBlock pumpkin = new BaseBlock(BlockID.PUMPKIN);
if (t == 0) { if (t == 0) {
if (prng.nextBoolean()) if (prng.nextBoolean()) {
makePumpkinPatchVine(basePos, pos.add(1, 0, 0)); makePumpkinPatchVine(basePos, pos.add(1, 0, 0));
if (prng.nextBoolean()) }
setBlockIfAir(pos.add(1, h, -1), new BaseBlock(18)); if (prng.nextBoolean()) {
setBlockIfAir(pos.add(0, 0, -1), new BaseBlock(86)); setBlockIfAir(pos.add(1, h, -1), log);
}
setBlockIfAir(pos.add(0, 0, -1), pumpkin);
} else if (t == 1) { } else if (t == 1) {
if (prng.nextBoolean()) if (prng.nextBoolean()) {
makePumpkinPatchVine(basePos, pos.add(0, 0, 1)); makePumpkinPatchVine(basePos, pos.add(0, 0, 1));
if (prng.nextBoolean()) }
setBlockIfAir(pos.add(1, h, 0), new BaseBlock(18)); if (prng.nextBoolean()) {
setBlockIfAir(pos.add(1, 0, 1), new BaseBlock(86)); setBlockIfAir(pos.add(1, h, 0), log);
}
setBlockIfAir(pos.add(1, 0, 1), pumpkin);
} else if (t == 2) { } else if (t == 2) {
if (prng.nextBoolean()) if (prng.nextBoolean()) {
makePumpkinPatchVine(basePos, pos.add(0, 0, -1)); makePumpkinPatchVine(basePos, pos.add(0, 0, -1));
if (prng.nextBoolean()) }
setBlockIfAir(pos.add(-1, h, 0), new BaseBlock(18)); if (prng.nextBoolean()) {
setBlockIfAir(pos.add(-1, 0, 1), new BaseBlock(86)); setBlockIfAir(pos.add(-1, h, 0), log);
}
setBlockIfAir(pos.add(-1, 0, 1), pumpkin);
} else if (t == 3) { } else if (t == 3) {
if (prng.nextBoolean()) if (prng.nextBoolean()) {
makePumpkinPatchVine(basePos, pos.add(-1, 0, 0)); makePumpkinPatchVine(basePos, pos.add(-1, 0, 0));
if (prng.nextBoolean()) }
setBlockIfAir(pos.add(-1, h, -1), new BaseBlock(18)); if (prng.nextBoolean()) {
setBlockIfAir(pos.add(-1, 0, -1), new BaseBlock(86)); setBlockIfAir(pos.add(-1, h, -1), log);
}
setBlockIfAir(pos.add(-1, 0, -1), pumpkin);
} }
} }
@ -2377,8 +2399,9 @@ public class EditSession {
for (int z = basePos.getBlockZ() - size; z <= basePos.getBlockZ() for (int z = basePos.getBlockZ() - size; z <= basePos.getBlockZ()
+ size; ++z) { + size; ++z) {
// Don't want to be in the ground // Don't want to be in the ground
if (!getBlock(new Vector(x, basePos.getBlockY(), z)).isAir()) if (!getBlock(new Vector(x, basePos.getBlockY(), z)).isAir()) {
continue; continue;
}
// The gods don't want a pumpkin patch here // The gods don't want a pumpkin patch here
if (Math.random() < 0.98) { if (Math.random() < 0.98) {
continue; continue;
@ -2387,11 +2410,11 @@ public class EditSession {
for (int y = basePos.getBlockY(); y >= basePos.getBlockY() - 10; --y) { for (int y = basePos.getBlockY(); y >= basePos.getBlockY() - 10; --y) {
// Check if we hit the ground // Check if we hit the ground
int t = getBlock(new Vector(x, y, z)).getType(); int t = getBlock(new Vector(x, y, z)).getType();
if (t == 2 || t == 3) { if (t == BlockID.GRASS || t == BlockID.DIRT) {
makePumpkinPatch(new Vector(x, y + 1, z)); makePumpkinPatch(new Vector(x, y + 1, z));
++affected; ++affected;
break; break;
} else if (t != 0) { // Trees won't grow on this! } else if (t != BlockID.AIR) { // Trees won't grow on this!
break; break;
} }
} }
@ -2420,8 +2443,9 @@ public class EditSession {
for (int z = basePos.getBlockZ() - size; z <= basePos.getBlockZ() for (int z = basePos.getBlockZ() - size; z <= basePos.getBlockZ()
+ size; ++z) { + size; ++z) {
// Don't want to be in the ground // Don't want to be in the ground
if (!getBlock(new Vector(x, basePos.getBlockY(), z)).isAir()) if (!getBlock(new Vector(x, basePos.getBlockY(), z)).isAir()) {
continue; continue;
}
// The gods don't want a tree here // The gods don't want a tree here
if (Math.random() >= density) { if (Math.random() >= density) {
continue; continue;
@ -2430,11 +2454,11 @@ public class EditSession {
for (int y = basePos.getBlockY(); y >= basePos.getBlockY() - 10; --y) { for (int y = basePos.getBlockY(); y >= basePos.getBlockY() - 10; --y) {
// Check if we hit the ground // Check if we hit the ground
int t = getBlock(new Vector(x, y, z)).getType(); int t = getBlock(new Vector(x, y, z)).getType();
if (t == 2 || t == 3) { if (t == BlockID.GRASS || t == BlockID.DIRT) {
treeGenerator.generate(this, new Vector(x, y + 1, z)); treeGenerator.generate(this, new Vector(x, y + 1, z));
++affected; ++affected;
break; break;
} else if (t != 0) { // Trees won't grow on this! } else if (t != BlockID.AIR) { // Trees won't grow on this!
break; break;
} }
} }
@ -2551,10 +2575,22 @@ public class EditSession {
* *
* @param x * @param x
* @param z * @param z
* @param minY * @param minY minimal height
* minimal height * @param maxY maximal height
* @param maxY * @param naturalOnly look at natural blocks or all blocks
* maximal height * @return height of highest block found or 'minY'
*/
public int getHighestTerrainBlock(int x, int z, int minY, int maxY) {
return getHighestTerrainBlock(x, z, minY, maxY, false);
}
/**
* Returns the highest solid 'terrain' block which can occur naturally.
*
* @param x
* @param z
* @param minY minimal height
* @param maxY maximal height
* @param naturalOnly look at natural blocks or all blocks * @param naturalOnly look at natural blocks or all blocks
* @return height of highest block found or 'minY' * @return height of highest block found or 'minY'
*/ */

View File

@ -19,6 +19,7 @@ package com.sk89q.worldedit;
*/ */
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.filtering.HeightMapFilter; import com.sk89q.worldedit.filtering.HeightMapFilter;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
@ -43,7 +44,17 @@ public class HeightMap {
* @param session * @param session
* @param region * @param region
*/ */
public HeightMap(EditSession session, Region region) {
this(session, region, false);
}
/**
* Constructs the HeightMap
*
* @param session
* @param region
* @param naturalOnly ignore non-natural blocks
*/
public HeightMap(EditSession session, Region region, boolean naturalOnly) { public HeightMap(EditSession session, Region region, boolean naturalOnly) {
this.session = session; this.session = session;
this.region = region; this.region = region;
@ -99,7 +110,7 @@ public class HeightMap {
int originZ = minY.getBlockZ(); int originZ = minY.getBlockZ();
int maxY = region.getMaximumPoint().getBlockY(); int maxY = region.getMaximumPoint().getBlockY();
BaseBlock fillerAir = new BaseBlock(0); BaseBlock fillerAir = new BaseBlock(BlockID.AIR);
int blocksChanged = 0; int blocksChanged = 0;
@ -125,7 +136,8 @@ public class HeightMap {
BaseBlock existing = session.getBlock(new Vector(X, curHeight, Z)); BaseBlock existing = session.getBlock(new Vector(X, curHeight, Z));
// Skip water/lava // Skip water/lava
if (existing.getType() < 8 || existing.getType() > 11) { if (existing.getType() != BlockID.WATER && existing.getType() != BlockID.STATIONARY_WATER
&& existing.getType() != BlockID.LAVA && existing.getType() != BlockID.STATIONARY_LAVA) {
session.setBlock(new Vector(X, newHeight, Z), existing); session.setBlock(new Vector(X, newHeight, Z), existing);
++blocksChanged; ++blocksChanged;

View File

@ -19,6 +19,8 @@
package com.sk89q.worldedit; package com.sk89q.worldedit;
import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.ItemType;
import com.sk89q.worldedit.snapshots.SnapshotRepository; import com.sk89q.worldedit.snapshots.SnapshotRepository;
import java.io.File; import java.io.File;
import java.util.HashSet; import java.util.HashSet;
@ -32,9 +34,48 @@ import java.util.Set;
*/ */
public abstract class LocalConfiguration { public abstract class LocalConfiguration {
protected static final int[] defaultDisallowedBlocks = new int[] { protected static final int[] defaultDisallowedBlocks = new int[] {
6, 7, 14, 15, 16, 21, 22, 23, 24, 25, 26, 27, 28, 29, 39, 31, // dangerous stuff (physics/drops items)
32, 33, 34, 36, 37, 38, 39, 40, 46, 50, 51, 56, 59, 69, 73, 74, BlockID.SAPLING,
75, 76, 77, 81, 83 BlockID.BED,
BlockID.POWERED_RAIL,
BlockID.DETECTOR_RAIL,
BlockID.LONG_GRASS,
BlockID.DEAD_BUSH,
BlockID.PISTON_EXTENSION,
BlockID.PISTON_MOVING_PIECE,
BlockID.YELLOW_FLOWER,
BlockID.RED_FLOWER,
BlockID.BROWN_MUSHROOM,
BlockID.RED_MUSHROOM,
BlockID.TNT,
BlockID.TORCH,
BlockID.FIRE,
BlockID.REDSTONE_WIRE,
BlockID.CROPS,
BlockID.MINECART_TRACKS,
BlockID.LEVER,
BlockID.REDSTONE_TORCH_OFF,
BlockID.REDSTONE_TORCH_ON,
BlockID.REDSTONE_REPEATER_OFF,
BlockID.REDSTONE_REPEATER_ON,
BlockID.STONE_BUTTON,
BlockID.CACTUS,
BlockID.REED,
// ores and stuff
BlockID.BEDROCK,
BlockID.GOLD_ORE,
BlockID.IRON_ORE,
BlockID.COAL_ORE,
BlockID.DIAMOND_ORE,
// @TODO rethink what should be disallowed by default
// Gold and iron can be legitimately obtained, but were set to disallowed by
// default. Diamond and coal can't be legitimately obtained. Sponges,
// portals, snow, and locked chests also can't, but are allowed. None of
// these blocks poses any immediate threat. Most of the blocks (in the first
// section) are disallowed because people will accidentally set a huge area
// of them, triggering physics and a million item drops, lagging the server.
// Doors also have this effect, but are not disallowed.
}; };
public boolean profile = false; public boolean profile = false;
@ -48,13 +89,13 @@ public abstract class LocalConfiguration {
public int maxBrushRadius = 6; public int maxBrushRadius = 6;
public boolean logCommands = false; public boolean logCommands = false;
public boolean registerHelp = true; public boolean registerHelp = true;
public int wandItem = 271; public int wandItem = ItemType.WOOD_AXE.getID();
public boolean superPickaxeDrop = true; public boolean superPickaxeDrop = true;
public boolean superPickaxeManyDrop = true; public boolean superPickaxeManyDrop = true;
public boolean noDoubleSlash = false; public boolean noDoubleSlash = false;
public boolean useInventory = false; public boolean useInventory = false;
public boolean useInventoryOverride = false; public boolean useInventoryOverride = false;
public int navigationWand = 345; public int navigationWand = ItemType.COMPASS.getID();
public int navigationWandMaxDistance = 50; public int navigationWandMaxDistance = 50;
public int scriptTimeout = 3000; public int scriptTimeout = 3000;
public Set<Integer> allowedDataCycleBlocks = new HashSet<Integer>(); public Set<Integer> allowedDataCycleBlocks = new HashSet<Integer>();

View File

@ -21,7 +21,9 @@ package com.sk89q.worldedit;
import java.io.File; import java.io.File;
import com.sk89q.worldedit.bags.BlockBag; import com.sk89q.worldedit.bags.BlockBag;
import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.BlockType; import com.sk89q.worldedit.blocks.BlockType;
import com.sk89q.worldedit.blocks.ItemType;
import com.sk89q.worldedit.cui.CUIEvent; import com.sk89q.worldedit.cui.CUIEvent;
import com.sk89q.worldedit.util.TargetBlock; import com.sk89q.worldedit.util.TargetBlock;
@ -51,8 +53,11 @@ public abstract class LocalPlayer {
*/ */
public boolean isHoldingPickAxe() { public boolean isHoldingPickAxe() {
int item = getItemInHand(); int item = getItemInHand();
return item == 257 || item == 270 || item == 274 || item == 278 return item == ItemType.IRON_PICK.getID()
|| item == 285; || item == ItemType.WOOD_PICKAXE.getID()
|| item == ItemType.STONE_PICKAXE.getID()
|| item == ItemType.DIAMOND_PICKAXE.getID()
|| item == ItemType.GOLD_PICKAXE.getID();
} }
/** /**
@ -150,7 +155,7 @@ public abstract class LocalPlayer {
int type = world.getBlockType(new Vector(x, y - 2, z)); int type = world.getBlockType(new Vector(x, y - 2, z));
// Don't get put in lava! // Don't get put in lava!
if (type == 10 || type == 11) { if (type == BlockID.LAVA || type == BlockID.STATIONARY_LAVA) {
return false; return false;
} }
@ -194,7 +199,7 @@ public abstract class LocalPlayer {
int type = world.getBlockType(new Vector(x, y, z)); int type = world.getBlockType(new Vector(x, y, z));
// Don't want to end up in lava // Don't want to end up in lava
if (type != 0 && type != 10 && type != 11) { if (type != BlockID.AIR && type != BlockID.LAVA && type != BlockID.STATIONARY_LAVA) {
// Found a block! // Found a block!
setPosition(new Vector(x + 0.5, y + 1, z + 0.5)); setPosition(new Vector(x + 0.5, y + 1, z + 0.5));
return true; return true;
@ -236,7 +241,7 @@ public abstract class LocalPlayer {
if (!BlockType.canPassThrough(world.getBlockType(new Vector(x, y, z)))) { if (!BlockType.canPassThrough(world.getBlockType(new Vector(x, y, z)))) {
int platformY = Math.max(initialY, y - 3 - clearance); int platformY = Math.max(initialY, y - 3 - clearance);
world.setBlockType(new Vector(x, platformY, z), world.setBlockType(new Vector(x, platformY, z),
BlockType.GLASS.getID()); BlockID.GLASS);
setPosition(new Vector(x + 0.5, platformY + 1, z + 0.5)); setPosition(new Vector(x + 0.5, platformY + 1, z + 0.5));
return true; return true;
} }
@ -269,7 +274,7 @@ public abstract class LocalPlayer {
break; break;
} else if (y == maxY + 1) { } else if (y == maxY + 1) {
world.setBlockType(new Vector(x, y - 2, z), world.setBlockType(new Vector(x, y - 2, z),
BlockType.GLASS.getID()); BlockID.GLASS);
setPosition(new Vector(x + 0.5, y - 1, z + 0.5)); setPosition(new Vector(x + 0.5, y - 1, z + 0.5));
return true; return true;
} }

View File

@ -34,6 +34,7 @@ import com.sk89q.worldedit.tools.SinglePickaxe;
import com.sk89q.worldedit.tools.BlockTool; import com.sk89q.worldedit.tools.BlockTool;
import com.sk89q.worldedit.tools.Tool; import com.sk89q.worldedit.tools.Tool;
import com.sk89q.worldedit.bags.BlockBag; import com.sk89q.worldedit.bags.BlockBag;
import com.sk89q.worldedit.blocks.ItemType;
import com.sk89q.worldedit.cui.CUIPointBasedRegion; import com.sk89q.worldedit.cui.CUIPointBasedRegion;
import com.sk89q.worldedit.cui.CUIEvent; import com.sk89q.worldedit.cui.CUIEvent;
import com.sk89q.worldedit.cui.SelectionPointEvent; import com.sk89q.worldedit.cui.SelectionPointEvent;
@ -480,8 +481,10 @@ public class LocalSession {
public void setTool(int item, Tool tool) throws InvalidToolBindException { public void setTool(int item, Tool tool) throws InvalidToolBindException {
if (item > 0 && item < 255) { if (item > 0 && item < 255) {
throw new InvalidToolBindException(item, "Blocks can't be used"); throw new InvalidToolBindException(item, "Blocks can't be used");
} else if (item == 263 || item == 348) { /* } else if (item == ItemType.COAL.getID() || item == ItemType.LIGHTSTONE_DUST.getID()) {
throw new InvalidToolBindException(item, "Item is not usuable"); throw new InvalidToolBindException(item, "Item is not usuable");
// let people deal with craftbook themselves, not everyone uses it
*/
} else if (item == config.wandItem) { } else if (item == config.wandItem) {
throw new InvalidToolBindException(item, "Already used for the wand"); throw new InvalidToolBindException(item, "Already used for the wand");
} else if (item == config.navigationWand) { } else if (item == config.navigationWand) {

View File

@ -22,6 +22,8 @@ package com.sk89q.worldedit;
import java.util.Random; import java.util.Random;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.ItemType;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
/** /**
@ -249,63 +251,65 @@ public abstract class LocalWorld {
int type = getBlockType(pt); int type = getBlockType(pt);
//setBlockType(pt, 0); //setBlockType(pt, 0);
if (type == 1) { dropItem(pt, new BaseItemStack(4)); } // Stone if (type == BlockID.STONE) { dropItem(pt, new BaseItemStack(BlockID.COBBLESTONE)); } // Stone
else if (type == 2) { dropItem(pt, new BaseItemStack(3)); } // Grass else if (type == BlockID.GRASS) { dropItem(pt, new BaseItemStack(BlockID.DIRT)); } // Grass
else if (type == 7) { } // Bedrock else if (type == BlockID.BEDROCK) { } // Bedrock
else if (type == 8) { } // Water else if (type == BlockID.WATER) { } // Water
else if (type == 9) { } // Water else if (type == BlockID.STATIONARY_WATER) { } // Water
else if (type == 10) { } // Lava else if (type == BlockID.LAVA) { } // Lava
else if (type == 11) { } // Lava else if (type == BlockID.STATIONARY_LAVA) { } // Lava
else if (type == 13) { // Gravel else if (type == BlockID.GRAVEL) { // Gravel
if (random.nextDouble() >= 0.9) { if (random.nextDouble() >= 0.9) {
dropItem(pt, new BaseItemStack(318)); dropItem(pt, new BaseItemStack(ItemType.FLINT.getID()));
} else { } else {
dropItem(pt, new BaseItemStack(type)); dropItem(pt, new BaseItemStack(type));
} }
} }
else if (type == 16) { dropItem(pt, new BaseItemStack(263)); } // Coal ore else if (type == BlockID.COAL_ORE) { dropItem(pt, new BaseItemStack(ItemType.COAL.getID())); } // Coal ore
else if (type == 17) { dropItem(pt, new BaseItemStack(17, 1, (short)getBlockData(pt))); } // Log else if (type == BlockID.LOG) { dropItem(pt, new BaseItemStack(type, 1, (short) getBlockData(pt))); } // Log
else if (type == 18) { // Leaves else if (type == BlockID.LEAVES) { // Leaves
if (random.nextDouble() > 0.95) { if (random.nextDouble() > 0.95) {
dropItem(pt, new BaseItemStack(6)); dropItem(pt, new BaseItemStack(BlockID.SAPLING, 1, (short) getBlockData(pt)));
} }
} }
else if (type == 20) { } // Glass else if (type == BlockID.GLASS) { } // Glass
else if (type == 21) { dropItem(pt, new BaseItemStack(351, 1, (short)4), (random.nextInt(5)+4)); } // Lapis Lazuli ore else if (type == BlockID.LAPIS_LAZULI_ORE) {
else if (type == 26) { dropItem(pt, new BaseItemStack(355)); } // Bed dropItem(pt, new BaseItemStack(ItemType.INK_SACK.getID(), 1, (short) 4), (random.nextInt(5) + 4));
else if (type == 31) { if(random.nextInt(8) == 0) dropItem(pt, new BaseItemStack(295)); } // Tall Grass } // Lapis Lazuli ore
else if (type == 34) { } // Piston Head else if (type == BlockID.BED) { dropItem(pt, new BaseItemStack(ItemType.BED_ITEM.getID())); } // Bed
else if (type == 35) { dropItem(pt, new BaseItemStack(35, 1, (short)getBlockData(pt))); } // Cloth else if (type == BlockID.LONG_GRASS) { if (random.nextInt(8) == 0) dropItem(pt, new BaseItemStack(ItemType.SEEDS.getID())); } // Tall Grass
else if (type == 43) { // Double step else if (type == BlockID.PISTON_EXTENSION) { } // Piston Head
dropItem(pt, new BaseItemStack(44, 1, (short)getBlockData(pt)), 2); else if (type == BlockID.CLOTH) { dropItem(pt, new BaseItemStack(type, 1, (short) getBlockData(pt))); } // Cloth
else if (type == BlockID.DOUBLE_STEP) { // Double step
dropItem(pt, new BaseItemStack(BlockID.STEP, 1, (short) getBlockData(pt)), 2);
} }
else if (type == 44) { dropItem(pt, new BaseItemStack(44, 1, (short)getBlockData(pt))); } // Step else if (type == BlockID.STEP) { dropItem(pt, new BaseItemStack(type, 1, (short) getBlockData(pt))); } // Step
else if (type == 47) { } // Bookshelves else if (type == BlockID.BOOKCASE) { } // Bookshelves
else if (type == 51) { } // Fire else if (type == BlockID.FIRE) { } // Fire
else if (type == 52) { } // Mob spawner else if (type == BlockID.MOB_SPAWNER) { } // Mob spawner
else if (type == 53) { dropItem(pt, new BaseItemStack(5)); } // Wooden stairs else if (type == BlockID.WOODEN_STAIRS) { dropItem(pt, new BaseItemStack(BlockID.WOOD)); } // Wooden stairs
else if (type == 55) { dropItem(pt, new BaseItemStack(331)); } // Redstone wire else if (type == BlockID.REDSTONE_WIRE) { dropItem(pt, new BaseItemStack(ItemType.REDSTONE_DUST.getID())); } // Redstone wire
else if (type == 56) { dropItem(pt, new BaseItemStack(264)); } // Diamond ore else if (type == BlockID.DIAMOND_ORE) { dropItem(pt, new BaseItemStack(ItemType.DIAMOND.getID())); } // Diamond ore
else if (type == 59) { dropItem(pt, new BaseItemStack(295)); } // Crops else if (type == BlockID.CROPS) { dropItem(pt, new BaseItemStack(ItemType.SEEDS.getID())); } // Crops
else if (type == 60) { dropItem(pt, new BaseItemStack(3)); } // Soil else if (type == BlockID.SOIL) { dropItem(pt, new BaseItemStack(BlockID.DIRT)); } // Soil
else if (type == 62) { dropItem(pt, new BaseItemStack(61)); } // Furnace else if (type == BlockID.BURNING_FURNACE) { dropItem(pt, new BaseItemStack(BlockID.FURNACE)); } // Furnace
else if (type == 63) { dropItem(pt, new BaseItemStack(323)); } // Sign post else if (type == BlockID.SIGN_POST) { dropItem(pt, new BaseItemStack(ItemType.SIGN.getID())); } // Sign post
else if (type == 64) { dropItem(pt, new BaseItemStack(324)); } // Wood door else if (type == BlockID.WOODEN_DOOR) { dropItem(pt, new BaseItemStack(ItemType.WOODEN_DOOR_ITEM.getID())); } // Wood door
else if (type == 67) { dropItem(pt, new BaseItemStack(4)); } // Cobblestone stairs else if (type == BlockID.COBBLESTONE_STAIRS) { dropItem(pt, new BaseItemStack(BlockID.COBBLESTONE)); } // Cobblestone stairs
else if (type == 68) { dropItem(pt, new BaseItemStack(323)); } // Wall sign else if (type == BlockID.WALL_SIGN) { dropItem(pt, new BaseItemStack(ItemType.SIGN.getID())); } // Wall sign
else if (type == 71) { dropItem(pt, new BaseItemStack(330)); } // Iron door else if (type == BlockID.IRON_DOOR) { dropItem(pt, new BaseItemStack(ItemType.IRON_DOOR_ITEM.getID())); } // Iron door
else if (type == 73) { dropItem(pt, new BaseItemStack(331), (random.nextInt(2)+4)); } // Redstone ore else if (type == BlockID.REDSTONE_ORE) { dropItem(pt, new BaseItemStack(ItemType.REDSTONE_DUST.getID()), (random.nextInt(2) + 4)); } // Redstone ore
else if (type == 74) { dropItem(pt, new BaseItemStack(331), (random.nextInt(2)+4)); } // Glowing redstone ore else if (type == BlockID.GLOWING_REDSTONE_ORE) { dropItem(pt, new BaseItemStack(ItemType.REDSTONE_DUST.getID()), (random.nextInt(2) + 4)); } // Glowing redstone ore
else if (type == 75) { dropItem(pt, new BaseItemStack(76)); } // Redstone torch else if (type == BlockID.REDSTONE_TORCH_OFF) { dropItem(pt, new BaseItemStack(BlockID.REDSTONE_TORCH_ON)); } // Redstone torch
else if (type == 78) { } // Snow else if (type == BlockID.SNOW) { } // Snow
else if (type == 79) { } // Ice else if (type == BlockID.ICE) { } // Ice
else if (type == 82) { dropItem(pt, new BaseItemStack(337), 4); } // Clay else if (type == BlockID.CLAY) { dropItem(pt, new BaseItemStack(ItemType.CLAY_BALL.getID()), 4); } // Clay
else if (type == 83) { dropItem(pt, new BaseItemStack(338)); } // Reed else if (type == BlockID.REED) { dropItem(pt, new BaseItemStack(ItemType.SUGAR_CANE_ITEM.getID())); } // Reed
else if (type == 89) { dropItem(pt, new BaseItemStack(348), (random.nextInt(3)+2)); } // Lightstone else if (type == BlockID.LIGHTSTONE) { dropItem(pt, new BaseItemStack(ItemType.LIGHTSTONE_DUST.getID()), (random.nextInt(3) + 2)); } // Lightstone
else if (type == 90) { } // Portal else if (type == BlockID.PORTAL) { } // Portal
else if (type == 93) { dropItem(pt, new BaseItemStack(356)); } // Repeater else if (type == BlockID.REDSTONE_REPEATER_OFF) { dropItem(pt, new BaseItemStack(ItemType.REDSTONE_REPEATER.getID())); } // Repeater
else if (type == 94) { dropItem(pt, new BaseItemStack(356)); } // Repeater else if (type == BlockID.REDSTONE_REPEATER_ON) { dropItem(pt, new BaseItemStack(ItemType.REDSTONE_REPEATER.getID())); } // Repeater
else if (type != 0) { else if (type != BlockID.AIR) {
dropItem(pt, new BaseItemStack(type)); dropItem(pt, new BaseItemStack(type));
} }
} }

View File

@ -288,7 +288,7 @@ public class WorldEdit {
ClothColor col = ClothColor.lookup(testID); ClothColor col = ClothColor.lookup(testID);
if (col != null) { if (col != null) {
blockType = BlockType.fromID(35); blockType = BlockType.CLOTH;
data = col.getID(); data = col.getID();
} else { } else {
throw new UnknownItemException(arg); throw new UnknownItemException(arg);

View File

@ -85,7 +85,7 @@ public abstract class BlockBag {
fetchBlock(BlockID.DIRT); fetchBlock(BlockID.DIRT);
// Look for redstone dust // Look for redstone dust
} else if (id == BlockID.REDSTONE_WIRE) { } else if (id == BlockID.REDSTONE_WIRE) {
fetchBlock(331); fetchBlock(ItemType.REDSTONE_DUST.getID());
// Look for furnace // Look for furnace
} else if (id == BlockID.BURNING_FURNACE) { } else if (id == BlockID.BURNING_FURNACE) {
fetchBlock(BlockID.FURNACE); fetchBlock(BlockID.FURNACE);
@ -94,7 +94,7 @@ public abstract class BlockBag {
fetchBlock(BlockID.REDSTONE_TORCH_ON); fetchBlock(BlockID.REDSTONE_TORCH_ON);
// Look for signs // Look for signs
} else if (id == BlockID.WALL_SIGN || id == BlockID.SIGN_POST) { } else if (id == BlockID.WALL_SIGN || id == BlockID.SIGN_POST) {
fetchBlock(323); fetchBlock(ItemType.SIGN.getID());
} else { } else {
throw e; throw e;
} }

View File

@ -108,12 +108,20 @@ public class BaseBlock {
data = (byte)BlockData.rotate90Reverse(type, data); data = (byte)BlockData.rotate90Reverse(type, data);
} }
/**
* Flip this block.
*/
public BaseBlock flip() {
data = (byte) BlockData.flip(type, data);
return this;
}
/** /**
* Flip this block. * Flip this block.
* @param direction * @param direction
*/ */
public void flip(FlipDirection direction) { public BaseBlock flip(FlipDirection direction) {
data = (byte)BlockData.flip(type, data, direction); data = (byte) BlockData.flip(type, data, direction);
return this;
} }
@Override @Override

View File

@ -31,103 +31,103 @@ import com.sk89q.util.StringUtil;
* @author sk89q * @author sk89q
*/ */
public enum BlockType { public enum BlockType {
AIR(0, "Air", "air"), AIR(BlockID.AIR, "Air", "air"),
STONE(1, "Stone", "stone", "rock"), STONE(BlockID.STONE, "Stone", "stone", "rock"),
GRASS(2, "Grass", "grass"), GRASS(BlockID.GRASS, "Grass", "grass"),
DIRT(3, "Dirt", "dirt"), DIRT(BlockID.DIRT, "Dirt", "dirt"),
COBBLESTONE(4, "Cobblestone", "cobblestone", "cobble"), COBBLESTONE(BlockID.COBBLESTONE, "Cobblestone", "cobblestone", "cobble"),
WOOD(5, "Wood", "wood", "woodplank", "plank", "woodplanks", "planks"), WOOD(BlockID.WOOD, "Wood", "wood", "woodplank", "plank", "woodplanks", "planks"),
SAPLING(6, "Sapling", "sapling", "seedling"), SAPLING(BlockID.SAPLING, "Sapling", "sapling", "seedling"),
BEDROCK(7, "Bedrock", "adminium", "bedrock"), BEDROCK(BlockID.BEDROCK, "Bedrock", "adminium", "bedrock"),
WATER(8, "Water", "watermoving", "movingwater", "flowingwater", "waterflowing"), WATER(BlockID.WATER, "Water", "watermoving", "movingwater", "flowingwater", "waterflowing"),
STATIONARY_WATER(9, "Water (stationary)", "water", "waterstationary", "stationarywater", "stillwater"), STATIONARY_WATER(BlockID.STATIONARY_WATER, "Water (stationary)", "water", "waterstationary", "stationarywater", "stillwater"),
LAVA(10, "Lava", "lavamoving", "movinglava", "flowinglava", "lavaflowing"), LAVA(BlockID.LAVA, "Lava", "lavamoving", "movinglava", "flowinglava", "lavaflowing"),
STATIONARY_LAVA(11, "Lava (stationary)", "lava", "lavastationary", "stationarylava", "stilllava"), STATIONARY_LAVA(BlockID.STATIONARY_LAVA, "Lava (stationary)", "lava", "lavastationary", "stationarylava", "stilllava"),
SAND(12, "Sand", "sand"), SAND(BlockID.SAND, "Sand", "sand"),
GRAVEL(13, "Gravel", "gravel"), GRAVEL(BlockID.GRAVEL, "Gravel", "gravel"),
GOLD_ORE(14, "Gold ore", "goldore"), GOLD_ORE(BlockID.GOLD_ORE, "Gold ore", "goldore"),
IRON_ORE(15, "Iron ore", "ironore"), IRON_ORE(BlockID.IRON_ORE, "Iron ore", "ironore"),
COAL_ORE(16, "Coal ore", "coalore"), COAL_ORE(BlockID.COAL_ORE, "Coal ore", "coalore"),
LOG(17, "Log", "log", "tree", "pine", "oak", "birch", "redwood"), LOG(BlockID.LOG, "Log", "log", "tree", "pine", "oak", "birch", "redwood"),
LEAVES(18, "Leaves", "leaves", "leaf"), LEAVES(BlockID.LEAVES, "Leaves", "leaves", "leaf"),
SPONGE(19, "Sponge", "sponge"), SPONGE(BlockID.SPONGE, "Sponge", "sponge"),
GLASS(20, "Glass", "glass"), GLASS(BlockID.GLASS, "Glass", "glass"),
LAPIS_LAZULI_ORE(21, "Lapis lazuli ore", "lapislazuliore", "blueore", "lapisore"), LAPIS_LAZULI_ORE(BlockID.LAPIS_LAZULI_ORE, "Lapis lazuli ore", "lapislazuliore", "blueore", "lapisore"),
LAPIS_LAZULI(22, "Lapis lazuli", "lapislazuli", "lapislazuliblock", "bluerock"), LAPIS_LAZULI(BlockID.LAPIS_LAZULI_BLOCK, "Lapis lazuli", "lapislazuli", "lapislazuliblock", "bluerock"),
DISPENSER(23, "Dispenser", "dispenser"), DISPENSER(BlockID.DISPENSER, "Dispenser", "dispenser"),
SANDSTONE(24, "Sandstone", "sandstone"), SANDSTONE(BlockID.SANDSTONE, "Sandstone", "sandstone"),
NOTE_BLOCK(25, "Note block", "musicblock", "noteblock", "note", "music", "instrument"), NOTE_BLOCK(BlockID.NOTE_BLOCK, "Note block", "musicblock", "noteblock", "note", "music", "instrument"),
BED(26, "Bed", "bed"), BED(BlockID.BED, "Bed", "bed"),
POWERED_RAIL(27, "Powered Rail", "poweredrail", "boosterrail", "poweredtrack", "boostertrack", "booster"), POWERED_RAIL(BlockID.POWERED_RAIL, "Powered Rail", "poweredrail", "boosterrail", "poweredtrack", "boostertrack", "booster"),
DETECTOR_RAIL(28, "Detector Rail", "detectorrail", "detector"), DETECTOR_RAIL(BlockID.DETECTOR_RAIL, "Detector Rail", "detectorrail", "detector"),
PISTON_STICKY_BASE(29, "Sticky Piston", "stickypiston"), PISTON_STICKY_BASE(BlockID.PISTON_STICKY_BASE, "Sticky Piston", "stickypiston"),
WEB(30, "Web", "web", "spiderweb"), WEB(BlockID.WEB, "Web", "web", "spiderweb"),
LONG_GRASS(31, "Long grass", "longgrass", "tallgrass"), LONG_GRASS(BlockID.LONG_GRASS, "Long grass", "longgrass", "tallgrass"),
DEAD_BUSH(32, "Shrub", "deadbush", "shrub", "deadshrub", "tumbleweed"), DEAD_BUSH(BlockID.DEAD_BUSH, "Shrub", "deadbush", "shrub", "deadshrub", "tumbleweed"),
PISTON_BASE(33, "Piston", "piston"), PISTON_BASE(BlockID.PISTON_BASE, "Piston", "piston"),
PISTON_EXTENSION(34, "Piston extension", "pistonextendsion", "pistonhead"), PISTON_EXTENSION(BlockID.PISTON_EXTENSION, "Piston extension", "pistonextendsion", "pistonhead"),
CLOTH(35, "Wool", "cloth", "wool"), CLOTH(BlockID.CLOTH, "Wool", "cloth", "wool"),
PISTON_MOVING_PIECE(36, "Piston moving piece", "movingpiston"), PISTON_MOVING_PIECE(BlockID.PISTON_MOVING_PIECE, "Piston moving piece", "movingpiston"),
YELLOW_FLOWER(37, "Yellow flower", "yellowflower", "flower"), YELLOW_FLOWER(BlockID.YELLOW_FLOWER, "Yellow flower", "yellowflower", "flower"),
RED_FLOWER(38, "Red rose", "redflower", "redrose", "rose"), RED_FLOWER(BlockID.RED_FLOWER, "Red rose", "redflower", "redrose", "rose"),
BROWN_MUSHROOM(39, "Brown mushroom", "brownmushroom", "mushroom"), BROWN_MUSHROOM(BlockID.BROWN_MUSHROOM, "Brown mushroom", "brownmushroom", "mushroom"),
RED_MUSHROOM(40, "Red mushroom", "redmushroom"), RED_MUSHROOM(BlockID.RED_MUSHROOM, "Red mushroom", "redmushroom"),
GOLD_BLOCK(41, "Gold block", "gold", "goldblock"), GOLD_BLOCK(BlockID.GOLD_BLOCK, "Gold block", "gold", "goldblock"),
IRON_BLOCK(42, "Iron block", "iron", "ironblock"), IRON_BLOCK(BlockID.IRON_BLOCK, "Iron block", "iron", "ironblock"),
DOUBLE_STEP(43, "Double step", "doubleslab", "doublestoneslab", "doublestep"), DOUBLE_STEP(BlockID.DOUBLE_STEP, "Double step", "doubleslab", "doublestoneslab", "doublestep"),
STEP(44, "Step", "slab", "stoneslab", "step", "halfstep"), STEP(BlockID.STEP, "Step", "slab", "stoneslab", "step", "halfstep"),
BRICK(45, "Brick", "brick", "brickblock"), BRICK(BlockID.BRICK, "Brick", "brick", "brickblock"),
TNT(46, "TNT", "tnt", "c4", "explosive"), TNT(BlockID.TNT, "TNT", "tnt", "c4", "explosive"),
BOOKCASE(47, "Bookcase", "bookshelf", "bookshelves", "bookcase", "bookcases"), BOOKCASE(BlockID.BOOKCASE, "Bookcase", "bookshelf", "bookshelves", "bookcase", "bookcases"),
MOSSY_COBBLESTONE(48, "Cobblestone (mossy)", "mossycobblestone", "mossstone", "mossystone", "mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"), MOSSY_COBBLESTONE(BlockID.MOSSY_COBBLESTONE, "Cobblestone (mossy)", "mossycobblestone", "mossstone", "mossystone", "mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"),
OBSIDIAN(49, "Obsidian", "obsidian"), OBSIDIAN(BlockID.OBSIDIAN, "Obsidian", "obsidian"),
TORCH(50, "Torch", "torch", "light", "candle"), TORCH(BlockID.TORCH, "Torch", "torch", "light", "candle"),
FIRE(51, "Fire", "fire", "flame", "flames"), FIRE(BlockID.FIRE, "Fire", "fire", "flame", "flames"),
MOB_SPAWNER(52, "Mob spawner", "mobspawner", "spawner"), MOB_SPAWNER(BlockID.MOB_SPAWNER, "Mob spawner", "mobspawner", "spawner"),
WOODEN_STAIRS(53, "Wooden stairs", "woodstair", "woodstairs", "woodenstair", "woodenstairs"), WOODEN_STAIRS(BlockID.WOODEN_STAIRS, "Wooden stairs", "woodstair", "woodstairs", "woodenstair", "woodenstairs"),
CHEST(54, "Chest", "chest", "storage", "storagechest"), CHEST(BlockID.CHEST, "Chest", "chest", "storage", "storagechest"),
REDSTONE_WIRE(55, "Redstone wire", "redstone", "redstoneblock"), REDSTONE_WIRE(BlockID.REDSTONE_WIRE, "Redstone wire", "redstone", "redstoneblock"),
DIAMOND_ORE(56, "Diamond ore", "diamondore"), DIAMOND_ORE(BlockID.DIAMOND_ORE, "Diamond ore", "diamondore"),
DIAMOND_BLOCK(57, "Diamond block", "diamond", "diamondblock"), DIAMOND_BLOCK(BlockID.DIAMOND_BLOCK, "Diamond block", "diamond", "diamondblock"),
WORKBENCH(58, "Workbench", "workbench", "table", "craftingtable", "crafting"), WORKBENCH(BlockID.WORKBENCH, "Workbench", "workbench", "table", "craftingtable", "crafting"),
CROPS(59, "Crops", "crops", "crop", "plant", "plants"), CROPS(BlockID.CROPS, "Crops", "crops", "crop", "plant", "plants"),
SOIL(60, "Soil", "soil", "farmland"), SOIL(BlockID.SOIL, "Soil", "soil", "farmland"),
FURNACE(61, "Furnace", "furnace"), FURNACE(BlockID.FURNACE, "Furnace", "furnace"),
BURNING_FURNACE(62, "Furnace (burning)", "burningfurnace", "litfurnace"), BURNING_FURNACE(BlockID.BURNING_FURNACE, "Furnace (burning)", "burningfurnace", "litfurnace"),
SIGN_POST(63, "Sign post", "sign", "signpost"), SIGN_POST(BlockID.SIGN_POST, "Sign post", "sign", "signpost"),
WOODEN_DOOR(64, "Wooden door", "wooddoor", "woodendoor", "door"), WOODEN_DOOR(BlockID.WOODEN_DOOR, "Wooden door", "wooddoor", "woodendoor", "door"),
LADDER(65, "Ladder", "ladder"), LADDER(BlockID.LADDER, "Ladder", "ladder"),
MINECART_TRACKS(66, "Minecart tracks", "track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"), MINECART_TRACKS(BlockID.MINECART_TRACKS, "Minecart tracks", "track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"),
COBBLESTONE_STAIRS(67, "Cobblestone stairs", "cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"), COBBLESTONE_STAIRS(BlockID.COBBLESTONE_STAIRS, "Cobblestone stairs", "cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"),
WALL_SIGN(68, "Wall sign", "wallsign"), WALL_SIGN(BlockID.WALL_SIGN, "Wall sign", "wallsign"),
LEVER(69, "Lever", "lever", "switch", "stonelever", "stoneswitch"), LEVER(BlockID.LEVER, "Lever", "lever", "switch", "stonelever", "stoneswitch"),
STONE_PRESSURE_PLATE(70, "Stone pressure plate", "stonepressureplate", "stoneplate"), STONE_PRESSURE_PLATE(BlockID.STONE_PRESSURE_PLATE, "Stone pressure plate", "stonepressureplate", "stoneplate"),
IRON_DOOR(71, "Iron Door", "irondoor"), IRON_DOOR(BlockID.IRON_DOOR, "Iron Door", "irondoor"),
WOODEN_PRESSURE_PLATE(72, "Wooden pressure plate", "woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate", "plate", "pressureplate"), WOODEN_PRESSURE_PLATE(BlockID.WOODEN_PRESSURE_PLATE, "Wooden pressure plate", "woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate", "plate", "pressureplate"),
REDSTONE_ORE(73, "Redstone ore", "redstoneore"), REDSTONE_ORE(BlockID.REDSTONE_ORE, "Redstone ore", "redstoneore"),
GLOWING_REDSTONE_ORE(74, "Glowing redstone ore", "glowingredstoneore"), GLOWING_REDSTONE_ORE(BlockID.GLOWING_REDSTONE_ORE, "Glowing redstone ore", "glowingredstoneore"),
REDSTONE_TORCH_OFF(75, "Redstone torch (off)", "redstonetorchoff", "rstorchoff"), REDSTONE_TORCH_OFF(BlockID.REDSTONE_TORCH_OFF, "Redstone torch (off)", "redstonetorchoff", "rstorchoff"),
REDSTONE_TORCH_ON(76, "Redstone torch (on)", "redstonetorch", "redstonetorchon", "rstorchon", "redtorch"), REDSTONE_TORCH_ON(BlockID.REDSTONE_TORCH_ON, "Redstone torch (on)", "redstonetorch", "redstonetorchon", "rstorchon", "redtorch"),
STONE_BUTTON(77, "Stone Button", "stonebutton", "button"), STONE_BUTTON(BlockID.STONE_BUTTON, "Stone Button", "stonebutton", "button"),
SNOW(78, "Snow", "snow"), SNOW(BlockID.SNOW, "Snow", "snow"),
ICE(79, "Ice", "ice"), ICE(BlockID.ICE, "Ice", "ice"),
SNOW_BLOCK(80, "Snow block", "snowblock"), SNOW_BLOCK(BlockID.SNOW_BLOCK, "Snow block", "snowblock"),
CACTUS(81, "Cactus", "cactus", "cacti"), CACTUS(BlockID.CACTUS, "Cactus", "cactus", "cacti"),
CLAY(82, "Clay", "clay"), CLAY(BlockID.CLAY, "Clay", "clay"),
SUGAR_CANE(83, "Reed", "reed", "cane", "sugarcane", "sugarcanes", "vine", "vines"), SUGAR_CANE(BlockID.REED, "Reed", "reed", "cane", "sugarcane", "sugarcanes", "vine", "vines"),
JUKEBOX(84, "Jukebox", "jukebox", "stereo", "recordplayer"), JUKEBOX(BlockID.JUKEBOX, "Jukebox", "jukebox", "stereo", "recordplayer"),
FENCE(85, "Fence", "fence"), FENCE(BlockID.FENCE, "Fence", "fence"),
PUMPKIN(86, "Pumpkin", "pumpkin"), PUMPKIN(BlockID.PUMPKIN, "Pumpkin", "pumpkin"),
NETHERRACK(87, "Netherrack", "redmossycobblestone", "redcobblestone", "redmosstone", "redcobble", "netherstone", "netherrack", "nether", "hellstone"), NETHERRACK(BlockID.NETHERRACK, "Netherrack", "redmossycobblestone", "redcobblestone", "redmosstone", "redcobble", "netherstone", "netherrack", "nether", "hellstone"),
SOUL_SAND(88, "Soul sand", "slowmud", "mud", "soulsand", "hellmud"), SOUL_SAND(BlockID.SLOW_SAND, "Soul sand", "slowmud", "mud", "soulsand", "hellmud"),
GLOWSTONE(89, "Glowstone", "brittlegold", "glowstone", "lightstone", "brimstone", "australium"), GLOWSTONE(BlockID.LIGHTSTONE, "Glowstone", "brittlegold", "glowstone", "lightstone", "brimstone", "australium"),
PORTAL(90, "Portal", "portal"), PORTAL(BlockID.PORTAL, "Portal", "portal"),
JACK_O_LANTERN(91, "Pumpkin (on)", "pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"), JACK_O_LANTERN(BlockID.JACKOLANTERN, "Pumpkin (on)", "pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"),
CAKE(92, "Cake", "cake", "cakeblock"), CAKE(BlockID.CAKE_BLOCK, "Cake", "cake", "cakeblock"),
REDSTONE_REPEATER_OFF(93, "Redstone repeater (off)", "diodeoff", "redstonerepeater", "repeater", "delayer"), REDSTONE_REPEATER_OFF(BlockID.REDSTONE_REPEATER_OFF, "Redstone repeater (off)", "diodeoff", "redstonerepeater", "repeateroff", "delayeroff"),
REDSTONE_REPEATER_ON(94, "Redstone repeater (on)", "diode", "diodeon", "redstonerepeateron", "repeateron", "delayeron"), REDSTONE_REPEATER_ON(BlockID.REDSTONE_REPEATER_ON, "Redstone repeater (on)", "diodeon", "redstonerepeateron", "repeateron", "delayeron"),
LOCKED_CHEST(95, "Locked chest", "lockedchest", "steveco", "supplycrate", "valveneedstoworkonep3nottf2kthx"), LOCKED_CHEST(BlockID.LOCKED_CHEST, "Locked chest", "lockedchest", "steveco", "supplycrate", "valveneedstoworkonep3nottf2kthx"),
TRAP_DOOR(96, "Trap door", "trapdoor", "hatch", "floordoor"); TRAP_DOOR(BlockID.TRAP_DOOR, "Trap door", "trapdoor", "hatch", "floordoor");
/** /**
* Stores a list of dropped blocks for blocks. * Stores a list of dropped blocks for blocks.
@ -362,40 +362,40 @@ public enum BlockType {
* @return * @return
*/ */
public static boolean shouldPlaceLast(int id) { public static boolean shouldPlaceLast(int id) {
return id == 6 // Saplings return id == BlockID.SAPLING
|| id == 26 // Beds || id == BlockID.BED
|| id == 27 // Powered rails || id == BlockID.POWERED_RAIL
|| id == 28 // Detector rails || id == BlockID.DETECTOR_RAIL
|| id == 31 // Long grass || id == BlockID.LONG_GRASS
|| id == 32 // Shrub || id == BlockID.DEAD_BUSH
|| id == 37 // Yellow flower || id == BlockID.YELLOW_FLOWER
|| id == 38 // Red flower || id == BlockID.RED_FLOWER
|| id == 39 // Brown mushroom || id == BlockID.BROWN_MUSHROOM
|| id == 40 // Red mush room || id == BlockID.RED_MUSHROOM
|| id == 50 // Torch || id == BlockID.TORCH
|| id == 51 // Fire || id == BlockID.FIRE
|| id == 55 // Redstone wire || id == BlockID.REDSTONE_WIRE
|| id == 59 // Crops || id == BlockID.CROPS
|| id == 63 // Sign post || id == BlockID.SIGN_POST
|| id == 64 // Wooden door || id == BlockID.WOODEN_DOOR
|| id == 65 // Ladder || id == BlockID.LADDER
|| id == 66 // Minecart tracks || id == BlockID.MINECART_TRACKS
|| id == 68 // Wall sign || id == BlockID.WALL_SIGN
|| id == 69 // Lever || id == BlockID.LEVER
|| id == 70 // Stone pressure plate || id == BlockID.STONE_PRESSURE_PLATE
|| id == 71 // Iron door || id == BlockID.IRON_DOOR
|| id == 72 // Wooden pressure plate || id == BlockID.WOODEN_PRESSURE_PLATE
|| id == 75 // Redstone torch (off) || id == BlockID.REDSTONE_TORCH_OFF
|| id == 76 // Redstone torch (on) || id == BlockID.REDSTONE_TORCH_ON
|| id == 77 // Stone button || id == BlockID.STONE_BUTTON
|| id == 78 // Snow || id == BlockID.SNOW
|| id == 81 // Cactus || id == BlockID.CACTUS
|| id == 83 // Reed || id == BlockID.REED
|| id == 90 // Portal || id == BlockID.PORTAL
|| id == 92 // Cake || id == BlockID.CAKE_BLOCK
|| id == 93 // Repeater (off) || id == BlockID.REDSTONE_REPEATER_OFF
|| id == 94 // Repeater (on) || id == BlockID.REDSTONE_REPEATER_ON
|| id == 96; // Trap door || id == BlockID.TRAP_DOOR;
} }
/** /**
@ -405,38 +405,38 @@ public enum BlockType {
* @return * @return
*/ */
public static boolean canPassThrough(int id) { public static boolean canPassThrough(int id) {
return id == 0 // Air return id == BlockID.AIR
|| id == 8 // Water || id == BlockID.WATER
|| id == 9 // Water || id == BlockID.STATIONARY_WATER
|| id == 6 // Saplings || id == BlockID.SAPLING
|| id == 27 // Powered rails || id == BlockID.POWERED_RAIL
|| id == 28 // Detector rails || id == BlockID.DETECTOR_RAIL
|| id == 30 // Web <- someone will hate me for this || id == BlockID.WEB
|| id == 31 // Long grass || id == BlockID.LONG_GRASS
|| id == 32 // Shrub || id == BlockID.DEAD_BUSH
|| id == 37 // Yellow flower || id == BlockID.YELLOW_FLOWER
|| id == 38 // Red flower || id == BlockID.RED_FLOWER
|| id == 39 // Brown mushroom || id == BlockID.BROWN_MUSHROOM
|| id == 40 // Red mush room || id == BlockID.RED_MUSHROOM
|| id == 50 // Torch || id == BlockID.TORCH
|| id == 51 // Fire || id == BlockID.FIRE
|| id == 55 // Redstone wire || id == BlockID.REDSTONE_WIRE
|| id == 59 // Crops || id == BlockID.CROPS
|| id == 63 // Sign post || id == BlockID.SIGN_POST
|| id == 65 // Ladder || id == BlockID.LADDER
|| id == 66 // Minecart tracks || id == BlockID.MINECART_TRACKS
|| id == 68 // Wall sign || id == BlockID.WALL_SIGN
|| id == 69 // Lever || id == BlockID.LEVER
|| id == 70 // Stone pressure plate || id == BlockID.STONE_PRESSURE_PLATE
|| id == 72 // Wooden pressure plate || id == BlockID.WOODEN_PRESSURE_PLATE
|| id == 75 // Redstone torch (off) || id == BlockID.REDSTONE_TORCH_OFF
|| id == 76 // Redstone torch (on) || id == BlockID.REDSTONE_TORCH_ON
|| id == 77 // Stone button || id == BlockID.STONE_BUTTON
|| id == 78 // Snow || id == BlockID.SNOW
|| id == 83 // Reed || id == BlockID.REED
|| id == 90 // Portal || id == BlockID.PORTAL
|| id == 93 // Diode (off) || id == BlockID.REDSTONE_REPEATER_OFF
|| id == 94; // Diode (on) || id == BlockID.REDSTONE_REPEATER_ON;
} }
/** /**
@ -446,53 +446,53 @@ public enum BlockType {
* @return * @return
*/ */
public static boolean usesData(int id) { public static boolean usesData(int id) {
return id == 6 // Saplings return id == BlockID.SAPLING
|| id == 8 // Water || id == BlockID.WATER
|| id == 9 // Water || id == BlockID.STATIONARY_WATER
|| id == 10 // Lava || id == BlockID.LAVA
|| id == 11 // Lava || id == BlockID.STATIONARY_LAVA
|| id == 17 // Wood || id == BlockID.LOG
|| id == 18 // Leaves || id == BlockID.LEAVES
|| id == 23 // Dispenser || id == BlockID.DISPENSER
|| id == 25 // Note Block || id == BlockID.NOTE_BLOCK
|| id == 26 // Bed || id == BlockID.BED
|| id == 27 // Powered rails || id == BlockID.POWERED_RAIL
|| id == 28 // Detector rails || id == BlockID.DETECTOR_RAIL
|| id == 29 // Sticky piston || id == BlockID.PISTON_STICKY_BASE
|| id == 31 // Tall grass || id == BlockID.LONG_GRASS
|| id == 33 // Piston || id == BlockID.PISTON_BASE
|| id == 34 // Piston extension || id == BlockID.PISTON_EXTENSION
|| id == 35 // Wool || id == BlockID.CLOTH
|| id == 43 // Double slab || id == BlockID.DOUBLE_STEP
|| id == 44 // Slab || id == BlockID.STEP
|| id == 50 // Torch || id == BlockID.TORCH
|| id == 53 // Wooden stairs || id == BlockID.WOODEN_STAIRS
|| id == 55 // Redstone wire || id == BlockID.REDSTONE_WIRE
|| id == 59 // Crops || id == BlockID.CROPS
|| id == 60 // Soil || id == BlockID.SOIL
|| id == 61 // Furnace || id == BlockID.FURNACE
|| id == 62 // Furnace || id == BlockID.BURNING_FURNACE
|| id == 63 // Sign post || id == BlockID.SIGN_POST
|| id == 64 // Wooden door || id == BlockID.WOODEN_DOOR
|| id == 65 // Ladder || id == BlockID.LADDER
|| id == 66 // Minecart track || id == BlockID.MINECART_TRACKS
|| id == 67 // Cobblestone stairs || id == BlockID.COBBLESTONE_STAIRS
|| id == 68 // Wall sign || id == BlockID.WALL_SIGN
|| id == 69 // Lever || id == BlockID.LEVER
|| id == 70 // Stone pressure plate || id == BlockID.STONE_PRESSURE_PLATE
|| id == 71 // Iron door || id == BlockID.IRON_DOOR
|| id == 72 // Wooden pressure plate || id == BlockID.WOODEN_PRESSURE_PLATE
|| id == 75 // Redstone torch (off) || id == BlockID.REDSTONE_TORCH_OFF
|| id == 76 // Redstone torch (on) || id == BlockID.REDSTONE_TORCH_ON
|| id == 77 // Stone button || id == BlockID.STONE_BUTTON
|| id == 78 // Snow tile || id == BlockID.SNOW
|| id == 81 // Cactus || id == BlockID.CACTUS
|| id == 86 // Pumpkin || id == BlockID.PUMPKIN
|| id == 91 // Jack-o-lantern || id == BlockID.JACKOLANTERN
|| id == 92 // Cake || id == BlockID.CAKE_BLOCK
|| id == 93 // Redstone repeater (off) || id == BlockID.REDSTONE_REPEATER_OFF
|| id == 94 // Redstone repeater (on) || id == BlockID.REDSTONE_REPEATER_ON
|| id == 96; // Trap door || id == BlockID.TRAP_DOOR;
} }
/** /**
@ -502,10 +502,10 @@ public enum BlockType {
* @return * @return
*/ */
public static boolean isContainerBlock(int id) { public static boolean isContainerBlock(int id) {
return id == 23 // Dispenser return id == BlockID.DISPENSER
|| id == 61 // Furnace || id == BlockID.FURNACE
|| id == 62 // Furnace || id == BlockID.BURNING_FURNACE
|| id == 54; // Chest || id == BlockID.CHEST;
} }
/** /**
@ -515,24 +515,24 @@ public enum BlockType {
* @return * @return
*/ */
public static boolean isRedstoneBlock(int id) { public static boolean isRedstoneBlock(int id) {
return id == 27 // Powered rail return id == BlockID.POWERED_RAIL
|| id == 28 // Detector rail || id == BlockID.DETECTOR_RAIL
|| id == 29 // Sticky piston || id == BlockID.PISTON_STICKY_BASE
|| id == 33 // Piston || id == BlockID.PISTON_BASE
|| id == 69 // Lever || id == BlockID.LEVER
|| id == 70 // Stone pressure plate || id == BlockID.STONE_PRESSURE_PLATE
|| id == 72 // Wood pressure plate || id == BlockID.WOODEN_PRESSURE_PLATE
|| id == 76 // Redstone torch || id == BlockID.REDSTONE_TORCH_OFF
|| id == 75 // Redstone torch || id == BlockID.REDSTONE_TORCH_ON
|| id == 77 // Stone button || id == BlockID.STONE_BUTTON
|| id == 55 // Redstone wire || id == BlockID.REDSTONE_WIRE
|| id == 64 // Wooden door || id == BlockID.WOODEN_DOOR
|| id == 71 // Iron door || id == BlockID.IRON_DOOR
|| id == 46 // TNT || id == BlockID.TNT
|| id == 23 // Dispenser || id == BlockID.DISPENSER
|| id == 25 // Note block || id == BlockID.NOTE_BLOCK
|| id == 93 // Diode (off) || id == BlockID.REDSTONE_REPEATER_OFF
|| id == 94; // Diode (on) || id == BlockID.REDSTONE_REPEATER_ON;
} }
/** /**
@ -543,12 +543,11 @@ public enum BlockType {
* @return * @return
*/ */
public static boolean canTransferRedstone(int id) { public static boolean canTransferRedstone(int id) {
return id == 27 // Powered rail return id == BlockID.REDSTONE_TORCH_OFF
|| id == 75 // Redstone torch (off) || id == BlockID.REDSTONE_TORCH_ON
|| id == 76 // Redstone torch (on) || id == BlockID.REDSTONE_WIRE
|| id == 55 // Redstone wire || id == BlockID.REDSTONE_REPEATER_OFF
|| id == 93 // Diode (off) || id == BlockID.REDSTONE_REPEATER_ON;
|| id == 94; // Diode (on)
} }
/** /**
@ -558,13 +557,13 @@ public enum BlockType {
* @return * @return
*/ */
public static boolean isRedstoneSource(int id) { public static boolean isRedstoneSource(int id) {
return id == 28 // Detector rail return id == BlockID.DETECTOR_RAIL
|| id == 75 // Redstone torch (off) || id == BlockID.REDSTONE_TORCH_OFF
|| id == 76 // Redstone torch (on) || id == BlockID.REDSTONE_TORCH_ON
|| id == 69 // Lever || id == BlockID.LEVER
|| id == 70 // Stone plate || id == BlockID.STONE_PRESSURE_PLATE
|| id == 72 // Wood plate || id == BlockID.WOODEN_PRESSURE_PLATE
|| id == 77; // Button || id == BlockID.STONE_BUTTON;
} }
/** /**
@ -574,9 +573,38 @@ public enum BlockType {
* @return * @return
*/ */
public static boolean isRailBlock(int id) { public static boolean isRailBlock(int id) {
return id == 27 // Powered rail return id == BlockID.POWERED_RAIL
|| id == 28 // Detector rail || id == BlockID.DETECTOR_RAIL
|| id == 66; // Normal rail || id == BlockID.MINECART_TRACKS;
}
/**
* Checks if the block type is naturally occuring
*
* @param id
* @return
*/
public static boolean isNaturalBlock(int id) {
return id == BlockID.STONE
|| id == BlockID.GRASS
|| id == BlockID.DIRT
// || id == BlockID.COBBLESTONE // technically can occur next to water and lava
|| id == BlockID.BEDROCK
|| id == BlockID.SAND
|| id == BlockID.GRAVEL
|| id == BlockID.CLAY
// hell
|| id == BlockID.NETHERSTONE
|| id == BlockID.SLOW_SAND
|| id == BlockID.LIGHTSTONE
// ores
|| id == BlockID.COAL_ORE
|| id == BlockID.IRON_ORE
|| id == BlockID.GOLD_ORE
|| id == BlockID.LAPIS_LAZULI_ORE
|| id == BlockID.DIAMOND_ORE
|| id == BlockID.REDSTONE_ORE
|| id == BlockID.GLOWING_REDSTONE_ORE;
} }
/** /**
@ -590,36 +618,9 @@ public enum BlockType {
public static int getDroppedBlock(int id) { public static int getDroppedBlock(int id) {
Integer dropped = blockDrops.get(id); Integer dropped = blockDrops.get(id);
if (dropped == null) { if (dropped == null) {
return 0; return BlockID.AIR;
} }
return dropped; return dropped;
} }
/**
* Checks if the block type is "natural"
*
* @param id
* @return
*/
public static boolean isNaturalBlock(int id) {
return id == 1 // stone
|| id == 2 // grass
|| id == 3 // dirt
|| id == 7 // bedrock
|| id == 12 // sand
|| id == 13 // gravel
|| id == 82 // clay
// hell
|| id == 87 // netherstone
|| id == 88 // slowsand
|| id == 89 // lightstone
// ores
|| id == 14 // coal ore
|| id == 15 // iron ore
|| id == 16 // gold ore
|| id == 21 // lapis ore
|| id == 56 // diamond ore
|| id == 73 // redstone ore
|| id == 74; // redstone ore (active)
}
} }

View File

@ -41,7 +41,7 @@ public class ChestBlock extends BaseBlock implements TileEntityBlock, ContainerB
* Construct the chest block. * Construct the chest block.
*/ */
public ChestBlock() { public ChestBlock() {
super(54); super(BlockID.CHEST);
items = new BaseItemStack[27]; items = new BaseItemStack[27];
} }
@ -51,7 +51,7 @@ public class ChestBlock extends BaseBlock implements TileEntityBlock, ContainerB
* @param data * @param data
*/ */
public ChestBlock(int data) { public ChestBlock(int data) {
super(54, data); super(BlockID.CHEST, data);
items = new BaseItemStack[27]; items = new BaseItemStack[27];
} }
@ -62,7 +62,7 @@ public class ChestBlock extends BaseBlock implements TileEntityBlock, ContainerB
* @param items * @param items
*/ */
public ChestBlock(int data, BaseItemStack[] items) { public ChestBlock(int data, BaseItemStack[] items) {
super(54, data); super(BlockID.CHEST, data);
this.items = items; this.items = items;
} }

View File

@ -38,31 +38,31 @@ public class DispenserBlock extends BaseBlock implements TileEntityBlock, Contai
private BaseItemStack[] items; private BaseItemStack[] items;
/** /**
* Construct the chest block. * Construct the dispenser block.
*/ */
public DispenserBlock() { public DispenserBlock() {
super(54); super(BlockID.DISPENSER);
items = new BaseItemStack[9]; items = new BaseItemStack[9];
} }
/** /**
* Construct the chest block. * Construct the dispenser block.
* *
* @param data * @param data
*/ */
public DispenserBlock(int data) { public DispenserBlock(int data) {
super(23, data); super(BlockID.DISPENSER, data);
items = new BaseItemStack[9]; items = new BaseItemStack[9];
} }
/** /**
* Construct the chest block. * Construct the dispenser block.
* *
* @param data * @param data
* @param items * @param items
*/ */
public DispenserBlock(int data, BaseItemStack[] items) { public DispenserBlock(int data, BaseItemStack[] items) {
super(23, data); super(BlockID.DISPENSER, data);
this.items = items; this.items = items;
} }
@ -155,7 +155,7 @@ public class DispenserBlock extends BaseBlock implements TileEntityBlock, Contai
byte slot = (Byte)((ByteTag)Chunk.getChildTag(itemValues, "Slot", ByteTag.class)) byte slot = (Byte)((ByteTag)Chunk.getChildTag(itemValues, "Slot", ByteTag.class))
.getValue(); .getValue();
if (slot >= 0 && slot <= 26) { if (slot >= 0 && slot <= 8) {
newItems[slot] = new BaseItemStack(id, count, damage); newItems[slot] = new BaseItemStack(id, count, damage);
} }
} }

View File

@ -33,103 +33,103 @@ import com.sk89q.util.StringUtil;
*/ */
public enum ItemType { public enum ItemType {
// Blocks // Blocks
AIR(0, "Air", "air"), AIR(BlockID.AIR, "Air", "air"),
STONE(1, "Stone", "stone", "rock"), STONE(BlockID.STONE, "Stone", "stone", "rock"),
GRASS(2, "Grass", "grass"), GRASS(BlockID.GRASS, "Grass", "grass"),
DIRT(3, "Dirt", "dirt"), DIRT(BlockID.DIRT, "Dirt", "dirt"),
COBBLESTONE(4, "Cobblestone", "cobblestone", "cobble"), COBBLESTONE(BlockID.COBBLESTONE, "Cobblestone", "cobblestone", "cobble"),
WOOD(5, "Wood", "wood", "woodplank", "plank", "woodplanks", "planks"), WOOD(BlockID.WOOD, "Wood", "wood", "woodplank", "plank", "woodplanks", "planks"),
SAPLING(6, "Sapling", "sapling", "seedling"), SAPLING(BlockID.SAPLING, "Sapling", "sapling", "seedling"),
BEDROCK(7, "Bedrock", "adminium", "bedrock"), BEDROCK(BlockID.BEDROCK, "Bedrock", "adminium", "bedrock"),
WATER(8, "Water", "watermoving", "movingwater", "flowingwater", "waterflowing"), WATER(BlockID.WATER, "Water", "watermoving", "movingwater", "flowingwater", "waterflowing"),
STATIONARY_WATER(9, "Water (stationary)", "water", "waterstationary", "stationarywater", "stillwater"), STATIONARY_WATER(BlockID.STATIONARY_WATER, "Water (stationary)", "water", "waterstationary", "stationarywater", "stillwater"),
LAVA(10, "Lava", "lavamoving", "movinglava", "flowinglava", "lavaflowing"), LAVA(BlockID.LAVA, "Lava", "lavamoving", "movinglava", "flowinglava", "lavaflowing"),
STATIONARY_LAVA(11, "Lava (stationary)", "lava", "lavastationary", "stationarylava", "stilllava"), STATIONARY_LAVA(BlockID.STATIONARY_LAVA, "Lava (stationary)", "lava", "lavastationary", "stationarylava", "stilllava"),
SAND(12, "Sand", "sand"), SAND(BlockID.SAND, "Sand", "sand"),
GRAVEL(13, "Gravel", "gravel"), GRAVEL(BlockID.GRAVEL, "Gravel", "gravel"),
GOLD_ORE(14, "Gold ore", "goldore"), GOLD_ORE(BlockID.GOLD_ORE, "Gold ore", "goldore"),
IRON_ORE(15, "Iron ore", "ironore"), IRON_ORE(BlockID.IRON_ORE, "Iron ore", "ironore"),
COAL_ORE(16, "Coal ore", "coalore"), COAL_ORE(BlockID.COAL_ORE, "Coal ore", "coalore"),
LOG(17, "Log", "log", "tree", "pine", "oak", "birch", "redwood"), LOG(BlockID.LOG, "Log", "log", "tree", "pine", "oak", "birch", "redwood"),
LEAVES(18, "Leaves", "leaves", "leaf"), LEAVES(BlockID.LEAVES, "Leaves", "leaves", "leaf"),
SPONGE(19, "Sponge", "sponge"), SPONGE(BlockID.SPONGE, "Sponge", "sponge"),
GLASS(20, "Glass", "glass"), GLASS(BlockID.GLASS, "Glass", "glass"),
LAPIS_LAZULI_ORE(21, "Lapis lazuli ore", "lapislazuliore", "blueore", "lapisore"), LAPIS_LAZULI_ORE(BlockID.LAPIS_LAZULI_ORE, "Lapis lazuli ore", "lapislazuliore", "blueore", "lapisore"),
LAPIS_LAZULI(22, "Lapis lazuli", "lapislazuli", "lapislazuliblock", "bluerock"), LAPIS_LAZULI(BlockID.LAPIS_LAZULI_BLOCK, "Lapis lazuli", "lapislazuli", "lapislazuliblock", "bluerock"),
DISPENSER(23, "Dispenser", "dispenser"), DISPENSER(BlockID.DISPENSER, "Dispenser", "dispenser"),
SANDSTONE(24, "Sandstone", "sandstone"), SANDSTONE(BlockID.SANDSTONE, "Sandstone", "sandstone"),
NOTE_BLOCK(25, "Note block", "musicblock", "noteblock", "note", "music", "instrument"), NOTE_BLOCK(BlockID.NOTE_BLOCK, "Note block", "musicblock", "noteblock", "note", "music", "instrument"),
BED(26, "Bed", "bed"), BED(BlockID.BED, "Bed", "bed"),
POWERED_RAIL(27, "Powered Rail", "poweredrail", "boosterrail", "poweredtrack", "boostertrack", "booster"), POWERED_RAIL(BlockID.POWERED_RAIL, "Powered Rail", "poweredrail", "boosterrail", "poweredtrack", "boostertrack", "booster"),
DETECTOR_RAIL(28, "Detector Rail", "detectorrail", "detector"), DETECTOR_RAIL(BlockID.DETECTOR_RAIL, "Detector Rail", "detectorrail", "detector"),
PISTON_STICKY_BASE(29, "Sticky Piston", "stickypiston"), PISTON_STICKY_BASE(BlockID.PISTON_STICKY_BASE, "Sticky Piston", "stickypiston"),
WEB(30, "Web", "web", "spiderweb"), WEB(BlockID.WEB, "Web", "web", "spiderweb"),
LONG_GRASS(31, "Long grass", "longgrass", "tallgrass"), LONG_GRASS(BlockID.LONG_GRASS, "Long grass", "longgrass", "tallgrass"),
DEAD_BUSH(32, "Shrub", "deadbush", "shrub", "deadshrub", "tumbleweed"), DEAD_BUSH(BlockID.DEAD_BUSH, "Shrub", "deadbush", "shrub", "deadshrub", "tumbleweed"),
PISTON_BASE(33, "Piston", "piston"), PISTON_BASE(BlockID.PISTON_BASE, "Piston", "piston"),
PISTON_EXTENSION(34, "Piston extension", "pistonhead"), PISTON_EXTENSION(BlockID.PISTON_EXTENSION, "Piston extension", "pistonextendsion", "pistonhead"),
CLOTH(35, "Wool", "cloth", "wool"), CLOTH(BlockID.CLOTH, "Wool", "cloth", "wool"),
PISTON_MOVING_PIECE(36, "Piston moving piece", "movingpiston"), PISTON_MOVING_PIECE(BlockID.PISTON_MOVING_PIECE, "Piston moving piece", "movingpiston"),
YELLOW_FLOWER(37, "Yellow flower", "yellowflower", "flower"), YELLOW_FLOWER(BlockID.YELLOW_FLOWER, "Yellow flower", "yellowflower", "flower"),
RED_FLOWER(38, "Red rose", "redflower", "redrose", "rose"), RED_FLOWER(BlockID.RED_FLOWER, "Red rose", "redflower", "redrose", "rose"),
BROWN_MUSHROOM(39, "Brown mushroom", "brownmushroom", "mushroom"), BROWN_MUSHROOM(BlockID.BROWN_MUSHROOM, "Brown mushroom", "brownmushroom", "mushroom"),
RED_MUSHROOM(40, "Red mushroom", "redmushroom"), RED_MUSHROOM(BlockID.RED_MUSHROOM, "Red mushroom", "redmushroom"),
GOLD_BLOCK(41, "Gold block", "gold", "goldblock"), GOLD_BLOCK(BlockID.GOLD_BLOCK, "Gold block", "gold", "goldblock"),
IRON_BLOCK(42, "Iron block", "iron", "ironblock"), IRON_BLOCK(BlockID.IRON_BLOCK, "Iron block", "iron", "ironblock"),
DOUBLE_STEP(43, "Double step", "doubleslab", "doublestoneslab", "doublestep"), DOUBLE_STEP(BlockID.DOUBLE_STEP, "Double step", "doubleslab", "doublestoneslab", "doublestep"),
STEP(44, "Step", "slab", "stoneslab", "step", "halfstep"), STEP(BlockID.STEP, "Step", "slab", "stoneslab", "step", "halfstep"),
BRICK(45, "Brick", "brick", "brickblock"), BRICK(BlockID.BRICK, "Brick", "brick", "brickblock"),
TNT(46, "TNT", "tnt", "c4", "explosive"), TNT(BlockID.TNT, "TNT", "tnt", "c4", "explosive"),
BOOKCASE(47, "Bookcase", "bookshelf", "bookshelves", "bookcase", "bookcases"), BOOKCASE(BlockID.BOOKCASE, "Bookcase", "bookshelf", "bookshelves", "bookcase", "bookcases"),
MOSSY_COBBLESTONE(48, "Cobblestone (mossy)", "mossycobblestone", "mossstone", "mossystone", "mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"), MOSSY_COBBLESTONE(BlockID.MOSSY_COBBLESTONE, "Cobblestone (mossy)", "mossycobblestone", "mossstone", "mossystone", "mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"),
OBSIDIAN(49, "Obsidian", "obsidian"), OBSIDIAN(BlockID.OBSIDIAN, "Obsidian", "obsidian"),
TORCH(50, "Torch", "torch", "light", "candle"), TORCH(BlockID.TORCH, "Torch", "torch", "light", "candle"),
FIRE(51, "Fire", "fire", "flame", "flames"), FIRE(BlockID.FIRE, "Fire", "fire", "flame", "flames"),
MOB_SPAWNER(52, "Mob spawner", "mobspawner", "spawner"), MOB_SPAWNER(BlockID.MOB_SPAWNER, "Mob spawner", "mobspawner", "spawner"),
WOODEN_STAIRS(53, "Wooden stairs", "woodstair", "woodstairs", "woodenstair", "woodenstairs"), WOODEN_STAIRS(BlockID.WOODEN_STAIRS, "Wooden stairs", "woodstair", "woodstairs", "woodenstair", "woodenstairs"),
CHEST(54, "Chest", "chest", "storage", "storagechest"), CHEST(BlockID.CHEST, "Chest", "chest", "storage", "storagechest"),
REDSTONE_WIRE(55, "Redstone wire", "redstone", "redstoneblock"), REDSTONE_WIRE(BlockID.REDSTONE_WIRE, "Redstone wire", "redstone", "redstoneblock"),
DIAMOND_ORE(56, "Diamond ore", "diamondore"), DIAMOND_ORE(BlockID.DIAMOND_ORE, "Diamond ore", "diamondore"),
DIAMOND_BLOCK(57, "Diamond block", "diamond", "diamondblock"), DIAMOND_BLOCK(BlockID.DIAMOND_BLOCK, "Diamond block", "diamond", "diamondblock"),
WORKBENCH(58, "Workbench", "workbench", "table", "craftingtable", "crafting"), WORKBENCH(BlockID.WORKBENCH, "Workbench", "workbench", "table", "craftingtable", "crafting"),
CROPS(59, "Crops", "crops", "crop", "plant", "plants"), CROPS(BlockID.CROPS, "Crops", "crops", "crop", "plant", "plants"),
SOIL(60, "Soil", "soil", "farmland"), SOIL(BlockID.SOIL, "Soil", "soil", "farmland"),
FURNACE(61, "Furnace", "furnace"), FURNACE(BlockID.FURNACE, "Furnace", "furnace"),
BURNING_FURNACE(62, "Furnace (burning)", "burningfurnace", "litfurnace"), BURNING_FURNACE(BlockID.BURNING_FURNACE, "Furnace (burning)", "burningfurnace", "litfurnace"),
SIGN_POST(63, "Sign post", "sign", "signpost"), SIGN_POST(BlockID.SIGN_POST, "Sign post", "sign", "signpost"),
WOODEN_DOOR(64, "Wooden door", "wooddoor", "woodendoor", "door"), WOODEN_DOOR(BlockID.WOODEN_DOOR, "Wooden door", "wooddoor", "woodendoor", "door"),
LADDER(65, "Ladder", "ladder"), LADDER(BlockID.LADDER, "Ladder", "ladder"),
MINECART_TRACKS(66, "Minecart tracks", "track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"), MINECART_TRACKS(BlockID.MINECART_TRACKS, "Minecart tracks", "track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"),
COBBLESTONE_STAIRS(67, "Cobblestone stairs", "cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"), COBBLESTONE_STAIRS(BlockID.COBBLESTONE_STAIRS, "Cobblestone stairs", "cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"),
WALL_SIGN(68, "Wall sign", "wallsign"), WALL_SIGN(BlockID.WALL_SIGN, "Wall sign", "wallsign"),
LEVER(69, "Lever", "lever", "switch", "stonelever", "stoneswitch"), LEVER(BlockID.LEVER, "Lever", "lever", "switch", "stonelever", "stoneswitch"),
STONE_PRESSURE_PLATE(70, "Stone pressure plate", "stonepressureplate", "stoneplate"), STONE_PRESSURE_PLATE(BlockID.STONE_PRESSURE_PLATE, "Stone pressure plate", "stonepressureplate", "stoneplate"),
IRON_DOOR(71, "Iron Door", "irondoor"), IRON_DOOR(BlockID.IRON_DOOR, "Iron Door", "irondoor"),
WOODEN_PRESSURE_PLATE(72, "Wooden pressure plate", "woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate", "plate", "pressureplate"), WOODEN_PRESSURE_PLATE(BlockID.WOODEN_PRESSURE_PLATE, "Wooden pressure plate", "woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate", "plate", "pressureplate"),
REDSTONE_ORE(73, "Redstone ore", "redstoneore"), REDSTONE_ORE(BlockID.REDSTONE_ORE, "Redstone ore", "redstoneore"),
GLOWING_REDSTONE_ORE(74, "Glowing redstone ore", "glowingredstoneore"), GLOWING_REDSTONE_ORE(BlockID.GLOWING_REDSTONE_ORE, "Glowing redstone ore", "glowingredstoneore"),
REDSTONE_TORCH_OFF(75, "Redstone torch (off)", "redstonetorchoff", "rstorchoff"), REDSTONE_TORCH_OFF(BlockID.REDSTONE_TORCH_OFF, "Redstone torch (off)", "redstonetorchoff", "rstorchoff"),
REDSTONE_TORCH_ON(76, "Redstone torch (on)", "redstonetorch", "redstonetorchon", "rstorchon", "redtorch"), REDSTONE_TORCH_ON(BlockID.REDSTONE_TORCH_ON, "Redstone torch (on)", "redstonetorch", "redstonetorchon", "rstorchon", "redtorch"),
STONE_BUTTON(77, "Stone Button", "stonebutton", "button"), STONE_BUTTON(BlockID.STONE_BUTTON, "Stone Button", "stonebutton", "button"),
SNOW(78, "Snow", "snow"), SNOW(BlockID.SNOW, "Snow", "snow"),
ICE(79, "Ice", "ice"), ICE(BlockID.ICE, "Ice", "ice"),
SNOW_BLOCK(80, "Snow block", "snowblock"), SNOW_BLOCK(BlockID.SNOW_BLOCK, "Snow block", "snowblock"),
CACTUS(81, "Cactus", "cactus", "cacti"), CACTUS(BlockID.CACTUS, "Cactus", "cactus", "cacti"),
CLAY(82, "Clay", "clay"), CLAY(BlockID.CLAY, "Clay", "clay"),
SUGAR_CANE(83, "Reed", "reed", "cane", "sugarcane", "sugarcanes", "vine", "vines"), SUGAR_CANE(BlockID.REED, "Reed", "reed", "cane", "sugarcane", "sugarcanes", "vine", "vines"),
JUKEBOX(84, "Jukebox", "jukebox", "stereo", "recordplayer"), JUKEBOX(BlockID.JUKEBOX, "Jukebox", "jukebox", "stereo", "recordplayer"),
FENCE(85, "Fence", "fence"), FENCE(BlockID.FENCE, "Fence", "fence"),
PUMPKIN(86, "Pumpkin", "pumpkin"), PUMPKIN(BlockID.PUMPKIN, "Pumpkin", "pumpkin"),
NETHERRACK(87, "Netherrack", "redmossycobblestone", "redcobblestone", "redmosstone", "redcobble", "netherstone", "netherrack", "nether", "hellstone"), NETHERRACK(BlockID.NETHERRACK, "Netherrack", "redmossycobblestone", "redcobblestone", "redmosstone", "redcobble", "netherstone", "netherrack", "nether", "hellstone"),
SOUL_SAND(88, "Soul sand", "slowmud", "mud", "soulsand", "hellmud"), SOUL_SAND(BlockID.SLOW_SAND, "Soul sand", "slowmud", "mud", "soulsand", "hellmud"),
GLOWSTONE(89, "Glowstone", "brittlegold", "glowstone", "lightstone", "brimstone", "australium"), GLOWSTONE(BlockID.LIGHTSTONE, "Glowstone", "brittlegold", "glowstone", "lightstone", "brimstone", "australium"),
PORTAL(90, "Portal", "portal"), PORTAL(BlockID.PORTAL, "Portal", "portal"),
JACK_O_LANTERN(91, "Pumpkin (on)", "pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"), JACK_O_LANTERN(BlockID.JACKOLANTERN, "Pumpkin (on)", "pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"),
CAKE(92, "Cake", "cake", "cakeblock"), CAKE(BlockID.CAKE_BLOCK, "Cake", "cake", "cakeblock"),
REDSTONE_REPEATER_OFF(93, "Redstone repeater (off)", "diodeoff", "redstonerepeater", "repeater", "delayer"), REDSTONE_REPEATER_OFF(BlockID.REDSTONE_REPEATER_OFF, "Redstone repeater (off)", "diodeoff", "redstonerepeater", "repeateroff", "delayeroff"),
REDSTONE_REPEATER_ON(94, "Redstone repeater (on)", "diode", "diodeon", "redstonerepeateron", "repeateron", "delayeron"), REDSTONE_REPEATER_ON(BlockID.REDSTONE_REPEATER_ON, "Redstone repeater (on)", "diodeon", "redstonerepeateron", "repeateron", "delayeron"),
LOCKED_CHEST(95, "Locked chest", "lockedchest", "steveco", "supplycrate", "valveneedstoworkonep3nottf2kthx"), LOCKED_CHEST(BlockID.LOCKED_CHEST, "Locked chest", "lockedchest", "steveco", "supplycrate", "valveneedstoworkonep3nottf2kthx"),
TRAP_DOOR(96, "Trap door", "trapdoor", "hatch", "floordoor"), TRAP_DOOR(BlockID.TRAP_DOOR, "Trap door", "trapdoor", "hatch", "floordoor"),
// Items // Items
IRON_SHOVEL(256, "Iron shovel", "ironshovel"), IRON_SHOVEL(256, "Iron shovel", "ironshovel"),
@ -411,17 +411,79 @@ public enum ItemType {
* @return * @return
*/ */
public static boolean shouldNotStack(int id) { public static boolean shouldNotStack(int id) {
return (id >= 256 && id <= 259) ItemType t = ItemType.fromID(id);
|| id == 261 if (t == null) return false;
|| (id >= 267 && id <= 279) return t == ItemType.IRON_SHOVEL
|| (id >= 281 && id <= 286) || t == ItemType.IRON_PICK
|| (id >= 290 && id <= 294) || t == ItemType.IRON_AXE
|| (id >= 298 && id <= 317) || t == ItemType.FLINT_AND_TINDER
|| (id >= 325 && id <= 327) || t == ItemType.BOW
|| id == 335 || t == ItemType.IRON_SWORD
|| id == 354 || t == ItemType.WOOD_SWORD
|| id == 355 || t == ItemType.WOOD_SHOVEL
|| id >= 2256; || t == ItemType.WOOD_PICKAXE
|| t == ItemType.WOOD_AXE
|| t == ItemType.STONE_SWORD
|| t == ItemType.STONE_SHOVEL
|| t == ItemType.STONE_PICKAXE
|| t == ItemType.STONE_AXE
|| t == ItemType.DIAMOND_SWORD
|| t == ItemType.DIAMOND_SHOVEL
|| t == ItemType.DIAMOND_PICKAXE
|| t == ItemType.DIAMOND_AXE
|| t == ItemType.BOWL
|| t == ItemType.GOLD_SWORD
|| t == ItemType.GOLD_SHOVEL
|| t == ItemType.GOLD_PICKAXE
|| t == ItemType.GOLD_AXE
|| t == ItemType.WOOD_HOE
|| t == ItemType.STONE_HOE
|| t == ItemType.IRON_HOE
|| t == ItemType.DIAMOND_HOE
|| t == ItemType.GOLD_HOE
|| t == ItemType.BREAD
|| t == ItemType.LEATHER_HELMET
|| t == ItemType.LEATHER_CHEST
|| t == ItemType.LEATHER_PANTS
|| t == ItemType.LEATHER_BOOTS
|| t == ItemType.CHAINMAIL_CHEST
|| t == ItemType.CHAINMAIL_HELMET
|| t == ItemType.CHAINMAIL_BOOTS
|| t == ItemType.CHAINMAIL_PANTS
|| t == ItemType.IRON_HELMET
|| t == ItemType.IRON_CHEST
|| t == ItemType.IRON_PANTS
|| t == ItemType.IRON_BOOTS
|| t == ItemType.DIAMOND_HELMET
|| t == ItemType.DIAMOND_PANTS
|| t == ItemType.DIAMOND_CHEST
|| t == ItemType.DIAMOND_BOOTS
|| t == ItemType.GOLD_HELMET
|| t == ItemType.GOLD_CHEST
|| t == ItemType.GOLD_PANTS
|| t == ItemType.GOLD_BOOTS
|| t == ItemType.RAW_PORKCHOP
|| t == ItemType.COOKED_PORKCHOP
|| t == ItemType.SIGN
|| t == ItemType.WOODEN_DOOR_ITEM
|| t == ItemType.BUCKET
|| t == ItemType.WATER_BUCKET
|| t == ItemType.LAVA_BUCKET
|| t == ItemType.MINECART
|| t == ItemType.SADDLE
|| t == ItemType.IRON_DOOR_ITEM
|| t == ItemType.WOOD_BOAT
|| t == ItemType.MILK_BUCKET
|| t == ItemType.STORAGE_MINECART
|| t == ItemType.POWERED_MINECART
|| t == ItemType.WATCH
|| t == ItemType.RAW_FISH
|| t == ItemType.COOKED_FISH
|| t == ItemType.CAKE_ITEM
|| t == ItemType.BED_ITEM
|| t == ItemType.MAP
|| t == ItemType.GOLD_RECORD
|| t == ItemType.GREEN_RECORD;
} }
/** /**
@ -432,7 +494,7 @@ public enum ItemType {
* @return * @return
*/ */
public static boolean usesDamageValue(int id) { public static boolean usesDamageValue(int id) {
return id == 35 return id == ItemType.CLOTH.getID()
|| id == 351; || id == ItemType.INK_SACK.getID();
} }
} }

View File

@ -44,7 +44,7 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
* *
*/ */
public MobSpawnerBlock() { public MobSpawnerBlock() {
super(52); super(BlockID.MOB_SPAWNER);
this.mobType = "Pig"; this.mobType = "Pig";
} }
@ -54,7 +54,7 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
* @param mobType * @param mobType
*/ */
public MobSpawnerBlock(String mobType) { public MobSpawnerBlock(String mobType) {
super(52); super(BlockID.MOB_SPAWNER);
this.mobType = mobType; this.mobType = mobType;
} }
@ -64,7 +64,7 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
* @param data * @param data
*/ */
public MobSpawnerBlock(int data) { public MobSpawnerBlock(int data) {
super(52, data); super(BlockID.MOB_SPAWNER, data);
} }
/** /**
@ -74,7 +74,7 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
* @param mobType * @param mobType
*/ */
public MobSpawnerBlock(int data, String mobType) { public MobSpawnerBlock(int data, String mobType) {
super(52, data); super(BlockID.MOB_SPAWNER, data);
this.mobType = mobType; this.mobType = mobType;
} }

View File

@ -38,7 +38,7 @@ public class NoteBlock extends BaseBlock implements TileEntityBlock {
* Construct the note block. * Construct the note block.
*/ */
public NoteBlock() { public NoteBlock() {
super(25); super(BlockID.NOTE_BLOCK);
this.note = 0; this.note = 0;
} }
@ -48,7 +48,7 @@ public class NoteBlock extends BaseBlock implements TileEntityBlock {
* @param data * @param data
*/ */
public NoteBlock(int data) { public NoteBlock(int data) {
super(25, data); super(BlockID.NOTE_BLOCK, data);
this.note = 0; this.note = 0;
} }
@ -59,7 +59,7 @@ public class NoteBlock extends BaseBlock implements TileEntityBlock {
* @param note * @param note
*/ */
public NoteBlock(int data, byte note) { public NoteBlock(int data, byte note) {
super(25, data); super(BlockID.NOTE_BLOCK, data);
this.note = note; this.note = note;
} }

View File

@ -23,6 +23,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.bags.*; import com.sk89q.worldedit.bags.*;
import com.sk89q.worldedit.blocks.BlockID;
public class BukkitPlayerBlockBag extends BlockBag { public class BukkitPlayerBlockBag extends BlockBag {
/** /**
@ -68,7 +69,7 @@ public class BukkitPlayerBlockBag extends BlockBag {
*/ */
@Override @Override
public void fetchBlock(int id) throws BlockBagException { public void fetchBlock(int id) throws BlockBagException {
if (id == 0) { if (id == BlockID.AIR) {
throw new IllegalArgumentException("Can't fetch air block"); throw new IllegalArgumentException("Can't fetch air block");
} }
@ -114,7 +115,7 @@ public class BukkitPlayerBlockBag extends BlockBag {
*/ */
@Override @Override
public void storeBlock(int id) throws BlockBagException { public void storeBlock(int id) throws BlockBagException {
if (id == 0) { if (id == BlockID.AIR) {
throw new IllegalArgumentException("Can't store air block"); throw new IllegalArgumentException("Can't store air block");
} }

View File

@ -135,9 +135,7 @@ public class WorldEditPlugin extends JavaPlugin {
* Register the events used by WorldEdit. * Register the events used by WorldEdit.
*/ */
protected void registerEvents() { protected void registerEvents() {
@SuppressWarnings("unused")
PlayerListener playerListener = new WorldEditPlayerListener(this); PlayerListener playerListener = new WorldEditPlayerListener(this);
@SuppressWarnings("unused")
PlayerListener criticalPlayerListener = new WorldEditCriticalPlayerListener(this); PlayerListener criticalPlayerListener = new WorldEditCriticalPlayerListener(this);
// The permissions resolver has some hooks of its own // The permissions resolver has some hooks of its own

View File

@ -28,6 +28,7 @@ import com.sk89q.minecraft.util.commands.Logging;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.*; import static com.sk89q.minecraft.util.commands.Logging.LogMode.*;
import com.sk89q.worldedit.*; import com.sk89q.worldedit.*;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.data.DataException; import com.sk89q.worldedit.data.DataException;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
@ -76,7 +77,7 @@ public class ClipboardCommands {
LocalSession session, LocalPlayer player, EditSession editSession) LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException { throws WorldEditException {
BaseBlock block = new BaseBlock(0); BaseBlock block = new BaseBlock(BlockID.AIR);
if (args.argsLength() > 0) { if (args.argsLength() > 0) {
block = we.getBlock(player, args.getString(0)); block = we.getBlock(player, args.getString(0));

View File

@ -81,7 +81,8 @@ public class GenerationCommands {
@Command( @Command(
aliases = {"/hsphere"}, aliases = {"/hsphere"},
usage = "<block> <radius>[,<radius>,<radius>] [raised?] ", usage = "<block> <radius>[,<radius>,<radius>] [raised?] ",
desc = "Generate a hollow sphere. If you specify 3 radiuses separated by commas, an ellipsoid with the dimensions x,y,z will be generated.", desc = "Generate a hollow sphere.",
flags = "q",
min = 2, min = 2,
max = 3 max = 3
) )
@ -91,6 +92,29 @@ public class GenerationCommands {
LocalSession session, LocalPlayer player, EditSession editSession) LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException { throws WorldEditException {
if (args.hasFlag('q')) {
Pattern block = we.getBlockPattern(player, args.getString(0));
String[] radiuses = args.getString(1).split(",");
if (radiuses.length > 1) {
throw new InsufficientArgumentsException("Cannot specify q flag and multiple radiuses.");
}
double radius = Double.parseDouble(radiuses[0]);
boolean raised = args.argsLength() > 2
? (args.getString(2).equalsIgnoreCase("true")
|| args.getString(2).equalsIgnoreCase("yes"))
: false;
Vector pos = session.getPlacementPosition(player);
if (raised) {
pos = pos.add(0, radius, 0);
}
int affected = editSession.makeSphere(pos, block, radius, false);
player.findFreePosition();
player.print(affected + " block(s) have been created.");
return;
}
final Pattern block = we.getBlockPattern(player, args.getString(0)); final Pattern block = we.getBlockPattern(player, args.getString(0));
String[] radiuses = args.getString(1).split(","); String[] radiuses = args.getString(1).split(",");
final double radiusX, radiusY, radiusZ; final double radiusX, radiusY, radiusZ;
@ -110,10 +134,11 @@ public class GenerationCommands {
return; return;
} }
final boolean raised; final boolean raised;
if (args.argsLength() > 2) if (args.argsLength() > 2) {
raised = args.getString(2).equalsIgnoreCase("true") || args.getString(2).equalsIgnoreCase("yes"); raised = args.getString(2).equalsIgnoreCase("true") || args.getString(2).equalsIgnoreCase("yes");
else } else {
raised = false; raised = false;
}
Vector pos = session.getPlacementPosition(player); Vector pos = session.getPlacementPosition(player);
if (raised) { if (raised) {
@ -127,8 +152,9 @@ public class GenerationCommands {
@Command( @Command(
aliases = {"/sphere"}, aliases = {"/sphere"},
usage = "<block> <radius> [raised?] ", usage = "<block> <radius>[,<radius>,<radius>] [raised?] ",
desc = "Generate a filled sphere. If you specify 3 radiuses separated by commas, an ellipsoid with the dimensions x,y,z will be generated.", desc = "Generate a filled sphere.",
flags = "q",
min = 2, min = 2,
max = 3 max = 3
) )
@ -138,6 +164,29 @@ public class GenerationCommands {
LocalSession session, LocalPlayer player, EditSession editSession) LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException { throws WorldEditException {
if (args.hasFlag('q')) {
Pattern block = we.getBlockPattern(player, args.getString(0));
String[] radiuses = args.getString(1).split(",");
if (radiuses.length > 1) {
throw new InsufficientArgumentsException("Cannot specify q flag and multiple radiuses.");
}
double radius = Double.parseDouble(radiuses[0]);
boolean raised = args.argsLength() > 2
? (args.getString(2).equalsIgnoreCase("true")
|| args.getString(2).equalsIgnoreCase("yes"))
: false;
Vector pos = session.getPlacementPosition(player);
if (raised) {
pos = pos.add(0, radius, 0);
}
int affected = editSession.makeSphere(pos, block, radius, true);
player.findFreePosition();
player.print(affected + " block(s) have been created.");
return;
}
Pattern block = we.getBlockPattern(player, args.getString(0)); Pattern block = we.getBlockPattern(player, args.getString(0));
String[] radiuses = args.getString(1).split(","); String[] radiuses = args.getString(1).split(",");
final double radiusX, radiusY, radiusZ; final double radiusX, radiusY, radiusZ;
@ -157,10 +206,11 @@ public class GenerationCommands {
return; return;
} }
final boolean raised; final boolean raised;
if (args.argsLength() > 2) if (args.argsLength() > 2) {
raised = args.getString(2).equalsIgnoreCase("true") || args.getString(2).equalsIgnoreCase("yes"); raised = args.getString(2).equalsIgnoreCase("true") || args.getString(2).equalsIgnoreCase("yes");
else } else {
raised = false; raised = false;
}
Vector pos = session.getPlacementPosition(player); Vector pos = session.getPlacementPosition(player);
if (raised) { if (raised) {
@ -194,7 +244,6 @@ public class GenerationCommands {
if (type == null) { if (type == null) {
player.printError("Tree type '" + args.getString(1) + "' is unknown."); player.printError("Tree type '" + args.getString(1) + "' is unknown.");
return; return;
} else {
} }
int affected = editSession.makeForest(player.getPosition(), int affected = editSession.makeForest(player.getPosition(),

View File

@ -28,6 +28,7 @@ import com.sk89q.minecraft.util.commands.Logging;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.*; import static com.sk89q.minecraft.util.commands.Logging.LogMode.*;
import com.sk89q.worldedit.*; import com.sk89q.worldedit.*;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.filtering.GaussianKernel; import com.sk89q.worldedit.filtering.GaussianKernel;
import com.sk89q.worldedit.filtering.HeightMapFilter; import com.sk89q.worldedit.filtering.HeightMapFilter;
import com.sk89q.worldedit.masks.Mask; import com.sk89q.worldedit.masks.Mask;
@ -243,7 +244,7 @@ public class RegionCommands {
if (args.argsLength() > 2) { if (args.argsLength() > 2) {
replace = we.getBlock(player, args.getString(2)); replace = we.getBlock(player, args.getString(2));
} else { } else {
replace = new BaseBlock(0); replace = new BaseBlock(BlockID.AIR);
} }
int affected = editSession.moveCuboidRegion(session.getSelection(player.getWorld()), int affected = editSession.moveCuboidRegion(session.getSelection(player.getWorld()),

View File

@ -308,6 +308,17 @@ public final class BlockData {
return data; return data;
} }
/**
* Flip a block's data value.
*
* @param type
* @param data
* @return
*/
public static int flip(int type, int data) {
return rotate90(type, rotate90(type, data));
}
/** /**
* Flip a block's data value. * Flip a block's data value.
* *

View File

@ -21,9 +21,10 @@ package com.sk89q.worldedit.masks;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BlockID;
public class ExistingBlockMask implements Mask { public class ExistingBlockMask implements Mask {
public boolean matches(EditSession editSession, Vector pos) { public boolean matches(EditSession editSession, Vector pos) {
return editSession.getBlockType(pos) != 0; return editSession.getBlockType(pos) != BlockID.AIR;
} }
} }

View File

@ -84,10 +84,6 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
return null; return null;
} }
// Bug workaround
if (target.getBlockX() == 0 && target.getBlockY() == 0 && target.getBlockZ() == 0) {
return null;
}
return target; return target;
} }
} }

View File

@ -49,7 +49,7 @@ public class FloodFillTool implements BlockTool {
int initialType = world.getBlockType(clicked); int initialType = world.getBlockType(clicked);
if (initialType == 0) { if (initialType == BlockID.AIR) {
return true; return true;
} }

View File

@ -49,7 +49,7 @@ public class RecursivePickaxe implements BlockTool {
int initialType = world.getBlockType(clicked); int initialType = world.getBlockType(clicked);
if (initialType == 0) { if (initialType == BlockID.AIR) {
return true; return true;
} }

View File

@ -40,15 +40,13 @@ public class SinglePickaxe implements BlockTool {
if (world.getBlockType(clicked) == BlockID.BEDROCK if (world.getBlockType(clicked) == BlockID.BEDROCK
&& !player.canDestroyBedrock()) { && !player.canDestroyBedrock()) {
return true; return true;
} else if (world.getBlockType(clicked) == BlockID.TNT) {
return false;
} }
if (config.superPickaxeDrop) { if (config.superPickaxeDrop) {
world.simulateBlockMine(clicked); world.simulateBlockMine(clicked);
} }
world.setBlockType(clicked, 0); world.setBlockType(clicked, BlockID.AIR);
return true; return true;
} }

View File

@ -33,6 +33,10 @@ public class SmoothBrush implements Brush {
private int iterations; private int iterations;
private boolean naturalOnly; private boolean naturalOnly;
public SmoothBrush(int iterations) {
this(iterations, false);
}
public SmoothBrush(int iterations, boolean naturalOnly) { public SmoothBrush(int iterations, boolean naturalOnly) {
this.iterations = iterations; this.iterations = iterations;
this.naturalOnly = naturalOnly; this.naturalOnly = naturalOnly;

View File

@ -28,6 +28,7 @@ import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockID;
/** /**
* Tree generator. * Tree generator.
@ -177,8 +178,8 @@ public class TreeGenerator {
int trunkHeight = (int) Math.floor(Math.random() * 2) + 3; int trunkHeight = (int) Math.floor(Math.random() * 2) + 3;
int height = (int) Math.floor(Math.random() * 5) + 8; int height = (int) Math.floor(Math.random() * 5) + 8;
BaseBlock logBlock = new BaseBlock(17); BaseBlock logBlock = new BaseBlock(BlockID.LOG);
BaseBlock leavesBlock = new BaseBlock(18); BaseBlock leavesBlock = new BaseBlock(BlockID.LEAVES);
// Create trunk // Create trunk
for (int i = 0; i < trunkHeight; ++i) { for (int i = 0; i < trunkHeight; ++i) {