跳到正文

Antique Atlas/CraftTweaker API Adapter

作者:targrenmods

一个简单的 API 适配器,可让 CraftTweaker 脚本在 Antique Atlas 地图上添加标记。

收藏

介绍

介绍由机器翻译自 CurseForge 原页面,仅供参考。

这是一个简单的 API 适配器,可让 CraftTweaker ZenScripts 调用 Antique Atlas 的 MarkerAPI 方法,向游戏内的地图册添加标记和全局标记。它主要面向整合包作者,让他们无需编写新模组,就能使用 MarkerAPI——例如,添加一个在点击特定矿石时自动添加地图标记的工具(见示例)。不过,熟悉 Zenscript 的玩家也可以用它为自己的本地游戏添加一些便捷功能。 

 

需要:
CraftTweaker (12.2-4.1.13)
Antique Atlas (1.12.2-4.5.0)

你可能需要在 ZenScript 中导入这些适配器

 

import mods.AAMarkerAPI;
import mods.AAMarker;

 

方法

 

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)

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)

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) 

void mods.AAMarkerAPI.deleteMarker(IWorld w, int atlasID, int markerID)

void mods.AAMarkerAPI.deleteGlobalMarker(IWorld w, int markerID)

 

 

带有“double”的重载方法会将给定的双精度坐标(例如可从 crafttweaker.api.player.IPlayer 获取的坐标)四舍五入为整数,其余功能则完全相同。

 

有关 markerTypes 和标签的更多详情,请参阅 Antique Atlas Wiki

 

一个简易示例 ZS

import crafttweaker.events.IEventManager;
import crafttweaker.player.IPlayer;
import mods.AAMarkerAPI;
import mods.AAMarker;

//Clicking (left- or right-) on a the specified blocks with an Antique Atlas item in-hand will add a marker to that atlas
//Clicking on a spawner will add a marker with the "skull" icon, and the diamond ore will use the "diamond" icon

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;
                                                                           
            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();
            }        
                     
            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();
            }                             
            
            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();
            }
        }
    }
});

 

 

 

 

常见问题

Antique Atlas/CraftTweaker API Adapter 支持哪些 Minecraft 版本?

Antique Atlas/CraftTweaker API Adapter 支持 Minecraft Java 版 1.12.2,可用的加载器:Forge。下载时注意选择和你游戏版本一致的文件。

Antique Atlas/CraftTweaker API Adapter 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Forge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。

评论

登录后评论和评分

targrenmods 的其他作品

查看全部 →