Java 类org.bukkit.material.Coal 实例源码

项目:McMMOPlus    文件:ItemUtils.java   
/**
 * 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;
    }
}
项目:BedrockAPI    文件:Coal.java   
public Coal() {
}
项目:BedrockAPI    文件:Coal.java   
public Coal(CoalType type) {
}
项目:BedrockAPI    文件:Coal.java   
@Deprecated public Coal(int type) {
}
项目:BedrockAPI    文件:Coal.java   
public Coal(Material type) {
}
项目:BedrockAPI    文件:Coal.java   
@Deprecated public Coal(int type, byte data) {
}
项目:BedrockAPI    文件:Coal.java   
@Deprecated public Coal(Material type, byte data) {
}
项目:BedrockAPI    文件:Coal.java   
public Coal clone() {
    return null;
}
项目:CraftFX    文件:MaterialDataUtil.java   
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);
    }
}