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


Java CraftMagicNumbers.getItem方法代码示例

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


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

示例1: setPlaying

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
@Override
public void setPlaying(Material record) {
    if (record == null || CraftMagicNumbers.getItem(record) == null) {
        record = Material.AIR;
        jukebox.func_145857_a(null);
    } else {
        jukebox.func_145857_a(new ItemStack(CraftMagicNumbers.getItem(record), 1));
    }
    jukebox.markDirty();
    if (record == Material.AIR) {
        world.getHandle().setBlockMetadataWithNotify(getX(), getY(), getZ(), 0, 3);
    } else {
        world.getHandle().setBlockMetadataWithNotify(getX(), getY(), getZ(), 1, 3);
    }
    world.playEffect(getLocation(), Effect.RECORD_PLAY, record.getId());
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:17,代码来源:CraftJukebox.java

示例2: setTypeId

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
@Override
public void setTypeId(int type) {
    if (getTypeId() == type) {
        return;
    } else if (type == 0) {
        handle = null;
    } else if (CraftMagicNumbers.getItem(type) == null) { // :(
        handle = null;
    } else if (handle == null) {
        handle = new net.minecraft.item.ItemStack(CraftMagicNumbers.getItem(type), 1, 0);
    } else {
        handle.func_150996_a(CraftMagicNumbers.getItem(type));
        if (hasItemMeta()) {
            // This will create the appropriate item meta, which will contain all the data we intend to keep
            setItemMeta(handle, getItemMeta(handle));
        }
    }
    setData(null);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:20,代码来源:CraftItemStack.java

示例3: addToCraftingManager

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的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

示例4: addToCraftingManager

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的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.server.ItemStack(CraftMagicNumbers.getItem(id), 1, dmg);
        i++;
    }
    CraftingManager.getInstance().registerShapedRecipe(CraftItemStack.asNMSCopy(this.getResult()), data);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:24,代码来源:CraftShapedRecipe.java

示例5: setPlaying

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
@Override
public void setPlaying(Material record) {
    if (record == null || CraftMagicNumbers.getItem(record) == null) {
        record = Material.AIR;
        jukebox.setRecord(null);
    } else {
        jukebox.setRecord(new ItemStack(CraftMagicNumbers.getItem(record), 1));
    }
    jukebox.update();
    if (record == Material.AIR) {
        world.getHandle().setData(getX(), getY(), getZ(), 0, 3);
    } else {
        world.getHandle().setData(getX(), getY(), getZ(), 1, 3);
    }
    world.playEffect(getLocation(), Effect.RECORD_PLAY, record.getId());
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:17,代码来源:CraftJukebox.java

示例6: addToCraftingManager

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的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];
    }*/
    System.arraycopy(shape, 0, data, 0, shape.length);i=shape.length;//FFoKC
    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:Bogdan-G,项目名称:FFoKC,代码行数:25,代码来源:CraftShapedRecipe.java

示例7: addToCraftingManager

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的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

示例8: canMineBlock

import org.bukkit.craftbukkit.util.CraftMagicNumbers; //导入方法依赖的package包/类
/**
 * Test if the given tool is capable of "efficiently" mining the given block.
 *
 * Derived from CraftBlock.itemCausesDrops()
 */
public static boolean canMineBlock(MaterialData blockMaterial, org.bukkit.inventory.ItemStack tool) {
    if(!blockMaterial.getItemType().isBlock()) {
        throw new IllegalArgumentException("Material '" + blockMaterial + "' is not a block");
    }

    net.minecraft.server.Block nmsBlock = CraftMagicNumbers.getBlock(blockMaterial.getItemType());
    net.minecraft.server.Item nmsTool = tool == null ? null : CraftMagicNumbers.getItem(tool.getType());

    return nmsBlock != null && (nmsBlock.getBlockData().getMaterial().isAlwaysDestroyable() ||
                                (nmsTool != null && nmsTool.canDestroySpecialBlock(nmsBlock.getBlockData())));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:17,代码来源:NMSHacks.java


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