diff options
-rw-r--r-- | src/main/java/ftbsc/bscv/api/IModule.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/ftbsc/bscv/api/IModule.java b/src/main/java/ftbsc/bscv/api/IModule.java index a6a6d12..e075aa6 100644 --- a/src/main/java/ftbsc/bscv/api/IModule.java +++ b/src/main/java/ftbsc/bscv/api/IModule.java @@ -1,17 +1,26 @@ package ftbsc.bscv.api; import net.minecraftforge.common.ForgeConfigSpec; +import net.minecraftforge.common.MinecraftForge; public interface IModule<T extends Enum<T>> extends ICommand { T getGroup(); ForgeConfigSpec.Builder getConfigBuilder(); - void toggle(); + default void toggle() { + if(this.isEnabled()) + this.disable(); + else this.enable(); + } - void enable(); + default void enable() { + MinecraftForge.EVENT_BUS.register(this); + } - void disable(); + default void disable() { + MinecraftForge.EVENT_BUS.register(this); + } boolean isEnabled(); } |