22 public const SOURCE_CONTAINER = 0;
24 public const SOURCE_WORLD = 2;
25 public const SOURCE_CREATIVE = 3;
26 public const SOURCE_TODO = 99999;
38 public const SOURCE_TYPE_CRAFTING_USE_INGREDIENT = -5;
40 public const SOURCE_TYPE_ANVIL_RESULT = -12;
41 public const SOURCE_TYPE_ANVIL_OUTPUT = -13;
43 public const SOURCE_TYPE_ENCHANT_OUTPUT = -17;
45 public const SOURCE_TYPE_TRADING_INPUT_1 = -20;
46 public const SOURCE_TYPE_TRADING_INPUT_2 = -21;
47 public const SOURCE_TYPE_TRADING_USE_INPUTS = -22;
48 public const SOURCE_TYPE_TRADING_OUTPUT = -23;
50 public const SOURCE_TYPE_BEACON = -24;
52 public const ACTION_MAGIC_SLOT_CREATIVE_DELETE_ITEM = 0;
53 public const ACTION_MAGIC_SLOT_CREATIVE_CREATE_ITEM = 1;
55 public const ACTION_MAGIC_SLOT_DROP_ITEM = 0;
56 public const ACTION_MAGIC_SLOT_PICKUP_ITEM = 1;
58 public int $sourceType;
60 public int $sourceFlags = 0;
61 public int $inventorySlot;
72 $this->sourceType = $packet->getUnsignedVarInt();
74 switch($this->sourceType){
75 case self::SOURCE_CONTAINER:
78 case self::SOURCE_WORLD:
81 case self::SOURCE_CREATIVE:
83 case self::SOURCE_TODO:
91 $this->oldItem = $packet->getItemStackWrapper();
92 $this->newItem = $packet->getItemStackWrapper();
101 $packet->putUnsignedVarInt($this->sourceType);
103 switch($this->sourceType){
104 case self::SOURCE_CONTAINER:
107 case self::SOURCE_WORLD:
110 case self::SOURCE_CREATIVE:
112 case self::SOURCE_TODO:
116 throw new \InvalidArgumentException(
"Unknown inventory action source type $this->sourceType");
120 $packet->putItemStackWrapper($this->oldItem);
121 $packet->putItemStackWrapper($this->newItem);