Reputation: 11
I'm getting the following error while registering a texture: 'Identifier(java.lang.String, java.lang.String)' has private access in 'net.minecraft.util.Identifier'
Error occurs at line 18
private static final Identifier GLOW_TEXTURE = new Identifier(Mod.MOD_ID,"textures/misc/item_overlay.png");
While registering a texture identifier used in a mixin of the class 'ItemRenderer', the code fails to compile. (Some parts will be modified for personal reasons)
Please note that the code must work on the latest version as of this post, 1.21.4
package com.example.mod.mixin;
import com.example.mod.Mod;
import com.example.mod.item.ModItems;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.render.*;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@Mixin(ItemRenderer.class)
public abstract class ItemRendererMixin {
private static final Identifier GLOW_TEXTURE = new Identifier(Mod.MOD_ID,"textures/misc/item_overlay.png");
@Inject(method = "renderItem", at = @At("TAIL"))
public void renderGlowingOutline(ItemStack stack, MatrixStack matrices, VertexConsumerProvider vertexConsumers) {
if (stack.getItem() == ModItems.Item_Example) {
RenderSystem.disableDepthTest();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityTranslucent(GLOW_TEXTURE));
matrices.push();
matrices.pop();
RenderSystem.disableBlend();
RenderSystem.enableDepthTest();
}
}
}
Upvotes: 1
Views: 199
Reputation: 56
New changes have been made to the way Minecraft handles identifiers and you will now need to replace new Identifier(...)
with Identifier.of(...)
.
Upvotes: 1