Merge remote-tracking branch 'upstream/master' into position-cleanup

This commit is contained in:
Németh Noel 2021-05-07 02:55:22 +02:00
commit 443a097984
3 changed files with 17 additions and 19 deletions

View File

@ -5,7 +5,7 @@ plugins {
id 'java'
id 'maven-publish'
id 'net.ltgt.apt' version '0.10'
id 'org.jetbrains.kotlin.jvm' version '1.4.21'
id 'org.jetbrains.kotlin.jvm' version '1.5.0'
id 'checkstyle'
}

View File

@ -417,22 +417,18 @@ public abstract class Chunk implements Viewable, Tickable, DataContainer {
UpdateLightPacket updateLightPacket = new UpdateLightPacket(getIdentifier(), getLastChangeTime());
updateLightPacket.chunkX = getChunkX();
updateLightPacket.chunkZ = getChunkZ();
updateLightPacket.skyLightMask = 0x3FFF0;
updateLightPacket.blockLightMask = 0x3F;
updateLightPacket.emptySkyLightMask = 0x0F;
updateLightPacket.emptyBlockLightMask = 0x3FFC0;
updateLightPacket.skyLightMask = 0b111111111111111111;
updateLightPacket.emptySkyLightMask = 0b000000000000000000;
updateLightPacket.blockLightMask = 0b000000000000000000;
updateLightPacket.emptyBlockLightMask = 0b111111111111111111;
byte[] bytes = new byte[2048];
Arrays.fill(bytes, (byte) 0xFF);
List<byte[]> temp = new ArrayList<>(14);
List<byte[]> temp2 = new ArrayList<>(6);
for (int i = 0; i < 14; ++i) {
final List<byte[]> temp = new ArrayList<>(18);
for (int i = 0; i < 18; ++i) {
temp.add(bytes);
}
for (int i = 0; i < 6; ++i) {
temp2.add(bytes);
}
updateLightPacket.skyLight = temp;
updateLightPacket.blockLight = temp2;
updateLightPacket.blockLight = new ArrayList<>(0);
return updateLightPacket;
}

View File

@ -99,13 +99,15 @@ public class BlockPlacementListener {
blockPosition.add(offsetX, offsetY, offsetZ);
if (!canPlaceBlock) {
//Send a block change with AIR as block to keep the client in sync,
//using refreshChunk results in the client not being in sync
//after rapid invalid block placements
BlockChangePacket blockChangePacket = new BlockChangePacket();
blockChangePacket.blockPosition = blockPosition;
blockChangePacket.blockStateId = Block.AIR.getBlockId();
player.getPlayerConnection().sendPacket(blockChangePacket);
if (useMaterial.isBlock()) {
//Send a block change with AIR as block to keep the client in sync,
//using refreshChunk results in the client not being in sync
//after rapid invalid block placements
BlockChangePacket blockChangePacket = new BlockChangePacket();
blockChangePacket.blockPosition = blockPosition;
blockChangePacket.blockStateId = Block.AIR.getBlockId();
player.getPlayerConnection().sendPacket(blockChangePacket);
}
return;
}