Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
client doesn't work as expected
Browse files Browse the repository at this point in the history
  • Loading branch information
iam4722202468 committed Feb 7, 2024
1 parent 9fa936a commit 288d8d3
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/main/java/net/minestom/server/instance/LightingChunk.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,17 @@ protected LightData createLightData() {
Set<Chunk> combined = new HashSet<>();
int chunkMin = instance.getDimensionType().getMinY();

int highestRegionPoint = instance.getDimensionType().getMinY();
for (int x = chunkX - 1; x <= chunkX + 1; x++) {
for (int z = chunkZ - 1; z <= chunkZ + 1; z++) {
Chunk chunk = instance.getChunk(x, z);
if (chunk instanceof LightingChunk light) {
light.getHeightmap();
if (light.highestBlock > highestRegionPoint) highestRegionPoint = light.highestBlock;
}
}
}

int index = 0;
for (Section section : sections) {
boolean wasUpdatedBlock = false;
Expand Down Expand Up @@ -222,7 +233,7 @@ protected LightData createLightData() {
final byte[] blockLight = section.blockLight().array();
final int sectionMaxY = index * 16 + chunkMin;

if ((wasUpdatedSky) && this.instance.getDimensionType().isSkylightEnabled() && sectionMaxY <= (highestBlock + 16)) {
if ((wasUpdatedSky) && this.instance.getDimensionType().isSkylightEnabled() && sectionMaxY <= (highestRegionPoint + 16)) {
if (skyLight.length != 0 && skyLight != emptyContent) {
skyLights.add(skyLight);
skyMask.set(index);
Expand Down Expand Up @@ -355,8 +366,8 @@ private static Set<Point> getNearbyRequired(Instance instance, Point point, Ligh

for (int y = point.blockY() - 1; y <= point.blockY() + 1; y++) {
Point sectionPosition = new Vec(x, y, z);
int sectionHeight = instance.getDimensionType().getMinY() + 16 * y;
if ((sectionHeight + 16) > highestRegionPoint && type == LightType.SKY) continue;
// int sectionHeight = instance.getDimensionType().getMinY() + 16 * y;
// if ((sectionHeight + 16) > highestRegionPoint && type == LightType.SKY) continue;

if (sectionPosition.blockY() < chunkCheck.getMaxSection() && sectionPosition.blockY() >= chunkCheck.getMinSection()) {
Section s = chunkCheck.getSection(sectionPosition.blockY());
Expand Down

0 comments on commit 288d8d3

Please sign in to comment.