Flywheel/src/main/java/com/jozufozu/flywheel/util/ResourceUtil.java
Jozufozu 947c611bbc Some decoupling
- New Loader class in charge of loading and compiling everything
 - ShaderSources now only loads sources
 - ShaderSources is immutable now
 - Resolver singleton in charge of managing name resolutions
 - ProgramSpecs go through Resolver
 - WorldShaderPipeline no longer needs reference to ShaderSources
2021-08-10 15:20:51 -07:00

20 lines
712 B
Java

package com.jozufozu.flywheel.util;
import net.minecraft.util.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()));
}
}