bool BlockBasic::onBroken(User* user, int8_t status, int32_t x, int8_t y, int32_t z, int map, int8_t direction) { //Clear block on destroy uint8_t block, meta; Mineserver::get()->map(map)->getBlock(x, y, z, &block, &meta); Mineserver::get()->map(map)->sendBlockChange(x, y, z, BLOCK_AIR, 0); Mineserver::get()->map(map)->setBlock(x, y, z, BLOCK_AIR, 0); spawnBlockItem(x, y, z, map, block, meta); return false; }
bool BlockRedstone::onBroken(User* user, int8_t status, int32_t x, int16_t y, int32_t z, int map, int8_t direction) { uint8_t block; uint8_t meta; ServerInstance->map(map)->getBlock(x, y, z, &block, &meta); ServerInstance->map(map)->setBlock(x, y, z, char(BLOCK_AIR), 0); ServerInstance->map(map)->sendBlockChange(x, y, z, char(BLOCK_AIR), 0); spawnBlockItem(x, y, z, map, uint8_t(BLOCK_REDSTONE_WIRE), 0); ServerInstance->redstone(map)->addSimulation(vec(x,y,z)); return false; }
void BlockRedstone::onNeighbourBroken(User* user, int16_t oldblock, int32_t x, int16_t y, int32_t z, int map, int8_t direction) { uint8_t block; uint8_t meta; if (!ServerInstance->map(map)->getBlock(x, y, z, &block, &meta)) { return; } if (isBlockEmpty(x, y - 1, z, map)) { // Break torch and spawn torch item ServerInstance->map(map)->sendBlockChange(x, y, z, BLOCK_AIR, 0); ServerInstance->map(map)->setBlock(x, y, z, BLOCK_AIR, 0); spawnBlockItem(x, y, z, map, block); } }