mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-07 23:52:11 -07:00
SPIGOT-6765: Pass WorldInfo, Random and coordinates to ChunkGenerator should methods
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
@@ -42,12 +42,12 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
* Some aspects of world generation can be delegated to the Vanilla generator.
|
* Some aspects of world generation can be delegated to the Vanilla generator.
|
||||||
* The following methods can be overridden to enable this:
|
* The following methods can be overridden to enable this:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link ChunkGenerator#shouldGenerateNoise()}</li>
|
* <li>{@link ChunkGenerator#shouldGenerateNoise()} or {@link ChunkGenerator#shouldGenerateNoise(WorldInfo, Random, int, int)}</li>
|
||||||
* <li>{@link ChunkGenerator#shouldGenerateSurface()}</li>
|
* <li>{@link ChunkGenerator#shouldGenerateSurface()} or {@link ChunkGenerator#shouldGenerateSurface(WorldInfo, Random, int, int)}</li>
|
||||||
* <li>{@link ChunkGenerator#shouldGenerateCaves()}</li>
|
* <li>{@link ChunkGenerator#shouldGenerateCaves()} or {@link ChunkGenerator#shouldGenerateCaves(WorldInfo, Random, int, int)}</li>
|
||||||
* <li>{@link ChunkGenerator#shouldGenerateDecorations()}</li>
|
* <li>{@link ChunkGenerator#shouldGenerateDecorations()} or {@link ChunkGenerator#shouldGenerateDecorations(WorldInfo, Random, int, int)}</li>
|
||||||
* <li>{@link ChunkGenerator#shouldGenerateMobs()}</li>
|
* <li>{@link ChunkGenerator#shouldGenerateMobs()} or {@link ChunkGenerator#shouldGenerateMobs(WorldInfo, Random, int, int)}</li>
|
||||||
* <li>{@link ChunkGenerator#shouldGenerateStructures()}</li>
|
* <li>{@link ChunkGenerator#shouldGenerateStructures()} or {@link ChunkGenerator#shouldGenerateStructures(WorldInfo, Random, int, int)}</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public abstract class ChunkGenerator {
|
public abstract class ChunkGenerator {
|
||||||
@@ -373,24 +373,73 @@ public abstract class ChunkGenerator {
|
|||||||
* <p>
|
* <p>
|
||||||
* The Vanilla noise is generated <b>before</b>
|
* The Vanilla noise is generated <b>before</b>
|
||||||
* {@link #generateNoise(WorldInfo, Random, int, int, ChunkData)} is called.
|
* {@link #generateNoise(WorldInfo, Random, int, int, ChunkData)} is called.
|
||||||
|
* <p>
|
||||||
|
* This is method is not called (and has therefore no effect), if
|
||||||
|
* {@link #shouldGenerateNoise(WorldInfo, Random, int, int)} is overridden.
|
||||||
*
|
*
|
||||||
* @return true if the server should generate Vanilla noise
|
* @return true if the server should generate Vanilla noise
|
||||||
|
* @see #shouldGenerateNoise(WorldInfo, Random, int, int)
|
||||||
*/
|
*/
|
||||||
public boolean shouldGenerateNoise() {
|
public boolean shouldGenerateNoise() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets if the server should generate Vanilla noise.
|
||||||
|
* <p>
|
||||||
|
* The Vanilla noise is generated <b>before</b>
|
||||||
|
* {@link #generateNoise(WorldInfo, Random, int, int, ChunkData)} is called.
|
||||||
|
* <p>
|
||||||
|
* Only this method is called if both this and
|
||||||
|
* {@link #shouldGenerateNoise()} are overridden.
|
||||||
|
*
|
||||||
|
* @param worldInfo The world info of the world this chunk will be used for
|
||||||
|
* @param random The random generator to use
|
||||||
|
* @param chunkX The X-coordinate of the chunk
|
||||||
|
* @param chunkZ The Z-coordinate of the chunk
|
||||||
|
* @return true if the server should generate Vanilla noise
|
||||||
|
* @see #shouldGenerateNoise()
|
||||||
|
*/
|
||||||
|
public boolean shouldGenerateNoise(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ) {
|
||||||
|
return shouldGenerateNoise();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets if the server should generate Vanilla surface.
|
||||||
|
* <p>
|
||||||
|
* The Vanilla surface is generated <b>before</b>
|
||||||
|
* {@link #generateSurface(WorldInfo, Random, int, int, ChunkData)} is
|
||||||
|
* called.
|
||||||
|
* <p>
|
||||||
|
* This is method is not called (and has therefore no effect), if
|
||||||
|
* {@link #shouldGenerateSurface(WorldInfo, Random, int, int)} is overridden.
|
||||||
|
*
|
||||||
|
* @return true if the server should generate Vanilla surface
|
||||||
|
* @see #shouldGenerateSurface(WorldInfo, Random, int, int)
|
||||||
|
*/
|
||||||
|
public boolean shouldGenerateSurface() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets if the server should generate Vanilla surface.
|
* Gets if the server should generate Vanilla surface.
|
||||||
* <p>
|
* <p>
|
||||||
* The Vanilla surface is generated <b>before</b>
|
* The Vanilla surface is generated <b>before</b>
|
||||||
* {@link #generateSurface(WorldInfo, Random, int, int, ChunkData)} is
|
* {@link #generateSurface(WorldInfo, Random, int, int, ChunkData)} is
|
||||||
* called.
|
* called.
|
||||||
|
* <p>
|
||||||
|
* Only this method is called if both this and
|
||||||
|
* {@link #shouldGenerateSurface()} are overridden.
|
||||||
*
|
*
|
||||||
|
* @param worldInfo The world info of the world this chunk will be used for
|
||||||
|
* @param random The random generator to use
|
||||||
|
* @param chunkX The X-coordinate of the chunk
|
||||||
|
* @param chunkZ The Z-coordinate of the chunk
|
||||||
* @return true if the server should generate Vanilla surface
|
* @return true if the server should generate Vanilla surface
|
||||||
|
* @see #shouldGenerateSurface()
|
||||||
*/
|
*/
|
||||||
public boolean shouldGenerateSurface() {
|
public boolean shouldGenerateSurface(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ) {
|
||||||
return false;
|
return shouldGenerateSurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -413,46 +462,139 @@ public abstract class ChunkGenerator {
|
|||||||
* <p>
|
* <p>
|
||||||
* The Vanilla caves are generated <b>before</b>
|
* The Vanilla caves are generated <b>before</b>
|
||||||
* {@link #generateCaves(WorldInfo, Random, int, int, ChunkData)} is called.
|
* {@link #generateCaves(WorldInfo, Random, int, int, ChunkData)} is called.
|
||||||
|
* <p>
|
||||||
|
* This is method is not called (and has therefore no effect), if
|
||||||
|
* {@link #shouldGenerateCaves(WorldInfo, Random, int, int)} is overridden.
|
||||||
*
|
*
|
||||||
* @return true if the server should generate Vanilla caves
|
* @return true if the server should generate Vanilla caves
|
||||||
|
* @see #shouldGenerateCaves(WorldInfo, Random, int, int)
|
||||||
*/
|
*/
|
||||||
public boolean shouldGenerateCaves() {
|
public boolean shouldGenerateCaves() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets if the server should generate Vanilla caves.
|
||||||
|
* <p>
|
||||||
|
* The Vanilla caves are generated <b>before</b>
|
||||||
|
* {@link #generateCaves(WorldInfo, Random, int, int, ChunkData)} is called.
|
||||||
|
* <p>
|
||||||
|
* Only this method is called if both this and
|
||||||
|
* {@link #shouldGenerateCaves()} are overridden.
|
||||||
|
*
|
||||||
|
* @param worldInfo The world info of the world this chunk will be used for
|
||||||
|
* @param random The random generator to use
|
||||||
|
* @param chunkX The X-coordinate of the chunk
|
||||||
|
* @param chunkZ The Z-coordinate of the chunk
|
||||||
|
* @return true if the server should generate Vanilla caves
|
||||||
|
* @see #shouldGenerateCaves()
|
||||||
|
*/
|
||||||
|
public boolean shouldGenerateCaves(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ) {
|
||||||
|
return shouldGenerateCaves();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets if the server should generate Vanilla decorations after this
|
||||||
|
* ChunkGenerator.
|
||||||
|
* <p>
|
||||||
|
* The Vanilla decoration are generated <b>before</b> any
|
||||||
|
* {@link BlockPopulator} are called.
|
||||||
|
* <p>
|
||||||
|
* This is method is not called (and has therefore no effect), if
|
||||||
|
* {@link #shouldGenerateDecorations(WorldInfo, Random, int, int)} is overridden.
|
||||||
|
*
|
||||||
|
* @return true if the server should generate Vanilla decorations
|
||||||
|
* @see #shouldGenerateDecorations(WorldInfo, Random, int, int)
|
||||||
|
*/
|
||||||
|
public boolean shouldGenerateDecorations() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets if the server should generate Vanilla decorations after this
|
* Gets if the server should generate Vanilla decorations after this
|
||||||
* ChunkGenerator.
|
* ChunkGenerator.
|
||||||
* <p>
|
* <p>
|
||||||
* The Vanilla decoration are generated <b>before</b> any
|
* The Vanilla decoration are generated <b>before</b> any
|
||||||
* {@link BlockPopulator} are called.
|
* {@link BlockPopulator} are called.
|
||||||
|
* <p>
|
||||||
|
* Only this method is called if both this and
|
||||||
|
* {@link #shouldGenerateDecorations()} are overridden.
|
||||||
*
|
*
|
||||||
|
* @param worldInfo The world info of the world this chunk will be used for
|
||||||
|
* @param random The random generator to use
|
||||||
|
* @param chunkX The X-coordinate of the chunk
|
||||||
|
* @param chunkZ The Z-coordinate of the chunk
|
||||||
* @return true if the server should generate Vanilla decorations
|
* @return true if the server should generate Vanilla decorations
|
||||||
|
* @see #shouldGenerateDecorations()
|
||||||
*/
|
*/
|
||||||
public boolean shouldGenerateDecorations() {
|
public boolean shouldGenerateDecorations(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ) {
|
||||||
return false;
|
return shouldGenerateDecorations();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets if the server should generate Vanilla mobs after this
|
* Gets if the server should generate Vanilla mobs after this
|
||||||
* ChunkGenerator.
|
* ChunkGenerator.
|
||||||
|
* <p>
|
||||||
|
* This is method is not called (and has therefore no effect), if
|
||||||
|
* {@link #shouldGenerateMobs(WorldInfo, Random, int, int)} is overridden.
|
||||||
*
|
*
|
||||||
* @return true if the server should generate Vanilla mobs
|
* @return true if the server should generate Vanilla mobs
|
||||||
|
* @see #shouldGenerateMobs(WorldInfo, Random, int, int)
|
||||||
*/
|
*/
|
||||||
public boolean shouldGenerateMobs() {
|
public boolean shouldGenerateMobs() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets if the server should generate Vanilla mobs after this
|
||||||
|
* ChunkGenerator.
|
||||||
|
* <p>
|
||||||
|
* Only this method is called if both this and
|
||||||
|
* {@link #shouldGenerateMobs()} are overridden.
|
||||||
|
*
|
||||||
|
* @param worldInfo The world info of the world this chunk will be used for
|
||||||
|
* @param random The random generator to use
|
||||||
|
* @param chunkX The X-coordinate of the chunk
|
||||||
|
* @param chunkZ The Z-coordinate of the chunk
|
||||||
|
* @return true if the server should generate Vanilla mobs
|
||||||
|
* @see #shouldGenerateMobs()
|
||||||
|
*/
|
||||||
|
public boolean shouldGenerateMobs(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ) {
|
||||||
|
return shouldGenerateMobs();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets if the server should generate Vanilla structures after this
|
* Gets if the server should generate Vanilla structures after this
|
||||||
* ChunkGenerator.
|
* ChunkGenerator.
|
||||||
|
* <p>
|
||||||
|
* This is method is not called (and has therefore no effect), if
|
||||||
|
* {@link #shouldGenerateStructures(WorldInfo, Random, int, int)} is overridden.
|
||||||
*
|
*
|
||||||
* @return true if the server should generate Vanilla structures
|
* @return true if the server should generate Vanilla structures
|
||||||
|
* @see #shouldGenerateStructures(WorldInfo, Random, int, int)
|
||||||
*/
|
*/
|
||||||
public boolean shouldGenerateStructures() {
|
public boolean shouldGenerateStructures() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets if the server should generate Vanilla structures after this
|
||||||
|
* ChunkGenerator.
|
||||||
|
* <p>
|
||||||
|
* Only this method is called if both this and
|
||||||
|
* {@link #shouldGenerateStructures()} are overridden.
|
||||||
|
*
|
||||||
|
* @param worldInfo The world info of the world this chunk will be used for
|
||||||
|
* @param random The random generator to use
|
||||||
|
* @param chunkX The X-coordinate of the chunk
|
||||||
|
* @param chunkZ The Z-coordinate of the chunk
|
||||||
|
* @return true if the server should generate Vanilla structures
|
||||||
|
* @see #shouldGenerateStructures()
|
||||||
|
*/
|
||||||
|
public boolean shouldGenerateStructures(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ) {
|
||||||
|
return shouldGenerateStructures();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data for a Chunk.
|
* Data for a Chunk.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user