Jump to content

Recommended Posts

Posted

Hello,

Im currently working on a mod for minecraft 1.10.2 and I want to add my own particle effects. I have already created the particles and I got them into the game as well, but I cant seem to get my custom texture to work. When I place down the block ingame, that displays the particles, they only show up in the purple and black square texture you always get when your missing a texture. I need some help to get the texture displayed correctly.

 

Here is my class for the Particles:

package com.xpmodder.xpadditions.particle;

import com.xpmodder.xpadditions.utility.LogHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

import java.util.Random;

public class LargeStarParticle extends Particle {

    public final ResourceLocation largeStarRL = new ResourceLocation("xpadditions:entity/largeStarParticle");

    public LargeStarParticle(World worldIn, double x, double y, double z, double velocityX, double velocityY, double velocityZ){

        super(worldIn, x, y, z, velocityX, velocityY, velocityZ);

        this.particleAlpha = 0.99F;

        TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(largeStarRL.toString());
        setParticleTexture(sprite);
        LogHelper.info(largeStarRL.toString());
        LogHelper.info(sprite);

    }

    @Override
    public int getFXLayer() {

        return 1;

    }

    @Override
    public int getBrightnessForRender(float partialTick) {

        return 0xf000f0;

    }

    @Override
    public boolean isTransparent() {

        return false;

    }

    @Override
    public void onUpdate(){

        Random ran = new Random();
        int num = ran.nextInt(20);

        if (particleScale > 2){
            particleScale = 1;
        }

        switch(num){

            case 1:
                particleScale = particleScale * (float)1.1;
                break;

            case 4:
                particleScale = particleScale * (float)1.2;
                break;

            case 8:
                particleScale = particleScale * (float)0.9;
                break;

            case 12:
                particleScale = particleScale * (float)0.8;
                break;

            case 16:
                particleScale = 1;
                break;

        }

        if (this.particleMaxAge-- <= 0) {
            this.setExpired();
        }

    }

}

 

Inside the assets/xpadditions/textures/entity folder of my project I have the texture file largeStarParticle.png. The size of the texture is 32x32 pixel and I tried using a 16x16 pixel texture file with the same name. Neither of those textures works for me.

Folder Structure.png

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.