Javadoc, some cleanup

This commit is contained in:
dordsor21
2020-07-24 17:00:08 +01:00
parent 1d0760c630
commit 7aaa075ba8
14 changed files with 268 additions and 84 deletions

View File

@ -67,7 +67,6 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
private org.bukkit.World bukkitWorld;
@Inject private ChunkCoordinatorBuilderFactory chunkCoordinatorBuilderFactory;
@Inject private ChunkCoordinatorFactory chunkCoordinatorFactory;
private Runnable whenDone;
private ChunkCoordinator chunkCoordinator;
@Inject public BukkitQueueCoordinator(@Nonnull World world) {
@ -198,7 +197,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
}
chunkCoordinator =
chunkCoordinatorBuilderFactory.create(chunkCoordinatorFactory).inWorld(getWorld()).withChunks(getBlockChunks().keySet()).withChunks(read)
.withInitialBatchSize(3).withMaxIterationTime(40).withThrowableConsumer(Throwable::printStackTrace).withFinalAction(whenDone)
.withInitialBatchSize(3).withMaxIterationTime(40).withThrowableConsumer(Throwable::printStackTrace).withFinalAction(getCompleteTask())
.withConsumer(consumer).unloadAfter(isUnloadAfter()).build();
return super.enqueue();
}
@ -239,8 +238,4 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
}
}
@Override public void setCompleteTask(Runnable whenDone) {
this.whenDone = whenDone;
}
}

View File

@ -71,6 +71,9 @@ public class GenChunk extends ScopedQueueCoordinator {
return this.chunkData;
}
/**
* Set the internal Bukkit chunk data
*/
public void setChunkData(@Nonnull ChunkData chunkData) {
this.chunkData = chunkData;
}
@ -85,10 +88,17 @@ public class GenChunk extends ScopedQueueCoordinator {
return chunk;
}
/**
* Set the chunk being represented
*/
public void setChunk(@Nonnull Chunk chunk) {
this.chunk = chunk;
}
/**
* Set the world and XZ of the chunk being represented via {@link ChunkWrapper}
*/
public void setChunk(@Nonnull ChunkWrapper wrap) {
chunk = null;
world = wrap.world;
@ -101,9 +111,11 @@ public class GenChunk extends ScopedQueueCoordinator {
return;
}
Biome biome = BukkitAdapter.adapt(biomeType);
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
this.biomeGrid.setBiome(x, z, biome);
for (int y = 0; y < 256; y++) {
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
this.biomeGrid.setBiome(x, y, z, biome);
}
}
}
}
@ -134,9 +146,22 @@ public class GenChunk extends ScopedQueueCoordinator {
return setBiome(x, z, BukkitAdapter.adapt(biomeType));
}
/**
* Set the in the whole column of XZ
*/
public boolean setBiome(int x, int z, @Nonnull Biome biome) {
if (this.biomeGrid != null) {
this.biomeGrid.setBiome(x, z, biome);
for (int y = 0; y < 256; y++) {
this.setBiome(x, y, z, biome);
}
return true;
}
return false;
}
public boolean setBiome(int x, int y, int z, @Nonnull Biome biome) {
if (this.biomeGrid != null) {
this.biomeGrid.setBiome(x, y, z, biome);
return true;
}
return false;