Skip to content

Instantly share code, notes, and snippets.

@JonMagon
Last active January 19, 2021 15:41
Show Gist options
  • Save JonMagon/0723c1889c890a944f94aa1f51c6f4fe to your computer and use it in GitHub Desktop.
Save JonMagon/0723c1889c890a944f94aa1f51c6f4fe to your computer and use it in GitHub Desktop.
Minecraft Client Bars Render
private final Random rand = new Random();
private int m;
private void e(MatrixStack matrixStack) {
bfw bfw = k();
if (bfw == null)
return;
int i = afm.f(bfw.dk());
boolean bool = (this.G > this.m && (this.G - this.m) / 3L % 2L == 1L);
long l = x.b();
if (i < this.D && bfw.P > 0) {
this.F = l;
this.G = (this.m + 20);
} else if (i > this.D && bfw.P > 0) {
this.F = l;
this.G = (this.m + 10);
}
if (l - this.F > 1000L) {
this.D = i;
this.E = i;
this.F = l;
}
this.D = i;
int j = this.E;
this.rand.setSeed((this.m * 312871));
bhy bhy = bfw.eI();
int k = bhy.a();
int m = this.H / 2 - 91;
int n = this.H / 2 + 91;
int i1 = this.I - 39;
float f = (float)bfw.b(arl.a);
int i2 = afm.f(bfw.dT());
int i3 = afm.f((f + i2) / 2.0F / 10.0F);
int i4 = Math.max(10 - i3 - 2, 3);
int i5 = i1 - (i3 - 1) * i4 - 10;
int i6 = i1 - 10;
int i7 = i2;
int i8 = bfw.du();
int i9 = -1;
if (bfw.a(apw.j))
i9 = this.m % afm.f(f + 5.0F);
this.j.au().a("armor");
int i10;
for (i10 = 0; i10 < 10; i10++) {
if (i8 > 0) {
int uOffset = m + i10 * 8;
if (i10 * 2 + 1 < i8)
b(matrixStack, uOffset, i5, 34, 9, 9, 9);
if (i10 * 2 + 1 == i8)
b(matrixStack, uOffset, i5, 25, 9, 9, 9);
if (i10 * 2 + 1 > i8)
b(matrixStack, uOffset, i5, 16, 9, 9, 9);
}
}
this.j.au().b("health");
for (i10 = afm.f((f + i2) / 2.0F) - 1; i10 >= 0; i10--) {
int uOffset = 16;
if (bfw.a(apw.s)) {
uOffset += 36;
} else if (bfw.a(apw.t)) {
uOffset += 72;
}
int i15 = 0;
if (bool)
i15 = 1;
int i16 = afm.f((i10 + 1) / 10.0F) - 1;
int x = m + i10 % 10 * 8;
int y = i1 - i16 * i4;
if (i <= 4)
y += this.rand.nextInt(2);
if (i7 <= 0 && i10 == i9)
y -= 2;
int vOffset = 0;
if (bfw.l.h().n())
vOffset = 5;
b(matrixStack, x, y, 16 + i15 * 9, 9 * vOffset, 9, 9);
if (bool) {
if (i10 * 2 + 1 < j)
b(matrixStack, x, y, uOffset + 54, 9 * vOffset, 9, 9);
if (i10 * 2 + 1 == j)
b(matrixStack, x, y, uOffset + 63, 9 * vOffset, 9, 9);
}
if (i7 > 0) {
if (i7 == i2 && i2 % 2 == 1) {
b(matrixStack, x, y, uOffset + 153, 9 * vOffset, 9, 9);
i7--;
} else {
b(matrixStack, x, y, uOffset + 144, 9 * vOffset, 9, 9);
i7 -= 2;
}
} else {
if (i10 * 2 + 1 < i)
b(matrixStack, x, y, uOffset + 36, 9 * vOffset, 9, 9);
if (i10 * 2 + 1 == i)
b(matrixStack, x, y, uOffset + 45, 9 * vOffset, 9, 9);
}
}
aqm aqm = l();
int i11 = a(aqm);
if (i11 == 0) {
this.j.au().b("food");
for (int uOffset = 0; uOffset < 10; uOffset++) {
int i15 = i1;
int i16 = 16;
int x = 0;
if (bfw.a(apw.q)) {
i16 += 36;
x = 13;
}
if (bfw.eI().e() <= 0.0F &&
this.m % (k * 3 + 1) == 0)
i15 += this.rand.nextInt(3) - 1;
int y = n - uOffset * 8 - 9;
b(matrixStack, y, i15, 16 + x * 9, 27, 9, 9);
if (uOffset * 2 + 1 < k)
b(matrixStack, y, i15, i16 + 36, 27, 9, 9);
if (uOffset * 2 + 1 == k)
b(matrixStack, y, i15, i16 + 45, 27, 9, 9);
}
i6 -= 10;
}
this.j.au().b("air");
int i12 = bfw.bH();
int i13 = Math.min(bfw.bI(), i12);
if (bfw.a(aef.b) || i13 < i12) {
int uOffset = a(i11) - 1;
i6 -= uOffset * 10;
int i15 = afm.f((i13 - 2) * 10.0D / i12);
int i16 = afm.f(i13 * 10.0D / i12) - i15;
for (int x = 0; x < i15 + i16; x++) {
if (x < i15) {
b(matrixStack, n - x * 8 - 9, i6, 16, 18, 9, 9);
} else {
b(matrixStack, n - x * 8 - 9, i6, 25, 18, 9, 9);
}
}
}
this.j.au().c();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment