Skip to content

Commit

Permalink
fix: grass -> small_grass when reading
Browse files Browse the repository at this point in the history
  • Loading branch information
mworzala committed Dec 19, 2023
1 parent 9767456 commit a2c7ebc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ metadata.format.version = "1.1"

[versions]
minestom = "9f3ee89506"
minestomSnapshot = "1_20_2-909719b369"
minestomSnapshot = "1_20_4-2e8a2863a3"
zstd = "1.5.5-3"
fastutil = "8.5.12"

Expand Down
7 changes: 7 additions & 0 deletions src/main/java/net/hollowcube/polar/PolarReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.luben.zstd.Zstd;
import net.minestom.server.network.NetworkBuffer;
import net.minestom.server.utils.NamespaceID;
import net.minestom.server.utils.chunk.ChunkUtils;
import net.minestom.server.utils.validate.Check;
import org.jetbrains.annotations.Contract;
Expand Down Expand Up @@ -89,6 +90,12 @@ private PolarReader() {}
if (buffer.read(BOOLEAN)) return new PolarSection();

var blockPalette = buffer.readCollection(STRING).toArray(String[]::new);
if (version <= PolarWorld.VERSION_SHORT_GRASS) {
for (int i = 0; i < blockPalette.length; i++) {
if (NamespaceID.from(blockPalette[i]).path().equals("grass"))
blockPalette[i] = "short_grass";
}
}
int[] blockData = null;
if (blockPalette.length > 1) {
blockData = new int[PolarSection.BLOCK_PALETTE_SIZE];
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/hollowcube/polar/PolarWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class PolarWorld {
static final short VERSION_USERDATA_OPT_BLOCK_ENT_NBT = 2;
static final short VERSION_MINESTOM_NBT_READ_BREAK = 3;
static final short VERSION_WORLD_USERDATA = 4;
static final short VERSION_SHORT_GRASS = 5; // >:(

public static CompressionType DEFAULT_COMPRESSION = CompressionType.ZSTD;

Expand Down

0 comments on commit a2c7ebc

Please sign in to comment.