<commit_before>package net.darkhax.bookshelf.lib.util;

import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraftforge.fluids.IFluidBlock;

public class BlockUtils {
    
    /**
     * Checks if a block is a fluid or not.
     *
     * @param block: An instance of the block being checked.
     * @return boolean: If the block is a fluid, true will be returned. If not, false will be
     *         returned.
     */
    public static boolean isFluid (Block block) {
        
        return block == Blocks.LAVA || block == Blocks.WATER || block instanceof IFluidBlock;
    }
}<commit_msg>Added a way to check for whether or not an ItemStack is an ore. <commit_after>package net.darkhax.bookshelf.lib.util;

import net.minecraft.block.Block;
import net.minecraft.block.BlockOre;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.oredict.OreDictionary;

public class BlockUtils {
    
    /**
     * Checks if an ItemStack contains an ore item. This is done by checking the item extends
     * BlockOre, or if the ore dictionary for entries that start with 'ore'. It will also check
     * the display name of the stack to see if it has the word Ore in it.
     * 
     * @param stack The ItemStack to check.
     * @return Whether or not the ItemStack is an ore.
     */
    public static boolean isOre (ItemStack stack) {
        
        if (stack == null || stack.getItem() == null)
            return false;
            
        if (Block.getBlockFromItem(stack.getItem()) instanceof BlockOre)
            return true;
            
        for (final int oreID : OreDictionary.getOreIDs(stack))
            if (OreDictionary.getOreName(oreID).startsWith("ore"))
                return true;
                
        if (stack.getDisplayName().matches(".*(^|\\s)([oO]re)($|\\s)."))
            return true;
            
        return false;
    }
    
    /**
     * Checks if a block is a fluid or not.
     *
     * @param block An instance of the block being checked.
     * @return If the block is a fluid, true will be returned. If not, false will be returned.
     */
    public static boolean isFluid (Block block) {
        
        return block == Blocks.LAVA || block == Blocks.WATER || block instanceof IFluidBlock;
    }
}
{'fraction_non_alphanumeric': 0.09225560727888278, 'fraction_numerical': 0.0, 'mean_word_length': 2.3295774647887324, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '530319', 'n_tokens_mistral': 683, 'n_tokens_neox': 684, 'n_words': 238}