@@ -828,29 +828,50 @@ static Inventory^ CreateContainerInventory(String^ playerName, int containerType
828828 }
829829 }
830830
831+ String^ title = nullptr ;
832+ if (openData->hasTitle && openData->title [0 ] != ' \0 ' )
833+ {
834+ title = gcnew String (openData->title );
835+ }
836+
831837 InventoryType type = MapContainerType (containerType);
838+ ContainerInventory^ result = nullptr ;
832839
833840 switch (type)
834841 {
835842 case InventoryType::PLAYER:
836843 return gcnew PlayerInventory (playerName);
837844 case InventoryType::DOUBLE_CHEST:
838- return gcnew DoubleChestInventory (playerName, slotCount, items);
845+ result = gcnew DoubleChestInventory (playerName, slotCount, items);
846+ break ;
839847 case InventoryType::WORKBENCH:
840- return gcnew CraftingInventory (playerName, slotCount, items);
848+ result = gcnew CraftingInventory (playerName, slotCount, items);
849+ break ;
841850 case InventoryType::BREWING:
842- return gcnew BrewerInventory (playerName, slotCount, items);
851+ result = gcnew BrewerInventory (playerName, slotCount, items);
852+ break ;
843853 case InventoryType::BEACON:
844- return gcnew BeaconInventory (playerName, slotCount, items);
854+ result = gcnew BeaconInventory (playerName, slotCount, items);
855+ break ;
845856 case InventoryType::ENCHANTING:
846- return gcnew EnchantingInventory (playerName, slotCount, items);
857+ result = gcnew EnchantingInventory (playerName, slotCount, items);
858+ break ;
847859 case InventoryType::FURNACE:
848- return gcnew FurnaceInventory (playerName, slotCount, items);
860+ result = gcnew FurnaceInventory (playerName, slotCount, items);
861+ break ;
849862 case InventoryType::HORSE:
850- return gcnew HorseInventory (playerName, slotCount, items);
863+ result = gcnew HorseInventory (playerName, slotCount, items);
864+ break ;
851865 default :
852- return gcnew ContainerInventory (playerName, type, slotCount, items);
866+ result = gcnew ContainerInventory (playerName, type, slotCount, items);
867+ break ;
868+ }
869+
870+ if (title != nullptr )
871+ {
872+ result->setTitle (title);
853873 }
874+ return result;
854875}
855876
856877void FourKit::FireEventOnInventoryOpen (InventoryOpenData* openData, bool * cancelled)
0 commit comments