// Path: src/main/java/org/cyclops/integratedtunnels/api/world/IBlockBreakHandler.java
// public interface IBlockBreakHandler {
// 
//     /**
//      * If this can handle the given block state.
//      * @param blockState The block state.
//      * @param world The world.
//      * @param pos The block position.
//      * @param player The breaking player.
//      * @return If this can handle the given block state.
//      */
//     public boolean shouldApply(BlockState blockState, World world, BlockPos pos, PlayerEntity player);
// 
//     /**
//      * Get the dropping items of the given block.
//      * @param blockState The block state.
//      * @param world The world.
//      * @param pos The block position.
//      * @param player The breaking player.
//      * @return A list of itemstacks where each element must be removable.
//      */
//     public NonNullList<ItemStack> getDrops(BlockState blockState, World world, BlockPos pos, PlayerEntity player);
// 
//     /**
//      * Break the given block.
//      * @param blockState The block state.
//      * @param world The world.
//      * @param pos The block position.
//      * @param player The breaking player.
//      */
//     public void breakBlock(BlockState blockState, World world, BlockPos pos, PlayerEntity player);
// 
// }
// 
// Path: src/main/java/org/cyclops/integratedtunnels/api/world/IBlockBreakHandlerRegistry.java
// public interface IBlockBreakHandlerRegistry extends IRegistry {
// 
//     /**
//      * Add a block breaking handler.
//      * Multiple handlers can exist for a block.
//      * @param block A block.
//      * @param breakAction A handler.
//      * @return The registered handler.
//      */
//     public IBlockBreakHandler register(Block block, IBlockBreakHandler breakAction);
// 
//     /**
//      * @return All registered block breaking handlers.
//      */
//     public Collection<IBlockBreakHandler> getHandlers();
// 
//     /**
//      * @param block A block.
//      * @return All registered block breaking handlers for the given block.
//      */
//     public Collection<IBlockBreakHandler> getHandlers(Block block);
// 
//     /**
//      * Get the first possible block breaking handler for the given block state.
//      * @param blockState The block state.
//      * @param world The world.
//      * @param pos The block position.
//      * @param player The breaking player.
//      * @return A block breaking handler or null.
//      */
//     @Nullable
//     public IBlockBreakHandler getHandler(BlockState blockState, World world, BlockPos pos, PlayerEntity player);
// 
// }


import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
import com.google.common.collect.Sets;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.cyclops.integratedtunnels.api.world.IBlockBreakHandler;
import org.cyclops.integratedtunnels.api.world.IBlockBreakHandlerRegistry;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
package org.cyclops.integratedtunnels.core.world;



/**
 * Implementation of {@link IBlockBreakHandlerRegistry}.
 * @author rubensworks
 */
public class BlockBreakHandlerRegistry implements IBlockBreakHandlerRegistry {

    private static BlockBreakHandlerRegistry INSTANCE = new BlockBreakHandlerRegistry();

// Path: src/main/java/org/cyclops/integratedtunnels/api/world/IBlockBreakHandler.java
// public interface IBlockBreakHandler {
// 
//     /**
//      * If this can handle the given block state.
//      * @param blockState The block state.
//      * @param world The world.
//      * @param pos The block position.
//      * @param player The breaking player.
//      * @return If this can handle the given block state.
//      */
//     public boolean shouldApply(BlockState blockState, World world, BlockPos pos, PlayerEntity player);
// 
//     /**
//      * Get the dropping items of the given block.
//      * @param blockState The block state.
//      * @param world The world.
//      * @param pos The block position.
//      * @param player The breaking player.
//      * @return A list of itemstacks where each element must be removable.
//      */
//     public NonNullList<ItemStack> getDrops(BlockState blockState, World world, BlockPos pos, PlayerEntity player);
// 
//     /**
//      * Break the given block.
//      * @param blockState The block state.
//      * @param world The world.
//      * @param pos The block position.
//      * @param player The breaking player.
//      */
//     public void breakBlock(BlockState blockState, World world, BlockPos pos, PlayerEntity player);
// 
// }
// 
// Path: src/main/java/org/cyclops/integratedtunnels/api/world/IBlockBreakHandlerRegistry.java
// public interface IBlockBreakHandlerRegistry extends IRegistry {
// 
//     /**
//      * Add a block breaking handler.
//      * Multiple handlers can exist for a block.
//      * @param block A block.
//      * @param breakAction A handler.
//      * @return The registered handler.
//      */
//     public IBlockBreakHandler register(Block block, IBlockBreakHandler breakAction);
// 
//     /**
//      * @return All registered block breaking handlers.
//      */
//     public Collection<IBlockBreakHandler> getHandlers();
// 
//     /**
//      * @param block A block.
//      * @return All registered block breaking handlers for the given block.
//      */
//     public Collection<IBlockBreakHandler> getHandlers(Block block);
// 
//     /**
//      * Get the first possible block breaking handler for the given block state.
//      * @param blockState The block state.
//      * @param world The world.
//      * @param pos The block position.
//      * @param player The breaking player.
//      * @return A block breaking handler or null.
//      */
//     @Nullable
//     public IBlockBreakHandler getHandler(BlockState blockState, World world, BlockPos pos, PlayerEntity player);
// 
// }


// Path: src/main/java/org/cyclops/integratedtunnels/core/world/BlockBreakHandlerRegistry.java
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
import com.google.common.collect.Sets;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.cyclops.integratedtunnels.api.world.IBlockBreakHandler;
import org.cyclops.integratedtunnels.api.world.IBlockBreakHandlerRegistry;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;

package org.cyclops.integratedtunnels.core.world;



/**
 * Implementation of {@link IBlockBreakHandlerRegistry}.
 * @author rubensworks
 */
public class BlockBreakHandlerRegistry implements IBlockBreakHandlerRegistry {

    private static BlockBreakHandlerRegistry INSTANCE = new BlockBreakHandlerRegistry();

    private final Multimap<Block, IBlockBreakHandler> handlers = Multimaps.newSetMultimap(Maps.<Block, Collection<IBlockBreakHandler>>newIdentityHashMap(), Sets::newIdentityHashSet);