From 3efd1caa64119fb63046aecb957c2c0e58bf42b2 Mon Sep 17 00:00:00 2001 From: Noah van der Aa Date: Sat, 14 Dec 2024 17:39:31 +0100 Subject: [PATCH] net.minecraft.server.packs(.repository) --- .../server/packs/PathPackResources.java.patch | 8 ++++---- .../VanillaPackResourcesBuilder.java.patch | 2 +- .../repository/ServerPacksSource.java.patch | 18 +++++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-) rename paper-server/patches/{unapplied => sources}/net/minecraft/server/packs/PathPackResources.java.patch (77%) rename paper-server/patches/{unapplied => sources}/net/minecraft/server/packs/VanillaPackResourcesBuilder.java.patch (97%) rename paper-server/patches/{unapplied => sources}/net/minecraft/server/packs/repository/ServerPacksSource.java.patch (59%) diff --git a/paper-server/patches/unapplied/net/minecraft/server/packs/PathPackResources.java.patch b/paper-server/patches/sources/net/minecraft/server/packs/PathPackResources.java.patch similarity index 77% rename from paper-server/patches/unapplied/net/minecraft/server/packs/PathPackResources.java.patch rename to paper-server/patches/sources/net/minecraft/server/packs/PathPackResources.java.patch index 4c21d9802f..7f7053b2b2 100644 --- a/paper-server/patches/unapplied/net/minecraft/server/packs/PathPackResources.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/packs/PathPackResources.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/packs/PathPackResources.java +++ b/net/minecraft/server/packs/PathPackResources.java -@@ -103,6 +103,12 @@ +@@ -103,6 +_,12 @@ try (DirectoryStream directoryStream = Files.newDirectoryStream(path)) { - for (Path path2 : directoryStream) { - String string = path2.getFileName().toString(); + for (Path path1 : directoryStream) { + String string = path1.getFileName().toString(); + // Paper start - Improve logging and errors -+ if (!Files.isDirectory(path2)) { ++ if (!Files.isDirectory(path1)) { + LOGGER.error("Invalid directory entry: {} in {}.", string, this.root, new java.nio.file.NotDirectoryException(string)); + continue; + } diff --git a/paper-server/patches/unapplied/net/minecraft/server/packs/VanillaPackResourcesBuilder.java.patch b/paper-server/patches/sources/net/minecraft/server/packs/VanillaPackResourcesBuilder.java.patch similarity index 97% rename from paper-server/patches/unapplied/net/minecraft/server/packs/VanillaPackResourcesBuilder.java.patch rename to paper-server/patches/sources/net/minecraft/server/packs/VanillaPackResourcesBuilder.java.patch index 5f4418300b..acd2b45a58 100644 --- a/paper-server/patches/unapplied/net/minecraft/server/packs/VanillaPackResourcesBuilder.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/packs/VanillaPackResourcesBuilder.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/packs/VanillaPackResourcesBuilder.java +++ b/net/minecraft/server/packs/VanillaPackResourcesBuilder.java -@@ -138,6 +138,15 @@ +@@ -137,6 +_,15 @@ public VanillaPackResourcesBuilder applyDevelopmentConfig() { developmentConfig.accept(this); diff --git a/paper-server/patches/unapplied/net/minecraft/server/packs/repository/ServerPacksSource.java.patch b/paper-server/patches/sources/net/minecraft/server/packs/repository/ServerPacksSource.java.patch similarity index 59% rename from paper-server/patches/unapplied/net/minecraft/server/packs/repository/ServerPacksSource.java.patch rename to paper-server/patches/sources/net/minecraft/server/packs/repository/ServerPacksSource.java.patch index a5d66bbff8..dc3a6578a8 100644 --- a/paper-server/patches/unapplied/net/minecraft/server/packs/repository/ServerPacksSource.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/packs/repository/ServerPacksSource.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/packs/repository/ServerPacksSource.java +++ b/net/minecraft/server/packs/repository/ServerPacksSource.java -@@ -48,7 +48,7 @@ +@@ -48,7 +_,7 @@ public static VanillaPackResources createVanillaPackSource() { return new VanillaPackResourcesBuilder() .setMetadata(BUILT_IN_METADATA) @@ -9,23 +9,23 @@ .applyDevelopmentConfig() .pushJarResources() .build(VANILLA_PACK_INFO); -@@ -68,7 +68,18 @@ +@@ -68,7 +_,18 @@ @Nullable @Override - protected Pack createBuiltinPack(String fileName, Pack.ResourcesSupplier packFactory, Component displayName) { -- return Pack.readMetaAndCreate(createBuiltInPackLocation(fileName, displayName), packFactory, PackType.SERVER_DATA, FEATURE_SELECTION_CONFIG); + protected Pack createBuiltinPack(String id, Pack.ResourcesSupplier resources, Component title) { +- return Pack.readMetaAndCreate(createBuiltInPackLocation(id, title), resources, PackType.SERVER_DATA, FEATURE_SELECTION_CONFIG); + // Paper start - custom built-in pack + final PackLocationInfo info; + final PackSelectionConfig packConfig; -+ if ("paper".equals(fileName)) { -+ info = new PackLocationInfo(fileName, displayName, PackSource.BUILT_IN, Optional.empty()); ++ if ("paper".equals(id)) { ++ info = new PackLocationInfo(id, title, PackSource.BUILT_IN, Optional.empty()); + packConfig = new PackSelectionConfig(true, Pack.Position.TOP, true); + } else { -+ info = createBuiltInPackLocation(fileName, displayName); ++ info = createBuiltInPackLocation(id, title); + packConfig = FEATURE_SELECTION_CONFIG; + } -+ return Pack.readMetaAndCreate(info, packFactory, PackType.SERVER_DATA, packConfig); ++ return Pack.readMetaAndCreate(info, resources, PackType.SERVER_DATA, packConfig); + // Paper end - custom built-in pack } - public static PackRepository createPackRepository(Path dataPacksPath, DirectoryValidator symlinkFinder) { + public static PackRepository createPackRepository(Path folder, DirectoryValidator validator) {