Class BattleSceneManager

java.lang.Object
com.pixelmonmod.pixelmon.client.render.battle.BattleSceneManager

public final class BattleSceneManager extends Object
Static access point for the active client battle scene.

Rendering mixins use this to swap the render level, while battle UI/rendering code can query markers for placing participants.

  • Method Details

    • setScene

      public static void setScene(BattleSceneClientLevel scene)
      Sets the active client battle scene.
      Parameters:
      scene - the scene level to render in place of the normal world
    • setScene

      public static void setScene(BattleSceneData sceneData)
      Creates and sets the active client battle scene from server-built scene data.
      Parameters:
      sceneData - the scene data sent by the server
    • clearScene

      public static void clearScene()
      Clears the active battle scene and any camera placement state.
    • registerPositioningStrategy

      public static void registerPositioningStrategy(ScenePositioningStrategy strategy)
      Registers a client-side strategy that can place battle entities in an active scene.
      Parameters:
      strategy - the positioning strategy to run during battle scene updates
    • applyPositioning

      public static boolean applyPositioning(ClientBattleManager battleManager)
      Applies all applicable positioning strategies to the active scene.
      Parameters:
      battleManager - the current client battle state
      Returns:
      true when at least one strategy was applied
    • applyCameraMarker

      public static boolean applyCameraMarker(CameraEntity camera)
      Applies the scene's BattleSceneMarker.CAMERA_POS marker as the initial battle camera position.
      Parameters:
      camera - the active battle camera
      Returns:
      true when the camera is already positioned or was successfully positioned
    • isActive

      public static boolean isActive()
      Returns:
      true when a battle scene is currently active
    • getActiveScene

      @Nullable public static @Nullable BattleSceneClientLevel getActiveScene()
      Returns:
      the active battle scene, or null when normal world rendering is active
    • getRenderLevel

      @Nullable public static @Nullable net.minecraft.client.multiplayer.ClientLevel getRenderLevel(@Nullable @Nullable net.minecraft.client.multiplayer.ClientLevel fallbackLevel)
      Returns the level that should be used by render hooks.
      Parameters:
      fallbackLevel - the normal client level to use when no scene is active
      Returns:
      the active battle scene level, or fallbackLevel
    • isSceneLevel

      public static boolean isSceneLevel(net.minecraft.world.level.BlockAndTintGetter level)
      Checks whether a render context is using the active battle scene level.
      Parameters:
      level - the render level or tint getter to check
      Returns:
      true when the supplied level is the active battle scene
    • markers

      public static List<BattleSceneMarker> markers(String type)
      Finds markers of a type in the active scene.
      Parameters:
      type - the marker type to match
      Returns:
      matching markers, or an empty list when no scene is active
    • marker

      public static Optional<BattleSceneMarker> marker(String type)
      Finds the first marker of a type in the active scene.
      Parameters:
      type - the marker type to match
      Returns:
      the first matching marker, or empty when no scene is active
    • marker

      public static Optional<BattleSceneMarker> marker(String type, String id)
      Finds the first marker matching both type and id in the active scene.
      Parameters:
      type - the marker type to match
      id - the marker id to match
      Returns:
      the first matching marker, or empty when no scene is active