Actually use the particle event to register the particles

This commit is contained in:
Mrbysco 2024-03-08 00:29:17 +01:00
parent fc7032fa4d
commit 9ec20f4895
2 changed files with 6 additions and 15 deletions

View file

@ -52,10 +52,8 @@ import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.config.ModConfig;
import net.neoforged.fml.event.config.ModConfigEvent;
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.fml.loading.FMLEnvironment;
import net.neoforged.neoforge.client.event.RegisterParticleProvidersEvent;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.common.conditions.ICondition;
import net.neoforged.neoforge.common.world.BiomeModifier;
@ -132,9 +130,9 @@ public class ActuallyAdditions {
eventBus.addListener(this::setup);
if (FMLEnvironment.dist.isClient()) {
eventBus.addListener(this::clientSetup);
eventBus.addListener(ActuallyAdditionsClient::setup);
eventBus.addListener(ActuallyAdditionsClient::setupSpecialRenders);
eventBus.addListener(this::particleFactoryRegister);
eventBus.addListener(ActuallyAdditionsClient::registerParticleFactories);
eventBus.register(new ClientRegistryHandler());
}
IFarmerBehavior.initBehaviors();
@ -168,14 +166,6 @@ public class ActuallyAdditions {
CommonConfig.Other.relayConfigureItem = item2 != null?item2: Items.AIR;
}
private void clientSetup(FMLClientSetupEvent event) {
ActuallyAdditionsClient.setup(event);
}
private void particleFactoryRegister(RegisterParticleProvidersEvent event) {
ActuallyAdditionsClient.registerParticleFactories();
}
public void serverStarted(ServerStartedEvent event) {
// TODO: [port] check if this is needed

View file

@ -62,6 +62,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.phys.BlockHitResult;
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
import net.neoforged.neoforge.client.event.RegisterParticleProvidersEvent;
import net.neoforged.neoforge.common.NeoForge;
public class ActuallyAdditionsClient {
@ -135,9 +136,9 @@ public class ActuallyAdditionsClient {
event.registerEntityRenderer(ActuallyAdditions.ENTITY_WORM.get(), RenderWorm::new);
}
public static void registerParticleFactories() {
Minecraft.getInstance().particleEngine.register(ActuallyParticles.LASER_ITEM.get(), ParticleLaserItem.Factory::new);
Minecraft.getInstance().particleEngine.register(ActuallyParticles.BEAM.get(), ParticleBeam.Factory::new);
public static void registerParticleFactories(RegisterParticleProvidersEvent event) {
event.registerSpriteSet(ActuallyParticles.LASER_ITEM.get(), ParticleLaserItem.Factory::new);
event.registerSpriteSet(ActuallyParticles.BEAM.get(), ParticleBeam.Factory::new);
}
// TODO: [port] validate that this works