Developer page - MCTCP/TerrainControl GitHub Wiki
This page is made for plugin developers. It explains how to compile Terrain Control, as well as how to make plugins that work with custom biomes.
##Programming against Terrain Control
###Biome lookups
If you use Bukkit's biome lookup API it won't recognize the custom biomes. If you want to support Terrain Control, add it as a dependency (just like you did with Bukkit) and use TerrainControl.getBiomeName().
Obviously, this won't work if Terrain Control isn't installed. So to support servers without Terrain Control, we need to make our own method:
public String getBiomeName(Location location)
{
if (Bukkit.getServer().getPluginManager().getPlugin("TerrainControl") != null)
{
String biomeName = TerrainControl.getBiomeName(location.getWorld().getName(), location.getBlockX(), location.getBlockZ());
if (biomeName != null)
{
return biomeName;
}
}
return location.getWorld().getBiome(location.getBlockX(), location.getBlockZ()).toString();
}#Compiling Terrain Control/setting up your IDE
See the COMPILING.md file.
##Code formatting Try to follow these guidelines. Only important if you want to send your code back to us.
- In general, follow the Oracle code standards.
- Opening brackets should be placed on a new line.
- Use 4 spaces, not tabs.
- LF (\n) line endings.
- Variable names should be in
camelCase(so it should start with a lowercase letter, however some places still useCamelCase), class names inCamelCaseand constants (things that are static final)LIKE_THIS. Enum elements should also be formatted like constants, expect when they are used as a setting and thus cannot be changed (likeTerrainModeinWorldConfig.java). - No line length limit. Just keep your code readable.
- Each enum element on a new line.
- Imports: group all
javaimports together and all other imports together. Place the other imports above thejavaimports. Feel free to use the*if the import list is becoming too long.
For Eclipse, you can download the settings here: the formatting settings and the settings for the imports.