package com.elytradev.teckle.common.block;

import com.elytradev.teckle.common.TeckleMod;
import com.elytradev.teckle.common.handlers.TeckleGuiHandler;
import com.elytradev.teckle.common.tile.TileFabricator;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import javax.annotation.Nullable;

/**
 * Created by darkevilmac on 5/10/17.
 */
public class BlockFabricator extends BlockContainer {
    public BlockFabricator(Material materialIn) {
        super(materialIn);

        this.setHarvestLevel("pickaxe", 0);
    }

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

    @Override
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
        if (!playerIn.isSneaking()) {
            TileEntity tileentity = worldIn.getTileEntity(pos);
            if (tileentity != null) {
                playerIn.openGui(TeckleMod.INSTANCE, TeckleGuiHandler.ElementType.ELEMENT_PROVIDER.caseNumber, worldIn, pos.getX(), pos.getY(), pos.getZ());
                return true;
            }
        }

        return false;
    }

    @Override
    public EnumBlockRenderType getRenderType(IBlockState state) {
        return EnumBlockRenderType.MODEL;
    }

    @Override
    @SideOnly(Side.CLIENT)
    public BlockRenderLayer getBlockLayer() {
        return BlockRenderLayer.SOLID;
    }
}

@@ -201,16 +201,72 @@
 icator;%0A
+import com.elytradev.teckle.common.tile.inv.ItemStream;%0A
 import n
@@ -437,24 +437,72 @@
 tityPlayer;%0A
+import net.minecraft.inventory.InventoryHelper;%0A
 import net.m
@@ -1842,32 +1842,807 @@
 n false;%0A    %7D%0A%0A
+    @Override%0A    public void breakBlock(World worldIn, BlockPos pos, IBlockState state) %7B%0A        TileEntity tileAtPos = worldIn.getTileEntity(pos);%0A        if (tileAtPos != null) %7B%0A            TileFabricator fabricator = (TileFabricator) tileAtPos;%0A            ItemStream.createItemStream(fabricator.craftingGrid).filter(stack -%3E !stack.isEmpty()).forEach(stack -%3E InventoryHelper.spawnItemStack(worldIn, pos.getX(), pos.getY(), pos.getZ(), stack));%0A            fabricator.stackHandler.stream().filter(stack -%3E !stack.isEmpty()).forEach(stack -%3E InventoryHelper.spawnItemStack(worldIn, pos.getX(), pos.getY(), pos.getZ(), stack));%0A        %7D%0A%0A        // Call super after we're done so we still have access to the tile.%0A        super.breakBlock(worldIn, pos, state);%0A    %7D%0A%0A%0A
     @Override%0A  

Make fabricator spit items on break.