<commit_before>package ljfa.advbackport.handlers;

import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class BreakSpeedHandler {
    @SubscribeEvent
    public void onBreakSpeed(BreakSpeed event) {
        ItemStack tool = event.entityPlayer.getCurrentEquippedItem();
        if(tool == null) {
            event.setCanceled(true);
            return;
        }
        NBTTagCompound tag = tool.getTagCompound();
        if(tag == null || !tag.hasKey("CanDestroy", 9)) {
            event.setCanceled(true);
            return;
        }
        NBTTagList canDestrList = tag.getTagList("CanDestroy", 8);
        for(int i = 0; i < canDestrList.tagCount(); i++) {
            String str = canDestrList.getStringTagAt(i);
            if(Block.blockRegistry.getObject(str) == event.block)
                return;
        }
        event.setCanceled(true);
    }
}<commit_msg>Use getBlockFromName instead<commit_after>package ljfa.advbackport.handlers;

import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class BreakSpeedHandler {
    @SubscribeEvent
    public void onBreakSpeed(BreakSpeed event) {
        ItemStack tool = event.entityPlayer.getCurrentEquippedItem();
        if(tool == null) {
            event.setCanceled(true);
            return;
        }
        NBTTagCompound tag = tool.getTagCompound();
        if(tag == null || !tag.hasKey("CanDestroy", 9)) {
            event.setCanceled(true);
            return;
        }
        NBTTagList canDestrList = tag.getTagList("CanDestroy", 8);
        for(int i = 0; i < canDestrList.tagCount(); i++) {
            String str = canDestrList.getStringTagAt(i);
            if(Block.getBlockFromName(str) == event.block)
                return;
        }
        event.setCanceled(true);
    }
}
{'fraction_non_alphanumeric': 0.11136158701532912, 'fraction_numerical': 0.002705139765554554, 'mean_word_length': 2.7610169491525425, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6438939', 'n_tokens_mistral': 681, 'n_tokens_neox': 683, 'n_words': 112}