mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-21 04:42:17 +00:00
optimize resource reload (#2070)
This commit is contained in:
1 parent
73f5556595
commit
bb67f82701
3 files changed
+14
-10
No files matched your search
@@ -15,14 +15,15 @@ public class ResourceLocationWithSource extends ResourceLocation {
|
||||
private final boolean isDirectory;
|
||||
|
||||
public ResourceLocationWithSource(IResourcePack source, ResourceLocation resource) {
|
||||
String resourcePath = resource.getResourcePath();
|
||||
boolean isDirectory = resourcePath.endsWith("/");
|
||||
|
||||
super(
|
||||
resource.getResourceDomain(),
|
||||
resource.getResourcePath()
|
||||
.replaceFirst("/$", ""));
|
||||
isDirectory ? resourcePath.substring(0, resourcePath.length() - 1) : resourcePath);
|
||||
this.source = source;
|
||||
order = ResourceList.getResourcePackOrder(source);
|
||||
isDirectory = resource.getResourcePath()
|
||||
.endsWith("/");
|
||||
this.order = ResourceList.getResourcePackOrder(source);
|
||||
this.isDirectory = isDirectory;
|
||||
}
|
||||
|
||||
public IResourcePack getSource() {
|
||||
|
||||
@@ -196,10 +196,13 @@ public class TexturePackAPI {
|
||||
}
|
||||
path = path.replace(File.separatorChar, '/');
|
||||
if (path.startsWith(ASSETS)) {
|
||||
path = path.substring(ASSETS.length());
|
||||
int slash = path.indexOf('/');
|
||||
if (slash > 0 && slash + 1 < path.length()) {
|
||||
return new ResourceLocation(path.substring(0, slash), path.substring(slash + 1));
|
||||
int namespaceStart = ASSETS.length();
|
||||
int slash = path.indexOf('/', namespaceStart);
|
||||
|
||||
if (slash > namespaceStart && slash + 1 < path.length()) {
|
||||
return new ResourceLocation(
|
||||
path.substring(namespaceStart, slash),
|
||||
path.substring(slash + 1));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user