2012-09-21 02:53:43 +00:00
|
|
|
--- ../src_base/common/net/minecraft/src/BlockFlower.java
|
|
|
|
+++ ../src_work/common/net/minecraft/src/BlockFlower.java
|
|
|
|
@@ -2,7 +2,12 @@
|
|
|
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
-public class BlockFlower extends Block
|
|
|
|
+import net.minecraftforge.common.EnumPlantType;
|
|
|
|
+import net.minecraftforge.common.ForgeDirection;
|
|
|
|
+import net.minecraftforge.common.IPlantable;
|
|
|
|
+import static net.minecraftforge.common.EnumPlantType.*;
|
|
|
|
+
|
|
|
|
+public class BlockFlower extends Block implements IPlantable
|
|
|
|
{
|
|
|
|
protected BlockFlower(int par1, int par2, Material par3Material)
|
|
|
|
{
|
|
|
|
@@ -24,7 +29,7 @@
|
|
|
|
*/
|
|
|
|
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
|
|
|
|
{
|
|
|
|
- return super.canPlaceBlockAt(par1World, par2, par3, par4) && this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4));
|
2012-09-21 12:35:46 +00:00
|
|
|
+ return super.canPlaceBlockAt(par1World, par2, par3, par4) && canBlockStay(par1World, par2, par3, par4);
|
2012-09-21 02:53:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -68,7 +73,9 @@
|
|
|
|
*/
|
|
|
|
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
|
|
|
|
{
|
|
|
|
- return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) && this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4));
|
|
|
|
+ Block soil = blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
|
|
|
|
+ return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) &&
|
|
|
|
+ (soil != null && soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -104,4 +111,32 @@
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public EnumPlantType getPlantType(World world, int x, int y, int z)
|
|
|
|
+ {
|
|
|
|
+ if (blockID == crops.blockID ) return Crop;
|
|
|
|
+ if (blockID == deadBush.blockID ) return Desert;
|
|
|
|
+ if (blockID == waterlily.blockID ) return Water;
|
|
|
|
+ if (blockID == mushroomRed.blockID ) return Cave;
|
|
|
|
+ if (blockID == mushroomBrown.blockID) return Cave;
|
|
|
|
+ if (blockID == netherStalk.blockID ) return Nether;
|
|
|
|
+ if (blockID == sapling.blockID ) return Plains;
|
|
|
|
+ if (blockID == melonStem.blockID ) return Crop;
|
|
|
|
+ if (blockID == pumpkinStem.blockID ) return Crop;
|
|
|
|
+ if (blockID == tallGrass.blockID ) return Plains;
|
|
|
|
+ return Plains;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int getPlantID(World world, int x, int y, int z)
|
|
|
|
+ {
|
|
|
|
+ return blockID;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int getPlantMetadata(World world, int x, int y, int z)
|
|
|
|
+ {
|
|
|
|
+ return world.getBlockMetadata(x, y, z);
|
|
|
|
+ }
|
|
|
|
}
|