aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc/bscv/modules/HudModule.java
blob: 8c559fbcae0e08ff6e2bd44ffbb044da0b69511a (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
48
49
50
51
52
53
package ftbsc.bscv.modules;

import com.mojang.brigadier.CommandDispatcher;

import ftbsc.bscv.ICommons;
import ftbsc.bscv.tools.Anchor;
import ftbsc.bscv.tools.Setting;
import net.minecraft.command.CommandSource;
import net.minecraftforge.common.ForgeConfigSpec;

public abstract class HudModule extends Module {

   public final ForgeConfigSpec.ConfigValue<Integer> x;
   public final ForgeConfigSpec.ConfigValue<Integer> y;
   public final ForgeConfigSpec.ConfigValue<Double>  scale;
   public final ForgeConfigSpec.ConfigValue<Anchor>  anchor;

   protected HudModule(String name, ForgeConfigSpec.Builder builder, CommandDispatcher<CommandSource> dispatcher) {
      super(name, Group.HUD, builder, dispatcher);

      this.x = Setting.Number.builder()
         .name("x")
         .comment("horizontal offset")
         .fallback(0)
         .build(builder, dispatcher);

      this.y = Setting.Number.builder()
         .name("y")
         .comment("vertical offset")
         .fallback(0)
         .build(builder, dispatcher);

      this.scale = Setting.Decimal.builder()
         .name("scale")
         .comment("scale of element")
         .fallback(1.0)
         .build(builder, dispatcher);

      this.anchor = Setting.Switch.builder(Anchor.class)
         .name("anchor")
         .comment("origin point for coordinates")
         .fallback(Anchor.TOPLEFT)
         .build(builder, dispatcher);
   }

   protected boolean shouldHide() {
      if (ICommons.MC.options.renderDebug) {
         return true;
      }

      return false;
   }
}