VulkanShader_1.21.10-0.0.4-alpha.jar
Download file
package net.vulkanmod.render.chunk.build.light.data;
import java.util.Arrays;
import net.minecraft.class_1920;
import net.minecraft.class_2338;
import net.minecraft.class_4076;
public class ArrayLightDataCache extends LightDataAccess {
private static final int NEIGHBOR_BLOCK_RADIUS = 2;
private static final int BLOCK_LENGTH = 20;
private final int[] light = new int[8000];
private int xOffset;
private int yOffset;
private int zOffset;
public void reset(class_1920 blockAndTintGetter, int x, int y, int z) {
this.region = blockAndTintGetter;
this.xOffset = x - 2;
this.yOffset = y - 2;
this.zOffset = z - 2;
Arrays.fill(this.light, 0);
}
public void reset(class_1920 blockAndTintGetter, class_2338 origin) {
this.region = blockAndTintGetter;
this.xOffset = origin.method_10263() - 2;
this.yOffset = origin.method_10264() - 2;
this.zOffset = origin.method_10260() - 2;
Arrays.fill(this.light, 0);
}
public void reset(class_4076 origin) {
this.xOffset = origin.method_19527() - 2;
this.yOffset = origin.method_19528() - 2;
this.zOffset = origin.method_19529() - 2;
Arrays.fill(this.light, 0);
}
public void reset(class_2338 origin) {
this.xOffset = origin.method_10263() - 2;
this.yOffset = origin.method_10264() - 2;
this.zOffset = origin.method_10260() - 2;
Arrays.fill(this.light, 0);
}
private int index(int x, int y, int z) {
int x2 = x - this.xOffset;
int y2 = y - this.yOffset;
int z2 = z - this.zOffset;
return z2 * 20 * 20 + y2 * 20 + x2;
}
public int get(int x, int y, int z) {
int l = this.index(x, y, z);
int word = this.light[l];
return word != 0 ? word : (this.light[l] = this.compute(x, y, z));
}
}
Download file