Class Definitions

java.lang.Object
net.risingworld.api.definitions.Definitions

public final class Definitions extends Object
A static class which provides access to various game definitions. Almost all definitions are stored in the "definitions.db" SQLite database file (which is located in the /Data/StreamingAssets/ folder in the game directory).
  • Constructor Details

    • Definitions

      public Definitions()
  • Method Details

    • getItemDefinition

      public static Items.ItemDefinition getItemDefinition(int id)
      Gets an item definition by id.
      Parameters:
      id - the id of the item definition.
      Returns:
      the definition, or null if no such definition exists.
    • getItemDefinition

      public static Items.ItemDefinition getItemDefinition(String name)
      Gets an item definition by name, using the internal name (e.g "pickaxe"), not the localized name!
      Parameters:
      name - the internal name of the item definition.
      Returns:
      the definition, or null if no such definition exists.
      Example: Get item definition by name
      1Items.ItemDefinition def = Definitions.getItemDefinition("pickaxe");
      2if (def != null) {
      3 System.out.println("Item: " + def.name + " (ID: " + def.id + "), Variants: " + def.variations + ", Type: " + def.type + ", Stack size: " + def.stacksize);
      4}
    • getAllItemDefinitions

      public static Items.ItemDefinition[] getAllItemDefinitions()
      Gets an array containing all item definitions of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all item definitions.
      Example: Print names of all existing items
      1for (Items.ItemDefinition itemDef : Definitions.getAllItemDefinitions()) {
      2 if (itemDef != null) {
      3 System.out.println(itemDef.id + " " + itemDef.name);
      4 }
      5}
    • getItemVariant

      public static Items.ItemDefinition.Variant getItemVariant(String item, int variant)
      Gets an item variant definition, determines by the item definition name and the according variant. Only few items actually have variants. Most items only have the default variant (0).
      Parameters:
      item - the internal name of the item definition you want to get the variant for.
      variant - the variant. Default variant is 0.
      Returns:
      the variant definition, or null if no such variant/definition exists.
    • getObjectDefinition

      public static Objects.ObjectDefinition getObjectDefinition(int id)
      Gets an object definition by id.
      Parameters:
      id - the id of the object definition.
      Returns:
      the definition, or null if no such definition exists.
    • getObjectDefinition

      public static Objects.ObjectDefinition getObjectDefinition(String name)
      Gets an object definition by name, using the internal name (e.g "workbench"), not the localized name!
      Parameters:
      name - the internal name of the object definition.
      Returns:
      the definition, or null if no such definition exists.
    • getAllObjectDefinitions

      public static Objects.ObjectDefinition[] getAllObjectDefinitions()
      Gets an array containing all object definitions of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all object definitions.
    • getConstructionDefinition

      public static Constructions.ConstructionDefinition getConstructionDefinition(int id)
      Gets a construction definition by id.
      Parameters:
      id - the id of the construction definition.
      Returns:
      the definition, or null if no such definition exists.
    • getConstructionDefinition

      public static Constructions.ConstructionDefinition getConstructionDefinition(String name)
      Gets a construction definition by name, using the internal name (e.g "block").
      Parameters:
      name - the internal name of the construction definition.
      Returns:
      the definition, or null if no such definition exists.
    • getAllConstructionDefinitions

      public static Constructions.ConstructionDefinition[] getAllConstructionDefinitions()
      Gets an array containing all construction definitions of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all construction definitions.
    • getPlantDefinition

      public static Plants.PlantDefinition getPlantDefinition(int id)
      Gets a plant definition by id.
      Parameters:
      id - the id of the plant definition.
      Returns:
      the definition, or null if no such definition exists.
    • getPlantDefinition

      public static Plants.PlantDefinition getPlantDefinition(String name)
      Gets a plant definition by name, using the internal name (e.g "tomato" or "spruceforest" etc).
      Parameters:
      name - the internal name of the plant definition.
      Returns:
      the definition, or null if no such definition exists.
    • getAllPlantDefinitions

      public static Plants.PlantDefinition[] getAllPlantDefinitions()
      Gets an array containing all plant definitions of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all plant definitions.
    • getClothingDefinition

      public static Clothing.ClothingDefinition getClothingDefinition(int id)
      Gets a clothing definition by id.
      Parameters:
      id - the id of the clothing definition.
      Returns:
      the definition, or null if no such definition exists.
    • getClothingDefinition

      public static Clothing.ClothingDefinition getClothingDefinition(String name)
      Gets a clothing definition by name, using the internal name (e.g "mininghelmet"), not the localized name!
      Parameters:
      name - the internal name of the clothing definition.
      Returns:
      the definition, or null if no such definition exists.
    • getAllClothingDefinitions

      public static Clothing.ClothingDefinition[] getAllClothingDefinitions()
      Gets an array containing all clothing definitions of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all clothing definitions.
    • getNpcDefinition

      public static Npcs.NpcDefinition getNpcDefinition(int id)
      Gets an npc definition by id.
      Parameters:
      id - the id of the npc definition.
      Returns:
      the definition, or null if no such definition exists.
    • getNpcDefinition

      public static Npcs.NpcDefinition getNpcDefinition(String name)
      Gets an npc definition by name, using the internal name (e.g "cow" or "goat" etc).
      Parameters:
      name - the internal name of the npc definition.
      Returns:
      the definition, or null if no such definition exists.
    • getAllNpcDefinitions

      public static Npcs.NpcDefinition[] getAllNpcDefinitions()
      Gets an array containing all npc definitions of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all npc definitions.
    • getStorageDefinition

      public static Objects.StorageDefinition getStorageDefinition(String name)
      Gets a storage definition by name, using the internal name (e.g "chest1" or "leathertrunk" etc).
      Parameters:
      name - the internal name of the storage definition.
      Returns:
      the definition, or null if no such definition exists.
    • getAllStorageDefinitions

      public static Objects.StorageDefinition[] getAllStorageDefinitions()
      Gets an array containing all storage definitions of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all storage definitions.
    • getObjectInfoDefinition

      public static Objects.ObjectInfoDefinition getObjectInfoDefinition(String name)
    • getObjectInfoDefinitionByTypeID

      public static Objects.ObjectInfoDefinition getObjectInfoDefinitionByTypeID(int typeID)
    • getAllObjectInfoDefinitions

      public static Objects.ObjectInfoDefinition[] getAllObjectInfoDefinitions()
    • getCraftingStation

      public static Crafting.CraftingStation getCraftingStation(String name)
      Gets a crafting station definition by name. The name is usually the internal name of the related object element (e.g. "workbench", "anvil" etc).
      Parameters:
      name - the name of the crafting station (usually the internal object name).
      Returns:
      the definition, or null if no such definition exists.
    • getAllCraftingStations

      public static Crafting.CraftingStation[] getAllCraftingStations()
      Gets an array containing all crafting station definitions of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all crafting station definitions.
    • getRecipe

      public static Crafting.Recipe getRecipe(String name)
      Gets a crafting recipe by id. The name is usually the internal name of the related item or object (e.g. "pickaxe", "table" etc). If the target item/object has multiple variants, this recipe always represents the default variant.
      Parameters:
      name - the name of the recipe (usually the internal name of the item/object represented by this recipe).
      Returns:
      the recipe, or null if no such recipe exists.
      See Also:
    • getRecipe

      public static Crafting.Recipe getRecipe(String name, int itemTexture)
      Gets a crafting recipe by id and texture. The name is usually the internal name of the related item or object (e.g. "pickaxe", "table" etc). The texture represents the item texture or variant.
      Parameters:
      name - the name of the recipe (usually the internal name of the item/object represented by this recipe).
      itemTexture - the target item/object texture/variant. For blocks, this is the target texture. For other items or objects, it's the optional variant.
      Returns:
      the recipe, or null if no such recipe exists.
    • getAllRecipes

      public static Crafting.Recipe[] getAllRecipes()
      Gets an array containing all crafting recipes of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all recipes.
    • getPickingInfo

      public static Items.PickingInfo getPickingInfo(String name)
    • getAllPickingInfos

      public static Items.PickingInfo[] getAllPickingInfos()
      Gets an array containing all picking info definitions of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all picking info definitions.
    • getItemInfo

      public static Items.ItemInfo getItemInfo(String name, Items.ItemInfoType type)
    • getItemInfo

      public static Items.ItemInfo getItemInfo(Items.ItemDefinition itemDefinition, Items.ItemInfoType type)
    • getAllItemInfos

      public static Items.ItemInfo[] getAllItemInfos()
      Gets an array containing all item info definitions of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all item info definitions.
    • getWeaponDefinition

      public static Items.WeaponDefinition getWeaponDefinition(String name)
    • getAllWeaponDefinitions

      public static Items.WeaponDefinition[] getAllWeaponDefinitions()
    • getConsumeInfo

      public static Items.ConsumeInfo getConsumeInfo(String name)
    • getAllConsumeInfos

      public static Items.ConsumeInfo[] getAllConsumeInfos()
      Gets an array containing all consume definitions of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all consume definitions.
    • getProjectileDefinition

      public static Items.ProjectileDefinition getProjectileDefinition(int id)
    • getProjectileDefinition

      public static Items.ProjectileDefinition getProjectileDefinition(String name)
    • getAllProjectileDefinitions

      public static Items.ProjectileDefinition[] getAllProjectileDefinitions()
      Gets an array containing all projectile definitions of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all projectile definitions.
    • getVehicleDefinition

      public static Vehicles.VehicleDefinition getVehicleDefinition(int id)
      Gets a vehicle definition by id.
      Parameters:
      id - the id of the vehicle definition.
      Returns:
      the definition, or null if no such definition exists.
    • getVehicleDefinition

      public static Vehicles.VehicleDefinition getVehicleDefinition(String name)
      Gets a vehicle definition by name.
      Parameters:
      name - the internal name of the vehicle.
      Returns:
      the definition, or null if no such definition exists.
    • getAllVehicleDefinitions

      public static Vehicles.VehicleDefinition[] getAllVehicleDefinitions()
      Gets an array containing all vehicle definitions of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all vehicle definitions.
    • getAllVehicleComponents

      public static Vehicles.VehicleComponent[] getAllVehicleComponents()
      Gets an array containing all vehicle component definitions of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all vehicle components.
    • getVehicleAssembly

      public static Vehicles.VehicleAssembly getVehicleAssembly(String name, int constructionStage)
      Gets a vehicle assembly definition by vehicle name and construction stage.
      Parameters:
      name - the internal name of the vehicle.
      constructionStage - the construction stage.
      Returns:
      the vehicle assembly definition, or null if no such definition exists.
    • getAllVehicleAssemblies

      public static Vehicles.VehicleAssembly[] getAllVehicleAssemblies()
      Gets an array containing all vehicle assembly definitions of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all vehicle assemblies.
    • getWeather

      public static WeatherDefs.Weather getWeather(int id)
      Gets a weather definition by id.
      Parameters:
      id - the id of the weather definition.
      Returns:
      the definition, or null if no such definition exists.
    • getWeather

      public static WeatherDefs.Weather getWeather(String name)
      Gets a weather definition by name, using the internal name (e.g "overcast" or "default" etc).
      Parameters:
      name - the internal name of the weather definition.
      Returns:
      the definition, or null if no such definition exists.
    • getAllWeathers

      public static WeatherDefs.Weather[] getAllWeathers()
      Gets an array containing all weather definitions of the game. Please note that the array may contain null entries!
      Returns:
      a new array containing all weather definitions.