Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
Write linear palette as map palette for now
Dieser Commit ist enthalten in:
Ursprung
bfe6389377
Commit
eaa18f569a
@ -101,7 +101,9 @@ public class ChunkSectionType1_18 extends Type<ChunkSection> {
|
||||
}
|
||||
|
||||
private void writePalette(final ByteBuf buffer, final DataPalette palette) {
|
||||
int bitsPerValue = 0;
|
||||
int bitsPerValue;
|
||||
if (palette.size() > 1) {
|
||||
bitsPerValue = palette.type() == PaletteType.BLOCKS ? 4 : 2; //TODO implement linear palette
|
||||
while (palette.size() > 1 << bitsPerValue) {
|
||||
bitsPerValue += 1;
|
||||
}
|
||||
@ -109,6 +111,9 @@ public class ChunkSectionType1_18 extends Type<ChunkSection> {
|
||||
if (bitsPerValue > palette.type().highestBitsPerValue()) {
|
||||
bitsPerValue = GLOBAL_PALETTE;
|
||||
}
|
||||
} else {
|
||||
bitsPerValue = 0;
|
||||
}
|
||||
|
||||
buffer.writeByte(bitsPerValue);
|
||||
|
||||
|
@ -105,14 +105,6 @@ public final class WorldPackets {
|
||||
handler(wrapper -> {
|
||||
final EntityTracker tracker = protocol.getEntityRewriter().tracker(wrapper.user());
|
||||
final Chunk oldChunk = wrapper.read(new Chunk1_17Type(tracker.currentWorldSectionHeight()));
|
||||
/*for (int s = 0; s < chunk.getSections().length; s++) {
|
||||
ChunkSection section = chunk.getSections()[s];
|
||||
if (section == null) continue;
|
||||
for (int i = 0; i < section.getPaletteSize(); i++) {
|
||||
int old = section.getPaletteEntry(i);
|
||||
section.setPaletteEntry(i, protocol.getMappingData().getNewBlockStateId(old));
|
||||
}
|
||||
}*/
|
||||
|
||||
final List<BlockEntity> blockEntities = new ArrayList<>(oldChunk.getBlockEntities().size());
|
||||
for (final CompoundTag tag : oldChunk.getBlockEntities()) {
|
||||
@ -143,6 +135,12 @@ public final class WorldPackets {
|
||||
final DataPaletteImpl blockPalette = new DataPaletteImpl(PaletteType.BLOCKS);
|
||||
blockPalette.addEntry(0);
|
||||
section.addPalette(blockPalette);
|
||||
} else {
|
||||
/*final DataPalette blockpalette = section.palette(PaletteType.BLOCKS);
|
||||
for (int j = 0; j < blockpalette.size(); j++) {
|
||||
final int old = blockpalette.entry(j);
|
||||
blockpalette.setEntry(j, protocol.getMappingData().getNewBlockStateId(old));
|
||||
}*/
|
||||
}
|
||||
|
||||
// Fill biome palette
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren