Class BattleSceneManager
java.lang.Object
com.pixelmonmod.pixelmon.client.render.battle.BattleSceneManager
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 Summary
Modifier and TypeMethodDescriptionstatic booleanapplyCameraMarker(CameraEntity camera) Applies the scene'sBattleSceneMarker.CAMERA_POSmarker as the initial battle camera position.static booleanapplyPositioning(ClientBattleManager battleManager) Applies all applicable positioning strategies to the active scene.static voidClears the active battle scene and any camera placement state.static @Nullable BattleSceneClientLevelstatic @Nullable net.minecraft.client.multiplayer.ClientLevelgetRenderLevel(@Nullable net.minecraft.client.multiplayer.ClientLevel fallbackLevel) Returns the level that should be used by render hooks.static booleanisActive()static booleanisSceneLevel(net.minecraft.world.level.BlockAndTintGetter level) Checks whether a render context is using the active battle scene level.static Optional<BattleSceneMarker> Finds the first marker of a type in the active scene.static Optional<BattleSceneMarker> Finds the first marker matching both type and id in the active scene.static List<BattleSceneMarker> Finds markers of a type in the active scene.static voidRegisters a client-side strategy that can place battle entities in an active scene.static voidsetScene(BattleSceneData sceneData) Creates and sets the active client battle scene from server-built scene data.static voidsetScene(BattleSceneClientLevel scene) Sets the active client battle scene.
-
Method Details
-
setScene
Sets the active client battle scene.- Parameters:
scene- the scene level to render in place of the normal world
-
setScene
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
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
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
Applies the scene'sBattleSceneMarker.CAMERA_POSmarker 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
- Returns:
- the active battle scene, or
nullwhen 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
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
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
Finds the first marker matching both type and id in the active scene.- Parameters:
type- the marker type to matchid- the marker id to match- Returns:
- the first matching marker, or empty when no scene is active
-