Related to #487.
The Basic rendering concepts page is severely outdated/inconsistent. Some of the text is not applicable to the newer versions of minecraft, In some sections text does not match code snippet provided and text and snippet are discussing entirely different things, Snippet results shown in diagrams do not match actual results.
Required fixes:-
- Remove redundant text.
- Fix unrelated text and code by either removing them or making them related.
- Convert inconsistent code and diagram such as
private HudElement hudLayer() {
return (graphics, deltaTracker) -> {
Matrix3x2fStack matrices = graphics.pose();
// Store the total tick delta in a field, so we can use it later.
this.totalTickProgress += deltaTracker.getGameTimeDeltaPartialTick(true);
// Push a new matrix onto the stack.
matrices.pushMatrix();
// Scale the matrix by 0.5 to make the triangle smaller and larger over time.
float scaleAmount = Mth.sin(this.totalTickProgress / 10F) / 2F + 1.5F;
// Apply the scaling amount to the matrix.
// We don't need to scale the Z axis since it's on the HUD and 2D.
matrices.scale(scaleAmount, scaleAmount);
matrices.scale(1 / scaleAmount, 1 / scaleAmount);
matrices.translate(60f, 60f);
// Lerp between 0 and 360 degrees over time.
float rotationAmount = this.totalTickProgress / 50F % 360;
matrices.rotate(rotationAmount);
// Shift entire square so that it rotates in its center.
matrices.translate(-20f, -40f);
// We do not need to manually write to the buffer. GuiGraphics methods write to GUI buffer in `GuiRenderer` at the end of preparation.
// Pop our matrix from the stack.
matrices.popMatrix();
};
}
(the above code does not match the output btw)
by converting them to the modern equivalent.
private HudElement hudLayer() {
return (graphics, deltaTracker) -> {
Matrix3x2fStack matrices = graphics.pose();
this.totalTickProgress += deltaTracker.getGameTimeDeltaPartialTick(true);
matrices.pushMatrix();
float scaleAmount = Mth.sin(this.totalTickProgress / 10F) / 2F + 1.5F;
matrices.translate(50.0f, 50.0f);
matrices.scale(1.0f + scaleAmount, 1.4f + scaleAmount);
matrices.rotate((float) Math.toRadians(45.0f));
graphics.fillGradient(-10, -10, 10, 10, 0xFF414141, 0xFF000000);
matrices.popMatrix();
};
}
Related to #487.
The Basic rendering concepts page is severely outdated/inconsistent. Some of the text is not applicable to the newer versions of minecraft, In some sections text does not match code snippet provided and text and snippet are discussing entirely different things, Snippet results shown in diagrams do not match actual results.
Required fixes:-
(the above code does not match the output btw)
by converting them to the modern equivalent.