### Define Command Examples in C# Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.IChatCommand The WithExamples(params string[] examples) method defines one or more examples on how the command can be executed. It takes a variable number of string examples as input and returns an IChatCommand, enabling method chaining. This helps users understand how to use the command effectively. ```csharp IChatCommand WithExamples(params string[] examaples)__ ``` -------------------------------- ### CompositeShape Base Shape Configuration Example Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.CompositeShape JSON configuration example showing a simple CompositeShape with a base block shape reference. Demonstrates basic shape setup pointing to a cube primitive. ```json "shape": { "base": "block/basic/cube" } ``` -------------------------------- ### WithExamples Method Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.IChatCommand Defines one or more usage examples showing how the command can be executed. Multiple examples can demonstrate different use cases. ```APIDOC ## IChatCommand.WithExamples(params string[]) ### Description Define one or more examples on how this command can be executed. ### Method IChatCommand WithExamples(params string[] examples) ### Parameters #### Method Parameters - **examples** (string[]) - Required - One or more command usage examples ### Returns - **IChatCommand** - Returns the IChatCommand instance for method chaining ### Usage Notes Examples should show realistic command invocation patterns to help users understand usage. ``` -------------------------------- ### NatFloat Examples Source: https://apidocs.vintagestory.at/json-docs/jsondocs/Vintagestory.API.MathTools.NatFloat Examples demonstrating the configuration of NatFloat for generating random quantities. These examples show different distribution types and parameters. ```json "quantity": { "dist": "strongerinvexp", "avg": 6, "var": 4 }__ ``` ```json "quantity": { "avg": 4, "var": 2 }__ ``` -------------------------------- ### StartPre Method (C#) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.ModSystem Called during initial mod loading, before any mod receives the call to Start(). Used for early initialization tasks that need to happen before other mods start. ```csharp public virtual void StartPre(ICoreAPI api)__ ``` -------------------------------- ### Define Ingredient Example - JSON Source: https://apidocs.vintagestory.at/json-docs/jsondocs/Vintagestory.GameContent.BarrelRecipeIngredient Provides JSON examples of ingredient definitions for barrel recipes. These examples specify item types, codes, quantities, and litres, demonstrating how to configure different ingredient configurations. These snippets help illustrate how different ingredients are structured in the game's data. ```json { "type": "item", "code": "strongtanninportion", "litres": 2, "consumeLitres": 2 } ``` ```json { "type": "item", "code": "hide-prepared-small", "quantity": 1 } ``` -------------------------------- ### Client Entity Configuration Example (JSON) Source: https://apidocs.vintagestory.at/json-docs/jsondocs/Vintagestory.ServerMods.NoObf.ClientEntityConfig An example of how to structure the client-side entity configuration in JSON format. This includes settings for the renderer, textures, shape, size, and behaviors. ```json "client": { "renderer": "Shape", "textures": { "material": { "base": "block/stone/rock/{rock}1" } }, "shape": { "base": "item/stone" }, "size": 1, "behaviors": [ { "code": "passivephysics" }, { "code": "interpolateposition" } ] },__ ``` -------------------------------- ### Methods: GetStartPos(BlockPos, EnumOrigin) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.BlockSchematic Gets the starting position of the schematic. ```APIDOC ## Methods ### GetStartPos(BlockPos, EnumOrigin) Gets the starting position of the schematic. ``` public virtual BlockPos GetStartPos(BlockPos pos, EnumOrigin origin)__ ``` #### Parameters `pos` BlockPos `origin` EnumOrigin #### Returns BlockPos ``` -------------------------------- ### Start Method (C#) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.ModSystem The main start method, called on both server and client after mods have received StartPre(). This is where you typically register events and network packets, as well as register classes for blocks, items, entities, etc. ```csharp public virtual void Start(ICoreAPI api)__ ``` -------------------------------- ### Start Music Track - C# Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.ICoreClientAPI Starts playing a music track with specified priority, sound type and playnow parameters. Allows to play music tracks. ```csharp void StartTrack(MusicTrack track, float priority, EnumSoundType soundType, bool playnow = true) ``` ```csharp MusicTrack StartTrack(AssetLocation soundLocation, float priority, EnumSoundType soundType, Action onLoaded = null) ``` -------------------------------- ### AnimationMetaData Example Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.AnimationMetaData Demonstrates the structure and properties of an AnimationMetaData object using a JSON example. The example shows how to configure animations with properties such as code, animation, speed, weight, and blend mode. It also includes the use of triggeredBy to control animation activation. ```json { "animations": [ { "code": "hurt", "animation": "hurt", "animationSpeed": 2.2, "weight": 10, "blendMode": "AddAverage" }, { "code": "die", "animation": "death", "animationSpeed": 1.25, "weight": 10, "blendMode": "Average", "triggeredBy": { "onControls": [ "dead" ] } }, { "code": "idle", "animation": "idle", "blendMode": "AddAverage", "easeOutSpeed": 4, "triggeredBy": { "defaultAnim": true } }, { "code": "walk", "animation": "walk", "weight": 5 } ] } ``` -------------------------------- ### SpawnConditions Configuration Example Source: https://apidocs.vintagestory.at/json-docs/jsondocs/Vintagestory.API.Common.Entities.SpawnConditions JSON configuration example showing worldgen and runtime spawn conditions for wild pigs. Demonstrates TriesPerChunk, light levels, temperature ranges, rainfall, forest density, group size distribution, and companion entities. ```json "spawnconditions": { "worldgen": { "TriesPerChunk": { "avg": 0.1, "var": 0 }, "tryOnlySurface": true, "minLightLevel": 10, "groupSize": { "dist": "verynarrowgaussian", "avg": 3, "var": 4 }, "insideBlockCodes": [ "air", "tallgrass-*" ], "minTemp": 5, "maxTemp": 28, "minRain": 0.45, "minForest": 0.35, "companions": [ "pig-wild-female", "pig-wild-piglet" ] }, "runtime": { "group": "neutral", "tryOnlySurface": true, "chance": 0.0006, "maxQuantity": 4, "minLightLevel": 10, "groupSize": { "dist": "verynarrowgaussian", "avg": 3, "var": 4 }, "insideBlockCodes": [ "air", "tallgrass-*" ], "minTemp": 5, "maxTemp": 28, "minRain": 0.45, "minForestOrShrubs": 0.35, "companions": [ "pig-wild-female", "pig-wild-piglet" ] } } ``` -------------------------------- ### Get Start Position C# Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.BlockSchematic Gets the starting position of the schematic based on a given position and origin. Useful for determining the starting point of the schematic within the world. ```csharp public virtual BlockPos GetStartPos(BlockPos pos, EnumOrigin origin)__ ``` -------------------------------- ### MetalAlloyIngredient Example (JSON) Source: https://apidocs.vintagestory.at/json-docs/jsondocs/Vintagestory.GameContent.MetalAlloyIngredient Demonstrates a JSON example of how a MetalAlloyIngredient is structured. This snippet defines the type, code, minratio, and maxratio for a specific metal ingot. The minratio and maxratio properties specify the range of the metal's ratio in an alloy recipe. ```json { "type": "item", "code": "ingot-copper", "minratio": 0.5, "maxratio": 0.7 } ``` -------------------------------- ### Init in C# Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.ModInfo The Init method initializes the ModInfo class. This method likely performs setup operations. There are no input parameters or return values. ```csharp public void Init()__ ``` -------------------------------- ### JSON Example: ElevatorControl Behavior Configuration Source: https://apidocs.vintagestory.at/json-docs/jsondocs/Vintagestory.GameContent.BlockBehaviorElevatorControl This JSON snippet demonstrates how to configure the 'ElevatorControl' behavior. It is a configuration example for use within the Vintage Story game. The provided configuration example indicates how to enable 'ElevatorControl' behavior. ```json "behaviors": [ { "name": "ElevatorControl" } ] ``` -------------------------------- ### CairoFont.SetupContext Method Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.CairoFont Sets up the context for rendering with the CairoFont. Must be executed in the main thread due to thread safety considerations. ```csharp public void SetupContext(Context ctx)__ ``` -------------------------------- ### BlockBehaviorPushEventOnBlockBroken Usage Example Source: https://apidocs.vintagestory.at/json-docs/jsondocs/Vintagestory.GameContent.BlockBehaviorPushEventOnBlockBroken This JSON configuration example illustrates how to use the PushEventOnBlockBroken behavior. It configures a bamboo block to trigger a 'testForDecay' event when broken. This setup allows for custom actions to be executed after a block is destroyed. ```json "behaviorsByType": { "bamboo-grown-*": [ { "name": "PushEventOnBlockBroken", "properties": { "eventName": "testForDecay" } } ] } ``` -------------------------------- ### AssetsFinalize Method (C#) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.ModSystem Performs final asset setup after Block.OnLoaded() methods have been called. This method is used for any asset setup that needs to be done after the initial loading. It's typically used on the server side. ```csharp public virtual void AssetsFinalize(ICoreAPI api)__ ``` -------------------------------- ### Baking Stage Example (JSON) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.BakingProperties Demonstrates the usage of baking properties through a JSON example, focusing on a bread baking process with different stages. Each stage defines attributes like temperature, level ranges, and result codes. This example showcases the structure and usage of the baking properties within a JSON configuration. ```json "attributesByType": { "*-partbaked": { "bakingProperties": { "temp": 160, "levelFrom": 0.25, "levelTo": 0.5, "startScaleY": 0.95, "endScaleY": 1.10, "resultCode": "bread-{type}-perfect", "initialCode": "dough-{type}" } }, "*-perfect": { "bakingProperties": { "temp": 160, "levelFrom": 0.5, "levelTo": 0.75, "startScaleY": 1.10, "endScaleY": 1.13, "resultCode": "bread-{type}-charred", "initialCode": "bread-{type}-partbaked" } }, "*-charred": { "bakingProperties": { "temp": 160, "levelFrom": 0.75, "levelTo": 1, "startScaleY": 1.13, "endScaleY": 1.10, "initialCode": "bread-{type}-perfect" } } } ``` -------------------------------- ### IMusicTrack Initialization Methods Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.IMusicTrack Methods for initializing and preparing the music track for playback with required API references and managers. ```APIDOC ## Initialize Method ### Initialize(IAssetManager, ICoreClientAPI, IMusicEngine) **Description:** Initializes the music track with necessary API references and managers required for playback. **Method:** INIT **Parameters:** - **assetManager** (IAssetManager) - Required - The global Asset Manager for resource loading - **capi** (ICoreClientAPI) - Required - The Core Client API reference - **musicEngine** (IMusicEngine) - Required - The music engine managing playback **Usage:** ```csharp void Initialize(IAssetManager assetManager, ICoreClientAPI capi, IMusicEngine musicEngine) ``` **Notes:** This method must be called before the track can be used. It provides the track with access to essential Vintage Story client APIs. ``` -------------------------------- ### Get Cuboidi Start and End Positions C# Source: https://apidocs.vintagestory.at/api/Vintagestory.API.MathTools.Cuboidi Properties that return the start and end positions of the cuboid as Vec3i objects, and a Coordinates property that returns all six coordinate values as an integer array. ```csharp public Vec3i Start { get; } public Vec3i End { get; } public int[] Coordinates { get; } ``` -------------------------------- ### Start Animation C# Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.AnimationUtil Attempts to start an animation. It takes AnimationMetaData as input and returns a boolean indicating success. ```csharp public virtual bool StartAnimation(AnimationMetaData meta)__ ``` -------------------------------- ### PhysicsBehaviorBase Methods Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.Entities.PhysicsBehaviorBase Provides methods for initializing and managing physics behaviors. Includes AfterInitialized for post-initialization logic and Init/InitServerMT for setup. ```csharp public override void AfterInitialized(bool onFirstSpawn) public void Init() public static void InitServerMT(ICoreServerAPI sapi) ``` -------------------------------- ### Get Total Received Bytes Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Server.IServerAPI Returns the total number of bytes received by the server since it started. This metric can be used for network monitoring or analysis. ```csharp long TotalReceivedBytes { get; } ``` -------------------------------- ### BeginChildElements Method Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.GuiComposer The BeginChildElements method starts a set of child elements. ```APIDOC ## BeginChildElements() ### Description Starts a set of child elements. ### Method Method ### Endpoint `public GuiComposer BeginChildElements()__` ### Parameters None ### Request Example N/A ### Response #### Success Response (Return) - **GuiComposer** (GuiComposer) - The GuiComposer instance. #### Response Example N/A ``` -------------------------------- ### Get Total Sent Bytes Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Server.IServerAPI Returns the total number of bytes sent by the server since it started. This metric is useful for network traffic monitoring and analysis. ```csharp long TotalSentBytes { get; } ``` -------------------------------- ### StartClientSide Method (C#) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.ModSystem Initializes the mod specifically on the client-side. In multiplayer games, server assets might not be available at this point. Use this to perform client-specific initialization tasks, like setting up UI or rendering elements. ```csharp public virtual void StartClientSide(ICoreClientAPI api)__ ``` -------------------------------- ### Enum Member: Before Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.EnumRenderStage The initial stage of the rendering process, 'Before' any rendering begins. This is used for setup operations that need to be performed before the main rendering loop starts. ```csharp `Before = 0` ``` -------------------------------- ### Get Milliseconds Since Last Track Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.IMusicEngine Returns the total elapsed milliseconds since the game started when the last track finished playing. This is a long integer value. ```csharp long MillisecondsSinceLastTrack { get; }__ ``` -------------------------------- ### init Method in C# Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.RichTextComponent Initializes the text component. This method performs setup tasks. It's called internally before the component is ready for use. ```C# protected void init()__ ``` -------------------------------- ### ClientAnimator Method: AnimNowActive Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.ClientAnimator A protected method that is called when an animation becomes active. It's intended to handle the initial state setup or any logic required when an animation starts playing. ```csharp protected override void AnimNowActive(RunningAnimation anim, AnimationMetaData animData)__ ``` -------------------------------- ### Start Base Animation from Config Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.PlayerAnimationManager Starts a base animation using its configuration code. Returns a boolean indicating success. ```csharp public bool StartAnimationBase(string configCode)__ ``` -------------------------------- ### JSON Example for Item Configuration Source: https://apidocs.vintagestory.at/json-docs/jsondocs/Vintagestory.ServerMods.NoObf.ItemType This JSON example demonstrates the structure for defining an item within the game. It defines properties for item behavior, such as shape, creative inventory settings, held animations, stack size, and other properties related to how the item interacts within the game world. The properties are used to customize the item's appearance and behavior within the game. ```json { "code": "strawdummy", "class": "ItemStrawDummy", "shape": { "base": "entity/land/strawdummy" }, "creativeinventory": { ... }, "heldTpIdleAnimation": "holdunderarm", "maxstacksize": 1, "combustibleProps": { ... }, "guiTransform": { ... }, "fpHandTransform": { ... }, "tpHandTransform": { ... } } ``` -------------------------------- ### BeforeRender Method C# Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.Entities.EntityRenderer This method is called before in-world rendering starts. It takes a `float` representing the time delta. This allows for pre-render setup or adjustments before the main rendering pass. ```csharp public virtual void BeforeRender(float dt)__ ``` -------------------------------- ### Initialize Method in C# Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.RainMusicTrack Initializes the music track, setting up dependencies like the asset manager, core client API, and music engine. This method is called to prepare the track for playback and manage resources. It sets up the track. ```csharp public void Initialize(IAssetManager assetManager, ICoreClientAPI capi, IMusicEngine musicEngine)__ ``` -------------------------------- ### MusicTrack Initialize Method in C# Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.MusicTrack Virtual method that initializes the track with required dependencies. Requires IAssetManager, ICoreClientAPI, and IMusicEngine parameters to set up the track for use within the game's audio system. ```csharp public virtual void Initialize(IAssetManager assetManager, ICoreClientAPI capi, IMusicEngine musicEngine) ``` -------------------------------- ### Get Key Name String - C# Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.GlKeyNames Retrieves the string representation of a GlKeys value, converting it to uppercase without considering modifiers. For example, GlKeys.W on a QWERTY keyboard returns 'W'. ```csharp public static string GetKeyName(GlKeys key) ``` -------------------------------- ### Start Thread Safely with TryStart Extension Method Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.ThreadExtensions The TryStart extension method safely attempts to start a given Thread. It is part of the ThreadExtensions class and is designed to prevent exceptions if the thread has already been started or is in an invalid state. This method has no direct return value but modifies the state of the thread object it is called upon. ```csharp public static class ThreadExtensions { public static void TryStart(this Thread t) { // Implementation details omitted for brevity } } ``` -------------------------------- ### IMusicTrack Methods - Initialization and Management Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.IMusicTrack Includes methods for initializing the music track with necessary game components and for determining if a track should play based on player properties, climate conditions, and location. Also includes a method to update the track's volume. ```csharp void Initialize(IAssetManager assetManager, ICoreClientAPI capi, IMusicEngine musicEngine) ``` ```csharp bool ShouldPlay(TrackedPlayerProperties props, ClimateCondition conds, BlockPos pos) ``` ```csharp void UpdateVolume() ``` ```csharp void BeginSort() ``` -------------------------------- ### Create Child Element Bounds Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.ElementBounds A simple method to create a new ElementBounds object that can act as a child element. This is often used as a starting point for more complex child element setups. ```csharp public ElementBounds ForkChild()__ ``` -------------------------------- ### Decor Behavior Example in JSON Source: https://apidocs.vintagestory.at/json-docs/jsondocs/Vintagestory.GameContent.BlockBehaviorDecor An example demonstrating how to configure the 'Decor' behavior within a block's properties in JSON format. It specifies placement sides, whether it's a full face, and its thickness. ```json "behaviors": [ { "name": "Decor", "properties": { "sides": [ "north", "east", "south", "west", "up", "down" ], "notFullFace": true, "thickness": 0.0 } } ], ``` -------------------------------- ### TextTextureUtil Constructor Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.TextTextureUtil Initializes a new instance of the TextTextureUtil class. Requires the client API. ```csharp public TextTextureUtil(ICoreClientAPI capi) ``` -------------------------------- ### Get Elapsed Milliseconds Since Startup Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.ICoreClientAPI Retrieves the total number of milliseconds that have elapsed since the client application started. This property is useful for timing game events or performance monitoring. ```csharp long ElapsedMilliseconds { get; } ``` -------------------------------- ### Constructor for GuiElementGrayBackground Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.GuiElementGrayBackground Initializes a new instance of the GuiElementGrayBackground class. This constructor requires the client API and the bounds for the GUI element. ```csharp public GuiElementGrayBackground(ICoreClientAPI capi, ElementBounds bounds) ``` -------------------------------- ### Get Last Variant Code Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.AssetLocation Returns the code of the last variant in the asset path. For example, given a path like "water-still-7", this method would return "7". ```csharp public string EndVariant()__ ``` -------------------------------- ### StartServerSide(ICoreServerAPI) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.ModSystem This method starts the mod on the server-side, initializing mod-specific behaviors, attributes, and properties. It is crucial to ensure that code modifying block, item, or entity properties is executed before calling this method, often in the AssetsFinalize() method. See the BlockReinforcement.cs example in VSSurvivalMod for guidance. ```APIDOC ## StartServerSide(ICoreServerAPI) ### Description Initializes the mod on the server-side, ensuring that any code which adds or updates behaviors or attributes or other fixed properties of any block, item or entity, should have been run before now. ### Method public virtual void StartServerSide(ICoreServerAPI api) ### Endpoint N/A - Method call ### Parameters #### Path Parameters - **api** (ICoreServerAPI) - Required - Provides the core server API instance. ### Request Example N/A ### Response N/A ``` -------------------------------- ### Define Variant Group Examples in JSON Source: https://apidocs.vintagestory.at/json-docs/jsondocs/Vintagestory.ServerMods.RegistryObjectVariantGroup These JSON snippets provides examples of defining variant groups. The first example demonstrates variant groups that define 'type' and 'state'. The second example shows a variant group that loads properties from 'block/rockwithdeposit'. ```JSON "variantgroups": [ { "code": "type", "states": [ "spelt", "rye", "flax", "rice", "cassava", "amaranth", "sunflower" ] }, { "code": "state", "states": [ "partbaked", "perfect", "charred" ] } ], ``` ```JSON "variantgroups": [ { "code": "rock", "loadFromProperties": "block/rockwithdeposit" } ], ``` -------------------------------- ### Initialize Method (C#) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.CaveMusicTrack Initializes the music track with the provided asset manager, core client API, and music engine. This method is crucial for setting up the track's dependencies and resources. ```csharp public void Initialize(IAssetManager assetManager, ICoreClientAPI capi, IMusicEngine musicEngine) ``` -------------------------------- ### Texture Examples in JSON Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.CompositeTexture Illustrates how to define textures with base and overlay textures, as well as connected textures. These examples are used for texture configuration in the game. ```json "textures": { "charcoal": { "base": "block/coal/charcoal" }, "coke": { "base": "block/coal/coke" }, "ore-anthracite": { "base": "block/coal/anthracite" }, "ore-lignite": { "base": "block/coal/lignite" }, "ore-bituminouscoal": { "base": "block/coal/bituminous" }, "ember": { "base": "block/coal/ember" } },__ ``` ```json "textures": { "ore": { "base": "block/stone/rock/{rock}1", "overlays": [ "block/stone/ore/{ore}1" ] } },__ ``` ```json "textures": { "all": { "base": "block/stone/cobblestone/tiling/1", "tiles": [ { "base": "block/stone/cobblestone/tiling/*" } ], "tilesWidth": 4 } }__ ``` -------------------------------- ### BeginPlay Method Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.SurfaceMusicTrack Initiates playback of the music track with the provided player properties. This method prepares and starts the track based on current game state and player conditions. ```APIDOC ## BeginPlay(TrackedPlayerProperties) Method ### Description Begins playing the music track with consideration for current player properties and environmental conditions. ### Method Signature ``` public virtual void BeginPlay(TrackedPlayerProperties props) ``` ### Parameters - **props** (`TrackedPlayerProperties`) - Required - Description: Player properties including position, current environment conditions, and other relevant game state - Purpose: Used to validate environmental conditions (temperature, sunlight, etc.) before playback ### Return Value - `void` - No return value ### Usage Notes - Method is virtual and can be overridden in derived classes - Verifies all configured constraints (time, season, temperature, sunlight) before starting playback - Respects global and per-track cooldown timers - Considers track priority in relation to currently playing tracks ``` -------------------------------- ### Initialize HotkeyComponent Constructor Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.HotkeyComponent Constructs a new instance of the HotkeyComponent class. It requires the game's client API, a string representing the hotkey code, and a CairoFont object for styling. ```csharp public HotkeyComponent(ICoreClientAPI api, string hotkeycode, CairoFont font) ``` -------------------------------- ### GrindingProperties Example JSON Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.GrindingProperties An example of how GrindingProperties can be represented in JSON format. This specific example defines that the object can be ground into 'bonemeal'. ```json "grindingProps": { "groundStack": { "type": "item", "code": "bonemeal" } } ``` -------------------------------- ### Initialize Method for EventMusicTrack (C#) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.EventMusicTrack Overrides the Initialize method to set up the music track. It takes the global Asset Manager, the Core Client API, and the Music Engine as parameters. ```csharp public override void Initialize(IAssetManager assetManager, ICoreClientAPI capi, IMusicEngine musicEngine)__ ``` -------------------------------- ### Line3D Start Field in C# Source: https://apidocs.vintagestory.at/api/Vintagestory.API.MathTools.Line3D Declares the 'Start' field of the Line3D class, which is a double array. This field likely represents the starting coordinates of the 3D line. ```csharp public double[] Start__ ``` -------------------------------- ### Example of creativeinventoryStacksByType in JSON Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.CreativeTabAndStackList Provides an example of how the creativeinventoryStacksByType is structured in JSON format. Demonstrates the structure of how different items with their attributes are organized within the creative tabs. ```json "creativeinventoryStacksByType": { "*-fired": [ { "tabs": [ "general", "decorative" ], "stacks": [ { "type": "block", "code": "bowl-fired", "attributes": { "ucontents": [ { "type": "item", "code": "waterportion", "makefull": true } ] } }, { "type": "block", "code": "bowl-fired", "attributes": { "ucontents": [ { "type": "item", "code": "honeyportion", "makefull": true } ] } }, { "type": "block", "code": "bowl-fired" }, { "type": "block", "code": "bowl-raw" } ] } ] }, ``` -------------------------------- ### Start Animation by MetaData (C#) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.IAnimationManager Starts an animation using AnimationMetaData. This method initiates the animation using a pre-defined animation configuration, facilitating the start of pre-configured animations. ```csharp bool StartAnimation(AnimationMetaData animdata)__ ``` -------------------------------- ### Try Start Animation by Metadata (C#) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.AnimationManager Attempts to start an animation using AnimationMetaData, but avoids starting if the named animation does not exist for the entity. Returns a boolean indicating success. ```csharp public virtual bool TryStartAnimation(AnimationMetaData animdata)__ ``` -------------------------------- ### Init Method Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.AdvancedParticleProperties Initializes the particle system. This method should be called during the game's initialization phase and requires the ICoreAPI instance. ```csharp public void Init(ICoreAPI api)__ ``` -------------------------------- ### Start Animation with Metadata Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.PlayerAnimationManager Starts a new animation using provided AnimationMetaData. On the client, it starts the animation directly. On the server, it sends animations to clients and purges the local list. ```csharp public override bool StartAnimation(AnimationMetaData animdata)__ ``` -------------------------------- ### On Start Animation Event Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.NoAnimationManager Event delegate fired when an animation starts. Uses StartAnimationDelegate type to handle animation start events, allowing observers to track animation lifecycle initiation. ```csharp public event StartAnimationDelegate OnStartAnimation ``` -------------------------------- ### OnlinePlayerArgParser Constructor Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.OnlinePlayerArgParser Initializes a new instance of the OnlinePlayerArgParser class. ```APIDOC ## OnlinePlayerArgParser(string, ICoreAPI, bool) ### Description Initializes a new instance of the OnlinePlayerArgParser class. ### Method CONSTRUCTOR ### Parameters #### Path Parameters - **argName** (string) - Description - **api** (ICoreAPI) - Description - **isMandatoryArg** (bool) - Description ``` -------------------------------- ### Create AVI Writer Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.IXPlatformInterface Initializes and returns an IAviWriter instance for recording video. Requires parameters for buffer size, framerate, and codec. ```csharp IAviWriter GetAviWriter(int recordingBufferSize, double framerate, string codeccode)__ ``` -------------------------------- ### Method: Get(string) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.IChatCommandApi Gets a chat command by its name. ```APIDOC ## GET Get(string) ### Description Retrieves a chat command by its name. ### Method GET ### Endpoint Get(string name) ### Parameters #### Path Parameters - **name** (string) - Required - The name of the command. ### Response #### Success Response - **IChatCommand** - The chat command object. ``` -------------------------------- ### Example ModelTransform JSON Configuration Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.ModelTransform An example of how to configure ModelTransform properties within a JSON file, demonstrating translation, rotation, origin, and scale for a 'tpHandTransform'. These values can be customized using the '.tfedit' command in-game. ```json "tpHandTransform": { "translation": { "x": -0.87, "y": -0.01, "z": -0.56 }, "rotation": { "x": -90, "y": 0, "z": 0 }, "origin": { "x": 0.5, "y": 0, "z": 0.5 }, "scale": 0.8 } ``` -------------------------------- ### Try Start Animation with Metadata Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.NoAnimationManager Attempts to start an animation based on AnimationMetaData. Returns false if the animation does not exist or cannot be started (e.g., already playing), providing safe animation initiation with existence validation. ```csharp public bool TryStartAnimation(AnimationMetaData animdata) ``` -------------------------------- ### Construct AssetLocationAndSource with detailed source information (C#) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.AssetLocationAndSource Initializes a new instance of the AssetLocationAndSource class with domain, path, a message, source domain, source path, and an optional alternate number. This provides comprehensive source tracking for assets. ```csharp public AssetLocationAndSource(string domain, string path, string message, string sourceDomain, string sourcePath, int alternateNo = -1) ``` -------------------------------- ### FrameProfilerUtil Constructor (Action) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.FrameProfilerUtil This constructor initializes a FrameProfilerUtil instance, taking an Action as a parameter. The Action parameter, onLogoutputHandler, handles the logging output during profiling. This constructor is essential for setting up the profiler with a specified output handler. ```csharp public FrameProfilerUtil(Action onLogoutputHandler)__ ``` -------------------------------- ### BeginSort Method in C# Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.RainMusicTrack Called before sorting by start priority happens. This method is used internally to prepare for sorting music tracks based on their start priority. It is typically called before the start priority is evaluated. ```csharp public void BeginSort()__ ``` -------------------------------- ### Open Method for IAviWriter with Parameters Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.IAviWriter Implements the Open method for the IAviWriter interface in Vintagestory.API.Client. This method initializes the AVI writer, specifying the output filename, width, and height of the video frames. It is crucial for setting up the AVI file before adding frames. ```csharp void Open(string filename, int width, int height)__ ``` -------------------------------- ### BeginParticle Method Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.AdvancedParticleProperties Initiates the advanced particle's lifecycle. This method should be called to start the particle's simulation and rendering. ```csharp public void BeginParticle()__ ``` -------------------------------- ### Start Animation by Metadata (C#) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.AnimationManager Starts a given animation using AnimationMetaData. On the client, it starts the specified animation. On the server, it sends all active animations to clients and then purges the ActiveAnimationsByAnimCode list. Returns a boolean indicating success. ```csharp public virtual bool StartAnimation(AnimationMetaData animdata)__ ``` -------------------------------- ### StartPriority Property in C# Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.RainMusicTrack Defines the starting priority of the track. A higher start priority will leave active tracks playing. This property influences which tracks start playing first. It's also a float value. ```csharp public float StartPriority { get; }__ ``` -------------------------------- ### Get Retention Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.BlockBehavior Gets the retention value for a block at a specific position and facing. ```APIDOC ## GET /websites/apidocs_vintagestory_at/GetRetention ### Description Gets the retention value for a block at a specific position and facing. ### Method GET ### Endpoint /websites/apidocs_vintagestory_at/GetRetention ### Parameters #### Query Parameters - **pos** (BlockPos) - Required - The position of the block. - **facing** (BlockFacing) - Required - The facing of the block. - **type** (EnumRetentionType) - Required - The type of retention to get. - **handled** (EnumHandling) - Required - Indicates if the event is handled. ``` -------------------------------- ### Get System Information Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.IXPlatformInterface Retrieves detailed information about the system's CPU and RAM. Also provides free disk space for a given file path. ```csharp string GetCpuInfo()__ ``` ```csharp long GetFreeDiskSpace(string filepath)__ ``` ```csharp long GetRamCapacity()__ ``` -------------------------------- ### On Block Interact Start Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.BlockBehavior Called when a player starts interacting with the block via right-click. ```APIDOC ## POST /websites/apidocs_vintagestory_at/OnBlockInteractStart ### Description When a player does a right click while targeting this placed block. Should return true if the event is handled, so that other events can occur, e.g. eating a held item if the block is not interactable with. ### Method POST ### Endpoint /websites/apidocs_vintagestory_at/OnBlockInteractStart ### Parameters #### Request Body - **world** (IWorldAccessor) - Required - The world accessor. - **byPlayer** (IPlayer) - Required - The player interacting. - **blockSel** (BlockSelection) - Required - The block selection. - **handling** (EnumHandling) - Required - Indicates if the event is handled. #### Returns - **bool** - True if the event was handled. ``` -------------------------------- ### Start Animation Event (C#) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.AnimationManager Event fired when an animation is intended to start. It uses a StartAnimationDelegate. ```csharp public event StartAnimationDelegate OnStartAnimation__ ``` -------------------------------- ### IconUtil Constructor Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.IconUtil This constructor initializes a new IconUtil instance, requiring an ICoreClientAPI object for client-side API access. ```APIDOC ## IconUtil Constructor ### Description Creates a new IconUtil instance. ### Method Constructor ### Endpoint IconUtil(ICoreClientAPI capi) ### Parameters - **capi** (ICoreClientAPI) - Required - The Client API. ``` -------------------------------- ### Example of tpHandTransform JSON Configuration Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.ModelTransformNoDefaults Demonstrates an example of a tpHandTransform configuration in JSON format. This configuration specifies translation, rotation, origin, and scale values for hand transformations. It provides a template for customizing these values for specific game elements. ```json "tpHandTransform": { "translation": { "x": -0.87, "y": -0.01, "z": -0.56 }, "rotation": { "x": -90, "y": 0, "z": 0 }, "origin": { "x": 0.5, "y": 0, "z": 0.5 }, "scale": 0.8 }, ``` -------------------------------- ### Try Start Animation (C#) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.IAnimationManager Attempts to start an animation using provided `AnimationMetaData`. It returns `false` if the animation doesn't exist or cannot be started (e.g., already playing). This function is part of the Vintage Story API and used for animation control. ```csharp bool TryStartAnimation(AnimationMetaData animdata)__ ``` -------------------------------- ### Clay Forming Recipe JSON Structure Example Source: https://apidocs.vintagestory.at/json-docs/jsondocs/Vintagestory.GameContent.ClayFormingRecipe Example JSON structure for a ClayFormingRecipe. It specifies ingredients, a crafting pattern, the recipe name, and the output item. The 'ingredient' field uses a wildcard for clay variants. ```json { "ingredient": { "type": "item", "code": "clay-*", "name": "type", "allowedVariants": [ "blue", "fire", "red" ] }, "pattern": [ [ "#####", "#####", "#####", "#####", "#####" ], [ "#####", "#___#", "#___#", "#___#", "#####" ] ], "name": "Bowl", "output": { "type": "block", "code": "bowl-raw" } } ``` -------------------------------- ### GuiElementDropDown Class Overview Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.GuiElementDropDown Complete class overview for GuiElementDropDown, detailing inheritance hierarchy, implemented interfaces, and available members from parent classes. ```APIDOC ## Class: GuiElementDropDown ### Description A GUI element that creates a drop-down list of items with support for single and multi-select modes. Extends GuiElementTextBase to provide text-based drop-down list functionality. ### Class Declaration ```csharp public class GuiElementDropDown : GuiElementTextBase, IDisposable ``` ### Namespace Vintagestory.API.Client ### Assembly VintagestoryAPI.dll ### Inheritance Hierarchy - System.Object - GuiElement - GuiElementControl - GuiElementTextBase - **GuiElementDropDown** ### Implemented Interfaces - IDisposable ### Key Inherited Members #### From GuiElementTextBase - textUtil - text - Text (property) - textPathMode - Font (property) - RightPadding (property) - ComposeTextElements(Context, ImageSurface) - GetMultilineTextHeight() - DrawMultilineTextAt(Context, double, double, EnumTextOrientation) - DrawTextLineAt(Context, string, double, double, bool) - GetText() #### From GuiElementControl - enabled (property) #### From GuiElement - Bounds (property) - TabIndex (property) - hasFocus (property) - HasFocus (property) - api (property) - RenderAsPremultipliedAlpha (property) - InsideClipBounds (property) - OnMouseDownOnElement(ICoreClientAPI, MouseEvent) - OnMouseUpOnElement(ICoreClientAPI, MouseEvent) - OnKeyUp(ICoreClientAPI, KeyEvent) - OnKeyPress(ICoreClientAPI, KeyEvent) - Render2DTexture(int, ElementBounds, float, Vec4f) - PostRenderInteractiveElements(float) - RenderFocusOverlay(float) ### Purpose GuiElementDropDown is used to create interactive drop-down list UI elements in Vintagestory client applications. It supports text rendering, font customization, focus management, and selection change callbacks. ``` -------------------------------- ### BeginPlay Method (C#) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.CaveMusicTrack Starts playing the music track. Takes `TrackedPlayerProperties` as input which contains the properties of the current track, likely including player state or environmental conditions. ```csharp public void BeginPlay(TrackedPlayerProperties props) ``` -------------------------------- ### Start Entity Animation Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.EntityChunky Starts a specified animation for an entity. It takes a string parameter representing the animation code. ```csharp public override void StartAnimation(string code)__ ``` -------------------------------- ### Initialize EntityTalkUtil with ICoreAPI and Entity Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Util.EntityTalkUtil Constructor for EntityTalkUtil that accepts a core API reference, target entity, and multi-sound voice flag. This initializes the utility for managing entity vocalizations with optional multi-sound voice support. ```csharp public EntityTalkUtil(ICoreAPI api, Entity atEntity, bool isMultiSoundVoice) ``` -------------------------------- ### Mountable Entity Delegate Example Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common An example of a delegate used to retrieve a mountable entity. It demonstrates how to access tree attributes to find the entity by its ID. ```csharp public delegate IEntity GetMountableDelegate(BlockSelection blockSelection, ITreeAttribute tree); // Example implementation: // return world.GetEntityById(tree.GetLong("entityId")); ``` -------------------------------- ### Server Entity Configuration JSON Example Source: https://apidocs.vintagestory.at/json-docs/jsondocs/Vintagestory.ServerMods.NoObf.ServerEntityConfig Illustrates the JSON structure for configuring server-side entity behaviors, such as 'passivephysics' and 'despawn', including their specific parameters. ```json "server": { "behaviors": [ { "code": "passivephysics", "groundDragFactor": 1, "airDragFactor": 0.25, "gravityFactor": 0.75 }, { "code": "despawn", "minSeconds": 600 } ] },__ ``` -------------------------------- ### Start Base Animation with Metadata Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.PlayerAnimationManager Starts a base animation using provided AnimationMetaData. Returns a boolean indicating success. ```csharp public bool StartAnimationBase(AnimationMetaData animdata)__ ``` -------------------------------- ### IGuiAPI Methods for GUI Creation and Manipulation Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.IGuiAPI This snippet shows methods within the IGuiAPI interface for creating and managing GUI compositions. It includes creating new compositions with a specified name and bounds. ```csharp GuiComposer CreateCompo(string dialogName, ElementBounds bounds) ``` -------------------------------- ### Constructor GuiElementItemSlotGridBase Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Client.GuiElementItemSlotGridBase Initializes a new instance of GuiElementItemSlotGridBase with core client API, inventory reference, network packet handler, column count, and element bounds. The sendPacket parameter enables network synchronization of inventory modifications between client and server. ```csharp public GuiElementItemSlotGridBase(ICoreClientAPI capi, IInventory inventory, Action sendPacket, int columns, ElementBounds bounds) ``` -------------------------------- ### Start Right Held Idle Animation Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.PlayerAnimationManager Starts the idle animation for the player's right hand, specified by an animation code. ```csharp public void StartRightHeldIdleAnim(string animCode)__ ``` -------------------------------- ### Start Left Held Idle Animation Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.PlayerAnimationManager Starts the idle animation for the player's left hand, specified by an animation code. ```csharp public void StartLeftHeldIdleAnim(string animCode)__ ``` -------------------------------- ### InitForUse Method Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.MultiblockStructure Initializes the multiblock structure for use, likely setting up internal states or transformations based on a rotation value in degrees. ```csharp public void InitForUse(float rotateYDeg) ``` -------------------------------- ### StartAnimation Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.EntityItem This function starts an animation for the entity. ```APIDOC ## StartAnimation ### Description Starts the animation for the entity. ### Method N/A (Callback) ### Endpoint N/A ### Parameters #### Parameters - **code** (string) - Required - The animation code to start. ``` -------------------------------- ### Get Frame Profiler in C# Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.IWorldAccessor Gets the frame profiler utility. Used for performance analysis and optimization. Returns a FrameProfilerUtil object. ```csharp FrameProfilerUtil FrameProfiler { get; } ``` -------------------------------- ### Initialize Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.Entities.PModulePlayerInAir This method initializes the module with a configuration from the entity class. It configures the behavior of the module. ```APIDOC ## Initialize(JsonObject, Entity) ### Description Config passed in from the behavior in the entity class. ### Method public override void ### Endpoint Initialize(JsonObject config, Entity entity) ### Parameters #### Path Parameters - **config** (JsonObject) - - **entity** (Entity) - ### Request Example { "example": "N/A" } ### Response #### Success Response (200) - **N/A** (N/A) - N/A #### Response Example { "example": "N/A" } ``` -------------------------------- ### Construct AssetLocationAndSource with domain and path (C#) Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.AssetLocationAndSource Initializes a new instance of the AssetLocationAndSource class with domain, path, and an old-style source string. This overload is obsolete and newer overloads are recommended for reduced RAM usage. ```csharp [Obsolete("For reduced RAM usage please use newer overloads e.g. AssetLocationAndSource(domain, path, message, sourceDomain, sourcePath)", false)] public AssetLocationAndSource(string domain, string path, string oldStyleSource) ``` -------------------------------- ### Get Current Locale Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Config.Lang Gets the language code that is currently in use for translations. This property returns a string representing the active locale. ```csharp public static string CurrentLocale { get; } ``` -------------------------------- ### GET /IModLoader.GetModSystem Source: https://apidocs.vintagestory.at/api/Vintagestory.API.Common.IModLoader Retrieves a mod system by its type. It allows for getting the system directly without knowing the exact name. ```APIDOC ## GET /IModLoader.GetModSystem ### Description Gets a loaded mod system with the specified type. Returns null if no mod of that type was found. ### Method GET ### Endpoint /IModLoader.GetModSystem ### Parameters #### Path Parameters - **withInheritance** (bool) - Optional - If true, includes inherited types. ### Request Example N/A ### Response #### Success Response (200) - **T** (T) - The requested ModSystem object, or null if not found. #### Response Example N/A ``` -------------------------------- ### SemVer Constructors Source: https://apidocs.vintagestory.at/api/ProperVersion.SemVer Constructors for the SemVer class, allowing initialization with major, minor, patch, pre-release, and build metadata. ```csharp public SemVer(int major, int minor, int patch) ``` ```csharp public SemVer(int major, int minor, int patch, string preRelease = "", string buildMetadata = "") ``` ```csharp public SemVer(int major, int minor, int patch, string[] preReleaseIdentifiers = null, string[] buildMetadataIdentifiers = null) ```