9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-27 10:59:07 +00:00

Merge remote-tracking branch 'upstream/dev' into dev

# Conflicts:
#	core/src/main/java/net/momirealms/craftengine/core/pack/AbstractPackManager.java
This commit is contained in:
jhqwqmc
2025-06-26 09:54:58 +08:00
5 changed files with 19 additions and 8 deletions

View File

@@ -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,}", ""));
}

View File

@@ -0,0 +1,8 @@
package net.momirealms.craftengine.core.pack.obfuscation;
public class ResourcePackGenerationException extends RuntimeException {
public ResourcePackGenerationException(String message) {
super(message);
}
}

View File

@@ -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<String> resource_pack$protection$obfuscation$resource_location$bypass_textures;
protected List<String> 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() {