the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "net.minecraft.world.h"
3#include "net.minecraft.world.item.h"
4#include "net.minecraft.world.level.tile.h"
5#include "net.minecraft.world.inventory.h"
6#include "net.minecraft.world.item.crafting.h"
7#include "ArmorSlot.h"
8
9ArmorSlot::ArmorSlot(int slotNum, shared_ptr<Container> container, int id, int x, int y)
10 : Slot( container, id, x, y ),
11 slotNum( slotNum )
12{
13}
14
15int ArmorSlot::getMaxStackSize() const
16{
17 return 1;
18}
19
20bool ArmorSlot::mayPlace(shared_ptr<ItemInstance> item)
21{
22 if (item == NULL)
23 {
24 return false;
25 }
26 if ( dynamic_cast<ArmorItem *>( item->getItem() ) != NULL)
27 {
28 return dynamic_cast<ArmorItem *>( item->getItem() )->slot == slotNum;
29 }
30 if (item->getItem()->id == Tile::pumpkin_Id || item->getItem()->id == Item::skull_Id)
31 {
32 return slotNum == 0;
33 }
34 return false;
35}
36
37Icon *ArmorSlot::getNoItemIcon()
38{
39 return ArmorItem::getEmptyIcon(slotNum);
40}
41
42//
43//bool ArmorSlot::mayCombine(shared_ptr<ItemInstance> item)
44//{
45// shared_ptr<ItemInstance> thisItemI = getItem();
46// if(thisItemI == NULL || item == NULL) return false;
47//
48// ArmorItem *thisItem = (ArmorItem *)thisItemI->getItem();
49// bool thisIsDyableArmor = thisItem->getMaterial() == ArmorItem::ArmorMaterial::CLOTH;
50// bool itemIsDye = item->id == Item::dye_powder_Id;
51// return thisIsDyableArmor && itemIsDye;
52//}
53//
54//shared_ptr<ItemInstance> ArmorSlot::combine(shared_ptr<ItemInstance> item)
55//{
56// shared_ptr<CraftingContainer> craftSlots = shared_ptr<CraftingContainer>( new CraftingContainer(NULL, 2, 2) );
57// craftSlots->setItem(0, item);
58// craftSlots->setItem(1, getItem()); // Armour item needs to go second
59// shared_ptr<ItemInstance> result = ArmorDyeRecipe::assembleDyedArmor(craftSlots);
60// craftSlots->setItem(0, nullptr);
61// craftSlots->setItem(1, nullptr);
62// return result;
63//}