mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-19 15:09:15 +00:00
修复低版本资源包生成
This commit is contained in:
@@ -184,6 +184,7 @@ tasks {
|
||||
* Register Run Dev Server Tasks
|
||||
*/
|
||||
listOf(
|
||||
"1.21.11",
|
||||
"1.21.10",
|
||||
"1.21.8",
|
||||
"1.21.5",
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ReloadCommand extends BukkitCommandFeature<CommandSender> {
|
||||
Component.text(reloadResult.syncTime())
|
||||
);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
handleFeedback(context, MessageConstants.COMMAND_RELOAD_CONFIG_FAILURE);
|
||||
plugin().logger().warn("Failed to reload config", e);
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class ReloadCommand extends BukkitCommandFeature<CommandSender> {
|
||||
Component.text(reloadResult.syncTime())
|
||||
);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
handleFeedback(context, MessageConstants.COMMAND_RELOAD_CONFIG_FAILURE);
|
||||
plugin().logger().warn("Failed to reload config", e);
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class ReloadCommand extends BukkitCommandFeature<CommandSender> {
|
||||
long time2 = System.currentTimeMillis();
|
||||
long packTime = time2 - time1;
|
||||
handleFeedback(context, MessageConstants.COMMAND_RELOAD_PACK_SUCCESS, Component.text(packTime));
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
handleFeedback(context, MessageConstants.COMMAND_RELOAD_PACK_FAILURE);
|
||||
plugin().logger().warn("Failed to generate resource pack", e);
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class ReloadCommand extends BukkitCommandFeature<CommandSender> {
|
||||
Component.text(reloadResult.syncTime()),
|
||||
Component.text(packTime)
|
||||
);
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
handleFeedback(context, MessageConstants.COMMAND_RELOAD_PACK_FAILURE);
|
||||
plugin().logger().warn("Failed to generate resource pack", e);
|
||||
} finally {
|
||||
|
||||
@@ -740,7 +740,7 @@ public abstract class AbstractPackManager implements PackManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateResourcePack() throws IOException {
|
||||
public void generateResourcePack() throws Exception {
|
||||
this.plugin.logger().info(TranslationManager.instance().translateLog("info.resource_pack.start"));
|
||||
long time1 = System.currentTimeMillis();
|
||||
|
||||
@@ -3039,7 +3039,7 @@ public abstract class AbstractPackManager implements PackManager {
|
||||
}
|
||||
|
||||
private void processZipFile(Path zipFile, Path sourceFolder, @Nullable FileSystem fs,
|
||||
Map<String, List<Path>> conflictChecker, Map<Path, CachedAssetFile> previousFiles) throws IOException {
|
||||
Map<String, List<Path>> conflictChecker, Map<Path, CachedAssetFile> previousFiles) {
|
||||
try (FileSystem zipFs = FileSystems.newFileSystem(zipFile)) {
|
||||
long zipLastModified = Files.getLastModifiedTime(zipFile).toMillis();
|
||||
long zipSize = Files.size(zipFile);
|
||||
@@ -3064,11 +3064,17 @@ public abstract class AbstractPackManager implements PackManager {
|
||||
cachedAssetFiles.put(sourcePath, cachedAsset);
|
||||
}
|
||||
if (fs != null) {
|
||||
try {
|
||||
updateConflictChecker(fs, conflictChecker, entry, sourcePath, entryPathInZip, cachedAsset.data());
|
||||
} catch (Exception e) {
|
||||
AbstractPackManager.this.plugin.logger().warn("Failed to update conflict checker", e);
|
||||
}
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
this.plugin.logger().warn("Failed to process zip file " + zipFile, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public interface PackManager extends Manageable {
|
||||
|
||||
void clearResourceConfigs();
|
||||
|
||||
void generateResourcePack() throws IOException;
|
||||
void generateResourcePack() throws Exception;
|
||||
|
||||
Path resourcePackPath();
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ public class ResolutionMergePackMcMeta implements Resolution {
|
||||
newLanguage.add(entry.getKey(), entry.getValue());
|
||||
}
|
||||
});
|
||||
if (!newLanguage.isEmpty()) {
|
||||
if (!newLanguage.asMap().isEmpty()) { // 兼容低版本gson
|
||||
merged.add("language", newLanguage);
|
||||
}
|
||||
// 第七步,合并其他未知元素
|
||||
|
||||
Reference in New Issue
Block a user