12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #pragma once
- #include <Array.h>
- #include "ItemStack.h"
- #include "ItemFilter.h"
- #include "ItemSlot.h"
- #include "Inventory.h"
- #include "Recipie.h"
- class CraftingStorage
- {
- public:
- virtual bool isAllAvailable(Framework::RCArray<ItemFilter>& filters, Framework::Array<int>& inputAmount) = 0;
- virtual bool hasFreeSpace(const Item* zItem, int amount) = 0;
- virtual bool consume(Framework::RCArray<ItemFilter>& filters, Framework::Array<int>& inputAmount) = 0;
- virtual void addCraftingResult(ItemStack* stack) = 0;
- };
- class ShapedCraftingStorage
- {
- public:
- virtual bool isAllAvailable(Framework::RCArray<ItemFilter>& filters, int width, int height) = 0;
- virtual bool hasFreeSpace(const Item* zItem, int amount) = 0;
- virtual bool consume(Framework::RCArray<ItemFilter>& filters, Framework::RCArray<ItemModifier>& modifiers, int width, int height) = 0;
- virtual void addCraftingResult(ItemStack* stack) = 0;
- };
- class BasicShapedCrafter : public ShapedCraftingStorage
- {
- private:
- Framework::Array<ItemSlot*> craftingInput;
- Inventory* zInventory;
- ShapedRecipie* currentRecipie;
- Framework::Text recipieList;
- int width;
- int height;
- void getOutputPreview(NetworkMessage* zMsg);
- public:
- BasicShapedCrafter(int width, int height, Inventory* zInventory, Framework::Text recipieList);
- virtual bool isAllAvailable(Framework::RCArray<ItemFilter>& filters, int width, int height) override;
- virtual bool hasFreeSpace(const Item* zItem, int amount) override;
- virtual bool consume(Framework::RCArray<ItemFilter>& filters, Framework::RCArray<ItemModifier>& modifiers, int width, int height) override;
- virtual void addCraftingResult(ItemStack* stack) override;
- void applyCurrentRecipie();
- void calculateOutputPreview();
- };
|