Skip to content

Commit f56f1b4

Browse files
committed
Readied for a beta release
1 parent 9ebaff2 commit f56f1b4

File tree

22 files changed

+542
-298
lines changed

22 files changed

+542
-298
lines changed

README.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# Hexaplex
22

3+
![](https://github.com/LazuriteMC/Hexaplex/blob/main/src/main/resources/assets/rayon/icon.png?raw=true)
4+
35
[![GitHub](https://img.shields.io/github/license/LazuriteMC/Hexaplex?color=A31F34&label=License&labelColor=8A8B8C)](https://github.com/LazuriteMC/Hexaplex/blob/main/LICENSE)
46
[![Discord](https://img.shields.io/discord/719662192601071747?color=7289DA&label=Discord&labelColor=2C2F33&logo=Discord)](https://discord.gg/efCMR7U)
5-
[![Website](https://img.shields.io/website?color=E34C26&label=Website&logo=HTML5&labelColor=FFFFFF&url=https%3A%2F%2Flazurite.dev)](https://lazurite.dev)
67

78
---
89

910
## What is Hexaplex?
1011

1112
Hexaplex is a colorblindness correction mod for Minecraft written for the Fabric Mod Loader.
1213

13-
Note: Hexaplex is still in development and thus may not have all expected features implemented. Keep an eye out for
14-
a release in the near future.
15-
1614
## What isn't Hexaplex?
1715

1816
Hexaplex *isn't* a shader pack or a resource pack. This means that you can run this mod alongside your favorite
1917
shaders and resources without conflict.
2018

19+
Note: Optifabric is currently incompatible. This will be resolved by a 1.0.0 release.
20+
2121
## How does it work?
2222

2323
Hexaplex utilizes a process called Daltonization which has the following four steps.
@@ -29,14 +29,6 @@ Hexaplex utilizes a process called Daltonization which has the following four st
2929

3030
On the technical side, Hexaplex uses OpenGL shaders and applies Daltonization as a post-processing filter.
3131

32-
## Examples
33-
34-
In progress.
35-
36-
## How do I install it?
37-
38-
In progress.
39-
4032
## What does "Hexaplex" mean?
4133

4234
[Hexaplex](https://en.wikipedia.org/wiki/Hexaplex) is a genus of sea snail that was used by the Minoans,

build.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ dependencies {
3232
modImplementation "me.zeroeightsix:fiber:${project.fiber_version}"
3333
include "me.zeroeightsix:fiber:${project.fiber_version}"
3434

35-
// what does transitive do?
36-
modImplementation("io.github.prospector:modmenu:1.14.13+build.22")
37-
// {
38-
// transitive(false)
39-
// }
35+
modImplementation "me.shedaniel.cloth:config-2:${project.cloth_version}"
36+
include "me.shedaniel.cloth:config-2:${project.cloth_version}"
37+
38+
modImplementation "io.github.prospector:modmenu:${project.modmenu_version}"
4039
}
4140

4241
processResources {

gradle.properties

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22
org.gradle.jvmargs=-Xmx1G
33
# Fabric Properties
44
# check these on https://modmuss50.me/fabric.html
5-
minecraft_version=1.16.4
6-
yarn_mappings=1.16.4+build.7
7-
loader_version=0.10.8
5+
minecraft_version=1.16.5
6+
yarn_mappings=1.16.5+build.1
7+
loader_version=0.11.1
88
# Mod Properties
9-
mod_version=1.0.0
9+
mod_version=0.1.0
1010
maven_group=lazurite
1111
archives_base_name=hexaplex
1212
# Dependencies
1313
# check this on https://modmuss50.me/fabric.html
14-
fabric_version=0.29.1+1.16
14+
fabric_version=0.29.4+1.16
1515
satin_version=1.5.1
1616
fiber_version=0.23.0-2
17+
cloth_version=4.8.3
18+
fiber2cloth_version=3.0.1
19+
modmenu_version=1.14.13+build.19
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package dev.lazurite.hexaplex;
2+
3+
import blue.endless.jankson.api.SyntaxError;
4+
import dev.lazurite.hexaplex.config.Config;
5+
import dev.lazurite.hexaplex.rendering.ShaderManager;
6+
import dev.lazurite.hexaplex.rendering.MatrixLoader;
7+
import net.fabricmc.api.ClientModInitializer;
8+
import net.fabricmc.api.EnvType;
9+
import net.fabricmc.api.Environment;
10+
import org.apache.logging.log4j.LogManager;
11+
import org.apache.logging.log4j.Logger;
12+
13+
import java.io.IOException;
14+
15+
@Environment(EnvType.CLIENT)
16+
public final class Hexaplex implements ClientModInitializer {
17+
public static final String MOD_ID = "hexaplex";
18+
public static final Logger LOGGER = LogManager.getLogger("Hexaplex");
19+
20+
@Override
21+
public void onInitializeClient() {
22+
try {
23+
MatrixLoader.loadMatrices(this.getClass().getResourceAsStream("/assets/hexaplex/shaders/uniform/matrix4x4/filter.json"));
24+
} catch (SyntaxError | IOException e) {
25+
Hexaplex.LOGGER.error("Error loading Hexaplex shader matrices!");
26+
e.printStackTrace();
27+
}
28+
29+
ShaderManager.registerRenderer();
30+
Config.INSTANCE.load();
31+
}
32+
}
Lines changed: 67 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,131 @@
11
package dev.lazurite.hexaplex.config;
22

3-
import dev.lazurite.hexaplex.graphics.ShaderManager;
4-
import dev.lazurite.hexaplex.init.ClientInitializer;
3+
import dev.lazurite.hexaplex.Hexaplex;
4+
import dev.lazurite.hexaplex.rendering.Profiles;
55
import io.github.fablabsmc.fablabs.api.fiber.v1.annotation.AnnotatedSettings;
66
import io.github.fablabsmc.fablabs.api.fiber.v1.annotation.Setting;
77
import io.github.fablabsmc.fablabs.api.fiber.v1.annotation.Settings;
88
import io.github.fablabsmc.fablabs.api.fiber.v1.exception.FiberException;
99
import io.github.fablabsmc.fablabs.api.fiber.v1.serialization.FiberSerialization;
1010
import io.github.fablabsmc.fablabs.api.fiber.v1.serialization.JanksonValueSerializer;
1111
import io.github.fablabsmc.fablabs.api.fiber.v1.tree.ConfigTree;
12+
import net.fabricmc.api.EnvType;
13+
import net.fabricmc.api.Environment;
1214
import net.fabricmc.loader.api.FabricLoader;
1315

1416
import java.io.IOException;
1517
import java.nio.file.Files;
18+
import java.nio.file.Path;
1619

20+
@Environment(EnvType.CLIENT)
1721
@Settings(onlyAnnotated = true)
18-
public class Config {
22+
public final class Config {
1923

2024
public static final Config INSTANCE = new Config();
2125

22-
private boolean dirty;
26+
private static final Path PATH = FabricLoader.getInstance().getConfigDir().resolve(Hexaplex.MOD_ID + ".json");
2327

24-
@Setting(name = "filterProfile")
25-
private ShaderManager.Profiles profile;
28+
@Setting(name = "profile")
29+
private Profiles profile;
2630

27-
@Setting(name = "filterStrength")
31+
@Setting(name = "strength")
2832
@Setting.Constrain.Range(min = 0.0, max = 1.0, step = 0.01)
2933
private double strength;
3034

31-
private Config() {
32-
this.profile = ShaderManager.Profiles.NORMAL;
33-
this.strength = 0.0;
34-
this.dirty = true;
35-
}
36-
37-
private void markDirty() {
38-
this.dirty = true;
39-
}
35+
@Setting(name = "skew")
36+
@Setting.Constrain.Range(min = 0.0, max = 1.0, step = 0.01)
37+
private double skew;
4038

41-
public void markClean() {
42-
this.dirty = true;
43-
}
39+
private boolean dirty;
4440

45-
public boolean isDirty() {
46-
return this.dirty;
41+
private Config() {
42+
this.setProfile(Profiles.NORMAL);
43+
this.setStrength(0.0);
44+
this.setSkew(0.5);
45+
this.markDirty();
4746
}
4847

4948
public void save() {
5049
try {
5150
FiberSerialization.serialize(
52-
ConfigTree.builder().applyFromPojo(INSTANCE, AnnotatedSettings.builder().collectOnlyAnnotatedMembers().build()).build(),
53-
Files.newOutputStream(FabricLoader.getInstance().getConfigDir().resolve("hexaplex.json")),
51+
ConfigTree.builder()
52+
.applyFromPojo(
53+
INSTANCE,
54+
AnnotatedSettings.builder()
55+
.collectOnlyAnnotatedMembers()
56+
.build()
57+
)
58+
.build(),
59+
Files.newOutputStream(PATH),
5460
new JanksonValueSerializer(false)
5561
);
5662
} catch (IOException e) {
57-
ClientInitializer.LOGGER.error("Error saving Hexaplex config.");
63+
Hexaplex.LOGGER.error("Error saving Hexaplex config!");
5864
e.printStackTrace();
5965
}
6066
}
6167

6268
public void load() {
63-
if (Files.exists(FabricLoader.getInstance().getConfigDir().resolve("hexaplex.json"))) {
69+
if (Files.exists(PATH)) {
6470
try {
6571
FiberSerialization.deserialize(
66-
ConfigTree.builder().applyFromPojo(INSTANCE, AnnotatedSettings.builder().collectOnlyAnnotatedMembers().build()).build(),
67-
Files.newInputStream(FabricLoader.getInstance().getConfigDir().resolve("hexaplex.json")),
72+
ConfigTree.builder()
73+
.applyFromPojo(
74+
INSTANCE,
75+
AnnotatedSettings.builder()
76+
.collectOnlyAnnotatedMembers()
77+
.build()
78+
)
79+
.build(),
80+
Files.newInputStream(PATH),
6881
new JanksonValueSerializer(false)
6982
);
70-
} catch (IOException | FiberException e) {
71-
ClientInitializer.LOGGER.error("Error loading Hexaplex config.");
83+
} catch (FiberException | IOException e) {
84+
Hexaplex.LOGGER.error("Error loading Hexaplex config!");
7285
e.printStackTrace();
7386
}
7487
} else {
75-
ClientInitializer.LOGGER.info("Creating Hexaplex config.");
88+
Hexaplex.LOGGER.info("Creating Hexaplex config.");
7689
this.save();
7790
}
7891
}
7992

80-
public void setProfile(ShaderManager.Profiles profile) {
93+
public void setProfile(Profiles profile) {
8194
this.profile = profile;
8295
this.markDirty();
83-
this.save();
8496
}
8597

86-
public ShaderManager.Profiles getProfile() {
98+
public Profiles getProfile() {
8799
return this.profile;
88100
}
89101

90102
public void setStrength(double strength) {
91103
this.strength = strength;
92-
this.save();
104+
this.markDirty();
93105
}
94106

95107
public double getStrength() {
96108
return this.strength;
97109
}
110+
111+
public void setSkew(double skew) {
112+
this.skew = skew;
113+
this.markDirty();
114+
}
115+
116+
public double getSkew() {
117+
return this.skew;
118+
}
119+
120+
private void markDirty() {
121+
this.dirty = true;
122+
}
123+
124+
public void markClean() {
125+
this.dirty = false;
126+
}
127+
128+
public boolean isDirty() {
129+
return this.dirty;
130+
}
98131
}

src/main/java/dev/lazurite/hexaplex/graphics/ShaderManager.java

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)