package com.progwml6.natura.common.block.base; import com.progwml6.natura.library.NaturaRegistry; import net.minecraft.block.Block; import net.minecraft.block.BlockFence; import net.minecraft.block.BlockFenceGate; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; public class BlockFenceBase extends BlockFence { public BlockFenceBase() { super(Material.WOOD, Material.WOOD.getMaterialMapColor()); this.setHardness(2.0F); this.setResistance(5.0F); this.setSoundType(SoundType.WOOD); this.setCreativeTab(NaturaRegistry.tabDecorative); } @Override public boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPos pos) { return true; } @Override public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); Block block = iblockstate.getBlock(); return block == Blocks.BARRIER ? false : ((!(block instanceof BlockFence) || iblockstate.getMaterial() != this.blockMaterial) && !(block instanceof BlockFenceGate) ? (iblockstate.getMaterial().isOpaque() && iblockstate.isFullCube() ? iblockstate.getMaterial() != Material.GOURD : false) : true); } }