mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-28 15:36:18 +00:00
Fix Module System
This commit is contained in:
1 parent
3073473b0e
commit
26f44a2862
5 files changed
+127
-55
No files matched your search
@@ -16,6 +16,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
* Defines a Forestry module.
|
||||
* Any class implementing this interface and annotated by {@link ForestryModule} to be loaded by
|
||||
* the model manager of Forestry.
|
||||
*
|
||||
*/
|
||||
public interface IForestryModule {
|
||||
default boolean isAvailable() {
|
||||
@@ -40,22 +41,31 @@ public interface IForestryModule {
|
||||
/**
|
||||
* Can be used to setup the api.
|
||||
* Will only be called if the module is active if not {@link #disabledSetupAPI()} will be called.
|
||||
*
|
||||
* Must be called by the mod that registers the container.
|
||||
*/
|
||||
default void setupAPI() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to setup the api if this module is disabled in the config or has missing dependencies.
|
||||
*
|
||||
* Must be called by the mod that registers the container.
|
||||
*/
|
||||
default void disabledSetupAPI() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to register items and blocks. Called before {@link #preInit()}.
|
||||
*
|
||||
* Must be called by the mod that registers the container.
|
||||
*/
|
||||
default void registerItemsAndBlocks() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Must be called by the mod that registers the container.
|
||||
*/
|
||||
default void preInit() {
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.modules;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
public interface IModuleContainer {
|
||||
@@ -26,9 +24,9 @@ public interface IModuleContainer {
|
||||
|
||||
/**
|
||||
* Called after configured the modules.
|
||||
*
|
||||
* @param modules All active modules
|
||||
*/
|
||||
default void onConfiguredModules(Collection<IForestryModule> modules){
|
||||
default void onConfiguredModules(IModuleHandler handler){
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package forestry.api.modules;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface IModuleHandler {
|
||||
|
||||
void runSetup();
|
||||
|
||||
void runPreInit();
|
||||
|
||||
void runInit();
|
||||
|
||||
void runPostInit();
|
||||
|
||||
Collection<IForestryModule> getModules();
|
||||
}
|
||||
Reference in new issue
Block a user