9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-19 15:09:15 +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

@@ -35,14 +35,14 @@ resource-pack:
resource-location: resource-location:
enable: true enable: true
random-namespace: random-namespace:
amount: 32 # 0 = disable amount: 16 # 0 = disable
length: 9 length: 9
random-path: random-path:
source: obf source: obf
depth: 16 depth: 16
anti-unzip: false anti-unzip: false
random-atlas: random-atlas:
amount: 5 # 0 = disable images-per-canvas: 32 # 0 = disable
use-double: true use-double: true
# Sometimes, some vanilla files that have been overwritten might be mistakenly obfuscated. # Sometimes, some vanilla files that have been overwritten might be mistakenly obfuscated.
# Please add the ignored textures/models/sounds here. # Please add the ignored textures/models/sounds here.

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.generation.ModelGenerator;
import net.momirealms.craftengine.core.pack.model.rangedisptach.CustomModelDataRangeDispatchProperty; import net.momirealms.craftengine.core.pack.model.rangedisptach.CustomModelDataRangeDispatchProperty;
import net.momirealms.craftengine.core.pack.obfuscation.ObfA; 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.pack.revision.Revision;
import net.momirealms.craftengine.core.plugin.CraftEngine; import net.momirealms.craftengine.core.plugin.CraftEngine;
import net.momirealms.craftengine.core.plugin.config.Config; import net.momirealms.craftengine.core.plugin.config.Config;
@@ -241,6 +242,8 @@ public abstract class AbstractPackManager implements PackManager {
try { try {
Object magicObject = magicConstructor.newInstance(p1, p2); Object magicObject = magicConstructor.newInstance(p1, p2);
magicMethod.invoke(magicObject); magicMethod.invoke(magicObject);
} catch (ResourcePackGenerationException e) {
this.plugin.logger().warn("Failed to generate resource pack: " + e.getMessage());
} catch (Throwable e) { } 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,}", "")); 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 String resource_pack$protection$obfuscation$resource_location$random_path$source;
protected int resource_pack$protection$obfuscation$resource_location$random_path$depth; protected int resource_pack$protection$obfuscation$resource_location$random_path$depth;
protected boolean resource_pack$protection$obfuscation$resource_location$random_path$anti_unzip; 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 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_textures;
protected List<String> resource_pack$protection$obfuscation$resource_location$bypass_models; 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$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$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_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$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_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"); 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; return instance.resource_pack$protection$obfuscation$resource_location$random_path$anti_unzip;
} }
public static int atlasAmount() { public static int imagesPerCanvas() {
return instance.resource_pack$protection$obfuscation$resource_location$random_atlas$amount; return instance.resource_pack$protection$obfuscation$resource_location$random_atlas$images_per_canvas;
} }
public static boolean useDouble() { public static boolean useDouble() {

View File

@@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx1G
# Project settings # Project settings
# Rule: [major update].[feature update].[bug fix] # Rule: [major update].[feature update].[bug fix]
project_version=0.0.58.2 project_version=0.0.58.3.2
config_version=39 config_version=39
lang_version=20 lang_version=20
project_group=net.momirealms project_group=net.momirealms
@@ -41,7 +41,7 @@ commons_io_version=2.18.0
commons_imaging_version=1.0.0-alpha6 commons_imaging_version=1.0.0-alpha6
commons_lang3_version=3.17.0 commons_lang3_version=3.17.0
sparrow_nbt_version=0.9.1 sparrow_nbt_version=0.9.1
sparrow_util_version=0.50 sparrow_util_version=0.50.3
fastutil_version=8.5.15 fastutil_version=8.5.15
netty_version=4.1.121.Final netty_version=4.1.121.Final
joml_version=1.10.8 joml_version=1.10.8