2020-04-15 14:22:03 +02:00
|
|
|
package com.minelittlepony.unicopia.client;
|
|
|
|
|
2020-09-22 15:11:20 +02:00
|
|
|
import com.minelittlepony.unicopia.UEntities;
|
2020-04-22 16:28:20 +02:00
|
|
|
import com.minelittlepony.unicopia.client.particle.ChangelingMagicParticle;
|
|
|
|
import com.minelittlepony.unicopia.client.particle.DiskParticle;
|
|
|
|
import com.minelittlepony.unicopia.client.particle.MagicParticle;
|
2020-10-13 17:44:49 +02:00
|
|
|
import com.minelittlepony.unicopia.client.particle.RainboomParticle;
|
2020-10-14 21:07:36 +02:00
|
|
|
import com.minelittlepony.unicopia.client.particle.RainbowTrailParticle;
|
2020-04-22 16:28:20 +02:00
|
|
|
import com.minelittlepony.unicopia.client.particle.RaindropsParticle;
|
|
|
|
import com.minelittlepony.unicopia.client.particle.SphereParticle;
|
2020-09-22 15:11:20 +02:00
|
|
|
import com.minelittlepony.unicopia.particle.UParticles;
|
|
|
|
|
2020-04-22 16:28:20 +02:00
|
|
|
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
|
2020-09-27 17:44:39 +02:00
|
|
|
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry.PendingParticleFactory;
|
2020-09-22 15:11:20 +02:00
|
|
|
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
|
2020-09-27 17:44:39 +02:00
|
|
|
import net.minecraft.client.particle.Particle;
|
|
|
|
import net.minecraft.client.particle.SpriteProvider;
|
2020-09-22 15:11:20 +02:00
|
|
|
import net.minecraft.client.render.entity.FlyingItemEntityRenderer;
|
2020-09-27 17:44:39 +02:00
|
|
|
import net.minecraft.client.world.ClientWorld;
|
|
|
|
import net.minecraft.particle.ParticleEffect;
|
2020-04-15 14:22:03 +02:00
|
|
|
|
|
|
|
public interface URenderers {
|
|
|
|
static void bootstrap() {
|
2020-09-27 17:44:39 +02:00
|
|
|
ParticleFactoryRegistry.getInstance().register(UParticles.UNICORN_MAGIC, createFactory(MagicParticle::new));
|
|
|
|
ParticleFactoryRegistry.getInstance().register(UParticles.CHANGELING_MAGIC, createFactory(ChangelingMagicParticle::new));
|
|
|
|
ParticleFactoryRegistry.getInstance().register(UParticles.RAIN_DROPS, createFactory(RaindropsParticle::new));
|
2020-10-13 17:44:49 +02:00
|
|
|
ParticleFactoryRegistry.getInstance().register(UParticles.RAINBOOM_RING, RainboomParticle::new);
|
2020-10-14 21:07:36 +02:00
|
|
|
ParticleFactoryRegistry.getInstance().register(UParticles.RAINBOOM_TRAIL, RainbowTrailParticle::new);
|
2020-05-03 19:20:51 +02:00
|
|
|
ParticleFactoryRegistry.getInstance().register(UParticles.SPHERE, SphereParticle::new);
|
|
|
|
ParticleFactoryRegistry.getInstance().register(UParticles.DISK, DiskParticle::new);
|
2020-04-26 22:40:43 +02:00
|
|
|
|
2020-09-22 15:11:20 +02:00
|
|
|
EntityRendererRegistry.INSTANCE.register(UEntities.THROWN_ITEM, (manager, context) -> new FlyingItemEntityRenderer<>(manager, context.getItemRenderer()));
|
2020-04-15 14:22:03 +02:00
|
|
|
}
|
2020-09-27 17:44:39 +02:00
|
|
|
|
|
|
|
static <T extends ParticleEffect> PendingParticleFactory<T> createFactory(ParticleSupplier<T> supplier) {
|
|
|
|
return provider -> (effect, world, x, y, z, dx, dy, dz) -> supplier.get(provider, world, x, y, z, dx, dy, dz);
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ParticleSupplier<T extends ParticleEffect> {
|
|
|
|
Particle get(SpriteProvider provider, ClientWorld world, double x, double y, double z, double dx, double dy, double dz);
|
|
|
|
}
|
2020-04-15 14:22:03 +02:00
|
|
|
}
|