Compare commits

...

2 Commits

Author SHA1 Message Date
Johannes Frohnmeyer 0dc1187d3a
fix: use different log category for IO logs
ci/woodpecker/push/docs Pipeline was successful Details
ci/woodpecker/push/jfmod Pipeline was successful Details
2024-05-04 20:23:53 +02:00
Johannes Frohnmeyer 57e2fb4b7a
chore: remove dashloader compat 2024-05-04 20:23:29 +02:00
7 changed files with 12 additions and 50 deletions

View File

@ -16,13 +16,6 @@ repositories {
includeGroup("io.vram")
}
}
maven("https://notalpha.dev/maven/releases") {
name = "DashLoader"
content {
includeGroup("dev.notalpha")
includeGroup("dev.quantumfusion")
}
}
maven("https://api.modrinth.com/maven") {
name = "Modrinth"
content {
@ -70,8 +63,7 @@ dependencies {
modLocalRuntime("com.terraformersmc:modmenu:$modmenuVersion", nofabric)
modClientCompileOnly("com.terraformersmc:modmenu:$modmenuVersion", nofabric)
modClientCompileOnly("io.vram:frex-fabric:20.0.+")
modClientCompileOnly("dev.notalpha:dashloader:5.0.0-beta.1+1.20.0")
modClientCompileOnly("io.vram:frex-fabric:20.2.+")
testImplementation("org.junit.jupiter:junit-jupiter:5.9.3")
@ -79,11 +71,8 @@ dependencies {
annotationProcessor("io.gitlab.jfronny:commons-serialize-generator:$muscriptVersion")
// Canvas for FREX testing
// modClientRuntimeOnly("io.vram:canvas-fabric:20.0.+")
//modClientRuntimeOnly("io.vram:canvas-fabric:20.2.+")
// Sodium for debugging
modClientRuntimeOnly("maven.modrinth:sodium:mc1.20.6-0.5.8")
// DashLoader "compatibility"
// modClientRuntimeOnly("dev.notalpha:dashloader:5.0.0-beta.1+1.20.0")
}

View File

@ -52,7 +52,6 @@ public class RespackoptsClient implements ClientModInitializer, SaveHook {
if (args.flagResourcesForReload()) {
forcePackReload = true;
DashLoaderCompat.requestForceReload();
}
List<CompletableFuture<Void>> futures = new ArrayList<>();
if (args.reloadResourcesImmediately()) {
@ -66,7 +65,6 @@ public class RespackoptsClient implements ClientModInitializer, SaveHook {
public static CompletableFuture<Void> forceReloadResources() {
forcePackReload = true;
DashLoaderCompat.requestForceReload();
if (RespackoptsConfig.debugLogs) Respackopts.LOGGER.info("Forcing resource reload");
return CompletableFuture.allOf(MinecraftClient.getInstance().reloadResources());
}

View File

@ -1,24 +0,0 @@
package io.gitlab.jfronny.respackopts.integration;
import dev.notalpha.dashloader.client.DashLoaderClient;
import io.gitlab.jfronny.respackopts.Respackopts;
import io.gitlab.jfronny.respackopts.RespackoptsConfig;
import net.fabricmc.loader.api.FabricLoader;
public class DashLoaderCompat {
public static void requestForceReload() {
if (!FabricLoader.getInstance().isModLoaded("dashloader"))
return;
if (!RespackoptsConfig.dashloaderCompat)
return;
try {
if (RespackoptsConfig.debugLogs)
Respackopts.LOGGER.info("Removing DashCache to force dashloader to reload");
DashLoaderClient.CACHE.remove();
DashLoaderClient.NEEDS_RELOAD = true;
} catch (Throwable e) {
Respackopts.LOGGER.error("Failed to remove dashloader data, try disabling dashloaderCompat if this keeps happening", e);
}
}
}

View File

@ -36,7 +36,7 @@ public class Respackopts implements ModInitializer, SaveHook {
if (RespackoptsConfig.debugLogs) ValidationLayer.Pre.INSTANCE.register();
DirFilterEvents.INSTANCE.register();
FileFilterEvents.INSTANCE.register();
if (RespackoptsConfig.ioLogs) DebugEvents.INSTANCE.register();
if (RespackoptsConfig.ioLogs) IOLogEvents.INSTANCE.register();
if (RespackoptsConfig.debugLogs) ValidationLayer.Post.INSTANCE.register();
ServerInstanceHolder.init();

View File

@ -16,7 +16,6 @@ public class RespackoptsConfig implements JfCustomConfig {
public static boolean debugCommands = false;
public static boolean debugLogs = false;
public static boolean ioLogs = false;
public static boolean dashloaderCompat = true;
public static ScanState scanState = ScanState.NONE;
public static ConfigInstance configInstance = null;
@ -40,7 +39,6 @@ public class RespackoptsConfig implements JfCustomConfig {
.value("debugCommands", debugCommands, () -> debugCommands, v -> debugCommands = v)
.value("debugLogs", debugLogs, () -> debugLogs, v -> debugLogs = v)
.value("ioLogs", ioLogs, () -> ioLogs, v -> ioLogs = v)
.value("dashloaderCompat", dashloaderCompat, () -> dashloaderCompat, v -> dashloaderCompat = v)
// Not using Respackopts.FALLBACK_CONF_DIR to avoid premature initialization with libjf-unsafe and libjf-config-reflect
.setPath(dir.resolve("_respackopts.conf"))
.referenceConfig(() -> {

View File

@ -1,7 +1,7 @@
package io.gitlab.jfronny.respackopts.filters;
import io.gitlab.jfronny.commons.logger.SystemLoggerPlus;
import io.gitlab.jfronny.libjf.data.manipulation.api.UserResourceEvents;
import io.gitlab.jfronny.respackopts.Respackopts;
import net.minecraft.resource.*;
import net.minecraft.resource.metadata.ResourceMetadataReader;
import net.minecraft.util.Identifier;
@ -11,8 +11,10 @@ import java.util.HashSet;
import java.util.Set;
import java.util.function.Supplier;
public enum DebugEvents implements UserResourceEvents.FindResource, UserResourceEvents.ParseMetadata, UserResourceEvents.Open, UserResourceEvents.OpenRoot {
public enum IOLogEvents implements UserResourceEvents.FindResource, UserResourceEvents.ParseMetadata, UserResourceEvents.Open, UserResourceEvents.OpenRoot {
INSTANCE;
private static final SystemLoggerPlus LOG = SystemLoggerPlus.forName("respackopts/io");
public void register() {
UserResourceEvents.FIND_RESOURCE.register(this);
@ -23,11 +25,11 @@ public enum DebugEvents implements UserResourceEvents.FindResource, UserResource
@Override
public ResourcePack.ResultConsumer findResources(ResourceType type, String namespace, String prefix, ResourcePack.ResultConsumer previous, ResourcePack pack) {
Respackopts.LOGGER.info("FIND_RESOURCE " + type + " in " + namespace + " " + prefix + " of " + pack.getId());
LOG.info("FIND_RESOURCE " + type + " in " + namespace + " " + prefix + " of " + pack.getId());
Set<Identifier> results = new HashSet<>();
return (identifier, inputStreamInputSupplier) -> {
if (!results.add(identifier)) {
Respackopts.LOGGER.warn("Duplicate identifier returned by findResources: " + identifier);
LOG.warn("Duplicate identifier returned by findResources: " + identifier);
}
previous.accept(identifier, inputStreamInputSupplier);
};
@ -35,19 +37,19 @@ public enum DebugEvents implements UserResourceEvents.FindResource, UserResource
@Override
public InputSupplier<InputStream> open(ResourceType type, Identifier id, InputSupplier<InputStream> previous, ResourcePack pack) {
Respackopts.LOGGER.info("OPEN " + type + " at " + id + " of " + pack.getId());
LOG.info("OPEN " + type + " at " + id + " of " + pack.getId());
return previous;
}
@Override
public InputSupplier<InputStream> openRoot(String[] fileName, InputSupplier<InputStream> previous, ResourcePack pack) {
Respackopts.LOGGER.info("OPEN_ROOT " + String.join("/", fileName) + " of " + pack.getId());
LOG.info("OPEN_ROOT " + String.join("/", fileName) + " of " + pack.getId());
return previous;
}
@Override
public <T> T parseMetadata(ResourceMetadataReader<T> reader, Supplier<T> previous, ResourcePack pack) {
Respackopts.LOGGER.info("PARSE_METADATA " + reader.getKey() + " of " + pack.getId());
LOG.info("PARSE_METADATA " + reader.getKey() + " of " + pack.getId());
return previous.get();
}
}

View File

@ -8,7 +8,6 @@
"respackopts.jfconfig.debugLogs.tooltip": "Logs some information useful for debugging packs or the mod itself. (requires restart)",
"respackopts.jfconfig.ioLogs": "IO Logs",
"respackopts.jfconfig.ioLogs.tooltip": "Log every resource access. WARNING: This WILL result in giant log files! (requires restart)",
"respackopts.jfconfig.dashloaderCompat": "Dashloader compatibility",
"respackopts.invalid": "Invalid value",
"respackopts.dumpSucceeded": "Successfully dumped the resource to %s",
"respackopts.dumpFailed": "Could not dump the requested resource, look at your log for details",