diff --git a/common-files/src/main/resources/config.yml b/common-files/src/main/resources/config.yml index 9ea8b709b..3c0309030 100644 --- a/common-files/src/main/resources/config.yml +++ b/common-files/src/main/resources/config.yml @@ -35,14 +35,14 @@ resource-pack: resource-location: enable: true random-namespace: - amount: 32 # 0 = disable + amount: 16 # 0 = disable length: 9 random-path: source: obf depth: 16 anti-unzip: false random-atlas: - amount: 5 # 0 = disable + images-per-canvas: 32 # 0 = disable use-double: true # Sometimes, some vanilla files that have been overwritten might be mistakenly obfuscated. # Please add the ignored textures/models/sounds here. diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java b/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java index cf7c43a4a..acc87dc43 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java @@ -25,6 +25,7 @@ import net.momirealms.craftengine.core.pack.model.generation.ModelGeneration; import net.momirealms.craftengine.core.pack.model.generation.ModelGenerator; import net.momirealms.craftengine.core.pack.model.rangedisptach.CustomModelDataRangeDispatchProperty; import net.momirealms.craftengine.core.pack.obfuscation.ObfA; +import net.momirealms.craftengine.core.pack.obfuscation.ResourcePackGenerationException; import net.momirealms.craftengine.core.pack.revision.Revision; import net.momirealms.craftengine.core.plugin.CraftEngine; import net.momirealms.craftengine.core.plugin.config.Config; @@ -241,6 +242,8 @@ public abstract class AbstractPackManager implements PackManager { try { Object magicObject = magicConstructor.newInstance(p1, p2); magicMethod.invoke(magicObject); + } catch (ResourcePackGenerationException e) { + this.plugin.logger().warn("Failed to generate resource pack: " + e.getMessage()); } catch (Throwable e) { this.plugin.logger().warn("Failed to generate zip files\n" + new StringWriter(){{e.printStackTrace(new PrintWriter(this));}}.toString().replaceAll("\\.[Il]{2,}", "").replaceAll("/[Il]{2,}", "")); } diff --git a/core/src/main/java/net/momirealms/craftengine/core/pack/obfuscation/ResourcePackGenerationException.java b/core/src/main/java/net/momirealms/craftengine/core/pack/obfuscation/ResourcePackGenerationException.java new file mode 100644 index 000000000..adebeba89 --- /dev/null +++ b/core/src/main/java/net/momirealms/craftengine/core/pack/obfuscation/ResourcePackGenerationException.java @@ -0,0 +1,8 @@ +package net.momirealms.craftengine.core.pack.obfuscation; + +public class ResourcePackGenerationException extends RuntimeException { + + public ResourcePackGenerationException(String message) { + super(message); + } +} diff --git a/core/src/main/java/net/momirealms/craftengine/core/plugin/config/Config.java b/core/src/main/java/net/momirealms/craftengine/core/plugin/config/Config.java index 65c05e6c4..72259e56d 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/plugin/config/Config.java +++ b/core/src/main/java/net/momirealms/craftengine/core/plugin/config/Config.java @@ -74,7 +74,7 @@ public class Config { protected String resource_pack$protection$obfuscation$resource_location$random_path$source; protected int resource_pack$protection$obfuscation$resource_location$random_path$depth; protected boolean resource_pack$protection$obfuscation$resource_location$random_path$anti_unzip; - protected int resource_pack$protection$obfuscation$resource_location$random_atlas$amount; + protected int resource_pack$protection$obfuscation$resource_location$random_atlas$images_per_canvas; protected boolean resource_pack$protection$obfuscation$resource_location$random_atlas$use_double; protected List resource_pack$protection$obfuscation$resource_location$bypass_textures; protected List resource_pack$protection$obfuscation$resource_location$bypass_models; @@ -258,7 +258,7 @@ public class Config { resource_pack$protection$obfuscation$resource_location$random_path$depth = config.getInt("resource-pack.protection.obfuscation.resource-location.random-path.depth", 16); resource_pack$protection$obfuscation$resource_location$random_path$source = config.getString("resource-pack.protection.obfuscation.resource-location.random-path.source", "obf"); resource_pack$protection$obfuscation$resource_location$random_path$anti_unzip = config.getBoolean("resource-pack.protection.obfuscation.resource-location.random-path.anti-unzip", false); - resource_pack$protection$obfuscation$resource_location$random_atlas$amount = config.getInt("resource-pack.protection.obfuscation.resource-location.random-atlas.amount", 5); + resource_pack$protection$obfuscation$resource_location$random_atlas$images_per_canvas = config.getInt("resource-pack.protection.obfuscation.resource-location.random-atlas.images-per-canvas", 16); resource_pack$protection$obfuscation$resource_location$random_atlas$use_double = config.getBoolean("resource-pack.protection.obfuscation.resource-location.random-atlas.use-double", true); resource_pack$protection$obfuscation$resource_location$bypass_textures = config.getStringList("resource-pack.protection.obfuscation.resource-location.bypass-textures"); resource_pack$protection$obfuscation$resource_location$bypass_models = config.getStringList("resource-pack.protection.obfuscation.resource-location.bypass-models"); @@ -572,8 +572,8 @@ public class Config { return instance.resource_pack$protection$obfuscation$resource_location$random_path$anti_unzip; } - public static int atlasAmount() { - return instance.resource_pack$protection$obfuscation$resource_location$random_atlas$amount; + public static int imagesPerCanvas() { + return instance.resource_pack$protection$obfuscation$resource_location$random_atlas$images_per_canvas; } public static boolean useDouble() { diff --git a/gradle.properties b/gradle.properties index 1757b198e..f1865ed56 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx1G # Project settings # Rule: [major update].[feature update].[bug fix] -project_version=0.0.58.2 +project_version=0.0.58.3.2 config_version=39 lang_version=20 project_group=net.momirealms @@ -41,7 +41,7 @@ commons_io_version=2.18.0 commons_imaging_version=1.0.0-alpha6 commons_lang3_version=3.17.0 sparrow_nbt_version=0.9.1 -sparrow_util_version=0.50 +sparrow_util_version=0.50.3 fastutil_version=8.5.15 netty_version=4.1.121.Final joml_version=1.10.8