mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-28 15:36:18 +00:00
Move some classes to the api and fix broken api classes
This commit is contained in:
1 parent
e7766d3ad9
commit
a0e15f76ca
58 files changed
+306
-182
No files matched your search
@@ -5,9 +5,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
public enum EnumFruitFamily implements IFruitFamily {
|
||||
PRUNES("prunes", "Prunus domestica"),
|
||||
@@ -37,12 +38,12 @@ public enum EnumFruitFamily implements IFruitFamily {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Translator.translateToLocal("for.family." + uid);
|
||||
return I18n.translateToLocal("for.family." + uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return Translator.translateToLocal("for.family." + uid + ".description");
|
||||
return I18n.translateToLocal("for.family." + uid + ".description");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import net.minecraft.world.World;
|
||||
public interface IClimateManager {
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link IClimateStates#create(float, float)}
|
||||
* @deprecated Use {@link IClimateStates#create(float, float, ClimateStateType)}
|
||||
*/
|
||||
@Deprecated
|
||||
IClimateInfo createInfo(float temperature, float humidity);
|
||||
|
||||
@@ -17,7 +17,8 @@ import forestry.api.climate.IClimateStates;
|
||||
import forestry.api.farming.IFarmRegistry;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.api.farming.ISimpleFarmLogic;
|
||||
import forestry.greenhouse.api.climate.IClimateFactory;
|
||||
import forestry.api.modules.IModuleContainer;
|
||||
import forestry.api.modules.IModuleManager;
|
||||
|
||||
/**
|
||||
* Forestry's API is divided into several subcategories to make it easier to understand.
|
||||
@@ -54,12 +55,12 @@ public class ForestryAPI {
|
||||
public static IModelManager modelManager;
|
||||
|
||||
public static IClimateManager climateManager;
|
||||
|
||||
|
||||
/**
|
||||
* A factory to create climate related things.
|
||||
* @since 5.3.4
|
||||
* Instance of the module manager of forestry.
|
||||
* This can be used to register {@link IModuleContainer}s in the constructor of your mod.
|
||||
*/
|
||||
public static IClimateFactory climateFactory;
|
||||
public static IModuleManager moduleManager;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -61,7 +61,10 @@ public abstract class ForestryEvent extends Event {
|
||||
|
||||
/**
|
||||
* Posted before forestry registers all items and blocks.
|
||||
*
|
||||
* @deprecated removed in 1.13
|
||||
*/
|
||||
@Deprecated
|
||||
public static class PreInit extends ForestryEvent{
|
||||
/**
|
||||
* The main mod instance for Forestry.
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
/**
|
||||
* The alignment of the text in a text gui element.
|
||||
*/
|
||||
public enum GuiElementAlignment {
|
||||
LEFT, CENTER, RIGHT;
|
||||
LEFT, CENTER, RIGHT
|
||||
}
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -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;
|
||||
Reference in new issue
Block a user