Skip to content

Commit

Permalink
[ci-skip] Mention missing World#regenerateChunk implementation in jd (P…
Browse files Browse the repository at this point in the history
…aperMC#12109)

* Mention missing impl

* Clean the implementation out of years old code

* Change the jd comment

* Move to default method

---------

Co-authored-by: Bjarne Koll <[email protected]>
  • Loading branch information
2 people authored and Y2Kwastaken committed Feb 16, 2025
1 parent 0287e85 commit 61b79c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 29 deletions.
7 changes: 5 additions & 2 deletions paper-api/src/main/java/org/bukkit/World.java
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,15 @@ default boolean isChunkGenerated(long chunkKey) {
* @param z Z-coordinate of the chunk
* @return Whether the chunk was actually regenerated
*
* @throws UnsupportedOperationException not implemented
* @deprecated regenerating a single chunk is not likely to produce the same
* chunk as before as terrain decoration may be spread across chunks. It may
* or may not change blocks in the adjacent chunks as well.
*/
@Deprecated(since = "1.13")
public boolean regenerateChunk(int x, int z);
@Deprecated(since = "1.13", forRemoval = true)
default boolean regenerateChunk(int x, int z) {
throw new UnsupportedOperationException("Not supported in this Minecraft version! This is not a bug.");
}

/**
* Resends the {@link Chunk} to all clients
Expand Down
27 changes: 0 additions & 27 deletions paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -470,33 +470,6 @@ private boolean unloadChunk0(int x, int z, boolean save) {
return !this.isChunkLoaded(x, z);
}

@Override
public boolean regenerateChunk(int x, int z) {
org.spigotmc.AsyncCatcher.catchOp("chunk regenerate"); // Spigot
throw new UnsupportedOperationException("Not supported in this Minecraft version! Unless you can fix it, this is not a bug :)");
/*
if (!unloadChunk0(x, z, false)) {
return false;
}
warnUnsafeChunk("regenerating a faraway chunk", x, z); // Paper
final long chunkKey = ChunkCoordIntPair.pair(x, z);
world.getChunkProvider().unloadQueue.remove(chunkKey);
net.minecraft.server.Chunk chunk = world.getChunkProvider().generateChunk(x, z);
PlayerChunk playerChunk = world.getPlayerChunkMap().getChunk(x, z);
if (playerChunk != null) {
playerChunk.chunk = chunk;
}
if (chunk != null) {
refreshChunk(x, z);
}
return chunk != null;
*/
}

@Override
public boolean refreshChunk(int x, int z) {
ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z));
Expand Down

0 comments on commit 61b79c3

Please sign in to comment.