|
1 | 1 | package net.tschipcraft.make_bubbles_pop; |
2 | 2 |
|
3 | | -import eu.midnightdust.lib.config.MidnightConfig; |
4 | | - |
5 | | -public class MakeBubblesPopConfig extends MidnightConfig { |
6 | | - |
7 | | - @Entry |
8 | | - public static boolean POP_PARTICLE_ENABLED = true; |
9 | | - |
10 | | - // Show this entry with percentage if possible |
11 | | - @Entry(isSlider = true, min = 0F, max = 1F, precision = 100) |
12 | | - public static float BUBBLE_POP_VOLUME = 0.1F; |
13 | | - |
14 | | - @Entry |
15 | | - public static boolean POPPED_BUBBLES_MAINTAIN_VELOCITY = false; |
16 | | - |
17 | | - |
18 | | - @Comment(centered = true) |
19 | | - public static Comment empty; |
20 | | - |
21 | | - @Comment(centered = true) |
22 | | - public static Comment additional_features; |
23 | | - |
24 | | - @Entry |
25 | | - public static boolean BUBBLE_PHYSICS_ENABLED = true; |
26 | | - |
27 | | - @Entry(isSlider = true, min = 1D, max = 100D, precision = 2) |
28 | | - public static double BUBBLE_LIFETIME_MULTIPLIER = 32D; |
29 | | - |
30 | | - @Entry |
31 | | - public static boolean BIOME_COLORS_ENABLED = true; |
32 | | - |
33 | | - // Show this entry with percentage if possible |
34 | | - @Entry(isSlider = true, min = 0F, max = 1F, precision = 100) |
35 | | - public static float BIOME_COLOR_INTENSITY = 0.65F; |
36 | | - |
37 | | - |
38 | | - @Entry |
39 | | - public static boolean CHEST_BUBBLES_ENABLED = true; |
40 | | - |
41 | | - @Entry |
42 | | - public static boolean BARREL_BUBBLES_ENABLED = true; |
43 | | - |
44 | | - @Entry |
45 | | - public static boolean CONTAINER_SOUND_ENABLED = true; |
46 | | - |
47 | | - @Entry |
48 | | - public static boolean EXPLOSION_BUBBLES_ENABLED = true; |
| 3 | +import net.minecraftforge.common.ForgeConfigSpec; |
| 4 | +import net.minecraftforge.eventbus.api.SubscribeEvent; |
| 5 | +import net.minecraftforge.fml.common.Mod; |
| 6 | +import net.minecraftforge.fml.event.config.ModConfigEvent; |
| 7 | + |
| 8 | +@Mod.EventBusSubscriber(modid = MakeBubblesPop.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) |
| 9 | +public class MakeBubblesPopConfig { |
| 10 | + |
| 11 | + private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder(); |
| 12 | + |
| 13 | + private static final ForgeConfigSpec.BooleanValue POP_PARTICLE_ENABLED_CONF = BUILDER |
| 14 | + .translation("make_bubbles_pop.midnightconfig.POP_PARTICLE_ENABLED") |
| 15 | + .comment("Default: true") |
| 16 | + .define("POP_PARTICLE_ENABLED", true); |
| 17 | + |
| 18 | + private static final ForgeConfigSpec.DoubleValue BUBBLE_POP_VOLUME_CONF = BUILDER |
| 19 | + .translation("make_bubbles_pop.midnightconfig.BUBBLE_POP_VOLUME") |
| 20 | + .comment("Default: §b10%§f") |
| 21 | + .defineInRange("BUBBLE_POP_VOLUME", 0.1D, 0D, 1D); |
| 22 | + |
| 23 | + private static final ForgeConfigSpec.BooleanValue POPPED_BUBBLES_MAINTAIN_VELOCITY_CONF = BUILDER |
| 24 | + .translation("make_bubbles_pop.midnightconfig.POPPED_BUBBLES_MAINTAIN_VELOCITY") |
| 25 | + .comment("If enabled, popped bubbles will maintain their velocity. Default: false") |
| 26 | + .define("POPPED_BUBBLES_MAINTAIN_VELOCITY", false); |
| 27 | + |
| 28 | + private static final ForgeConfigSpec.BooleanValue BUBBLE_PHYSICS_ENABLED_CONF = BUILDER |
| 29 | + .translation("make_bubbles_pop.midnightconfig.BUBBLE_PHYSICS_ENABLED") |
| 30 | + .comment("If enabled, bubbles will be affected by physics when colliding with blocks or entities. Default: true") |
| 31 | + .define("BUBBLE_PHYSICS_ENABLED", true); |
| 32 | + |
| 33 | + private static final ForgeConfigSpec.DoubleValue BUBBLE_LIFETIME_MULTIPLIER_CONF = BUILDER |
| 34 | + .translation("make_bubbles_pop.midnightconfig.BUBBLE_LIFETIME_MULTIPLIER") |
| 35 | + .comment("The time it takes for a bubble to pop underwater. \nBy default, this is set longer than in vanilla to allow bubbles to reach the water surface. \nDefault: §b32.0§f §7(Vanilla: 8.0)§f") |
| 36 | + .defineInRange("BUBBLE_LIFETIME_MULTIPLIER", 32D, 1D, 100D); |
| 37 | + |
| 38 | + private static final ForgeConfigSpec.BooleanValue BIOME_COLORS_ENABLED_CONF = BUILDER |
| 39 | + .translation("make_bubbles_pop.midnightconfig.BIOME_COLORS_ENABLED") |
| 40 | + .comment("If enabled, bubbles will have a color based on the biome they are in. Default: true") |
| 41 | + .define("BIOME_COLORS_ENABLED", true); |
| 42 | + |
| 43 | + private static final ForgeConfigSpec.DoubleValue BIOME_COLOR_INTENSITY_CONF = BUILDER |
| 44 | + .translation("make_bubbles_pop.midnightconfig.BIOME_COLOR_INTENSITY") |
| 45 | + .comment("Default: §b65%§f") |
| 46 | + .defineInRange("BIOME_COLOR_INTENSITY", 0.65D, 0D, 1D); |
| 47 | + |
| 48 | + private static final ForgeConfigSpec.BooleanValue CHEST_BUBBLES_ENABLED_CONF = BUILDER |
| 49 | + .translation("make_bubbles_pop.midnightconfig.CHEST_BUBBLES_ENABLED") |
| 50 | + .comment("If enabled, bubbles will appear when opening chests underwater. Default: true") |
| 51 | + .define("CHEST_BUBBLES_ENABLED", true); |
| 52 | + |
| 53 | + private static final ForgeConfigSpec.BooleanValue BARREL_BUBBLES_ENABLED_CONF = BUILDER |
| 54 | + .translation("make_bubbles_pop.midnightconfig.BARREL_BUBBLES_ENABLED") |
| 55 | + .comment("If enabled, bubbles will appear when opening barrels underwater. Default: true") |
| 56 | + .define("BARREL_BUBBLES_ENABLED", true); |
| 57 | + |
| 58 | + private static final ForgeConfigSpec.BooleanValue CONTAINER_SOUND_ENABLED_CONF = BUILDER |
| 59 | + .translation("make_bubbles_pop.midnightconfig.CONTAINER_SOUND_ENABLED") |
| 60 | + .comment("If enabled, a sound will play when opening chests or barrels underwater. Default: true") |
| 61 | + .define("CONTAINER_SOUND_ENABLED", true); |
| 62 | + |
| 63 | + private static final ForgeConfigSpec.BooleanValue EXPLOSION_BUBBLES_ENABLED_CONF = BUILDER |
| 64 | + .translation("make_bubbles_pop.midnightconfig.EXPLOSION_BUBBLES_ENABLED") |
| 65 | + .comment("If enabled, bubbles will appear when an explosion occurs underwater. Default: true") |
| 66 | + .define("EXPLOSION_BUBBLES_ENABLED", true); |
| 67 | + |
| 68 | + public static final ForgeConfigSpec SPEC = BUILDER.build(); |
| 69 | + |
| 70 | + |
| 71 | + // Config values |
| 72 | + public static boolean POP_PARTICLE_ENABLED; |
| 73 | + public static float BUBBLE_POP_VOLUME; |
| 74 | + public static boolean POPPED_BUBBLES_MAINTAIN_VELOCITY; |
| 75 | + |
| 76 | + public static boolean BUBBLE_PHYSICS_ENABLED; |
| 77 | + public static double BUBBLE_LIFETIME_MULTIPLIER; |
| 78 | + public static boolean BIOME_COLORS_ENABLED; |
| 79 | + public static float BIOME_COLOR_INTENSITY; |
| 80 | + |
| 81 | + public static boolean CHEST_BUBBLES_ENABLED; |
| 82 | + public static boolean BARREL_BUBBLES_ENABLED; |
| 83 | + public static boolean CONTAINER_SOUND_ENABLED; |
| 84 | + public static boolean EXPLOSION_BUBBLES_ENABLED; |
| 85 | + |
| 86 | + @SubscribeEvent |
| 87 | + static void onLoad(final ModConfigEvent event) { |
| 88 | + POP_PARTICLE_ENABLED = POP_PARTICLE_ENABLED_CONF.get(); |
| 89 | + BUBBLE_POP_VOLUME = BUBBLE_POP_VOLUME_CONF.get().floatValue(); |
| 90 | + POPPED_BUBBLES_MAINTAIN_VELOCITY = POPPED_BUBBLES_MAINTAIN_VELOCITY_CONF.get(); |
| 91 | + BUBBLE_PHYSICS_ENABLED = BUBBLE_PHYSICS_ENABLED_CONF.get(); |
| 92 | + BUBBLE_LIFETIME_MULTIPLIER = BUBBLE_LIFETIME_MULTIPLIER_CONF.get(); |
| 93 | + BIOME_COLORS_ENABLED = BIOME_COLORS_ENABLED_CONF.get(); |
| 94 | + BIOME_COLOR_INTENSITY = BIOME_COLOR_INTENSITY_CONF.get().floatValue(); |
| 95 | + CHEST_BUBBLES_ENABLED = CHEST_BUBBLES_ENABLED_CONF.get(); |
| 96 | + BARREL_BUBBLES_ENABLED = BARREL_BUBBLES_ENABLED_CONF.get(); |
| 97 | + CONTAINER_SOUND_ENABLED = CONTAINER_SOUND_ENABLED_CONF.get(); |
| 98 | + EXPLOSION_BUBBLES_ENABLED = EXPLOSION_BUBBLES_ENABLED_CONF.get(); |
| 99 | + } |
49 | 100 |
|
50 | 101 | } |
0 commit comments