inventory: fix some transactions being rejected for no good reason

since 1.13, transactions such as interacting with creative inventory cause a spoof windowID 124 slot 50 action to appear which changes air -> air. This currently gets rejected because only cursor is mapped to ID 124, and it only has a single slot.

It is not clear what the purpose of 124:50 is, but this fix filters out any actions which do not change anything, since they won't affect transaction balance anyway.
This commit is contained in:
Dylan K. Taylor 2019-12-02 20:15:22 +00:00
parent b7c4379700
commit 7fdfe947b0

View File

@ -167,6 +167,10 @@ class NetworkInventoryAction{
* @throws \UnexpectedValueException
*/
public function createInventoryAction(Player $player){
if($this->oldItem->equalsExact($this->newItem)){
//filter out useless noise in 1.13
return null;
}
switch($this->sourceType){
case self::SOURCE_CONTAINER:
$window = $player->getWindow($this->windowId);