Class PreviewSampleService

java.lang.Object
dev.deepcore.challenge.preview.PreviewSampleService

public final class PreviewSampleService extends Object
Samples and transforms world blocks into preview hologram block data.
  • Constructor Details

    • PreviewSampleService

      public PreviewSampleService(org.bukkit.plugin.java.JavaPlugin plugin, DeepCoreLogger log)
      Creates a preview sample service.
      Parameters:
      plugin - plugin instance used for config and resource access
      log - logger used for sampling and resource warnings
  • Method Details

    • sampleSpawnSurface

      public List<PreviewSampleService.PreviewBlock> sampleSpawnSurface(org.bukkit.World runWorld)
      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

      public List<PreviewSampleService.PreviewBlock> 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 sample
      elapsedTicks - elapsed animation ticks since spawn start
      totalAnimationTicks - total ticks allocated for the full animation
      Returns:
      eased count of blocks that should be visible at the current tick
    • formatBiomeName

      public String formatBiomeName(org.bukkit.block.Biome biome)
      Formats a biome enum key into a user-friendly title-cased name.
      Parameters:
      biome - biome to format
      Returns:
      user-facing biome name