mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-19 03:39:09 +00:00
Use ForestryPlugin annotation to discover plugins
This commit is contained in:
1 parent
c6ab58de22
commit
65436a4e70
41 files changed
+721
-560
No files matched your search
@@ -30,6 +30,7 @@ import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry.Type;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.EventHandlerCore;
|
||||
import forestry.core.config.Config;
|
||||
@@ -92,7 +93,7 @@ public class Forestry {
|
||||
configFolder = new File(event.getModConfigurationDirectory(), "forestry");
|
||||
Config.load();
|
||||
|
||||
PluginManager.runSetup();
|
||||
PluginManager.runSetup(event);
|
||||
|
||||
ForestryAPI.activeMode = new GameMode(Config.gameMode);
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
meta = block.getMetaFromState(world.getBlockState(pos));
|
||||
}
|
||||
|
||||
/*if (PluginManager.Module.AGRICRAFT.isEnabled()) {
|
||||
/*if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.AGRICRAFT)) {
|
||||
Block cropBlock = GameRegistry.findBlock("AgriCraft", "crops");
|
||||
if (block == cropBlock) {
|
||||
if (block instanceof IPlantable) {
|
||||
|
||||
@@ -27,6 +27,7 @@ import net.minecraft.world.gen.structure.StructureComponent;
|
||||
import net.minecraft.world.gen.structure.StructureVillagePieces;
|
||||
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
@@ -37,6 +38,7 @@ import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IFlower;
|
||||
import forestry.apiculture.blocks.BlockTypeApiculture;
|
||||
@@ -52,9 +54,9 @@ import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.worldgen.BlockType;
|
||||
import forestry.core.worldgen.BlockTypeTileForestry;
|
||||
import forestry.core.worldgen.IBlockType;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import forestry.plugins.PluginCore;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 {
|
||||
|
||||
@@ -80,7 +82,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 {
|
||||
}
|
||||
|
||||
private void createBuildingBlocks(Random random) {
|
||||
if (PluginManager.Module.ARBORICULTURE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ARBORICULTURE)) {
|
||||
|
||||
boolean fireproof = (random.nextInt(4) == 0);
|
||||
|
||||
|
||||
@@ -13,23 +13,26 @@ package forestry.core;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import forestry.plugins.PluginCore;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
public class CreativeTabForestry extends CreativeTabs {
|
||||
|
||||
static {
|
||||
if (PluginManager.Module.APICULTURE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) {
|
||||
Tabs.tabApiculture = new CreativeTabForestry(1, "apiculture");
|
||||
}
|
||||
|
||||
if (PluginManager.Module.ARBORICULTURE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ARBORICULTURE)) {
|
||||
Tabs.tabArboriculture = new CreativeTabForestry(2, "arboriculture");
|
||||
}
|
||||
|
||||
if (PluginManager.Module.LEPIDOPTEROLOGY.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.LEPIDOPTEROLOGY)) {
|
||||
Tabs.tabLepidopterology = new CreativeTabForestry(3, "lepidopterology");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import net.minecraft.util.StatCollector;
|
||||
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.Plugin;
|
||||
import forestry.plugins.IForestryPlugin;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
/**
|
||||
@@ -43,19 +43,19 @@ public class CommandPlugins extends SubCommand {
|
||||
|
||||
private static void listPluginsForSender(ICommandSender sender) {
|
||||
StringBuilder pluginList = new StringBuilder();
|
||||
for (PluginManager.Module pluginModule : PluginManager.getLoadedModules()) {
|
||||
for (IForestryPlugin plugin : PluginManager.getLoadedPlugins()) {
|
||||
if (pluginList.length() > 0) {
|
||||
pluginList.append(", ");
|
||||
}
|
||||
pluginList.append(makeListEntry(pluginModule.instance()));
|
||||
pluginList.append(makeListEntry(plugin));
|
||||
}
|
||||
CommandHelpers.sendChatMessage(sender, pluginList.toString());
|
||||
}
|
||||
|
||||
private static String makeListEntry(ForestryPlugin plugin) {
|
||||
private static String makeListEntry(IForestryPlugin plugin) {
|
||||
String entry = plugin.isAvailable() ? EnumChatFormatting.GREEN.toString() : EnumChatFormatting.RED.toString();
|
||||
|
||||
Plugin info = plugin.getClass().getAnnotation(Plugin.class);
|
||||
ForestryPlugin info = plugin.getClass().getAnnotation(ForestryPlugin.class);
|
||||
if (info != null) {
|
||||
entry += info.pluginID();
|
||||
if (!info.version().isEmpty()) {
|
||||
@@ -84,27 +84,27 @@ public class CommandPlugins extends SubCommand {
|
||||
}
|
||||
}
|
||||
|
||||
private static void listPluginInfoForSender(ICommandSender sender, String plugin) throws CommandException {
|
||||
ForestryPlugin found = null;
|
||||
for (PluginManager.Module pluginModule : PluginManager.getLoadedModules()) {
|
||||
Plugin info = pluginModule.instance().getClass().getAnnotation(Plugin.class);
|
||||
private static void listPluginInfoForSender(ICommandSender sender, String pluginUid) throws CommandException {
|
||||
IForestryPlugin found = null;
|
||||
for (IForestryPlugin plugin : PluginManager.getLoadedPlugins()) {
|
||||
ForestryPlugin info = plugin.getClass().getAnnotation(ForestryPlugin.class);
|
||||
if (info == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((info.pluginID().equalsIgnoreCase(plugin) || info.name().equalsIgnoreCase(plugin))) {
|
||||
found = pluginModule.instance();
|
||||
if ((info.pluginID().equalsIgnoreCase(pluginUid) || info.name().equalsIgnoreCase(pluginUid))) {
|
||||
found = plugin;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found == null) {
|
||||
throw new CommandException(StringUtil.localizeAndFormat("chat.plugins.error", plugin));
|
||||
throw new CommandException(StringUtil.localizeAndFormat("chat.plugins.error", pluginUid));
|
||||
}
|
||||
|
||||
EnumChatFormatting formatting = found.isAvailable() ? EnumChatFormatting.GREEN : EnumChatFormatting.RED;
|
||||
|
||||
Plugin info = found.getClass().getAnnotation(Plugin.class);
|
||||
ForestryPlugin info = found.getClass().getAnnotation(ForestryPlugin.class);
|
||||
if (info != null) {
|
||||
CommandHelpers.sendChatMessage(sender, formatting + "Plugin: " + info.name());
|
||||
if (!info.version().isEmpty()) {
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.Map;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IAllele;
|
||||
@@ -28,7 +29,7 @@ import forestry.api.lepidopterology.EnumButterflyChromosome;
|
||||
import forestry.apiculture.flowers.FlowerProvider;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.vect.IVect;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
|
||||
public class AlleleHelper implements IAlleleHelper {
|
||||
|
||||
@@ -38,12 +39,12 @@ public class AlleleHelper implements IAlleleHelper {
|
||||
private final Map<Class, Map<?, ? extends IAllele>> alleleMaps = new HashMap<>();
|
||||
|
||||
public void init() {
|
||||
if (PluginManager.Module.APICULTURE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) {
|
||||
createAlleles(EnumAllele.Fertility.class, EnumBeeChromosome.FERTILITY);
|
||||
createAlleles(EnumAllele.Flowering.class, EnumBeeChromosome.FLOWERING);
|
||||
}
|
||||
|
||||
if (PluginManager.Module.APICULTURE.isEnabled() || PluginManager.Module.ARBORICULTURE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE) || ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ARBORICULTURE)) {
|
||||
createAlleles(EnumAllele.Territory.class,
|
||||
EnumBeeChromosome.TERRITORY,
|
||||
EnumTreeChromosome.TERRITORY
|
||||
@@ -52,7 +53,7 @@ public class AlleleHelper implements IAlleleHelper {
|
||||
AlleleManager.alleleRegistry.registerDeprecatedAlleleReplacement("forestry.territoryDefault", get(EnumAllele.Territory.AVERAGE));
|
||||
}
|
||||
|
||||
if (PluginManager.Module.APICULTURE.isEnabled() || PluginManager.Module.LEPIDOPTEROLOGY.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE) || ForestryAPI.enabledPlugins.contains(ForestryPluginUids.LEPIDOPTEROLOGY)) {
|
||||
createAlleles(EnumAllele.Speed.class,
|
||||
EnumBeeChromosome.SPEED,
|
||||
EnumButterflyChromosome.SPEED
|
||||
@@ -75,7 +76,7 @@ public class AlleleHelper implements IAlleleHelper {
|
||||
AlleleManager.alleleRegistry.registerDeprecatedAlleleReplacement("forestry.speedNorm", get(EnumAllele.Speed.NORMAL));
|
||||
}
|
||||
|
||||
if (PluginManager.Module.ARBORICULTURE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ARBORICULTURE)) {
|
||||
createAlleles(EnumAllele.Height.class, EnumTreeChromosome.HEIGHT);
|
||||
createAlleles(EnumAllele.Saplings.class, EnumTreeChromosome.FERTILITY);
|
||||
createAlleles(EnumAllele.Yield.class, EnumTreeChromosome.YIELD);
|
||||
@@ -97,7 +98,7 @@ public class AlleleHelper implements IAlleleHelper {
|
||||
AlleleManager.alleleRegistry.registerDeprecatedAlleleReplacement("forestry.maturityFastest", get(EnumAllele.Maturation.FASTEST));
|
||||
}
|
||||
|
||||
if (PluginManager.Module.LEPIDOPTEROLOGY.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.LEPIDOPTEROLOGY)) {
|
||||
createAlleles(EnumAllele.Size.class, EnumButterflyChromosome.SIZE);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,15 +12,17 @@ package forestry.core.inventory;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.tiles.TileAnalyzer;
|
||||
import forestry.core.utils.GeneticsUtil;
|
||||
import forestry.core.utils.SlotUtil;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
|
||||
public class InventoryAnalyzer extends InventoryAdapterTile<TileAnalyzer> {
|
||||
public static final short SLOT_ANALYZE = 0;
|
||||
@@ -53,7 +55,7 @@ public class InventoryAnalyzer extends InventoryAdapterTile<TileAnalyzer> {
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slotId, ItemStack itemStack) {
|
||||
if (PluginManager.Module.ARBORICULTURE.isEnabled() && !TreeManager.treeRoot.isMember(itemStack)) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ARBORICULTURE) && !TreeManager.treeRoot.isMember(itemStack)) {
|
||||
ItemStack ersatz = GeneticsUtil.convertSaplingToGeneticEquivalent(itemStack);
|
||||
if (ersatz != null) {
|
||||
itemStack = ersatz;
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IErrorSource;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
@@ -24,8 +25,8 @@ import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.apiculture.items.ItemRegistryApiculture;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
public abstract class ItemInventoryAlyzer extends ItemInventory implements IErrorSource {
|
||||
public static final int SLOT_SPECIMEN = 0;
|
||||
@@ -83,7 +84,7 @@ public abstract class ItemInventoryAlyzer extends ItemInventory implements IErro
|
||||
// Analyze if necessary
|
||||
if (!individual.isAnalyzed()) {
|
||||
|
||||
if (PluginManager.Module.APICULTURE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) {
|
||||
// Requires energy
|
||||
if (!isEnergy(getStackInSlot(SLOT_ENERGY))) {
|
||||
return;
|
||||
|
||||
@@ -10,15 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.models;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.PluginManager.Module;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.resources.model.ModelBakery;
|
||||
@@ -26,11 +17,19 @@ import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelManager implements IModelManager {
|
||||
|
||||
@@ -75,38 +74,22 @@ public class ModelManager implements IModelManager {
|
||||
}
|
||||
|
||||
public static void registerModels() {
|
||||
for(Module module : PluginManager.getLoadedModules()){
|
||||
ForestryPlugin plugin = module.instance();
|
||||
|
||||
for (Block block : GameData.getBlockRegistry()) {
|
||||
if (block != null) {
|
||||
if (block instanceof IItemModelRegister) {
|
||||
((IItemModelRegister) block).registerModel(Item.getItemFromBlock(block), getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
for (Block block : GameData.getBlockRegistry()) {
|
||||
if (block instanceof IItemModelRegister) {
|
||||
((IItemModelRegister) block).registerModel(Item.getItemFromBlock(block), getInstance());
|
||||
}
|
||||
for (Item item : GameData.getItemRegistry()) {
|
||||
if (item != null) {
|
||||
if (item instanceof IItemModelRegister) {
|
||||
((IItemModelRegister) item).registerModel(item, getInstance());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Item item : GameData.getItemRegistry()) {
|
||||
if (item instanceof IItemModelRegister) {
|
||||
((IItemModelRegister) item).registerModel(item, getInstance());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerStateMappers(){
|
||||
for(Module module : PluginManager.getLoadedModules()){
|
||||
ForestryPlugin plugin = module.instance();
|
||||
|
||||
for (Block block : GameData.getBlockRegistry()) {
|
||||
if (block != null) {
|
||||
if (block instanceof IStateMapperRegister) {
|
||||
((IStateMapperRegister) block).registerStateMapper();
|
||||
}
|
||||
}
|
||||
|
||||
for (Block block : GameData.getBlockRegistry()) {
|
||||
if (block instanceof IStateMapperRegister) {
|
||||
((IStateMapperRegister) block).registerStateMapper();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,12 +18,14 @@ import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.config.Constants;
|
||||
@@ -44,7 +46,7 @@ import forestry.core.network.packets.PacketItemStackDisplay;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.GeneticsUtil;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
|
||||
public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiquidTankTile, IFluidHandler, IItemStackDisplay {
|
||||
private static final int TIME_TO_ANALYZE = 125;
|
||||
@@ -205,7 +207,7 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
|
||||
return;
|
||||
}
|
||||
|
||||
if (PluginManager.Module.ARBORICULTURE.isEnabled() && !TreeManager.treeRoot.isMember(inputStack)) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ARBORICULTURE) && !TreeManager.treeRoot.isMember(inputStack)) {
|
||||
ItemStack ersatz = GeneticsUtil.convertSaplingToGeneticEquivalent(inputStack);
|
||||
if (ersatz != null) {
|
||||
inputStack = ersatz;
|
||||
|
||||
@@ -13,14 +13,17 @@ package forestry.core.utils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.plugins.PluginManager;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.ICrashCallable;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.IForestryPlugin;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
/**
|
||||
* ICrashCallable for highlighting certain mods and listing disabled modules for crash reports.
|
||||
**/
|
||||
@@ -57,8 +60,9 @@ public class ForestryModEnvWarningCallable implements ICrashCallable {
|
||||
}
|
||||
|
||||
this.disabledModules = new ArrayList<>();
|
||||
for (PluginManager.Module module : PluginManager.configDisabledModules) {
|
||||
disabledModules.add(module.configName());
|
||||
for (IForestryPlugin plugin : PluginManager.configDisabledPlugins) {
|
||||
ForestryPlugin info = plugin.getClass().getAnnotation(ForestryPlugin.class);
|
||||
disabledModules.add(info.name());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package forestry.core.utils;
|
||||
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
|
||||
public class IMCUtil {
|
||||
public static String getInvalidIMCMessageText(FMLInterModComms.IMCMessage message) {
|
||||
final Object messageValue;
|
||||
if (message.isItemStackMessage()) {
|
||||
messageValue = message.getItemStackValue().toString();
|
||||
} else if (message.isNBTMessage()) {
|
||||
messageValue = message.getNBTValue();
|
||||
} else if (message.isStringMessage()) {
|
||||
messageValue = message.getStringValue();
|
||||
} else {
|
||||
messageValue = "";
|
||||
}
|
||||
|
||||
return String.format("Received an invalid '%s' request '%s' from mod '%s'. Please contact the author and report this issue.", message.key, messageValue, message.getSender());
|
||||
}
|
||||
|
||||
public static void logInvalidIMCMessage(FMLInterModComms.IMCMessage message) {
|
||||
String invalidIMCMessageText = getInvalidIMCMessageText(message);
|
||||
Log.warning(invalidIMCMessageText);
|
||||
}
|
||||
}
|
||||
@@ -27,11 +27,12 @@ import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.circuits.ISocketable;
|
||||
import forestry.core.inventory.filters.ArrayStackFilter;
|
||||
import forestry.core.inventory.filters.IStackFilter;
|
||||
@@ -42,7 +43,7 @@ import forestry.core.inventory.wrappers.InventoryCopy;
|
||||
import forestry.core.inventory.wrappers.InventoryIterator;
|
||||
import forestry.core.inventory.wrappers.SidedInventoryMapper;
|
||||
import forestry.core.tiles.AdjacentTileCache;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
|
||||
@@ -254,7 +255,7 @@ public abstract class InventoryUtil {
|
||||
}
|
||||
|
||||
public static boolean moveOneItemToPipe(IInventory source, AdjacentTileCache tileCache, EnumFacing[] directions) {
|
||||
if (PluginManager.Module.BUILDCRAFT_TRANSPORT.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.BUILDCRAFT_TRANSPORT)) {
|
||||
return internal_moveOneItemToPipe(source, tileCache, directions);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,13 +49,13 @@ public class FarmLogicOrchard extends FarmLogic {
|
||||
this.farmables = Farmables.farmables.get("farmOrchard");
|
||||
|
||||
ImmutableList.Builder<Block> traversalBlocksBuilder = ImmutableList.builder();
|
||||
// if (PluginManager.Module.AGRICRAFT.isEnabled() || PluginManager.Module.INDUSTRIALCRAFT.isEnabled()) {
|
||||
// if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.AGRICRAFT) || ForestryAPI.enabledPlugins.contains(ForestryPluginUids.INDUSTRIALCRAFT)) {
|
||||
// traversalBlocksBuilder.add(Blocks.farmland);
|
||||
// }
|
||||
// if (PluginManager.Module.INDUSTRIALCRAFT.isEnabled()) {
|
||||
// if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.INDUSTRIALCRAFT)) {
|
||||
// traversalBlocksBuilder.add(Blocks.dirt);
|
||||
// }
|
||||
// if (PluginManager.Module.PLANTMEGAPACK.isEnabled()) {
|
||||
// if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.PLANTMEGAPACK)) {
|
||||
// traversalBlocksBuilder.add(Blocks.water);
|
||||
// }
|
||||
//
|
||||
|
||||
@@ -20,9 +20,10 @@ import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.utils.GeneticsUtil;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
|
||||
public class FarmableVanillaSapling extends FarmableGenericSapling {
|
||||
|
||||
@@ -32,7 +33,7 @@ public class FarmableVanillaSapling extends FarmableGenericSapling {
|
||||
|
||||
@Override
|
||||
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) {
|
||||
if (PluginManager.Module.ARBORICULTURE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ARBORICULTURE)) {
|
||||
IIndividual tree = GeneticsUtil.getGeneticEquivalent(germling);
|
||||
if (!(tree instanceof ITree)) {
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.plugins;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
|
||||
import net.minecraftforge.fml.common.IFuelHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
import forestry.core.IPickupHandler;
|
||||
import forestry.core.IResupplyHandler;
|
||||
import forestry.core.ISaveEventHandler;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
|
||||
public abstract class BlankForestryPlugin implements IForestryPlugin {
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeDisabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFailMessage() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getDependencyUids() {
|
||||
Set<String> dependencyUids = new HashSet<>();
|
||||
dependencyUids.add(ForestryPluginUids.CORE);
|
||||
return dependencyUids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupAPI() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disabledSetupAPI() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerItemsAndBlocks() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTriggers() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBackpackItems() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCrates() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doInit() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRecipes() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processIMCMessage(IMCMessage message) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populateChunk(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGeneratedZ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ) {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ISaveEventHandler getSaveEventHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IPacketRegistry getPacketRegistry() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IPickupHandler getPickupHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IResupplyHandler getResupplyHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ICommand[] getConsoleCommands() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IFuelHandler getFuelHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
ForestryPlugin forestryPlugin = getClass().getAnnotation(ForestryPlugin.class);
|
||||
if (forestryPlugin == null) {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
return forestryPlugin.name() + " Plugin";
|
||||
}
|
||||
|
||||
}
|
||||
Executable → Regular
+39
-120
@@ -1,135 +1,54 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.plugins;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraftforge.fml.common.IFuelHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import forestry.core.IPickupHandler;
|
||||
import forestry.core.IResupplyHandler;
|
||||
import forestry.core.ISaveEventHandler;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.network.PacketRegistryDummy;
|
||||
import forestry.core.utils.Log;
|
||||
/**
|
||||
* Optional annotation to provide additional information on IPlugins. This information will be available via the "/forestry plugin info $pluginID" command ingame.
|
||||
*
|
||||
* @author SirSengir
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ForestryPlugin {
|
||||
|
||||
public abstract class ForestryPlugin {
|
||||
/**
|
||||
* @return Unique identifier for the plugin, no spaces!
|
||||
*/
|
||||
String pluginID();
|
||||
|
||||
public boolean isAvailable() {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* @return Nice and readable plugin name.
|
||||
*/
|
||||
String name();
|
||||
|
||||
public String getFailMessage() {
|
||||
return "";
|
||||
}
|
||||
/**
|
||||
* @return ForestryPlugin author's name.
|
||||
*/
|
||||
String author() default "";
|
||||
|
||||
public EnumSet<PluginManager.Module> getDependancies() {
|
||||
return EnumSet.of(PluginManager.Module.CORE);
|
||||
}
|
||||
/**
|
||||
* @return URL of plugin homepage.
|
||||
*/
|
||||
String url() default "";
|
||||
|
||||
protected void setupAPI() {
|
||||
}
|
||||
/**
|
||||
* @return Version of the plugin, if any.
|
||||
*/
|
||||
String version() default "";
|
||||
|
||||
protected void disabledSetupAPI() {
|
||||
}
|
||||
/**
|
||||
* @return Localization key for a short description what the plugin does.
|
||||
*/
|
||||
String unlocalizedDescription() default "";
|
||||
|
||||
protected void registerItemsAndBlocks() {
|
||||
}
|
||||
|
||||
protected void preInit() {
|
||||
}
|
||||
|
||||
protected void registerTriggers() {
|
||||
}
|
||||
|
||||
protected void registerBackpackItems() {
|
||||
}
|
||||
|
||||
protected void registerCrates() {
|
||||
}
|
||||
|
||||
protected void doInit() {
|
||||
}
|
||||
|
||||
protected void registerRecipes() {
|
||||
}
|
||||
|
||||
protected void postInit() {
|
||||
}
|
||||
|
||||
public boolean processIMCMessage(IMCMessage message) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static String getInvalidIMCMessageText(IMCMessage message) {
|
||||
final Object messageValue;
|
||||
if (message.isItemStackMessage()) {
|
||||
messageValue = message.getItemStackValue().toString();
|
||||
} else if (message.isNBTMessage()) {
|
||||
messageValue = message.getNBTValue();
|
||||
} else if (message.isStringMessage()) {
|
||||
messageValue = message.getStringValue();
|
||||
} else {
|
||||
messageValue = "";
|
||||
}
|
||||
|
||||
return String.format("Received an invalid '%s' request '%s' from mod '%s'. Please contact the author and report this issue.", message.key, messageValue, message.getSender());
|
||||
}
|
||||
|
||||
protected static void logInvalidIMCMessage(IMCMessage message) {
|
||||
String invalidIMCMessageText = getInvalidIMCMessageText(message);
|
||||
Log.warning(invalidIMCMessageText);
|
||||
}
|
||||
|
||||
public ISaveEventHandler getSaveEventHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void populateChunk(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGeneratedZ) {
|
||||
}
|
||||
|
||||
public void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ) {
|
||||
}
|
||||
|
||||
public IPacketRegistry getPacketRegistry() {
|
||||
return PacketRegistryDummy.instance;
|
||||
}
|
||||
|
||||
public IPickupHandler getPickupHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public IResupplyHandler getResupplyHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ICommand[] getConsoleCommands() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public IFuelHandler getFuelHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
Plugin info = getClass().getAnnotation(Plugin.class);
|
||||
if (info == null) {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
return info.name() + " Plugin";
|
||||
}
|
||||
/**
|
||||
* @return Not used (yet?).
|
||||
*/
|
||||
String help() default "";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package forestry.plugins;
|
||||
|
||||
public class ForestryPluginUids {
|
||||
public static final String APICULTURE = "forestry.apiculture";
|
||||
public static final String ARBORICULTURE = "forestry.arboriculture";
|
||||
public static final String CORE = "forestry.core";
|
||||
public static final String ENERGY = "forestry.energy";
|
||||
public static final String FACTORY = "forestry.factory";
|
||||
public static final String FARMING = "forestry.farming";
|
||||
public static final String FLUIDS = "forestry.fluids";
|
||||
public static final String FOOD = "forestry.food";
|
||||
public static final String LEPIDOPTEROLOGY = "forestry.lepidopterology";
|
||||
public static final String MAIL = "forestry.mail";
|
||||
public static final String STORAGE = "forestry.storage";
|
||||
|
||||
public static final String BIOMES_O_PLENTY = "forestry.biomes.o.plenty";
|
||||
public static final String BUILDCRAFT_FUELS = "forestry.buildcraft.fuels";
|
||||
public static final String BUILDCRAFT_RECIPES = "forestry.buildcraft.recipes";
|
||||
public static final String BUILDCRAFT_STATEMENTS = "forestry.buildcraft.statements";
|
||||
public static final String BUILDCRAFT_TRANSPORT = "forestry.buildcraft.transport";
|
||||
public static final String CHISEL = "forestry.chisel";
|
||||
public static final String NATURA = "forestry.natura";
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package forestry.plugins;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.fml.common.discovery.ASMDataTable;
|
||||
|
||||
import forestry.core.utils.Log;
|
||||
|
||||
public class ForestryPluginUtil {
|
||||
private ForestryPluginUtil() {
|
||||
|
||||
}
|
||||
|
||||
public static List<IForestryPlugin> getForestryPlugins(@Nonnull ASMDataTable asmDataTable) {
|
||||
return getInstances(asmDataTable, ForestryPlugin.class, IForestryPlugin.class);
|
||||
}
|
||||
|
||||
private static <T> List<T> getInstances(@Nonnull ASMDataTable asmDataTable, Class annotationClass, Class<T> instanceClass) {
|
||||
String annotationClassName = annotationClass.getCanonicalName();
|
||||
Set<ASMDataTable.ASMData> asmDatas = asmDataTable.getAll(annotationClassName);
|
||||
List<T> instances = new ArrayList<>();
|
||||
for (ASMDataTable.ASMData asmData : asmDatas) {
|
||||
try {
|
||||
Class<?> asmClass = Class.forName(asmData.getClassName());
|
||||
Class<? extends T> asmInstanceClass = asmClass.asSubclass(instanceClass);
|
||||
T instance = asmInstanceClass.newInstance();
|
||||
instances.add(instance);
|
||||
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
|
||||
Log.severe("Failed to load: {}", asmData.getClassName(), e);
|
||||
}
|
||||
}
|
||||
return instances;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package forestry.plugins;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
|
||||
import net.minecraftforge.fml.common.IFuelHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
|
||||
import forestry.core.IPickupHandler;
|
||||
import forestry.core.IResupplyHandler;
|
||||
import forestry.core.ISaveEventHandler;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
|
||||
public interface IForestryPlugin {
|
||||
boolean isAvailable();
|
||||
|
||||
boolean canBeDisabled();
|
||||
|
||||
String getFailMessage();
|
||||
|
||||
/**
|
||||
* See ForestryPlugin.pluginID()
|
||||
*/
|
||||
@Nonnull
|
||||
Set<String> getDependencyUids();
|
||||
|
||||
void setupAPI();
|
||||
|
||||
void disabledSetupAPI();
|
||||
|
||||
void registerItemsAndBlocks();
|
||||
|
||||
void preInit();
|
||||
|
||||
void registerTriggers();
|
||||
|
||||
void registerBackpackItems();
|
||||
|
||||
void registerCrates();
|
||||
|
||||
void doInit();
|
||||
|
||||
void registerRecipes();
|
||||
|
||||
void postInit();
|
||||
|
||||
boolean processIMCMessage(FMLInterModComms.IMCMessage message);
|
||||
|
||||
void populateChunk(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGeneratedZ);
|
||||
|
||||
void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ);
|
||||
|
||||
@Nullable
|
||||
ISaveEventHandler getSaveEventHandler();
|
||||
|
||||
@Nullable
|
||||
IPacketRegistry getPacketRegistry();
|
||||
|
||||
@Nullable
|
||||
IPickupHandler getPickupHandler();
|
||||
|
||||
@Nullable
|
||||
IResupplyHandler getResupplyHandler();
|
||||
|
||||
@Nullable
|
||||
ICommand[] getConsoleCommands();
|
||||
|
||||
@Nullable
|
||||
IFuelHandler getFuelHandler();
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.plugins;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Optional annotation to provide additional information on IPlugins. This information will be available via the "/forestry plugin info $pluginID" command ingame.
|
||||
*
|
||||
* @author SirSengir
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Plugin {
|
||||
|
||||
/**
|
||||
* @return Unique identifier for the plugin, no spaces!
|
||||
*/
|
||||
String pluginID();
|
||||
|
||||
/**
|
||||
* @return Nice and readable plugin name.
|
||||
*/
|
||||
String name();
|
||||
|
||||
/**
|
||||
* @return Plugin author's name.
|
||||
*/
|
||||
String author() default "";
|
||||
|
||||
/**
|
||||
* @return URL of plugin homepage.
|
||||
*/
|
||||
String url() default "";
|
||||
|
||||
/**
|
||||
* @return Version of the plugin, if any.
|
||||
*/
|
||||
String version() default "";
|
||||
|
||||
/**
|
||||
* @return Localization key for a short description what the plugin does.
|
||||
*/
|
||||
String unlocalizedDescription() default "";
|
||||
|
||||
/**
|
||||
* @return Not used (yet?).
|
||||
*/
|
||||
String help() default "";
|
||||
|
||||
}
|
||||
@@ -65,9 +65,9 @@ import forestry.api.storage.StorageManager;
|
||||
import forestry.apiculture.ArmorApiaristHelper;
|
||||
import forestry.apiculture.SaveEventHandlerApiculture;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.blocks.BlockTypeApiculture;
|
||||
import forestry.apiculture.blocks.BlockCandle;
|
||||
import forestry.apiculture.blocks.BlockRegistryApiculture;
|
||||
import forestry.apiculture.blocks.BlockTypeApiculture;
|
||||
import forestry.apiculture.blocks.BlockTypeApicultureTesr;
|
||||
import forestry.apiculture.commands.CommandBee;
|
||||
import forestry.apiculture.entities.EntityMinecartApiary;
|
||||
@@ -113,14 +113,15 @@ import forestry.core.items.EnumElectronTube;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.EntityUtil;
|
||||
import forestry.core.utils.IMCUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.Stack;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.food.items.ItemRegistryFood;
|
||||
|
||||
@Plugin(pluginID = "Apiculture", name = "Apiculture", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.apiculture.description")
|
||||
public class PluginApiculture extends ForestryPlugin {
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.APICULTURE, name = "Apiculture", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.apiculture.description")
|
||||
public class PluginApiculture extends BlankForestryPlugin {
|
||||
|
||||
@SidedProxy(clientSide = "forestry.apiculture.proxy.ProxyApicultureClient", serverSide = "forestry.apiculture.proxy.ProxyApiculture")
|
||||
public static ProxyApiculture proxy;
|
||||
@@ -140,7 +141,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
protected void setupAPI() {
|
||||
public void setupAPI() {
|
||||
super.setupAPI();
|
||||
|
||||
HiveManager.hiveRegistry = hiveRegistry = new HiveRegistry();
|
||||
@@ -168,7 +169,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerItemsAndBlocks() {
|
||||
public void registerItemsAndBlocks() {
|
||||
items = new ItemRegistryApiculture();
|
||||
blocks = new BlockRegistryApiculture();
|
||||
}
|
||||
@@ -182,11 +183,6 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
blocks.apiculture.addDefinitions(BlockTypeApiculture.VALUES);
|
||||
blocks.apicultureChest.addDefinitions(BlockTypeApicultureTesr.APIARIST_CHEST);
|
||||
|
||||
// Add triggers
|
||||
if (PluginManager.Module.BUILDCRAFT_STATEMENTS.isEnabled()) {
|
||||
ApicultureTriggers.initialize();
|
||||
}
|
||||
|
||||
/*if (Config.enableVillagers) {
|
||||
// Register village components with the Structure registry.
|
||||
VillageHandlerApiculture.registerVillageComponents();
|
||||
@@ -196,6 +192,11 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
PluginCore.rootCommand.addChildCommand(new CommandBee());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTriggers() {
|
||||
ApicultureTriggers.initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doInit() {
|
||||
File configFile = new File(Forestry.instance.getConfigFolder(), CONFIG_CATEGORY + ".cfg");
|
||||
@@ -380,7 +381,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerCrates() {
|
||||
public void registerCrates() {
|
||||
ICrateRegistry crateRegistry = StorageManager.crateRegistry;
|
||||
crateRegistry.registerCrate(PluginCore.items.beeswax.getItemStack(), "cratedBeeswax");
|
||||
crateRegistry.registerCrate(items.pollenCluster.get(EnumPollenCluster.NORMAL, 1), "cratedPollen");
|
||||
@@ -407,7 +408,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
public void registerRecipes() {
|
||||
|
||||
// / APIARIST'S ARMOR
|
||||
ItemStack wovenSilk = PluginCore.items.craftingMaterial.getWovenSilk();
|
||||
@@ -566,7 +567,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
'I', "ingotIron",
|
||||
'W', PluginCore.items.craftingMaterial.getWovenSilk());
|
||||
|
||||
if (PluginManager.Module.FACTORY.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FACTORY)) {
|
||||
// / SQUEEZER
|
||||
FluidStack honeyDropFluid = Fluids.HONEY.getFluid(Constants.FLUID_PER_HONEY_DROP);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{items.honeyDrop.getItemStack()}, honeyDropFluid, items.propolis.getItemStack(), 5);
|
||||
@@ -902,7 +903,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
if (value != null) {
|
||||
BlockCandle.addItemToLightingList(value.getItem());
|
||||
} else {
|
||||
logInvalidIMCMessage(message);
|
||||
IMCUtil.logInvalidIMCMessage(message);
|
||||
}
|
||||
return true;
|
||||
} else if (message.key.equals("add-alveary-slab") && message.isStringMessage()) {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package forestry.plugins;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -19,6 +20,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -41,9 +43,9 @@ import forestry.api.storage.ICrateRegistry;
|
||||
import forestry.api.storage.StorageManager;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.WoodItemAccess;
|
||||
import forestry.arboriculture.blocks.BlockTypeArboricultureTesr;
|
||||
import forestry.arboriculture.blocks.BlockFruitPod;
|
||||
import forestry.arboriculture.blocks.BlockRegistryArboriculture;
|
||||
import forestry.arboriculture.blocks.BlockTypeArboricultureTesr;
|
||||
import forestry.arboriculture.commands.CommandTree;
|
||||
import forestry.arboriculture.genetics.TreeBranchDefinition;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
@@ -68,11 +70,12 @@ import forestry.core.genetics.alleles.AllelePlantType;
|
||||
import forestry.core.items.ItemFruit.EnumFruit;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.IMCUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.factory.recipes.FabricatorRecipe;
|
||||
|
||||
@Plugin(pluginID = "Arboriculture", name = "Arboriculture", author = "Binnie & SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.arboriculture.description")
|
||||
public class PluginArboriculture extends ForestryPlugin {
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.ARBORICULTURE, name = "Arboriculture", author = "Binnie & SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.arboriculture.description")
|
||||
public class PluginArboriculture extends BlankForestryPlugin {
|
||||
|
||||
@SidedProxy(clientSide = "forestry.arboriculture.proxy.ProxyArboricultureClient", serverSide = "forestry.arboriculture.proxy.ProxyArboriculture")
|
||||
public static ProxyArboriculture proxy;
|
||||
@@ -84,9 +87,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
public static BlockRegistryArboriculture blocks;
|
||||
|
||||
@Override
|
||||
protected void setupAPI() {
|
||||
super.setupAPI();
|
||||
|
||||
public void setupAPI() {
|
||||
TreeManager.treeFactory = new TreeFactory();
|
||||
TreeManager.treeMutationFactory = new TreeMutationFactory();
|
||||
|
||||
@@ -105,7 +106,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerItemsAndBlocks() {
|
||||
public void registerItemsAndBlocks() {
|
||||
items = new ItemRegistryArboriculture();
|
||||
blocks = new BlockRegistryArboriculture();
|
||||
}
|
||||
@@ -186,7 +187,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerCrates() {
|
||||
public void registerCrates() {
|
||||
ICrateRegistry crateRegistry = StorageManager.crateRegistry;
|
||||
crateRegistry.registerCrate(EnumFruit.CHERRY.getStack(), "cratedCherry");
|
||||
crateRegistry.registerCrate(EnumFruit.WALNUT.getStack(), "cratedWalnut");
|
||||
@@ -198,7 +199,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
public void registerRecipes() {
|
||||
|
||||
RecipeUtil.addSmelting(new ItemStack(blocks.logs, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.coal, 1, 1), 0.15F);
|
||||
|
||||
@@ -266,7 +267,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
'#', fireproofPlanks.copy());
|
||||
|
||||
// Fabricator recipes
|
||||
if (PluginManager.Module.FACTORY.isEnabled() && PluginManager.Module.APICULTURE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.containsAll(Arrays.asList(ForestryPluginUids.FACTORY, ForestryPluginUids.APICULTURE))) {
|
||||
logs.stackSize = 1;
|
||||
fireproofLogs.stackSize = 1;
|
||||
RecipeManagers.fabricatorManager.addRecipe(new FabricatorRecipe(null, Fluids.GLASS.getFluid(500), fireproofLogs.copy(), new Object[]{
|
||||
@@ -287,7 +288,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
if (PluginManager.Module.FACTORY.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FACTORY)) {
|
||||
// Treealyzer
|
||||
RecipeManagers.carpenterManager.addRecipe(100, Fluids.WATER.getFluid(2000), null, items.treealyzer.getItemStack(), "X#X", "X#X", "RDR",
|
||||
'#', "paneGlass",
|
||||
@@ -380,7 +381,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
if (block != null && block != Blocks.air) {
|
||||
validFences.add(block);
|
||||
} else {
|
||||
logInvalidIMCMessage(message);
|
||||
IMCUtil.logInvalidIMCMessage(message);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -396,7 +397,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Larch.getMemberStack(EnumGermlingType.SAPLING), 1, 2, 4));
|
||||
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Lime.getMemberStack(EnumGermlingType.SAPLING), 1, 2, 4));
|
||||
|
||||
if (PluginManager.Module.APICULTURE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) {
|
||||
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Oak.getMemberStack(EnumGermlingType.POLLEN), 2, 3, 4));
|
||||
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Spruce.getMemberStack(EnumGermlingType.POLLEN), 2, 3, 4));
|
||||
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Birch.getMemberStack(EnumGermlingType.POLLEN), 2, 3, 4));
|
||||
|
||||
@@ -10,12 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.plugins;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.IFuelHandler;
|
||||
@@ -34,11 +38,11 @@ import forestry.core.IPickupHandler;
|
||||
import forestry.core.ISaveEventHandler;
|
||||
import forestry.core.PickupHandlerCore;
|
||||
import forestry.core.SaveEventHandlerCore;
|
||||
import forestry.core.blocks.BlockTypeCoreTesr;
|
||||
import forestry.core.blocks.BlockRegistryCore;
|
||||
import forestry.core.blocks.BlockResourceOre;
|
||||
import forestry.core.blocks.BlockResourceStorage;
|
||||
import forestry.core.blocks.BlockSoil;
|
||||
import forestry.core.blocks.BlockTypeCoreTesr;
|
||||
import forestry.core.circuits.CircuitRegistry;
|
||||
import forestry.core.circuits.SolderManager;
|
||||
import forestry.core.commands.CommandPlugins;
|
||||
@@ -56,21 +60,29 @@ import forestry.core.models.RenderHandler;
|
||||
import forestry.core.multiblock.MultiblockLogicFactory;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.network.PacketRegistryCore;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.ClimateUtil;
|
||||
import forestry.core.utils.ForestryModEnvWarningCallable;
|
||||
|
||||
@Plugin(pluginID = "Core", name = "Core", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.core.description")
|
||||
public class PluginCore extends ForestryPlugin {
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.CORE, name = "Core", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.core.description")
|
||||
public class PluginCore extends BlankForestryPlugin {
|
||||
public static final RootCommand rootCommand = new RootCommand();
|
||||
public static ItemRegistryCore items;
|
||||
public static BlockRegistryCore blocks;
|
||||
|
||||
@Override
|
||||
protected void setupAPI() {
|
||||
super.setupAPI();
|
||||
public boolean canBeDisabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<String> getDependencyUids() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupAPI() {
|
||||
ChipsetManager.solderManager = new SolderManager();
|
||||
|
||||
ChipsetManager.circuitRegistry = new CircuitRegistry();
|
||||
@@ -87,7 +99,7 @@ public class PluginCore extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerItemsAndBlocks() {
|
||||
public void registerItemsAndBlocks() {
|
||||
items = new ItemRegistryCore();
|
||||
blocks = new BlockRegistryCore();
|
||||
}
|
||||
@@ -126,7 +138,7 @@ public class PluginCore extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerCrates() {
|
||||
public void registerCrates() {
|
||||
ICrateRegistry crateRegistry = StorageManager.crateRegistry;
|
||||
|
||||
// forestry items
|
||||
@@ -197,7 +209,7 @@ public class PluginCore extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
public void registerRecipes() {
|
||||
|
||||
/* SMELTING RECIPES */
|
||||
RecipeUtil.addSmelting(blocks.resources.get(BlockResourceOre.ResourceType.APATITE, 1), items.apatite, 0.5f);
|
||||
|
||||
@@ -12,16 +12,18 @@ package forestry.plugins;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.energy.blocks.BlockTypeEngine;
|
||||
import forestry.energy.blocks.BlockRegistryEnergy;
|
||||
import forestry.energy.blocks.BlockTypeEngine;
|
||||
import forestry.energy.proxy.ProxyEnergy;
|
||||
|
||||
@Plugin(pluginID = "Energy", name = "Energy", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.energy.description")
|
||||
public class PluginEnergy extends ForestryPlugin {
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.ENERGY, name = "Energy", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.energy.description")
|
||||
public class PluginEnergy extends BlankForestryPlugin {
|
||||
|
||||
@SidedProxy(clientSide = "forestry.energy.proxy.ProxyEnergyClient", serverSide = "forestry.energy.proxy.ProxyEnergy")
|
||||
public static ProxyEnergy proxy;
|
||||
@@ -29,7 +31,7 @@ public class PluginEnergy extends ForestryPlugin {
|
||||
public static BlockRegistryEnergy blocks;
|
||||
|
||||
@Override
|
||||
protected void registerItemsAndBlocks() {
|
||||
public void registerItemsAndBlocks() {
|
||||
blocks = new BlockRegistryEnergy();
|
||||
}
|
||||
|
||||
@@ -51,7 +53,7 @@ public class PluginEnergy extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
public void registerRecipes() {
|
||||
super.registerRecipes();
|
||||
|
||||
RecipeUtil.addRecipe(blocks.engine.get(BlockTypeEngine.PEAT),
|
||||
|
||||
@@ -32,8 +32,8 @@ import forestry.api.fuels.RainSubstrate;
|
||||
import forestry.api.recipes.ICraftingProvider;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.apiculture.items.ItemRegistryApiculture;
|
||||
import forestry.core.blocks.BlockTypeCoreTesr;
|
||||
import forestry.core.blocks.BlockSoil;
|
||||
import forestry.core.blocks.BlockTypeCoreTesr;
|
||||
import forestry.core.circuits.Circuit;
|
||||
import forestry.core.circuits.CircuitLayout;
|
||||
import forestry.core.circuits.EnumCircuitBoardType;
|
||||
@@ -48,9 +48,9 @@ import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.datastructures.FluidMap;
|
||||
import forestry.core.utils.datastructures.ItemStackMap;
|
||||
import forestry.factory.DummyManagers;
|
||||
import forestry.factory.blocks.BlockRegistryFactory;
|
||||
import forestry.factory.blocks.BlockTypeFactoryPlain;
|
||||
import forestry.factory.blocks.BlockTypeFactoryTesr;
|
||||
import forestry.factory.blocks.BlockRegistryFactory;
|
||||
import forestry.factory.circuits.CircuitSpeedUpgrade;
|
||||
import forestry.factory.network.PacketRegistryFactory;
|
||||
import forestry.factory.recipes.CarpenterRecipeManager;
|
||||
@@ -63,14 +63,12 @@ import forestry.factory.recipes.SqueezerRecipeManager;
|
||||
import forestry.factory.recipes.StillRecipeManager;
|
||||
import forestry.factory.triggers.FactoryTriggers;
|
||||
|
||||
@Plugin(pluginID = "Factory", name = "Factory", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.factory.description")
|
||||
public class PluginFactory extends ForestryPlugin {
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.FACTORY, name = "Factory", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.factory.description")
|
||||
public class PluginFactory extends BlankForestryPlugin {
|
||||
public static BlockRegistryFactory blocks;
|
||||
|
||||
@Override
|
||||
protected void setupAPI() {
|
||||
super.setupAPI();
|
||||
|
||||
public void setupAPI() {
|
||||
RecipeManagers.craftingProviders = ImmutableList.<ICraftingProvider>of(
|
||||
RecipeManagers.carpenterManager = new CarpenterRecipeManager(),
|
||||
RecipeManagers.centrifugeManager = new CentrifugeRecipeManager(),
|
||||
@@ -86,9 +84,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disabledSetupAPI() {
|
||||
super.disabledSetupAPI();
|
||||
|
||||
public void disabledSetupAPI() {
|
||||
RecipeManagers.craftingProviders = ImmutableList.<ICraftingProvider>of(
|
||||
RecipeManagers.carpenterManager = new DummyManagers.DummyCarpenterManager(),
|
||||
RecipeManagers.centrifugeManager = new DummyManagers.DummyCentrifugeManager(),
|
||||
@@ -113,7 +109,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerItemsAndBlocks() {
|
||||
public void registerItemsAndBlocks() {
|
||||
blocks = new BlockRegistryFactory();
|
||||
}
|
||||
|
||||
@@ -183,7 +179,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerTriggers() {
|
||||
public void registerTriggers() {
|
||||
FactoryTriggers.initialize();
|
||||
}
|
||||
|
||||
@@ -200,7 +196,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
public void registerRecipes() {
|
||||
|
||||
// / FABRICATOR
|
||||
ItemElectronTube electronTube = PluginCore.items.tubes;
|
||||
@@ -233,7 +229,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
String[] dyes = {"dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", "dyePink", "dyeLime",
|
||||
"dyeYellow", "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite"};
|
||||
|
||||
if (PluginManager.Module.APICULTURE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) {
|
||||
ItemRegistryApiculture beeItems = PluginApiculture.items;
|
||||
FluidStack liquidGlass = Fluids.GLASS.getFluid(Constants.BUCKET_VOLUME);
|
||||
FluidStack liquidGlassX4 = Fluids.GLASS.getFluid(Constants.BUCKET_VOLUME * 4);
|
||||
@@ -414,7 +410,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
RecipeManagers.carpenterManager.addRecipe(null, PluginCore.items.ingotBronze.getItemStack(), "#", '#', PluginCore.items.brokenBronzeShovel);
|
||||
|
||||
// Crating and uncrating
|
||||
if (PluginManager.Module.STORAGE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.STORAGE)) {
|
||||
PluginStorage.createCrateRecipes();
|
||||
}
|
||||
ICircuitLayout layout = ChipsetManager.circuitRegistry.getLayout("forestry.machine.upgrade");
|
||||
|
||||
@@ -22,6 +22,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
@@ -30,9 +31,11 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.Farmables;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.core.circuits.Circuit;
|
||||
@@ -40,6 +43,7 @@ import forestry.core.circuits.CircuitLayout;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.items.EnumElectronTube;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.IMCUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.farming.blocks.BlockRegistryFarming;
|
||||
@@ -73,8 +77,8 @@ import forestry.farming.tiles.TileFarmPlain;
|
||||
import forestry.farming.tiles.TileFarmValve;
|
||||
import forestry.farming.triggers.FarmingTriggers;
|
||||
|
||||
@Plugin(pluginID = "Farming", name = "Farming", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.farming.description")
|
||||
public class PluginFarming extends ForestryPlugin {
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.FARMING, name = "Farming", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.farming.description")
|
||||
public class PluginFarming extends BlankForestryPlugin {
|
||||
|
||||
@SidedProxy(clientSide = "forestry.farming.proxy.ProxyFarmingClient", serverSide = "forestry.farming.proxy.ProxyFarming")
|
||||
public static ProxyFarming proxy;
|
||||
@@ -83,19 +87,17 @@ public class PluginFarming extends ForestryPlugin {
|
||||
public static BlockRegistryFarming blocks;
|
||||
|
||||
@Override
|
||||
protected void registerItemsAndBlocks() {
|
||||
public void registerItemsAndBlocks() {
|
||||
blocks = new BlockRegistryFarming();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
super.preInit();
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
Farmables.farmables.put("farmArboreal", new ArrayList<IFarmable>());
|
||||
Farmables.farmables.get("farmArboreal").add(new FarmableVanillaSapling());
|
||||
if (PluginManager.Module.ARBORICULTURE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ARBORICULTURE)) {
|
||||
Farmables.farmables.get("farmArboreal").add(new FarmableGE());
|
||||
}
|
||||
|
||||
@@ -139,7 +141,7 @@ public class PluginFarming extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerTriggers() {
|
||||
public void registerTriggers() {
|
||||
FarmingTriggers.initialize();
|
||||
}
|
||||
|
||||
@@ -177,7 +179,7 @@ public class PluginFarming extends ForestryPlugin {
|
||||
|
||||
if (message.key.equals("add-farmable-sapling")) {
|
||||
String[] tokens = message.getStringValue().split("@");
|
||||
String errormsg = getInvalidIMCMessageText(message);
|
||||
String errormsg = IMCUtil.getInvalidIMCMessageText(message);
|
||||
if (tokens.length != 2) {
|
||||
Log.warning(errormsg);
|
||||
return true;
|
||||
@@ -231,7 +233,7 @@ public class PluginFarming extends ForestryPlugin {
|
||||
} else if (message.key.equals("add-farmable-crop")) {
|
||||
|
||||
String[] tokens = message.getStringValue().split("@");
|
||||
String errormsg = getInvalidIMCMessageText(message);
|
||||
String errormsg = IMCUtil.getInvalidIMCMessageText(message);
|
||||
if (tokens.length != 2) {
|
||||
Log.warning(errormsg);
|
||||
return true;
|
||||
@@ -273,7 +275,7 @@ public class PluginFarming extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
public void registerRecipes() {
|
||||
|
||||
ItemStack basic = blocks.farm.get(EnumFarmBlockType.PLAIN, 1);
|
||||
ItemStack gearbox = blocks.farm.get(EnumFarmBlockType.GEARBOX, 1);
|
||||
|
||||
@@ -19,14 +19,15 @@ import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.fuels.GeneratorFuel;
|
||||
@@ -44,8 +45,8 @@ import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
@Plugin(pluginID = "Fluids", name = "Fluids", author = "mezz", url = Constants.URL, unlocalizedDescription = "for.plugin.fluids.description")
|
||||
public class PluginFluids extends ForestryPlugin {
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.FLUIDS, name = "Fluids", author = "mezz", url = Constants.URL, unlocalizedDescription = "for.plugin.fluids.description")
|
||||
public class PluginFluids extends BlankForestryPlugin {
|
||||
|
||||
private static final List<Fluids> forestryFluidsWithBlocks = new ArrayList<>();
|
||||
|
||||
@@ -86,6 +87,11 @@ public class PluginFluids extends ForestryPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeDisabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerItemsAndBlocks() {
|
||||
for (Fluids fluidType : Fluids.forestryFluids) {
|
||||
|
||||
@@ -26,13 +26,13 @@ import forestry.food.InfuserMixtureManager;
|
||||
import forestry.food.items.EnumBeverage;
|
||||
import forestry.food.items.ItemRegistryFood;
|
||||
|
||||
@Plugin(pluginID = "Food", name = "Food", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.food.description")
|
||||
public class PluginFood extends ForestryPlugin {
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.FOOD, name = "Food", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.food.description")
|
||||
public class PluginFood extends BlankForestryPlugin {
|
||||
|
||||
public static ItemRegistryFood items;
|
||||
|
||||
@Override
|
||||
protected void setupAPI() {
|
||||
public void setupAPI() {
|
||||
super.setupAPI();
|
||||
|
||||
// Init seasoner
|
||||
@@ -41,14 +41,12 @@ public class PluginFood extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerItemsAndBlocks() {
|
||||
public void registerItemsAndBlocks() {
|
||||
items = new ItemRegistryFood();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preInit() {
|
||||
super.preInit();
|
||||
|
||||
public void preInit() {
|
||||
LiquidRegistryHelper.registerLiquidContainer(Fluids.SHORT_MEAD, Constants.BUCKET_VOLUME, items.beverage.get(EnumBeverage.MEAD_SHORT, 1), new ItemStack(Items.glass_bottle));
|
||||
|
||||
ItemRegistryApiculture beeItems = PluginApiculture.items;
|
||||
@@ -64,7 +62,7 @@ public class PluginFood extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
public void registerRecipes() {
|
||||
// INFUSER
|
||||
RecipeUtil.addRecipe(items.infuser.getItemStack(),
|
||||
"X", "#", "X",
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.plugins;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.File;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
@@ -51,8 +52,8 @@ import forestry.lepidopterology.items.ItemRegistryLepidopterology;
|
||||
import forestry.lepidopterology.proxy.ProxyLepidopterology;
|
||||
import forestry.lepidopterology.recipes.MatingRecipe;
|
||||
|
||||
@Plugin(pluginID = "Lepidopterology", name = "Lepidopterology", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.lepidopterology.description")
|
||||
public class PluginLepidopterology extends ForestryPlugin {
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.LEPIDOPTEROLOGY, name = "Lepidopterology", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.lepidopterology.description")
|
||||
public class PluginLepidopterology extends BlankForestryPlugin {
|
||||
|
||||
@SidedProxy(clientSide = "forestry.lepidopterology.proxy.ProxyLepidopterologyClient", serverSide = "forestry.lepidopterology.proxy.ProxyLepidopterology")
|
||||
public static ProxyLepidopterology proxy;
|
||||
@@ -65,9 +66,7 @@ public class PluginLepidopterology extends ForestryPlugin {
|
||||
public static BlockRegistryLepidopterology blocks;
|
||||
|
||||
@Override
|
||||
protected void setupAPI() {
|
||||
super.setupAPI();
|
||||
|
||||
public void setupAPI() {
|
||||
ButterflyManager.butterflyRoot = new ButterflyHelper();
|
||||
AlleleManager.alleleRegistry.registerSpeciesRoot(ButterflyManager.butterflyRoot);
|
||||
|
||||
@@ -75,7 +74,7 @@ public class PluginLepidopterology extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerItemsAndBlocks() {
|
||||
public void registerItemsAndBlocks() {
|
||||
items = new ItemRegistryLepidopterology();
|
||||
blocks = new BlockRegistryLepidopterology();
|
||||
}
|
||||
@@ -90,11 +89,12 @@ public class PluginLepidopterology extends ForestryPlugin {
|
||||
blocks.lepidopterology.addDefinitions(BlockTypeLepidopterologyTesr.VALUES);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumSet<PluginManager.Module> getDependancies() {
|
||||
EnumSet<PluginManager.Module> deps = super.getDependancies();
|
||||
deps.add(PluginManager.Module.ARBORICULTURE);
|
||||
return deps;
|
||||
public Set<String> getDependencyUids() {
|
||||
Set<String> dependencyUids = super.getDependencyUids();
|
||||
dependencyUids.add(ForestryPluginUids.ARBORICULTURE);
|
||||
return dependencyUids;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,7 +129,7 @@ public class PluginLepidopterology extends ForestryPlugin {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
public void registerRecipes() {
|
||||
CraftingManager.getInstance().getRecipeList().add(new MatingRecipe());
|
||||
|
||||
RecipeManagers.carpenterManager.addRecipe(100, Fluids.WATER.getFluid(2000), null, items.flutterlyzer.getItemStack(),
|
||||
|
||||
@@ -12,7 +12,9 @@ package forestry.plugins;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
|
||||
import forestry.api.mail.EnumAddressee;
|
||||
import forestry.api.mail.PostManager;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
@@ -29,30 +31,28 @@ import forestry.mail.EventHandlerMailAlert;
|
||||
import forestry.mail.PostRegistry;
|
||||
import forestry.mail.PostalCarrier;
|
||||
import forestry.mail.SaveEventHandlerMail;
|
||||
import forestry.mail.blocks.BlockTypeMail;
|
||||
import forestry.mail.blocks.BlockRegistryMail;
|
||||
import forestry.mail.blocks.BlockTypeMail;
|
||||
import forestry.mail.commands.CommandMail;
|
||||
import forestry.mail.items.EnumStampDefinition;
|
||||
import forestry.mail.items.ItemRegistryMail;
|
||||
import forestry.mail.network.PacketRegistryMail;
|
||||
import forestry.mail.triggers.MailTriggers;
|
||||
|
||||
@Plugin(pluginID = "Mail", name = "Mail", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.mail.description")
|
||||
public class PluginMail extends ForestryPlugin {
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.MAIL, name = "Mail", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.mail.description")
|
||||
public class PluginMail extends BlankForestryPlugin {
|
||||
public static ItemRegistryMail items;
|
||||
public static BlockRegistryMail blocks;
|
||||
|
||||
@Override
|
||||
protected void setupAPI() {
|
||||
super.setupAPI();
|
||||
|
||||
public void setupAPI() {
|
||||
PostManager.postRegistry = new PostRegistry();
|
||||
PostManager.postRegistry.registerCarrier(new PostalCarrier(EnumAddressee.PLAYER));
|
||||
PostManager.postRegistry.registerCarrier(new PostalCarrier(EnumAddressee.TRADER));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerItemsAndBlocks() {
|
||||
public void registerItemsAndBlocks() {
|
||||
items = new ItemRegistryMail();
|
||||
blocks = new BlockRegistryMail();
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public class PluginMail extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerTriggers() {
|
||||
public void registerTriggers() {
|
||||
MailTriggers.initialize();
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class PluginMail extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
public void registerRecipes() {
|
||||
Object stampGlue;
|
||||
Object letterGlue;
|
||||
|
||||
|
||||
@@ -11,13 +11,16 @@
|
||||
package forestry.plugins;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
@@ -32,33 +35,30 @@ import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fml.common.IFuelHandler;
|
||||
import net.minecraftforge.fml.common.discovery.ASMDataTable;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.Forestry;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.IPickupHandler;
|
||||
import forestry.core.IResupplyHandler;
|
||||
import forestry.core.ISaveEventHandler;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.plugins.compat.PluginBiomesOPlenty;
|
||||
import forestry.plugins.compat.PluginBuildCraftFuels;
|
||||
import forestry.plugins.compat.PluginBuildCraftRecipes;
|
||||
import forestry.plugins.compat.PluginBuildCraftStatements;
|
||||
import forestry.plugins.compat.PluginBuildCraftTransport;
|
||||
import forestry.plugins.compat.PluginChisel;
|
||||
import forestry.plugins.compat.PluginNatura;
|
||||
|
||||
public class PluginManager {
|
||||
|
||||
private static final String MODULE_CONFIG_FILE_NAME = "modules.cfg";
|
||||
private static final String CATEGORY_MODULES = "modules";
|
||||
private static final String PLUGIN_CONFIG_FILE_NAME = "plugins.cfg";
|
||||
private static final String CATEGORY_PLUGINS = "plugins";
|
||||
|
||||
public static final ArrayList<IPickupHandler> pickupHandlers = Lists.newArrayList();
|
||||
public static final ArrayList<ISaveEventHandler> saveEventHandlers = Lists.newArrayList();
|
||||
public static final ArrayList<IResupplyHandler> resupplyHandlers = Lists.newArrayList();
|
||||
|
||||
private static final Set<Module> loadedModules = EnumSet.noneOf(Module.class);
|
||||
private static final Set<Module> unloadedModules = EnumSet.allOf(Module.class);
|
||||
private static final Set<IForestryPlugin> loadedPlugins = new LinkedHashSet<>();
|
||||
private static final Set<IForestryPlugin> unloadedPlugins = new LinkedHashSet<>();
|
||||
private static Stage stage = Stage.SETUP;
|
||||
|
||||
public enum Stage {
|
||||
@@ -70,90 +70,23 @@ public class PluginManager {
|
||||
FINISHED
|
||||
}
|
||||
|
||||
public enum Module {
|
||||
|
||||
CORE(new PluginCore(), false),
|
||||
FLUIDS(new PluginFluids(), false),
|
||||
|
||||
APICULTURE(new PluginApiculture()),
|
||||
ARBORICULTURE(new PluginArboriculture()),
|
||||
ENERGY(new PluginEnergy()),
|
||||
FACTORY(new PluginFactory()),
|
||||
FARMING(new PluginFarming()),
|
||||
FOOD(new PluginFood()),
|
||||
LEPIDOPTEROLOGY(new PluginLepidopterology()),
|
||||
MAIL(new PluginMail()),
|
||||
STORAGE(new PluginStorage()),
|
||||
|
||||
BUILDCRAFT_FUELS(new PluginBuildCraftFuels()),
|
||||
BUILDCRAFT_RECIPES(new PluginBuildCraftRecipes()),
|
||||
BUILDCRAFT_STATEMENTS(new PluginBuildCraftStatements()),
|
||||
BUILDCRAFT_TRANSPORT(new PluginBuildCraftTransport()),
|
||||
|
||||
//AGRICRAFT(new PluginAgriCraft()),
|
||||
BIOMESOPLENTY(new PluginBiomesOPlenty()),
|
||||
CHISEL(new PluginChisel()),
|
||||
/*ENDERIO(new PluginEnderIO()),
|
||||
EREBUS(new PluginErebus()),
|
||||
EXTRAUTILITIES(new PluginExtraUtilities()),
|
||||
GROWTHCRAFT(new PluginGrowthCraft()),
|
||||
HARVESTCRAFT(new PluginHarvestCraft()),
|
||||
IMMERSIVEENGINEERING(new PluginImmersiveEngineering()),
|
||||
INDUSTRIALCRAFT(new PluginIC2()),
|
||||
MAGICALCROPS(new PluginMagicalCrops()),*/
|
||||
NATURA(new PluginNatura()),
|
||||
/*PLANTMEGAPACK(new PluginPlantMegaPack()),
|
||||
ROTARYCRAFT(new PluginRotaryCraft()),
|
||||
WITCHERY(new PluginWitchery())*/;
|
||||
|
||||
static {
|
||||
ForestryAPI.enabledPlugins = new HashSet<>();
|
||||
}
|
||||
|
||||
private final ForestryPlugin instance;
|
||||
private final boolean canBeDisabled;
|
||||
|
||||
Module(ForestryPlugin plugin) {
|
||||
this(plugin, true);
|
||||
}
|
||||
|
||||
Module(ForestryPlugin plugin, boolean canBeDisabled) {
|
||||
this.instance = plugin;
|
||||
this.canBeDisabled = canBeDisabled;
|
||||
}
|
||||
|
||||
public ForestryPlugin instance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return ForestryAPI.enabledPlugins.contains(toString());
|
||||
}
|
||||
|
||||
public boolean canBeDisabled() {
|
||||
return canBeDisabled;
|
||||
}
|
||||
|
||||
public String configName() {
|
||||
return toString().toLowerCase(Locale.ENGLISH).replace('_', '.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final EnumSet<Module> configDisabledModules = EnumSet.noneOf(Module.class);
|
||||
public static final Set<IForestryPlugin> configDisabledPlugins = new HashSet<>();
|
||||
|
||||
public static Stage getStage() {
|
||||
return stage;
|
||||
}
|
||||
|
||||
public static EnumSet<Module> getLoadedModules() {
|
||||
return EnumSet.copyOf(loadedModules);
|
||||
public static Set<IForestryPlugin> getLoadedPlugins() {
|
||||
return ImmutableSet.copyOf(loadedPlugins);
|
||||
}
|
||||
|
||||
private static void registerHandlers(ForestryPlugin plugin) {
|
||||
private static void registerHandlers(IForestryPlugin plugin) {
|
||||
Log.fine("Registering Handlers for Plugin: {0}", plugin);
|
||||
|
||||
plugin.getPacketRegistry().registerPackets();
|
||||
IPacketRegistry packetRegistry = plugin.getPacketRegistry();
|
||||
if (packetRegistry != null) {
|
||||
packetRegistry.registerPackets();
|
||||
}
|
||||
|
||||
IPickupHandler pickupHandler = plugin.getPickupHandler();
|
||||
if (pickupHandler != null) {
|
||||
@@ -176,57 +109,78 @@ public class PluginManager {
|
||||
}
|
||||
}
|
||||
|
||||
private static void configureModules() {
|
||||
private static IForestryPlugin getPluginCore(@Nonnull List<IForestryPlugin> forestryPlugins) {
|
||||
for (IForestryPlugin plugin : forestryPlugins) {
|
||||
if (plugin instanceof PluginCore) {
|
||||
return plugin;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void configurePlugins(@Nonnull List<IForestryPlugin> forestryPlugins) {
|
||||
Locale locale = Locale.getDefault();
|
||||
Locale.setDefault(Locale.ENGLISH);
|
||||
|
||||
Configuration config = new Configuration(new File(Forestry.instance.getConfigFolder(), MODULE_CONFIG_FILE_NAME));
|
||||
Configuration config = new Configuration(new File(Forestry.instance.getConfigFolder(), PLUGIN_CONFIG_FILE_NAME));
|
||||
|
||||
config.load();
|
||||
config.addCustomCategoryComment(CATEGORY_MODULES, "Disabling these modules can greatly change how the mod functions.\n"
|
||||
config.addCustomCategoryComment(CATEGORY_PLUGINS, "Disabling these plugins can greatly change how the mod functions.\n"
|
||||
+ "Your mileage may vary, please report any issues.");
|
||||
|
||||
Set<Module> toLoad = EnumSet.allOf(Module.class);
|
||||
Iterator<Module> it = toLoad.iterator();
|
||||
while (it.hasNext()) {
|
||||
Module m = it.next();
|
||||
if (!m.canBeDisabled()) {
|
||||
continue;
|
||||
}
|
||||
if (!isEnabled(config, m)) {
|
||||
it.remove();
|
||||
Log.info("Module disabled: {0}", m);
|
||||
continue;
|
||||
}
|
||||
ForestryPlugin plugin = m.instance;
|
||||
if (!plugin.isAvailable()) {
|
||||
it.remove();
|
||||
Log.info("Module {0} failed to load: {1}", plugin, plugin.getFailMessage());
|
||||
continue;
|
||||
IForestryPlugin corePlugin = getPluginCore(forestryPlugins);
|
||||
forestryPlugins.remove(corePlugin);
|
||||
forestryPlugins.add(0, corePlugin);
|
||||
|
||||
Set<String> toLoad = new HashSet<>();
|
||||
|
||||
ImmutableList<IForestryPlugin> allForestryPlugins = ImmutableList.copyOf(forestryPlugins);
|
||||
|
||||
Iterator<IForestryPlugin> iterator = forestryPlugins.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
IForestryPlugin plugin = iterator.next();
|
||||
if (plugin.canBeDisabled()) {
|
||||
if (!isEnabled(config, plugin)) {
|
||||
iterator.remove();
|
||||
Log.info("Plugin disabled: {0}", plugin);
|
||||
continue;
|
||||
}
|
||||
if (!plugin.isAvailable()) {
|
||||
iterator.remove();
|
||||
Log.info("Plugin {0} failed to load: {1}", plugin, plugin.getFailMessage());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ForestryPlugin info = plugin.getClass().getAnnotation(ForestryPlugin.class);
|
||||
toLoad.add(info.pluginID());
|
||||
}
|
||||
|
||||
boolean changed;
|
||||
do {
|
||||
changed = false;
|
||||
it = toLoad.iterator();
|
||||
while (it.hasNext()) {
|
||||
Module m = it.next();
|
||||
Set<Module> deps = m.instance().getDependancies();
|
||||
if (!toLoad.containsAll(deps)) {
|
||||
it.remove();
|
||||
iterator = forestryPlugins.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
IForestryPlugin plugin = iterator.next();
|
||||
Set<String> dependencies = plugin.getDependencyUids();
|
||||
if (!toLoad.containsAll(dependencies)) {
|
||||
iterator.remove();
|
||||
changed = true;
|
||||
Log.warning("Module {0} is missing dependencies: {1}", m, deps);
|
||||
continue;
|
||||
ForestryPlugin info = plugin.getClass().getAnnotation(ForestryPlugin.class);
|
||||
String pluginId = info.pluginID();
|
||||
toLoad.remove(pluginId);
|
||||
Log.warning("Plugin {0} is missing dependencies: {1}", pluginId, dependencies);
|
||||
}
|
||||
}
|
||||
} while (changed);
|
||||
|
||||
unloadedModules.removeAll(toLoad);
|
||||
loadedModules.addAll(toLoad);
|
||||
loadedPlugins.addAll(forestryPlugins);
|
||||
unloadedPlugins.addAll(allForestryPlugins);
|
||||
unloadedPlugins.removeAll(loadedPlugins);
|
||||
|
||||
for (Module m : loadedModules) {
|
||||
ForestryAPI.enabledPlugins.add(m.toString());
|
||||
ForestryAPI.enabledPlugins = new HashSet<>();
|
||||
for (IForestryPlugin plugin : loadedPlugins) {
|
||||
ForestryPlugin info = plugin.getClass().getAnnotation(ForestryPlugin.class);
|
||||
ForestryAPI.enabledPlugins.add(info.pluginID());
|
||||
}
|
||||
|
||||
if (config.hasChanged()) {
|
||||
@@ -236,12 +190,15 @@ public class PluginManager {
|
||||
Locale.setDefault(locale);
|
||||
}
|
||||
|
||||
public static void runSetup() {
|
||||
stage = Stage.SETUP;
|
||||
configureModules();
|
||||
public static void runSetup(FMLPreInitializationEvent event) {
|
||||
|
||||
for (Module m : loadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
ASMDataTable asmDataTable = event.getAsmData();
|
||||
List<IForestryPlugin> forestryPlugins = ForestryPluginUtil.getForestryPlugins(asmDataTable);
|
||||
|
||||
stage = Stage.SETUP;
|
||||
configurePlugins(forestryPlugins);
|
||||
|
||||
for (IForestryPlugin plugin : loadedPlugins) {
|
||||
Log.fine("Setup Start: {0}", plugin);
|
||||
plugin.setupAPI();
|
||||
plugin.registerItemsAndBlocks();
|
||||
@@ -249,8 +206,7 @@ public class PluginManager {
|
||||
}
|
||||
|
||||
stage = Stage.SETUP_DISABLED;
|
||||
for (Module m : unloadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
for (IForestryPlugin plugin : unloadedPlugins) {
|
||||
Log.fine("Disabled-Setup Start: {0}", plugin);
|
||||
plugin.disabledSetupAPI();
|
||||
Log.fine("Disabled-Setup Complete: {0}", plugin);
|
||||
@@ -259,15 +215,14 @@ public class PluginManager {
|
||||
|
||||
public static void runPreInit() {
|
||||
stage = Stage.PRE_INIT;
|
||||
for (Module m : loadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
for (IForestryPlugin plugin : loadedPlugins) {
|
||||
Log.fine("Pre-Init Start: {0}", plugin);
|
||||
registerHandlers(plugin);
|
||||
plugin.preInit();
|
||||
if (Module.BUILDCRAFT_STATEMENTS.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.BUILDCRAFT_STATEMENTS)) {
|
||||
plugin.registerTriggers();
|
||||
}
|
||||
if (Module.STORAGE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.STORAGE)) {
|
||||
plugin.registerBackpackItems();
|
||||
plugin.registerCrates();
|
||||
}
|
||||
@@ -277,8 +232,7 @@ public class PluginManager {
|
||||
|
||||
public static void runInit() {
|
||||
stage = Stage.INIT;
|
||||
for (Module m : loadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
for (IForestryPlugin plugin : loadedPlugins) {
|
||||
Log.fine("Init Start: {0}", plugin);
|
||||
plugin.doInit();
|
||||
plugin.registerRecipes();
|
||||
@@ -288,8 +242,7 @@ public class PluginManager {
|
||||
|
||||
public static void runPostInit() {
|
||||
stage = Stage.POST_INIT;
|
||||
for (Module m : loadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
for (IForestryPlugin plugin : loadedPlugins) {
|
||||
Log.fine("Post-Init Start: {0}", plugin);
|
||||
plugin.postInit();
|
||||
Log.fine("Post-Init Complete: {0}", plugin);
|
||||
@@ -301,8 +254,7 @@ public class PluginManager {
|
||||
public static void serverStarting(MinecraftServer server) {
|
||||
CommandHandler commandManager = (CommandHandler) server.getCommandManager();
|
||||
|
||||
for (Module m : loadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
for (IForestryPlugin plugin : loadedPlugins) {
|
||||
ICommand[] commands = plugin.getConsoleCommands();
|
||||
if (commands == null) {
|
||||
continue;
|
||||
@@ -315,8 +267,7 @@ public class PluginManager {
|
||||
|
||||
public static void processIMCMessages(ImmutableList<FMLInterModComms.IMCMessage> messages) {
|
||||
for (FMLInterModComms.IMCMessage message : messages) {
|
||||
for (Module m : loadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
for (IForestryPlugin plugin : loadedPlugins) {
|
||||
if (plugin.processIMCMessage(message)) {
|
||||
break;
|
||||
}
|
||||
@@ -325,28 +276,26 @@ public class PluginManager {
|
||||
}
|
||||
|
||||
public static void populateChunk(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
|
||||
for (Module m : loadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
for (IForestryPlugin plugin : loadedPlugins) {
|
||||
plugin.populateChunk(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated);
|
||||
}
|
||||
}
|
||||
|
||||
public static void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ) {
|
||||
for (Module m : loadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
for (IForestryPlugin plugin : loadedPlugins) {
|
||||
plugin.populateChunkRetroGen(world, rand, chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isEnabled(Configuration config, Module m) {
|
||||
Plugin info = m.instance().getClass().getAnnotation(Plugin.class);
|
||||
private static boolean isEnabled(Configuration config, IForestryPlugin plugin) {
|
||||
ForestryPlugin info = plugin.getClass().getAnnotation(ForestryPlugin.class);
|
||||
|
||||
String comment = StatCollector.translateToLocal(info.unlocalizedDescription());
|
||||
Property prop = config.get(CATEGORY_MODULES, m.configName(), true, comment);
|
||||
Property prop = config.get(CATEGORY_PLUGINS, info.pluginID(), true, comment);
|
||||
boolean enabled = prop.getBoolean();
|
||||
|
||||
if (!enabled) {
|
||||
configDisabledModules.add(m);
|
||||
configDisabledPlugins.add(plugin);
|
||||
}
|
||||
|
||||
return enabled;
|
||||
|
||||
@@ -12,7 +12,6 @@ package forestry.plugins;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -36,7 +35,6 @@ import net.minecraft.block.BlockTrapDoor;
|
||||
import net.minecraft.block.BlockWall;
|
||||
import net.minecraft.block.BlockWorkbench;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.model.ModelBakery;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -44,8 +42,8 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemDoor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
@@ -60,6 +58,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.Forestry;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
@@ -72,13 +71,13 @@ import forestry.core.config.LocalizedConfiguration;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.items.ItemCrated;
|
||||
import forestry.core.models.ModelCrate;
|
||||
import forestry.core.models.RenderHandler;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.IMCUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.lepidopterology.blocks.BlockTypeLepidopterologyTesr;
|
||||
import forestry.lepidopterology.blocks.BlockRegistryLepidopterology;
|
||||
import forestry.lepidopterology.blocks.BlockTypeLepidopterologyTesr;
|
||||
import forestry.storage.BackpackDefinition;
|
||||
import forestry.storage.BackpackDefinition.BackpackDefinitionApiarist;
|
||||
import forestry.storage.BackpackDefinition.BackpackDefinitionLepidopterist;
|
||||
@@ -88,8 +87,8 @@ import forestry.storage.PickupHandlerStorage;
|
||||
import forestry.storage.ResupplyHandler;
|
||||
import forestry.storage.items.ItemRegistryStorage;
|
||||
|
||||
@Plugin(pluginID = "Storage", name = "Storage", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.storage.description")
|
||||
public class PluginStorage extends ForestryPlugin {
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.STORAGE, name = "Storage", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.storage.description")
|
||||
public class PluginStorage extends BlankForestryPlugin {
|
||||
|
||||
private static final List<ItemCrated> crates = new ArrayList<>();
|
||||
private static final String CONFIG_CATEGORY = "backpacks";
|
||||
@@ -105,7 +104,7 @@ public class PluginStorage extends ForestryPlugin {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
protected void setupAPI() {
|
||||
public void setupAPI() {
|
||||
super.setupAPI();
|
||||
|
||||
StorageManager.crateRegistry = new CrateRegistry();
|
||||
@@ -123,12 +122,12 @@ public class PluginStorage extends ForestryPlugin {
|
||||
|
||||
BackpackDefinition definition;
|
||||
|
||||
if (PluginManager.Module.APICULTURE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) {
|
||||
definition = new BackpackDefinitionApiarist(new Color(0xc4923d).getRGB());
|
||||
BackpackManager.definitions.put(definition.getKey(), definition);
|
||||
}
|
||||
|
||||
if (PluginManager.Module.LEPIDOPTEROLOGY.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.LEPIDOPTEROLOGY)) {
|
||||
definition = new BackpackDefinitionLepidopterist(new Color(0x995b31).getRGB());
|
||||
BackpackManager.definitions.put(definition.getKey(), definition);
|
||||
}
|
||||
@@ -155,7 +154,7 @@ public class PluginStorage extends ForestryPlugin {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
protected void disabledSetupAPI() {
|
||||
public void disabledSetupAPI() {
|
||||
BackpackManager.backpackItems = new ArrayList[6];
|
||||
BackpackManager.backpackItems[0] = minerItems;
|
||||
BackpackManager.backpackItems[1] = diggerItems;
|
||||
@@ -166,12 +165,12 @@ public class PluginStorage extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerItemsAndBlocks() {
|
||||
public void registerItemsAndBlocks() {
|
||||
items = new ItemRegistryStorage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preInit() {
|
||||
public void preInit() {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@@ -485,12 +484,12 @@ public class PluginStorage extends ForestryPlugin {
|
||||
if (message.key.equals("add-backpack-items")) {
|
||||
String[] tokens = message.getStringValue().split("@");
|
||||
if (tokens.length != 2) {
|
||||
logInvalidIMCMessage(message);
|
||||
IMCUtil.logInvalidIMCMessage(message);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!BackpackManager.definitions.containsKey(tokens[0])) {
|
||||
String errorMessage = getInvalidIMCMessageText(message);
|
||||
String errorMessage = IMCUtil.getInvalidIMCMessageText(message);
|
||||
Log.warning("%s For non-existent backpack %s.", errorMessage, tokens[0]);
|
||||
return true;
|
||||
}
|
||||
@@ -515,7 +514,7 @@ public class PluginStorage extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
public void registerRecipes() {
|
||||
BlockRegistryApiculture beeBlocks = PluginApiculture.blocks;
|
||||
if (items.apiaristBackpack != null && beeBlocks != null) {
|
||||
addBackpackRecipe(items.apiaristBackpack, "stickWood", beeBlocks.apicultureChest);
|
||||
@@ -535,7 +534,7 @@ public class PluginStorage extends ForestryPlugin {
|
||||
addBackpackRecipe(items.builderBackpack, Items.clay_ball);
|
||||
|
||||
// / CARPENTER
|
||||
if (PluginManager.Module.FACTORY.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FACTORY)) {
|
||||
// / CRATES
|
||||
RecipeManagers.carpenterManager.addRecipe(20, Fluids.WATER.getFluid(1000), null, items.crate.getItemStack(24),
|
||||
" # ", "# #", " # ", '#', "logWood");
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -34,13 +35,13 @@ import forestry.core.utils.ModUtil;
|
||||
import forestry.farming.logic.FarmableBasicFruit;
|
||||
import forestry.farming.logic.FarmableGenericCrop;
|
||||
import forestry.farming.logic.FarmableGenericSapling;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.Plugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import forestry.plugins.PluginCore;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
@Plugin(pluginID = "BiomesOPlenty", name = "BiomesOPlenty", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.plugin.biomesoplenty.description")
|
||||
public class PluginBiomesOPlenty extends ForestryPlugin {
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.BIOMES_O_PLENTY, name = "BiomesOPlenty", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.plugin.biomesoplenty.description")
|
||||
public class PluginBiomesOPlenty extends BlankForestryPlugin {
|
||||
|
||||
private static final String BoP = "BiomesOPlenty";
|
||||
|
||||
@@ -72,20 +73,20 @@ public class PluginBiomesOPlenty extends ForestryPlugin {
|
||||
persimmon = new ItemStack(food, 1, 8);
|
||||
}
|
||||
|
||||
if (PluginManager.Module.APICULTURE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) {
|
||||
addFlowers();
|
||||
}
|
||||
if (PluginManager.Module.FARMING.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING)) {
|
||||
addFarmCrops();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
public void registerRecipes() {
|
||||
super.registerRecipes();
|
||||
|
||||
amount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
|
||||
if (PluginManager.Module.FACTORY.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FACTORY)) {
|
||||
addFermenterRecipes();
|
||||
addSqueezerRecipes();
|
||||
}
|
||||
@@ -107,17 +108,17 @@ public class PluginBiomesOPlenty extends ForestryPlugin {
|
||||
FMLInterModComms.sendMessage(Constants.MOD, "add-farmable-sapling", String.format("farmArboreal@%s.-1", saplingName));
|
||||
}
|
||||
|
||||
if (PluginManager.Module.FARMING.isEnabled() && saplings != null && persimmon != null) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && saplings != null && persimmon != null) {
|
||||
Farmables.farmables.get("farmArboreal").add(new FarmableGenericSapling(saplings, 15, persimmon));
|
||||
}
|
||||
|
||||
Block boPTurnip = GameRegistry.findBlock(BoP, "turnip");
|
||||
if (PluginManager.Module.FARMING.isEnabled() && boPTurnip != null) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && boPTurnip != null) {
|
||||
Item boPTurnipSeeds = GameRegistry.findItem(BoP, "turnipSeeds");
|
||||
ItemStack boPTurnipSeedStack = new ItemStack(boPTurnipSeeds, 1, 0);
|
||||
if (boPTurnipSeeds != null) {
|
||||
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(boPTurnipSeedStack, boPTurnip, 7));
|
||||
if (PluginManager.Module.FACTORY.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FACTORY)) {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{boPTurnipSeedStack}, Fluids.SEEDOIL.getFluid(amount));
|
||||
}
|
||||
}
|
||||
@@ -204,7 +205,7 @@ public class PluginBiomesOPlenty extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerBackpackItems() {
|
||||
public void registerBackpackItems() {
|
||||
// most blocks are covered by the oreDictionary
|
||||
|
||||
final int MINER = 0;
|
||||
|
||||
@@ -11,21 +11,22 @@
|
||||
package forestry.plugins.compat;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.utils.ModUtil;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import forestry.plugins.Plugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
|
||||
import buildcraft.api.fuels.BuildcraftFuelRegistry;
|
||||
import buildcraft.api.fuels.ICoolant;
|
||||
import buildcraft.api.fuels.ICoolantManager;
|
||||
|
||||
@Plugin(pluginID = "BC6|Fuels", name = "BuildCraft 6 Fuels", author = "mezz", url = Constants.URL, unlocalizedDescription = "for.plugin.buildcraft6.description")
|
||||
public class PluginBuildCraftFuels extends ForestryPlugin {
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.BUILDCRAFT_FUELS, name = "BuildCraft 6 Fuels", author = "mezz", url = Constants.URL, unlocalizedDescription = "for.plugin.buildcraft6.description")
|
||||
public class PluginBuildCraftFuels extends BlankForestryPlugin {
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
|
||||
@@ -10,17 +10,19 @@
|
||||
******************************************************************************/
|
||||
package forestry.plugins.compat;
|
||||
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.utils.ModUtil;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.Plugin;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
|
||||
import buildcraft.api.recipes.BuildcraftRecipeRegistry;
|
||||
|
||||
@Plugin(pluginID = "BC6|Recipes", name = "BuildCraft 6 Recipes", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.buildcraft6.description")
|
||||
public class PluginBuildCraftRecipes extends ForestryPlugin {
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.BUILDCRAFT_RECIPES, name = "BuildCraft 6 Recipes", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.buildcraft6.description")
|
||||
public class PluginBuildCraftRecipes extends BlankForestryPlugin {
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
@@ -34,7 +36,7 @@ public class PluginBuildCraftRecipes extends ForestryPlugin {
|
||||
|
||||
@Optional.Method(modid = "BuildCraftAPI|recipes")
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
public void registerRecipes() {
|
||||
// Add recipe for ethanol
|
||||
BuildcraftRecipeRegistry.refinery.addRecipe("forestry:BiomassToEthanol", Fluids.BIOMASS.getFluid(4), Fluids.ETHANOL.getFluid(1), 100, 1);
|
||||
}
|
||||
|
||||
@@ -14,11 +14,14 @@ import java.util.Collection;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.ModUtil;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.Plugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
@@ -26,9 +29,9 @@ import buildcraft.api.statements.ITriggerInternal;
|
||||
import buildcraft.api.statements.ITriggerProvider;
|
||||
import buildcraft.api.statements.StatementManager;
|
||||
|
||||
@Plugin(pluginID = "BC6|Statements", name = "BuildCraft 6 Statements", author = "mezz", url = Constants.URL, unlocalizedDescription = "for.plugin.buildcraft6.description")
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.BUILDCRAFT_STATEMENTS, name = "BuildCraft 6 Statements", author = "mezz", url = Constants.URL, unlocalizedDescription = "for.plugin.buildcraft6.description")
|
||||
@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = "BuildCraftAPI|statements")
|
||||
public class PluginBuildCraftStatements extends ForestryPlugin implements ITriggerProvider {
|
||||
public class PluginBuildCraftStatements extends BlankForestryPlugin implements ITriggerProvider {
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
|
||||
@@ -12,17 +12,20 @@ package forestry.plugins.compat;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.ModUtil;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.Plugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import forestry.plugins.PluginCore;
|
||||
|
||||
@Plugin(pluginID = "BC6|Transport", name = "BuildCraft 6 Transport", author = "mezz", url = Constants.URL, unlocalizedDescription = "for.plugin.buildcraft6.description")
|
||||
public class PluginBuildCraftTransport extends ForestryPlugin {
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.BUILDCRAFT_TRANSPORT, name = "BuildCraft 6 Transport", author = "mezz", url = Constants.URL, unlocalizedDescription = "for.plugin.buildcraft6.description")
|
||||
public class PluginBuildCraftTransport extends BlankForestryPlugin {
|
||||
|
||||
private static final String BCT = "BuildCraft|Transport";
|
||||
|
||||
@@ -37,7 +40,7 @@ public class PluginBuildCraftTransport extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
public void registerRecipes() {
|
||||
Item beeswax = PluginCore.items.beeswax;
|
||||
Item pipeWaterproof = GameRegistry.findItem(BCT, "pipeWaterproof");
|
||||
if (pipeWaterproof != null) {
|
||||
|
||||
@@ -12,14 +12,16 @@ package forestry.plugins.compat;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.ModUtil;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.Plugin;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
|
||||
@Plugin(pluginID = "Chisel", name = "Chisel", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.plugin.chisel.description")
|
||||
public class PluginChisel extends ForestryPlugin {
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.ModUtil;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.CHISEL, name = "Chisel", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.plugin.chisel.description")
|
||||
public class PluginChisel extends BlankForestryPlugin {
|
||||
|
||||
private static final String Chisel = "chisel";
|
||||
|
||||
@@ -34,7 +36,7 @@ public class PluginChisel extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
public void registerRecipes() {
|
||||
|
||||
ImmutableList<String> worldgenBlocks = ImmutableList.of(
|
||||
"granite",
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -34,13 +35,13 @@ import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.ModUtil;
|
||||
import forestry.farming.logic.FarmableGenericCrop;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.Plugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import forestry.plugins.PluginCore;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
@Plugin(pluginID = "Natura", name = "Natura", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.natura.description")
|
||||
public class PluginNatura extends ForestryPlugin {
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.NATURA, name = "Natura", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.natura.description")
|
||||
public class PluginNatura extends BlankForestryPlugin {
|
||||
|
||||
private static final String NATURA = "Natura";
|
||||
|
||||
@@ -115,7 +116,7 @@ public class PluginNatura extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerCrates() {
|
||||
public void registerCrates() {
|
||||
super.registerCrates();
|
||||
|
||||
ICrateRegistry crateRegistry = StorageManager.crateRegistry;
|
||||
@@ -202,7 +203,7 @@ public class PluginNatura extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
public void registerRecipes() {
|
||||
Item seed = GameRegistry.findItem(NATURA, "barley.seed");
|
||||
ItemStack seedBarley = new ItemStack(seed, 1, 0);
|
||||
ItemStack seedCotton = new ItemStack(seed, 1, 1);
|
||||
@@ -221,7 +222,7 @@ public class PluginNatura extends ForestryPlugin {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{aSeedList}, Fluids.SEEDOIL.getFluid(amount));
|
||||
}
|
||||
|
||||
if(PluginManager.Module.FARMING.isEnabled()){
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING)) {
|
||||
Block cropBlock = GameRegistry.findBlock(NATURA, "N Crops");
|
||||
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(seedBarley, cropBlock, 3));
|
||||
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(seedCotton, cropBlock, 8));
|
||||
|
||||
@@ -13,6 +13,7 @@ package forestry.storage.items;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
import forestry.api.storage.BackpackManager;
|
||||
@@ -20,7 +21,7 @@ import forestry.api.storage.EnumBackpackType;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.core.items.ItemCrated;
|
||||
import forestry.core.items.ItemRegistry;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
|
||||
public class ItemRegistryStorage extends ItemRegistry {
|
||||
public final ItemCrated crate;
|
||||
@@ -46,7 +47,7 @@ public class ItemRegistryStorage extends ItemRegistry {
|
||||
// BACKPACKS
|
||||
IBackpackDefinition definition;
|
||||
|
||||
if (PluginManager.Module.APICULTURE.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) {
|
||||
definition = BackpackManager.definitions.get("apiarist");
|
||||
apiaristBackpack = new ItemBackpackNaturalist(BeeManager.beeRoot, definition, EnumBackpackType.APIARIST);
|
||||
apiaristBackpack.setCreativeTab(Tabs.tabApiculture);
|
||||
@@ -55,7 +56,7 @@ public class ItemRegistryStorage extends ItemRegistry {
|
||||
apiaristBackpack = null;
|
||||
}
|
||||
|
||||
if (PluginManager.Module.LEPIDOPTEROLOGY.isEnabled()) {
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.LEPIDOPTEROLOGY)) {
|
||||
definition = BackpackManager.definitions.get("lepidopterist");
|
||||
lepidopteristBackpack = new ItemBackpackNaturalist(ButterflyManager.butterflyRoot, definition, EnumBackpackType.APIARIST);
|
||||
lepidopteristBackpack.setCreativeTab(Tabs.tabLepidopterology);
|
||||
|
||||
Reference in new issue
Block a user