com.parzivail.util.client.texture.tinted.TintedTextureProvider Maven / Gradle / Ivy
package com.parzivail.util.client.texture.tinted;
import com.parzivail.pswg.Resources;
import com.parzivail.util.client.NativeImageUtil;
import com.parzivail.util.client.texture.CallbackTexture;
import com.parzivail.util.client.texture.TextureProvider;
import com.parzivail.util.data.TintedIdentifier;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.class_1060;
import net.minecraft.class_1068;
import net.minecraft.class_2960;
import java.util.function.Consumer;
@Environment(EnvType.CLIENT)
public class TintedTextureProvider extends TextureProvider
{
public static final class_2960 ROOT = Resources.id("///tinted");
public TintedTextureProvider(class_1060 textureManager)
{
super(ROOT, textureManager);
}
public class_2960 tint(String textureId, class_2960 texture, int color)
{
return getId(
textureId,
() -> texture,
() -> new TintedIdentifier(texture.method_12836(), texture.method_12832(), NativeImageUtil.argbToAbgr(color))
);
}
@Override
protected CallbackTexture createTexture(class_2960 destId, TintedIdentifier request, Consumer callback)
{
registerDependencyCallbacks(destId, request);
return new TintedTexture(request, class_1068.method_4649(), callback);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy