Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.