mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +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)
|
if (cancelled)
|
||||||
return;
|
return;
|
||||||
player->inventory->removeItem(player->inventory->selected, 1);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -526,7 +533,12 @@ void PlayerConnection::handlePlayerAction(shared_ptr<PlayerActionPacket> packet)
|
||||||
if (cancelled)
|
if (cancelled)
|
||||||
return;
|
return;
|
||||||
player->inventory->removeItem(player->inventory->selected, selected->count);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue