Class CraftingSystem

java.lang.Object
com.deco2800.game.crafting.CraftingSystem
All Implemented Interfaces:
Runnable

public class CraftingSystem extends Object implements 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
    Modifier and Type
    Field
    Description
    static final WeaponConfigSetup
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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
    Sets the users inventory contents to be used by the crafting classes.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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

      public void buildItem(Object item)
      Checks if an item can be build, then adds it to the list of built items if possible.
      Parameters:
      item -
    • getInventoryContents

      public List<Materials> getInventoryContents()
      Returns the instance of inventory contents made and used by the class. Synchronised to prevent thread write conflicts.
    • setInventoryContents

      public void setInventoryContents(List<Materials> materials)
      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.
      Specified by:
      run in interface Runnable