Added data value mappings for certain blocks and made all other block types wildcard matches.

This commit is contained in:
TomyLobo
2013-12-01 23:57:09 +01:00
parent ef43e141ee
commit d467bf1386
2 changed files with 31 additions and 6 deletions

View File

@ -166,9 +166,6 @@ public class BukkitUtil {
public static BaseBlock toBlock(LocalWorld world, ItemStack itemStack) throws WorldEditException {
final int typeId = itemStack.getTypeId();
if (world.isValidBlockType(typeId)) {
return new BaseBlock(typeId, itemStack.getDurability());
}
switch (typeId) {
case ItemID.INK_SACK:
@ -182,13 +179,17 @@ public class BukkitUtil {
return new SkullBlock(0, (byte) itemStack.getDurability());
default:
final BaseBlock baseBlock = BlockType.getBlockForItem(typeId);
final BaseBlock baseBlock = BlockType.getBlockForItem(typeId, itemStack.getDurability());
if (baseBlock != null) {
return baseBlock;
}
break;
}
if (world.isValidBlockType(typeId)) {
return new BaseBlock(typeId, -1);
}
throw new NotABlockException(typeId);
}
}