/common/buildcraft/lib/misc/RegistryUtil.java

https://github.com/2xsaiko/BuildCraft · Java · 22 lines · 12 code · 5 blank · 5 comment · 0 complexity · 18b3f6b82167febe513cb91a47d757de MD5 · raw file

  1. /*
  2. * Copyright (c) 2017 SpaceToad and the BuildCraft team
  3. * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
  4. * distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/
  5. */
  6. package buildcraft.lib.misc;
  7. import net.minecraft.block.Block;
  8. import net.minecraft.item.Item;
  9. import net.minecraftforge.fml.common.registry.ForgeRegistries;
  10. public class RegistryUtil {
  11. public static boolean isRegistered(Block block) {
  12. return ForgeRegistries.BLOCKS.containsValue(block);
  13. }
  14. public static boolean isRegistered(Item item) {
  15. return ForgeRegistries.ITEMS.containsValue(item);
  16. }
  17. }