Skip to content

Commit

Permalink
Use new dynamic loader logic for the generate command
Browse files Browse the repository at this point in the history
  • Loading branch information
KnightMiner committed Nov 21, 2022
1 parent f41c5df commit b837b46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package slimeknights.tconstruct.library.client.data.util;

import lombok.RequiredArgsConstructor;
import com.mojang.blaze3d.platform.NativeImage;
import lombok.RequiredArgsConstructor;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.resources.Resource;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.resources.ResourceLocation;
import slimeknights.tconstruct.library.client.model.DynamicTextureLoader;

import java.io.IOException;

Expand All @@ -20,7 +21,7 @@ private ResourceLocation getLocation(ResourceLocation base) {

@Override
public boolean exists(ResourceLocation path) {
return manager.hasResource(getLocation(path));
return DynamicTextureLoader.textureExists(manager, DynamicTextureLoader.getTextureFolder(path), path);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import slimeknights.tconstruct.library.client.materials.MaterialRenderInfoJson;
import slimeknights.tconstruct.library.client.materials.MaterialRenderInfoJson.MaterialGeneratorJson;
import slimeknights.tconstruct.library.client.materials.MaterialRenderInfoLoader;
import slimeknights.tconstruct.library.client.model.DynamicTextureLoader;
import slimeknights.tconstruct.library.materials.definition.MaterialVariantId;
import slimeknights.tconstruct.library.materials.stats.MaterialStatsId;
import slimeknights.tconstruct.shared.network.GeneratePartTexturesPacket.Operation;
Expand Down Expand Up @@ -130,6 +131,7 @@ public static void generateTextures(Operation operation, String modId, String ma
}
}
spriteReader.closeAll();
DynamicTextureLoader.clearCache();

// success message
long deltaTime = System.nanoTime() - time;
Expand Down

0 comments on commit b837b46

Please sign in to comment.