mirror of
https://github.com/p2r3/bareiron.git
synced 2025-10-01 23:25:09 +02:00
prevent players from dropping and losing items
This commit is contained in:
@@ -572,6 +572,20 @@ uint8_t getItemStackSize (uint16_t item) {
|
||||
|
||||
void handlePlayerAction (PlayerData *player, int action, short x, short y, short z) {
|
||||
|
||||
// Re-sync slot when player drops an item
|
||||
if (action == 3 || action == 4) {
|
||||
sc_setContainerSlot(
|
||||
player->client_fd, 0,
|
||||
serverSlotToClientSlot(0, player->hotbar),
|
||||
player->inventory_count[player->hotbar],
|
||||
player->inventory_items[player->hotbar]
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore further actions not pertaining to mining blocks
|
||||
if (action != 0 && action != 2) return;
|
||||
|
||||
// In creative, only the "start mining" action is sent
|
||||
// No additional verification is performed, the block is simply removed
|
||||
if (action == 0 && GAMEMODE == 1) {
|
||||
@@ -579,9 +593,6 @@ void handlePlayerAction (PlayerData *player, int action, short x, short y, short
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore actions not pertaining to mining blocks
|
||||
if (action != 0 && action != 2) return;
|
||||
|
||||
uint8_t block = getBlockAt(x, y, z);
|
||||
|
||||
// If this is a "start mining" packet, the block must be instamine
|
||||
|
Reference in New Issue
Block a user