Move some classes to the api and fix broken api classes

This commit is contained in:
Nedelosk committed 2017-11-03 16:09:17 +01:00
1 parent e7766d3ad9
commit a0e15f76ca
58 files changed
+306 -182

No files matched your search

@@ -0,0 +1,70 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.modules;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Annotation to provide additional information on IForestryModules. This information will be available via the "/forestry module info {@link #moduleID()}" command ingame.
* Any class annotated by this and implementing {@link IForestryModule} will be loaded by the model manager of Forestry.
*
* @author Nedelosk
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface ForestryModule {
/**
* @return Unique identifier for the module, no spaces!
*/
String moduleID();
/**
* @return The unique identifier of the module container.
*/
String containerID();
/**
* @return Nice and readable module name.
*/
String name();
/**
* @return ForestryModule author's name.
*/
String author() default "";
/**
* @return URL of plugin homepage.
*/
String url() default "";
/**
* @return Not used (yet?).
*/
String help() default "";
/**
* @return The name of the loot table file, if any.
*/
String lootTable() default "";
/**
* @return True if this is a core module.
*/
boolean coreModule() default false;
/**
* @return Version of the module, if any.
*/
String version() default "";
/**
* @return Localization key for a short description what the module does.
*/
String unlocalizedDescription() default "";
}
@@ -0,0 +1,99 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.modules;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.Set;
import net.minecraft.command.ICommand;
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() {
return true;
}
default boolean canBeDisabled() {
return true;
}
default String getFailMessage() {
return "";
}
/**
* The ForestryModule.moduleID()s of any other modules this module depends on.
*/
default Set<ResourceLocation> getDependencyUids(){
return Collections.emptySet();
}
/**
* Can be used to setup the api.
* Will only be called if the module is active if not {@link #disabledSetupAPI()} will be called.
*/
default void setupAPI() {
}
/**
* Called to setup the api if this module is disabled in the config or has missing dependencies.
*/
default void disabledSetupAPI() {
}
/**
* Can be used to register items and blocks. Called before {@link #preInit()}.
*/
default void registerItemsAndBlocks() {
}
default void preInit() {
}
/**
* Can be used to register Buildcraft triggers.
*/
default void registerTriggers() {
}
/**
* Can be used to register items to the backpack via the {@link forestry.api.storage.IBackpackInterface}.
*/
default void registerBackpackItems() {
}
/**
* Can be used to register crates via the {@link forestry.api.storage.ICrateRegistry}.
*/
default void registerCrates() {
}
default void doInit() {
}
/**
* Can be used to register recipes. Called after {@link #doInit()}.
*/
default void registerRecipes(){
}
default void addLootPoolNames(Set<String> lootPoolNames){
}
default void postInit(){
}
@Nullable
default ICommand[] getConsoleCommands(){
return null;
}
}
@@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.modules;
import net.minecraftforge.common.config.Configuration;
public interface IModuleContainer {
/**
* @return Unique identifier for the module container, no spaces!
*/
String getID();
boolean isAvailable();
Configuration getModulesConfig();
/**
* @return true if the module is enabled in the config file of this container.
*/
boolean isModuleEnabled(IForestryModule module);
}
@@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.modules;
import java.util.Collection;
import net.minecraft.util.ResourceLocation;
/**
* The module manager of Forestry.
*/
public interface IModuleManager {
default boolean isModuleEnabled(String containerID, String moduleID){
return isModuleEnabled(new ResourceLocation(containerID, moduleID));
}
boolean isModuleEnabled(ResourceLocation id);
void registerContainers(IModuleContainer... container);
Collection<IModuleContainer> getContainers();
}
@@ -0,0 +1,15 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "5.7.0", owner = "ForestryAPI|core", provides = "ForestryAPI|modules")
package forestry.api.modules;
import javax.annotation.ParametersAreNonnullByDefault;
import net.minecraftforge.fml.common.API;
import mcp.MethodsReturnNonnullByDefault;