<commit_before>package net.machinemuse.numina.recipe;

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.oredict.OreDictionary;

/**
 * Author: MachineMuse (<NAME>)
 * Created: 2:48 PM, 11/4/13
 */
public class SimpleItemMatcher implements IItemMatcher {
    public Integer id;
    public Integer meta;
    public String unlocalizedName;
    public String oredictName;
    public NBTTagCompound nbt;

    public SimpleItemMatcher() {
    }

    public SimpleItemMatcher(int id) {
        this.id = id;
    }

    public SimpleItemMatcher(String oredictName) {
        this.oredictName = oredictName;
    }

    public SimpleItemMatcher(int id, int meta) {
        this.id = id;
        this.meta = meta;
    }

    @Override
    public boolean matchesItem(ItemStack stack) {
        if (stack == null) {
            return false;
        }
        if (id != null && id != stack.itemID) {
            return false;
        }
        if (meta != null && meta != stack.getItemDamage()) {
            return false;
        }
        if (unlocalizedName != null && !unlocalizedName.equals(stack.getItem().getUnlocalizedName(stack))) {
            return false;
        }
        if (oredictName != null) {
            boolean found = false;
            for (ItemStack ore : OreDictionary.getOres(oredictName)) {
                if (ore.itemID == stack.itemID && ore.getItemDamage() == stack.getItemDamage()) {
                    found = true;
                }
            }
            if (!found) return false;
        }
        if (nbt != null && !nbt.equals(stack.getTagCompound())) {
            return false;
        }

        return true;
    }

    public SimpleItemMatcher copy() {
        SimpleItemMatcher copy = new SimpleItemMatcher();
        copy.id = this.id;
        copy.meta = this.meta;
        copy.unlocalizedName = this.unlocalizedName;
        copy.oredictName = this.unlocalizedName;
        copy.nbt = this.nbt;
        return copy;
    }
}
<commit_msg>add a nullcheck for gregtech weirdness<commit_after>package net.machinemuse.numina.recipe;

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.oredict.OreDictionary;

/**
 * Author: MachineMuse (<NAME>)
 * Created: 2:48 PM, 11/4/13
 */
public class SimpleItemMatcher implements IItemMatcher {
    public Integer id;
    public Integer meta;
    public String unlocalizedName;
    public String oredictName;
    public NBTTagCompound nbt;

    public SimpleItemMatcher() {
    }

    public SimpleItemMatcher(int id) {
        this.id = id;
    }

    public SimpleItemMatcher(String oredictName) {
        this.oredictName = oredictName;
    }

    public SimpleItemMatcher(int id, int meta) {
        this.id = id;
        this.meta = meta;
    }

    @Override
    public boolean matchesItem(ItemStack stack) {
        if (stack == null) {
            return false;
        }
        if(stack.getItem() == null) {
            return false;
        }
        if (id != null && id != stack.itemID) {
            return false;
        }
        if (meta != null && meta != stack.getItemDamage()) {
            return false;
        }
        if (unlocalizedName != null && !unlocalizedName.equals(stack.getItem().getUnlocalizedName(stack))) {
            return false;
        }
        if (oredictName != null) {
            boolean found = false;
            for (ItemStack ore : OreDictionary.getOres(oredictName)) {
                if (ore.itemID == stack.itemID && ore.getItemDamage() == stack.getItemDamage()) {
                    found = true;
                }
            }
            if (!found) return false;
        }
        if (nbt != null && !nbt.equals(stack.getTagCompound())) {
            return false;
        }

        return true;
    }

    public SimpleItemMatcher copy() {
        SimpleItemMatcher copy = new SimpleItemMatcher();
        copy.id = this.id;
        copy.meta = this.meta;
        copy.unlocalizedName = this.unlocalizedName;
        copy.oredictName = this.unlocalizedName;
        copy.nbt = this.nbt;
        return copy;
    }
}

{'fraction_non_alphanumeric': 0.10579466217840827, 'fraction_numerical': 0.0038470786246693916, 'mean_word_length': 1.9928057553956835, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1689777', 'n_tokens_mistral': 1240, 'n_tokens_neox': 1220, 'n_words': 277}