aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/bscv/module/vision/Fullbright.java
blob: 183b933bbfe9ce428fcfe94ae2c2c2c543d1705e (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
38
39
40
41
42
43
44
45
46
47
package bscv.module.vision;

import java.awt.event.KeyEvent;

import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType;

import net.minecraft.command.CommandSource;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;

import bscv.module.QuickModule;
import bscv.BoSCoVicino;

public class Fullbright extends QuickModule {
   
   private final ForgeConfigSpec.ConfigValue<String> mode;

   public Fullbright(ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
      super("Fullbright", Group.VISION, KeyEvent.VK_V, builder, dispatcher);

      this.mode = this.option(
         "mode", "either potion or potion", "potion",
         StringArgumentType.string(), String.class,
         builder, dispatcher
      );
   }

   @SubscribeEvent
   public void onTick(TickEvent.ClientTickEvent event) {
      if (BoSCoVicino.minecraft == null) return;
      if (BoSCoVicino.minecraft.player == null) return;
      if (this.mode.get().equals("potion")) {
         BoSCoVicino.minecraft.player.addEffect(new EffectInstance(Effect.byId(16), 5204));
      }
   }

   @Override
   protected void onDisabled() {
      if (this.mode.get().equals("potion")) {
         BoSCoVicino.minecraft.player.removeEffect(Effect.byId(16));
      }
   }
}