Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
compare: 3b3a95b442
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
Commits on Apr 15, 2012
aPunch Added some Flower logic
f186f3b
Chris Sanders Merge pull request #126 from aPunch/master
Added Flower logic
3b3a95b
View
5 src/main/java/org/spout/vanilla/material/VanillaMaterials.java
@@ -35,6 +35,7 @@
import org.spout.vanilla.material.block.Cactus;
import org.spout.vanilla.material.block.DoubleSlab;
import org.spout.vanilla.material.block.Fire;
+import org.spout.vanilla.material.block.Flower;
import org.spout.vanilla.material.block.Grass;
import org.spout.vanilla.material.block.Gravel;
import org.spout.vanilla.material.block.Ice;
@@ -121,8 +122,8 @@
public static final Solid PISTON_EXTENSION = (Solid) register(new Solid("Piston (Head)", 34).setResistance(0.8F));
public static final Wool WOOL = Wool.WHITE;
public static final Solid MOVED_BY_PISTON = (Solid) register(new Solid("Moved By Piston", 36).setResistance(0.0F));
- public static final GroundAttachable DANDELION = (GroundAttachable) register(new GroundAttachable("Dandelion", 37).setHardness(0.0F).setResistance(0.0F));
- public static final GroundAttachable ROSE = (GroundAttachable) register(new GroundAttachable("Rose", 38).setHardness(0.0F).setResistance(0.0F));
+ public static final Flower DANDELION = (Flower) register(new Flower("Dandelion", 37).setHardness(0.0F).setResistance(0.0F));
+ public static final Flower ROSE = (Flower) register(new Flower("Rose", 38).setHardness(0.0F).setResistance(0.0F));
public static final GroundAttachable BROWN_MUSHROOM = (GroundAttachable) register(new GroundAttachable("Brown Mushroom", 39).setHardness(0.0F).setResistance(0.0F).setLightLevel(1));
public static final GroundAttachable RED_MUSHROOM = (GroundAttachable) register(new GroundAttachable("Red Mushroom", 40).setHardness(0.0F).setResistance(0.0F));
public static final Solid GOLD_BLOCK = (Solid) register(new Solid("Gold Block", 41).setHardness(3.0F).setResistance(10.0F));
View
70 src/main/java/org/spout/vanilla/material/block/Flower.java
@@ -0,0 +1,70 @@
+/*
+ * This file is part of Vanilla (http://www.spout.org/).
+ *
+ * Vanilla is licensed under the SpoutDev License Version 1.
+ *
+ * Vanilla is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * In addition, 180 days after any changes are published, you can use the
+ * software, incorporating those changes, under the terms of the MIT license,
+ * as described in the SpoutDev License Version 1.
+ *
+ * Vanilla is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License,
+ * the MIT license and the SpoutDev License Version 1 along with this program.
+ * If not, see <http://www.gnu.org/licenses/> for the GNU Lesser General Public
+ * License and see <http://www.spout.org/SpoutDevLicenseV1.txt> for the full license,
+ * including the MIT license.
+ */
+package org.spout.vanilla.material.block;
+
+import org.spout.api.Source;
+import org.spout.api.geo.World;
+import org.spout.api.geo.cuboid.Block;
+import org.spout.api.material.Material;
+import org.spout.api.material.block.BlockFace;
+import org.spout.vanilla.material.Plant;
+import org.spout.vanilla.material.attachable.GroundAttachable;
+
+public class Flower extends GroundAttachable implements Plant {
+ public Flower(String name, int id) {
+ super(name, id);
+ }
+
+ @Override
+ public boolean hasGrowthStages() {
+ return false;
+ }
+
+ @Override
+ public int getNumGrowthStages() {
+ return 0;
+ }
+
+ @Override
+ public int getMinimumLightToGrow() {
+ return 8;
+ }
+
+ @Override
+ public boolean canPlace(World world, int x, int y, int z, short data, BlockFace against, Source source) {
+ if (super.canPlace(world, x, y, z, data, against, source)) {
+ Block block = world.getBlock(x, y, z).move(against.getOpposite());
+ return block.getMaterial() instanceof Grass || block.getMaterial().getId() == 3; // Grass or Dirt
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public Material getDrop() {
+ return Material.get(getName());
+ }
+}

No commit comments for this range

Something went wrong with that request. Please try again.