feat: defaults for toggle/enable/disable

This commit is contained in:
ftbsc 2023-02-28 21:49:37 +01:00
parent 4359e3d285
commit c833568c4b

View file

@ -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();
}