package xyz.ibatv.iba_backblocks.blocks.mc18.fence;

import net.minecraft.world.World;
import xyz.ibatv.iba_backblocks.Register.Register;


import net.minecraft.block.Block;
import net.minecraft.block.BlockFence;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.world.IBlockAccess;

public class BlockFenceSimple extends BlockFence
{
    public BlockFenceSimple(String name)
    {
        super(name, Material.wood);
        this.setStepSound(Block.soundTypeWood);
        this.setHardness(2.0F).setResistance(5.0F);//same as vanilla fence
    }

    @Override
    public boolean canConnectFenceTo(IBlockAccess ib, int x, int y, int z)
    {
        Block block = ib.getBlock(x, y, z);
        //if its NOT a fence or fence gate, do one extra check
        return block == this || block == Blocks.fence || block == Blocks.fence_gate ||
                block == Register.acacia_fence ||
                block == Register.birch_fence ||
                block == Register.jungle_fence ||
                block == Register.spruce_fence ||
                block == Register.big_oak_fence ||
                block == Register.acacia_fence_gate ||
                block == Register.birch_fence_gate ||
                block == Register.jungle_fence_gate ||
                block == Register.spruce_fence_gate ||
                block == Register.big_oak_fence_gate || (block.getMaterial().isOpaque() && block.renderAsNormalBlock() && block.getMaterial() != Material.gourd);//it was for sure a fence or fgate, so we went true right away
    }

    @Override
    public boolean canPlaceTorchOnTop(World world, int x, int y, int z) {
        return true;
    }
}