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.

(1.16.5 MCP) Redundant texture list for particle mymod:myparticle

Featured Replies

Posted

so i made a particle but when i enter in the world it crashes (yes i did register the ModParticles class in Main class)

 

lightning_particle.json file

{ "textures": [ "modid:lightning_particle" ] }

 

ModParticles class:

public class ModParticles {

    public static final DeferredRegister<ParticleType<?>> PARTICLES = DeferredRegister.create(ForgeRegistries.PARTICLE_TYPES, Main.MOD_ID);

    public static final RegistryObject<BasicParticleType> LIGHTNING_PARTICLE = PARTICLES.register("lightning_particle",
            () -> new BasicParticleType(true));
}

 

LightningParticle class:

@OnlyIn(Dist.CLIENT)
public class LightningParticle extends SpriteTexturedParticle {

    protected LightningParticle(ClientWorld world, double xCoord, double yCoord, double zCoord, double motionX, double motionY, double motionZ) {
        super(world, xCoord, yCoord, zCoord, motionX, motionY, motionZ);

        float f = this.rand.nextFloat() * 1.0f;
        this.particleRed = f;
        this.particleGreen = f;
        this.particleBlue = f;
        this.setSize(0.1F,0.1F);
        this.particleScale *= this.rand.nextFloat() * 1.1F;
        this.motionX *= (double) 0.02f;
        this.motionY *= (double) 0.02f;
        this.motionZ *= (double) 0.02f;
        this.maxAge = (int)(20.0D / (Math.random() * 1.0D));
    }

    @Override
    public IParticleRenderType getRenderType() {
        return IParticleRenderType.PARTICLE_SHEET_OPAQUE;
    }

    @Override
    public void tick() {
        this.prevPosX = this.posX;
        this.prevPosY = this.posY;
        this.prevPosZ = this.posZ;
        if(this.maxAge-- <= 0)
        {
            this.setExpired();
        } else {
            this.move(this.motionX, this.motionY, this.motionZ);
        }
    }

    @OnlyIn(Dist.CLIENT)
    public static class Factory implements IParticleFactory<BasicParticleType>
    {
        private final IAnimatedSprite sprite;

        public Factory(IAnimatedSprite sprite)
        {
            this.sprite = sprite;
        }

        @Override
        public Particle makeParticle(BasicParticleType typeIn, ClientWorld worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
            LightningParticle myParticle = new LightningParticle(worldIn,x,y,z,xSpeed,ySpeed,zSpeed);
            myParticle.setColor(1.0f,1.0f,1.0f);
            myParticle.selectSpriteRandomly(sprite);
            return myParticle;
        }
    }
}

 

ParticleEvent class:

@Mod.EventBusSubscriber(modid = Main.MOD_ID)
public class ParticleEvent {

    @SubscribeEvent(priority = EventPriority.LOWEST)
    public static void registerParticles(ParticleFactoryRegisterEvent event)
    {
        Minecraft.getInstance().particles.registerFactory(ModParticles.LIGHTNING_PARTICLE.get(), LightningParticle.Factory::new);
    }
}

 

Edited by ElTotisPro50

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.