Remove potentially problematic ephemeral window creation

this is *probably* fine, but best avoided.
This commit is contained in:
Dylan K. Taylor 2024-11-24 23:43:32 +00:00
parent fe1a8d98e7
commit 1738355357
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -462,8 +462,8 @@ class InGamePacketHandler extends PacketHandler{
$droppedItem = $sourceSlotItem->pop($droppedCount); $droppedItem = $sourceSlotItem->pop($droppedCount);
$builder = new TransactionBuilder(); $builder = new TransactionBuilder();
//TODO: this probably shouldn't be creating an ephemeral window here - it works, but no idea what side effects it might have on the permanent window $window = $this->inventoryManager->getInventoryWindow($inventory) ?? throw new AssumptionFailedError("This should never happen");
$builder->getActionBuilder(new PlayerInventoryWindow($this->player, $inventory, PlayerInventoryWindow::TYPE_INVENTORY))->setItem($sourceSlot, $sourceSlotItem); $builder->getActionBuilder($window)->setItem($sourceSlot, $sourceSlotItem);
$builder->addAction(new DropItemAction($droppedItem)); $builder->addAction(new DropItemAction($droppedItem));
$transaction = new InventoryTransaction($this->player, $builder->generateActions()); $transaction = new InventoryTransaction($this->player, $builder->generateActions());