123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #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<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();
- };
|