• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Item类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.canarymod.api.inventory.Item的典型用法代码示例。如果您正苦于以下问题:Java Item类的具体用法?Java Item怎么用?Java Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Item类属于net.canarymod.api.inventory包,在下文中一共展示了Item类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createPacket

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
public Packet createPacket(int id, Object... args) throws InvalidPacketConstructionException {
    if (args == null || args.length < 1) {
        throw new IllegalArgumentException("Arguments cannot be null or empty!");
    }
    switch (id) {
        case 0:
            throw new InvalidPacketConstructionException(id, "KeepAlive", "Keep Alive packets should only be handled by the server!");
        case 1:
            throw new InvalidPacketConstructionException(id, "JoinGame", "Join Game packets should only be handled by the server!");
        case 2:
            this.check(2, "Chat", 1, args, this.test(ChatComponent.class));
            return this.chat((ChatComponent) args[0]);
        case 3:
            this.check(3, "UpdateTime", 2, args, this.test(Long.class), this.test(Long.class));
            return this.updateTime((Long) args[0], (Long) args[1]);
        case 4:
            this.check(4, "EntityEquipment", 3, args, this.test(Integer.class), this.test(Integer.class), this.test(Item.class));
            return this.entityEquipment((Integer) args[0], (Integer) args[1], (Item) args[2]);
        case 5:
            this.check(5, "SpawnPosition", 3, args, this.test(Integer.class), this.test(Integer.class), this.test(Integer.class));
            return this.spawnPosition((Integer) args[0], (Integer) args[1], (Integer) args[2]);
    }
    return null;
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:26,代码来源:NeptunePacketFactory.java


示例2: newItem

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
public Item newItem(int id, int damage, int stackSize) {
    net.minecraft.item.Item item = net.minecraft.item.Item.getItemById(id);
    item.setMaxDamage(damage);
    item.setMaxStackSize(stackSize);
    return (Item) item;
}
 
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:8,代码来源:NeptuneItemFactory.java


示例3: newItem

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
public Item newItem(int id, int damage, int stackSize) {
    final net.minecraft.item.Item item = net.minecraft.item.Item.getItemById(id);
    item.setMaxDamage(damage);
    item.setMaxStackSize(stackSize);
    return (Item) item;
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:8,代码来源:NeptuneItemFactory.java


示例4: setItem

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
public void setItem(Item item) {
    this.dataWatcher.updateObject(8, item);

    // Update flight information
    final NBTTagCompound tagCompound = ((ItemStack) item).getTagCompound().getCompoundTag("Fireworks");
    if (tagCompound != null) {
        this.lifetime = 10 * tagCompound.getByte("Flight") + this.rand.nextInt(6) + this.rand.nextInt(7);
    }
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:11,代码来源:MixinEntityFireworkRocket.java


示例5: onBlockRightClick

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onBlockRightClick(final BlockRightClickHook hook) {
    final Player player = hook.getPlayer();
    final Block block = hook.getBlockClicked();

    final Item item = player.getItemHeld();
    final TileEntity tileEntity = block.getTileEntity();
    final BlockType type = block.getType();

    if (item == null || tileEntity != null || type == BlockType.AcaciaDoor
            || type == BlockType.AcaciaFenceGate || type == BlockType.Bed
            || type == BlockType.BirchDoor || type == BlockType.BirchFenceGate
            || type == BlockType.Cake || type == BlockType.Cauldron || type == BlockType.DarkOakDoor
            || type == BlockType.DarkOakFenceGate || type == BlockType.EndPortalFrame
            || type == BlockType.Farmland || type == BlockType.FenceGate || type == BlockType.Flowerpot
            || type == BlockType.JungleDoor || type == BlockType.JungleFenceGate
            || type == BlockType.Lever || type == BlockType.MobSpawner || type == BlockType.OakDoor
            || type == BlockType.RedstoneRepeaterOff || type == BlockType.RedstoneRepeaterOn
            || type == BlockType.SpruceDoor || type == BlockType.SpruceFenceGate
            || type == BlockType.StoneButton || type == BlockType.Trapdoor
            || type == BlockType.WoodenButton || type == BlockType.WoodenDoor) {
        if (!player.isOperator() && !player.safeHasPermission("zown.admin.mod")) {
            final Tree<? extends IZown> zownTree = zownManager.getZown(block.getLocation());
            if (!zownTree.getData().isOwnerOrMember(player)) {
                final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.interact.name());
                if (flag != null) {
                    final boolean excluded = zownTree.getData().getConfiguration()
                            .hasBlockInteractExclusion(block.getType());
                    if (flag) {
                        if (excluded) {
                            hook.setCanceled();
                            closeDoor(block);
                        }
                    } else {
                        if (!excluded) {
                            hook.setCanceled();
                            closeDoor(block);
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:45,代码来源:ModifyWorldListener.java


示例6: getContents

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
default Item[] getContents() {
    return null;
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:5,代码来源:MixinIInventory.java


示例7: setBuyingOne

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
public void setBuyingOne(Item item) {
    this.itemToBuy = (ItemStack) item;
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:5,代码来源:MixinMerchantRecipe.java


示例8: setBuyingTwo

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
public void setBuyingTwo(Item item) {
    this.secondItemToBuy = (ItemStack) item;
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:5,代码来源:MixinMerchantRecipe.java


示例9: newVillagerTrade

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
public VillagerTrade newVillagerTrade(Item buying, Item selling) {
    return (VillagerTrade) new MerchantRecipe((ItemStack) buying, (ItemStack) selling);
}
 
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:5,代码来源:NeptuneObjectFactory.java


示例10: entityEquipment

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
public Packet entityEquipment(int entityID, int slot, Item item) {
    return null;
}
 
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:5,代码来源:NeptunePacketFactory.java


示例11: setSlot

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
public Packet setSlot(int windowId, int slotId, Item item) {
    return null;
}
 
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:5,代码来源:NeptunePacketFactory.java


示例12: addItem

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
default void addItem(ItemType var1) {
    this.addItem((Item) new ItemStack(net.minecraft.item.Item.getItemById(var1.getId()), 1, var1.getData()));
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:5,代码来源:MixinIInventory.java


示例13: getResult

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
public Item getResult() {
    return (Item) this.getHandle().getRecipeOutput();
}
 
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:5,代码来源:NeptuneRecipe.java


示例14: getRecipeItems

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
public Item[] getRecipeItems() {
    return (Item[]) this.getHandle().recipeItems;
}
 
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:5,代码来源:NeptuneShapedRecipe.java


示例15: removeItem

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
default Item removeItem(String var1) {
    return null;
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:5,代码来源:MixinIInventory.java


示例16: getSlot

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
default Item getSlot(int var1) {
    return (Item) this.getStackInSlot(var1);
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:5,代码来源:MixinIInventory.java


示例17: setEquipment

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
public void setEquipment(Item item, int slot) {
    this.equipment[slot] = (ItemStack) item;
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:5,代码来源:MixinEntityLiving.java


示例18: getAllEquipment

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
public Item[] getAllEquipment() {
    return (Item[]) this.getInventory();
}
 
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:5,代码来源:MixinEntityArmorStand.java


示例19: getEquipment

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
public Item getEquipment(Slot slot) {
    return this.getAllEquipment()[slot.ordinal()];
}
 
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:5,代码来源:MixinEntityArmorStand.java


示例20: getItemInFrame

import net.canarymod.api.inventory.Item; //导入依赖的package包/类
@Override
public Item getItemInFrame() {
    return (Item) this.getDisplayedItem();
}
 
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:5,代码来源:MixinEntityItemFrame.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TriggerDef类代码示例发布时间:2022-05-22
下一篇:
Java ServiceSupport类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap