Antique Atlas/CraftTweaker API Adapter
This adapter provides a convenient bridge between CraftTweaker and Antique Atlas, allowing modpack creators and experienced players to add markers to maps through ZenScript without the need to develop a separate mod.
Main Purpose
The modification provides access to Antique Atlas MarkerAPI methods through CraftTweaker scripts. This is an ideal solution for automating marker placement on maps - for example, you can create a tool that automatically marks deposits of specific ores or other important locations when interacting with them.
Compatibility Requirements
Required for operation:
- CraftTweaker version 12.2-4.1.13 or higher
- Antique Atlas version 1.12.2-4.5.0 or higher
Before using the API methods, you'll need to import the corresponding adapters into your ZenScript:
import mods.AAMarkerAPI;
import mods.AAMarker;
Available API Methods
// Adding markers for specific atlases
AAMarker mods.AAMarkerAPI.putMarker(IWorld w, boolean visibleAhead, int atlasID, String markerType, String label, int x, int z)
AAMarker mods.AAMarkerAPI.putMarker(IWorld w, boolean visibleAhead, int atlasID, String markerType, String label, double x, double z)
// Adding global markers
AAMarker mods.AAMarkerAPI.putGlobalMarker(IWorld w, boolean visibleAhead, String markerType, String label, int x, int z)
AAMarker mods.AAMarkerAPI.putGlobalMarker(IWorld w, boolean visibleAhead, String markerType, String label, double x, double z)
// Alternative methods returning identifier
int mods.AAMarkerAPI.putMarkerI(IWorld w, boolean visibleAhead, int atlasID, String markerType, String label, int x, int z)
int mods.AAMarkerAPI.putMarkerI(IWorld w, boolean visibleAhead, int atlasID, String markerType, String label, double x, double z)
int mods.AAMarkerAPI.putGlobalMarkerI(IWorld w, boolean visibleAhead, String markerType, String label, int x, int z)
int mods.AAMarkerAPI.putGlobalMarkerI(IWorld w, boolean visibleAhead, String markerType, String label, double x, double z)
// Removing markers
void mods.AAMarkerAPI.deleteMarker(IWorld w, int atlasID, int markerID)
void mods.AAMarkerAPI.deleteGlobalMarker(IWorld w, int markerID)
Methods with double parameters automatically round coordinates to integers, which is convenient when working with player coordinates.
Practical Usage Example
Here's an example script that adds markers when interacting with specific blocks if the player has an atlas in hand:
import crafttweaker.events.IEventManager;
import crafttweaker.player.IPlayer;
import mods.AAMarkerAPI;
import mods.AAMarker;
// Adding markers when clicking on specific blocks with atlas in hand
events.onPlayerInteract(function(event as crafttweaker.event.PlayerInteractEvent){
if (<antiqueatlas:antique_atlas:*>.matches(event.player.currentItem)) {
var atlasID as int;
var x as double;
var z as double;
var mkI as int;
var mkAAM as AAMarker;
if (!event.world.isRemote()){
atlasID = event.player.currentItem.metadata;
x = event.player.x;
z = event.player.z;
// Marker with skull icon for spawner
if ((<minecraft:mob_spawner>.asBlock()) in (event.block)){
mods.AAMarkerAPI.putMarker(event.world, false, atlasID, "skull", event.block.displayName , x, z);
event.player.sendMessage("Marker added");
event.cancel();
}
// Marker with diamond icon for diamond ore
if ((<minecraft:diamond_ore>.asBlock()) in (event.block)){
mkI = mods.AAMarkerAPI.putMarkerI(event.world, false, atlasID, "diamond", event.block.displayName , x, z);
event.player.sendMessage("Marker added");
event.cancel();
}
// Demonstration of adding and removing a marker
if ((<minecraft:dirt>.asBlock()) in (event.block)){
mkAAM = mods.AAMarkerAPI.putMarker(event.world, false, atlasID, "google", event.block.displayName , x, z);
event.player.sendMessage("Marker added");
event.player.sendMessage("Nah, nevermind");
mods.AAMarkerAPI.deleteMarker(event.world, atlasID, mkAAM.getId());
event.player.sendMessage("Marker deleted");
event.cancel();
}
}
}
});
This tool opens up wide possibilities for customizing gameplay and creating unique mechanics in your modpacks.