Modding:Modding API Updates: Difference between revisions

From Vintage Story Wiki
Marked this version for translation
mNo edit summary
(Marked this version for translation)
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude><languages/><translate></noinclude>
<languages/><translate>
<!--T:1-->
{{GameVersion|1.19.7}}
 
<!--T:2-->
The Vintage Story API is responsible for almost all functionality for modding the game. This page will list changes made to the API in each version, taken directly from [https://www.vintagestory.at/blog.html/ the VS News page]. Changes will be sectioned by ''content'', ''code'', or ''other'', based on what type of mod they mostly affect.
 
<!--T:3-->
Some points may contain additional information on how this will affect mods.
 
<!--T:4-->
This log starts at version 1.19.0, and changes from before then are not listed. Release candidate versions (suffixed with ''rc'') are not listed until they are released as stable versions.
 
<!--T:5-->
__TOC__
__TOC__
The Vintage Story API is responsible for almost all functionality for modding the game. This page will list changes made to the API in each version, taken directly from [https://www.vintagestory.at/blog.html/ the VS News page]. Changes will be sectioned by _Content_, _Code_, or _Other_.


Some points may contain additional information on how this will affect mods.
== How to Utilise This Page for Modders == <!--T:6-->
This page gives updates on all API updates for code and content modders. When updating a mod, it is recommended to find the version your mod was released for in this list. From there, scrolling up will display all the changes made to the API since that version. If your mod uses any of those API features, it is recommended to test them. This will give you a good idea of what parts of a mod may need updating for newer versions.
 
== 1.19 == <!--T:7-->
 
=== 1.19.6/1.19.7 === <!--T:8-->
 
==== Code ==== <!--T:9-->
 
<!--T:10-->
* API Fixed: RegisterEventBusListener() delegates called twice in some cases
 
=== 1.19.5 === <!--T:11-->
 
==== Content ==== <!--T:12-->
 
<!--T:13-->
* Api Tweak: Items/Blocks can now define an attribute "inBarrelShape" to determine their shape inside a barrel
 
==== Code ==== <!--T:14-->
 
<!--T:15-->
* Api Fixed: WorldAPI ''RegionMapSizeX'' would return a size off by one since game version 1.12.9. Affected methods are ''MapRegionIndex2D'', ''MapRegionPosFromIndex2D'', ''MapRegionIndex2DByBlockPos''
* Api Fixed: Chatcommands with multiple `WithPreCondition` or a pre-condition and `RequiresPlayer` would over-write each other. Now all pre-conditions are checked and if one pre-condition returns ''EnumCommandStatus.Error'' it won't process the command further.
 
==== Other ==== <!--T:16-->
 
<!--T:17-->
* Api Tweak: Don't crash on invalid GroundStack
 
=== 1.19.4 === <!--T:18-->
 
==== Content ==== <!--T:19-->
 
<!--T:20-->
* Tweak: Added a new attachment point on the seraph model for off-hand animations
* Tweak: New and updated stackrandomizers are available to allow random loot to be placed in containers in schematics; and these randomizers can be modded to add or change loot in vanilla ruins: for details see the randomizers in assets/survival/itemtypes/meta
* Tweak: If an item specifies a renderVariant, and the shape cannot be found, log an error instead of crashing
* Tweak: Modded spears should now include behavior "AnimationAuthoritative", see vanilla spear.json for an example
* Tweak: Added entity property ''fallDamageMultiplier''
* Notice: Entity boolean property ''fallDamage'' will become obsolete in v1.20 and removed in v1.21. Use ''fallDamageMultiplier: 0.0'' instead
* Fixed: Block patches with NearSeaWater placement now detect salt water properly
* Fixed: Incorrect door and chest took on wrong appearance when animated in heavily modded games, due to multiple texture atlas creation, when using default texture atlas sizes
* Fixed: Microblocks not allowing 255 materials
 
==== Code ==== <!--T:21-->
 
<!--T:22-->
* Additional minor tweaks relevant only to coded mods:
** ''KeyConfiguration'' used for hotkeys can now also represent a mouse button; mouse buttons are treated like keyboard keys with keycodes 240-247
** For AITasks, the ''EntityPartitioning'' system is now divided more logically into Creatures and Inanimate entities, use ''EnumEntitySearchType'' to specify which
** For all string IndexOf(), StartsWith() or EndsWith() operations on strings representing game internal elements, for example AssetLocation, texture codes and other dictionary keys or anything found in JSON code, StringComparison.Ordinal should be used for culture independence.  [https://learn.microsoft.com/en-us/dotnet/standard/base-types/best-practices-strings See .NET Best Practice Guide].  Vintagestory.API.Util now provides helper methods ''string.IndexOfOrdinal()'', ''string.StartsWithOrdinal()'' and ''string.EndsWithOrdinal()'' which you can use; and for AssetLocations, ordinal comparison is built-in to new convenience method ''AssetLocation.PathStartsWith()''
** Mods can access and change ''climbUpSpeed'' and ''climbDownSpeed'' in an entity's ''BehaviorControlledPhysics''
** Marked ''UsingHeldItemTransformBefore/After'' as obsolete
** Exposed ''GetRecipeRegistry()'' in ''IWorldAccessor''
** ''BlockEntity.GetBlockInfo()'' exceptions now trapped and logged, a simple error line is shown in the Block Info HUD
** Exceptions thrown by ticking a BlockEntity are now logged with position of entity and type; override ''BlockEntity.TickingExceptionHandler'' to change this behavior
** Exceptions thrown by ''BlockEntity.FromTreeAttributes()'' are now logged with position of entity and type
** Any mod directly accessing ''BlockEntityMicroBlock.sideAlmostSolid'' or ''.sidecenterSolid'' should re-compile for 1.19.4 (no actual code change in the mod should normally be required, but the field type changed, pull latest VSSurvivalMod source from GitHub)
** Notice: For coded mods using native binaries (.dll in Windows) in a /native folder, these will now not get loaded automatically (they would produce 'Bad IL format' errors at loading time anyhow). Applies to native binaries representing either libraries or a mod's own code not written in C#. Mods needing to load native binaries should instead write their own short DllImportResolver method [[https://github.com/anegostudios/vsmodexamples/blob/master/code_mods/NativeInterop/nativeInterop/NativeInteropModSystem.cs example]] to locate their native binaries properly for each platform, and also include a static call to set that DllImportResolver [[https://github.com/anegostudios/vsmodexamples/blob/master/code_mods/NativeInterop/nativeInterop/NativeInteropModSystem.cs#L16 example line of code]]
 
==== Other ==== <!--T:23-->
 
<!--T:24-->
* Tweak: Missing dependencies now listed in the mod manager
* Tweak: Log an error if HeldRightReadyAnimation and HeldRightTpIdleAnimation for an item are set to the same animation
 
=== 1.19.2/1.19.3 === <!--T:25-->
 
==== Code ==== <!--T:26-->
 
<!--T:27-->
* API Fixed: DidPlaceBlock() not called on the last block in the stack
 
=== 1.19.1 === <!--T:28-->
There are no API changes for this version.


<noinclude></translate></noinclude>
</translate>
{{navbox/modding}}
{{Navbox/modding}}
Confirmedusers
637

edits