@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(); }
public FlowerPot() { }
@Deprecated public FlowerPot(int type) { }
public FlowerPot(Material type) { }
@Deprecated public FlowerPot(int type, byte data) { }
@Deprecated public FlowerPot(Material type, byte data) { }
public FlowerPot clone() { return null; }