Skip to content

Commit ea6ef16

Browse files
committed
make newMCAFile public / check if palette is null
1 parent 5d80a38 commit ea6ef16

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/main/java/net/querz/mca/MCAUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public static int chunkToBlock(int chunk) {
191191

192192
private static final Pattern mcaFilePattern = Pattern.compile("^.*r\\.(?<regionX>-?\\d+)\\.(?<regionZ>-?\\d+)\\.mca$");
193193

194-
private static MCAFile newMCAFile(File file) {
194+
public static MCAFile newMCAFile(File file) {
195195
Matcher m = mcaFilePattern.matcher(file.getName());
196196
if (m.find()) {
197197
return new MCAFile(Integer.parseInt(m.group("regionX")), Integer.parseInt(m.group("regionZ")));

src/main/java/net/querz/mca/Section.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,18 @@ public static Section newSection() {
371371
*/
372372
public CompoundTag updateHandle(int y) {
373373
data.putByte("Y", (byte) y);
374-
data.put("Palette", palette);
375-
if (blockLight != null) data.putByteArray("BlockLight", blockLight);
376-
data.putLongArray("BlockStates", blockStates);
377-
if (skyLight != null) data.putByteArray("SkyLight", skyLight);
374+
if (palette != null) {
375+
data.put("Palette", palette);
376+
}
377+
if (blockLight != null) {
378+
data.putByteArray("BlockLight", blockLight);
379+
}
380+
if (blockStates != null) {
381+
data.putLongArray("BlockStates", blockStates);
382+
}
383+
if (skyLight != null) {
384+
data.putByteArray("SkyLight", skyLight);
385+
}
378386
return data;
379387
}
380388
}

0 commit comments

Comments
 (0)