Jump to content

[1.12.2] Particle Doesn't Have Texture


unassigned

Recommended Posts

Hello, I have a custom particle that has a custom texture, however, the texture always seems to be missing and just displays as pink/black. Here is the code for the particle:

@SideOnly(Side.CLIENT)
public class ParticleInfuse extends Particle {

    public static final ResourceLocation TEXTURE = new ResourceLocation(VoidUtils.MODID, "particles/infuse");
    private double[] args;

    public ParticleInfuse(World world, double x, double y, double z, double xOff, double yOff, double zOff, double... args){
        super(world, x+xOff, y+yOff, z+zOff, 0, 0, 0);

        TextureMap map = Minecraft.getMinecraft().getTextureMapBlocks();
        this.setParticleTexture(map.getAtlasSprite(TEXTURE.toString()));

        System.out.println(TEXTURE.toString());

        this.args = args;

        this.particleMaxAge = 30; //1.5 seconds
        this.particleScale *= 1;
    }

    @Override
    public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
        super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
    }

    @Override
    public void onUpdate() {
        this.prevPosX = this.posX;
        this.prevPosY = this.posY;
        this.prevPosZ = this.posZ;

        if (this.particleAge++ >= this.particleMaxAge)
        {
            this.setExpired();
        }

        if(args.length == 3){
            double toX = this.args[0];
            double toY = this.args[1];
            double toZ = this.args[2];
            double moveFactor = 0.125d;

            this.posX += (toX - this.posX)*moveFactor;
            this.posY += (toY - this.posY)*moveFactor;
            this.posZ += (toZ - this.posZ)*moveFactor;

        }

    }

    @Override
    public int getFXLayer() {
        return 1;
    }
}

Highlighting: In the constructor, I'm using:

        TextureMap map = Minecraft.getMinecraft().getTextureMapBlocks();
        this.setParticleTexture(map.getAtlasSprite(TEXTURE.toString()));

to bind the texture, and overriding FX layer to make sure that it will use my custom texture.

I've even to go as far as to print the texture location and make sure that the file exists there, but still no luck.

 

Thanks.

Link to comment
Share on other sites

While it's not my specialty in minecraft modding, I do know that many systems require textures to follow very specific...specifications, so I would double check the file itself.

In particular, many systems require that the texture have both its width and height be a power of 2 (16, 32, 64...)

 

I just saw a case in discord recently where someone's file was 257x256 instead of 256x256, and that ended up being their issue.

Beyond that possibility, I am likely no help.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.