Skip to content

Commit

Permalink
finally found the missing link to #9
Browse files Browse the repository at this point in the history
  • Loading branch information
FalsePattern committed Jun 3, 2022
1 parent a47a625 commit 3d2b9c5
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,42 @@ private int incrementYValue0(int y) {
return y + 1;
}

int countS;
int countB;
float sky;
float block;

private void addLight(int light) {
int S = light & 0xff;
int B = (light & 0xff0000) >>> 16;
if (S != 0) {
sky += S;
countS++;
}
if (B != 0) {
block += B;
countB++;
}
}

@Inject(method = "getAoBrightness",
at = @At(value = "HEAD"),
cancellable = true,
require = 1)
private void betterCompute(int a, int b, int c, int d, CallbackInfoReturnable<Integer> cir) {
countS = 0;
countB = 0;
sky = 0;
block = 0;
addLight(a);
addLight(b);
addLight(c);
addLight(d);
sky /= countS;
block /= countB;
cir.setReturnValue((((int)sky) & 0xff) | ((((int)block) & 0xff) << 16));
}

/**
* @author embeddedt
*/
Expand Down

0 comments on commit 3d2b9c5

Please sign in to comment.