Package com.deco2800.game.crafting
Class CraftingSystem
java.lang.Object
com.deco2800.game.crafting.CraftingSystem
- All Implemented Interfaces:
Runnable
Public class that creates a new crafting system which allows users to combine materials in their inventory to make
new items. Implements runnable in order to create multiple threads for concurrent processing.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor that creates an instance of the crafting system class which creates a set of the users inventory and determines what items the users can build with it. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks if an item can be build, then adds it to the list of built items if possible.Returns the instance of inventory contents made and used by the class.void
run()
Run method that creates a daemon to update the users possible builds.void
setInventoryContents
(List<Materials> materials) Sets the users inventory contents to be used by the crafting classes.
-
Field Details
-
configs
-
-
Constructor Details
-
CraftingSystem
public CraftingSystem()Constructor that creates an instance of the crafting system class which creates a set of the users inventory and determines what items the users can build with it. Class then calls an instance of the display to be made and creates a daemon that checks the users inventory.
-
-
Method Details
-
buildItem
Checks if an item can be build, then adds it to the list of built items if possible.- Parameters:
item
-
-
getInventoryContents
Returns the instance of inventory contents made and used by the class. Synchronised to prevent thread write conflicts. -
setInventoryContents
Sets the users inventory contents to be used by the crafting classes. Synchronised to prevent write conflicts.- Parameters:
materials
-
-
run
public void run()Run method that creates a daemon to update the users possible builds.
-