Skip to content
Hazel Fidecaro edited this page May 19, 2021 · 28 revisions

API version: 3.0

You can find the latest build on the releases page. The API is included in the mod jar.

Use the class hunternif.mc.atlas.api.AtlasAPI to obtain a reference to the API. There are 2 actual APIs: TileAPI and MarkerAPI.

This example project serves as a reference for using the TileAPI.

To develop with the API, you need to add a deobfuscated jar to your project's build path. (Consult your IDE's documentation for how to do that.)

BiomeAPI

Allows other mods to register custom textures for biomes. The workflow:

  1. During initialization of your mod, on the client side set textures for your biome IDs by calling setBiomeTexture(biome, textureSet). (There are more variants of this method)
  2. Save the config, so the textures will be loaded automatically next time, or manually modified by the players.

Each texture must be a tilesheet following the Autotile layout.

Each texture setter method accepts an array of textures. The purpose of this is to choose a random texture for each tile, so that the map has a better, more varied look.

TileAPI

Allows other mods to put custom tiles into the Atlases, both globally and locally (into specific Altas). The workflow is as follows:

  1. Decide on a unique name for you custom tile (i.e. "zeldaSwordSkillsDungeon")
  2. During initialization of your mod, on the client side set textures for that unique name by calling setCustomTileTexture(name, textureSet).
  3. Anytime during the game, on the server side put your custom tile at chunk coordinates.

Each texture must be a tilesheet following the Autotile layout.

Use the method putCustomTile(world, atlasID, tileName, chunkX, chunkZ) or putCustomGlobalTile. In case of a custom building, the appropriate time to do this is when the building is generated, summoned etc. This will put your custom tile on every Atlas for every player, if they have seen that chunk.

Adjacent tiles with the same name will be "stitched" together like chunks of the same biome. If you wish, for example, to have separate little houses instead of one large house, you must use different tile names for each chunk, or make a tilesheet that only consists of single-tile-sized houses, without transitions.

Custom biomes

If you wish to register a custom texture for a biome, then during initialization of your mod, on the client side call setBiomeTexture(biome, textureSet) set textures for your biome IDs.

Consult the javadocs for more details and additional methods.

MarkerAPI

Allows other mods to put custom markers in a specific atlas or in all atlases globally. The workflow:

  1. If you want to use one of the default marker icons, skip to phase 5. If you want to use a custom icon, then:
  2. Decide on a unique name for your custom marker type.
  3. During initialization of your mod, on the client side set texture for that unique name.
  4. Save the config, so the textures will be loaded automatically next time, or manually modified by the players.
  5. Anytime during the game, put a marker with a default type or your custom type at block coordinates. This can be done both on the client and the server side.

Use the method putMarker(world, visibleAhead, atlasID, markerType, label, x, z), or putGlobalMarker, if you want your marker to appear on every atlas in the world. If can pass an empty string as the label argument, then no tooltip will be display over that marker. The x and z arguments are block coordinates.

You can't really delete any markers via the API yet, because there is no way to get Marker ID. Sorry!

As of mod version 4.2, the marker types available by default are:

"red_x_large" the actual default, used when placing a marker via the GUI

"red_x_small"

"google"

"village"

"bed"

"diamond"

"sword"

"pickaxe"

"skull"

"tower"

"scroll"

"nether_portal"

Marker textures have to be square; the center of the image will be placed directly at the specified block coordinates.

Consult the sources or javadocs for more details and additional methods.