use of me.ichun.mods.ichunutil.client.render.NativeImageTexture in project iChunUtil by iChun.
the class Project method getNativeImageResourceLocation.
@OnlyIn(Dist.CLIENT)
public ResourceLocation getNativeImageResourceLocation() {
if (textureBytes != null) {
if (nativeImageTexture == null) {
try (NativeImage image = NativeImage.read(new ByteArrayInputStream(textureBytes))) {
nativeImageTexture = new NativeImageTexture(image);
Minecraft.getInstance().getTextureManager().loadTexture(nativeImageTexture.getResourceLocation(), nativeImageTexture);
} catch (IOException e) {
iChunUtil.LOGGER.error("Failed to read NativeImage for project: " + name);
e.printStackTrace();
}
}
return nativeImageTexture.getResourceLocation();
}
return null;
}
Aggregations