mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-09 15:29:16 +00:00
fix enchants disappearing when dropped
This commit is contained in:
parent
4a220faebe
commit
5a6bf5e733
|
|
@ -504,7 +504,14 @@ void PlayerConnection::handlePlayerAction(shared_ptr<PlayerActionPacket> packet)
|
|||
if (cancelled)
|
||||
return;
|
||||
player->inventory->removeItem(player->inventory->selected, 1);
|
||||
player->drop(std::make_shared<ItemInstance>(outId, outCount, outAux));
|
||||
// oops
|
||||
// fix enchants disappearing
|
||||
shared_ptr<ItemInstance> dropItem = (outId == selected->id)
|
||||
? selected->copy()
|
||||
: std::make_shared<ItemInstance>(outId, outCount, outAux);
|
||||
dropItem->count = outCount;
|
||||
if (outAux != selected->getAuxValue()) dropItem->setAuxValue(outAux);
|
||||
player->drop(dropItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -526,7 +533,12 @@ void PlayerConnection::handlePlayerAction(shared_ptr<PlayerActionPacket> packet)
|
|||
if (cancelled)
|
||||
return;
|
||||
player->inventory->removeItem(player->inventory->selected, selected->count);
|
||||
player->drop(std::make_shared<ItemInstance>(outId, outCount, outAux));
|
||||
shared_ptr<ItemInstance> dropItem = (outId == selected->id)
|
||||
? selected->copy()
|
||||
: std::make_shared<ItemInstance>(outId, outCount, outAux);
|
||||
dropItem->count = outCount;
|
||||
if (outAux != selected->getAuxValue()) dropItem->setAuxValue(outAux);
|
||||
player->drop(dropItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue