本文整理了Java中org.bukkit.inventory.ItemStack.clone()
方法的一些代码示例,展示了ItemStack.clone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ItemStack.clone()
方法的具体详情如下:
包路径:org.bukkit.inventory.ItemStack
类名称:ItemStack
方法名:clone
暂无
代码示例来源:origin: Bukkit/Bukkit
/**
* Gets an ItemStack representing the cursor prior to any modifications
* as a result of this drag.
*
* @return the original cursor
*/
public ItemStack getOldCursor() {
return oldCursor.clone();
}
代码示例来源:origin: Bukkit/Bukkit
/**
* Gets the item that is being dispensed. Modifying the returned item will
* have no effect, you must use {@link
* #setItem(org.bukkit.inventory.ItemStack)} instead.
*
* @return An ItemStack for the item being dispensed
*/
public ItemStack getItem() {
return item.clone();
}
代码示例来源:origin: Bukkit/Bukkit
/**
* Get the input material.
*
* @return The input material.
*/
public ItemStack getInput() {
return this.ingredient.clone();
}
代码示例来源:origin: Bukkit/Bukkit
/**
* Gets the ItemStack being moved; if modified, the original item will not
* be removed from the source inventory.
*
* @return ItemStack
*/
public ItemStack getItem() {
return itemStack.clone();
}
代码示例来源:origin: Bukkit/Bukkit
/**
* Get the result of this recipe.
*
* @return The result stack.
*/
public ItemStack getResult() {
return output.clone();
}
代码示例来源:origin: Bukkit/Bukkit
/**
* Gets the item that is being consumed. Modifying the returned item will
* have no effect, you must use {@link
* #setItem(org.bukkit.inventory.ItemStack)} instead.
*
* @return an ItemStack for the item being consumed
*/
public ItemStack getItem() {
return item.clone();
}
代码示例来源:origin: Bukkit/Bukkit
/**
* Get the result of this recipe.
*
* @return The resulting stack.
*/
public ItemStack getResult() {
return output.clone();
}
}
代码示例来源:origin: Bukkit/Bukkit
/**
* Get the result.
*
* @return The result stack.
*/
public ItemStack getResult() {
return output.clone();
}
}
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
public ItemStack ensureServerConversions(ItemStack itemStack) {
// TODO: Implementation (1.12.1)
return itemStack.clone();
}
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
public ItemStack getSaddle() {
return saddle != null ? saddle.clone() : null;
}
代码示例来源:origin: Bukkit/Bukkit
/**
* Sets the ItemStack being moved; if this is different from the original
* ItemStack, the original item will not be removed from the source
* inventory.
*
* @param itemStack The ItemStack
*/
public void setItem(ItemStack itemStack) {
Validate.notNull(itemStack, "ItemStack cannot be null. Cancel the event if you want nothing to be transferred.");
this.itemStack = itemStack.clone();
}
代码示例来源:origin: Bukkit/Bukkit
/**
* Get the list of ingredients used for this recipe.
*
* @return The input list
*/
public List<ItemStack> getIngredientList() {
ArrayList<ItemStack> result = new ArrayList<ItemStack>(ingredients.size());
for (ItemStack ingredient : ingredients) {
result.add(ingredient.clone());
}
return result;
}
}
代码示例来源:origin: Bukkit/Bukkit
/**
* Get a copy of the ingredients map.
*
* @return The mapping of character to ingredients.
*/
public Map<Character, ItemStack> getIngredientMap() {
HashMap<Character, ItemStack> result = new HashMap<Character, ItemStack>();
for (Map.Entry<Character, ItemStack> ingredient : ingredients.entrySet()) {
if (ingredient.getValue() == null) {
result.put(ingredient.getKey(), null);
} else {
result.put(ingredient.getKey(), ingredient.getValue().clone());
}
}
return result;
}
代码示例来源:origin: GlowstoneMC/Glowstone
/**
* Update the given slot with the current value from the inventory.
*
* @param slot The slot to update.
*/
private void updateItem(int slot) {
ItemStack source = getItem(slot);
slots[slot] = source == null ? null : source.clone();
}
代码示例来源:origin: GlowstoneMC/Glowstone
/**
* Update the given slot with the current value from the view.
*
* @param slot The slot to update.
*/
private void updateItem(int slot) {
// sanitize() used as a last line of defense to prevent client crashes
// GlowInventory should generally be able to keep its contents safe
ItemStack source = view.getItem(slot);
slots[slot] = source == null ? null : ItemIds.sanitize(source.clone());
}
代码示例来源:origin: GlowstoneMC/Glowstone
/**
* Set the firework item of this firework entity. If an empty ItemStack, or none of the type
* {{@link Material#FIREWORK}} was given, a new Firework ItemStack will be created.
*
* @param item FireWork Item this entity should use
*/
public void setFireworkItem(ItemStack item) {
if (InventoryUtil.isEmpty(item) || !Material.FIREWORK.equals(item.getType())) {
item = DEFAULT_FIREWORK_ITEM.clone();
}
this.metadata.set(MetadataIndex.FIREWORK_INFO, item.clone());
}
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
public void setItemStack(ItemStack stack) {
// stone is the "default state" for the item stack according to the client
metadata.set(MetadataIndex.ITEM_ITEM,
stack == null ? new ItemStack(Material.STONE) : stack.clone());
}
}
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
public void setItem(ItemStack is) {
is = InventoryUtil.itemOrEmpty(is).clone();
is.setAmount(1);
metadata.set(MetadataIndex.ITEM_FRAME_ITEM, is);
}
代码示例来源:origin: GlowstoneMC/Glowstone
private ItemStack combine(ItemStack slotItem, ItemStack cursor, int amount) {
if (InventoryUtil.isEmpty(slotItem)) {
ItemStack stack = cursor.clone();
stack.setAmount(amount);
return stack;
} else if (slotItem.isSimilar(cursor)) {
slotItem.setAmount(slotItem.getAmount() + amount);
return slotItem;
} else {
throw new IllegalArgumentException(
"Trying to combine dissimilar " + slotItem + " and " + cursor);
}
}
代码示例来源:origin: GlowstoneMC/Glowstone
/**
* Get the underlying firework item.
*
* @return The Firework ItemStack of this Firework entity, or a new Firework ItemStack
*/
public ItemStack getFireworkItem() {
ItemStack item = this.metadata.getItem(MetadataIndex.FIREWORK_INFO);
if (InventoryUtil.isEmpty(item) || !Material.FIREWORK.equals(item.getType())) {
item = DEFAULT_FIREWORK_ITEM.clone();
}
return item;
}
内容来源于网络,如有侵权,请联系作者删除!