Skip to content

Commit

Permalink
Clean up some regen code (#2405)
Browse files Browse the repository at this point in the history
  • Loading branch information
SirYwell authored Sep 9, 2023
1 parent 7288393 commit 60a3994
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,6 @@ public PaperweightRegen(org.bukkit.World originalBukkitWorld, Region region, Ext
protected boolean prepare() {
this.originalServerWorld = ((CraftWorld) originalBukkitWorld).getHandle();
originalChunkProvider = originalServerWorld.getChunkSource();
if (!(originalChunkProvider instanceof ServerChunkCache)) {
return false;
}

//flat bedrock? (only on paper)
if (paperConfigField != null) {
Expand All @@ -197,7 +194,7 @@ protected boolean prepare() {
}

seed = options.getSeed().orElse(originalServerWorld.getSeed());
chunkStati.forEach((s, c) -> super.chunkStati.put(new ChunkStatusWrap(s), c));
chunkStati.forEach((s, c) -> super.chunkStatuses.put(new ChunkStatusWrap(s), c));

return true;
}
Expand Down Expand Up @@ -680,7 +677,7 @@ public String name() {
}

@Override
public CompletableFuture<?> processChunk(Long xz, List<ChunkAccess> accessibleChunks) {
public CompletableFuture<?> processChunk(List<ChunkAccess> accessibleChunks) {
return chunkStatus.generate(
Runnable::run, // TODO revisit, we might profit from this somehow?
freshWorld,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,6 @@ public PaperweightRegen(org.bukkit.World originalBukkitWorld, Region region, Ext
protected boolean prepare() {
this.originalServerWorld = ((CraftWorld) originalBukkitWorld).getHandle();
originalChunkProvider = originalServerWorld.getChunkSource();
if (!(originalChunkProvider instanceof ServerChunkCache)) {
return false;
}

//flat bedrock? (only on paper)
if (paperConfigField != null) {
Expand All @@ -191,7 +188,7 @@ protected boolean prepare() {
}

seed = options.getSeed().orElse(originalServerWorld.getSeed());
chunkStati.forEach((s, c) -> super.chunkStati.put(new ChunkStatusWrap(s), c));
chunkStati.forEach((s, c) -> super.chunkStatuses.put(new ChunkStatusWrap(s), c));

return true;
}
Expand Down Expand Up @@ -523,7 +520,7 @@ public String name() {
}

@Override
public CompletableFuture<?> processChunk(Long xz, List<ChunkAccess> accessibleChunks) {
public CompletableFuture<?> processChunk(List<ChunkAccess> accessibleChunks) {
return chunkStatus.generate(
Runnable::run, // TODO revisit, we might profit from this somehow?
freshWorld,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,6 @@ public PaperweightRegen(org.bukkit.World originalBukkitWorld, Region region, Ext
protected boolean prepare() {
this.originalServerWorld = ((CraftWorld) originalBukkitWorld).getHandle();
originalChunkProvider = originalServerWorld.getChunkSource();
if (!(originalChunkProvider instanceof ServerChunkCache)) {
return false;
}

//flat bedrock? (only on paper)
if (paperConfigField != null) {
Expand All @@ -205,7 +202,7 @@ protected boolean prepare() {
}

seed = options.getSeed().orElse(originalServerWorld.getSeed());
chunkStati.forEach((s, c) -> super.chunkStati.put(new ChunkStatusWrap(s), c));
chunkStati.forEach((s, c) -> super.chunkStatuses.put(new ChunkStatusWrap(s), c));

return true;
}
Expand Down Expand Up @@ -554,7 +551,7 @@ public String name() {
}

@Override
public CompletableFuture<?> processChunk(Long xz, List<ChunkAccess> accessibleChunks) {
public CompletableFuture<?> processChunk(List<ChunkAccess> accessibleChunks) {
return chunkStatus.generate(
Runnable::run, // TODO revisit, we might profit from this somehow?
freshWorld,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,6 @@ public PaperweightRegen(org.bukkit.World originalBukkitWorld, Region region, Ext
protected boolean prepare() {
this.originalServerWorld = ((CraftWorld) originalBukkitWorld).getHandle();
originalChunkProvider = originalServerWorld.getChunkSource();
if (!(originalChunkProvider instanceof ServerChunkCache)) {
return false;
}

//flat bedrock? (only on paper)
if (paperConfigField != null) {
Expand All @@ -205,7 +202,7 @@ protected boolean prepare() {
}

seed = options.getSeed().orElse(originalServerWorld.getSeed());
chunkStati.forEach((s, c) -> super.chunkStati.put(new ChunkStatusWrap(s), c));
chunkStati.forEach((s, c) -> super.chunkStatuses.put(new ChunkStatusWrap(s), c));

return true;
}
Expand Down Expand Up @@ -555,7 +552,7 @@ public String name() {
}

@Override
public CompletableFuture<?> processChunk(Long xz, List<ChunkAccess> accessibleChunks) {
public CompletableFuture<?> processChunk(List<ChunkAccess> accessibleChunks) {
return chunkStatus.generate(
Runnable::run, // TODO revisit, we might profit from this somehow?
freshWorld,
Expand Down
Loading

0 comments on commit 60a3994

Please sign in to comment.