mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-30 12:03:30 +00:00
FIX: workbench compatibility
This commit is contained in:
@@ -467,35 +467,34 @@ void PaneCraftingScreen::craftSelectedItem()
|
|||||||
if (minecraft->isOnline()) {
|
if (minecraft->isOnline()) {
|
||||||
WantCreatePacket packet(minecraft->player->entityId, resultItem.count, resultItem.getAuxValue(), resultItem.id);
|
WantCreatePacket packet(minecraft->player->entityId, resultItem.count, resultItem.getAuxValue(), resultItem.id);
|
||||||
minecraft->raknetInstance->send(packet);
|
minecraft->raknetInstance->send(packet);
|
||||||
} else {
|
|
||||||
// Remove all items required for the recipe and ...
|
|
||||||
for (unsigned int i = 0; i < currentItem->neededItems.size(); ++i) {
|
|
||||||
CItem::ReqItem& req = currentItem->neededItems[i];
|
|
||||||
|
|
||||||
// If the recipe allows any aux-value as ingredients, first deplete
|
|
||||||
// aux == 0 from inventory. Since I'm not sure if this always is
|
|
||||||
// correct, let's only do it for ingredient sandstone for now.
|
|
||||||
ItemInstance toRemove = req.item;
|
|
||||||
|
|
||||||
if (Tile::sandStone->id == req.item.id
|
|
||||||
&& Recipe::ANY_AUX_VALUE == req.item.getAuxValue()) {
|
|
||||||
toRemove.setAuxValue(0);
|
|
||||||
toRemove.count = minecraft->player->inventory->removeResource(toRemove, true);
|
|
||||||
toRemove.setAuxValue(Recipe::ANY_AUX_VALUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (toRemove.count > 0) {
|
|
||||||
minecraft->player->inventory->removeResource(toRemove);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ... add the new one! (in this order, to fill empty slots better)
|
|
||||||
// if it doesn't fit, throw it on the ground!
|
|
||||||
if (!minecraft->player->inventory->add(&resultItem)) {
|
|
||||||
minecraft->player->drop(new ItemInstance(resultItem), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
recheckRecipes();
|
|
||||||
}
|
}
|
||||||
|
// Remove all items required for the recipe and ...
|
||||||
|
for (unsigned int i = 0; i < currentItem->neededItems.size(); ++i) {
|
||||||
|
CItem::ReqItem& req = currentItem->neededItems[i];
|
||||||
|
|
||||||
|
// If the recipe allows any aux-value as ingredients, first deplete
|
||||||
|
// aux == 0 from inventory. Since I'm not sure if this always is
|
||||||
|
// correct, let's only do it for ingredient sandstone for now.
|
||||||
|
ItemInstance toRemove = req.item;
|
||||||
|
|
||||||
|
if (Tile::sandStone->id == req.item.id
|
||||||
|
&& Recipe::ANY_AUX_VALUE == req.item.getAuxValue()) {
|
||||||
|
toRemove.setAuxValue(0);
|
||||||
|
toRemove.count = minecraft->player->inventory->removeResource(toRemove, true);
|
||||||
|
toRemove.setAuxValue(Recipe::ANY_AUX_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toRemove.count > 0) {
|
||||||
|
minecraft->player->inventory->removeResource(toRemove);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ... add the new one! (in this order, to fill empty slots better)
|
||||||
|
// if it doesn't fit, throw it on the ground!
|
||||||
|
if (!minecraft->player->inventory->add(&resultItem)) {
|
||||||
|
minecraft->player->drop(new ItemInstance(resultItem), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
recheckRecipes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -654,14 +654,14 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, WantCrea
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < items.size(); i++) {
|
// for (int i = 0; i < items.size(); i++) {
|
||||||
RemoveItemPacket removePacket(packet->playerId, items.at(i).count, items.at(i).getAuxValue(), items.at(i).id);
|
// RemoveItemPacket removePacket(packet->playerId, items.at(i).count, items.at(i).getAuxValue(), items.at(i).id);
|
||||||
raknetInstance->send(source, removePacket);
|
// raknetInstance->send(source, removePacket);
|
||||||
|
|
||||||
p->inventory->removeResource(ItemInstance(items.at(i).id, items.at(i).count, items.at(i).getAuxValue()));
|
// p->inventory->removeResource(ItemInstance(items.at(i).id, items.at(i).count, items.at(i).getAuxValue()));
|
||||||
}
|
// }
|
||||||
TakeItemPacket itemAdd(p->entityId, wantCreate.count, wantCreate.getAuxValue(), wantCreate.id);
|
// TakeItemPacket itemAdd(p->entityId, wantCreate.count, wantCreate.getAuxValue(), wantCreate.id);
|
||||||
raknetInstance->send(source, itemAdd);
|
// raknetInstance->send(source, itemAdd);
|
||||||
|
|
||||||
p->inventory->add(new ItemInstance(wantCreate.id, wantCreate.count, wantCreate.getAuxValue()));
|
p->inventory->add(new ItemInstance(wantCreate.id, wantCreate.count, wantCreate.getAuxValue()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user