当前位置: 首页>>代码示例>>Java>>正文


Java ItemStack.getTypeId方法代码示例

本文整理汇总了Java中org.bukkit.inventory.ItemStack.getTypeId方法的典型用法代码示例。如果您正苦于以下问题:Java ItemStack.getTypeId方法的具体用法?Java ItemStack.getTypeId怎么用?Java ItemStack.getTypeId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.inventory.ItemStack的用法示例。


在下文中一共展示了ItemStack.getTypeId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addToCraftingManager

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public void addToCraftingManager() {
    Object[] data;
    String[] shape = this.getShape();
    Map<Character, ItemStack> ingred = this.getIngredientMap();
    int datalen = shape.length;
    datalen += ingred.size() * 2;
    int i = 0;
    data = new Object[datalen];
    for (; i < shape.length; i++) {
        data[i] = shape[i];
    }
    for (char c : ingred.keySet()) {
        ItemStack mdata = ingred.get(c);
        if (mdata == null) continue;
        data[i] = c;
        i++;
        int id = mdata.getTypeId();
        short dmg = mdata.getDurability();
        data[i] = new net.minecraft.item.ItemStack(CraftMagicNumbers.getItem(id), 1, dmg);
        i++;
    }
    net.minecraft.item.crafting.CraftingManager.getInstance().addRecipe(CraftItemStack.asNMSCopy(this.getResult()), data);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:24,代码来源:CraftShapedRecipe.java

示例2: giveItem

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public void giveItem(ItemStack i, boolean addToArmor) {
	int id = i.getTypeId();
	Player p = getPlayer();
	if (!addToArmor) {
		p.getInventory().addItem(i);
		return;
	}
	
	if ((id < 298) || (317 < id))
		p.getInventory().addItem(i);
	else if ((id == 298) || (id == 302) || (id == 306) || (id == 310) || (id == 314))
		p.getInventory().setHelmet(new ItemStack(id, 1));
	else if ((id == 299) || (id == 303) || (id == 307) || (id == 311) || (id == 315))
		p.getInventory().setChestplate(new ItemStack(id, 1));
	else if ((id == 300) || (id == 304) || (id == 308) || (id == 312) || (id == 316))
		p.getInventory().setLeggings(new ItemStack(id, 1));
	else if ((id == 301) || (id == 305) || (id == 309) || (id == 313) || (id == 317))
		p.getInventory().setBoots(new ItemStack(id, 1));
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:20,代码来源:Gamer.java

示例3: setResult

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public void setResult(ItemStack item) {
    net.minecraft.item.ItemStack[] contents = getResultInventory().getContents();
    if (item == null || item.getTypeId() <= 0) {
        contents[0] = null;
    } else {
        contents[0] = CraftItemStack.asNMSCopy(item);
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:9,代码来源:CraftInventoryCrafting.java

示例4: setArmorContents

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public void setArmorContents(ItemStack[] items) {
    int cnt = getSize();

    if (items == null) {
        items = new ItemStack[4];
    }
    for (ItemStack item : items) {
        if (item == null || item.getTypeId() == 0) {
            clear(cnt++);
        } else {
            setItem(cnt++, item);
        }
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:15,代码来源:CraftInventoryPlayer.java

示例5: contains

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public boolean contains(int materialId) {
    for (ItemStack item : getContents()) {
        if (item != null && item.getTypeId() == materialId) {
            return true;
        }
    }
    return false;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:9,代码来源:CraftInventory.java

示例6: all

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public HashMap<Integer, ItemStack> all(int materialId) {
    HashMap<Integer, ItemStack> slots = new HashMap<Integer, ItemStack>();

    ItemStack[] inventory = getContents();
    for (int i = 0; i < inventory.length; i++) {
        ItemStack item = inventory[i];
        if (item != null && item.getTypeId() == materialId) {
            slots.put(i, item);
        }
    }
    return slots;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:13,代码来源:CraftInventory.java

示例7: first

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public int first(int materialId) {
    ItemStack[] inventory = getContents();
    for (int i = 0; i < inventory.length; i++) {
        ItemStack item = inventory[i];
        if (item != null && item.getTypeId() == materialId) {
            return i;
        }
    }
    return -1;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:11,代码来源:CraftInventory.java

示例8: firstPartial

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public int firstPartial(int materialId) {
    ItemStack[] inventory = getContents();
    for (int i = 0; i < inventory.length; i++) {
        ItemStack item = inventory[i];
        if (item != null && item.getTypeId() == materialId && item.getAmount() < item.getMaxStackSize()) {
            return i;
        }
    }
    return -1;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:11,代码来源:CraftInventory.java

示例9: addToCraftingManager

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public void addToCraftingManager() {
    List<ItemStack> ingred = this.getIngredientList();
    Object[] data = new Object[ingred.size()];
    int i = 0;
    for (ItemStack mdata : ingred) {
        int id = mdata.getTypeId();
        short dmg = mdata.getDurability();
        data[i] = new net.minecraft.item.ItemStack(CraftMagicNumbers.getItem(id), 1, dmg);
        i++;
    }
    net.minecraft.item.crafting.CraftingManager.getInstance().addShapelessRecipe(CraftItemStack.asNMSCopy(this.getResult()), data);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:13,代码来源:CraftShapelessRecipe.java

示例10: setItem

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public void setItem(int slot, ItemStack origItem){
	//items[slot] = new ItemStack(itemType);
	if( slot >= 27 )
		return;
	items[slot] = new ItemStack(origItem.getTypeId());
	items[slot].setAmount(origItem.getAmount());
	items[slot].setData(origItem.getData());
	items[slot].setDurability(origItem.getDurability());
}
 
开发者ID:Maximuspayne,项目名称:NavyCraft2-Lite,代码行数:11,代码来源:DataBlock.java

示例11: ItemStacks

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public ItemStacks(ItemStack sta){
    meta = new DefaultMeta(sta.getItemMeta());
    id = sta.getTypeId();
    durability = sta.getDurability();
    amount = sta.getAmount();
    array = new EnchantArray(sta);

}
 
开发者ID:DevCrafters,项目名称:SaveableSerializing,代码行数:9,代码来源:ItemStacks.java

示例12: ItemStacks

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public ItemStacks(ItemStack sta){
    meta = new DefaultMeta(sta.getItemMeta());
    id = sta.getTypeId();
    durability = sta.getDurability();
    amount = sta.getAmount();
    array = new EnchantArray(sta);
}
 
开发者ID:DevCrafters,项目名称:SaveableSerializing,代码行数:8,代码来源:ItemStacks.java

示例13: contains

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
@Override
public boolean contains( int i ) {
    for ( ItemStack item : this.items ) {
        if( item != null && item.getTypeId() == i ) {
            return true;
        }
    }
    return false;
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:10,代码来源:FlexInventory.java

示例14: all

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
@Override
public HashMap<Integer, ? extends ItemStack> all( int i ) {
    HashMap<Integer, ItemStack> results = new HashMap<>();
    for ( int index = 0; index < items.length; index++ ) {
        ItemStack itemStack = items[ index ];
        if( itemStack != null && itemStack.getTypeId() == i ) {
            results.put( index, itemStack );
        }
    }
    return results;
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:12,代码来源:FlexInventory.java

示例15: first

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
@Override
public int first( int i ) {
    int j = 0;
    for ( ItemStack item : items ) {
        if( item != null && item.getTypeId() == i ) {
            return j;
        }
        j++;
    }
    return -1;
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:12,代码来源:FlexInventory.java


注:本文中的org.bukkit.inventory.ItemStack.getTypeId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。