Skip to content

Commit 9f8bc9d

Browse files
Bump MCPL for data palette fixes (#5818)
* Update chunk loading for MCPL changes * Adjust for renames in MCPL * Bump MCPL * Rename this just because I can
1 parent 6690e75 commit 9f8bc9d

File tree

6 files changed

+21
-10
lines changed

6 files changed

+21
-10
lines changed

core/src/main/java/org/geysermc/geyser/level/physics/Direction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ public boolean isHorizontal() {
7272
return axis == Axis.X || axis == Axis.Z;
7373
}
7474

75-
public static @NonNull Direction fromMCPL(org.geysermc.mcprotocollib.protocol.data.game.entity.object.Direction pistonValue) {
75+
public static @NonNull Direction fromMCPL(org.geysermc.mcprotocollib.protocol.data.game.entity.object.Direction mcpl) {
7676
for (Direction direction : VALUES) {
77-
if (direction.mcpl == pistonValue) {
77+
if (direction.mcpl == mcpl) {
7878
return direction;
7979
}
8080
}

core/src/main/java/org/geysermc/geyser/session/cache/ChunkCache.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.geysermc.geyser.GeyserImpl;
3232
import org.geysermc.geyser.level.block.type.Block;
3333
import org.geysermc.geyser.level.chunk.GeyserChunk;
34+
import org.geysermc.geyser.registry.BlockRegistries;
3435
import org.geysermc.geyser.session.GeyserSession;
3536
import org.geysermc.geyser.util.MathUtils;
3637
import org.geysermc.mcprotocollib.protocol.data.game.chunk.DataPalette;
@@ -89,9 +90,7 @@ public void updateBlock(int x, int y, int z, int block) {
8990
previouslyEmpty = true;
9091
if (block != Block.JAVA_AIR_ID) {
9192
// A previously empty chunk, which is no longer empty as a block has been added to it
92-
palette = DataPalette.createForChunk();
93-
// Fixes the chunk assuming that all blocks is the `block` variable we are updating. /shrug
94-
palette.getPalette().stateToId(Block.JAVA_AIR_ID);
93+
palette = DataPalette.createForBlockState(Block.JAVA_AIR_ID, BlockRegistries.BLOCK_STATES.get().size());
9594
chunk.sections()[(y - minY) >> 4] = palette;
9695
} else {
9796
// Nothing to update

core/src/main/java/org/geysermc/geyser/session/cache/registry/JavaRegistry.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,9 @@ public interface JavaRegistry<T> {
8080
* All values of this registry, as a list.
8181
*/
8282
List<T> values();
83+
84+
/**
85+
* The amount of values registered in this registry.
86+
*/
87+
int size();
8388
}

core/src/main/java/org/geysermc/geyser/session/cache/registry/SimpleJavaRegistry.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ public List<T> values() {
108108
return this.values.stream().map(RegistryEntryData::data).toList();
109109
}
110110

111+
@Override
112+
public int size() {
113+
return values.size();
114+
}
115+
111116
@Override
112117
public String toString() {
113118
return this.values.toString();

core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import org.geysermc.geyser.level.chunk.bitarray.SingletonBitArray;
5454
import org.geysermc.geyser.registry.BlockRegistries;
5555
import org.geysermc.geyser.session.GeyserSession;
56+
import org.geysermc.geyser.session.cache.registry.JavaRegistries;
5657
import org.geysermc.geyser.translator.level.BiomeTranslator;
5758
import org.geysermc.geyser.translator.level.block.entity.BedrockChunkWantsBlockEntityTag;
5859
import org.geysermc.geyser.translator.level.block.entity.BlockEntityTranslator;
@@ -120,8 +121,9 @@ public void translate(GeyserSession session, ClientboundLevelChunkWithLightPacke
120121
ByteBuf in = Unpooled.wrappedBuffer(packet.getChunkData());
121122
boolean extendedCollisionNextSection = false;
122123
for (int sectionY = 0; sectionY < chunkSize; sectionY++) {
123-
ChunkSection javaSection = MinecraftTypes.readChunkSection(in);
124-
javaChunks[sectionY] = javaSection.getChunkData();
124+
ChunkSection javaSection = MinecraftTypes.readChunkSection(in, BlockRegistries.BLOCK_STATES.get().size(),
125+
session.getRegistryCache().registry(JavaRegistries.BIOME).size());
126+
javaChunks[sectionY] = javaSection.getBlockData();
125127
javaBiomes[sectionY] = javaSection.getBiomeData();
126128
boolean extendedCollision = extendedCollisionNextSection;
127129
boolean thisExtendedCollisionNextSection = false;
@@ -163,8 +165,8 @@ public void translate(GeyserSession session, ClientboundLevelChunkWithLightPacke
163165
continue;
164166
}
165167

166-
Palette javaPalette = javaSection.getChunkData().getPalette();
167-
BitStorage javaData = javaSection.getChunkData().getStorage();
168+
Palette javaPalette = javaSection.getBlockData().getPalette();
169+
BitStorage javaData = javaSection.getBlockData().getStorage();
168170

169171
if (javaPalette instanceof GlobalPalette) {
170172
// As this is the global palette, simply iterate through the whole chunk section once

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ protocol-common = "3.0.0.Beta7-20250812.232642-18"
1414
protocol-codec = "3.0.0.Beta7-20250812.232642-18"
1515
raknet = "1.0.0.CR3-20250811.214335-20"
1616
minecraftauth = "4.1.1"
17-
mcprotocollib = "1.21.7-20250911.173407-5"
17+
mcprotocollib = "1.21.7-20250915.111046-6"
1818
adventure = "4.24.0"
1919
adventure-platform = "4.3.0"
2020
junit = "5.9.2"

0 commit comments

Comments
 (0)