Workaround ItemStackRequest offhand incorrect slot bug

closes #5667

this appears to be a client bug specific to ItemStackRequest.
This commit is contained in:
Dylan K. Taylor
2023-03-31 17:27:11 +01:00
parent 5ac0d7ae11
commit a862cf5144
2 changed files with 10 additions and 1 deletions

View File

@ -53,6 +53,10 @@ final class ItemStackResponseBuilder{
* @phpstan-return array{Inventory, int}
*/
private function getInventoryAndSlot(int $containerInterfaceId, int $slotId) : ?array{
if($containerInterfaceId === ContainerUIIds::OFFHAND && $slotId === 1){
//TODO: HACK! The client sends an incorrect slot ID for the offhand as of 1.19.70
$slotId = 0;
}
$windowId = ItemStackContainerIdTranslator::translate($containerInterfaceId, $this->inventoryManager->getCurrentWindowId());
$windowAndSlot = $this->inventoryManager->locateWindowAndSlot($windowId, $slotId);
if($windowAndSlot === null){