Skip to content

Commit

Permalink
Try to target Java 4
Browse files Browse the repository at this point in the history
Why not x2 ¯\_(ツ)_/¯

I won't go any lower than this for now, as I think I am using a Java 4 feature (logging).
  • Loading branch information
NeRdTheNed committed Sep 17, 2021
1 parent da94a49 commit 2a10154
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 33 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ compileJava {
// Use the provisioned Java 6 compatible JDK to compile the program
// Note to self: probably support building with not outdated versions of Java in the future.
javaCompiler = compiler
sourceCompatibility = "1.5"
targetCompatibility = "1.5"
sourceCompatibility = "1.4"
targetCompatibility = "1.4"
}

compileTestJava {
Expand Down
2 changes: 1 addition & 1 deletion guard.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# dontpreverify should only be used when targeting Java 6 or below.

-target 1.5
-target 1.4
-dontpreverify

# Make sure to check everything always, can't hurt.
Expand Down
15 changes: 9 additions & 6 deletions src/main/java/mcTextureGen/MCTextureGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static void main(final String[] args) {
if ("-nonDeterministicFrames".equals(args[i])) {
AbstractTextureGenerator.setNonDeterministicFrames(Integer.parseInt(args[i + 1]));
} else if ("-randomSeed".equals(args[i])) {
AbstractTextureGenerator.setRandomSeed(Long.parseLong(args[i + 1]));
AbstractTextureGenerator.setRandomSeed(Long.valueOf(args[i + 1]));
} else {
log.log(Level.SEVERE, "Invalid command line parameter {0} provided", args[i]);
System.exit(1);
Expand All @@ -81,11 +81,14 @@ public static void main(final String[] args) {
final String fileSeperator = System.getProperty("file.separator");
final String baseTextureOutputPath = currentDir + fileSeperator + "GeneratedTextures";

for (final AbstractTextureGenerator generator : getTextureGenerators()) {
for (int i = 0; i < getTextureGenerators().length; i++) {
final AbstractTextureGenerator generator = getTextureGenerators()[i];
log.log(Level.INFO, "Generating all texture groups for the texture generator {0}", generator.getGeneratorName());
final String textureGeneratorOutputPath = baseTextureOutputPath + fileSeperator + generator.getGeneratorName();

for (final TextureGroup group : generator.getTextureGroups()) {
for (int j = 0; j < generator.getTextureGroups().length; j++) {
final TextureGroup group = generator.getTextureGroups()[j];

if (group.textureImages.length == 0) {
log.log(Level.WARNING, "Group {0} did not contain any textures, skipping", group.textureGroupName);
continue;
Expand All @@ -101,12 +104,12 @@ public static void main(final String[] args) {

log.log(Level.INFO, "Generating all texures for the texture group {0}", group.textureGroupName);

for (int i = 0; i < group.textureImages.length; i++) {
final RenderedImage textureImage = group.textureImages[i];
for (int k = 0; k < group.textureImages.length; k++) {
final RenderedImage textureImage = group.textureImages[k];
final String outFileName;

if (group.textureImages.length > 1) {
outFileName = textureGroupOutputPath + fileSeperator + group.textureGroupName + "_" + (i + 1) + ".png";
outFileName = textureGroupOutputPath + fileSeperator + group.textureGroupName + "_" + (k + 1) + ".png";
} else {
outFileName = textureGroupOutputPath + fileSeperator + group.textureGroupName + ".png";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ protected AbstractLavaGenerator(String generatorName) {
super(generatorName);
}

@Override
public final void generateLiquidTexture(final float[] liquidImagePrevious, final float[] liquidImageCurrent, final float[] liquidIntensity, final float[] liquidIntensityIntensity) {
for (int currentLavaX = 0; currentLavaX < liquidImageSize; ++currentLavaX) {
for (int currentLavaY = 0; currentLavaY < liquidImageSize; ++currentLavaY) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ protected AbstractLiquidGenerator(String generatorName) {
this.generatorName = generatorName;
}

@Override
public final String getGeneratorName() {
return generatorName;
}

@Override
public final TextureGroup[] getTextureGroups() {
return new TextureGroup[] { liquidTextures() };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static final Random getRandom() {
final Random rand;

if (randomSeed != null) {
rand = new Random(randomSeed);
rand = new Random(randomSeed.longValue());
} else {
rand = cachedRand;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ public Classic19aLavaGenerator() {
super("Classic_19a_Lava");
}

@Override
public void setABGR(final byte[] imageByteData, final float currentPixelIntensity, final int imageOffset) {
imageByteData[imageOffset + 0] = (byte) 0xFF;
imageByteData[imageOffset + 1] = (byte) (currentPixelIntensity * currentPixelIntensity * currentPixelIntensity * currentPixelIntensity * 128.0F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ public Classic19aWaterGenerator() {
super("Classic_19a_Water");
}

@Override
public void generateLiquidTexture(final float[] liquidImagePrevious, final float[] liquidImageCurrent, final float[] liquidIntensity, final float[] liquidIntensityIntensity) {
// Generate the image pixel values
for (int currentWaterX = 0; currentWaterX < liquidImageSize; ++currentWaterX) {
Expand Down Expand Up @@ -46,7 +45,6 @@ public void generateLiquidTexture(final float[] liquidImagePrevious, final float
}
}

@Override
public void setABGR(final byte[] imageByteData, final float currentPixelIntensity, final int imageOffset) {
final float currentPixelIntensityPow = currentPixelIntensity * currentPixelIntensity;
imageByteData[imageOffset + 0] = (byte) (146.0F + (currentPixelIntensityPow * 50.0F));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ public Classic22aLavaGenerator() {
super("Classic_22a_Lava");
}

@Override
public void setABGR(final byte[] imageByteData, final float currentPixelIntensity, final int imageOffset) {
imageByteData[imageOffset + 0] = (byte) 0xFF;
imageByteData[imageOffset + 1] = (byte) (currentPixelIntensity * currentPixelIntensity * currentPixelIntensity * currentPixelIntensity * 128.0F);
imageByteData[imageOffset + 2] = (byte) (currentPixelIntensity * currentPixelIntensity * 255.0F);
imageByteData[imageOffset + 3] = (byte) ((currentPixelIntensity * 100.0F) + 155.0F);
}

@Override
float clampCurrentPixelIntensity(float toClamp) {
toClamp *= 2.0F;
return super.clampCurrentPixelIntensity(toClamp);
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/mcTextureGen/generators/FireGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,10 @@ public final class FireGenerator extends AbstractTextureGenerator {
// If that's true, removing " + (selfSamples * 0.01F)" from wtFloat might simulate this.
private static final float divPixelIntensity = sampleCounterEnd * wtFloat;

@Override
public String getGeneratorName() {
return "Fire";
}

@Override
public TextureGroup[] getTextureGroups() {
return new TextureGroup[] { fireTextures() };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,14 @@ private static BufferedImage generateGearTextureForRotation(int rotationStep) {
return rotatedImage;
}

@Override
public String getGeneratorName() {
return "Gear_Rotation";
}

@Override
public TextureGroup[] getTextureGroups() {
return new TextureGroup[] { gearRotationTextures() };
}

@Override
public boolean hasGenerationIssue() {
return generationIssueFlag;
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/mcTextureGen/generators/MC4k1Generator.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ public final class MC4k1Generator extends AbstractTextureGenerator {
private static final int unsignedByteMax = 0xFF;
private static final float unsignedByteMaxAsFloat = 0xFF;

@Override
public String getGeneratorName() {
return "Minecraft_4k_1";
}

@Override
public TextureGroup[] getTextureGroups() {
return new TextureGroup[] { xorTextures() };
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/mcTextureGen/generators/MC4k2Generator.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ public final class MC4k2Generator extends AbstractTextureGenerator {
private static final int TEXTURES_PER_ID = 3;
private static final int TEXTURE_OFFSET = 1;

@Override
public String getGeneratorName() {
return "Minecraft_4k_2";
}

@Override
public TextureGroup[] getTextureGroups() {
return rawTextureDump();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ public final class MissingTextureGenerator extends AbstractTextureGenerator {
private static final int CHECKERBOARD_TEXTURE_SIZE = 16;
private static final int TEXT_TEXTURE_SZIE = 64;

@Override
public String getGeneratorName() {
return "Missing_Textures";
}

@Override
public TextureGroup[] getTextureGroups() {
return new TextureGroup[] {
missingTextureText("Java_13w02a_to_13w17a", "missing", "texture"),
missingTextureText("Java_13w02a_to_13w17a", new String[] { "missing", "texture"}),
missingTextureCheckerboard("Java_13w18a_to_1_12_2", 0x000000, 0xF800F8),
missingTextureCheckerboard("Java_17w43a_to_current", 0xF800F8, 0x000000)
};
Expand All @@ -40,7 +38,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, String[] toDraw) {
final BufferedImage[] missingTextureAsArray;

if (nonDeterministicFrames > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ public final class NetherPortalGenerator extends AbstractTextureGenerator {
private static final boolean addConstantOffset = true;
private static final boolean addRandomNoise = true;

@Override
public String getGeneratorName() {
return "Nether_Portal";
}

@Override
public TextureGroup[] getTextureGroups() {
return new TextureGroup[] { netherPortalFrames() };
}
Expand Down

0 comments on commit 2a10154

Please sign in to comment.