Class ItemFactory

java.lang.Object
com.deco2800.game.entities.factories.ItemFactory
Direct Known Subclasses:
ClueItemFactory, ConsumableItemFactory

public class ItemFactory extends Object
Factory to create item entities with predefined components.

Each item entity type should have a creation method that returns a corresponding entity. Predefined entity properties can be loaded from configs stored as json files which are defined in "ItemConfigs".

  • Constructor Details

    • ItemFactory

      public ItemFactory()
  • Method Details

    • createItem

      public static Entity createItem(int id)
      Create an item with the specified id.
      Parameters:
      id - item id
      Returns:
      the item entity
    • createItem

      public static Entity createItem(String name)
      Create an item with the specified name.
      Parameters:
      name - item name
      Returns:
      item entity
    • createItem

      @Deprecated public static Entity createItem(Entity target, String texturePath)
      Deprecated.
      Creates an item entity.
      Parameters:
      target - entity to chase
      Returns:
      entity