Forge event registering

Started by Gabriele007 on

Topic category: Advanced modding

Joined Sep 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Forge event registering

So i have finally figured out how to use FOVUpdateEvent, the problem now seems like it's always active when i want to change fov only under certain conditions. Anybody know why and? It's because i put @Mod.EventBusSubscriber at the top? if so, what should i put?

import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.client.event.FOVUpdateEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;

@Mod.EventBusSubscriber
public class SniperFOV {
    @SubscribeEvent
    public static void ChangeFOV(FOVUpdateEvent event) {
        event.setNewfov(0.1f);
    }
}