mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 08:39:53 +00:00
Revert "Fixed crafting grid transaction handling, close #2559"
This reverts commit dfeb62491a74a402aa269e06c51de8f1a60238e9.
This commit is contained in:
parent
87ce87112b
commit
fd77dd0066
@ -36,7 +36,6 @@ class NetworkInventoryAction{
|
|||||||
|
|
||||||
public const SOURCE_WORLD = 2; //drop/pickup item entity
|
public const SOURCE_WORLD = 2; //drop/pickup item entity
|
||||||
public const SOURCE_CREATIVE = 3;
|
public const SOURCE_CREATIVE = 3;
|
||||||
public const SOURCE_CRAFTING_GRID = 100;
|
|
||||||
public const SOURCE_TODO = 99999;
|
public const SOURCE_TODO = 99999;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,8 +47,8 @@ class NetworkInventoryAction{
|
|||||||
*
|
*
|
||||||
* Expect these to change in the future.
|
* Expect these to change in the future.
|
||||||
*/
|
*/
|
||||||
public const SOURCE_TYPE_CRAFTING_USELESS_MAGIC_NUMBER = -2;
|
public const SOURCE_TYPE_CRAFTING_ADD_INGREDIENT = -2;
|
||||||
|
public const SOURCE_TYPE_CRAFTING_REMOVE_INGREDIENT = -3;
|
||||||
public const SOURCE_TYPE_CRAFTING_RESULT = -4;
|
public const SOURCE_TYPE_CRAFTING_RESULT = -4;
|
||||||
public const SOURCE_TYPE_CRAFTING_USE_INGREDIENT = -5;
|
public const SOURCE_TYPE_CRAFTING_USE_INGREDIENT = -5;
|
||||||
|
|
||||||
@ -108,12 +107,6 @@ class NetworkInventoryAction{
|
|||||||
break;
|
break;
|
||||||
case self::SOURCE_CREATIVE:
|
case self::SOURCE_CREATIVE:
|
||||||
break;
|
break;
|
||||||
case self::SOURCE_CRAFTING_GRID:
|
|
||||||
$dummy = $packet->getVarInt();
|
|
||||||
if($dummy !== self::SOURCE_TYPE_CRAFTING_USELESS_MAGIC_NUMBER){
|
|
||||||
throw new \UnexpectedValueException("Useless magic number for crafting-grid type was $dummy, expected " . self::SOURCE_TYPE_CRAFTING_USELESS_MAGIC_NUMBER);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case self::SOURCE_TODO:
|
case self::SOURCE_TODO:
|
||||||
$this->windowId = $packet->getVarInt();
|
$this->windowId = $packet->getVarInt();
|
||||||
switch($this->windowId){
|
switch($this->windowId){
|
||||||
@ -151,9 +144,6 @@ class NetworkInventoryAction{
|
|||||||
break;
|
break;
|
||||||
case self::SOURCE_CREATIVE:
|
case self::SOURCE_CREATIVE:
|
||||||
break;
|
break;
|
||||||
case self::SOURCE_CRAFTING_GRID:
|
|
||||||
$packet->putVarInt(self::SOURCE_TYPE_CRAFTING_USELESS_MAGIC_NUMBER);
|
|
||||||
break;
|
|
||||||
case self::SOURCE_TODO:
|
case self::SOURCE_TODO:
|
||||||
$packet->putVarInt($this->windowId);
|
$packet->putVarInt($this->windowId);
|
||||||
break;
|
break;
|
||||||
@ -200,11 +190,13 @@ class NetworkInventoryAction{
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new CreativeInventoryAction($this->oldItem, $this->newItem, $type);
|
return new CreativeInventoryAction($this->oldItem, $this->newItem, $type);
|
||||||
case self::SOURCE_CRAFTING_GRID:
|
|
||||||
return new SlotChangeAction($player->getCraftingGrid(), $this->inventorySlot, $this->oldItem, $this->newItem);
|
|
||||||
case self::SOURCE_TODO:
|
case self::SOURCE_TODO:
|
||||||
//These types need special handling.
|
//These types need special handling.
|
||||||
switch($this->windowId){
|
switch($this->windowId){
|
||||||
|
case self::SOURCE_TYPE_CRAFTING_ADD_INGREDIENT:
|
||||||
|
case self::SOURCE_TYPE_CRAFTING_REMOVE_INGREDIENT:
|
||||||
|
$window = $player->getCraftingGrid();
|
||||||
|
return new SlotChangeAction($window, $this->inventorySlot, $this->oldItem, $this->newItem);
|
||||||
case self::SOURCE_TYPE_CRAFTING_RESULT:
|
case self::SOURCE_TYPE_CRAFTING_RESULT:
|
||||||
case self::SOURCE_TYPE_CRAFTING_USE_INGREDIENT:
|
case self::SOURCE_TYPE_CRAFTING_USE_INGREDIENT:
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user