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


Java CoalType类代码示例

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


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

示例1: isMobDrop

import org.bukkit.CoalType; //导入依赖的package包/类
/**
 * Checks to see if an item is a mob drop.
 *
 * @param item Item to check
 * @return true if the item is a mob drop, false otherwise
 */
public static boolean isMobDrop(ItemStack item) {
    switch (item.getType()) {
        case STRING:
        case FEATHER:
        case RAW_CHICKEN:
        case COOKED_CHICKEN:
        case LEATHER:
        case RAW_BEEF:
        case COOKED_BEEF:
        case PORK:
        case GRILLED_PORK:
        case WOOL:
        case IRON_INGOT:
        case SNOW_BALL:
        case BLAZE_ROD:
        case SPIDER_EYE:
        case SULPHUR:
        case ENDER_PEARL:
        case GHAST_TEAR:
        case MAGMA_CREAM:
        case BONE:
        case ARROW:
        case SLIME_BALL:
        case NETHER_STAR:
        case ROTTEN_FLESH:
        case GOLD_NUGGET:
        case EGG:
            return true;

        case COAL: // Not sure we should include this, as it will also trigger when mining
            return (((Coal) item.getData()).getType() == CoalType.COAL);

        case RED_ROSE: // Not sure we should include this, as it will also trigger from herbalism
            return (item.getData().getData() == 0x0);

        default:
            return false;
    }
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:46,代码来源:ItemUtils.java

示例2: Coal

import org.bukkit.CoalType; //导入依赖的package包/类
public Coal(CoalType type) {
    this();
    setType(type);
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:5,代码来源:Coal.java

示例3: Coal

import org.bukkit.CoalType; //导入依赖的package包/类
public Coal(CoalType type) {
}
 
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:3,代码来源:Coal.java

示例4: getType

import org.bukkit.CoalType; //导入依赖的package包/类
public CoalType getType() {
	return null;
}
 
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:4,代码来源:Coal.java

示例5: setType

import org.bukkit.CoalType; //导入依赖的package包/类
public void setType(CoalType type) {
}
 
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:3,代码来源:Coal.java

示例6: getMaterialData

import org.bukkit.CoalType; //导入依赖的package包/类
public static MaterialData getMaterialData(String identifier) {
    final String[] split = identifier.replaceAll("\\s+", "_").split("\\W");
    // TODO: Add additional material/name database like essentials/worldedit have
    Material material = matchMaterial(split[0]);

    if (material == null) {
        // try worldedit
        material = getWEMaterial(split[0]);
        if (material == null) return null;
    }

    if (split.length == 1) {
        return new MaterialData(material);
    }

    try {
        final byte rawData = Byte.parseByte(split[1]);
        return new MaterialData(material, rawData);
    } catch (NumberFormatException e) {
        // ignore
    }

    switch (material) {
        case LEAVES:
            return getMaterialData(material, Leaves::new, TreeSpecies.class, split[1]);
        case COAL:
            return getMaterialData(material, Coal::new, CoalType.class, split[1]);
        case LONG_GRASS:
            return getMaterialData(material, LongGrass::new, GrassSpecies.class, split[1]);
        case SANDSTONE:
            return getMaterialData(material, Sandstone::new, SandstoneType.class, split[1]);
        case MONSTER_EGG:
            return getMaterialData(material, SpawnEgg::new, EntityType.class, split[1]);
        case LOG:
            return getMaterialData(material, Tree::new, TreeSpecies.class, split[1]);
        case WOOD_STEP:
            return getMaterialData(material, WoodenStep::new, TreeSpecies.class, split[1]);
        case WOOL:
            return getMaterialData(material, Wool::new, DyeColor.class, split[1]);
        // TODO: Add Dye here when Spigot finally accepts my PR to match other MaterialData types
        default:
            // Couldn't find additional data for this material
            return new MaterialData(material);
    }
}
 
开发者ID:t7seven7t,项目名称:CraftFX,代码行数:46,代码来源:MaterialDataUtil.java

示例7: getType

import org.bukkit.CoalType; //导入依赖的package包/类
/**
 * Gets the current type of this coal
 *
 * @return CoalType of this coal
 */
public CoalType getType() {
    return CoalType.getByData(getData());
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:9,代码来源:Coal.java

示例8: setType

import org.bukkit.CoalType; //导入依赖的package包/类
/**
 * Sets the type of this coal
 *
 * @param type New type of this coal
 */
public void setType(CoalType type) {
    setData(type.getData());
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:9,代码来源:Coal.java


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