本文整理了Java中org.bukkit.inventory.ItemStack.setTypeId()
方法的一些代码示例,展示了ItemStack.setTypeId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ItemStack.setTypeId()
方法的具体详情如下:
包路径:org.bukkit.inventory.ItemStack
类名称:ItemStack
方法名:setTypeId
[英]Sets the type id of this item
Note that in doing so you will reset the MaterialData for this stack
[中]设置此项目的类型id
请注意,这样做会重置此堆栈的MaterialData
代码示例来源:origin: Bukkit/Bukkit
/**
* Sets the type of this item
* <p>
* Note that in doing so you will reset the MaterialData for this stack
*
* @param type New type to set the items in this stack to
*/
@Utility
public void setType(Material type) {
Validate.notNull(type, "Material cannot be null");
setTypeId(type.getId());
}
代码示例来源:origin: SpigotMC/Spigot-API
/**
* Sets the type of this item
* <p>
* Note that in doing so you will reset the MaterialData for this stack
*
* @param type New type to set the items in this stack to
*/
@Utility
public void setType(Material type) {
Validate.notNull(type, "Material cannot be null");
setTypeId(type.getId());
}
代码示例来源:origin: bergerkiller/BKCommonLib
/**
* Transfers the item type, data and enchantments from one item stack to the other
*
* @param from which Item Stack to read the info
* @param to which Item Stack to transfer the info to
*/
@SuppressWarnings("deprecation")
public static void transferInfo(org.bukkit.inventory.ItemStack from, org.bukkit.inventory.ItemStack to) {
// Transfer type, durability and any other remaining metadata information
to.setTypeId(from.getTypeId());
to.setDurability(from.getDurability());
setMetaTag(to, LogicUtil.clone(getMetaTag(from)));
}
内容来源于网络,如有侵权,请联系作者删除!