ResourceLocation Utils for doing things..

This commit is contained in:
cpw 2018-10-11 19:35:22 -04:00
parent 0b26047ea8
commit 558e1d2fb0
1 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,12 @@
package net.minecraftforge.fml;
import com.google.common.base.Joiner;
import net.minecraft.util.ResourceLocation;
import java.nio.file.Path;
public class ResourceLocationUtils {
public static ResourceLocation pathToResourceLocation(Path path, int maxDepth) {
return new ResourceLocation(path.getName(0).toString(), Joiner.on("/").join(path.subpath(1, Math.min(maxDepth, path.getNameCount())).iterator()));
}
}