package xyz.brassgoggledcoders.steamagerevolution.modules.mechanical.blocks;

import javax.annotation.Nullable;

import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import xyz.brassgoggledcoders.boilerplate.blocks.BlockTEBase;
import xyz.brassgoggledcoders.boilerplate.utils.ItemStackUtils;
import xyz.brassgoggledcoders.steamagerevolution.modules.mechanical.tileentities.TileEntityBeltEnd;

public class BlockBeltEnd extends BlockTEBase {
	public BlockBeltEnd(Material mat, String name) {
		super(mat, name);
	}

	@Override
	public Class<? extends TileEntity> getTileEntityClass() {
		return TileEntityBeltEnd.class;
	}

	@Override
	public TileEntity createNewTileEntity(World worldIn, int meta) {
		return new TileEntityBeltEnd();
	}

	// TODO Handling for unpairing when blocks are broken

	@Override
	public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
			EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
		if(ItemStackUtils.doItemsMatch(heldItem, Items.STICK))
			if(worldIn.getTileEntity(pos) instanceof TileEntityBeltEnd) {
				TileEntityBeltEnd belt = (TileEntityBeltEnd) worldIn.getTileEntity(pos);
				if(belt.isTilePaired()) {
					belt.unpair();
					return true;
				}
			}
		return false;
	}
}
@@ -251,41 +251,8 @@
 er;%0A
-import net.minecraft.init.Items;%0A
 impo
@@ -523,26 +523,26 @@
 ate.
-blocks.BlockTEBase
+api.BoilerplateAPI
 ;%0Aim
@@ -585,28 +585,26 @@
 ate.
-utils.ItemStackUtils
+blocks.BlockTEBase
 ;%0Aim
@@ -1330,57 +1330,90 @@
 %09if(
-ItemStackUtils.doItemsMatch(heldItem, Items.STICK
+heldItem != null && heldItem.hasCapability(BoilerplateAPI.SPANNER_CAPABILITY, side
 ))%0A%09

Check for cap in belt unlinking