/** * Get the material in the flower pot * * @return material MaterialData for the block currently in the flower pot * or null if empty */ public MaterialData getContents() { switch (getData()) { case 1: return new MaterialData(Material.RED_ROSE); case 2: return new MaterialData(Material.YELLOW_FLOWER); case 3: return new Tree(TreeSpecies.GENERIC); case 4: return new Tree(TreeSpecies.REDWOOD); case 5: return new Tree(TreeSpecies.BIRCH); case 6: return new Tree(TreeSpecies.JUNGLE); case 7: return new MaterialData(Material.RED_MUSHROOM); case 8: return new MaterialData(Material.BROWN_MUSHROOM); case 9: return new MaterialData(Material.CACTUS); case 10: return new MaterialData(Material.DEAD_BUSH); case 11: return new LongGrass(GrassSpecies.FERN_LIKE); default: return null; } }
/** * Get the material in the flower pot * * @return material MaterialData for the block currently in the flower pot or null if empty */ public MaterialData getContents() { switch (getData()) { case 1: return new MaterialData(Material.RED_ROSE); case 2: return new MaterialData(Material.YELLOW_FLOWER); case 3: return new Tree(TreeSpecies.GENERIC); case 4: return new Tree(TreeSpecies.REDWOOD); case 5: return new Tree(TreeSpecies.BIRCH); case 6: return new Tree(TreeSpecies.JUNGLE); case 7: return new MaterialData(Material.RED_MUSHROOM); case 8: return new MaterialData(Material.BROWN_MUSHROOM); case 9: return new MaterialData(Material.CACTUS); case 10: return new MaterialData(Material.DEAD_BUSH); case 11: return new LongGrass(GrassSpecies.FERN_LIKE); default: return null; } }
public LongGrass(GrassSpecies species) { this(); setSpecies(species); }
public LongGrass(GrassSpecies species) { }
public GrassSpecies getSpecies() { return null; }
public void setSpecies(GrassSpecies species) { }
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); } }
/** * Gets the current species of this grass * * @return GrassSpecies of this grass */ public GrassSpecies getSpecies() { return GrassSpecies.getByData(getData()); }
/** * Sets the species of this grass * * @param species New species of this grass */ public void setSpecies(GrassSpecies species) { setData(species.getData()); }