Package dev.deepcore.challenge.preview
Class PreviewSampleService
java.lang.Object
dev.deepcore.challenge.preview.PreviewSampleService
Samples and transforms world blocks into preview hologram block data.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents a sampled preview block in coordinates relative to preview origin. -
Constructor Summary
ConstructorsConstructorDescriptionPreviewSampleService(org.bukkit.plugin.java.JavaPlugin plugin, DeepCoreLogger log) Creates a preview sample service. -
Method Summary
Modifier and TypeMethodDescriptionBuilds the disco preview sample from bundled JSON grid resources.intcalculateEasedSpawnTarget(int totalBlocks, int elapsedTicks, int totalAnimationTicks) Calculates eased block target count for preview spawn animation ticks.formatBiomeName(org.bukkit.block.Biome biome) Formats a biome enum key into a user-friendly title-cased name.Orders preview blocks by layer with randomized intra-layer build order.sampleSpawnSurface(org.bukkit.World runWorld) Samples the run-world spawn surface into a filtered preview block list.
-
Constructor Details
-
PreviewSampleService
Creates a preview sample service.- Parameters:
plugin- plugin instance used for config and resource accesslog- logger used for sampling and resource warnings
-
-
Method Details
-
sampleSpawnSurface
Samples the run-world spawn surface into a filtered preview block list.- Parameters:
runWorld- run world to sample around spawn- Returns:
- filtered list of sampled preview blocks relative to preview origin
-
buildDiscoPreviewSample
Builds the disco preview sample from bundled JSON grid resources.- Returns:
- disco preview block sample parsed from bundled resources
-
orderPreviewBlocksForBuild
public List<PreviewSampleService.PreviewBlock> orderPreviewBlocksForBuild(List<PreviewSampleService.PreviewBlock> sample) Orders preview blocks by layer with randomized intra-layer build order.- Parameters:
sample- unsorted preview block sample- Returns:
- layer-ordered preview blocks with shuffled intra-layer order
-
calculateEasedSpawnTarget
public int calculateEasedSpawnTarget(int totalBlocks, int elapsedTicks, int totalAnimationTicks) Calculates eased block target count for preview spawn animation ticks.- Parameters:
totalBlocks- total number of blocks in the preview sampleelapsedTicks- elapsed animation ticks since spawn starttotalAnimationTicks- total ticks allocated for the full animation- Returns:
- eased count of blocks that should be visible at the current tick
-
formatBiomeName
Formats a biome enum key into a user-friendly title-cased name.- Parameters:
biome- biome to format- Returns:
- user-facing biome name
-