Skip to content

Commit

Permalink
Add b1.4 to 13w01b "missing texture" texture generator
Browse files Browse the repository at this point in the history
Closes #21. Needs further testing to determine why these textures vary so much.
  • Loading branch information
NeRdTheNed committed Sep 18, 2021
1 parent f56c62a commit 87f547f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/main/java/mcTextureGen/generators/MissingTextureGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public String getGeneratorName() {

public TextureGroup[] getTextureGroups() {
return new TextureGroup[] {
missingTextureText("Java_13w02a_to_13w17a", new String[] { "missing", "texture"}),
missingTextureText("Java_b1_4_to_13w01b", false, new String[] { "missingtex" }),
missingTextureText("Java_13w02a_to_13w17a", true, new String[] { "missing", "texture"}),
missingTextureCheckerboard("Java_13w18a_to_1_12_2", 0x000000, 0xF800F8),
missingTextureCheckerboard("Java_17w43a_to_current", 0xF800F8, 0x000000)
};
Expand All @@ -38,7 +39,7 @@ private static TextureGroup missingTextureCheckerboard(String name, int colourOn
}

/** Note: The generated TextureGroup is JVM / system dependent: the font / text rendering method chosen will vary across different platforms. */
private static TextureGroup missingTextureText(String name, String[] toDraw) {
private static TextureGroup missingTextureText(String name, boolean repeats, String[] lines) {
final BufferedImage[] missingTextureAsArray;

if (nonDeterministicFrames > 0) {
Expand All @@ -48,11 +49,12 @@ private static TextureGroup missingTextureText(String name, String[] toDraw) {
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, TEXT_TEXTURE_SZIE, TEXT_TEXTURE_SZIE);

if ((toDraw != null) && (toDraw.length > 0)) {
if ((lines != null) && (lines.length > 0)) {
// Set color to black for text rendering
graphics.setColor(Color.BLACK);
int fontSize = graphics.getFont().getSize();

// Prevent infinite loops
if (fontSize < 1) {
fontSize = 1;
}
Expand All @@ -61,12 +63,16 @@ private static TextureGroup missingTextureText(String name, String[] toDraw) {
int stringsDrawn = 0;

while (yPos < TEXT_TEXTURE_SZIE) {
final String currentLine = toDraw[stringsDrawn % toDraw.length];
final String currentLine = lines[stringsDrawn % lines.length];
stringsDrawn++;
graphics.drawString(currentLine, 1, yPos);
yPos += fontSize;

if ((stringsDrawn % toDraw.length) == 0) {
if ((stringsDrawn % lines.length) == 0) {
if (!repeats) {
break;
}

yPos += 5;
}
}
Expand Down

0 comments on commit 87f547f

Please sign in to comment.