CraftTweakerSavedData
Link to crafttweakersaveddata
Data that is saved and loaded with the world when it is saved and loaded from disk.
Saved Data is only on the server side, so you can only get it from a invalid.
导入类
Link to 导入类
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport crafttweaker.api.world.CraftTweakerSavedData;
Extending SavedData
Link to extending-saveddata
CraftTweakerSavedData extends SavedData. That means all methods available in SavedData are also available in CraftTweakerSavedData
使用方式
Link to 使用方式
Name: getData
Return Type: IData
ZenScript Copy// CraftTweakerSavedData.getData() as IData
level.customData.getData();
Name: setData
ZenScript CopyCraftTweakerSavedData.setData(data as MapData)
参数 | 类型 |
---|---|
参数 data | 类型 MapData #地图数据 |
Name: updateData
ZenScript CopyCraftTweakerSavedData.updateData(data as IData)
参数 | 类型 |
---|---|
参数 data | 类型 IData #数据 |
名称 | 类型 | 可获得 | 可设置 |
---|---|---|---|
名称 data | 类型 IData #数据 | 可获得 true | 可设置 true |