Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ plugins {
id 'maven-publish'
}

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8

tasks.withType(JavaCompile).configureEach {
it.options.release = 8
}

archivesBaseName = project.archives_base_name
version = project.mod_version
Expand Down Expand Up @@ -101,4 +105,4 @@ publishing {
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
}
Empty file modified gradlew
100644 → 100755
Empty file.
22 changes: 14 additions & 8 deletions src/main/java/net/mine_diver/macula/Shaders.java
Original file line number Diff line number Diff line change
Expand Up @@ -976,15 +976,18 @@ private static void setEnumShaderOption(ShaderOption eso, String str) {
if (str == null) str = eso.getValueDefault();

switch (eso) {
case SHADOW_RES_MUL -> {
case SHADOW_RES_MUL:
try {
configShadowResMul = Float.parseFloat(str);
} catch (NumberFormatException e) {
configShadowResMul = 1;
}
}
case SHADER_PACK -> currentShaderName = str;
default -> throw new IllegalArgumentException("Unknown option: " + eso);
break;
case SHADER_PACK:
currentShaderName = str;
break;
default:
throw new IllegalArgumentException("Unknown option: " + eso);
}
}

Expand All @@ -999,10 +1002,13 @@ public static void storeConfig() {
}

public static String getEnumShaderOption(ShaderOption eso) {
return switch (eso) {
case SHADOW_RES_MUL -> Float.toString(configShadowResMul);
case SHADER_PACK -> currentShaderName;
};
switch (eso) {
case SHADOW_RES_MUL:
return Float.toString(configShadowResMul);
case SHADER_PACK:
return currentShaderName;
}
return null;
}

public static void setShaderPack(String shaderPack) {
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/net/mine_diver/macula/gui/ShaderOptionButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ public ShaderOption getEnumShaderOption() {

private static String getButtonText(final ShaderOption eso) {
final String nameText = I18n.translate(eso.getResourceKey()) + ": ";
return switch (eso) {
case SHADOW_RES_MUL -> nameText + ShadersScreen.toStringQuality(Shaders.configShadowResMul);
default -> throw new IllegalStateException("Unexpected value: " + eso);
};
switch (eso) {
case SHADOW_RES_MUL:
return nameText + ShadersScreen.toStringQuality(Shaders.configShadowResMul);
default:
throw new IllegalStateException("Unexpected value: " + eso);
}
}

public void updateButtonText() {
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/net/mine_diver/macula/gui/ShadersScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,13 @@ protected void mouseClicked(int i, int j, int action) {
protected void buttonClicked(Button button) {
super.buttonClicked(button);
if (!button.active) return;
if (button instanceof ShaderOptionButton sob) {
if (button instanceof ShaderOptionButton) {
ShaderOptionButton sob = (ShaderOptionButton) button;
switch (sob.getEnumShaderOption()) {
case SHADOW_RES_MUL -> {
case SHADOW_RES_MUL:
Shaders.configShadowResMul = this.getNextValue(Shaders.configShadowResMul, QUALITY_MULTIPLIERS, QUALITY_MULTIPLIER_DEFAULT, !rightClick, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT));
Shaders.loadShaderPack();
}
break;
}
sob.updateButtonText();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void onDraw1(CallbackInfo ci) {
if (!Shaders.shaderPackLoaded) return;
if (Shaders.entityAttrib >= 0) {
ARBVertexProgram.glEnableVertexAttribArrayARB(Shaders.entityAttrib);
ARBVertexProgram.glVertexAttribPointerARB(Shaders.entityAttrib, 2, false, false, 4, shadersShortBuffer.position(0));
ARBVertexProgram.glVertexAttribPointerARB(Shaders.entityAttrib, 2, false, false, 4, (ShortBuffer) shadersShortBuffer.position(0));
}
}

Expand Down