3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-20 06:50:09 +01:00

Remove unneeded retain

Dieser Commit ist enthalten in:
SupremeMortal 2023-04-20 10:45:23 +01:00
Ursprung 0f3d5c5859
Commit eaaba44e05
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: DDBB25F8EE4FA29A

Datei anzeigen

@ -312,8 +312,7 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator<Clientbo
size += bedrockBlockEntities.size() * 64; // Conservative estimate of 64 bytes per tile entity size += bedrockBlockEntities.size() * 64; // Conservative estimate of 64 bytes per tile entity
// Allocate output buffer // Allocate output buffer
byteBuf = ByteBufAllocator.DEFAULT.buffer(size); byteBuf = ByteBufAllocator.DEFAULT.ioBuffer(size);
byteBuf.retain();
for (int i = 0; i < sectionCount; i++) { for (int i = 0; i < sectionCount; i++) {
GeyserChunkSection section = sections[i]; GeyserChunkSection section = sections[i];
if (section != null) { if (section != null) {
@ -348,6 +347,7 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator<Clientbo
for (NbtMap blockEntity : bedrockBlockEntities) { for (NbtMap blockEntity : bedrockBlockEntities) {
nbtStream.writeTag(blockEntity); nbtStream.writeTag(blockEntity);
} }
byteBuf.retain();
} catch (IOException e) { } catch (IOException e) {
session.getGeyser().getLogger().error("IO error while encoding chunk", e); session.getGeyser().getLogger().error("IO error while encoding chunk", e);
return; return;
@ -362,7 +362,7 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator<Clientbo
levelChunkPacket.setCachingEnabled(false); levelChunkPacket.setCachingEnabled(false);
levelChunkPacket.setChunkX(packet.getX()); levelChunkPacket.setChunkX(packet.getX());
levelChunkPacket.setChunkZ(packet.getZ()); levelChunkPacket.setChunkZ(packet.getZ());
levelChunkPacket.setData(byteBuf.retain()); levelChunkPacket.setData(byteBuf);
session.sendUpstreamPacket(levelChunkPacket); session.sendUpstreamPacket(levelChunkPacket);
if (!lecterns.isEmpty()) { if (!lecterns.isEmpty()) {