mirror of
https://github.com/p2r3/bareiron.git
synced 2025-10-02 07:35:08 +02:00
fixes
This commit is contained in:
@@ -1167,8 +1167,8 @@ void processBlockUpdate (short x, uint8_t y, short z, uint8_t block) {
|
|||||||
// TODO: if below block breaks sand
|
// TODO: if below block breaks sand
|
||||||
if (isReplaceableBlock(below)) {
|
if (isReplaceableBlock(below)) {
|
||||||
// TODO: drop item of below block
|
// TODO: drop item of below block
|
||||||
makeBlockChange(x, y, z, 0);
|
makeBlockChange(x, y, z, B_air);
|
||||||
makeBlockChange(x, y - 1, z, 0);
|
makeBlockChange(x, y - 1, z, B_air);
|
||||||
makeBlockChange(x, y - 1, z, block);
|
makeBlockChange(x, y - 1, z, block);
|
||||||
// update this now moved block at the sand fall speed
|
// update this now moved block at the sand fall speed
|
||||||
deferBlockUpdate(x, y - 1, z, 15);
|
deferBlockUpdate(x, y - 1, z, 15);
|
||||||
@@ -1214,30 +1214,30 @@ void handlePlayerAction (PlayerData *player, int action, short x, short y, short
|
|||||||
// Ignore further actions not pertaining to mining blocks
|
// Ignore further actions not pertaining to mining blocks
|
||||||
if (action != 0 && action != 2) return;
|
if (action != 0 && action != 2) return;
|
||||||
|
|
||||||
|
uint8_t block = getBlockAt(x, y, z);
|
||||||
|
|
||||||
// In creative, only the "start mining" action is sent
|
// In creative, only the "start mining" action is sent
|
||||||
// No additional verification is performed, the block is simply removed
|
// No additional verification is performed, the block is simply removed
|
||||||
if (action == 0 && GAMEMODE == 1) {
|
if (action == 0 && GAMEMODE == 1) {
|
||||||
makeBlockChange(x, y, z, 0);
|
makeBlockChange(x, y, z, B_air);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// If this is a "start mining" packet, the block must be instamine
|
||||||
|
if (action == 0 && !isInstantlyMined(player, block)) return;
|
||||||
|
|
||||||
uint8_t block = getBlockAt(x, y, z);
|
// Don't continue if the block change failed
|
||||||
|
if (makeBlockChange(x, y, z, B_air)) return;
|
||||||
|
|
||||||
// If this is a "start mining" packet, the block must be instamine
|
uint16_t held_item = player->inventory_items[player->hotbar];
|
||||||
if (action == 0 && !isInstantlyMined(player, block)) return;
|
uint16_t item = getMiningResult(held_item, block);
|
||||||
|
bumpToolDurability(player);
|
||||||
|
|
||||||
// Don't continue if the block change failed
|
if (item) {
|
||||||
if (makeBlockChange(x, y, z, 0)) return;
|
#ifdef ENABLE_PICKUP_ANIMATION
|
||||||
|
playPickupAnimation(player, item, x, y, z);
|
||||||
uint16_t held_item = player->inventory_items[player->hotbar];
|
#endif
|
||||||
uint16_t item = getMiningResult(held_item, block);
|
givePlayerItem(player, item, 1);
|
||||||
bumpToolDurability(player);
|
}
|
||||||
|
|
||||||
if (item) {
|
|
||||||
#ifdef ENABLE_PICKUP_ANIMATION
|
|
||||||
playPickupAnimation(player, item, x, y, z);
|
|
||||||
#endif
|
|
||||||
givePlayerItem(player, item, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update nearby blocks
|
// Update nearby blocks
|
||||||
@@ -1391,14 +1391,13 @@ void handlePlayerUseItem (PlayerData *player, short x, short y, short z, uint8_t
|
|||||||
*count -= 1;
|
*count -= 1;
|
||||||
// Clear item id in slot if amount is zero
|
// Clear item id in slot if amount is zero
|
||||||
if (*count == 0) *item = 0;
|
if (*count == 0) *item = 0;
|
||||||
// Calculate fluid flow
|
// Send updates
|
||||||
#ifdef DO_FLUID_FLOW
|
processBlockUpdate(x, y, z, block);
|
||||||
processBlockUpdate(x, y + 1, z, getBlockAt(x, y + 1, z));
|
processBlockUpdate(x, y + 1, z, getBlockAt(x, y + 1, z));
|
||||||
processBlockUpdate(x - 1, y, z, getBlockAt(x - 1, y, z));
|
processBlockUpdate(x - 1, y, z, getBlockAt(x - 1, y, z));
|
||||||
processBlockUpdate(x + 1, y, z, getBlockAt(x + 1, y, z));
|
processBlockUpdate(x + 1, y, z, getBlockAt(x + 1, y, z));
|
||||||
processBlockUpdate(x, y, z - 1, getBlockAt(x, y, z - 1));
|
processBlockUpdate(x, y, z - 1, getBlockAt(x, y, z - 1));
|
||||||
processBlockUpdate(x, y, z + 1, getBlockAt(x, y, z + 1));
|
processBlockUpdate(x, y, z + 1, getBlockAt(x, y, z + 1));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sync hotbar contents to player
|
// Sync hotbar contents to player
|
||||||
|
Reference in New Issue
Block a user