mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
net.minecraft.server.packs(.repository)
This commit is contained in:
parent
68961d9f5e
commit
3efd1caa64
3 changed files with 14 additions and 14 deletions
|
@ -1,11 +1,11 @@
|
||||||
--- a/net/minecraft/server/packs/PathPackResources.java
|
--- a/net/minecraft/server/packs/PathPackResources.java
|
||||||
+++ b/net/minecraft/server/packs/PathPackResources.java
|
+++ b/net/minecraft/server/packs/PathPackResources.java
|
||||||
@@ -103,6 +103,12 @@
|
@@ -103,6 +_,12 @@
|
||||||
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(path)) {
|
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(path)) {
|
||||||
for (Path path2 : directoryStream) {
|
for (Path path1 : directoryStream) {
|
||||||
String string = path2.getFileName().toString();
|
String string = path1.getFileName().toString();
|
||||||
+ // Paper start - Improve logging and errors
|
+ // 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));
|
+ LOGGER.error("Invalid directory entry: {} in {}.", string, this.root, new java.nio.file.NotDirectoryException(string));
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
|
@ -1,6 +1,6 @@
|
||||||
--- a/net/minecraft/server/packs/VanillaPackResourcesBuilder.java
|
--- a/net/minecraft/server/packs/VanillaPackResourcesBuilder.java
|
||||||
+++ b/net/minecraft/server/packs/VanillaPackResourcesBuilder.java
|
+++ b/net/minecraft/server/packs/VanillaPackResourcesBuilder.java
|
||||||
@@ -138,6 +138,15 @@
|
@@ -137,6 +_,15 @@
|
||||||
|
|
||||||
public VanillaPackResourcesBuilder applyDevelopmentConfig() {
|
public VanillaPackResourcesBuilder applyDevelopmentConfig() {
|
||||||
developmentConfig.accept(this);
|
developmentConfig.accept(this);
|
|
@ -1,6 +1,6 @@
|
||||||
--- a/net/minecraft/server/packs/repository/ServerPacksSource.java
|
--- a/net/minecraft/server/packs/repository/ServerPacksSource.java
|
||||||
+++ b/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() {
|
public static VanillaPackResources createVanillaPackSource() {
|
||||||
return new VanillaPackResourcesBuilder()
|
return new VanillaPackResourcesBuilder()
|
||||||
.setMetadata(BUILT_IN_METADATA)
|
.setMetadata(BUILT_IN_METADATA)
|
||||||
|
@ -9,23 +9,23 @@
|
||||||
.applyDevelopmentConfig()
|
.applyDevelopmentConfig()
|
||||||
.pushJarResources()
|
.pushJarResources()
|
||||||
.build(VANILLA_PACK_INFO);
|
.build(VANILLA_PACK_INFO);
|
||||||
@@ -68,7 +68,18 @@
|
@@ -68,7 +_,18 @@
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
protected Pack createBuiltinPack(String fileName, Pack.ResourcesSupplier packFactory, Component displayName) {
|
protected Pack createBuiltinPack(String id, Pack.ResourcesSupplier resources, Component title) {
|
||||||
- return Pack.readMetaAndCreate(createBuiltInPackLocation(fileName, displayName), packFactory, PackType.SERVER_DATA, FEATURE_SELECTION_CONFIG);
|
- return Pack.readMetaAndCreate(createBuiltInPackLocation(id, title), resources, PackType.SERVER_DATA, FEATURE_SELECTION_CONFIG);
|
||||||
+ // Paper start - custom built-in pack
|
+ // Paper start - custom built-in pack
|
||||||
+ final PackLocationInfo info;
|
+ final PackLocationInfo info;
|
||||||
+ final PackSelectionConfig packConfig;
|
+ final PackSelectionConfig packConfig;
|
||||||
+ if ("paper".equals(fileName)) {
|
+ if ("paper".equals(id)) {
|
||||||
+ info = new PackLocationInfo(fileName, displayName, PackSource.BUILT_IN, Optional.empty());
|
+ info = new PackLocationInfo(id, title, PackSource.BUILT_IN, Optional.empty());
|
||||||
+ packConfig = new PackSelectionConfig(true, Pack.Position.TOP, true);
|
+ packConfig = new PackSelectionConfig(true, Pack.Position.TOP, true);
|
||||||
+ } else {
|
+ } else {
|
||||||
+ info = createBuiltInPackLocation(fileName, displayName);
|
+ info = createBuiltInPackLocation(id, title);
|
||||||
+ packConfig = FEATURE_SELECTION_CONFIG;
|
+ 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
|
+ // Paper end - custom built-in pack
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PackRepository createPackRepository(Path dataPacksPath, DirectoryValidator symlinkFinder) {
|
public static PackRepository createPackRepository(Path folder, DirectoryValidator validator) {
|
Loading…
Reference in a new issue