geforkt von Mirrors/FastAsyncWorldEdit
Abstracted all block IDs to BlockID and item ids to ItemType. Overloaded recently changed methods for compatibility and cleaned a few things up.
Dieser Commit ist enthalten in:
Ursprung
8c0d0f9ed4
Commit
4c00a24c1d
@ -170,10 +170,20 @@ public class CuboidClipboard {
|
||||
.subtract(shiftX, 0, shiftZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flip the clipboard.
|
||||
*
|
||||
* @param dir direction to flip
|
||||
*/
|
||||
public void flip(FlipDirection dir) {
|
||||
flip(dir, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flip the clipboard.
|
||||
*
|
||||
* @param dir
|
||||
* @param dir direction to flip
|
||||
* @param aroundPlayer flip the offset around the player
|
||||
*/
|
||||
public void flip(FlipDirection dir, boolean aroundPlayer) {
|
||||
final int width = getWidth();
|
||||
@ -186,24 +196,16 @@ public class CuboidClipboard {
|
||||
for (int xs = 0; xs < wid; ++xs) {
|
||||
for (int z = 0; z < length; ++z) {
|
||||
for (int y = 0; y < height; ++y) {
|
||||
final BaseBlock a = data[xs][y][z];
|
||||
//System.out.println(xs+"/"+y+"/"+z+": "+a.getType());
|
||||
a.flip(dir);
|
||||
|
||||
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;
|
||||
BaseBlock old = data[xs][y][z].flip(dir);
|
||||
data[xs][y][z] = data[width - xs - 1][y][z].flip(dir);
|
||||
data[width - xs - 1][y][z] = old;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aroundPlayer)
|
||||
if (aroundPlayer) {
|
||||
offset = offset.setX(1 - offset.getX() - width);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@ -212,23 +214,16 @@ public class CuboidClipboard {
|
||||
for (int zs = 0; zs < len; ++zs) {
|
||||
for (int x = 0; x < width; ++x) {
|
||||
for (int y = 0; y < height; ++y) {
|
||||
final BaseBlock a = data[x][y][zs];
|
||||
a.flip(dir);
|
||||
|
||||
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;
|
||||
BaseBlock old = data[x][y][zs].flip(dir);
|
||||
data[x][y][zs] = data[x][y][length - zs - 1].flip(dir);
|
||||
data[x][y][length - zs - 1] = old;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aroundPlayer)
|
||||
if (aroundPlayer) {
|
||||
offset = offset.setZ(1 - offset.getZ() - length);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@ -237,23 +232,16 @@ public class CuboidClipboard {
|
||||
for (int ys = 0; ys < hei; ++ys) {
|
||||
for (int x = 0; x < width; ++x) {
|
||||
for (int z = 0; z < length; ++z) {
|
||||
final BaseBlock a = data[x][ys][z];
|
||||
a.flip(dir);
|
||||
|
||||
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;
|
||||
BaseBlock old = data[x][ys][z].flip(dir);
|
||||
data[x][ys][z] = data[x][height - ys - 1][z].flip(dir);
|
||||
data[x][height - ys - 1][z] = old;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aroundPlayer)
|
||||
if (aroundPlayer) {
|
||||
offset = offset.setY(1 - offset.getY() - height);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
package com.sk89q.worldedit;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
@ -182,7 +181,7 @@ public class EditSession {
|
||||
world.clearContainerBlockContents(pt);
|
||||
// Ice turns until water so this has to be done first
|
||||
} else if (existing == BlockID.ICE) {
|
||||
world.setBlockType(pt, 0);
|
||||
world.setBlockType(pt, BlockID.AIR);
|
||||
}
|
||||
|
||||
int id = block.getType();
|
||||
@ -342,7 +341,7 @@ public class EditSession {
|
||||
&& getBlockData(pt) == block.getData());
|
||||
// Destroy torches, etc. first
|
||||
} else if (BlockType.shouldPlaceLast(getBlockType(pt))) {
|
||||
rawSetBlock(pt, new BaseBlock(0));
|
||||
rawSetBlock(pt, new BaseBlock(BlockID.AIR));
|
||||
} else {
|
||||
queueAfter.put(pt.toBlockVector(), block);
|
||||
return !(getBlockType(pt) == block.getType()
|
||||
@ -504,8 +503,7 @@ public class EditSession {
|
||||
/**
|
||||
* Set the maximum number of blocks that can be changed.
|
||||
*
|
||||
* @param maxBlocks
|
||||
* -1 to disable
|
||||
* @param maxBlocks -1 to disable
|
||||
*/
|
||||
public void setBlockChangeLimit(int maxBlocks) {
|
||||
if (maxBlocks < -1) {
|
||||
@ -818,8 +816,8 @@ public class EditSession {
|
||||
for (int y = oY; y <= maxY; ++y) {
|
||||
Vector pt = new Vector(x, y, z);
|
||||
|
||||
if (getBlockType(pt) != 0) {
|
||||
setBlock(pt, new BaseBlock(0));
|
||||
if (getBlockType(pt) != BlockID.AIR) {
|
||||
setBlock(pt, new BaseBlock(BlockID.AIR));
|
||||
++affected;
|
||||
}
|
||||
}
|
||||
@ -853,8 +851,8 @@ public class EditSession {
|
||||
for (int y = oY; y >= minY; --y) {
|
||||
Vector pt = new Vector(x, y, z);
|
||||
|
||||
if (getBlockType(pt) != 0) {
|
||||
setBlock(pt, new BaseBlock(0));
|
||||
if (getBlockType(pt) != BlockID.AIR) {
|
||||
setBlock(pt, new BaseBlock(BlockID.AIR));
|
||||
++affected;
|
||||
}
|
||||
}
|
||||
@ -876,7 +874,7 @@ public class EditSession {
|
||||
public int removeNear(Vector pos, int blockType, int size)
|
||||
throws MaxChangedBlocksException {
|
||||
int affected = 0;
|
||||
BaseBlock air = new BaseBlock(0);
|
||||
BaseBlock air = new BaseBlock(BlockID.AIR);
|
||||
|
||||
int minX = pos.getBlockX() - size;
|
||||
int maxX = pos.getBlockX() + size;
|
||||
@ -1633,7 +1631,8 @@ public class EditSession {
|
||||
int type = getBlockType(cur);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -1661,7 +1660,7 @@ public class EditSession {
|
||||
}
|
||||
}
|
||||
|
||||
if (setBlock(cur, new BaseBlock(0))) {
|
||||
if (setBlock(cur, new BaseBlock(BlockID.AIR))) {
|
||||
++affected;
|
||||
}
|
||||
}
|
||||
@ -1707,7 +1706,7 @@ public class EditSession {
|
||||
int type = getBlockType(cur);
|
||||
|
||||
// Check block type
|
||||
if (type != moving && type != stationary && type != 0) {
|
||||
if (type != moving && type != stationary && type != BlockID.AIR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1919,6 +1918,74 @@ public class EditSession {
|
||||
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.
|
||||
*
|
||||
@ -1950,31 +2017,33 @@ public class EditSession {
|
||||
forX:
|
||||
for (int x = 0; x <= ceilRadiusX; ++x) {
|
||||
final double xn = nextXn;
|
||||
nextXn = (x+1)*invRadiusX;
|
||||
nextXn = (x + 1) * invRadiusX;
|
||||
double nextYn = 0;
|
||||
forY:
|
||||
for (int y = 0; y <= ceilRadiusY; ++y) {
|
||||
final double yn = nextYn;
|
||||
nextYn = (y+1)*invRadiusY;
|
||||
nextYn = (y + 1) * invRadiusY;
|
||||
double nextZn = 0;
|
||||
forZ:
|
||||
for (int z = 0; z <= ceilRadiusZ; ++z) {
|
||||
final double zn = nextZn;
|
||||
nextZn = (z+1)*invRadiusZ;
|
||||
nextZn = (z + 1) * invRadiusZ;
|
||||
|
||||
double distanceSq = lengthSq(xn, yn, zn);
|
||||
if (distanceSq > 1) {
|
||||
if (z == 0) {
|
||||
if (y == 0)
|
||||
if (y == 0) {
|
||||
break forX;
|
||||
}
|
||||
break forY;
|
||||
}
|
||||
break forZ;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
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 oz = pos.getBlockZ();
|
||||
|
||||
BaseBlock ice = new BaseBlock(79);
|
||||
BaseBlock snow = new BaseBlock(78);
|
||||
BaseBlock ice = new BaseBlock(BlockID.ICE);
|
||||
BaseBlock snow = new BaseBlock(BlockID.SNOW);
|
||||
|
||||
int ceilRadius = (int) Math.ceil(radius);
|
||||
for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) {
|
||||
@ -2136,34 +2205,13 @@ public class EditSession {
|
||||
int id = getBlockType(pt);
|
||||
|
||||
// Snow should not cover these blocks
|
||||
if (id == 6 // Saplings
|
||||
|| id == 10 // Lava
|
||||
|| 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
|
||||
if (BlockType.canPassThrough(id)
|
||||
&& !(id == BlockID.WATER || id == BlockID.STATIONARY_WATER)) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Ice!
|
||||
if (id == 8 || id == 9) {
|
||||
if (id == BlockID.WATER || id == BlockID.STATIONARY_WATER) {
|
||||
if (setBlock(pt, ice)) {
|
||||
++affected;
|
||||
}
|
||||
@ -2171,7 +2219,7 @@ public class EditSession {
|
||||
}
|
||||
|
||||
// Cover
|
||||
if (id != 0) {
|
||||
if (id != BlockID.AIR) {
|
||||
if (y == 127) { // Too high!
|
||||
break;
|
||||
}
|
||||
@ -2188,42 +2236,6 @@ public class EditSession {
|
||||
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.
|
||||
*
|
||||
@ -2254,8 +2266,9 @@ public class EditSession {
|
||||
Vector pt = new Vector(x, y, z);
|
||||
int id = getBlockType(pt);
|
||||
|
||||
if (greenIgnoreBlockIds.contains(id))
|
||||
if (BlockType.canPassThrough(id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (id == BlockID.DIRT) {
|
||||
if (setBlock(pt, grass)) {
|
||||
@ -2294,8 +2307,8 @@ public class EditSession {
|
||||
*/
|
||||
private void makePumpkinPatch(Vector basePos)
|
||||
throws MaxChangedBlocksException {
|
||||
// BaseBlock logBlock = new BaseBlock(17);
|
||||
BaseBlock leavesBlock = new BaseBlock(18);
|
||||
// BaseBlock logBlock = new BaseBlock(BlockID.LOG);
|
||||
BaseBlock leavesBlock = new BaseBlock(BlockID.LEAVES);
|
||||
|
||||
// setBlock(basePos.subtract(0, 1, 0), logBlock);
|
||||
setBlockIfAir(basePos, leavesBlock);
|
||||
@ -2314,49 +2327,58 @@ public class EditSession {
|
||||
*/
|
||||
private void makePumpkinPatchVine(Vector basePos, Vector pos)
|
||||
throws MaxChangedBlocksException {
|
||||
if (pos.distance(basePos) > 4)
|
||||
return;
|
||||
if (getBlockType(pos) != 0)
|
||||
return;
|
||||
if (pos.distance(basePos) > 4) return;
|
||||
if (getBlockType(pos) != 0) return;
|
||||
|
||||
for (int i = -1; i > -3; --i) {
|
||||
Vector testPos = pos.add(0, i, 0);
|
||||
if (getBlockType(testPos) == 0) {
|
||||
if (getBlockType(testPos) == BlockID.AIR) {
|
||||
pos = testPos;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setBlockIfAir(pos, new BaseBlock(18));
|
||||
setBlockIfAir(pos, new BaseBlock(BlockID.LEAVES));
|
||||
|
||||
int t = prng.nextInt(4);
|
||||
int h = prng.nextInt(3) - 1;
|
||||
|
||||
BaseBlock log = new BaseBlock(BlockID.LOG);
|
||||
BaseBlock pumpkin = new BaseBlock(BlockID.PUMPKIN);
|
||||
|
||||
if (t == 0) {
|
||||
if (prng.nextBoolean())
|
||||
if (prng.nextBoolean()) {
|
||||
makePumpkinPatchVine(basePos, pos.add(1, 0, 0));
|
||||
if (prng.nextBoolean())
|
||||
setBlockIfAir(pos.add(1, h, -1), new BaseBlock(18));
|
||||
setBlockIfAir(pos.add(0, 0, -1), new BaseBlock(86));
|
||||
}
|
||||
if (prng.nextBoolean()) {
|
||||
setBlockIfAir(pos.add(1, h, -1), log);
|
||||
}
|
||||
setBlockIfAir(pos.add(0, 0, -1), pumpkin);
|
||||
} else if (t == 1) {
|
||||
if (prng.nextBoolean())
|
||||
if (prng.nextBoolean()) {
|
||||
makePumpkinPatchVine(basePos, pos.add(0, 0, 1));
|
||||
if (prng.nextBoolean())
|
||||
setBlockIfAir(pos.add(1, h, 0), new BaseBlock(18));
|
||||
setBlockIfAir(pos.add(1, 0, 1), new BaseBlock(86));
|
||||
}
|
||||
if (prng.nextBoolean()) {
|
||||
setBlockIfAir(pos.add(1, h, 0), log);
|
||||
}
|
||||
setBlockIfAir(pos.add(1, 0, 1), pumpkin);
|
||||
} else if (t == 2) {
|
||||
if (prng.nextBoolean())
|
||||
if (prng.nextBoolean()) {
|
||||
makePumpkinPatchVine(basePos, pos.add(0, 0, -1));
|
||||
if (prng.nextBoolean())
|
||||
setBlockIfAir(pos.add(-1, h, 0), new BaseBlock(18));
|
||||
setBlockIfAir(pos.add(-1, 0, 1), new BaseBlock(86));
|
||||
}
|
||||
if (prng.nextBoolean()) {
|
||||
setBlockIfAir(pos.add(-1, h, 0), log);
|
||||
}
|
||||
setBlockIfAir(pos.add(-1, 0, 1), pumpkin);
|
||||
} else if (t == 3) {
|
||||
if (prng.nextBoolean())
|
||||
if (prng.nextBoolean()) {
|
||||
makePumpkinPatchVine(basePos, pos.add(-1, 0, 0));
|
||||
if (prng.nextBoolean())
|
||||
setBlockIfAir(pos.add(-1, h, -1), new BaseBlock(18));
|
||||
setBlockIfAir(pos.add(-1, 0, -1), new BaseBlock(86));
|
||||
}
|
||||
if (prng.nextBoolean()) {
|
||||
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()
|
||||
+ size; ++z) {
|
||||
// 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;
|
||||
}
|
||||
// The gods don't want a pumpkin patch here
|
||||
if (Math.random() < 0.98) {
|
||||
continue;
|
||||
@ -2387,11 +2410,11 @@ public class EditSession {
|
||||
for (int y = basePos.getBlockY(); y >= basePos.getBlockY() - 10; --y) {
|
||||
// Check if we hit the ground
|
||||
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));
|
||||
++affected;
|
||||
break;
|
||||
} else if (t != 0) { // Trees won't grow on this!
|
||||
} else if (t != BlockID.AIR) { // Trees won't grow on this!
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2420,8 +2443,9 @@ public class EditSession {
|
||||
for (int z = basePos.getBlockZ() - size; z <= basePos.getBlockZ()
|
||||
+ size; ++z) {
|
||||
// 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;
|
||||
}
|
||||
// The gods don't want a tree here
|
||||
if (Math.random() >= density) {
|
||||
continue;
|
||||
@ -2430,11 +2454,11 @@ public class EditSession {
|
||||
for (int y = basePos.getBlockY(); y >= basePos.getBlockY() - 10; --y) {
|
||||
// Check if we hit the ground
|
||||
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));
|
||||
++affected;
|
||||
break;
|
||||
} else if (t != 0) { // Trees won't grow on this!
|
||||
} else if (t != BlockID.AIR) { // Trees won't grow on this!
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2551,10 +2575,22 @@ public class EditSession {
|
||||
*
|
||||
* @param x
|
||||
* @param z
|
||||
* @param minY
|
||||
* minimal height
|
||||
* @param maxY
|
||||
* maximal height
|
||||
* @param minY minimal height
|
||||
* @param maxY maximal height
|
||||
* @param naturalOnly look at natural blocks or all blocks
|
||||
* @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
|
||||
* @return height of highest block found or 'minY'
|
||||
*/
|
||||
|
@ -19,6 +19,7 @@ package com.sk89q.worldedit;
|
||||
*/
|
||||
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.filtering.HeightMapFilter;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
@ -43,7 +44,17 @@ public class HeightMap {
|
||||
* @param session
|
||||
* @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) {
|
||||
this.session = session;
|
||||
this.region = region;
|
||||
@ -99,7 +110,7 @@ public class HeightMap {
|
||||
int originZ = minY.getBlockZ();
|
||||
|
||||
int maxY = region.getMaximumPoint().getBlockY();
|
||||
BaseBlock fillerAir = new BaseBlock(0);
|
||||
BaseBlock fillerAir = new BaseBlock(BlockID.AIR);
|
||||
|
||||
int blocksChanged = 0;
|
||||
|
||||
@ -125,7 +136,8 @@ public class HeightMap {
|
||||
BaseBlock existing = session.getBlock(new Vector(X, curHeight, Z));
|
||||
|
||||
// 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);
|
||||
++blocksChanged;
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.ItemType;
|
||||
import com.sk89q.worldedit.snapshots.SnapshotRepository;
|
||||
import java.io.File;
|
||||
import java.util.HashSet;
|
||||
@ -32,9 +34,48 @@ import java.util.Set;
|
||||
*/
|
||||
public abstract class LocalConfiguration {
|
||||
protected static final int[] defaultDisallowedBlocks = new int[] {
|
||||
6, 7, 14, 15, 16, 21, 22, 23, 24, 25, 26, 27, 28, 29, 39, 31,
|
||||
32, 33, 34, 36, 37, 38, 39, 40, 46, 50, 51, 56, 59, 69, 73, 74,
|
||||
75, 76, 77, 81, 83
|
||||
// dangerous stuff (physics/drops items)
|
||||
BlockID.SAPLING,
|
||||
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;
|
||||
@ -48,13 +89,13 @@ public abstract class LocalConfiguration {
|
||||
public int maxBrushRadius = 6;
|
||||
public boolean logCommands = false;
|
||||
public boolean registerHelp = true;
|
||||
public int wandItem = 271;
|
||||
public int wandItem = ItemType.WOOD_AXE.getID();
|
||||
public boolean superPickaxeDrop = true;
|
||||
public boolean superPickaxeManyDrop = true;
|
||||
public boolean noDoubleSlash = false;
|
||||
public boolean useInventory = false;
|
||||
public boolean useInventoryOverride = false;
|
||||
public int navigationWand = 345;
|
||||
public int navigationWand = ItemType.COMPASS.getID();
|
||||
public int navigationWandMaxDistance = 50;
|
||||
public int scriptTimeout = 3000;
|
||||
public Set<Integer> allowedDataCycleBlocks = new HashSet<Integer>();
|
||||
|
@ -21,7 +21,9 @@ package com.sk89q.worldedit;
|
||||
|
||||
import java.io.File;
|
||||
import com.sk89q.worldedit.bags.BlockBag;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.BlockType;
|
||||
import com.sk89q.worldedit.blocks.ItemType;
|
||||
import com.sk89q.worldedit.cui.CUIEvent;
|
||||
import com.sk89q.worldedit.util.TargetBlock;
|
||||
|
||||
@ -51,8 +53,11 @@ public abstract class LocalPlayer {
|
||||
*/
|
||||
public boolean isHoldingPickAxe() {
|
||||
int item = getItemInHand();
|
||||
return item == 257 || item == 270 || item == 274 || item == 278
|
||||
|| item == 285;
|
||||
return item == ItemType.IRON_PICK.getID()
|
||||
|| 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));
|
||||
|
||||
// Don't get put in lava!
|
||||
if (type == 10 || type == 11) {
|
||||
if (type == BlockID.LAVA || type == BlockID.STATIONARY_LAVA) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -194,7 +199,7 @@ public abstract class LocalPlayer {
|
||||
int type = world.getBlockType(new Vector(x, y, z));
|
||||
|
||||
// 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!
|
||||
setPosition(new Vector(x + 0.5, y + 1, z + 0.5));
|
||||
return true;
|
||||
@ -236,7 +241,7 @@ public abstract class LocalPlayer {
|
||||
if (!BlockType.canPassThrough(world.getBlockType(new Vector(x, y, z)))) {
|
||||
int platformY = Math.max(initialY, y - 3 - clearance);
|
||||
world.setBlockType(new Vector(x, platformY, z),
|
||||
BlockType.GLASS.getID());
|
||||
BlockID.GLASS);
|
||||
setPosition(new Vector(x + 0.5, platformY + 1, z + 0.5));
|
||||
return true;
|
||||
}
|
||||
@ -269,7 +274,7 @@ public abstract class LocalPlayer {
|
||||
break;
|
||||
} else if (y == maxY + 1) {
|
||||
world.setBlockType(new Vector(x, y - 2, z),
|
||||
BlockType.GLASS.getID());
|
||||
BlockID.GLASS);
|
||||
setPosition(new Vector(x + 0.5, y - 1, z + 0.5));
|
||||
return true;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ import com.sk89q.worldedit.tools.SinglePickaxe;
|
||||
import com.sk89q.worldedit.tools.BlockTool;
|
||||
import com.sk89q.worldedit.tools.Tool;
|
||||
import com.sk89q.worldedit.bags.BlockBag;
|
||||
import com.sk89q.worldedit.blocks.ItemType;
|
||||
import com.sk89q.worldedit.cui.CUIPointBasedRegion;
|
||||
import com.sk89q.worldedit.cui.CUIEvent;
|
||||
import com.sk89q.worldedit.cui.SelectionPointEvent;
|
||||
@ -480,8 +481,10 @@ public class LocalSession {
|
||||
public void setTool(int item, Tool tool) throws InvalidToolBindException {
|
||||
if (item > 0 && item < 255) {
|
||||
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");
|
||||
// let people deal with craftbook themselves, not everyone uses it
|
||||
*/
|
||||
} else if (item == config.wandItem) {
|
||||
throw new InvalidToolBindException(item, "Already used for the wand");
|
||||
} else if (item == config.navigationWand) {
|
||||
|
@ -22,6 +22,8 @@ package com.sk89q.worldedit;
|
||||
import java.util.Random;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.ItemType;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
/**
|
||||
@ -249,63 +251,65 @@ public abstract class LocalWorld {
|
||||
int type = getBlockType(pt);
|
||||
//setBlockType(pt, 0);
|
||||
|
||||
if (type == 1) { dropItem(pt, new BaseItemStack(4)); } // Stone
|
||||
else if (type == 2) { dropItem(pt, new BaseItemStack(3)); } // Grass
|
||||
else if (type == 7) { } // Bedrock
|
||||
else if (type == 8) { } // Water
|
||||
else if (type == 9) { } // Water
|
||||
else if (type == 10) { } // Lava
|
||||
else if (type == 11) { } // Lava
|
||||
else if (type == 13) { // Gravel
|
||||
if (type == BlockID.STONE) { dropItem(pt, new BaseItemStack(BlockID.COBBLESTONE)); } // Stone
|
||||
else if (type == BlockID.GRASS) { dropItem(pt, new BaseItemStack(BlockID.DIRT)); } // Grass
|
||||
else if (type == BlockID.BEDROCK) { } // Bedrock
|
||||
else if (type == BlockID.WATER) { } // Water
|
||||
else if (type == BlockID.STATIONARY_WATER) { } // Water
|
||||
else if (type == BlockID.LAVA) { } // Lava
|
||||
else if (type == BlockID.STATIONARY_LAVA) { } // Lava
|
||||
else if (type == BlockID.GRAVEL) { // Gravel
|
||||
if (random.nextDouble() >= 0.9) {
|
||||
dropItem(pt, new BaseItemStack(318));
|
||||
dropItem(pt, new BaseItemStack(ItemType.FLINT.getID()));
|
||||
} else {
|
||||
dropItem(pt, new BaseItemStack(type));
|
||||
}
|
||||
}
|
||||
else if (type == 16) { dropItem(pt, new BaseItemStack(263)); } // Coal ore
|
||||
else if (type == 17) { dropItem(pt, new BaseItemStack(17, 1, (short)getBlockData(pt))); } // Log
|
||||
else if (type == 18) { // Leaves
|
||||
else if (type == BlockID.COAL_ORE) { dropItem(pt, new BaseItemStack(ItemType.COAL.getID())); } // Coal ore
|
||||
else if (type == BlockID.LOG) { dropItem(pt, new BaseItemStack(type, 1, (short) getBlockData(pt))); } // Log
|
||||
else if (type == BlockID.LEAVES) { // Leaves
|
||||
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 == 21) { dropItem(pt, new BaseItemStack(351, 1, (short)4), (random.nextInt(5)+4)); } // Lapis Lazuli ore
|
||||
else if (type == 26) { dropItem(pt, new BaseItemStack(355)); } // Bed
|
||||
else if (type == 31) { if(random.nextInt(8) == 0) dropItem(pt, new BaseItemStack(295)); } // Tall Grass
|
||||
else if (type == 34) { } // Piston Head
|
||||
else if (type == 35) { dropItem(pt, new BaseItemStack(35, 1, (short)getBlockData(pt))); } // Cloth
|
||||
else if (type == 43) { // Double step
|
||||
dropItem(pt, new BaseItemStack(44, 1, (short)getBlockData(pt)), 2);
|
||||
else if (type == BlockID.GLASS) { } // Glass
|
||||
else if (type == BlockID.LAPIS_LAZULI_ORE) {
|
||||
dropItem(pt, new BaseItemStack(ItemType.INK_SACK.getID(), 1, (short) 4), (random.nextInt(5) + 4));
|
||||
} // Lapis Lazuli ore
|
||||
else if (type == BlockID.BED) { dropItem(pt, new BaseItemStack(ItemType.BED_ITEM.getID())); } // Bed
|
||||
else if (type == BlockID.LONG_GRASS) { if (random.nextInt(8) == 0) dropItem(pt, new BaseItemStack(ItemType.SEEDS.getID())); } // Tall Grass
|
||||
else if (type == BlockID.PISTON_EXTENSION) { } // Piston Head
|
||||
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 == 47) { } // Bookshelves
|
||||
else if (type == 51) { } // Fire
|
||||
else if (type == 52) { } // Mob spawner
|
||||
else if (type == 53) { dropItem(pt, new BaseItemStack(5)); } // Wooden stairs
|
||||
else if (type == 55) { dropItem(pt, new BaseItemStack(331)); } // Redstone wire
|
||||
else if (type == 56) { dropItem(pt, new BaseItemStack(264)); } // Diamond ore
|
||||
else if (type == 59) { dropItem(pt, new BaseItemStack(295)); } // Crops
|
||||
else if (type == 60) { dropItem(pt, new BaseItemStack(3)); } // Soil
|
||||
else if (type == 62) { dropItem(pt, new BaseItemStack(61)); } // Furnace
|
||||
else if (type == 63) { dropItem(pt, new BaseItemStack(323)); } // Sign post
|
||||
else if (type == 64) { dropItem(pt, new BaseItemStack(324)); } // Wood door
|
||||
else if (type == 67) { dropItem(pt, new BaseItemStack(4)); } // Cobblestone stairs
|
||||
else if (type == 68) { dropItem(pt, new BaseItemStack(323)); } // Wall sign
|
||||
else if (type == 71) { dropItem(pt, new BaseItemStack(330)); } // Iron door
|
||||
else if (type == 73) { dropItem(pt, new BaseItemStack(331), (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 == 75) { dropItem(pt, new BaseItemStack(76)); } // Redstone torch
|
||||
else if (type == 78) { } // Snow
|
||||
else if (type == 79) { } // Ice
|
||||
else if (type == 82) { dropItem(pt, new BaseItemStack(337), 4); } // Clay
|
||||
else if (type == 83) { dropItem(pt, new BaseItemStack(338)); } // Reed
|
||||
else if (type == 89) { dropItem(pt, new BaseItemStack(348), (random.nextInt(3)+2)); } // Lightstone
|
||||
else if (type == 90) { } // Portal
|
||||
else if (type == 93) { dropItem(pt, new BaseItemStack(356)); } // Repeater
|
||||
else if (type == 94) { dropItem(pt, new BaseItemStack(356)); } // Repeater
|
||||
else if (type != 0) {
|
||||
else if (type == BlockID.STEP) { dropItem(pt, new BaseItemStack(type, 1, (short) getBlockData(pt))); } // Step
|
||||
else if (type == BlockID.BOOKCASE) { } // Bookshelves
|
||||
else if (type == BlockID.FIRE) { } // Fire
|
||||
else if (type == BlockID.MOB_SPAWNER) { } // Mob spawner
|
||||
else if (type == BlockID.WOODEN_STAIRS) { dropItem(pt, new BaseItemStack(BlockID.WOOD)); } // Wooden stairs
|
||||
else if (type == BlockID.REDSTONE_WIRE) { dropItem(pt, new BaseItemStack(ItemType.REDSTONE_DUST.getID())); } // Redstone wire
|
||||
else if (type == BlockID.DIAMOND_ORE) { dropItem(pt, new BaseItemStack(ItemType.DIAMOND.getID())); } // Diamond ore
|
||||
else if (type == BlockID.CROPS) { dropItem(pt, new BaseItemStack(ItemType.SEEDS.getID())); } // Crops
|
||||
else if (type == BlockID.SOIL) { dropItem(pt, new BaseItemStack(BlockID.DIRT)); } // Soil
|
||||
else if (type == BlockID.BURNING_FURNACE) { dropItem(pt, new BaseItemStack(BlockID.FURNACE)); } // Furnace
|
||||
else if (type == BlockID.SIGN_POST) { dropItem(pt, new BaseItemStack(ItemType.SIGN.getID())); } // Sign post
|
||||
else if (type == BlockID.WOODEN_DOOR) { dropItem(pt, new BaseItemStack(ItemType.WOODEN_DOOR_ITEM.getID())); } // Wood door
|
||||
else if (type == BlockID.COBBLESTONE_STAIRS) { dropItem(pt, new BaseItemStack(BlockID.COBBLESTONE)); } // Cobblestone stairs
|
||||
else if (type == BlockID.WALL_SIGN) { dropItem(pt, new BaseItemStack(ItemType.SIGN.getID())); } // Wall sign
|
||||
else if (type == BlockID.IRON_DOOR) { dropItem(pt, new BaseItemStack(ItemType.IRON_DOOR_ITEM.getID())); } // Iron door
|
||||
else if (type == BlockID.REDSTONE_ORE) { dropItem(pt, new BaseItemStack(ItemType.REDSTONE_DUST.getID()), (random.nextInt(2) + 4)); } // 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 == BlockID.REDSTONE_TORCH_OFF) { dropItem(pt, new BaseItemStack(BlockID.REDSTONE_TORCH_ON)); } // Redstone torch
|
||||
else if (type == BlockID.SNOW) { } // Snow
|
||||
else if (type == BlockID.ICE) { } // Ice
|
||||
else if (type == BlockID.CLAY) { dropItem(pt, new BaseItemStack(ItemType.CLAY_BALL.getID()), 4); } // Clay
|
||||
else if (type == BlockID.REED) { dropItem(pt, new BaseItemStack(ItemType.SUGAR_CANE_ITEM.getID())); } // Reed
|
||||
else if (type == BlockID.LIGHTSTONE) { dropItem(pt, new BaseItemStack(ItemType.LIGHTSTONE_DUST.getID()), (random.nextInt(3) + 2)); } // Lightstone
|
||||
else if (type == BlockID.PORTAL) { } // Portal
|
||||
else if (type == BlockID.REDSTONE_REPEATER_OFF) { dropItem(pt, new BaseItemStack(ItemType.REDSTONE_REPEATER.getID())); } // Repeater
|
||||
else if (type == BlockID.REDSTONE_REPEATER_ON) { dropItem(pt, new BaseItemStack(ItemType.REDSTONE_REPEATER.getID())); } // Repeater
|
||||
else if (type != BlockID.AIR) {
|
||||
dropItem(pt, new BaseItemStack(type));
|
||||
}
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ public class WorldEdit {
|
||||
ClothColor col = ClothColor.lookup(testID);
|
||||
|
||||
if (col != null) {
|
||||
blockType = BlockType.fromID(35);
|
||||
blockType = BlockType.CLOTH;
|
||||
data = col.getID();
|
||||
} else {
|
||||
throw new UnknownItemException(arg);
|
||||
|
@ -85,7 +85,7 @@ public abstract class BlockBag {
|
||||
fetchBlock(BlockID.DIRT);
|
||||
// Look for redstone dust
|
||||
} else if (id == BlockID.REDSTONE_WIRE) {
|
||||
fetchBlock(331);
|
||||
fetchBlock(ItemType.REDSTONE_DUST.getID());
|
||||
// Look for furnace
|
||||
} else if (id == BlockID.BURNING_FURNACE) {
|
||||
fetchBlock(BlockID.FURNACE);
|
||||
@ -94,7 +94,7 @@ public abstract class BlockBag {
|
||||
fetchBlock(BlockID.REDSTONE_TORCH_ON);
|
||||
// Look for signs
|
||||
} else if (id == BlockID.WALL_SIGN || id == BlockID.SIGN_POST) {
|
||||
fetchBlock(323);
|
||||
fetchBlock(ItemType.SIGN.getID());
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
|
@ -108,12 +108,20 @@ public class BaseBlock {
|
||||
data = (byte)BlockData.rotate90Reverse(type, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flip this block.
|
||||
*/
|
||||
public BaseBlock flip() {
|
||||
data = (byte) BlockData.flip(type, data);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Flip this block.
|
||||
* @param direction
|
||||
*/
|
||||
public void flip(FlipDirection direction) {
|
||||
data = (byte)BlockData.flip(type, data, direction);
|
||||
public BaseBlock flip(FlipDirection direction) {
|
||||
data = (byte) BlockData.flip(type, data, direction);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,7 +24,7 @@ package com.sk89q.worldedit.blocks;
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public final class BlockID {
|
||||
public final class BlockID {
|
||||
public static final int AIR = 0;
|
||||
public static final int STONE = 1;
|
||||
public static final int GRASS = 2;
|
||||
|
@ -31,103 +31,103 @@ import com.sk89q.util.StringUtil;
|
||||
* @author sk89q
|
||||
*/
|
||||
public enum BlockType {
|
||||
AIR(0, "Air", "air"),
|
||||
STONE(1, "Stone", "stone", "rock"),
|
||||
GRASS(2, "Grass", "grass"),
|
||||
DIRT(3, "Dirt", "dirt"),
|
||||
COBBLESTONE(4, "Cobblestone", "cobblestone", "cobble"),
|
||||
WOOD(5, "Wood", "wood", "woodplank", "plank", "woodplanks", "planks"),
|
||||
SAPLING(6, "Sapling", "sapling", "seedling"),
|
||||
BEDROCK(7, "Bedrock", "adminium", "bedrock"),
|
||||
WATER(8, "Water", "watermoving", "movingwater", "flowingwater", "waterflowing"),
|
||||
STATIONARY_WATER(9, "Water (stationary)", "water", "waterstationary", "stationarywater", "stillwater"),
|
||||
LAVA(10, "Lava", "lavamoving", "movinglava", "flowinglava", "lavaflowing"),
|
||||
STATIONARY_LAVA(11, "Lava (stationary)", "lava", "lavastationary", "stationarylava", "stilllava"),
|
||||
SAND(12, "Sand", "sand"),
|
||||
GRAVEL(13, "Gravel", "gravel"),
|
||||
GOLD_ORE(14, "Gold ore", "goldore"),
|
||||
IRON_ORE(15, "Iron ore", "ironore"),
|
||||
COAL_ORE(16, "Coal ore", "coalore"),
|
||||
LOG(17, "Log", "log", "tree", "pine", "oak", "birch", "redwood"),
|
||||
LEAVES(18, "Leaves", "leaves", "leaf"),
|
||||
SPONGE(19, "Sponge", "sponge"),
|
||||
GLASS(20, "Glass", "glass"),
|
||||
LAPIS_LAZULI_ORE(21, "Lapis lazuli ore", "lapislazuliore", "blueore", "lapisore"),
|
||||
LAPIS_LAZULI(22, "Lapis lazuli", "lapislazuli", "lapislazuliblock", "bluerock"),
|
||||
DISPENSER(23, "Dispenser", "dispenser"),
|
||||
SANDSTONE(24, "Sandstone", "sandstone"),
|
||||
NOTE_BLOCK(25, "Note block", "musicblock", "noteblock", "note", "music", "instrument"),
|
||||
BED(26, "Bed", "bed"),
|
||||
POWERED_RAIL(27, "Powered Rail", "poweredrail", "boosterrail", "poweredtrack", "boostertrack", "booster"),
|
||||
DETECTOR_RAIL(28, "Detector Rail", "detectorrail", "detector"),
|
||||
PISTON_STICKY_BASE(29, "Sticky Piston", "stickypiston"),
|
||||
WEB(30, "Web", "web", "spiderweb"),
|
||||
LONG_GRASS(31, "Long grass", "longgrass", "tallgrass"),
|
||||
DEAD_BUSH(32, "Shrub", "deadbush", "shrub", "deadshrub", "tumbleweed"),
|
||||
PISTON_BASE(33, "Piston", "piston"),
|
||||
PISTON_EXTENSION(34, "Piston extension", "pistonextendsion", "pistonhead"),
|
||||
CLOTH(35, "Wool", "cloth", "wool"),
|
||||
PISTON_MOVING_PIECE(36, "Piston moving piece", "movingpiston"),
|
||||
YELLOW_FLOWER(37, "Yellow flower", "yellowflower", "flower"),
|
||||
RED_FLOWER(38, "Red rose", "redflower", "redrose", "rose"),
|
||||
BROWN_MUSHROOM(39, "Brown mushroom", "brownmushroom", "mushroom"),
|
||||
RED_MUSHROOM(40, "Red mushroom", "redmushroom"),
|
||||
GOLD_BLOCK(41, "Gold block", "gold", "goldblock"),
|
||||
IRON_BLOCK(42, "Iron block", "iron", "ironblock"),
|
||||
DOUBLE_STEP(43, "Double step", "doubleslab", "doublestoneslab", "doublestep"),
|
||||
STEP(44, "Step", "slab", "stoneslab", "step", "halfstep"),
|
||||
BRICK(45, "Brick", "brick", "brickblock"),
|
||||
TNT(46, "TNT", "tnt", "c4", "explosive"),
|
||||
BOOKCASE(47, "Bookcase", "bookshelf", "bookshelves", "bookcase", "bookcases"),
|
||||
MOSSY_COBBLESTONE(48, "Cobblestone (mossy)", "mossycobblestone", "mossstone", "mossystone", "mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"),
|
||||
OBSIDIAN(49, "Obsidian", "obsidian"),
|
||||
TORCH(50, "Torch", "torch", "light", "candle"),
|
||||
FIRE(51, "Fire", "fire", "flame", "flames"),
|
||||
MOB_SPAWNER(52, "Mob spawner", "mobspawner", "spawner"),
|
||||
WOODEN_STAIRS(53, "Wooden stairs", "woodstair", "woodstairs", "woodenstair", "woodenstairs"),
|
||||
CHEST(54, "Chest", "chest", "storage", "storagechest"),
|
||||
REDSTONE_WIRE(55, "Redstone wire", "redstone", "redstoneblock"),
|
||||
DIAMOND_ORE(56, "Diamond ore", "diamondore"),
|
||||
DIAMOND_BLOCK(57, "Diamond block", "diamond", "diamondblock"),
|
||||
WORKBENCH(58, "Workbench", "workbench", "table", "craftingtable", "crafting"),
|
||||
CROPS(59, "Crops", "crops", "crop", "plant", "plants"),
|
||||
SOIL(60, "Soil", "soil", "farmland"),
|
||||
FURNACE(61, "Furnace", "furnace"),
|
||||
BURNING_FURNACE(62, "Furnace (burning)", "burningfurnace", "litfurnace"),
|
||||
SIGN_POST(63, "Sign post", "sign", "signpost"),
|
||||
WOODEN_DOOR(64, "Wooden door", "wooddoor", "woodendoor", "door"),
|
||||
LADDER(65, "Ladder", "ladder"),
|
||||
MINECART_TRACKS(66, "Minecart tracks", "track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"),
|
||||
COBBLESTONE_STAIRS(67, "Cobblestone stairs", "cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"),
|
||||
WALL_SIGN(68, "Wall sign", "wallsign"),
|
||||
LEVER(69, "Lever", "lever", "switch", "stonelever", "stoneswitch"),
|
||||
STONE_PRESSURE_PLATE(70, "Stone pressure plate", "stonepressureplate", "stoneplate"),
|
||||
IRON_DOOR(71, "Iron Door", "irondoor"),
|
||||
WOODEN_PRESSURE_PLATE(72, "Wooden pressure plate", "woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate", "plate", "pressureplate"),
|
||||
REDSTONE_ORE(73, "Redstone ore", "redstoneore"),
|
||||
GLOWING_REDSTONE_ORE(74, "Glowing redstone ore", "glowingredstoneore"),
|
||||
REDSTONE_TORCH_OFF(75, "Redstone torch (off)", "redstonetorchoff", "rstorchoff"),
|
||||
REDSTONE_TORCH_ON(76, "Redstone torch (on)", "redstonetorch", "redstonetorchon", "rstorchon", "redtorch"),
|
||||
STONE_BUTTON(77, "Stone Button", "stonebutton", "button"),
|
||||
SNOW(78, "Snow", "snow"),
|
||||
ICE(79, "Ice", "ice"),
|
||||
SNOW_BLOCK(80, "Snow block", "snowblock"),
|
||||
CACTUS(81, "Cactus", "cactus", "cacti"),
|
||||
CLAY(82, "Clay", "clay"),
|
||||
SUGAR_CANE(83, "Reed", "reed", "cane", "sugarcane", "sugarcanes", "vine", "vines"),
|
||||
JUKEBOX(84, "Jukebox", "jukebox", "stereo", "recordplayer"),
|
||||
FENCE(85, "Fence", "fence"),
|
||||
PUMPKIN(86, "Pumpkin", "pumpkin"),
|
||||
NETHERRACK(87, "Netherrack", "redmossycobblestone", "redcobblestone", "redmosstone", "redcobble", "netherstone", "netherrack", "nether", "hellstone"),
|
||||
SOUL_SAND(88, "Soul sand", "slowmud", "mud", "soulsand", "hellmud"),
|
||||
GLOWSTONE(89, "Glowstone", "brittlegold", "glowstone", "lightstone", "brimstone", "australium"),
|
||||
PORTAL(90, "Portal", "portal"),
|
||||
JACK_O_LANTERN(91, "Pumpkin (on)", "pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"),
|
||||
CAKE(92, "Cake", "cake", "cakeblock"),
|
||||
REDSTONE_REPEATER_OFF(93, "Redstone repeater (off)", "diodeoff", "redstonerepeater", "repeater", "delayer"),
|
||||
REDSTONE_REPEATER_ON(94, "Redstone repeater (on)", "diode", "diodeon", "redstonerepeateron", "repeateron", "delayeron"),
|
||||
LOCKED_CHEST(95, "Locked chest", "lockedchest", "steveco", "supplycrate", "valveneedstoworkonep3nottf2kthx"),
|
||||
TRAP_DOOR(96, "Trap door", "trapdoor", "hatch", "floordoor");
|
||||
AIR(BlockID.AIR, "Air", "air"),
|
||||
STONE(BlockID.STONE, "Stone", "stone", "rock"),
|
||||
GRASS(BlockID.GRASS, "Grass", "grass"),
|
||||
DIRT(BlockID.DIRT, "Dirt", "dirt"),
|
||||
COBBLESTONE(BlockID.COBBLESTONE, "Cobblestone", "cobblestone", "cobble"),
|
||||
WOOD(BlockID.WOOD, "Wood", "wood", "woodplank", "plank", "woodplanks", "planks"),
|
||||
SAPLING(BlockID.SAPLING, "Sapling", "sapling", "seedling"),
|
||||
BEDROCK(BlockID.BEDROCK, "Bedrock", "adminium", "bedrock"),
|
||||
WATER(BlockID.WATER, "Water", "watermoving", "movingwater", "flowingwater", "waterflowing"),
|
||||
STATIONARY_WATER(BlockID.STATIONARY_WATER, "Water (stationary)", "water", "waterstationary", "stationarywater", "stillwater"),
|
||||
LAVA(BlockID.LAVA, "Lava", "lavamoving", "movinglava", "flowinglava", "lavaflowing"),
|
||||
STATIONARY_LAVA(BlockID.STATIONARY_LAVA, "Lava (stationary)", "lava", "lavastationary", "stationarylava", "stilllava"),
|
||||
SAND(BlockID.SAND, "Sand", "sand"),
|
||||
GRAVEL(BlockID.GRAVEL, "Gravel", "gravel"),
|
||||
GOLD_ORE(BlockID.GOLD_ORE, "Gold ore", "goldore"),
|
||||
IRON_ORE(BlockID.IRON_ORE, "Iron ore", "ironore"),
|
||||
COAL_ORE(BlockID.COAL_ORE, "Coal ore", "coalore"),
|
||||
LOG(BlockID.LOG, "Log", "log", "tree", "pine", "oak", "birch", "redwood"),
|
||||
LEAVES(BlockID.LEAVES, "Leaves", "leaves", "leaf"),
|
||||
SPONGE(BlockID.SPONGE, "Sponge", "sponge"),
|
||||
GLASS(BlockID.GLASS, "Glass", "glass"),
|
||||
LAPIS_LAZULI_ORE(BlockID.LAPIS_LAZULI_ORE, "Lapis lazuli ore", "lapislazuliore", "blueore", "lapisore"),
|
||||
LAPIS_LAZULI(BlockID.LAPIS_LAZULI_BLOCK, "Lapis lazuli", "lapislazuli", "lapislazuliblock", "bluerock"),
|
||||
DISPENSER(BlockID.DISPENSER, "Dispenser", "dispenser"),
|
||||
SANDSTONE(BlockID.SANDSTONE, "Sandstone", "sandstone"),
|
||||
NOTE_BLOCK(BlockID.NOTE_BLOCK, "Note block", "musicblock", "noteblock", "note", "music", "instrument"),
|
||||
BED(BlockID.BED, "Bed", "bed"),
|
||||
POWERED_RAIL(BlockID.POWERED_RAIL, "Powered Rail", "poweredrail", "boosterrail", "poweredtrack", "boostertrack", "booster"),
|
||||
DETECTOR_RAIL(BlockID.DETECTOR_RAIL, "Detector Rail", "detectorrail", "detector"),
|
||||
PISTON_STICKY_BASE(BlockID.PISTON_STICKY_BASE, "Sticky Piston", "stickypiston"),
|
||||
WEB(BlockID.WEB, "Web", "web", "spiderweb"),
|
||||
LONG_GRASS(BlockID.LONG_GRASS, "Long grass", "longgrass", "tallgrass"),
|
||||
DEAD_BUSH(BlockID.DEAD_BUSH, "Shrub", "deadbush", "shrub", "deadshrub", "tumbleweed"),
|
||||
PISTON_BASE(BlockID.PISTON_BASE, "Piston", "piston"),
|
||||
PISTON_EXTENSION(BlockID.PISTON_EXTENSION, "Piston extension", "pistonextendsion", "pistonhead"),
|
||||
CLOTH(BlockID.CLOTH, "Wool", "cloth", "wool"),
|
||||
PISTON_MOVING_PIECE(BlockID.PISTON_MOVING_PIECE, "Piston moving piece", "movingpiston"),
|
||||
YELLOW_FLOWER(BlockID.YELLOW_FLOWER, "Yellow flower", "yellowflower", "flower"),
|
||||
RED_FLOWER(BlockID.RED_FLOWER, "Red rose", "redflower", "redrose", "rose"),
|
||||
BROWN_MUSHROOM(BlockID.BROWN_MUSHROOM, "Brown mushroom", "brownmushroom", "mushroom"),
|
||||
RED_MUSHROOM(BlockID.RED_MUSHROOM, "Red mushroom", "redmushroom"),
|
||||
GOLD_BLOCK(BlockID.GOLD_BLOCK, "Gold block", "gold", "goldblock"),
|
||||
IRON_BLOCK(BlockID.IRON_BLOCK, "Iron block", "iron", "ironblock"),
|
||||
DOUBLE_STEP(BlockID.DOUBLE_STEP, "Double step", "doubleslab", "doublestoneslab", "doublestep"),
|
||||
STEP(BlockID.STEP, "Step", "slab", "stoneslab", "step", "halfstep"),
|
||||
BRICK(BlockID.BRICK, "Brick", "brick", "brickblock"),
|
||||
TNT(BlockID.TNT, "TNT", "tnt", "c4", "explosive"),
|
||||
BOOKCASE(BlockID.BOOKCASE, "Bookcase", "bookshelf", "bookshelves", "bookcase", "bookcases"),
|
||||
MOSSY_COBBLESTONE(BlockID.MOSSY_COBBLESTONE, "Cobblestone (mossy)", "mossycobblestone", "mossstone", "mossystone", "mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"),
|
||||
OBSIDIAN(BlockID.OBSIDIAN, "Obsidian", "obsidian"),
|
||||
TORCH(BlockID.TORCH, "Torch", "torch", "light", "candle"),
|
||||
FIRE(BlockID.FIRE, "Fire", "fire", "flame", "flames"),
|
||||
MOB_SPAWNER(BlockID.MOB_SPAWNER, "Mob spawner", "mobspawner", "spawner"),
|
||||
WOODEN_STAIRS(BlockID.WOODEN_STAIRS, "Wooden stairs", "woodstair", "woodstairs", "woodenstair", "woodenstairs"),
|
||||
CHEST(BlockID.CHEST, "Chest", "chest", "storage", "storagechest"),
|
||||
REDSTONE_WIRE(BlockID.REDSTONE_WIRE, "Redstone wire", "redstone", "redstoneblock"),
|
||||
DIAMOND_ORE(BlockID.DIAMOND_ORE, "Diamond ore", "diamondore"),
|
||||
DIAMOND_BLOCK(BlockID.DIAMOND_BLOCK, "Diamond block", "diamond", "diamondblock"),
|
||||
WORKBENCH(BlockID.WORKBENCH, "Workbench", "workbench", "table", "craftingtable", "crafting"),
|
||||
CROPS(BlockID.CROPS, "Crops", "crops", "crop", "plant", "plants"),
|
||||
SOIL(BlockID.SOIL, "Soil", "soil", "farmland"),
|
||||
FURNACE(BlockID.FURNACE, "Furnace", "furnace"),
|
||||
BURNING_FURNACE(BlockID.BURNING_FURNACE, "Furnace (burning)", "burningfurnace", "litfurnace"),
|
||||
SIGN_POST(BlockID.SIGN_POST, "Sign post", "sign", "signpost"),
|
||||
WOODEN_DOOR(BlockID.WOODEN_DOOR, "Wooden door", "wooddoor", "woodendoor", "door"),
|
||||
LADDER(BlockID.LADDER, "Ladder", "ladder"),
|
||||
MINECART_TRACKS(BlockID.MINECART_TRACKS, "Minecart tracks", "track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"),
|
||||
COBBLESTONE_STAIRS(BlockID.COBBLESTONE_STAIRS, "Cobblestone stairs", "cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"),
|
||||
WALL_SIGN(BlockID.WALL_SIGN, "Wall sign", "wallsign"),
|
||||
LEVER(BlockID.LEVER, "Lever", "lever", "switch", "stonelever", "stoneswitch"),
|
||||
STONE_PRESSURE_PLATE(BlockID.STONE_PRESSURE_PLATE, "Stone pressure plate", "stonepressureplate", "stoneplate"),
|
||||
IRON_DOOR(BlockID.IRON_DOOR, "Iron Door", "irondoor"),
|
||||
WOODEN_PRESSURE_PLATE(BlockID.WOODEN_PRESSURE_PLATE, "Wooden pressure plate", "woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate", "plate", "pressureplate"),
|
||||
REDSTONE_ORE(BlockID.REDSTONE_ORE, "Redstone ore", "redstoneore"),
|
||||
GLOWING_REDSTONE_ORE(BlockID.GLOWING_REDSTONE_ORE, "Glowing redstone ore", "glowingredstoneore"),
|
||||
REDSTONE_TORCH_OFF(BlockID.REDSTONE_TORCH_OFF, "Redstone torch (off)", "redstonetorchoff", "rstorchoff"),
|
||||
REDSTONE_TORCH_ON(BlockID.REDSTONE_TORCH_ON, "Redstone torch (on)", "redstonetorch", "redstonetorchon", "rstorchon", "redtorch"),
|
||||
STONE_BUTTON(BlockID.STONE_BUTTON, "Stone Button", "stonebutton", "button"),
|
||||
SNOW(BlockID.SNOW, "Snow", "snow"),
|
||||
ICE(BlockID.ICE, "Ice", "ice"),
|
||||
SNOW_BLOCK(BlockID.SNOW_BLOCK, "Snow block", "snowblock"),
|
||||
CACTUS(BlockID.CACTUS, "Cactus", "cactus", "cacti"),
|
||||
CLAY(BlockID.CLAY, "Clay", "clay"),
|
||||
SUGAR_CANE(BlockID.REED, "Reed", "reed", "cane", "sugarcane", "sugarcanes", "vine", "vines"),
|
||||
JUKEBOX(BlockID.JUKEBOX, "Jukebox", "jukebox", "stereo", "recordplayer"),
|
||||
FENCE(BlockID.FENCE, "Fence", "fence"),
|
||||
PUMPKIN(BlockID.PUMPKIN, "Pumpkin", "pumpkin"),
|
||||
NETHERRACK(BlockID.NETHERRACK, "Netherrack", "redmossycobblestone", "redcobblestone", "redmosstone", "redcobble", "netherstone", "netherrack", "nether", "hellstone"),
|
||||
SOUL_SAND(BlockID.SLOW_SAND, "Soul sand", "slowmud", "mud", "soulsand", "hellmud"),
|
||||
GLOWSTONE(BlockID.LIGHTSTONE, "Glowstone", "brittlegold", "glowstone", "lightstone", "brimstone", "australium"),
|
||||
PORTAL(BlockID.PORTAL, "Portal", "portal"),
|
||||
JACK_O_LANTERN(BlockID.JACKOLANTERN, "Pumpkin (on)", "pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"),
|
||||
CAKE(BlockID.CAKE_BLOCK, "Cake", "cake", "cakeblock"),
|
||||
REDSTONE_REPEATER_OFF(BlockID.REDSTONE_REPEATER_OFF, "Redstone repeater (off)", "diodeoff", "redstonerepeater", "repeateroff", "delayeroff"),
|
||||
REDSTONE_REPEATER_ON(BlockID.REDSTONE_REPEATER_ON, "Redstone repeater (on)", "diodeon", "redstonerepeateron", "repeateron", "delayeron"),
|
||||
LOCKED_CHEST(BlockID.LOCKED_CHEST, "Locked chest", "lockedchest", "steveco", "supplycrate", "valveneedstoworkonep3nottf2kthx"),
|
||||
TRAP_DOOR(BlockID.TRAP_DOOR, "Trap door", "trapdoor", "hatch", "floordoor");
|
||||
|
||||
/**
|
||||
* Stores a list of dropped blocks for blocks.
|
||||
@ -362,40 +362,40 @@ public enum BlockType {
|
||||
* @return
|
||||
*/
|
||||
public static boolean shouldPlaceLast(int id) {
|
||||
return id == 6 // Saplings
|
||||
|| id == 26 // Beds
|
||||
|| id == 27 // Powered rails
|
||||
|| id == 28 // Detector rails
|
||||
|| id == 31 // Long grass
|
||||
|| id == 32 // Shrub
|
||||
|| id == 37 // Yellow flower
|
||||
|| id == 38 // Red flower
|
||||
|| id == 39 // Brown mushroom
|
||||
|| id == 40 // Red mush room
|
||||
|| id == 50 // Torch
|
||||
|| id == 51 // Fire
|
||||
|| id == 55 // Redstone wire
|
||||
|| id == 59 // Crops
|
||||
|| id == 63 // Sign post
|
||||
|| id == 64 // Wooden door
|
||||
|| id == 65 // Ladder
|
||||
|| id == 66 // Minecart tracks
|
||||
|| id == 68 // Wall sign
|
||||
|| id == 69 // Lever
|
||||
|| id == 70 // Stone pressure plate
|
||||
|| id == 71 // Iron door
|
||||
|| id == 72 // Wooden pressure plate
|
||||
|| id == 75 // Redstone torch (off)
|
||||
|| id == 76 // Redstone torch (on)
|
||||
|| id == 77 // Stone button
|
||||
|| id == 78 // Snow
|
||||
|| id == 81 // Cactus
|
||||
|| id == 83 // Reed
|
||||
|| id == 90 // Portal
|
||||
|| id == 92 // Cake
|
||||
|| id == 93 // Repeater (off)
|
||||
|| id == 94 // Repeater (on)
|
||||
|| id == 96; // Trap door
|
||||
return id == BlockID.SAPLING
|
||||
|| id == BlockID.BED
|
||||
|| id == BlockID.POWERED_RAIL
|
||||
|| id == BlockID.DETECTOR_RAIL
|
||||
|| id == BlockID.LONG_GRASS
|
||||
|| id == BlockID.DEAD_BUSH
|
||||
|| id == BlockID.YELLOW_FLOWER
|
||||
|| id == BlockID.RED_FLOWER
|
||||
|| id == BlockID.BROWN_MUSHROOM
|
||||
|| id == BlockID.RED_MUSHROOM
|
||||
|| id == BlockID.TORCH
|
||||
|| id == BlockID.FIRE
|
||||
|| id == BlockID.REDSTONE_WIRE
|
||||
|| id == BlockID.CROPS
|
||||
|| id == BlockID.SIGN_POST
|
||||
|| id == BlockID.WOODEN_DOOR
|
||||
|| id == BlockID.LADDER
|
||||
|| id == BlockID.MINECART_TRACKS
|
||||
|| id == BlockID.WALL_SIGN
|
||||
|| id == BlockID.LEVER
|
||||
|| id == BlockID.STONE_PRESSURE_PLATE
|
||||
|| id == BlockID.IRON_DOOR
|
||||
|| id == BlockID.WOODEN_PRESSURE_PLATE
|
||||
|| id == BlockID.REDSTONE_TORCH_OFF
|
||||
|| id == BlockID.REDSTONE_TORCH_ON
|
||||
|| id == BlockID.STONE_BUTTON
|
||||
|| id == BlockID.SNOW
|
||||
|| id == BlockID.CACTUS
|
||||
|| id == BlockID.REED
|
||||
|| id == BlockID.PORTAL
|
||||
|| id == BlockID.CAKE_BLOCK
|
||||
|| id == BlockID.REDSTONE_REPEATER_OFF
|
||||
|| id == BlockID.REDSTONE_REPEATER_ON
|
||||
|| id == BlockID.TRAP_DOOR;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -405,38 +405,38 @@ public enum BlockType {
|
||||
* @return
|
||||
*/
|
||||
public static boolean canPassThrough(int id) {
|
||||
return id == 0 // Air
|
||||
|| id == 8 // Water
|
||||
|| id == 9 // Water
|
||||
|| id == 6 // Saplings
|
||||
|| id == 27 // Powered rails
|
||||
|| id == 28 // Detector rails
|
||||
|| id == 30 // Web <- someone will hate me for this
|
||||
|| id == 31 // Long grass
|
||||
|| id == 32 // Shrub
|
||||
|| id == 37 // Yellow flower
|
||||
|| id == 38 // Red flower
|
||||
|| id == 39 // Brown mushroom
|
||||
|| id == 40 // Red mush room
|
||||
|| id == 50 // Torch
|
||||
|| id == 51 // Fire
|
||||
|| id == 55 // Redstone wire
|
||||
|| id == 59 // Crops
|
||||
|| id == 63 // Sign post
|
||||
|| id == 65 // Ladder
|
||||
|| id == 66 // Minecart tracks
|
||||
|| id == 68 // Wall sign
|
||||
|| id == 69 // Lever
|
||||
|| id == 70 // Stone pressure plate
|
||||
|| id == 72 // Wooden pressure plate
|
||||
|| id == 75 // Redstone torch (off)
|
||||
|| id == 76 // Redstone torch (on)
|
||||
|| id == 77 // Stone button
|
||||
|| id == 78 // Snow
|
||||
|| id == 83 // Reed
|
||||
|| id == 90 // Portal
|
||||
|| id == 93 // Diode (off)
|
||||
|| id == 94; // Diode (on)
|
||||
return id == BlockID.AIR
|
||||
|| id == BlockID.WATER
|
||||
|| id == BlockID.STATIONARY_WATER
|
||||
|| id == BlockID.SAPLING
|
||||
|| id == BlockID.POWERED_RAIL
|
||||
|| id == BlockID.DETECTOR_RAIL
|
||||
|| id == BlockID.WEB
|
||||
|| id == BlockID.LONG_GRASS
|
||||
|| id == BlockID.DEAD_BUSH
|
||||
|| id == BlockID.YELLOW_FLOWER
|
||||
|| id == BlockID.RED_FLOWER
|
||||
|| id == BlockID.BROWN_MUSHROOM
|
||||
|| id == BlockID.RED_MUSHROOM
|
||||
|| id == BlockID.TORCH
|
||||
|| id == BlockID.FIRE
|
||||
|| id == BlockID.REDSTONE_WIRE
|
||||
|| id == BlockID.CROPS
|
||||
|| id == BlockID.SIGN_POST
|
||||
|| id == BlockID.LADDER
|
||||
|| id == BlockID.MINECART_TRACKS
|
||||
|| id == BlockID.WALL_SIGN
|
||||
|| id == BlockID.LEVER
|
||||
|| id == BlockID.STONE_PRESSURE_PLATE
|
||||
|| id == BlockID.WOODEN_PRESSURE_PLATE
|
||||
|| id == BlockID.REDSTONE_TORCH_OFF
|
||||
|| id == BlockID.REDSTONE_TORCH_ON
|
||||
|| id == BlockID.STONE_BUTTON
|
||||
|| id == BlockID.SNOW
|
||||
|| id == BlockID.REED
|
||||
|| id == BlockID.PORTAL
|
||||
|| id == BlockID.REDSTONE_REPEATER_OFF
|
||||
|| id == BlockID.REDSTONE_REPEATER_ON;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -446,53 +446,53 @@ public enum BlockType {
|
||||
* @return
|
||||
*/
|
||||
public static boolean usesData(int id) {
|
||||
return id == 6 // Saplings
|
||||
|| id == 8 // Water
|
||||
|| id == 9 // Water
|
||||
|| id == 10 // Lava
|
||||
|| id == 11 // Lava
|
||||
|| id == 17 // Wood
|
||||
|| id == 18 // Leaves
|
||||
|| id == 23 // Dispenser
|
||||
|| id == 25 // Note Block
|
||||
|| id == 26 // Bed
|
||||
|| id == 27 // Powered rails
|
||||
|| id == 28 // Detector rails
|
||||
|| id == 29 // Sticky piston
|
||||
|| id == 31 // Tall grass
|
||||
|| id == 33 // Piston
|
||||
|| id == 34 // Piston extension
|
||||
|| id == 35 // Wool
|
||||
|| id == 43 // Double slab
|
||||
|| id == 44 // Slab
|
||||
|| id == 50 // Torch
|
||||
|| id == 53 // Wooden stairs
|
||||
|| id == 55 // Redstone wire
|
||||
|| id == 59 // Crops
|
||||
|| id == 60 // Soil
|
||||
|| id == 61 // Furnace
|
||||
|| id == 62 // Furnace
|
||||
|| id == 63 // Sign post
|
||||
|| id == 64 // Wooden door
|
||||
|| id == 65 // Ladder
|
||||
|| id == 66 // Minecart track
|
||||
|| id == 67 // Cobblestone stairs
|
||||
|| id == 68 // Wall sign
|
||||
|| id == 69 // Lever
|
||||
|| id == 70 // Stone pressure plate
|
||||
|| id == 71 // Iron door
|
||||
|| id == 72 // Wooden pressure plate
|
||||
|| id == 75 // Redstone torch (off)
|
||||
|| id == 76 // Redstone torch (on)
|
||||
|| id == 77 // Stone button
|
||||
|| id == 78 // Snow tile
|
||||
|| id == 81 // Cactus
|
||||
|| id == 86 // Pumpkin
|
||||
|| id == 91 // Jack-o-lantern
|
||||
|| id == 92 // Cake
|
||||
|| id == 93 // Redstone repeater (off)
|
||||
|| id == 94 // Redstone repeater (on)
|
||||
|| id == 96; // Trap door
|
||||
return id == BlockID.SAPLING
|
||||
|| id == BlockID.WATER
|
||||
|| id == BlockID.STATIONARY_WATER
|
||||
|| id == BlockID.LAVA
|
||||
|| id == BlockID.STATIONARY_LAVA
|
||||
|| id == BlockID.LOG
|
||||
|| id == BlockID.LEAVES
|
||||
|| id == BlockID.DISPENSER
|
||||
|| id == BlockID.NOTE_BLOCK
|
||||
|| id == BlockID.BED
|
||||
|| id == BlockID.POWERED_RAIL
|
||||
|| id == BlockID.DETECTOR_RAIL
|
||||
|| id == BlockID.PISTON_STICKY_BASE
|
||||
|| id == BlockID.LONG_GRASS
|
||||
|| id == BlockID.PISTON_BASE
|
||||
|| id == BlockID.PISTON_EXTENSION
|
||||
|| id == BlockID.CLOTH
|
||||
|| id == BlockID.DOUBLE_STEP
|
||||
|| id == BlockID.STEP
|
||||
|| id == BlockID.TORCH
|
||||
|| id == BlockID.WOODEN_STAIRS
|
||||
|| id == BlockID.REDSTONE_WIRE
|
||||
|| id == BlockID.CROPS
|
||||
|| id == BlockID.SOIL
|
||||
|| id == BlockID.FURNACE
|
||||
|| id == BlockID.BURNING_FURNACE
|
||||
|| id == BlockID.SIGN_POST
|
||||
|| id == BlockID.WOODEN_DOOR
|
||||
|| id == BlockID.LADDER
|
||||
|| id == BlockID.MINECART_TRACKS
|
||||
|| id == BlockID.COBBLESTONE_STAIRS
|
||||
|| id == BlockID.WALL_SIGN
|
||||
|| id == BlockID.LEVER
|
||||
|| id == BlockID.STONE_PRESSURE_PLATE
|
||||
|| id == BlockID.IRON_DOOR
|
||||
|| id == BlockID.WOODEN_PRESSURE_PLATE
|
||||
|| id == BlockID.REDSTONE_TORCH_OFF
|
||||
|| id == BlockID.REDSTONE_TORCH_ON
|
||||
|| id == BlockID.STONE_BUTTON
|
||||
|| id == BlockID.SNOW
|
||||
|| id == BlockID.CACTUS
|
||||
|| id == BlockID.PUMPKIN
|
||||
|| id == BlockID.JACKOLANTERN
|
||||
|| id == BlockID.CAKE_BLOCK
|
||||
|| id == BlockID.REDSTONE_REPEATER_OFF
|
||||
|| id == BlockID.REDSTONE_REPEATER_ON
|
||||
|| id == BlockID.TRAP_DOOR;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -502,10 +502,10 @@ public enum BlockType {
|
||||
* @return
|
||||
*/
|
||||
public static boolean isContainerBlock(int id) {
|
||||
return id == 23 // Dispenser
|
||||
|| id == 61 // Furnace
|
||||
|| id == 62 // Furnace
|
||||
|| id == 54; // Chest
|
||||
return id == BlockID.DISPENSER
|
||||
|| id == BlockID.FURNACE
|
||||
|| id == BlockID.BURNING_FURNACE
|
||||
|| id == BlockID.CHEST;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -515,24 +515,24 @@ public enum BlockType {
|
||||
* @return
|
||||
*/
|
||||
public static boolean isRedstoneBlock(int id) {
|
||||
return id == 27 // Powered rail
|
||||
|| id == 28 // Detector rail
|
||||
|| id == 29 // Sticky piston
|
||||
|| id == 33 // Piston
|
||||
|| id == 69 // Lever
|
||||
|| id == 70 // Stone pressure plate
|
||||
|| id == 72 // Wood pressure plate
|
||||
|| id == 76 // Redstone torch
|
||||
|| id == 75 // Redstone torch
|
||||
|| id == 77 // Stone button
|
||||
|| id == 55 // Redstone wire
|
||||
|| id == 64 // Wooden door
|
||||
|| id == 71 // Iron door
|
||||
|| id == 46 // TNT
|
||||
|| id == 23 // Dispenser
|
||||
|| id == 25 // Note block
|
||||
|| id == 93 // Diode (off)
|
||||
|| id == 94; // Diode (on)
|
||||
return id == BlockID.POWERED_RAIL
|
||||
|| id == BlockID.DETECTOR_RAIL
|
||||
|| id == BlockID.PISTON_STICKY_BASE
|
||||
|| id == BlockID.PISTON_BASE
|
||||
|| id == BlockID.LEVER
|
||||
|| id == BlockID.STONE_PRESSURE_PLATE
|
||||
|| id == BlockID.WOODEN_PRESSURE_PLATE
|
||||
|| id == BlockID.REDSTONE_TORCH_OFF
|
||||
|| id == BlockID.REDSTONE_TORCH_ON
|
||||
|| id == BlockID.STONE_BUTTON
|
||||
|| id == BlockID.REDSTONE_WIRE
|
||||
|| id == BlockID.WOODEN_DOOR
|
||||
|| id == BlockID.IRON_DOOR
|
||||
|| id == BlockID.TNT
|
||||
|| id == BlockID.DISPENSER
|
||||
|| id == BlockID.NOTE_BLOCK
|
||||
|| id == BlockID.REDSTONE_REPEATER_OFF
|
||||
|| id == BlockID.REDSTONE_REPEATER_ON;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -543,12 +543,11 @@ public enum BlockType {
|
||||
* @return
|
||||
*/
|
||||
public static boolean canTransferRedstone(int id) {
|
||||
return id == 27 // Powered rail
|
||||
|| id == 75 // Redstone torch (off)
|
||||
|| id == 76 // Redstone torch (on)
|
||||
|| id == 55 // Redstone wire
|
||||
|| id == 93 // Diode (off)
|
||||
|| id == 94; // Diode (on)
|
||||
return id == BlockID.REDSTONE_TORCH_OFF
|
||||
|| id == BlockID.REDSTONE_TORCH_ON
|
||||
|| id == BlockID.REDSTONE_WIRE
|
||||
|| id == BlockID.REDSTONE_REPEATER_OFF
|
||||
|| id == BlockID.REDSTONE_REPEATER_ON;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -558,13 +557,13 @@ public enum BlockType {
|
||||
* @return
|
||||
*/
|
||||
public static boolean isRedstoneSource(int id) {
|
||||
return id == 28 // Detector rail
|
||||
|| id == 75 // Redstone torch (off)
|
||||
|| id == 76 // Redstone torch (on)
|
||||
|| id == 69 // Lever
|
||||
|| id == 70 // Stone plate
|
||||
|| id == 72 // Wood plate
|
||||
|| id == 77; // Button
|
||||
return id == BlockID.DETECTOR_RAIL
|
||||
|| id == BlockID.REDSTONE_TORCH_OFF
|
||||
|| id == BlockID.REDSTONE_TORCH_ON
|
||||
|| id == BlockID.LEVER
|
||||
|| id == BlockID.STONE_PRESSURE_PLATE
|
||||
|| id == BlockID.WOODEN_PRESSURE_PLATE
|
||||
|| id == BlockID.STONE_BUTTON;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -574,9 +573,38 @@ public enum BlockType {
|
||||
* @return
|
||||
*/
|
||||
public static boolean isRailBlock(int id) {
|
||||
return id == 27 // Powered rail
|
||||
|| id == 28 // Detector rail
|
||||
|| id == 66; // Normal rail
|
||||
return id == BlockID.POWERED_RAIL
|
||||
|| id == BlockID.DETECTOR_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) {
|
||||
Integer dropped = blockDrops.get(id);
|
||||
if (dropped == null) {
|
||||
return 0;
|
||||
return BlockID.AIR;
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class ChestBlock extends BaseBlock implements TileEntityBlock, ContainerB
|
||||
* Construct the chest block.
|
||||
*/
|
||||
public ChestBlock() {
|
||||
super(54);
|
||||
super(BlockID.CHEST);
|
||||
items = new BaseItemStack[27];
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ public class ChestBlock extends BaseBlock implements TileEntityBlock, ContainerB
|
||||
* @param data
|
||||
*/
|
||||
public ChestBlock(int data) {
|
||||
super(54, data);
|
||||
super(BlockID.CHEST, data);
|
||||
items = new BaseItemStack[27];
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ public class ChestBlock extends BaseBlock implements TileEntityBlock, ContainerB
|
||||
* @param items
|
||||
*/
|
||||
public ChestBlock(int data, BaseItemStack[] items) {
|
||||
super(54, data);
|
||||
super(BlockID.CHEST, data);
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
|
@ -38,31 +38,31 @@ public class DispenserBlock extends BaseBlock implements TileEntityBlock, Contai
|
||||
private BaseItemStack[] items;
|
||||
|
||||
/**
|
||||
* Construct the chest block.
|
||||
* Construct the dispenser block.
|
||||
*/
|
||||
public DispenserBlock() {
|
||||
super(54);
|
||||
super(BlockID.DISPENSER);
|
||||
items = new BaseItemStack[9];
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct the chest block.
|
||||
* Construct the dispenser block.
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
public DispenserBlock(int data) {
|
||||
super(23, data);
|
||||
super(BlockID.DISPENSER, data);
|
||||
items = new BaseItemStack[9];
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct the chest block.
|
||||
* Construct the dispenser block.
|
||||
*
|
||||
* @param data
|
||||
* @param items
|
||||
*/
|
||||
public DispenserBlock(int data, BaseItemStack[] items) {
|
||||
super(23, data);
|
||||
super(BlockID.DISPENSER, data);
|
||||
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))
|
||||
.getValue();
|
||||
|
||||
if (slot >= 0 && slot <= 26) {
|
||||
if (slot >= 0 && slot <= 8) {
|
||||
newItems[slot] = new BaseItemStack(id, count, damage);
|
||||
}
|
||||
}
|
||||
|
@ -33,103 +33,103 @@ import com.sk89q.util.StringUtil;
|
||||
*/
|
||||
public enum ItemType {
|
||||
// Blocks
|
||||
AIR(0, "Air", "air"),
|
||||
STONE(1, "Stone", "stone", "rock"),
|
||||
GRASS(2, "Grass", "grass"),
|
||||
DIRT(3, "Dirt", "dirt"),
|
||||
COBBLESTONE(4, "Cobblestone", "cobblestone", "cobble"),
|
||||
WOOD(5, "Wood", "wood", "woodplank", "plank", "woodplanks", "planks"),
|
||||
SAPLING(6, "Sapling", "sapling", "seedling"),
|
||||
BEDROCK(7, "Bedrock", "adminium", "bedrock"),
|
||||
WATER(8, "Water", "watermoving", "movingwater", "flowingwater", "waterflowing"),
|
||||
STATIONARY_WATER(9, "Water (stationary)", "water", "waterstationary", "stationarywater", "stillwater"),
|
||||
LAVA(10, "Lava", "lavamoving", "movinglava", "flowinglava", "lavaflowing"),
|
||||
STATIONARY_LAVA(11, "Lava (stationary)", "lava", "lavastationary", "stationarylava", "stilllava"),
|
||||
SAND(12, "Sand", "sand"),
|
||||
GRAVEL(13, "Gravel", "gravel"),
|
||||
GOLD_ORE(14, "Gold ore", "goldore"),
|
||||
IRON_ORE(15, "Iron ore", "ironore"),
|
||||
COAL_ORE(16, "Coal ore", "coalore"),
|
||||
LOG(17, "Log", "log", "tree", "pine", "oak", "birch", "redwood"),
|
||||
LEAVES(18, "Leaves", "leaves", "leaf"),
|
||||
SPONGE(19, "Sponge", "sponge"),
|
||||
GLASS(20, "Glass", "glass"),
|
||||
LAPIS_LAZULI_ORE(21, "Lapis lazuli ore", "lapislazuliore", "blueore", "lapisore"),
|
||||
LAPIS_LAZULI(22, "Lapis lazuli", "lapislazuli", "lapislazuliblock", "bluerock"),
|
||||
DISPENSER(23, "Dispenser", "dispenser"),
|
||||
SANDSTONE(24, "Sandstone", "sandstone"),
|
||||
NOTE_BLOCK(25, "Note block", "musicblock", "noteblock", "note", "music", "instrument"),
|
||||
BED(26, "Bed", "bed"),
|
||||
POWERED_RAIL(27, "Powered Rail", "poweredrail", "boosterrail", "poweredtrack", "boostertrack", "booster"),
|
||||
DETECTOR_RAIL(28, "Detector Rail", "detectorrail", "detector"),
|
||||
PISTON_STICKY_BASE(29, "Sticky Piston", "stickypiston"),
|
||||
WEB(30, "Web", "web", "spiderweb"),
|
||||
LONG_GRASS(31, "Long grass", "longgrass", "tallgrass"),
|
||||
DEAD_BUSH(32, "Shrub", "deadbush", "shrub", "deadshrub", "tumbleweed"),
|
||||
PISTON_BASE(33, "Piston", "piston"),
|
||||
PISTON_EXTENSION(34, "Piston extension", "pistonhead"),
|
||||
CLOTH(35, "Wool", "cloth", "wool"),
|
||||
PISTON_MOVING_PIECE(36, "Piston moving piece", "movingpiston"),
|
||||
YELLOW_FLOWER(37, "Yellow flower", "yellowflower", "flower"),
|
||||
RED_FLOWER(38, "Red rose", "redflower", "redrose", "rose"),
|
||||
BROWN_MUSHROOM(39, "Brown mushroom", "brownmushroom", "mushroom"),
|
||||
RED_MUSHROOM(40, "Red mushroom", "redmushroom"),
|
||||
GOLD_BLOCK(41, "Gold block", "gold", "goldblock"),
|
||||
IRON_BLOCK(42, "Iron block", "iron", "ironblock"),
|
||||
DOUBLE_STEP(43, "Double step", "doubleslab", "doublestoneslab", "doublestep"),
|
||||
STEP(44, "Step", "slab", "stoneslab", "step", "halfstep"),
|
||||
BRICK(45, "Brick", "brick", "brickblock"),
|
||||
TNT(46, "TNT", "tnt", "c4", "explosive"),
|
||||
BOOKCASE(47, "Bookcase", "bookshelf", "bookshelves", "bookcase", "bookcases"),
|
||||
MOSSY_COBBLESTONE(48, "Cobblestone (mossy)", "mossycobblestone", "mossstone", "mossystone", "mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"),
|
||||
OBSIDIAN(49, "Obsidian", "obsidian"),
|
||||
TORCH(50, "Torch", "torch", "light", "candle"),
|
||||
FIRE(51, "Fire", "fire", "flame", "flames"),
|
||||
MOB_SPAWNER(52, "Mob spawner", "mobspawner", "spawner"),
|
||||
WOODEN_STAIRS(53, "Wooden stairs", "woodstair", "woodstairs", "woodenstair", "woodenstairs"),
|
||||
CHEST(54, "Chest", "chest", "storage", "storagechest"),
|
||||
REDSTONE_WIRE(55, "Redstone wire", "redstone", "redstoneblock"),
|
||||
DIAMOND_ORE(56, "Diamond ore", "diamondore"),
|
||||
DIAMOND_BLOCK(57, "Diamond block", "diamond", "diamondblock"),
|
||||
WORKBENCH(58, "Workbench", "workbench", "table", "craftingtable", "crafting"),
|
||||
CROPS(59, "Crops", "crops", "crop", "plant", "plants"),
|
||||
SOIL(60, "Soil", "soil", "farmland"),
|
||||
FURNACE(61, "Furnace", "furnace"),
|
||||
BURNING_FURNACE(62, "Furnace (burning)", "burningfurnace", "litfurnace"),
|
||||
SIGN_POST(63, "Sign post", "sign", "signpost"),
|
||||
WOODEN_DOOR(64, "Wooden door", "wooddoor", "woodendoor", "door"),
|
||||
LADDER(65, "Ladder", "ladder"),
|
||||
MINECART_TRACKS(66, "Minecart tracks", "track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"),
|
||||
COBBLESTONE_STAIRS(67, "Cobblestone stairs", "cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"),
|
||||
WALL_SIGN(68, "Wall sign", "wallsign"),
|
||||
LEVER(69, "Lever", "lever", "switch", "stonelever", "stoneswitch"),
|
||||
STONE_PRESSURE_PLATE(70, "Stone pressure plate", "stonepressureplate", "stoneplate"),
|
||||
IRON_DOOR(71, "Iron Door", "irondoor"),
|
||||
WOODEN_PRESSURE_PLATE(72, "Wooden pressure plate", "woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate", "plate", "pressureplate"),
|
||||
REDSTONE_ORE(73, "Redstone ore", "redstoneore"),
|
||||
GLOWING_REDSTONE_ORE(74, "Glowing redstone ore", "glowingredstoneore"),
|
||||
REDSTONE_TORCH_OFF(75, "Redstone torch (off)", "redstonetorchoff", "rstorchoff"),
|
||||
REDSTONE_TORCH_ON(76, "Redstone torch (on)", "redstonetorch", "redstonetorchon", "rstorchon", "redtorch"),
|
||||
STONE_BUTTON(77, "Stone Button", "stonebutton", "button"),
|
||||
SNOW(78, "Snow", "snow"),
|
||||
ICE(79, "Ice", "ice"),
|
||||
SNOW_BLOCK(80, "Snow block", "snowblock"),
|
||||
CACTUS(81, "Cactus", "cactus", "cacti"),
|
||||
CLAY(82, "Clay", "clay"),
|
||||
SUGAR_CANE(83, "Reed", "reed", "cane", "sugarcane", "sugarcanes", "vine", "vines"),
|
||||
JUKEBOX(84, "Jukebox", "jukebox", "stereo", "recordplayer"),
|
||||
FENCE(85, "Fence", "fence"),
|
||||
PUMPKIN(86, "Pumpkin", "pumpkin"),
|
||||
NETHERRACK(87, "Netherrack", "redmossycobblestone", "redcobblestone", "redmosstone", "redcobble", "netherstone", "netherrack", "nether", "hellstone"),
|
||||
SOUL_SAND(88, "Soul sand", "slowmud", "mud", "soulsand", "hellmud"),
|
||||
GLOWSTONE(89, "Glowstone", "brittlegold", "glowstone", "lightstone", "brimstone", "australium"),
|
||||
PORTAL(90, "Portal", "portal"),
|
||||
JACK_O_LANTERN(91, "Pumpkin (on)", "pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"),
|
||||
CAKE(92, "Cake", "cake", "cakeblock"),
|
||||
REDSTONE_REPEATER_OFF(93, "Redstone repeater (off)", "diodeoff", "redstonerepeater", "repeater", "delayer"),
|
||||
REDSTONE_REPEATER_ON(94, "Redstone repeater (on)", "diode", "diodeon", "redstonerepeateron", "repeateron", "delayeron"),
|
||||
LOCKED_CHEST(95, "Locked chest", "lockedchest", "steveco", "supplycrate", "valveneedstoworkonep3nottf2kthx"),
|
||||
TRAP_DOOR(96, "Trap door", "trapdoor", "hatch", "floordoor"),
|
||||
AIR(BlockID.AIR, "Air", "air"),
|
||||
STONE(BlockID.STONE, "Stone", "stone", "rock"),
|
||||
GRASS(BlockID.GRASS, "Grass", "grass"),
|
||||
DIRT(BlockID.DIRT, "Dirt", "dirt"),
|
||||
COBBLESTONE(BlockID.COBBLESTONE, "Cobblestone", "cobblestone", "cobble"),
|
||||
WOOD(BlockID.WOOD, "Wood", "wood", "woodplank", "plank", "woodplanks", "planks"),
|
||||
SAPLING(BlockID.SAPLING, "Sapling", "sapling", "seedling"),
|
||||
BEDROCK(BlockID.BEDROCK, "Bedrock", "adminium", "bedrock"),
|
||||
WATER(BlockID.WATER, "Water", "watermoving", "movingwater", "flowingwater", "waterflowing"),
|
||||
STATIONARY_WATER(BlockID.STATIONARY_WATER, "Water (stationary)", "water", "waterstationary", "stationarywater", "stillwater"),
|
||||
LAVA(BlockID.LAVA, "Lava", "lavamoving", "movinglava", "flowinglava", "lavaflowing"),
|
||||
STATIONARY_LAVA(BlockID.STATIONARY_LAVA, "Lava (stationary)", "lava", "lavastationary", "stationarylava", "stilllava"),
|
||||
SAND(BlockID.SAND, "Sand", "sand"),
|
||||
GRAVEL(BlockID.GRAVEL, "Gravel", "gravel"),
|
||||
GOLD_ORE(BlockID.GOLD_ORE, "Gold ore", "goldore"),
|
||||
IRON_ORE(BlockID.IRON_ORE, "Iron ore", "ironore"),
|
||||
COAL_ORE(BlockID.COAL_ORE, "Coal ore", "coalore"),
|
||||
LOG(BlockID.LOG, "Log", "log", "tree", "pine", "oak", "birch", "redwood"),
|
||||
LEAVES(BlockID.LEAVES, "Leaves", "leaves", "leaf"),
|
||||
SPONGE(BlockID.SPONGE, "Sponge", "sponge"),
|
||||
GLASS(BlockID.GLASS, "Glass", "glass"),
|
||||
LAPIS_LAZULI_ORE(BlockID.LAPIS_LAZULI_ORE, "Lapis lazuli ore", "lapislazuliore", "blueore", "lapisore"),
|
||||
LAPIS_LAZULI(BlockID.LAPIS_LAZULI_BLOCK, "Lapis lazuli", "lapislazuli", "lapislazuliblock", "bluerock"),
|
||||
DISPENSER(BlockID.DISPENSER, "Dispenser", "dispenser"),
|
||||
SANDSTONE(BlockID.SANDSTONE, "Sandstone", "sandstone"),
|
||||
NOTE_BLOCK(BlockID.NOTE_BLOCK, "Note block", "musicblock", "noteblock", "note", "music", "instrument"),
|
||||
BED(BlockID.BED, "Bed", "bed"),
|
||||
POWERED_RAIL(BlockID.POWERED_RAIL, "Powered Rail", "poweredrail", "boosterrail", "poweredtrack", "boostertrack", "booster"),
|
||||
DETECTOR_RAIL(BlockID.DETECTOR_RAIL, "Detector Rail", "detectorrail", "detector"),
|
||||
PISTON_STICKY_BASE(BlockID.PISTON_STICKY_BASE, "Sticky Piston", "stickypiston"),
|
||||
WEB(BlockID.WEB, "Web", "web", "spiderweb"),
|
||||
LONG_GRASS(BlockID.LONG_GRASS, "Long grass", "longgrass", "tallgrass"),
|
||||
DEAD_BUSH(BlockID.DEAD_BUSH, "Shrub", "deadbush", "shrub", "deadshrub", "tumbleweed"),
|
||||
PISTON_BASE(BlockID.PISTON_BASE, "Piston", "piston"),
|
||||
PISTON_EXTENSION(BlockID.PISTON_EXTENSION, "Piston extension", "pistonextendsion", "pistonhead"),
|
||||
CLOTH(BlockID.CLOTH, "Wool", "cloth", "wool"),
|
||||
PISTON_MOVING_PIECE(BlockID.PISTON_MOVING_PIECE, "Piston moving piece", "movingpiston"),
|
||||
YELLOW_FLOWER(BlockID.YELLOW_FLOWER, "Yellow flower", "yellowflower", "flower"),
|
||||
RED_FLOWER(BlockID.RED_FLOWER, "Red rose", "redflower", "redrose", "rose"),
|
||||
BROWN_MUSHROOM(BlockID.BROWN_MUSHROOM, "Brown mushroom", "brownmushroom", "mushroom"),
|
||||
RED_MUSHROOM(BlockID.RED_MUSHROOM, "Red mushroom", "redmushroom"),
|
||||
GOLD_BLOCK(BlockID.GOLD_BLOCK, "Gold block", "gold", "goldblock"),
|
||||
IRON_BLOCK(BlockID.IRON_BLOCK, "Iron block", "iron", "ironblock"),
|
||||
DOUBLE_STEP(BlockID.DOUBLE_STEP, "Double step", "doubleslab", "doublestoneslab", "doublestep"),
|
||||
STEP(BlockID.STEP, "Step", "slab", "stoneslab", "step", "halfstep"),
|
||||
BRICK(BlockID.BRICK, "Brick", "brick", "brickblock"),
|
||||
TNT(BlockID.TNT, "TNT", "tnt", "c4", "explosive"),
|
||||
BOOKCASE(BlockID.BOOKCASE, "Bookcase", "bookshelf", "bookshelves", "bookcase", "bookcases"),
|
||||
MOSSY_COBBLESTONE(BlockID.MOSSY_COBBLESTONE, "Cobblestone (mossy)", "mossycobblestone", "mossstone", "mossystone", "mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"),
|
||||
OBSIDIAN(BlockID.OBSIDIAN, "Obsidian", "obsidian"),
|
||||
TORCH(BlockID.TORCH, "Torch", "torch", "light", "candle"),
|
||||
FIRE(BlockID.FIRE, "Fire", "fire", "flame", "flames"),
|
||||
MOB_SPAWNER(BlockID.MOB_SPAWNER, "Mob spawner", "mobspawner", "spawner"),
|
||||
WOODEN_STAIRS(BlockID.WOODEN_STAIRS, "Wooden stairs", "woodstair", "woodstairs", "woodenstair", "woodenstairs"),
|
||||
CHEST(BlockID.CHEST, "Chest", "chest", "storage", "storagechest"),
|
||||
REDSTONE_WIRE(BlockID.REDSTONE_WIRE, "Redstone wire", "redstone", "redstoneblock"),
|
||||
DIAMOND_ORE(BlockID.DIAMOND_ORE, "Diamond ore", "diamondore"),
|
||||
DIAMOND_BLOCK(BlockID.DIAMOND_BLOCK, "Diamond block", "diamond", "diamondblock"),
|
||||
WORKBENCH(BlockID.WORKBENCH, "Workbench", "workbench", "table", "craftingtable", "crafting"),
|
||||
CROPS(BlockID.CROPS, "Crops", "crops", "crop", "plant", "plants"),
|
||||
SOIL(BlockID.SOIL, "Soil", "soil", "farmland"),
|
||||
FURNACE(BlockID.FURNACE, "Furnace", "furnace"),
|
||||
BURNING_FURNACE(BlockID.BURNING_FURNACE, "Furnace (burning)", "burningfurnace", "litfurnace"),
|
||||
SIGN_POST(BlockID.SIGN_POST, "Sign post", "sign", "signpost"),
|
||||
WOODEN_DOOR(BlockID.WOODEN_DOOR, "Wooden door", "wooddoor", "woodendoor", "door"),
|
||||
LADDER(BlockID.LADDER, "Ladder", "ladder"),
|
||||
MINECART_TRACKS(BlockID.MINECART_TRACKS, "Minecart tracks", "track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"),
|
||||
COBBLESTONE_STAIRS(BlockID.COBBLESTONE_STAIRS, "Cobblestone stairs", "cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"),
|
||||
WALL_SIGN(BlockID.WALL_SIGN, "Wall sign", "wallsign"),
|
||||
LEVER(BlockID.LEVER, "Lever", "lever", "switch", "stonelever", "stoneswitch"),
|
||||
STONE_PRESSURE_PLATE(BlockID.STONE_PRESSURE_PLATE, "Stone pressure plate", "stonepressureplate", "stoneplate"),
|
||||
IRON_DOOR(BlockID.IRON_DOOR, "Iron Door", "irondoor"),
|
||||
WOODEN_PRESSURE_PLATE(BlockID.WOODEN_PRESSURE_PLATE, "Wooden pressure plate", "woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate", "plate", "pressureplate"),
|
||||
REDSTONE_ORE(BlockID.REDSTONE_ORE, "Redstone ore", "redstoneore"),
|
||||
GLOWING_REDSTONE_ORE(BlockID.GLOWING_REDSTONE_ORE, "Glowing redstone ore", "glowingredstoneore"),
|
||||
REDSTONE_TORCH_OFF(BlockID.REDSTONE_TORCH_OFF, "Redstone torch (off)", "redstonetorchoff", "rstorchoff"),
|
||||
REDSTONE_TORCH_ON(BlockID.REDSTONE_TORCH_ON, "Redstone torch (on)", "redstonetorch", "redstonetorchon", "rstorchon", "redtorch"),
|
||||
STONE_BUTTON(BlockID.STONE_BUTTON, "Stone Button", "stonebutton", "button"),
|
||||
SNOW(BlockID.SNOW, "Snow", "snow"),
|
||||
ICE(BlockID.ICE, "Ice", "ice"),
|
||||
SNOW_BLOCK(BlockID.SNOW_BLOCK, "Snow block", "snowblock"),
|
||||
CACTUS(BlockID.CACTUS, "Cactus", "cactus", "cacti"),
|
||||
CLAY(BlockID.CLAY, "Clay", "clay"),
|
||||
SUGAR_CANE(BlockID.REED, "Reed", "reed", "cane", "sugarcane", "sugarcanes", "vine", "vines"),
|
||||
JUKEBOX(BlockID.JUKEBOX, "Jukebox", "jukebox", "stereo", "recordplayer"),
|
||||
FENCE(BlockID.FENCE, "Fence", "fence"),
|
||||
PUMPKIN(BlockID.PUMPKIN, "Pumpkin", "pumpkin"),
|
||||
NETHERRACK(BlockID.NETHERRACK, "Netherrack", "redmossycobblestone", "redcobblestone", "redmosstone", "redcobble", "netherstone", "netherrack", "nether", "hellstone"),
|
||||
SOUL_SAND(BlockID.SLOW_SAND, "Soul sand", "slowmud", "mud", "soulsand", "hellmud"),
|
||||
GLOWSTONE(BlockID.LIGHTSTONE, "Glowstone", "brittlegold", "glowstone", "lightstone", "brimstone", "australium"),
|
||||
PORTAL(BlockID.PORTAL, "Portal", "portal"),
|
||||
JACK_O_LANTERN(BlockID.JACKOLANTERN, "Pumpkin (on)", "pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"),
|
||||
CAKE(BlockID.CAKE_BLOCK, "Cake", "cake", "cakeblock"),
|
||||
REDSTONE_REPEATER_OFF(BlockID.REDSTONE_REPEATER_OFF, "Redstone repeater (off)", "diodeoff", "redstonerepeater", "repeateroff", "delayeroff"),
|
||||
REDSTONE_REPEATER_ON(BlockID.REDSTONE_REPEATER_ON, "Redstone repeater (on)", "diodeon", "redstonerepeateron", "repeateron", "delayeron"),
|
||||
LOCKED_CHEST(BlockID.LOCKED_CHEST, "Locked chest", "lockedchest", "steveco", "supplycrate", "valveneedstoworkonep3nottf2kthx"),
|
||||
TRAP_DOOR(BlockID.TRAP_DOOR, "Trap door", "trapdoor", "hatch", "floordoor"),
|
||||
|
||||
// Items
|
||||
IRON_SHOVEL(256, "Iron shovel", "ironshovel"),
|
||||
@ -411,17 +411,79 @@ public enum ItemType {
|
||||
* @return
|
||||
*/
|
||||
public static boolean shouldNotStack(int id) {
|
||||
return (id >= 256 && id <= 259)
|
||||
|| id == 261
|
||||
|| (id >= 267 && id <= 279)
|
||||
|| (id >= 281 && id <= 286)
|
||||
|| (id >= 290 && id <= 294)
|
||||
|| (id >= 298 && id <= 317)
|
||||
|| (id >= 325 && id <= 327)
|
||||
|| id == 335
|
||||
|| id == 354
|
||||
|| id == 355
|
||||
|| id >= 2256;
|
||||
ItemType t = ItemType.fromID(id);
|
||||
if (t == null) return false;
|
||||
return t == ItemType.IRON_SHOVEL
|
||||
|| t == ItemType.IRON_PICK
|
||||
|| t == ItemType.IRON_AXE
|
||||
|| t == ItemType.FLINT_AND_TINDER
|
||||
|| t == ItemType.BOW
|
||||
|| t == ItemType.IRON_SWORD
|
||||
|| t == ItemType.WOOD_SWORD
|
||||
|| t == ItemType.WOOD_SHOVEL
|
||||
|| 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
|
||||
*/
|
||||
public static boolean usesDamageValue(int id) {
|
||||
return id == 35
|
||||
|| id == 351;
|
||||
return id == ItemType.CLOTH.getID()
|
||||
|| id == ItemType.INK_SACK.getID();
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
|
||||
*
|
||||
*/
|
||||
public MobSpawnerBlock() {
|
||||
super(52);
|
||||
super(BlockID.MOB_SPAWNER);
|
||||
this.mobType = "Pig";
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
|
||||
* @param mobType
|
||||
*/
|
||||
public MobSpawnerBlock(String mobType) {
|
||||
super(52);
|
||||
super(BlockID.MOB_SPAWNER);
|
||||
this.mobType = mobType;
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
|
||||
* @param 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
|
||||
*/
|
||||
public MobSpawnerBlock(int data, String mobType) {
|
||||
super(52, data);
|
||||
super(BlockID.MOB_SPAWNER, data);
|
||||
this.mobType = mobType;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class NoteBlock extends BaseBlock implements TileEntityBlock {
|
||||
* Construct the note block.
|
||||
*/
|
||||
public NoteBlock() {
|
||||
super(25);
|
||||
super(BlockID.NOTE_BLOCK);
|
||||
this.note = 0;
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ public class NoteBlock extends BaseBlock implements TileEntityBlock {
|
||||
* @param data
|
||||
*/
|
||||
public NoteBlock(int data) {
|
||||
super(25, data);
|
||||
super(BlockID.NOTE_BLOCK, data);
|
||||
this.note = 0;
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ public class NoteBlock extends BaseBlock implements TileEntityBlock {
|
||||
* @param note
|
||||
*/
|
||||
public NoteBlock(int data, byte note) {
|
||||
super(25, data);
|
||||
super(BlockID.NOTE_BLOCK, data);
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.bags.*;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
|
||||
public class BukkitPlayerBlockBag extends BlockBag {
|
||||
/**
|
||||
@ -68,7 +69,7 @@ public class BukkitPlayerBlockBag extends BlockBag {
|
||||
*/
|
||||
@Override
|
||||
public void fetchBlock(int id) throws BlockBagException {
|
||||
if (id == 0) {
|
||||
if (id == BlockID.AIR) {
|
||||
throw new IllegalArgumentException("Can't fetch air block");
|
||||
}
|
||||
|
||||
@ -114,7 +115,7 @@ public class BukkitPlayerBlockBag extends BlockBag {
|
||||
*/
|
||||
@Override
|
||||
public void storeBlock(int id) throws BlockBagException {
|
||||
if (id == 0) {
|
||||
if (id == BlockID.AIR) {
|
||||
throw new IllegalArgumentException("Can't store air block");
|
||||
}
|
||||
|
||||
|
@ -135,9 +135,7 @@ public class WorldEditPlugin extends JavaPlugin {
|
||||
* Register the events used by WorldEdit.
|
||||
*/
|
||||
protected void registerEvents() {
|
||||
@SuppressWarnings("unused")
|
||||
PlayerListener playerListener = new WorldEditPlayerListener(this);
|
||||
@SuppressWarnings("unused")
|
||||
PlayerListener criticalPlayerListener = new WorldEditCriticalPlayerListener(this);
|
||||
|
||||
// The permissions resolver has some hooks of its own
|
||||
|
@ -28,6 +28,7 @@ import com.sk89q.minecraft.util.commands.Logging;
|
||||
import static com.sk89q.minecraft.util.commands.Logging.LogMode.*;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.data.DataException;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
@ -76,7 +77,7 @@ public class ClipboardCommands {
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
BaseBlock block = new BaseBlock(0);
|
||||
BaseBlock block = new BaseBlock(BlockID.AIR);
|
||||
|
||||
if (args.argsLength() > 0) {
|
||||
block = we.getBlock(player, args.getString(0));
|
||||
|
@ -81,7 +81,8 @@ public class GenerationCommands {
|
||||
@Command(
|
||||
aliases = {"/hsphere"},
|
||||
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,
|
||||
max = 3
|
||||
)
|
||||
@ -91,6 +92,29 @@ public class GenerationCommands {
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
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));
|
||||
String[] radiuses = args.getString(1).split(",");
|
||||
final double radiusX, radiusY, radiusZ;
|
||||
@ -110,10 +134,11 @@ public class GenerationCommands {
|
||||
return;
|
||||
}
|
||||
final boolean raised;
|
||||
if (args.argsLength() > 2)
|
||||
if (args.argsLength() > 2) {
|
||||
raised = args.getString(2).equalsIgnoreCase("true") || args.getString(2).equalsIgnoreCase("yes");
|
||||
else
|
||||
} else {
|
||||
raised = false;
|
||||
}
|
||||
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
if (raised) {
|
||||
@ -127,8 +152,9 @@ public class GenerationCommands {
|
||||
|
||||
@Command(
|
||||
aliases = {"/sphere"},
|
||||
usage = "<block> <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.",
|
||||
usage = "<block> <radius>[,<radius>,<radius>] [raised?] ",
|
||||
desc = "Generate a filled sphere.",
|
||||
flags = "q",
|
||||
min = 2,
|
||||
max = 3
|
||||
)
|
||||
@ -138,6 +164,29 @@ public class GenerationCommands {
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
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));
|
||||
String[] radiuses = args.getString(1).split(",");
|
||||
final double radiusX, radiusY, radiusZ;
|
||||
@ -157,10 +206,11 @@ public class GenerationCommands {
|
||||
return;
|
||||
}
|
||||
final boolean raised;
|
||||
if (args.argsLength() > 2)
|
||||
if (args.argsLength() > 2) {
|
||||
raised = args.getString(2).equalsIgnoreCase("true") || args.getString(2).equalsIgnoreCase("yes");
|
||||
else
|
||||
} else {
|
||||
raised = false;
|
||||
}
|
||||
|
||||
Vector pos = session.getPlacementPosition(player);
|
||||
if (raised) {
|
||||
@ -194,7 +244,6 @@ public class GenerationCommands {
|
||||
if (type == null) {
|
||||
player.printError("Tree type '" + args.getString(1) + "' is unknown.");
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
|
||||
int affected = editSession.makeForest(player.getPosition(),
|
||||
|
@ -28,6 +28,7 @@ import com.sk89q.minecraft.util.commands.Logging;
|
||||
import static com.sk89q.minecraft.util.commands.Logging.LogMode.*;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.filtering.GaussianKernel;
|
||||
import com.sk89q.worldedit.filtering.HeightMapFilter;
|
||||
import com.sk89q.worldedit.masks.Mask;
|
||||
@ -243,7 +244,7 @@ public class RegionCommands {
|
||||
if (args.argsLength() > 2) {
|
||||
replace = we.getBlock(player, args.getString(2));
|
||||
} else {
|
||||
replace = new BaseBlock(0);
|
||||
replace = new BaseBlock(BlockID.AIR);
|
||||
}
|
||||
|
||||
int affected = editSession.moveCuboidRegion(session.getSelection(player.getWorld()),
|
||||
|
@ -308,6 +308,17 @@ public final class BlockData {
|
||||
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.
|
||||
*
|
||||
|
@ -21,9 +21,10 @@ package com.sk89q.worldedit.masks;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
|
||||
public class ExistingBlockMask implements Mask {
|
||||
public boolean matches(EditSession editSession, Vector pos) {
|
||||
return editSession.getBlockType(pos) != 0;
|
||||
return editSession.getBlockType(pos) != BlockID.AIR;
|
||||
}
|
||||
}
|
||||
|
@ -84,10 +84,6 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Bug workaround
|
||||
if (target.getBlockX() == 0 && target.getBlockY() == 0 && target.getBlockZ() == 0) {
|
||||
return null;
|
||||
}
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class FloodFillTool implements BlockTool {
|
||||
|
||||
int initialType = world.getBlockType(clicked);
|
||||
|
||||
if (initialType == 0) {
|
||||
if (initialType == BlockID.AIR) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class RecursivePickaxe implements BlockTool {
|
||||
|
||||
int initialType = world.getBlockType(clicked);
|
||||
|
||||
if (initialType == 0) {
|
||||
if (initialType == BlockID.AIR) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -40,15 +40,13 @@ public class SinglePickaxe implements BlockTool {
|
||||
if (world.getBlockType(clicked) == BlockID.BEDROCK
|
||||
&& !player.canDestroyBedrock()) {
|
||||
return true;
|
||||
} else if (world.getBlockType(clicked) == BlockID.TNT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (config.superPickaxeDrop) {
|
||||
world.simulateBlockMine(clicked);
|
||||
}
|
||||
|
||||
world.setBlockType(clicked, 0);
|
||||
world.setBlockType(clicked, BlockID.AIR);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -33,6 +33,10 @@ public class SmoothBrush implements Brush {
|
||||
private int iterations;
|
||||
private boolean naturalOnly;
|
||||
|
||||
public SmoothBrush(int iterations) {
|
||||
this(iterations, false);
|
||||
}
|
||||
|
||||
public SmoothBrush(int iterations, boolean naturalOnly) {
|
||||
this.iterations = iterations;
|
||||
this.naturalOnly = naturalOnly;
|
||||
|
@ -28,6 +28,7 @@ import com.sk89q.worldedit.LocalWorld;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
|
||||
/**
|
||||
* Tree generator.
|
||||
@ -177,8 +178,8 @@ public class TreeGenerator {
|
||||
int trunkHeight = (int) Math.floor(Math.random() * 2) + 3;
|
||||
int height = (int) Math.floor(Math.random() * 5) + 8;
|
||||
|
||||
BaseBlock logBlock = new BaseBlock(17);
|
||||
BaseBlock leavesBlock = new BaseBlock(18);
|
||||
BaseBlock logBlock = new BaseBlock(BlockID.LOG);
|
||||
BaseBlock leavesBlock = new BaseBlock(BlockID.LEAVES);
|
||||
|
||||
// Create trunk
|
||||
for (int i = 0; i < trunkHeight; ++i) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren