Package ke.ric.renderer.api
Interface RendererClient
- All Superinterfaces:
AutoCloseable
A consuming plugin's lifecycle and ownership boundary for captures, scenes, assets, and tasks.
Clients become stale when closed or when their provider generation is disabled or reloaded.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanactive()Returns a current lifecycle snapshot; individual operations always recheck validity.default SceneappendEntities(Scene source, List<SceneEntity> entities) Appends copied, complete resolved entity evidence without changing the source or recapturing world state.Returns a snapshot of this provider generation's advertised capabilities.capture(CaptureRequest request) Captures loaded Paper world state asynchronously, batching thread-affine reads on the main server thread.default CompletionStage<Scene> capture(CaptureRequest request, double fovDegrees) Captures loaded world evidence with a vertical field of view in degrees.default CompletionStage<Scene> capture(CaptureRequest request, double fovDegrees, double rollDegrees, Consumer<FrameProgress> progress) Captures loaded evidence with FOV and roll in degrees.voidclose()Idempotently cancels or releases client-owned work and registrations.default RenderedMapcreateTemporaryMap(org.bukkit.World world, byte[] palette) Creates a guarded temporary map on the server thread.default ScenederiveScene(Scene source, SceneSelection selection) Derives an immutable selection from existing scene evidence, without recapturing live state.default ScenederiveScene(Scene source, SceneTransform transform) Derives immutable scene evidence after validating client and provider ownership.default LightingCapabilitiesReturns explicit-lighting and primary-camera visibility limits for this provider generation.Starts a manual scene builder; callers must supply all required world/visual evidence instead of relying on live lookup.default ScenereframeScene(Scene source, SceneCamera camera, SceneReusePolicy policy) Renders a new camera pose against unchanged captured world evidence.registerAsset(AssetPack pack) Registers copied archive evidence and returns a client-owned handle; invalid/bounded archives fail synchronously.default CompositionLeasereserveComposition(long bytes) Reserves composition bytes from the provider-generation shared pool until close or shutdown.default CompletionStage<org.bukkit.inventory.ItemStack> saveMap(org.bukkit.World world, byte[] palette) Saves a copied 128×128 map palette and creates an item only after durable photo storage.Validates and attempts bounded queue/memory admission, returning immediately on success.default Set<SceneOperation> Returns the optional scene operations implemented by this provider.
-
Method Details
-
active
boolean active()Returns a current lifecycle snapshot; individual operations always recheck validity. -
capabilities
RendererCapabilities capabilities()Returns a snapshot of this provider generation's advertised capabilities. -
lightingCapabilities
Returns explicit-lighting and primary-camera visibility limits for this provider generation. Older providers safely report unsupported capabilities. Check these before requesting creative controls; unsupported controls fail explicitly rather than being ignored.- Returns:
- immutable provider lighting capabilities
-
newSceneBuilder
SceneBuilder newSceneBuilder()Starts a manual scene builder; callers must supply all required world/visual evidence instead of relying on live lookup. -
capture
Captures loaded Paper world state asynchronously, batching thread-affine reads on the main server thread. The completion continuation has no general thread guarantee. Required chunks must already be loaded; missing evidence fails rather than loading chunks.- Parameters:
request- copied camera, finite radius in blocks, dimensions and per-tick chunk budget- Returns:
- stage yielding an immutable client-owned scene or a typed failure; never block the server thread waiting
-
capture
Captures loaded world evidence with a vertical field of view in degrees. Required chunks must already be loaded. Older providers retain their 70° default and reject other values explicitly. Completion continuations have no general server-thread guarantee.- Parameters:
request- copied camera, capture radius, settings and per-tick budgetfovDegrees- finite vertical FOV strictly between 0 and 180- Returns:
- asynchronous immutable client-owned capture
- Throws:
IllegalArgumentException- if FOV is invalidRendererException- if the provider does not support the requested FOV
-
capture
default CompletionStage<Scene> capture(CaptureRequest request, double fovDegrees, double rollDegrees, Consumer<FrameProgress> progress) Captures loaded evidence with FOV and roll in degrees. Optional progress may arrive on any thread; fluent builders provide server-thread/coalesced observers. Older providers reject nonzero roll explicitly and may omit capture progress.- Parameters:
request- copied camera, capture radius, settings and per-tick budgetfovDegrees- finite vertical FOV strictly between 0 and 180rollDegrees- any finite camera roll; zero preserves the ordinary orientationprogress- optional capture-stage observer, or null- Returns:
- asynchronous immutable client-owned capture
- Throws:
IllegalArgumentException- if a requested angle is invalidRendererException- if the provider cannot support the requested controls
-
saveMap
default CompletionStage<org.bukkit.inventory.ItemStack> saveMap(org.bukkit.World world, byte[] palette) Saves a copied 128×128 map palette and creates an item only after durable photo storage. Invoke on the server thread; conversion to palette bytes is the caller's responsibility. The provider restores saved photos independently of the consuming plugin. Older providers explicitly reject this optional operation.- Parameters:
world- loaded world in which the map is allocatedpalette- exactly 16384 row-major Minecraft map-palette bytes; copied before retention- Returns:
- asynchronous saved photo item, or exceptional completion if allocation/persistence fails
-
createTemporaryMap
Creates a guarded temporary map on the server thread. The caller owns cleanup; this map is not stored as a durable photograph. Older providers reject this optional operation.- Parameters:
world- loaded allocation worldpalette- exactly 16384 row-major map-palette bytes- Returns:
- temporary map helper; close it when no longer needed
- Throws:
RendererException- if temporary allocation is unsupported or unsafe
-
deriveScene
Derives an immutable selection from existing scene evidence, without recapturing live state. The source remains unchanged; removed evidence cannot be restored by a later derivation. Providers predating this optional operation reject it withUNSUPPORTED_CAPABILITY. This preview operation is supported only when validated with a matching development provider.- Parameters:
source- scene owned by this active client/provider generationselection- block/entity evidence to retain; camera, object IDs and generation identity stay unchanged- Returns:
- immutable derivative; the source is not modified and no live Bukkit entity is read
-
deriveScene
Derives immutable scene evidence after validating client and provider ownership. Older providers reject even identity transforms with UNSUPPORTED_CAPABILITY.- Parameters:
source- scene owned by this active clienttransform- immutable content/environment/appearance and optional lighting/visibility controls- Returns:
- immutable derivative, or the validated source for an identity transform
-
reserveComposition
Reserves composition bytes from the provider-generation shared pool until close or shutdown.- Parameters:
bytes- positive reservation size- Returns:
- idempotent, thread-safe lease
- Throws:
RendererException- if unsupported, permanently oversized, or temporarily exhausted
-
supportedSceneOperations
Returns the optional scene operations implemented by this provider. Older providers return empty. -
appendEntities
Appends copied, complete resolved entity evidence without changing the source or recapturing world state. The scene must belong to this active client and provider generation. UUIDs and nonzero object IDs must be unique across captured and appended entities. Targets require actual meshes with finite, nondegenerate geometry enclosed by their world bounds. Camera, chunks, lighting and weather are preserved. No live entity or resource lookup occurs.- Parameters:
source- immutable scene owned by this cliententities- immutable exact visual evidence; the list is defensively copied- Returns:
- a new client-owned scene; subsequent selections include the appended classifications
- Throws:
RendererException- for unsupported composition, stale ownership or invalid/oversized evidence
-
reframeScene
Renders a new camera pose against unchanged captured world evidence. This does not read the world or refresh captured entities, environment or capture age. The camera must remain in the original centre chunk and captured build-height coverage, within the displacement bound. Age starts at the first capture read and is checked at derivation, admission and worker start. Selecting or appending visuals never renews these limits. Camera-relative lights follow the new effective camera. A fresh capture is required on STALE_SCENE or MISSING_CHUNK.- Parameters:
source- captured scene owned by this active client/provider generationcamera- effective camera in world blocks and radians; remains in the source worldpolicy- maximum evidence age and displacement from the original capture- Returns:
- immutable camera-only derivative
- Throws:
RendererException- if unsupported, stale, foreign or outside captured coverage
-
registerAsset
Registers copied archive evidence and returns a client-owned handle; invalid/bounded archives fail synchronously. -
submit
Validates and attempts bounded queue/memory admission, returning immediately on success.- Parameters:
job- owned scene, matching settings and active asset hashes- Returns:
- nonblocking task; rendering is performed off the server thread
- Throws:
RendererException- if validation, capability, lifecycle, queue or memory admission fails
-
close
void close()Idempotently cancels or releases client-owned work and registrations.- Specified by:
closein interfaceAutoCloseable
-