mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-12-19 14:59:27 +00:00
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
This commit is contained in:
@@ -72,9 +72,9 @@ public enum Direction {
|
|||||||
return axis == Axis.X || axis == Axis.Z;
|
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) {
|
for (Direction direction : VALUES) {
|
||||||
if (direction.mcpl == pistonValue) {
|
if (direction.mcpl == mcpl) {
|
||||||
return direction;
|
return direction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import lombok.Setter;
|
|||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
import org.geysermc.geyser.level.block.type.Block;
|
import org.geysermc.geyser.level.block.type.Block;
|
||||||
import org.geysermc.geyser.level.chunk.GeyserChunk;
|
import org.geysermc.geyser.level.chunk.GeyserChunk;
|
||||||
|
import org.geysermc.geyser.registry.BlockRegistries;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.util.MathUtils;
|
import org.geysermc.geyser.util.MathUtils;
|
||||||
import org.geysermc.mcprotocollib.protocol.data.game.chunk.DataPalette;
|
import org.geysermc.mcprotocollib.protocol.data.game.chunk.DataPalette;
|
||||||
@@ -89,9 +90,7 @@ public class ChunkCache {
|
|||||||
previouslyEmpty = true;
|
previouslyEmpty = true;
|
||||||
if (block != Block.JAVA_AIR_ID) {
|
if (block != Block.JAVA_AIR_ID) {
|
||||||
// A previously empty chunk, which is no longer empty as a block has been added to it
|
// A previously empty chunk, which is no longer empty as a block has been added to it
|
||||||
palette = DataPalette.createForChunk();
|
palette = DataPalette.createForBlockState(Block.JAVA_AIR_ID, BlockRegistries.BLOCK_STATES.get().size());
|
||||||
// Fixes the chunk assuming that all blocks is the `block` variable we are updating. /shrug
|
|
||||||
palette.getPalette().stateToId(Block.JAVA_AIR_ID);
|
|
||||||
chunk.sections()[(y - minY) >> 4] = palette;
|
chunk.sections()[(y - minY) >> 4] = palette;
|
||||||
} else {
|
} else {
|
||||||
// Nothing to update
|
// Nothing to update
|
||||||
|
|||||||
@@ -80,4 +80,9 @@ public interface JavaRegistry<T> {
|
|||||||
* All values of this registry, as a list.
|
* All values of this registry, as a list.
|
||||||
*/
|
*/
|
||||||
List<T> values();
|
List<T> values();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of values registered in this registry.
|
||||||
|
*/
|
||||||
|
int size();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,6 +108,11 @@ public class SimpleJavaRegistry<T> implements JavaRegistry<T> {
|
|||||||
return this.values.stream().map(RegistryEntryData::data).toList();
|
return this.values.stream().map(RegistryEntryData::data).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int size() {
|
||||||
|
return values.size();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.values.toString();
|
return this.values.toString();
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ import org.geysermc.geyser.level.chunk.bitarray.BitArrayVersion;
|
|||||||
import org.geysermc.geyser.level.chunk.bitarray.SingletonBitArray;
|
import org.geysermc.geyser.level.chunk.bitarray.SingletonBitArray;
|
||||||
import org.geysermc.geyser.registry.BlockRegistries;
|
import org.geysermc.geyser.registry.BlockRegistries;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
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.BiomeTranslator;
|
||||||
import org.geysermc.geyser.translator.level.block.entity.BedrockChunkWantsBlockEntityTag;
|
import org.geysermc.geyser.translator.level.block.entity.BedrockChunkWantsBlockEntityTag;
|
||||||
import org.geysermc.geyser.translator.level.block.entity.BlockEntityTranslator;
|
import org.geysermc.geyser.translator.level.block.entity.BlockEntityTranslator;
|
||||||
@@ -120,8 +121,9 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator<Clientbo
|
|||||||
ByteBuf in = Unpooled.wrappedBuffer(packet.getChunkData());
|
ByteBuf in = Unpooled.wrappedBuffer(packet.getChunkData());
|
||||||
boolean extendedCollisionNextSection = false;
|
boolean extendedCollisionNextSection = false;
|
||||||
for (int sectionY = 0; sectionY < chunkSize; sectionY++) {
|
for (int sectionY = 0; sectionY < chunkSize; sectionY++) {
|
||||||
ChunkSection javaSection = MinecraftTypes.readChunkSection(in);
|
ChunkSection javaSection = MinecraftTypes.readChunkSection(in, BlockRegistries.BLOCK_STATES.get().size(),
|
||||||
javaChunks[sectionY] = javaSection.getChunkData();
|
session.getRegistryCache().registry(JavaRegistries.BIOME).size());
|
||||||
|
javaChunks[sectionY] = javaSection.getBlockData();
|
||||||
javaBiomes[sectionY] = javaSection.getBiomeData();
|
javaBiomes[sectionY] = javaSection.getBiomeData();
|
||||||
boolean extendedCollision = extendedCollisionNextSection;
|
boolean extendedCollision = extendedCollisionNextSection;
|
||||||
boolean thisExtendedCollisionNextSection = false;
|
boolean thisExtendedCollisionNextSection = false;
|
||||||
@@ -163,8 +165,8 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator<Clientbo
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Palette javaPalette = javaSection.getChunkData().getPalette();
|
Palette javaPalette = javaSection.getBlockData().getPalette();
|
||||||
BitStorage javaData = javaSection.getChunkData().getStorage();
|
BitStorage javaData = javaSection.getBlockData().getStorage();
|
||||||
|
|
||||||
if (javaPalette instanceof GlobalPalette) {
|
if (javaPalette instanceof GlobalPalette) {
|
||||||
// As this is the global palette, simply iterate through the whole chunk section once
|
// As this is the global palette, simply iterate through the whole chunk section once
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ protocol-common = "3.0.0.Beta7-20250812.232642-18"
|
|||||||
protocol-codec = "3.0.0.Beta7-20250812.232642-18"
|
protocol-codec = "3.0.0.Beta7-20250812.232642-18"
|
||||||
raknet = "1.0.0.CR3-20250811.214335-20"
|
raknet = "1.0.0.CR3-20250811.214335-20"
|
||||||
minecraftauth = "4.1.1"
|
minecraftauth = "4.1.1"
|
||||||
mcprotocollib = "1.21.7-20250911.173407-5"
|
mcprotocollib = "1.21.7-20250915.111046-6"
|
||||||
adventure = "4.24.0"
|
adventure = "4.24.0"
|
||||||
adventure-platform = "4.3.0"
|
adventure-platform = "4.3.0"
|
||||||
junit = "5.9.2"
|
junit = "5.9.2"
|
||||||
|
|||||||
Reference in New Issue
Block a user