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

项目:Steel    文件:BlockStateSerializer.java   
@SuppressWarnings("deprecation")
public static Optional<String> serializeState(BlockState state) {
    YamlConfiguration yaml = new YamlConfiguration();

    // http://minecraft.gamepedia.com/Block_entity was used as a reference for this method

    if (state instanceof InventoryHolder) {
        yaml.set(INVENTORY_KEY, InventoryHelper.serializeInventory(((InventoryHolder) state).getInventory()));
    }

    if (state instanceof Sign) {
        yaml.set(SIGN_LINES_KEY, Arrays.asList(((Sign) state).getLines()));
    } else if (Support.BANNER && state instanceof Banner) {
        yaml.set(BANNER_BASE_COLOR_KEY, ((Banner) state).getBaseColor().name());
        ConfigurationSection patternSection = yaml.createSection(BANNER_PATTERNS_KEY);
        List<Pattern> patterns = ((Banner) state).getPatterns();
        for (int i = 0; i < patterns.size(); i++) {
            ConfigurationSection subSection = patternSection.createSection("" + i);
            subSection.set(BANNER_PATTERN_COLOR_KEY, patterns.get(i).getColor().name());
            subSection.set(BANNER_PATTERN_TYPE_KEY, patterns.get(i).getPattern().name());
        }
    } else if (state instanceof CreatureSpawner) {
        yaml.set(SPAWNER_TYPE_KEY, ((CreatureSpawner) state).getSpawnedType().name());
        yaml.set(SPAWNER_DELAY_KEY, ((CreatureSpawner) state).getDelay());
    } else if (state instanceof NoteBlock) {
        yaml.set(NOTE_OCTAVE_KEY, ((NoteBlock) state).getNote().getOctave());
        yaml.set(NOTE_TONE_KEY, ((NoteBlock) state).getNote().getTone().name());
    } else if (state instanceof Jukebox) {
        if (((Jukebox) state).isPlaying()) {
            yaml.set(JUKEBOX_DISC_KEY, ((Jukebox) state).getPlaying());
        }
    } else if (state instanceof Skull) {
        yaml.set(SKULL_OWNER_KEY, ((Skull) state).getOwner());
        yaml.set(SKULL_ROTATION_KEY, ((Skull) state).getRotation().name());
    } else if (state instanceof CommandBlock) {
        yaml.set(COMMAND_NAME_KEY, ((CommandBlock) state).getName());
        yaml.set(COMMAND_CMD_KEY, ((CommandBlock) state).getCommand());
    } else if (state instanceof FlowerPot) {
        yaml.set(FLOWER_TYPE_KEY, ((FlowerPot) state).getContents().getItemType().name());
        yaml.set(FLOWER_DATA_KEY, ((FlowerPot) state).getContents().getData());
    }

    if (yaml.getKeys(false).size() > 0) {
        return Optional.of(yaml.saveToString());
    }
    return Optional.absent();
}
项目:BedrockAPI    文件:FlowerPot.java   
public FlowerPot() {
}
项目:BedrockAPI    文件:FlowerPot.java   
@Deprecated public FlowerPot(int type) {
}
项目:BedrockAPI    文件:FlowerPot.java   
public FlowerPot(Material type) {
}
项目:BedrockAPI    文件:FlowerPot.java   
@Deprecated public FlowerPot(int type, byte data) {
}
项目:BedrockAPI    文件:FlowerPot.java   
@Deprecated public FlowerPot(Material type, byte data) {
}
项目:BedrockAPI    文件:FlowerPot.java   
public FlowerPot clone() {
    return null;
}