Skip to content

Commit 7e8da77

Browse files
committed
Add emptyFactory method to OversizedChunkAccessor
1 parent e30a893 commit 7e8da77

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

‎src/main/java/org/glavo/nbt/internal/OversizedChunkAccessors.java‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ public String toString() {
4343
}
4444
};
4545

46+
public static final Function<Path, OversizedChunkAccessor> EMPTY_FACTORY = new Function<>() {
47+
@Override
48+
public OversizedChunkAccessor apply(Path path) {
49+
return OversizedChunkAccessor.emptyAccessor();
50+
}
51+
52+
@Override
53+
public String toString() {
54+
return "OversizedChunkAccessor.emptyFactory()";
55+
}
56+
};
57+
4658
public static final OversizedChunkAccessor EMPTY = new OversizedChunkAccessor() {
4759
@Override
4860
public String toString() {

‎src/main/java/org/glavo/nbt/io/OversizedChunkAccessor.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ static Function<Path, OversizedChunkAccessor> defaultFactory() {
4040
return OversizedChunkAccessors.DEFAULT_FACTORY;
4141
}
4242

43+
/// Returns an empty factory. It returns an empty accessor for any Anvil file.
44+
static Function<Path, OversizedChunkAccessor> emptyFactory() {
45+
return OversizedChunkAccessors.EMPTY_FACTORY;
46+
}
47+
4348
/// Returns an accessor for the oversized chunk file for a given chunk in an Anvil file.
4449
///
4550
/// If the file name is matched by the pattern `r.<regionX>.<regionZ>.mca`, where `<regionX>` and `<regionZ>` are integers, returns an accessor for the oversized chunk file;

0 commit comments

Comments
 (0)