From 1201c2979bc533f8299c3f6b470669fcd129fa86 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Thu, 20 May 2021 18:34:05 +0200 Subject: [PATCH] Update VV usage --- .../packets/BlockItemPackets1_14.java | 20 +++++++++++-------- .../Protocol1_16_4To1_17.java | 2 +- gradle/libs.versions.toml | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java index c0a75e8c..45b7f39b 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java @@ -28,6 +28,8 @@ import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.minecraft.Environment; import com.viaversion.viaversion.api.minecraft.chunks.Chunk; import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; +import com.viaversion.viaversion.api.minecraft.chunks.ChunkSectionLight; +import com.viaversion.viaversion.api.minecraft.chunks.ChunkSectionLightImpl; import com.viaversion.viaversion.api.minecraft.entities.Entity1_14Types; import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.item.Item; @@ -439,27 +441,29 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit ChunkSection section = chunk.getSections()[i]; if (section == null) continue; + ChunkSectionLight sectionLight = new ChunkSectionLightImpl(); + section.setLight(sectionLight); if (chunkLight == null) { - section.setBlockLight(ChunkLightStorage.FULL_LIGHT); + sectionLight.setBlockLight(ChunkLightStorage.FULL_LIGHT); if (clientWorld.getEnvironment() == Environment.NORMAL) { - section.setSkyLight(ChunkLightStorage.FULL_LIGHT); + sectionLight.setSkyLight(ChunkLightStorage.FULL_LIGHT); } } else { - final byte[] blockLight = chunkLight.getBlockLight()[i]; - section.setBlockLight(blockLight != null ? blockLight : ChunkLightStorage.FULL_LIGHT); + byte[] blockLight = chunkLight.getBlockLight()[i]; + sectionLight.setBlockLight(blockLight != null ? blockLight : ChunkLightStorage.FULL_LIGHT); if (clientWorld.getEnvironment() == Environment.NORMAL) { - final byte[] skyLight = chunkLight.getSkyLight()[i]; - section.setSkyLight(skyLight != null ? skyLight : ChunkLightStorage.FULL_LIGHT); + byte[] skyLight = chunkLight.getSkyLight()[i]; + sectionLight.setSkyLight(skyLight != null ? skyLight : ChunkLightStorage.FULL_LIGHT); } } - if (Via.getConfig().isNonFullBlockLightFix() && section.getNonAirBlocksCount() != 0 && section.hasBlockLight()) { + if (Via.getConfig().isNonFullBlockLightFix() && section.getNonAirBlocksCount() != 0 && sectionLight.hasBlockLight()) { for (int x = 0; x < 16; x++) { for (int y = 0; y < 16; y++) { for (int z = 0; z < 16; z++) { int id = section.getFlatBlock(x, y, z); if (Protocol1_14To1_13_2.MAPPINGS.getNonFullBlocks().contains(id)) { - section.getBlockLightNibbleArray().set(x, y, z, 0); + sectionLight.getBlockLightNibbleArray().set(x, y, z, 0); } } } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/Protocol1_16_4To1_17.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/Protocol1_16_4To1_17.java index 04752406..a79b9022 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/Protocol1_16_4To1_17.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/Protocol1_16_4To1_17.java @@ -137,7 +137,7 @@ public class Protocol1_16_4To1_17 extends BackwardsProtocol