fix: fix generation by re-adding important method

This commit is contained in:
dordsor21 2023-03-16 17:42:48 +00:00
parent 77b2bd166a
commit 745b06a008
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
1 changed files with 36 additions and 2 deletions

View File

@ -185,6 +185,35 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
world.setWaterAnimalSpawnLimit(limit);
}
@Override
public void generateNoise(
@NotNull final WorldInfo worldInfo,
@NotNull final Random random,
final int chunkX,
final int chunkZ,
@NotNull final ChunkData chunkData
) {
if (this.platformGenerator != this) {
this.platformGenerator.generateNoise(worldInfo, random, chunkX, chunkZ, chunkData);
return;
}
int minY = chunkData.getMinHeight();
int maxY = chunkData.getMaxHeight();
GenChunk result = new GenChunk(minY, maxY);
// Set the chunk location
result.setChunk(new ChunkWrapper(worldInfo.getName(), chunkX, chunkZ));
// Set the result data
result.setChunkData(chunkData);
result.result = null;
// Catch any exceptions (as exceptions usually thrown)
try {
generate(BlockVector2.at(chunkX, chunkZ), worldInfo.getName(), result, false);
} catch (Throwable e) {
LOGGER.error("Error attempting to generate chunk.", e);
}
}
@Override
public void generateSurface(
@NotNull final WorldInfo worldInfo,
@ -248,6 +277,11 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
return super.getBaseHeight(worldInfo, random, x, z, heightMap);
}
/**
* The entire method is deprecated, but kept for compatibility with versions lower than or equal to 1.16.2.
* The method will be removed in future versions, because WorldEdit and FastAsyncWorldEdit only support the latest point
* release.
*/
@SuppressWarnings("deprecation") // The entire method is deprecated, but kept for compatibility with <=1.16.2
@Override
@Deprecated(since = "TODO")
@ -258,8 +292,8 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
if (this.platformGenerator != this) {
return this.platformGenerator.generateChunkData(world, random, x, z, biome);
} else {
// Return super as it will throw an exception caught by the server that will mean this method is no longer used.
return super.generateChunkData(world, random, x, z, biome);
// Throw exception to be caught by the server that indicates the new generation API is being used.
throw new UnsupportedOperationException("Using new generation methods. This method is unsupported.");
}
}