Changes between Version 5 and Version 6 of Scripting/API


Ignore:
Timestamp:
05/07/23 16:23:46 (12 months ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Scripting/API

    v5 v6  
    128128}}}
    129129
     130== Loading a Map Format ==
     131
     132To be able to specify the map format of a newly created world you need to obtain a reference to the map format like so:
     133
     134{{{
     135#!js
     136var mapFormat = wp.getMapFormat()
     137    .withId('id') // Mutually exclusive with withName(). The ID of the map format to obtain
     138    .withName('name') // Mutually exclusive with withId(). The name of the map format to obtain
     139    .go(); // Returns the map format with the specified ID or name
     140}}}
     141
     142Note that it is recommended to use the ID, as that is guaranteed to be stable, while the names might change from release to release. Here are the IDs of the currently supported map formats of !WorldPainter:
     143
     144|| {{org.pepsoft.mcregion}} || Minecraft 1.1 (MCRegion) ||
     145
    130146== Creating a World from a Height Map ==
    131147
     
    139155    .shift(0, 0) // Optional. The number of blocks the height map should be shifted east and south respectively (negative numbers shift west and north). Default value: 0, 0
    140156    .fromLevels(0, 255).toLevels(0, 255) // Optional. Specifies how image values should be mapped to surface heights. The first two values are the lower and upper bounds of the range of image values; the second pair of values if the corresponding range of surface heights those image values should be mapped to. The default is to map the values one on one
     157    .withWaterLevel(62) // Optional. The default water level to set the new world to. Default value: 62
     158    .withMapFormat(mapFormat) // Optional. The map format to set the new world to. See below for obtaining the reference to the map format. Defaults to the default map format configured in the !WorldPainter Preferences
     159    .withLowerBuildLimit(-64) // Optional. The lower build limit to set the new world to. This value is inclusive. Defaults to the default lower build limit of the map format
     160    .withUpperBuildLimit(320) // Optional. The upper build limit to set the new world to. This valus is exclusive. Defaults to the default upper build limit of the map format
    141161    .go(); // Returns the created world for exporting, saving or using in other operations
    142162}}}