Skip to content

Commit

Permalink
Redirect chunk holder retrieval in ChunkMap#forEachSpawnCandidateChunk
Browse files Browse the repository at this point in the history
The old chunk holder field is not maintained so this would
NPE.
  • Loading branch information
Spottedleaf committed Oct 24, 2024
1 parent 529b9a4 commit a3f2328
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,21 @@ public void dumpChunks(final Writer writer) throws IOException {
throw new UnsupportedOperationException();
}

/**
* @reason Route to new chunk system
* @author Spottedleaf
*/
@Redirect(
method = "forEachSpawnCandidateChunk",
at = @At(
value = "INVOKE",
target = "Lit/unimi/dsi/fastutil/longs/Long2ObjectLinkedOpenHashMap;get(J)Ljava/lang/Object;"
)
)
private <V> V redirectChunkHolderGet(final Long2ObjectLinkedOpenHashMap<V> instance, final long key) {
return (V)this.getVisibleChunkIfPresent(key);
}

@Override
public CompletableFuture<Optional<CompoundTag>> read(final ChunkPos pos) {
final CompletableFuture<Optional<CompoundTag>> ret = new CompletableFuture<>();
Expand Down

0 comments on commit a3f2328

Please sign in to comment.