Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-03 14:50:19 +01:00
Remove obsolete chunk writing code
Dieser Commit ist enthalten in:
Ursprung
7a0a6795d0
Commit
e43a143bf4
@ -43,7 +43,6 @@ import com.nukkitx.nbt.NbtMap;
|
|||||||
import com.nukkitx.nbt.NbtUtils;
|
import com.nukkitx.nbt.NbtUtils;
|
||||||
import com.nukkitx.network.VarInts;
|
import com.nukkitx.network.VarInts;
|
||||||
import com.nukkitx.protocol.bedrock.packet.LevelChunkPacket;
|
import com.nukkitx.protocol.bedrock.packet.LevelChunkPacket;
|
||||||
import com.nukkitx.protocol.bedrock.v503.Bedrock_v503;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.ByteBufAllocator;
|
import io.netty.buffer.ByteBufAllocator;
|
||||||
import io.netty.buffer.ByteBufOutputStream;
|
import io.netty.buffer.ByteBufOutputStream;
|
||||||
@ -52,6 +51,7 @@ import it.unimi.dsi.fastutil.ints.IntList;
|
|||||||
import it.unimi.dsi.fastutil.ints.IntLists;
|
import it.unimi.dsi.fastutil.ints.IntLists;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
import org.geysermc.geyser.entity.type.ItemFrameEntity;
|
import org.geysermc.geyser.entity.type.ItemFrameEntity;
|
||||||
|
import org.geysermc.geyser.level.BedrockDimension;
|
||||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||||
import org.geysermc.geyser.level.chunk.BlockStorage;
|
import org.geysermc.geyser.level.chunk.BlockStorage;
|
||||||
import org.geysermc.geyser.level.chunk.GeyserChunkSection;
|
import org.geysermc.geyser.level.chunk.GeyserChunkSection;
|
||||||
@ -60,7 +60,6 @@ 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.level.BedrockDimension;
|
|
||||||
import org.geysermc.geyser.translator.level.BiomeTranslator;
|
import org.geysermc.geyser.translator.level.BiomeTranslator;
|
||||||
import org.geysermc.geyser.translator.level.block.entity.BedrockOnlyBlockEntity;
|
import org.geysermc.geyser.translator.level.block.entity.BedrockOnlyBlockEntity;
|
||||||
import org.geysermc.geyser.translator.level.block.entity.BlockEntityTranslator;
|
import org.geysermc.geyser.translator.level.block.entity.BlockEntityTranslator;
|
||||||
@ -76,7 +75,8 @@ import java.util.BitSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.geysermc.geyser.util.ChunkUtils.*;
|
import static org.geysermc.geyser.util.ChunkUtils.SERIALIZED_CHUNK_DATA;
|
||||||
|
import static org.geysermc.geyser.util.ChunkUtils.indexYZXtoXZY;
|
||||||
|
|
||||||
@Translator(packet = ClientboundLevelChunkWithLightPacket.class)
|
@Translator(packet = ClientboundLevelChunkWithLightPacket.class)
|
||||||
public class JavaLevelChunkWithLightTranslator extends PacketTranslator<ClientboundLevelChunkWithLightPacket> {
|
public class JavaLevelChunkWithLightTranslator extends PacketTranslator<ClientboundLevelChunkWithLightPacket> {
|
||||||
@ -312,10 +312,8 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator<Clientbo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// As of 1.18.0, Bedrock hardcodes to always read 25 biome sections
|
// As of 1.18.30, the amount of biomes read is dependent on how high Bedrock thinks the dimension is
|
||||||
// As of 1.18.30, the hardcode may now be tied to the dimension definition
|
int biomeCount = bedrockDimension.height() >> 4;
|
||||||
boolean isNewVersion = session.getUpstream().getProtocolVersion() >= Bedrock_v503.V503_CODEC.getProtocolVersion();
|
|
||||||
int biomeCount = isNewVersion ? bedrockDimension.height() >> 4 : 25;
|
|
||||||
int dimensionOffset = bedrockDimension.minY() >> 4;
|
int dimensionOffset = bedrockDimension.minY() >> 4;
|
||||||
for (int i = 0; i < biomeCount; i++) {
|
for (int i = 0; i < biomeCount; i++) {
|
||||||
int biomeYOffset = dimensionOffset + i;
|
int biomeYOffset = dimensionOffset + i;
|
||||||
@ -326,13 +324,8 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator<Clientbo
|
|||||||
}
|
}
|
||||||
if (biomeYOffset >= (chunkSize + yOffset)) {
|
if (biomeYOffset >= (chunkSize + yOffset)) {
|
||||||
// This biome section goes above the height of the Java world
|
// This biome section goes above the height of the Java world
|
||||||
if (isNewVersion) {
|
// The byte written here is a header that says to carry on the biome data from the previous chunk
|
||||||
// A header that says to carry on the biome data from the previous chunk
|
|
||||||
// This notably fixes biomes in the End
|
|
||||||
byteBuf.writeByte((127 << 1) | 1);
|
byteBuf.writeByte((127 << 1) | 1);
|
||||||
} else {
|
|
||||||
byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA);
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren