Started by an SCM change89701ff04f4419fee522e6275196124a6ec0e3bb5ef01ff04f4419fee522e6275196124a6ec0e3bb5efrefs/remotes/origin/master01ff04f4419fee522e6275196124a6ec0e3bb5ef01ff04f4419fee522e6275196124a6ec0e3bb5efrefs/remotes/origin/master01ff04f4419fee522e6275196124a6ec0e3bb5ef01ff04f4419fee522e6275196124a6ec0e3bb5efrefs/remotes/origin/masterhttps://hub.spigotmc.org/stash/scm/spigot/bukkit.githttps://hub.spigotmc.org/jenkins/view/RSS/job/Bukkit-RSS/897/artifacthttps://hub.spigotmc.org/jenkins/view/RSS/job/Bukkit-RSS/changeshttps://hub.spigotmc.org/jenkins/view/RSS/job/Bukkit-RSS/897/https://hub.spigotmc.org/jenkins/view/RSS/job/Bukkit-RSS/897/testReportfalse#897708717Bukkit-RSS #897897falsefalse8972371SUCCESS1628979191015https://hub.spigotmc.org/jenkins/view/RSS/job/Bukkit-RSS/897/src/main/java/org/bukkit/generator/LimitedRegion.javasrc/main/java/org/bukkit/generator/BlockPopulator.javasrc/main/java/org/bukkit/generator/BiomeProvider.javasrc/main/java/org/bukkit/plugin/java/JavaPlugin.javasrc/main/java/org/bukkit/RegionAccessor.javasrc/main/java/org/bukkit/generator/ChunkGenerator.javasrc/main/java/org/bukkit/plugin/Plugin.javasrc/main/java/org/bukkit/generator/WorldInfo.javasrc/main/java/org/bukkit/WorldCreator.javasrc/test/java/org/bukkit/plugin/TestPlugin.javasrc/main/java/org/bukkit/World.java01ff04f4419fee522e6275196124a6ec0e3bb5ef1628978891000https://hub.spigotmc.org/jenkins/user/md_5md_5git@md-5.netSPIGOT-5880, SPIGOT-5567: New ChunkGenerator API ## **Current API** The current world generation API is very old and limited when you want to make more complex world generation. Resulting in some hard to fix bugs such as that you cannot modify blocks outside the chunk in the BlockPopulator (which should and was per the docs possible), or strange behavior such as SPIGOT-5880. ## **New API** With the new API, the generation is more separate in multiple methods and is more in line with Vanilla chunk generation. The new API is designed to as future proof as possible. If for example a new generation step is added it can easily also be added as a step in API by simply creating the method for it. On the other side if a generation step gets removed, the method can easily be called after another, which is the case with surface and bedrock. The new API and changes are also fully backwards compatible with old chunk generators. ### **Changes in the new api** **Extra generation steps:** Noise, surface, bedrock and caves are added as steps. With those generation steps three extra methods for Vanilla generation are also added. Those new methods provide the ChunkData instead of returning one. The reason for this is, that the ChunkData is now backed by a ChunkAccess. With this, each step has the information of the step before and the Vanilla information (if chosen by setting a 'should' method to true). The old method is deprecated. **New class BiomeProvider** The BiomeProvider acts as Biome source and wrapper for the NMS class WorldChunkManager. With this the underlying Vanilla ChunkGeneration knows which Biome to use for the structure and decoration generation. (Fixes: SPIGOT-5880). Although the List of Biomes which is required in BiomeProvider, is currently not much in use in Vanilla, I decided to add it to future proof the API when it may be required in later versions of Minecraft. The BiomeProvider is also separated from the ChunkGenerator for plugins which only want to change the biome map, such as single Biome worlds or if some biomes should be more present than others. **Deprecated isParallelCapable** Mojang has and is pushing to a more multi threaded chunk generation. This should also be the case for custom chunk generators. This is why the new API only supports multi threaded generation. This does not affect the old API, which is still checking this. **Base height method added** This method was added to also bring the Minecraft generator and Bukkit generator more in line. With this it is possible to return the max height of a location (before decorations). This is useful to let most structures know were to place them. This fixes SPIGOT-5567. (This fixes not all structures placement, desert pyramids for example are still way up at y-level 64, This however is more a vanilla bug and should be fixed at Mojangs end). **WorldInfo Class** The World object was swapped for a WorldInfo object. This is because many methods of the World object won't work during world generation and would mostly likely result in a deadlock. It contains any information a plugin should need to identify the world. **BlockPopulator Changes** Instead of directly manipulating a chunk, changes are now made to a new class LimitedRegion, this class provides methods to populated the chunk and its surrounding area. The wrapping is done so that the population can be moved into the place where Minecraft generates decorations. Where there is no chunk to access yet. By moving it into this place the generation is now async and the surrounding area of the chunk can also be used. For common methods between the World and LimitedRegion a RegionAccessor was added. 2021-08-15 08:08:11 +100001ff04f4419fee522e6275196124a6ec0e3bb5efSPIGOT-5880, SPIGOT-5567: New ChunkGenerator APIaddsrc/main/java/org/bukkit/generator/WorldInfo.javaeditsrc/main/java/org/bukkit/WorldCreator.javaeditsrc/test/java/org/bukkit/plugin/TestPlugin.javaeditsrc/main/java/org/bukkit/plugin/Plugin.javaeditsrc/main/java/org/bukkit/World.javaaddsrc/main/java/org/bukkit/generator/LimitedRegion.javaaddsrc/main/java/org/bukkit/generator/BiomeProvider.javaeditsrc/main/java/org/bukkit/generator/BlockPopulator.javaeditsrc/main/java/org/bukkit/plugin/java/JavaPlugin.javaaddsrc/main/java/org/bukkit/RegionAccessor.javaeditsrc/main/java/org/bukkit/generator/ChunkGenerator.javagithttps://hub.spigotmc.org/jenkins/user/md_5md_5md_5