ResourceLocation Utils for doing things..
This commit is contained in:
parent
0b26047ea8
commit
558e1d2fb0
1 changed files with 12 additions and 0 deletions
|
@ -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()));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue