2021-05-04 06:46:33 +02:00
|
|
|
package com.jozufozu.flywheel.backend;
|
|
|
|
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
|
|
|
|
public class ResourceUtil {
|
|
|
|
|
|
|
|
public static ResourceLocation subPath(ResourceLocation root, String subPath) {
|
|
|
|
return new ResourceLocation(root.getNamespace(), root.getPath() + subPath);
|
|
|
|
}
|
2021-05-23 02:45:01 +02:00
|
|
|
|
|
|
|
public static ResourceLocation removePrefixUnchecked(ResourceLocation full, String root) {
|
2021-06-30 21:43:54 +02:00
|
|
|
return new ResourceLocation(full.getNamespace(), full.getPath()
|
|
|
|
.substring(root.length()));
|
2021-05-23 02:45:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static ResourceLocation trim(ResourceLocation loc, String prefix, String suffix) {
|
|
|
|
String path = loc.getPath();
|
|
|
|
return new ResourceLocation(loc.getNamespace(), path.substring(prefix.length(), path.length() - suffix.length()));
|
|
|
|
}
|
2021-05-04 06:46:33 +02:00
|
|
|
}
|