Class PassiveEntityRespawnPoint

All Implemented Interfaces:
TurnListener, Killer, Cloneable, Iterable<String>, Serializable
Direct Known Subclasses:
GrowingPassiveEntityRespawnPoint, SheepFood

public class PassiveEntityRespawnPoint extends Entity implements TurnListener
A PassiveEntityRespawnPoint basically is a 1x1 area where a plant, a fruit or another non-moving thing grows. This growing thing is a pickable Item (e.g. a mushroom, an apple); by extending this class, it can also grow something special (e.g. SheepFood). PassiveEntityRespawnPoint are currently invisible (fully transparent) on the client side. Extend GrowingPassiveEntityRespawnPoint and implement UseListener if grown item should not be dragable without special interaction.
Author:
Daniel Herding
  • Field Details

    • meanTurnsForRegrow

      protected int meanTurnsForRegrow
      Tells how many turns it takes in average for a new fruit to become ripe.
  • Constructor Details

    • PassiveEntityRespawnPoint

      public PassiveEntityRespawnPoint(RPObject object, String growingItemName, int meanTurnsForRegrow)
      Creates an item spawner.
      Parameters:
      object -
      growingItemName - Name of item to be spawned.
      meanTurnsForRegrow - Average number of turns for item to spawn.
    • PassiveEntityRespawnPoint

      public PassiveEntityRespawnPoint(String growingItemName, int meanTurnsForRegrow)
      Creates an item spawner.
      Parameters:
      growingItemName - Name of item to be spawned.
      meanTurnsForRegrow - Average number of turns for item to spawn.
    • PassiveEntityRespawnPoint

      public PassiveEntityRespawnPoint(String growingItemName, int meanTurnsForRegrow, boolean initOnAdded)
      Creates an item spawner.
      Parameters:
      growingItemName - Name of item to be spawned.
      meanTurnsForRegrow - Average number of turns for item to spawn.
      initOnAdded - If true, sets to full grown and initializes respawn timer when added to zone.
  • Method Details

    • generateRPClass

      public static void generateRPClass()
    • onAdded

      public void onAdded(StendhalRPZone zone)
      Description copied from class: Entity
      Called when this object is added to a zone.
      Overrides:
      onAdded in class Entity
      Parameters:
      zone - The zone this was added to.
    • onRemoved

      public void onRemoved(StendhalRPZone zone)
      Description copied from class: Entity
      Called when this object is being removed from a zone.
      Overrides:
      onRemoved in class Entity
      Parameters:
      zone - The zone this will be removed from.
    • onFruitPicked

      public void onFruitPicked(Item picked)
      Is called when a fruit has been picked from this plant grower.
      Parameters:
      picked - The fruit that has been picked. Use null for subclasses of PlantGrower that don't use items as fruits.
    • getRandomTurnsForRegrow

      protected int getRandomTurnsForRegrow()
    • growNewFruit

      protected void growNewFruit()
      Creates a new fruit.
    • setToFullGrowth

      public void setToFullGrowth()
    • onTurnReached

      public void onTurnReached(int currentTurn)
      Description copied from interface: TurnListener
      This method is called when the turn number is reached.
      Specified by:
      onTurnReached in interface TurnListener
      Parameters:
      currentTurn - current turn number
    • setStartState

      public void setStartState()
    • onItemPickedUp

      public void onItemPickedUp(Player player)
    • getItemName

      public String getItemName()
      Retrieves name of item that is grown/spawned.