mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-11 06:46:05 +01:00
20 lines
717 B
Java
20 lines
717 B
Java
package com.jozufozu.flywheel.util;
|
|
|
|
import net.minecraft.resources.ResourceLocation;
|
|
|
|
public class ResourceUtil {
|
|
|
|
public static ResourceLocation subPath(ResourceLocation root, String subPath) {
|
|
return new ResourceLocation(root.getNamespace(), root.getPath() + subPath);
|
|
}
|
|
|
|
public static ResourceLocation removePrefixUnchecked(ResourceLocation full, String root) {
|
|
return new ResourceLocation(full.getNamespace(), full.getPath()
|
|
.substring(root.length()));
|
|
}
|
|
|
|
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()));
|
|
}
|
|
}
|