类org.bukkit.material.Dye源码实例Demo

下面列出了怎么用org.bukkit.material.Dye的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: FastAsyncWorldedit   文件: BukkitPlayer.java
@Override
public BaseBlock getBlockInHand() throws WorldEditException {
    ItemStack itemStack = player.getItemInHand();
    if (itemStack == null) {
        return EditSession.nullBlock;
    }
    final int typeId = itemStack.getTypeId();
    switch (typeId) {
        case 0:
            return EditSession.nullBlock;
        case ItemID.INK_SACK:
            final Dye materialData = (Dye) itemStack.getData();
            if (materialData.getColor() == DyeColor.BROWN) {
                return FaweCache.getBlock(BlockID.COCOA_PLANT, 0);
            }
            break;
        case ItemID.HEAD:
            return new SkullBlock(0, (byte) itemStack.getDurability());

        default:
            final BaseBlock baseBlock = BlockType.getBlockForItem(typeId, itemStack.getDurability());
            if (baseBlock != null) {
                return baseBlock;
            }
            break;
    }
    BaseBlock block = FaweCache.getBlock(typeId, itemStack.getType().getMaxDurability() != 0 ? 0 : Math.max(0, itemStack.getDurability()));
    if (Settings.IMP.EXPERIMENTAL.PERSISTENT_BRUSHES && Fawe.<FaweBukkit>imp().getItemUtil() != null) {
        return new BrushBoundBaseBlock(this, WorldEdit.getInstance().getSession(this), itemStack);
    }
    return block;
}
 
源代码2 项目: UhcCore   文件: CutCleanListener.java
public CutCleanListener(){
    Dye d = new Dye();
    d.setColor(DyeColor.BLUE);
    this.lapis = d.toItemStack();
    this.lapis.setAmount(64);
}
 
 类所在包
 类方法
 同包方法