Translations:Modding:Modding API Updates/22/en

From Vintage Story Wiki
Revision as of 13:49, 11 April 2024 by FuzzyBot (talk | contribs) (Importing a new version from external source)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
  • 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.  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 [example] to locate their native binaries properly for each platform, and also include a static call to set that DllImportResolver [example line of code]