Advertisement
Barteks2x

Untitled

Jun 29th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.24 KB | None | 0 0
  1. package cubicchunks.worldgen;
  2.  
  3. import cubicchunks.util.CubeCoords;
  4. import cubicchunks.world.column.Column;
  5. import cubicchunks.world.cube.Cube;
  6. import cubicchunks.worldgen.dependency.DependentCubeManager;
  7.  
  8. import javax.annotation.Nonnull;
  9. import javax.annotation.Nullable;
  10.  
  11. public interface ICubeGenerator {
  12.  
  13.     /**
  14.      * Returns the number of cubes that are queued for generation.
  15.      *
  16.      * @return The number of cubes that are queued for generation.
  17.      */
  18.     int getQueuedCubeCount();
  19.  
  20.     /**
  21.      * Returns the GeneratorPipeline used by this ICubeGenerator. This pipeline dictates the stages every cube has to
  22.      * go through and the processors used in each given stage. Modifications on this pipeline are strongly discouraged
  23.      * as they are likely to disrupt generation of currently queued cubes.
  24.      *
  25.      * @return The GeneratorPipeline used by this ICubeGenerator.
  26.      */
  27.     @Nonnull
  28.     GeneratorPipeline getGeneratorPipeline();
  29.  
  30.     /**
  31.      * Returns the DependentCubeManager used by this ICubeGenerator. The DependentCubeManager keeps track of all cubes
  32.      * requiring other cubes to be loaded for their generation. Removing cubes that have been registered by the
  33.      * ICubeGenerator from the DependentCubeCache will result in them not being generated further or may disrupt its
  34.      * processing.
  35.      *
  36.      * @return The DependentCubeManager used by this ICubeGenerator.
  37.      */
  38.     @Nonnull
  39.     DependentCubeManager getDependentCubeManager();
  40.  
  41.     /**
  42.      * Immediately queues the given cube for generation. All cubes required for processing the given cube must be
  43.      * loaded prior to passing it to this method. If a required cube is not available, undocumented behaviour might
  44.      * occur.
  45.      *
  46.      * @param cube The cube to be queued for generation.
  47.      */
  48.     void resumeCube(@Nonnull Cube cube);
  49.  
  50.     /**
  51.      * Schedules the given cube for generation. The cube will be generated up to its set target stage. This
  52.      * ICubeGenerator will ensure that all cubes required for generating this cube are available when needed.
  53.      *
  54.      * @param cube The cube to be generated.
  55.      */
  56.     void generateCube(@Nonnull Cube cube);
  57.  
  58.     /**
  59.      * Schedules the given cube for generation up to the given target stage.
  60.      * @see #generateCube(Cube)
  61.      *
  62.      * @param cube The cube to be generated.
  63.      */
  64.     void generateCube(@Nonnull Cube cube, @Nonnull GeneratorStage targetStage);
  65.  
  66.     /**
  67.      * Schedules the cube at the given coordinates for generation. If the cube does already exist, updates the target
  68.      * stage if necessary. Otherwise a new cube object will be created and added to the proper column. If the cube did
  69.      * not yet exist or if it had not reached the target stage, it will be queued for generation.
  70.      * @see #generateCube(Cube)
  71.      *
  72.      * @param coords The coordinates of the cube to be generated.
  73.      * @param targetStage The target stage up until which the cube is supposed to be generated.
  74.      * @return The cube being generated or null if the cube did not already exist and creating it failed.
  75.      */
  76.     @Nullable
  77.     Cube generateCube(@Nonnull CubeCoords coords, @Nonnull GeneratorStage targetStage);
  78.  
  79.     /**
  80.      * Schedules the cube at the given coordinates for generation. The cube will be generated up to the final stage
  81.      * GeneratorStage.LIVE at which point it is considered to be final.
  82.      * @see #generateCube(CubeCoords, GeneratorStage)
  83.      * @see #generateCube(Cube)
  84.      *
  85.      * @param coords The coordinates of the cube to be generated.
  86.      * @return The cube being generated or null if the cube did not already exist and creating it failed.
  87.      */
  88.     @Nullable
  89.     Cube generateCube(@Nonnull CubeCoords coords);
  90.  
  91.     /**
  92.      * Creates a new column for the given coordinates.
  93.      *
  94.      * @param cubeX The x-coordinate of the column to be created.
  95.      * @param cubeZ The z-coordinate of the column to be created.
  96.      * @return A new instance of Column for the given coordinates.
  97.      */
  98.     @Nullable
  99.     Column generateColumn(int cubeX, int cubeZ);
  100.  
  101.     /**
  102.      * Removes the cube at the given coordinates from the generator queue.
  103.      *
  104.      * @param coords The coordinates of the cube to be removed from the generator queue.
  105.      */
  106.     void removeCube(@Nonnull CubeCoords coords);
  107.  
  108.     /**
  109.      * Processes all currently queued cubes up to their respective target stage.
  110.      */
  111.     void calculateAll();
  112.  
  113.     /**
  114.      * Processes queued cubes.
  115.      */
  116.     void tick();
  117.  
  118. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement