Skip to content
Hunternif edited this page Feb 10, 2014 · 28 revisions

API version: 1.0

You can find the latest API build on the releases page.

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

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

To develop with the API, put a deobfuscated jar in your project's library folder and add it to build path. In order to recompile your mod you will need to copy the API jar to mcp/libs (The example project's Ant build script does that automatically).

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.
  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.

In order to allow players to manually customize their texture configs, consider using the methods setTextureIfNone, which will only set the texture for biome ID if it was not present in the config file. Methods setTexture will override the config.

Consider saving the config only if some texture was actually changed (i.e. setTextureIfNone returned true), so that the config file is not overwritten too often. That makes it easier for players to modify the file manually.

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 in the Atlases. The workflow:

  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.
  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, dimension, tileName, chunkX, chunkZ). 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.

Clone this wiki locally