API

AttributeAPI

/* 获取实体的属性数据 */
fun getAttrData(entity: LivingEntity) : AttributeData = AttributePlus.attributeManager.getAttributeData(entity.uniqueId, entity)

/* 
  延迟任务
  ID相同的任务会被覆盖 
*/
fun runEntityTask(millis: Long, id: String, entity: LivingEntity, block: () -> Unit)

/* 获取物品上的 AttributeSource 数据 */
fun getAttributeSource(itemStack: ItemStack, async: Boolean) = AttributeSource(itemStack, async)
/* 获取 List 上的 AttributeSource 数据 */
fun getAttributeSource(list: List<String>, async: Boolean) = AttributeSource(list, async)

/* 增加一个源的属性数据 */
fun addSourceAttribute(attributeData: AttributeData, source: String, attr: AttributeSource, async: Boolean = false)
fun addSourceAttribute(attributeData: AttributeData, source: String, itemStack: ItemStack?, async: Boolean = false)
fun addSourceAttribute(attributeData: AttributeData, source: String, list: List<String>?, async: Boolean = false)
fun addSourceAttribute(attributeData: AttributeData, source: String, attribute: HashMap<String, Array<Number>>?, async: Boolean = false)

/* 删除一个源的属性数据 */
fun takeSourceAttribute(attributeData: AttributeData, source: String)

最后更新于