123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #pragma once
- #include <Array.h>
- #include "Inventory.h"
- #include "ItemFilter.h"
- #include "ItemSlot.h"
- #include "ItemStack.h"
- #include "Recipie.h"
- class CraftingStorage
- {
- public:
- virtual bool isAllAvailable(Framework::RCArray<RecipieInput>& inputs) = 0;
- virtual bool hasFreeSpace(const Item* zItem, int amount) = 0;
- virtual bool consume(Framework::RCArray<RecipieInput>& inputs) = 0;
- virtual void addCraftingResult(ItemStack* stack) = 0;
- };
- class ShapedCraftingStorage : public CraftingStorage
- {
- public:
- virtual bool isAllAvailable(
- Framework::RCArray<RecipieInput>& inputs, int width, int height)
- = 0;
- virtual bool consume(
- Framework::RCArray<RecipieInput>& inputs, int width, int height)
- = 0;
- };
- class BasicShapedCrafter : public ShapedCraftingStorage
- {
- private:
- Framework::Array<ItemSlot*> craftingInput;
- Inventory* zInventory;
- Recipie* 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<RecipieInput>& inputs,
- int width,
- int height) override;
- virtual bool isAllAvailable(
- Framework::RCArray<RecipieInput>& inputs) override;
- virtual bool hasFreeSpace(const Item* zItem, int amount) override;
- virtual bool consume(Framework::RCArray<RecipieInput>& inputs,
- int width,
- int height) override;
- virtual bool consume(Framework::RCArray<RecipieInput>& inputs) override;
- virtual void addCraftingResult(ItemStack* stack) override;
- void applyCurrentRecipie();
- void calculateOutputPreview();
- };
|