Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 2 files changed
  • 0 comments
  • 2 contributors
5 src/main/java/org/spout/vanilla/material/VanillaMaterials.java
@@ -35,6 +35,7 @@
35 35 import org.spout.vanilla.material.block.Cactus;
36 36 import org.spout.vanilla.material.block.DoubleSlab;
37 37 import org.spout.vanilla.material.block.Fire;
  38 +import org.spout.vanilla.material.block.Flower;
38 39 import org.spout.vanilla.material.block.Grass;
39 40 import org.spout.vanilla.material.block.Gravel;
40 41 import org.spout.vanilla.material.block.Ice;
@@ -121,8 +122,8 @@
121 122 public static final Solid PISTON_EXTENSION = (Solid) register(new Solid("Piston (Head)", 34).setResistance(0.8F));
122 123 public static final Wool WOOL = Wool.WHITE;
123 124 public static final Solid MOVED_BY_PISTON = (Solid) register(new Solid("Moved By Piston", 36).setResistance(0.0F));
124   - public static final GroundAttachable DANDELION = (GroundAttachable) register(new GroundAttachable("Dandelion", 37).setHardness(0.0F).setResistance(0.0F));
125   - public static final GroundAttachable ROSE = (GroundAttachable) register(new GroundAttachable("Rose", 38).setHardness(0.0F).setResistance(0.0F));
  125 + public static final Flower DANDELION = (Flower) register(new Flower("Dandelion", 37).setHardness(0.0F).setResistance(0.0F));
  126 + public static final Flower ROSE = (Flower) register(new Flower("Rose", 38).setHardness(0.0F).setResistance(0.0F));
126 127 public static final GroundAttachable BROWN_MUSHROOM = (GroundAttachable) register(new GroundAttachable("Brown Mushroom", 39).setHardness(0.0F).setResistance(0.0F).setLightLevel(1));
127 128 public static final GroundAttachable RED_MUSHROOM = (GroundAttachable) register(new GroundAttachable("Red Mushroom", 40).setHardness(0.0F).setResistance(0.0F));
128 129 public static final Solid GOLD_BLOCK = (Solid) register(new Solid("Gold Block", 41).setHardness(3.0F).setResistance(10.0F));
70 src/main/java/org/spout/vanilla/material/block/Flower.java
... ... @@ -0,0 +1,70 @@
  1 +/*
  2 + * This file is part of Vanilla (http://www.spout.org/).
  3 + *
  4 + * Vanilla is licensed under the SpoutDev License Version 1.
  5 + *
  6 + * Vanilla is free software: you can redistribute it and/or modify
  7 + * it under the terms of the GNU Lesser General Public License as published by
  8 + * the Free Software Foundation, either version 3 of the License, or
  9 + * (at your option) any later version.
  10 + *
  11 + * In addition, 180 days after any changes are published, you can use the
  12 + * software, incorporating those changes, under the terms of the MIT license,
  13 + * as described in the SpoutDev License Version 1.
  14 + *
  15 + * Vanilla is distributed in the hope that it will be useful,
  16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18 + * GNU Lesser General Public License for more details.
  19 + *
  20 + * You should have received a copy of the GNU Lesser General Public License,
  21 + * the MIT license and the SpoutDev License Version 1 along with this program.
  22 + * If not, see <http://www.gnu.org/licenses/> for the GNU Lesser General Public
  23 + * License and see <http://www.spout.org/SpoutDevLicenseV1.txt> for the full license,
  24 + * including the MIT license.
  25 + */
  26 +package org.spout.vanilla.material.block;
  27 +
  28 +import org.spout.api.Source;
  29 +import org.spout.api.geo.World;
  30 +import org.spout.api.geo.cuboid.Block;
  31 +import org.spout.api.material.Material;
  32 +import org.spout.api.material.block.BlockFace;
  33 +import org.spout.vanilla.material.Plant;
  34 +import org.spout.vanilla.material.attachable.GroundAttachable;
  35 +
  36 +public class Flower extends GroundAttachable implements Plant {
  37 + public Flower(String name, int id) {
  38 + super(name, id);
  39 + }
  40 +
  41 + @Override
  42 + public boolean hasGrowthStages() {
  43 + return false;
  44 + }
  45 +
  46 + @Override
  47 + public int getNumGrowthStages() {
  48 + return 0;
  49 + }
  50 +
  51 + @Override
  52 + public int getMinimumLightToGrow() {
  53 + return 8;
  54 + }
  55 +
  56 + @Override
  57 + public boolean canPlace(World world, int x, int y, int z, short data, BlockFace against, Source source) {
  58 + if (super.canPlace(world, x, y, z, data, against, source)) {
  59 + Block block = world.getBlock(x, y, z).move(against.getOpposite());
  60 + return block.getMaterial() instanceof Grass || block.getMaterial().getId() == 3; // Grass or Dirt
  61 + } else {
  62 + return false;
  63 + }
  64 + }
  65 +
  66 + @Override
  67 + public Material getDrop() {
  68 + return Material.get(getName());
  69 + }
  70 +}

No commit comments for this range

Something went wrong with that request. Please try again.