Browse Source

Added a getState() method that will optionally fail on state misses.

Ali-RS 6 years ago
parent
commit
c0823bb903
1 changed files with 5 additions and 1 deletions
  1. 5 1
      jme3-core/src/main/java/com/jme3/app/state/BaseAppState.java

+ 5 - 1
jme3-core/src/main/java/com/jme3/app/state/BaseAppState.java

@@ -142,7 +142,11 @@ public abstract class BaseAppState implements AppState {
     }
 
     public final <T extends AppState> T getState( Class<T> type ) {
-        return getStateManager().getState(type);
+        return getState( type, false );
+    }
+    
+    public final <T extends AppState> T getState( Class<T> type, boolean failOnMiss ) {
+        return getStateManager().getState( type, failOnMiss );
     }
 
     @Override