Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public boolean isHorizontal() {
return axis == Axis.X || axis == Axis.Z;
}

public static @NonNull Direction fromMCPL(org.geysermc.mcprotocollib.protocol.data.game.entity.object.Direction pistonValue) {
public static @NonNull Direction fromMCPL(org.geysermc.mcprotocollib.protocol.data.game.entity.object.Direction mcpl) {
for (Direction direction : VALUES) {
if (direction.mcpl == pistonValue) {
if (direction.mcpl == mcpl) {
return direction;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.level.block.type.Block;
import org.geysermc.geyser.level.chunk.GeyserChunk;
import org.geysermc.geyser.registry.BlockRegistries;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.util.MathUtils;
import org.geysermc.mcprotocollib.protocol.data.game.chunk.DataPalette;
Expand Down Expand Up @@ -89,9 +90,7 @@ public void updateBlock(int x, int y, int z, int block) {
previouslyEmpty = true;
if (block != Block.JAVA_AIR_ID) {
// A previously empty chunk, which is no longer empty as a block has been added to it
palette = DataPalette.createForChunk();
// Fixes the chunk assuming that all blocks is the `block` variable we are updating. /shrug
palette.getPalette().stateToId(Block.JAVA_AIR_ID);
palette = DataPalette.createForBlockState(Block.JAVA_AIR_ID, BlockRegistries.BLOCK_STATES.get().size());
chunk.sections()[(y - minY) >> 4] = palette;
} else {
// Nothing to update
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,9 @@ public interface JavaRegistry<T> {
* All values of this registry, as a list.
*/
List<T> values();

/**
* The amount of values registered in this registry.
*/
int size();
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ public List<T> values() {
return this.values.stream().map(RegistryEntryData::data).toList();
}

@Override
public int size() {
return values.size();
}

@Override
public String toString() {
return this.values.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.geysermc.geyser.level.chunk.bitarray.SingletonBitArray;
import org.geysermc.geyser.registry.BlockRegistries;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.session.cache.registry.JavaRegistries;
import org.geysermc.geyser.translator.level.BiomeTranslator;
import org.geysermc.geyser.translator.level.block.entity.BedrockChunkWantsBlockEntityTag;
import org.geysermc.geyser.translator.level.block.entity.BlockEntityTranslator;
Expand Down Expand Up @@ -120,8 +121,9 @@ public void translate(GeyserSession session, ClientboundLevelChunkWithLightPacke
ByteBuf in = Unpooled.wrappedBuffer(packet.getChunkData());
boolean extendedCollisionNextSection = false;
for (int sectionY = 0; sectionY < chunkSize; sectionY++) {
ChunkSection javaSection = MinecraftTypes.readChunkSection(in);
javaChunks[sectionY] = javaSection.getChunkData();
ChunkSection javaSection = MinecraftTypes.readChunkSection(in, BlockRegistries.BLOCK_STATES.get().size(),
session.getRegistryCache().registry(JavaRegistries.BIOME).size());
javaChunks[sectionY] = javaSection.getBlockData();
javaBiomes[sectionY] = javaSection.getBiomeData();
boolean extendedCollision = extendedCollisionNextSection;
boolean thisExtendedCollisionNextSection = false;
Expand Down Expand Up @@ -163,8 +165,8 @@ public void translate(GeyserSession session, ClientboundLevelChunkWithLightPacke
continue;
}

Palette javaPalette = javaSection.getChunkData().getPalette();
BitStorage javaData = javaSection.getChunkData().getStorage();
Palette javaPalette = javaSection.getBlockData().getPalette();
BitStorage javaData = javaSection.getBlockData().getStorage();

if (javaPalette instanceof GlobalPalette) {
// As this is the global palette, simply iterate through the whole chunk section once
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ protocol-common = "3.0.0.Beta7-20250812.232642-18"
protocol-codec = "3.0.0.Beta7-20250812.232642-18"
raknet = "1.0.0.CR3-20250811.214335-20"
minecraftauth = "4.1.1"
mcprotocollib = "1.21.7-20250911.173407-5"
mcprotocollib = "1.21.7-20250915.111046-6"
adventure = "4.24.0"
adventure-platform = "4.3.0"
junit = "5.9.2"
Expand Down