Skip to content

Commit

Permalink
switched to midnightlib
Browse files Browse the repository at this point in the history
now runs on 1.19.2

yacl gone
  • Loading branch information
Goby56 committed Oct 3, 2024
1 parent ea6b370 commit e1fbe43
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 372 deletions.
20 changes: 1 addition & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,11 @@ repositories {
maven { url 'https://jitpack.io' }
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/releases/" }
maven {
name "Xander Maven"
url "https://maven.isxander.dev/releases"
}
maven {
name "Ladysnake Mods"
url "https://maven.ladysnake.org/releases"
// content {
// includeGroup 'io.github.ladysnake'
// includeGroup 'org.ladysnake'
// includeGroupByRegex 'dev\\.onyxstudios.*'
// }
}

// maven {
// name "YACL weird depend"
// url "https://oss.sonatype.org/content/repositories/snapshots"
// }

exclusiveContent {
forRepository {
maven {
Expand Down Expand Up @@ -67,11 +53,6 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"

modImplementation("dev.isxander:yet-another-config-lib:${project.yacl_version}") {
exclude(group: "com.twelvemonkeys.common")
exclude(group: "com.twelvemonkeys.imageio")
}

modCompileOnly "maven.modrinth:iris:${project.iris_version}"
// modImplementation "maven.modrinth:sodium:${project.sodium_version}"
// modImplementation "org.anarres:jcpp:1.4.14"
Expand All @@ -80,6 +61,7 @@ dependencies {
modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}"

include(modImplementation("io.github.ladysnake:satin:${project.satin_version}"))
include(modImplementation("maven.modrinth:midnightlib:${project.midnightlib_version}"))

testImplementation "org.junit.jupiter:junit-jupiter:5.10.0-M1"

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ maven_group=com.goby56.wakes
archives_base_name=wakes

# Dependencies
yacl_version=2.2.0-for-1.19.2
midnightlib_version = 1.0.0-fabric
iris_version=1.6.11+1.19.2
modmenu_version=4.1.2
jankson_version=1.2.2
Expand Down
11 changes: 3 additions & 8 deletions src/main/java/com/goby56/wakes/WakesClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
import com.goby56.wakes.debug.DebugCommand;
import com.goby56.wakes.config.WakesConfig;
import com.goby56.wakes.debug.WakeDebugRenderer;
import com.goby56.wakes.event.PickBoat;
import com.goby56.wakes.event.WakeTicker;
import com.goby56.wakes.render.WakeRenderer;
import eu.midnightdust.lib.config.MidnightConfig;
import ladysnake.satin.api.managed.ManagedCoreShader;
import ladysnake.satin.api.managed.ShaderEffectManager;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
import net.fabricmc.fabric.api.event.client.player.ClientPickBlockGatherCallback;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.metadata.ModMetadata;
import net.irisshaders.iris.api.v0.IrisApi;
Expand All @@ -29,7 +28,7 @@ public class WakesClient implements ClientModInitializer {
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static WakesConfig CONFIG_INSTANCE;
public static final ManagedCoreShader TRANSLUCENT_NO_LIGHT_DIRECTION_PROGRAM = ShaderEffectManager.getInstance().manageCoreShader(
Identifier.of(MOD_ID, "translucent_no_light_direction"), VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL);
new Identifier(MOD_ID, "translucent_no_light_direction"), VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL);
public static boolean areShadersEnabled = false;

@Override
Expand All @@ -39,10 +38,10 @@ public void onInitializeClient() {

// Mod configs
CONFIG_INSTANCE = WakesConfig.loadConfig();
MidnightConfig.init(MOD_ID, WakesConfig.class);

// Game events
ClientTickEvents.END_WORLD_TICK.register(new WakeTicker());
ClientPickBlockGatherCallback.EVENT.register(new PickBoat());

// Rendering events
WorldRenderEvents.AFTER_TRANSLUCENT.register(new WakeRenderer());
Expand All @@ -52,10 +51,6 @@ public void onInitializeClient() {
ClientCommandRegistrationCallback.EVENT.register(DebugCommand::register);
}

public static boolean isYACLLoaded() {
return FabricLoader.getInstance().isModLoaded("yet_another_config_lib_v3");
}

public static boolean areShadersEnabled() {
if (FabricLoader.getInstance().isModLoaded("iris")) {
return IrisApi.getInstance().getConfig().areShadersEnabled();
Expand Down
26 changes: 2 additions & 24 deletions src/main/java/com/goby56/wakes/config/ModMenuIntegration.java
Original file line number Diff line number Diff line change
@@ -1,35 +1,13 @@
package com.goby56.wakes.config;

import com.goby56.wakes.WakesClient;
import com.goby56.wakes.utils.WakesUtils;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ConfirmScreen;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.text.Text;
import net.minecraft.util.Util;

import java.net.URI;
import eu.midnightdust.lib.config.MidnightConfig;

public class ModMenuIntegration implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
// Great idea taken from Benjamin Norton: https://github.com/Benjamin-Norton
// Do a barrel roll is a sick mod. Go download: https://modrinth.com/mod/do-a-barrel-roll
if (WakesClient.isYACLLoaded()) {
return YACLIntegration::createScreen;
} else {
return parent -> new ConfirmScreen(result -> {
if (result) {
Util.getOperatingSystem().open(URI.create("https://modrinth.com/mod/yacl/versions"));
}
MinecraftClient.getInstance().setScreen(parent);
}, Text.translatable(String.format("%s.%s", WakesClient.MOD_ID, "yacl_missing")),
Text.translatable(String.format("%s.%s", WakesClient.MOD_ID, "yacl_missing.message")),
ScreenTexts.YES,
ScreenTexts.NO);
}
// https://github.com/enjarai/do-a-barrel-roll/blob/1.20/dev/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/ModMenuIntegration.java#L18
return parent -> MidnightConfig.getScreen(parent, WakesClient.MOD_ID);
}
}
15 changes: 2 additions & 13 deletions src/main/java/com/goby56/wakes/config/WakesConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.goby56.wakes.render.enums.RenderType;
import com.goby56.wakes.render.enums.WakeColor;
import com.google.gson.Gson;
import eu.midnightdust.lib.config.MidnightConfig;

import java.io.File;
import java.io.FileOutputStream;
Expand All @@ -17,7 +18,7 @@
import java.util.List;
import java.util.Map;

public class WakesConfig {
public class WakesConfig extends MidnightConfig {
// Spawning
public Map<String, EffectSpawningRule> effectSpawningRules = new HashMap<>(Map.of(
"boat", EffectSpawningRule.SIMULATION_AND_PLANES,
Expand All @@ -33,7 +34,6 @@ public class WakesConfig {
public int initialStrength = 20;
public int paddleStrength = 100;
public int splashStrength = 100;
public boolean spawnParticles = true;

// Debug
public boolean disableMod = false;
Expand All @@ -50,7 +50,6 @@ public class WakesConfig {
// Appearance
public Resolution wakeResolution = Resolution.SIXTEEN;
public float wakeOpacity = 1f;
public boolean firstPersonSplashPlane = false;
public List<ColorInterval> colorIntervals = List.of(
new ColorInterval(WakeColor.TRANSPARENT, -50, -45),
new ColorInterval(WakeColor.DARK_GRAY, -45, -35),
Expand Down Expand Up @@ -88,16 +87,6 @@ public void setUpper(int upper) {

}

// Splash plane
public float splashPlaneWidth = 2f;
public float splashPlaneHeight = 1.5f;
public float splashPlaneDepth = 3f;
public float splashPlaneOffset = -0.2f;
public float splashPlaneGap = 1f;
public int splashPlaneResolution = 5;
public float maxSplashPlaneVelocity = 0.5f;
public float splashPlaneScale = 0.8f;

public static WakesConfig loadConfig() {
Jankson jankson = Jankson.builder().build();
try {
Expand Down
Loading

0 comments on commit e1fbe43

Please sign in to comment.