Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-08 17:20:24 +01:00
Merge pull request #1310 from Gerrygames/master
Faster light writing
Dieser Commit ist enthalten in:
Commit
85067b2574
@ -3,7 +3,6 @@ package us.myles.ViaVersion.protocols.protocol1_14to1_13_2.packets;
|
|||||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.LongArrayTag;
|
import com.github.steveice10.opennbt.tag.builtin.LongArrayTag;
|
||||||
import com.google.common.primitives.Bytes;
|
import com.google.common.primitives.Bytes;
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.entities.Entity1_14Types;
|
import us.myles.ViaVersion.api.entities.Entity1_14Types;
|
||||||
import us.myles.ViaVersion.api.minecraft.BlockChangeRecord;
|
import us.myles.ViaVersion.api.minecraft.BlockChangeRecord;
|
||||||
@ -189,21 +188,11 @@ public class WorldPackets {
|
|||||||
lightPacket.write(Type.VAR_INT, 0); //TODO
|
lightPacket.write(Type.VAR_INT, 0); //TODO
|
||||||
for (ChunkSection section : chunk.getSections()) {
|
for (ChunkSection section : chunk.getSections()) {
|
||||||
if (section == null || !section.hasSkyLight()) continue;
|
if (section == null || !section.hasSkyLight()) continue;
|
||||||
ByteBuf buf = wrapper.user().getChannel().alloc().buffer();
|
lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(section.getSkyLight()).toArray(new Byte[0]));
|
||||||
section.writeSkyLight(buf);
|
|
||||||
byte[] data = new byte[buf.readableBytes()];
|
|
||||||
buf.readBytes(data);
|
|
||||||
buf.release();
|
|
||||||
lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(data).toArray(new Byte[0]));
|
|
||||||
}
|
}
|
||||||
for (ChunkSection section : chunk.getSections()) {
|
for (ChunkSection section : chunk.getSections()) {
|
||||||
if (section == null) continue;
|
if (section == null) continue;
|
||||||
ByteBuf buf = wrapper.user().getChannel().alloc().buffer();
|
lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(section.getBlockLight()).toArray(new Byte[0]));
|
||||||
section.writeBlockLight(buf);
|
|
||||||
byte[] data = new byte[buf.readableBytes()];
|
|
||||||
buf.readBytes(data);
|
|
||||||
buf.release();
|
|
||||||
lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(data).toArray(new Byte[0]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
|
EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren