Merge commit '911b6feaf927a7dd9f54240d9bf6b0f7684df692'

This commit is contained in:
Dylan K. Taylor 2019-12-25 13:52:21 +00:00
commit b6071bff36

View File

@ -53,18 +53,12 @@ class NetworkInventoryAction{
*
* Expect these to change in the future.
*/
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_USE_INGREDIENT = -5;
public const SOURCE_TYPE_ANVIL_INPUT = -10;
public const SOURCE_TYPE_ANVIL_MATERIAL = -11;
public const SOURCE_TYPE_ANVIL_RESULT = -12;
public const SOURCE_TYPE_ANVIL_OUTPUT = -13;
public const SOURCE_TYPE_ENCHANT_INPUT = -15;
public const SOURCE_TYPE_ENCHANT_MATERIAL = -16;
public const SOURCE_TYPE_ENCHANT_OUTPUT = -17;
public const SOURCE_TYPE_TRADING_INPUT_1 = -20;
@ -74,9 +68,6 @@ class NetworkInventoryAction{
public const SOURCE_TYPE_BEACON = -24;
/** Any client-side window dropping its contents when the player closes it */
public const SOURCE_TYPE_CONTAINER_DROP_CONTENTS = -100;
public const ACTION_MAGIC_SLOT_CREATIVE_DELETE_ITEM = 0;
public const ACTION_MAGIC_SLOT_CREATIVE_CREATE_ITEM = 1;
@ -220,27 +211,9 @@ class NetworkInventoryAction{
case self::SOURCE_TODO:
//These types need special handling.
switch($this->windowId){
case self::SOURCE_TYPE_CRAFTING_ADD_INGREDIENT:
case self::SOURCE_TYPE_CRAFTING_REMOVE_INGREDIENT:
case self::SOURCE_TYPE_CONTAINER_DROP_CONTENTS: //TODO: this type applies to all fake windows, not just crafting
return new SlotChangeAction($player->getCraftingGrid(), $this->inventorySlot, $this->oldItem, $this->newItem);
case self::SOURCE_TYPE_CRAFTING_RESULT:
case self::SOURCE_TYPE_CRAFTING_USE_INGREDIENT:
return null;
case self::SOURCE_TYPE_ANVIL_INPUT:
case self::SOURCE_TYPE_ANVIL_MATERIAL:
$window = $player->getCurrentWindow();
if(!($window instanceof AnvilInventory)){
throw new \UnexpectedValueException("Current open container is not an anvil");
}
return new SlotChangeAction($window, $this->inventorySlot, $this->oldItem, $this->newItem);
case self::SOURCE_TYPE_ENCHANT_INPUT:
case self::SOURCE_TYPE_ENCHANT_MATERIAL:
$window = $player->getCurrentWindow();
if(!($window instanceof EnchantInventory)){
throw new \UnexpectedValueException("Current open container is not an enchanting table");
}
return new SlotChangeAction($window, $this->inventorySlot, $this->oldItem, $this->newItem);
}
//TODO: more stuff