aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc/bscv/modules/vision/Fullbright.java
blob: 9569d4403d38eb36a6f5d1e1fbaf51fa6c45f49e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package ftbsc.bscv.modules.vision;

import com.google.auto.service.AutoService;
import ftbsc.bscv.ICommons;
import ftbsc.bscv.api.ILoadable;
import ftbsc.bscv.modules.QuickModule;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;

import java.awt.event.KeyEvent;

@AutoService(ILoadable.class)
public class Fullbright extends QuickModule implements ICommons {
   
   private final static int NIGHT_VISION_ID = 16;
   private final static int FOUR_MINUTES_TWENTY_SECONDS = 5204;

   @Override
   protected int getDefaultKey() {
      return KeyEvent.VK_V;
   }

   @SubscribeEvent
   public void onTick(TickEvent.ClientTickEvent event) {
      if (MC == null) return;
      if (MC.player == null) return;
      MC.player.addEffect(new EffectInstance(Effect.byId(NIGHT_VISION_ID), FOUR_MINUTES_TWENTY_SECONDS));
   }

   @Override
   public void disable() {
      super.disable();
      MC.player.removeEffect(Effect.byId(NIGHT_VISION_ID));
   }
}