mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Abstracted type detection of simulateBlockMine into BlockType.
This commit is contained in:
@ -249,154 +249,11 @@ public abstract class LocalWorld {
|
||||
* @param pt
|
||||
*/
|
||||
public void simulateBlockMine(Vector pt) {
|
||||
int type = getBlockType(pt);
|
||||
//setBlockType(pt, 0);
|
||||
BaseItemStack stack = BlockType.getBlockDrop(getBlockType(pt), (short) getBlockData(pt));
|
||||
if (stack != null) dropItem(pt,
|
||||
stack.getAmount() > 1 ? new BaseItemStack(stack.getType(),
|
||||
1, stack.getDamage()) : stack, stack.getAmount());
|
||||
|
||||
switch (type) {
|
||||
case BlockID.STONE:
|
||||
dropItem(pt, new BaseItemStack(BlockID.COBBLESTONE));
|
||||
break;
|
||||
|
||||
case BlockID.GRASS:
|
||||
dropItem(pt, new BaseItemStack(BlockID.DIRT));
|
||||
break;
|
||||
|
||||
case BlockID.GRAVEL:
|
||||
if (random.nextDouble() >= 0.9) {
|
||||
dropItem(pt, new BaseItemStack(ItemType.FLINT.getID()));
|
||||
} else {
|
||||
dropItem(pt, new BaseItemStack(type));
|
||||
}
|
||||
break;
|
||||
|
||||
case BlockID.COAL_ORE:
|
||||
dropItem(pt, new BaseItemStack(ItemType.COAL.getID()));
|
||||
break;
|
||||
|
||||
case BlockID.LOG:
|
||||
dropItem(pt, new BaseItemStack(type, 1, (short) getBlockData(pt)));
|
||||
break;
|
||||
|
||||
case BlockID.LEAVES:
|
||||
if (random.nextDouble() > 0.95) {
|
||||
dropItem(pt, new BaseItemStack(BlockID.SAPLING, 1, (short) getBlockData(pt)));
|
||||
}
|
||||
break;
|
||||
|
||||
case BlockID.LAPIS_LAZULI_ORE:
|
||||
dropItem(pt, new BaseItemStack(ItemType.INK_SACK.getID(), 1, (short) 4), (random.nextInt(5) + 4));
|
||||
break;
|
||||
|
||||
case BlockID.BED:
|
||||
dropItem(pt, new BaseItemStack(ItemType.BED_ITEM.getID()));
|
||||
break;
|
||||
|
||||
case BlockID.LONG_GRASS:
|
||||
if (random.nextInt(8) == 0) dropItem(pt, new BaseItemStack(ItemType.SEEDS.getID()));
|
||||
break;
|
||||
|
||||
case BlockID.CLOTH:
|
||||
dropItem(pt, new BaseItemStack(type, 1, (short) getBlockData(pt)));
|
||||
break;
|
||||
|
||||
case BlockID.DOUBLE_STEP:
|
||||
dropItem(pt, new BaseItemStack(BlockID.STEP, 1, (short) getBlockData(pt)), 2);
|
||||
break;
|
||||
|
||||
case BlockID.STEP:
|
||||
dropItem(pt, new BaseItemStack(type, 1, (short) getBlockData(pt)));
|
||||
break;
|
||||
|
||||
case BlockID.WOODEN_STAIRS:
|
||||
dropItem(pt, new BaseItemStack(BlockID.WOOD));
|
||||
break;
|
||||
|
||||
case BlockID.REDSTONE_WIRE:
|
||||
dropItem(pt, new BaseItemStack(ItemType.REDSTONE_DUST.getID()));
|
||||
break;
|
||||
|
||||
case BlockID.DIAMOND_ORE:
|
||||
dropItem(pt, new BaseItemStack(ItemType.DIAMOND.getID()));
|
||||
break;
|
||||
|
||||
case BlockID.CROPS:
|
||||
dropItem(pt, new BaseItemStack(ItemType.SEEDS.getID()));
|
||||
break;
|
||||
|
||||
case BlockID.SOIL:
|
||||
dropItem(pt, new BaseItemStack(BlockID.DIRT));
|
||||
break;
|
||||
|
||||
case BlockID.BURNING_FURNACE:
|
||||
dropItem(pt, new BaseItemStack(BlockID.FURNACE));
|
||||
break;
|
||||
|
||||
case BlockID.SIGN_POST:
|
||||
dropItem(pt, new BaseItemStack(ItemType.SIGN.getID()));
|
||||
break;
|
||||
|
||||
case BlockID.WOODEN_DOOR:
|
||||
dropItem(pt, new BaseItemStack(ItemType.WOODEN_DOOR_ITEM.getID()));
|
||||
break;
|
||||
|
||||
case BlockID.COBBLESTONE_STAIRS:
|
||||
dropItem(pt, new BaseItemStack(BlockID.COBBLESTONE));
|
||||
break;
|
||||
|
||||
case BlockID.WALL_SIGN:
|
||||
dropItem(pt, new BaseItemStack(ItemType.SIGN.getID()));
|
||||
break;
|
||||
|
||||
case BlockID.IRON_DOOR:
|
||||
dropItem(pt, new BaseItemStack(ItemType.IRON_DOOR_ITEM.getID()));
|
||||
break;
|
||||
|
||||
case BlockID.REDSTONE_ORE:
|
||||
case BlockID.GLOWING_REDSTONE_ORE:
|
||||
dropItem(pt, new BaseItemStack(ItemType.REDSTONE_DUST.getID()), (random.nextInt(2) + 4));
|
||||
break;
|
||||
|
||||
case BlockID.REDSTONE_TORCH_OFF:
|
||||
dropItem(pt, new BaseItemStack(BlockID.REDSTONE_TORCH_ON));
|
||||
break;
|
||||
|
||||
case BlockID.CLAY:
|
||||
dropItem(pt, new BaseItemStack(ItemType.CLAY_BALL.getID()), 4);
|
||||
break;
|
||||
|
||||
case BlockID.REED:
|
||||
dropItem(pt, new BaseItemStack(ItemType.SUGAR_CANE_ITEM.getID()));
|
||||
break;
|
||||
|
||||
case BlockID.LIGHTSTONE:
|
||||
dropItem(pt, new BaseItemStack(ItemType.LIGHTSTONE_DUST.getID()), (random.nextInt(3) + 2));
|
||||
break;
|
||||
|
||||
case BlockID.REDSTONE_REPEATER_OFF:
|
||||
case BlockID.REDSTONE_REPEATER_ON:
|
||||
dropItem(pt, new BaseItemStack(ItemType.REDSTONE_REPEATER.getID()));
|
||||
break;
|
||||
|
||||
case BlockID.BEDROCK:
|
||||
case BlockID.WATER:
|
||||
case BlockID.STATIONARY_WATER:
|
||||
case BlockID.LAVA:
|
||||
case BlockID.STATIONARY_LAVA:
|
||||
case BlockID.GLASS:
|
||||
case BlockID.PISTON_EXTENSION:
|
||||
case BlockID.BOOKCASE:
|
||||
case BlockID.FIRE:
|
||||
case BlockID.MOB_SPAWNER:
|
||||
case BlockID.SNOW:
|
||||
case BlockID.ICE:
|
||||
case BlockID.PORTAL:
|
||||
case BlockID.AIR:
|
||||
break;
|
||||
|
||||
default:
|
||||
dropItem(pt, new BaseItemStack(type));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user