/******************************************************************************* * AbyssalCraft * Copyright (c) 2012 - 2017 Shinoow. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt * * Contributors: * Shinoow - implementation ******************************************************************************/ package com.shinoow.abyssalcraft.common.blocks; import net.minecraft.block.SoundType; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.IPlantable; public class BlockDreadlandsDirt extends BlockACBasic { public BlockDreadlandsDirt() { super(Material.GROUND, 0.4F, 2.0F, SoundType.GROUND, MapColor.TNT); setUnlocalizedName("dreadlandsdirt"); setHarvestLevel("shovel", 0); } @Override public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) { boolean hasWater = world.getBlockState(pos.east()).getMaterial() == Material.WATER || world.getBlockState(pos.west()).getMaterial() == Material.WATER || world.getBlockState(pos.north()).getMaterial() == Material.WATER || world.getBlockState(pos.south()).getMaterial() == Material.WATER; return plantable.getPlantType(world, pos.offset(direction)) == EnumPlantType.Plains || plantable.getPlantType(world, pos.offset(direction)) == EnumPlantType.Beach && hasWater; } }