File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed 
Common/src/main/java/net/darkhax/bookshelf/api/util 
Fabric/src/main/java/net/darkhax/bookshelf/impl/util 
Forge/src/main/java/net/darkhax/bookshelf/impl/util Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -104,4 +104,11 @@ default MutableComponent getModNameComponent(String modId) {
104104        final  String  modName  = getModName (modId );
105105        return  modName  != null  ? new  TextComponent (modName ) : null ;
106106    }
107+ 
108+     /** 
109+      * Checks if the mod is currently running in an environment with game tests enabled. 
110+      * 
111+      * @return Are game tests currently enabled? 
112+      */ 
113+     boolean  isTestingEnvironment ();
107114}
Original file line number Diff line number Diff line change 33import  net .darkhax .bookshelf .api .PhysicalSide ;
44import  net .darkhax .bookshelf .api .util .IPlatformHelper ;
55import  net .fabricmc .api .EnvType ;
6+ import  net .fabricmc .fabric .impl .gametest .FabricGameTestHelper ;
67import  net .fabricmc .loader .api .FabricLoader ;
78import  org .jetbrains .annotations .Nullable ;
89
@@ -46,4 +47,10 @@ public String getModName(String modId) {
4647
4748        return  FabricLoader .getInstance ().getModContainer (modId ).map (mod  -> mod .getMetadata ().getName ()).orElse (modId );
4849    }
50+ 
51+     @ Override 
52+     public  boolean  isTestingEnvironment () {
53+ 
54+         return  FabricGameTestHelper .ENABLED ;
55+     }
4956}
Original file line number Diff line number Diff line change 66import  net .minecraftforge .fml .loading .FMLEnvironment ;
77import  net .minecraftforge .fml .loading .FMLLoader ;
88import  net .minecraftforge .fml .loading .FMLPaths ;
9+ import  net .minecraftforge .gametest .ForgeGameTestHooks ;
910import  org .jetbrains .annotations .Nullable ;
1011
1112import  java .nio .file .Path ;
@@ -48,4 +49,10 @@ public String getModName(String modId) {
4849
4950        return  ModList .get ().getModContainerById (modId ).map (mod  -> mod .getModInfo ().getDisplayName ()).orElse (modId );
5051    }
52+ 
53+     @ Override 
54+     public  boolean  isTestingEnvironment () {
55+ 
56+         return  ForgeGameTestHooks .isGametestEnabled ();
57+     }
5158}
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments