Skip to content

Commit

Permalink
Fixing template args to extend ChunkBase instead of Chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools committed Nov 9, 2021
1 parent d002cbb commit 0c6d33b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/main/java/net/querz/mca/ChunkIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import java.util.Iterator;

/**
* Enhanced iterator for iterating over {@link Chunk} data.
* Enhanced iterator for iterating over {@link ChunkBase} data.
* All 1024 chunks will be returned by successive calls to {@link #next()}, even
* those which are {@code null}.
* See {@link MCAFileBase#iterator()}
*/
public interface ChunkIterator<I extends Chunk> extends Iterator<I> {
public interface ChunkIterator<I extends ChunkBase> extends Iterator<I> {
/**
* Replaces the current chunk with the one given by calling {@link MCAFileBase#setChunk(int, Chunk)}
* Replaces the current chunk with the one given by calling {@link MCAFileBase#setChunk(int, ChunkBase)}
* with the {@link #currentIndex()}. Take care as the given chunk is NOT copied by this call.
* @param chunk Chunk to set, may be null.
*/
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/querz/mca/MCAFileBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* An abstract representation of an mca file.
*/
public abstract class MCAFileBase<T extends Chunk> implements Iterable<T> {
public abstract class MCAFileBase<T extends ChunkBase> implements Iterable<T> {

protected int regionX, regionZ;
protected T[] chunks;
Expand Down Expand Up @@ -253,7 +253,7 @@ public int serialize(RandomAccessFile raf, boolean changeLastUpdate) throws IOEx
for (int cz = 0; cz < 32; cz++) {
for (int cx = 0; cx < 32; cx++) {
int index = getChunkIndex(cx, cz);
Chunk chunk = chunks[index];
T chunk = chunks[index];
if (chunk == null) {
continue;
}
Expand Down Expand Up @@ -377,7 +377,7 @@ public Stream<T> stream() {
return StreamSupport.stream(spliterator(), false);
}

protected static class ChunkIteratorImpl<I extends Chunk> implements ChunkIterator<I> {
protected static class ChunkIteratorImpl<I extends ChunkBase> implements ChunkIterator<I> {
private final MCAFileBase<I> owner;
private int currentIndex;

Expand Down

0 comments on commit 0c6d33b

Please sign in to comment.