Skip to content

Commit

Permalink
ModelContent
Browse files Browse the repository at this point in the history
  • Loading branch information
HappyRespawnanchor committed Nov 9, 2024
1 parent 4983002 commit d637384
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions common/src/main/java/org/ayamemc/ayame/util/ModelContent.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@
*/

package org.ayamemc.ayame.util;
import net.minecraft.server.packs.FilePackResources;
import net.minecraft.server.packs.PathPackResources;
import net.minecraft.server.packs.linkfs.LinkFileSystem;
import net.minecraft.server.packs.repository.FolderRepositorySource;
import net.minecraft.server.packs.repository.Pack;
import net.minecraft.server.packs.repository.PackDetector;
import net.minecraft.world.level.validation.DirectoryValidator;
import org.ayamemc.ayame.Ayame;
import org.ayamemc.ayame.model.resource.ModelResourceRegistry;
import org.jetbrains.annotations.Nullable;

Expand All @@ -41,14 +46,19 @@ public ModelContent(DirectoryValidator validator) {
super(validator);
}

@Override
protected @Nullable ModelResourceRegistry.ModelFile createZipPack(Path path) throws IOException {
return null;
@Nullable
protected ModelResourceRegistry.ModelFile createZipPack(Path path) {
FileSystem fileSystem = path.getFileSystem();
if (fileSystem != FileSystems.getDefault() && !(fileSystem instanceof LinkFileSystem)) {
Ayame.LOGGER.info("Can't open pack archive at {}", path);
return null;
} else {
return new FilePackResources.FileResourcesSupplier(path);
}
}

@Override
protected @Nullable ModelResourceRegistry.ModelFile createDirectoryPack(Path path) throws IOException {
return null;
protected ModelResourceRegistry.ModelFile createDirectoryPack(Path path) {
return new PathPackResources.PathResourcesSupplier(path);
}


Expand Down

0 comments on commit d637384

Please sign in to comment.