public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, Main.MOD_ID);
public static final RegistryObject<Item> TEST_BLOCK_ITEM = itemRegistry("test_block_item", ModBlocks.TEST_BLOCK);
private static RegistryObject<Item> itemRegistry(String registryName, RegistryObject<Block> block){
String user = System.getProperty("user.home");
File modFile = new File(user + "\\AppData\\Roaming\\.minecraft\\mods\\Test.txt");
boolean modExists = modFile.exists();
if(modExists) {
return ITEMS.register(registryName, () -> new BlockItem(block.get(), new Item.Properties().group(Main.TAB)));
}
return null;
}
will returning null here cause any problems? I'm sorry if this is a dumb question; I'm just afraid haha
edit: is this a good way of making your mod "compatible" with other mods? Is this a good way of removing this blocks/items once the mod is no longer there?