Skip to content

Commit

Permalink
Readied for a beta release
Browse files Browse the repository at this point in the history
  • Loading branch information
The-PPWD committed Jan 27, 2021
1 parent 9ebaff2 commit f56f1b4
Show file tree
Hide file tree
Showing 22 changed files with 542 additions and 298 deletions.
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Hexaplex

![](https://github.com/LazuriteMC/Hexaplex/blob/main/src/main/resources/assets/rayon/icon.png?raw=true)

[![GitHub](https://img.shields.io/github/license/LazuriteMC/Hexaplex?color=A31F34&label=License&labelColor=8A8B8C)](https://github.com/LazuriteMC/Hexaplex/blob/main/LICENSE)
[![Discord](https://img.shields.io/discord/719662192601071747?color=7289DA&label=Discord&labelColor=2C2F33&logo=Discord)](https://discord.gg/efCMR7U)
[![Website](https://img.shields.io/website?color=E34C26&label=Website&logo=HTML5&labelColor=FFFFFF&url=https%3A%2F%2Flazurite.dev)](https://lazurite.dev)

---

## What is Hexaplex?

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

Note: Hexaplex is still in development and thus may not have all expected features implemented. Keep an eye out for
a release in the near future.

## What isn't Hexaplex?

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

Note: Optifabric is currently incompatible. This will be resolved by a 1.0.0 release.

## How does it work?

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

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

## Examples

In progress.

## How do I install it?

In progress.

## What does "Hexaplex" mean?

[Hexaplex](https://en.wikipedia.org/wiki/Hexaplex) is a genus of sea snail that was used by the Minoans,
Expand Down
9 changes: 4 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ dependencies {
modImplementation "me.zeroeightsix:fiber:${project.fiber_version}"
include "me.zeroeightsix:fiber:${project.fiber_version}"

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

modImplementation "io.github.prospector:modmenu:${project.modmenu_version}"
}

processResources {
Expand Down
13 changes: 8 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.16.4
yarn_mappings=1.16.4+build.7
loader_version=0.10.8
minecraft_version=1.16.5
yarn_mappings=1.16.5+build.1
loader_version=0.11.1
# Mod Properties
mod_version=1.0.0
mod_version=0.1.0
maven_group=lazurite
archives_base_name=hexaplex
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.29.1+1.16
fabric_version=0.29.4+1.16
satin_version=1.5.1
fiber_version=0.23.0-2
cloth_version=4.8.3
fiber2cloth_version=3.0.1
modmenu_version=1.14.13+build.19
32 changes: 32 additions & 0 deletions src/main/java/dev/lazurite/hexaplex/Hexaplex.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package dev.lazurite.hexaplex;

import blue.endless.jankson.api.SyntaxError;
import dev.lazurite.hexaplex.config.Config;
import dev.lazurite.hexaplex.rendering.ShaderManager;
import dev.lazurite.hexaplex.rendering.MatrixLoader;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.io.IOException;

@Environment(EnvType.CLIENT)
public final class Hexaplex implements ClientModInitializer {
public static final String MOD_ID = "hexaplex";
public static final Logger LOGGER = LogManager.getLogger("Hexaplex");

@Override
public void onInitializeClient() {
try {
MatrixLoader.loadMatrices(this.getClass().getResourceAsStream("/assets/hexaplex/shaders/uniform/matrix4x4/filter.json"));
} catch (SyntaxError | IOException e) {
Hexaplex.LOGGER.error("Error loading Hexaplex shader matrices!");
e.printStackTrace();
}

ShaderManager.registerRenderer();
Config.INSTANCE.load();
}
}
101 changes: 67 additions & 34 deletions src/main/java/dev/lazurite/hexaplex/config/Config.java
Original file line number Diff line number Diff line change
@@ -1,98 +1,131 @@
package dev.lazurite.hexaplex.config;

import dev.lazurite.hexaplex.graphics.ShaderManager;
import dev.lazurite.hexaplex.init.ClientInitializer;
import dev.lazurite.hexaplex.Hexaplex;
import dev.lazurite.hexaplex.rendering.Profiles;
import io.github.fablabsmc.fablabs.api.fiber.v1.annotation.AnnotatedSettings;
import io.github.fablabsmc.fablabs.api.fiber.v1.annotation.Setting;
import io.github.fablabsmc.fablabs.api.fiber.v1.annotation.Settings;
import io.github.fablabsmc.fablabs.api.fiber.v1.exception.FiberException;
import io.github.fablabsmc.fablabs.api.fiber.v1.serialization.FiberSerialization;
import io.github.fablabsmc.fablabs.api.fiber.v1.serialization.JanksonValueSerializer;
import io.github.fablabsmc.fablabs.api.fiber.v1.tree.ConfigTree;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.loader.api.FabricLoader;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

@Environment(EnvType.CLIENT)
@Settings(onlyAnnotated = true)
public class Config {
public final class Config {

public static final Config INSTANCE = new Config();

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

@Setting(name = "filterProfile")
private ShaderManager.Profiles profile;
@Setting(name = "profile")
private Profiles profile;

@Setting(name = "filterStrength")
@Setting(name = "strength")
@Setting.Constrain.Range(min = 0.0, max = 1.0, step = 0.01)
private double strength;

private Config() {
this.profile = ShaderManager.Profiles.NORMAL;
this.strength = 0.0;
this.dirty = true;
}

private void markDirty() {
this.dirty = true;
}
@Setting(name = "skew")
@Setting.Constrain.Range(min = 0.0, max = 1.0, step = 0.01)
private double skew;

public void markClean() {
this.dirty = true;
}
private boolean dirty;

public boolean isDirty() {
return this.dirty;
private Config() {
this.setProfile(Profiles.NORMAL);
this.setStrength(0.0);
this.setSkew(0.5);
this.markDirty();
}

public void save() {
try {
FiberSerialization.serialize(
ConfigTree.builder().applyFromPojo(INSTANCE, AnnotatedSettings.builder().collectOnlyAnnotatedMembers().build()).build(),
Files.newOutputStream(FabricLoader.getInstance().getConfigDir().resolve("hexaplex.json")),
ConfigTree.builder()
.applyFromPojo(
INSTANCE,
AnnotatedSettings.builder()
.collectOnlyAnnotatedMembers()
.build()
)
.build(),
Files.newOutputStream(PATH),
new JanksonValueSerializer(false)
);
} catch (IOException e) {
ClientInitializer.LOGGER.error("Error saving Hexaplex config.");
Hexaplex.LOGGER.error("Error saving Hexaplex config!");
e.printStackTrace();
}
}

public void load() {
if (Files.exists(FabricLoader.getInstance().getConfigDir().resolve("hexaplex.json"))) {
if (Files.exists(PATH)) {
try {
FiberSerialization.deserialize(
ConfigTree.builder().applyFromPojo(INSTANCE, AnnotatedSettings.builder().collectOnlyAnnotatedMembers().build()).build(),
Files.newInputStream(FabricLoader.getInstance().getConfigDir().resolve("hexaplex.json")),
ConfigTree.builder()
.applyFromPojo(
INSTANCE,
AnnotatedSettings.builder()
.collectOnlyAnnotatedMembers()
.build()
)
.build(),
Files.newInputStream(PATH),
new JanksonValueSerializer(false)
);
} catch (IOException | FiberException e) {
ClientInitializer.LOGGER.error("Error loading Hexaplex config.");
} catch (FiberException | IOException e) {
Hexaplex.LOGGER.error("Error loading Hexaplex config!");
e.printStackTrace();
}
} else {
ClientInitializer.LOGGER.info("Creating Hexaplex config.");
Hexaplex.LOGGER.info("Creating Hexaplex config.");
this.save();
}
}

public void setProfile(ShaderManager.Profiles profile) {
public void setProfile(Profiles profile) {
this.profile = profile;
this.markDirty();
this.save();
}

public ShaderManager.Profiles getProfile() {
public Profiles getProfile() {
return this.profile;
}

public void setStrength(double strength) {
this.strength = strength;
this.save();
this.markDirty();
}

public double getStrength() {
return this.strength;
}

public void setSkew(double skew) {
this.skew = skew;
this.markDirty();
}

public double getSkew() {
return this.skew;
}

private void markDirty() {
this.dirty = true;
}

public void markClean() {
this.dirty = false;
}

public boolean isDirty() {
return this.dirty;
}
}
77 changes: 0 additions & 77 deletions src/main/java/dev/lazurite/hexaplex/graphics/ShaderManager.java

This file was deleted.

Loading

0 comments on commit f56f1b4

Please sign in to comment.