Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParticleTypes and SoundEvents #836

Open
wants to merge 5 commits into
base: 2001
Choose a base branch
from

Conversation

Notenoughmail
Copy link
Contributor

Description

Provides asset generation capabilities for SoundEvents and ParticleTypes as well as a new event for registering ParticleProviders for custom particles

Allows for custom sounds to work out of the box as long as scriptors have a sound file in the right auto-genned location and custom particle to work once they have a provider registered through the added event

Example Script

Startup:

StartupEvents.registry('sound_event', e => {
  e.create('test');
})

StartupEvents.registry('particle_type', e => {
  e.create('test');
})

Client:

ClientEvents.particleProviderRegistry(e => {
  e.register('kubejs:test', (options, clientLevel, spriteSet, x, y, z, xSpeed, ySpeed, zSpeed) => {
    let particle = Client.customParticle(clientLevel, spriteSet, x, y, z);
    particle.gravity = 0;
    particle.friction = 1;
    particle.setParticleSpeed(0, 0, 0);
    particle.lifetime = 100;
    return particle;
  });
  // Or
  e.registerSimple('kubejs:test', (particle) => {
    particle.gravity = 0;
    particle.friction = 1;
    particle.setParticleSpeed(0, 0, 0);
    particle.lifetime = 100;
  });
  // Or
  e.registerSimple('kubejs:test'); // No modification of particle's properties
})

Other details

A new subclass of SimpleAnimatedParticle was made, for use in providers, which can be made through the Client binding, but I'd like some input on renaming the method and/or if it would be better to move it to ClientLevelKJS so its use in the provider would look like clientLevel.customParticle(...

- Add particle provider registry event
- Add asset generator for particle jsons (just a list of textures)
- Add KubeAnimatedParticle, a custom Particle class that exposes things to scriptors
- Add particle asset auto-gen to particle type builder (currently broken for reasons...)
- Fix particle provider registration firing too late
- Add sound event asset generation
- Address ChiefArug's comments
@Notenoughmail Notenoughmail force-pushed the particles-and-sounds branch from 1af5fcd to 5a56c38 Compare May 19, 2024 23:59
@MaxNeedsSnacks MaxNeedsSnacks self-requested a review May 20, 2024 16:56
- Use sign-agnostic bitshift for particle color alphas
- Include particle speed by default for simple providers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants