<commit_before>package net.silentchaos512.gems.compat.jei;

import java.util.Map;
import java.util.Map.Entry;

import mezz.jei.api.IGuiHelper;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.IJeiRuntime;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter;
import mezz.jei.api.JEIPlugin;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import net.silentchaos512.gems.api.lib.EnumMaterialGrade;
import net.silentchaos512.gems.block.ModBlocks;
import net.silentchaos512.gems.item.ItemChaosStorage;
import net.silentchaos512.gems.item.ItemReturnHome;
import net.silentchaos512.gems.item.ModItems;
import net.silentchaos512.gems.lib.Names;

@JEIPlugin
public class SilentGemsPlugin implements IModPlugin {

  public static IJeiHelpers jeiHelper;

  @Override
  public void onRuntimeAvailable(IJeiRuntime runtime) {

  }

  @Override
  public void register(IModRegistry reg) {

    jeiHelper = reg.getJeiHelpers();
    IGuiHelper guiHelper = jeiHelper.getGuiHelper();

    // Hide blocks/items
    int any = OreDictionary.WILDCARD_VALUE;
    jeiHelper.getItemBlacklist()
        .addItemToBlacklist(new ItemStack(ModBlocks.gemLampInverted, 1, any));
    jeiHelper.getItemBlacklist()
        .addItemToBlacklist(new ItemStack(ModBlocks.gemLampInvertedDark, 1, any));
    jeiHelper.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.gemLampLit, 1, any));
    jeiHelper.getItemBlacklist()
        .addItemToBlacklist(new ItemStack(ModBlocks.gemLampLitDark, 1, any));
    // jeiHelper.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.chaosNode));
    jeiHelper.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.fluffyPuffPlant));
    jeiHelper.getItemBlacklist().addItemToBlacklist(new ItemStack(ModItems.toolRenderHelper));

    // NBT subtypes (doesn't work?)
    jeiHelper.getSubtypeRegistry().registerNbtInterpreter(ModItems.enchantmentToken,
        new ISubtypeInterpreter() {

          @Override
          public String getSubtypeInfo(ItemStack stack) {

            String result = "";
            Map<Enchantment, Integer> map = EnchantmentHelper.getEnchantments(stack);
            for (Entry<Enchantment, Integer> entry : map.entrySet())
              result += entry.getKey().getName() + "," + entry.getValue() + ";";
            return result;
          }
        });
    jeiHelper.getSubtypeRegistry().useNbtForSubtypes(ModItems.enchantmentToken);

    // NBT ignores (deprecated)
    jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(EnumMaterialGrade.NBT_KEY);
    jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(ItemChaosStorage.NBT_CHARGE);<commit_msg>Fixed a JEI error in log (closes #53)<commit_after>package net.silentchaos512.gems.compat.jei;

import java.util.Map;
import java.util.Map.Entry;

import mezz.jei.api.IGuiHelper;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.IJeiRuntime;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter;
import mezz.jei.api.JEIPlugin;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import net.silentchaos512.gems.api.lib.EnumMaterialGrade;
import net.silentchaos512.gems.block.ModBlocks;
import net.silentchaos512.gems.item.ItemChaosStorage;
import net.silentchaos512.gems.item.ItemReturnHome;
import net.silentchaos512.gems.item.ModItems;
import net.silentchaos512.gems.lib.Names;

@JEIPlugin
public class SilentGemsPlugin implements IModPlugin {

  public static IJeiHelpers jeiHelper;

  @Override
  public void onRuntimeAvailable(IJeiRuntime runtime) {

  }

  @Override
  public void register(IModRegistry reg) {

    jeiHelper = reg.getJeiHelpers();
    IGuiHelper guiHelper = jeiHelper.getGuiHelper();

    // Hide blocks/items
    int any = OreDictionary.WILDCARD_VALUE;
    jeiHelper.getItemBlacklist()
        .addItemToBlacklist(new ItemStack(ModBlocks.gemLampInverted, 1, any));
    jeiHelper.getItemBlacklist()
        .addItemToBlacklist(new ItemStack(ModBlocks.gemLampInvertedDark, 1, any));
    jeiHelper.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.gemLampLit, 1, any));
    jeiHelper.getItemBlacklist()
        .addItemToBlacklist(new ItemStack(ModBlocks.gemLampLitDark, 1, any));
    // jeiHelper.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.chaosNode));
    jeiHelper.getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.fluffyPuffPlant));
    jeiHelper.getItemBlacklist().addItemToBlacklist(new ItemStack(ModItems.toolRenderHelper));

    // NBT subtypes (doesn't work?)
    jeiHelper.getSubtypeRegistry().useNbtForSubtypes(ModItems.enchantmentToken);

    // NBT ignores (deprecated)
    jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(EnumMaterialGrade.NBT_KEY);
    jeiHelper.getNbtIgnoreList().ignoreNbtTagNames(ItemChaosStorage.NBT_CHARGE);
{'fraction_non_alphanumeric': 0.1035965598123534, 'fraction_numerical': 0.010164190774042221, 'mean_word_length': 5.091666666666667, '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': '6986625', 'n_tokens_mistral': 1768, 'n_tokens_neox': 1707, 'n_words': 240}