mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-22 04:52:26 +00:00
General clean up and improvement of internal plugin system
This commit is contained in:
1 parent
3ad5bdd598
commit
7cc3668a70
26 files changed
+593
-762
No files matched your search
@@ -38,6 +38,7 @@ import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.FluidMap;
|
||||
import forestry.core.utils.ItemStackMap;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import java.io.File;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
@@ -60,6 +61,7 @@ public class Forestry {
|
||||
|
||||
@Mod.Instance(Defaults.MOD)
|
||||
public static Forestry instance;
|
||||
private File configFolder;
|
||||
|
||||
public Forestry() {
|
||||
FuelManager.fermenterFuel = new ItemStackMap<FermenterFuel>();
|
||||
@@ -67,7 +69,7 @@ public class Forestry {
|
||||
FuelManager.rainSubstrate = new ItemStackMap<RainSubstrate>();
|
||||
FuelManager.bronzeEngineFuel = new FluidMap<EngineBronzeFuel>();
|
||||
FuelManager.copperEngineFuel = new ItemStackMap<EngineCopperFuel>();
|
||||
FuelManager.generatorFuel = new FluidMap<GeneratorFuel>();
|
||||
FuelManager.generatorFuel = new FluidMap<GeneratorFuel>();
|
||||
}
|
||||
@SidedProxy(clientSide = "forestry.core.ForestryClient", serverSide = "forestry.core.ForestryCore")
|
||||
public static ForestryCore core = new ForestryCore();
|
||||
@@ -76,6 +78,8 @@ public class Forestry {
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
packetHandler = new PacketHandler();
|
||||
|
||||
configFolder = new File(event.getModConfigurationDirectory(), "forestry");
|
||||
|
||||
core.preInit(event.getSourceFile(), this);
|
||||
}
|
||||
@@ -95,6 +99,9 @@ public class Forestry {
|
||||
core.serverStarting(event.getServer());
|
||||
}
|
||||
|
||||
public File getConfigFolder() {
|
||||
return configFolder;
|
||||
}
|
||||
/*@EventHandler
|
||||
public void fingerprintWarning(FMLFingerprintViolationEvent event) {
|
||||
Proxies.log.info("Fingerprint of the mod jar is invalid. The jar file was tampered with.");
|
||||
@@ -102,6 +109,7 @@ public class Forestry {
|
||||
FMLInterModComms.sendMessage("Thaumcraft", "securityViolation", "Fingerprint of jar file did not match.");
|
||||
FMLInterModComms.sendMessage("IC2", "securityViolation", "Fingerprint of jar file did not match.");
|
||||
}*/
|
||||
|
||||
@EventHandler
|
||||
public void processIMCMessages(IMCEvent event) {
|
||||
core.processIMCMessages(event.getMessages());
|
||||
|
||||
@@ -19,11 +19,11 @@ import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.api.core.IPlugin;
|
||||
import forestry.api.core.PluginInfo;
|
||||
import forestry.plugins.Plugin;
|
||||
import forestry.core.config.Version;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.CommandMC;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
public class CommandForestry extends CommandMC {
|
||||
@@ -96,10 +96,10 @@ public class CommandForestry extends CommandMC {
|
||||
|
||||
String pluginList = "";
|
||||
|
||||
for (IPlugin plugin : PluginManager.plugins) {
|
||||
for (PluginManager.Module pluginModule : PluginManager.getLoadedModules()) {
|
||||
if (!pluginList.isEmpty())
|
||||
pluginList += ", ";
|
||||
pluginList += makeListEntry(plugin);
|
||||
pluginList += makeListEntry(pluginModule.instance());
|
||||
}
|
||||
|
||||
sendChatMessage(sender, pluginList);
|
||||
@@ -110,14 +110,14 @@ public class CommandForestry extends CommandMC {
|
||||
if (arguments.length < 3)
|
||||
throw new WrongUsageException("/" + getCommandName() + " plugins info <plugin-name>");
|
||||
|
||||
IPlugin found = null;
|
||||
for (IPlugin plugin : PluginManager.plugins) {
|
||||
PluginInfo info = plugin.getClass().getAnnotation(PluginInfo.class);
|
||||
ForestryPlugin found = null;
|
||||
for (PluginManager.Module pluginModule : PluginManager.getLoadedModules()) {
|
||||
Plugin info = pluginModule.instance().getClass().getAnnotation(Plugin.class);
|
||||
if (info == null)
|
||||
continue;
|
||||
|
||||
if ((info.pluginID().equalsIgnoreCase(arguments[2]) || info.name().equalsIgnoreCase(arguments[2]))) {
|
||||
found = plugin;
|
||||
found = pluginModule.instance();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ public class CommandForestry extends CommandMC {
|
||||
String entry = "\u00A7c";
|
||||
if (found.isAvailable())
|
||||
entry = "\u00A7a";
|
||||
PluginInfo info = found.getClass().getAnnotation(PluginInfo.class);
|
||||
Plugin info = found.getClass().getAnnotation(Plugin.class);
|
||||
if (info != null) {
|
||||
sendChatMessage(sender, entry + "Plugin: " + info.name());
|
||||
if (!info.version().isEmpty())
|
||||
@@ -143,12 +143,12 @@ public class CommandForestry extends CommandMC {
|
||||
|
||||
}
|
||||
|
||||
private String makeListEntry(IPlugin plugin) {
|
||||
private String makeListEntry(ForestryPlugin plugin) {
|
||||
String entry = "\u00A7c";
|
||||
if (plugin.isAvailable())
|
||||
entry = "\u00A7a";
|
||||
|
||||
PluginInfo info = plugin.getClass().getAnnotation(PluginInfo.class);
|
||||
Plugin info = plugin.getClass().getAnnotation(Plugin.class);
|
||||
if (info != null) {
|
||||
entry += info.pluginID();
|
||||
if (!info.version().isEmpty())
|
||||
|
||||
@@ -12,8 +12,6 @@ package forestry.core;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.command.CommandHandler;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -30,7 +28,6 @@ import com.google.common.collect.ImmutableList;
|
||||
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IPlugin;
|
||||
import forestry.api.fuels.EngineBronzeFuel;
|
||||
import forestry.api.fuels.EngineCopperFuel;
|
||||
import forestry.api.fuels.FermenterFuel;
|
||||
@@ -46,8 +43,6 @@ import forestry.core.gadgets.TileMachine;
|
||||
import forestry.core.gadgets.TileMill;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.plugins.NativePlugin;
|
||||
import forestry.plugins.PluginCore;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
public class ForestryCore {
|
||||
@@ -56,8 +51,6 @@ public class ForestryCore {
|
||||
ForestryAPI.instance = basemod;
|
||||
ForestryAPI.forestryConstants = new ForestryConstants();
|
||||
|
||||
PluginManager.loadForestryPlugins();
|
||||
|
||||
// Register event handler
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandlerCore());
|
||||
|
||||
@@ -115,9 +108,8 @@ public class ForestryCore {
|
||||
FuelManager.rainSubstrate.put(ForestryItem.craftingMaterial.getItemStack(1, 4), new RainSubstrate(ForestryItem.craftingMaterial.getItemStack(1, 4), 0.075f));
|
||||
|
||||
// Set additional apiary flowers
|
||||
for (int i=0; i<9; i++) {
|
||||
for (int i = 0; i < 9; i++)
|
||||
FlowerManager.plainFlowers.add(new ItemStack(Blocks.red_flower, 1, i));
|
||||
}
|
||||
FlowerManager.plainFlowers.add(new ItemStack(Blocks.yellow_flower));
|
||||
|
||||
// Register gui handler
|
||||
@@ -128,7 +120,7 @@ public class ForestryCore {
|
||||
GameRegistry.registerTileEntity(TileEngine.class, "forestry.Engine");
|
||||
GameRegistry.registerTileEntity(TileMachine.class, "forestry.Machine");
|
||||
|
||||
PluginManager.runInit();
|
||||
PluginManager.runInit();
|
||||
}
|
||||
|
||||
public void postInit() {
|
||||
@@ -142,29 +134,11 @@ public class ForestryCore {
|
||||
}
|
||||
|
||||
public void serverStarting(MinecraftServer server) {
|
||||
CommandHandler commandManager = (CommandHandler) server.getCommandManager();
|
||||
for (IPlugin plugin : PluginManager.plugins) {
|
||||
if (plugin.isAvailable() && plugin instanceof NativePlugin) {
|
||||
ICommand[] commands = ((NativePlugin) plugin).getConsoleCommands();
|
||||
if (commands == null)
|
||||
continue;
|
||||
for (ICommand command : commands) {
|
||||
commandManager.registerCommand(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
PluginManager.serverStarting(server);
|
||||
}
|
||||
|
||||
public void processIMCMessages(ImmutableList<IMCMessage> messages) {
|
||||
for (IMCMessage message : messages) {
|
||||
for (IPlugin plugin : PluginManager.plugins) {
|
||||
if (!(plugin instanceof NativePlugin))
|
||||
continue;
|
||||
|
||||
if (((NativePlugin) plugin).processIMCMessage(message))
|
||||
break;
|
||||
}
|
||||
}
|
||||
PluginManager.processIMCMessages(messages);
|
||||
}
|
||||
|
||||
public String getPriorities() {
|
||||
|
||||
@@ -17,12 +17,11 @@ import net.minecraft.world.chunk.IChunkProvider;
|
||||
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
|
||||
import forestry.api.core.IPlugin;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.worldgen.WorldGenMinableMeta;
|
||||
import forestry.plugins.NativePlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
public class WorldGenerator implements IWorldGenerator {
|
||||
@@ -73,9 +72,7 @@ public class WorldGenerator implements IWorldGenerator {
|
||||
}
|
||||
|
||||
// / PLUGIN WORLD GENERATION
|
||||
for (IPlugin plugin : PluginManager.plugins)
|
||||
if (plugin.isAvailable() && plugin instanceof NativePlugin)
|
||||
((NativePlugin) plugin).generateSurface(world, random, chunkX, chunkZ);
|
||||
PluginManager.generateSurface(world, random, chunkX, chunkZ);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,17 +42,6 @@ public class Config {
|
||||
|
||||
public static boolean isDebug = false;
|
||||
|
||||
// Native Plugins
|
||||
public static boolean disableApiculture = false;
|
||||
public static boolean disableArboriculture = false;
|
||||
public static boolean disableCultivation = false;
|
||||
public static boolean disableEnergy = false;
|
||||
public static boolean disableFactory = false;
|
||||
public static boolean disableFarming = false;
|
||||
public static boolean disableFood = false;
|
||||
public static boolean disableMail = false;
|
||||
public static boolean disableStorage = false;
|
||||
|
||||
public static boolean disablePermissions = false;
|
||||
public static boolean disableNags = false;
|
||||
public static boolean disableVersionCheck = false;
|
||||
|
||||
@@ -12,19 +12,12 @@ package forestry.core.proxy;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import forestry.core.config.Defaults;
|
||||
import org.apache.logging.log4j.message.MessageFormatMessage;
|
||||
|
||||
public class ProxyLog {
|
||||
|
||||
/* LOGGING */
|
||||
private static Logger forestryLogger;
|
||||
|
||||
private void initLogger() {
|
||||
forestryLogger = LogManager.getLogger(Defaults.MOD);
|
||||
}
|
||||
|
||||
/* FINEST */
|
||||
public void finest(String message) {
|
||||
log(Level.TRACE, message);
|
||||
@@ -104,19 +97,8 @@ public class ProxyLog {
|
||||
}
|
||||
|
||||
/* GENERIC */
|
||||
public void log(Level logLevel, String message) {
|
||||
if (forestryLogger == null)
|
||||
initLogger();
|
||||
|
||||
forestryLogger.log(logLevel, message);
|
||||
}
|
||||
|
||||
public void log(Level logLevel, String message, Object... params) {
|
||||
log(logLevel, String.format(message, params));
|
||||
}
|
||||
|
||||
public void log(Level logLevel, String message, Object param) {
|
||||
log(logLevel, String.format(message, param));
|
||||
LogManager.getLogger(Defaults.MOD).log(logLevel, new MessageFormatMessage(String.format(message, params), params));
|
||||
}
|
||||
|
||||
}
|
||||
+41
-16
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.plugins;
|
||||
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.command.ICommand;
|
||||
@@ -18,29 +19,37 @@ import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
import forestry.api.core.IPlugin;
|
||||
import forestry.core.interfaces.IOreDictionaryHandler;
|
||||
import forestry.core.interfaces.IPacketHandler;
|
||||
import forestry.core.interfaces.IPickupHandler;
|
||||
import forestry.core.interfaces.IResupplyHandler;
|
||||
import forestry.core.interfaces.ISaveEventHandler;
|
||||
import java.util.EnumSet;
|
||||
|
||||
public abstract class NativePlugin implements IPlugin {
|
||||
public abstract class ForestryPlugin {
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
registerItems();
|
||||
public boolean isAvailable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doInit() {
|
||||
registerBackpackItems();
|
||||
registerCrates();
|
||||
public String getFailMessage() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
registerRecipes();
|
||||
public EnumSet<PluginManager.Module> getDependancies() {
|
||||
return EnumSet.of(PluginManager.Module.CORE);
|
||||
}
|
||||
|
||||
protected void preInit() {
|
||||
}
|
||||
|
||||
protected void doInit() {
|
||||
}
|
||||
|
||||
protected void postInit() {
|
||||
}
|
||||
|
||||
protected void disabledInit() {
|
||||
}
|
||||
|
||||
public boolean processIMCMessage(IMCMessage message) {
|
||||
@@ -77,13 +86,29 @@ public abstract class NativePlugin implements IPlugin {
|
||||
public ICommand[] getConsoleCommands() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public IFuelHandler getFuelHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected abstract void registerItems();
|
||||
protected void registerItems() {
|
||||
}
|
||||
|
||||
protected abstract void registerBackpackItems();
|
||||
protected void registerBackpackItems() {
|
||||
}
|
||||
|
||||
protected abstract void registerCrates();
|
||||
protected void registerCrates() {
|
||||
}
|
||||
|
||||
protected abstract void registerRecipes();
|
||||
protected void registerRecipes() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
Plugin info = getClass().getAnnotation(Plugin.class);
|
||||
if (info == null)
|
||||
return getClass().getSimpleName();
|
||||
return info.name() + " Plugin";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*******************************************************************************
|
||||
* 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 Short description what the plugin does.
|
||||
*/
|
||||
String description() default "";
|
||||
|
||||
/**
|
||||
* @return Not used (yet?).
|
||||
*/
|
||||
String help() default "";
|
||||
|
||||
}
|
||||
@@ -52,7 +52,6 @@ import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.PluginInfo;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
@@ -152,8 +151,8 @@ import forestry.core.triggers.Trigger;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
|
||||
@PluginInfo(pluginID = "Apiculture", name = "Apiculture", author = "SirSengir", url = Defaults.URL, description = "Adds bees, beekeeping and bee products. Affects world generation.")
|
||||
public class PluginApiculture extends NativePlugin {
|
||||
@Plugin(pluginID = "Apiculture", name = "Apiculture", author = "SirSengir", url = Defaults.URL, description = "Adds bees, beekeeping and bee products. Affects world generation.")
|
||||
public class PluginApiculture extends ForestryPlugin {
|
||||
|
||||
@SidedProxy(clientSide = "forestry.apiculture.proxy.ClientProxyApiculture", serverSide = "forestry.apiculture.proxy.ProxyApiculture")
|
||||
public static ProxyApiculture proxy;
|
||||
@@ -180,11 +179,6 @@ public class PluginApiculture extends NativePlugin {
|
||||
public static MachineDefinition definitionChest;
|
||||
public static MachineDefinition definitionBeehouse;
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return !Config.disableApiculture;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void preInit() {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.plugins;
|
||||
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,7 +26,6 @@ import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
@@ -36,7 +36,6 @@ import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.ITreeRoot;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.PluginInfo;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
@@ -126,7 +125,6 @@ import forestry.arboriculture.worldgen.WorldGenWalnut;
|
||||
import forestry.arboriculture.worldgen.WorldGenWenge;
|
||||
import forestry.arboriculture.worldgen.WorldGenWillow;
|
||||
import forestry.core.GameMode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
@@ -134,9 +132,7 @@ import forestry.core.gadgets.BlockBase;
|
||||
import forestry.core.gadgets.MachineDefinition;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.FruitFamily;
|
||||
import forestry.core.interfaces.IOreDictionaryHandler;
|
||||
import forestry.core.interfaces.IPacketHandler;
|
||||
import forestry.core.interfaces.ISaveEventHandler;
|
||||
import forestry.core.items.ItemForestryBlock;
|
||||
import forestry.core.items.ItemFruit.EnumFruit;
|
||||
import forestry.core.proxy.Proxies;
|
||||
@@ -145,8 +141,8 @@ import forestry.core.utils.RecipeUtil;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
import java.util.EnumSet;
|
||||
|
||||
@PluginInfo(pluginID = "Arboriculture", name = "Arboriculture", author = "Binnie & SirSengir", url = Defaults.URL, description = "Adds additional tree species and products.")
|
||||
public class PluginArboriculture extends NativePlugin implements IFuelHandler {
|
||||
@Plugin(pluginID = "Arboriculture", name = "Arboriculture", author = "Binnie & SirSengir", url = Defaults.URL, description = "Adds additional tree species and products.")
|
||||
public class PluginArboriculture extends ForestryPlugin {
|
||||
|
||||
@SidedProxy(clientSide = "forestry.arboriculture.proxy.ClientProxyArboriculture", serverSide = "forestry.arboriculture.proxy.ProxyArboriculture")
|
||||
public static ProxyArboriculture proxy;
|
||||
@@ -177,11 +173,6 @@ public class PluginArboriculture extends NativePlugin implements IFuelHandler {
|
||||
ForestryBlock.fences1,
|
||||
ForestryBlock.fences1);
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return !Config.disableArboriculture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
super.preInit();
|
||||
@@ -958,16 +949,6 @@ public class PluginArboriculture extends NativePlugin implements IFuelHandler {
|
||||
return new GuiHandlerArboriculture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISaveEventHandler getSaveEventHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOreDictionaryHandler getDictionaryHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICommand[] getConsoleCommands() {
|
||||
return new ICommand[]{new CommandSpawnTree(), new CommandSpawnForest(),
|
||||
@@ -975,11 +956,16 @@ public class PluginArboriculture extends NativePlugin implements IFuelHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBurnTime(ItemStack fuel) {
|
||||
if (ForestryItem.sapling.isItemEqual(fuel))
|
||||
return 100;
|
||||
public IFuelHandler getFuelHandler() {
|
||||
return new IFuelHandler() {
|
||||
@Override
|
||||
public int getBurnTime(ItemStack fuel) {
|
||||
if (ForestryItem.sapling.isItemEqual(fuel))
|
||||
return 100;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,8 +31,6 @@ import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import buildcraft.api.recipes.BuildcraftRecipes;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
|
||||
import forestry.api.core.IPlugin;
|
||||
import forestry.api.core.PluginInfo;
|
||||
import forestry.core.GameMode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Configuration;
|
||||
@@ -43,8 +41,8 @@ import forestry.core.gadgets.TileForestry;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
|
||||
@PluginInfo(pluginID = "BC6", name = "BuildCraft 6", author = "SirSengir", url = Defaults.URL, description = "Compatibility plugin for BuildCraft 6.")
|
||||
public class PluginBuildCraft implements IPlugin, ITriggerProvider {
|
||||
@Plugin(pluginID = "BC6", name = "BuildCraft 6", author = "SirSengir", url = Defaults.URL, description = "Compatibility plugin for BuildCraft 6.")
|
||||
public class PluginBuildCraft extends ForestryPlugin implements ITriggerProvider {
|
||||
|
||||
public static PluginBuildCraft instance;
|
||||
public static Configuration config;
|
||||
@@ -68,6 +66,11 @@ public class PluginBuildCraft implements IPlugin, ITriggerProvider {
|
||||
return (Proxies.common.isModLoaded("BuildCraft|Core", validVersionRange) && Proxies.common.isModLoaded("BuildCraft|Transport", validVersionRange));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFailMessage() {
|
||||
return "Compatible Buildcraft version not found";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doInit() {
|
||||
config = Config.config;
|
||||
@@ -92,10 +95,6 @@ public class PluginBuildCraft implements IPlugin, ITriggerProvider {
|
||||
initLiquids();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
}
|
||||
|
||||
private void initLiquids() {
|
||||
LiquidHelper.injectWaxContainer(Defaults.LIQUID_OIL, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleOil.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
LiquidHelper.injectWaxContainer(Defaults.LIQUID_FUEL, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleFuel.getItemStack(), ForestryItem.waxCapsule.getItemStack());
|
||||
@@ -156,8 +155,4 @@ public class PluginBuildCraft implements IPlugin, ITriggerProvider {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
}
|
||||
}
|
||||
@@ -23,14 +23,12 @@ import net.minecraft.item.crafting.IRecipe;
|
||||
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.core.PluginInfo;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.core.CommandForestry;
|
||||
@@ -56,7 +54,6 @@ import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.AlleleRegistry;
|
||||
import forestry.core.genetics.ClimateHelper;
|
||||
import forestry.core.genetics.ItemResearchNote;
|
||||
import forestry.core.interfaces.IOreDictionaryHandler;
|
||||
import forestry.core.interfaces.IPickupHandler;
|
||||
import forestry.core.interfaces.ISaveEventHandler;
|
||||
import forestry.core.items.ItemArmorNaturalist;
|
||||
@@ -80,8 +77,8 @@ import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.ForestryModEnvWarningCallable;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
|
||||
@PluginInfo(pluginID = "Core", name = "Core", author = "SirSengir", url = Defaults.URL, description = "Core mechanics for Forestry. Required by all other plugins.")
|
||||
public class PluginCore extends NativePlugin implements IFuelHandler {
|
||||
@Plugin(pluginID = "Core", name = "Core", author = "SirSengir", url = Defaults.URL, description = "Core mechanics for Forestry. Required by all other plugins.")
|
||||
public class PluginCore extends ForestryPlugin {
|
||||
|
||||
public static MachineDefinition definitionAnalyzer;
|
||||
public static MachineDefinition definitionEscritoire;
|
||||
@@ -130,9 +127,6 @@ public class PluginCore extends NativePlugin implements IFuelHandler {
|
||||
/* SMELTING RECIPES */
|
||||
FurnaceRecipes.smelting().func_151394_a(ForestryBlock.resources.getItemStack(1, 1), ForestryItem.ingotCopper.getItemStack(), 0.5f);
|
||||
FurnaceRecipes.smelting().func_151394_a(ForestryBlock.resources.getItemStack(1, 2), ForestryItem.ingotTin.getItemStack(), 0.5f);
|
||||
|
||||
GameRegistry.registerFuelHandler(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -448,11 +442,6 @@ public class PluginCore extends NativePlugin implements IFuelHandler {
|
||||
Proxies.common.addRecipe(ForestryItem.pipette.getItemStack(), " #", " X ", "X ", 'X', Blocks.glass_pane, '#', new ItemStack(Blocks.wool, 1, Defaults.WILDCARD));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOreDictionaryHandler getDictionaryHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPickupHandler getPickupHandler() {
|
||||
return new PickupHandlerCore();
|
||||
@@ -464,13 +453,19 @@ public class PluginCore extends NativePlugin implements IFuelHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBurnTime(ItemStack fuel) {
|
||||
if (fuel != null && fuel.getItem() == ForestryItem.peat.item())
|
||||
return 2000;
|
||||
if (fuel != null && fuel.getItem() == ForestryItem.bituminousPeat.item())
|
||||
return 4200;
|
||||
public IFuelHandler getFuelHandler() {
|
||||
return new IFuelHandler() {
|
||||
|
||||
return 0;
|
||||
@Override
|
||||
public int getBurnTime(ItemStack fuel) {
|
||||
if (fuel != null && fuel.getItem() == ForestryItem.peat.item())
|
||||
return 2000;
|
||||
if (fuel != null && fuel.getItem() == ForestryItem.bituminousPeat.item())
|
||||
return 4200;
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public IRecipe[] createAlyzerRecipes(Block block, int meta) {
|
||||
|
||||
@@ -17,8 +17,6 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
import forestry.api.core.IPlugin;
|
||||
import forestry.api.core.PluginInfo;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.apiculture.genetics.AlleleBeeSpecies;
|
||||
@@ -26,13 +24,12 @@ import forestry.apiculture.genetics.BeeTemplates;
|
||||
import forestry.apiculture.genetics.IJubilanceProvider;
|
||||
import forestry.apiculture.genetics.JubilanceReqRes;
|
||||
import forestry.apiculture.genetics.MutationEMC;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
@PluginInfo(pluginID = "EqEx2", name = "Equivalent Exchange 2", author = "SirSengir", url = Defaults.URL, description = "Compatibility plugin for Equivalent Exchange 2. Enables the Omega branch of bees. Requires Apiculture to be enabled.")
|
||||
public class PluginEE implements IPlugin {
|
||||
@Plugin(pluginID = "EqEx2", name = "Equivalent Exchange 2", author = "SirSengir", url = Defaults.URL, description = "Compatibility plugin for Equivalent Exchange 2. Enables the Omega branch of bees. Requires Apiculture to be enabled.")
|
||||
public class PluginEE extends ForestryPlugin {
|
||||
|
||||
public IMutation darkenedA;
|
||||
public IMutation reddenedA;
|
||||
@@ -48,7 +45,12 @@ public class PluginEE implements IPlugin {
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return Proxies.common.isModLoaded("mod_EE") && !Config.disableApiculture;
|
||||
return Proxies.common.isModLoaded("mod_EE");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFailMessage() {
|
||||
return "Equivalent Exchange not found";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,13 +85,4 @@ public class PluginEE implements IPlugin {
|
||||
eeRelay3EMCField, 933888).restrictBiomeType(BiomeDictionary.Type.NETHER).restrictBiomeType(BiomeDictionary.Type.SANDY);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.core.PluginInfo;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.fuels.GeneratorFuel;
|
||||
import forestry.core.GameMode;
|
||||
@@ -52,8 +51,8 @@ import forestry.energy.gadgets.EngineTin;
|
||||
import forestry.energy.gadgets.MachineGenerator;
|
||||
import forestry.energy.proxy.ProxyEnergy;
|
||||
|
||||
@PluginInfo(pluginID = "Energy", name = "Energy", author = "SirSengir", url = Defaults.URL, description = "Adds several engines compatible with BuildCraft 3 as well as a generator for IC2.")
|
||||
public class PluginEnergy extends NativePlugin {
|
||||
@Plugin(pluginID = "Energy", name = "Energy", author = "SirSengir", url = Defaults.URL, description = "Adds several engines compatible with BuildCraft 3 as well as a generator for IC2.")
|
||||
public class PluginEnergy extends ForestryPlugin {
|
||||
|
||||
@SidedProxy(clientSide = "forestry.energy.proxy.ClientProxyEnergy", serverSide = "forestry.energy.proxy.ProxyEnergy")
|
||||
public static ProxyEnergy proxy;
|
||||
@@ -63,11 +62,6 @@ public class PluginEnergy extends NativePlugin {
|
||||
public static MachineDefinition definitionEngineClockwork;
|
||||
public static MachineDefinition definitionGenerator;
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return !Config.disableEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
super.preInit();
|
||||
|
||||
@@ -19,7 +19,6 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
import forestry.api.core.PluginInfo;
|
||||
import forestry.api.recipes.ICraftingProvider;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.GameMode;
|
||||
@@ -53,8 +52,8 @@ import forestry.factory.gadgets.MillRainmaker;
|
||||
import forestry.factory.gadgets.TileWorktable;
|
||||
import forestry.factory.recipes.CraftGuideIntegration;
|
||||
|
||||
@PluginInfo(pluginID = "Factory", name = "Factory", author = "SirSengir", url = Defaults.URL, description = "Adds a wide variety of machines to craft, produce and process products.")
|
||||
public class PluginFactory extends NativePlugin {
|
||||
@Plugin(pluginID = "Factory", name = "Factory", author = "SirSengir", url = Defaults.URL, description = "Adds a wide variety of machines to craft, produce and process products.")
|
||||
public class PluginFactory extends ForestryPlugin {
|
||||
|
||||
public static MachineDefinition definitionBottler;
|
||||
public static MachineDefinition definitionCarpenter;
|
||||
@@ -68,11 +67,6 @@ public class PluginFactory extends NativePlugin {
|
||||
public static MachineDefinition definitionRaintank;
|
||||
public static MachineDefinition definitionWorktable;
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return !Config.disableFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
super.preInit();
|
||||
|
||||
@@ -18,18 +18,14 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
import forestry.api.core.PluginInfo;
|
||||
import forestry.api.farming.Farmables;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.interfaces.IOreDictionaryHandler;
|
||||
import forestry.core.interfaces.ISaveEventHandler;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.farming.logic.FarmableFarmCraftory;
|
||||
|
||||
@PluginInfo(pluginID = "FarmCraftory", name = "FarmCraftory", author = "SirSengir", url = Defaults.URL, description = "Enables compatibility with FarmCraftory. Adds crops and vegetables to farms.")
|
||||
public class PluginFarmCraftory extends NativePlugin {
|
||||
@Plugin(pluginID = "FarmCraftory", name = "FarmCraftory", author = "SirSengir", url = Defaults.URL, description = "Enables compatibility with FarmCraftory. Adds crops and vegetables to farms.")
|
||||
public class PluginFarmCraftory extends ForestryPlugin {
|
||||
|
||||
public static Block blockSingle;
|
||||
public static Block blockMulti;
|
||||
@@ -41,22 +37,27 @@ public class PluginFarmCraftory extends NativePlugin {
|
||||
public static Method methodGrowthMulti;
|
||||
|
||||
public static HashMap<String, ItemStack> vegetableSeeds = new HashMap<String, ItemStack>();
|
||||
public static final String[] seedIdentifiers = new String[] { "turnipSeedBag", "cabbageSeedBag", "onionSeedBag", "spinachSeedBag", "leekSeedBag",
|
||||
"cucumberSeedBag", "tomatoSeedBag", "eggplantSeedBag", "greenPepperSeedBag", "yamSeedBag", "strawberrySeedBag", "pineappleSeedBag" };
|
||||
public static final String[] seedIdentifiers = new String[]{"turnipSeedBag", "cabbageSeedBag", "onionSeedBag", "spinachSeedBag", "leekSeedBag",
|
||||
"cucumberSeedBag", "tomatoSeedBag", "eggplantSeedBag", "greenPepperSeedBag", "yamSeedBag", "strawberrySeedBag", "pineappleSeedBag"};
|
||||
public static HashMap<String, ItemStack> vegetableItems = new HashMap<String, ItemStack>();
|
||||
public static final String[] vegetableIdentifiers = new String[] { "turnipItem", "cabbageItem", "onionItem", "spinachItem", "leekItem", "cucumberItem",
|
||||
"tomatoItem", "eggplantItem", "greenPepperItem", "yamItem", "strawberryItem", "pineappleItem" };
|
||||
public static final String[] vegetableIdentifiers = new String[]{"turnipItem", "cabbageItem", "onionItem", "spinachItem", "leekItem", "cucumberItem",
|
||||
"tomatoItem", "eggplantItem", "greenPepperItem", "yamItem", "strawberryItem", "pineappleItem"};
|
||||
|
||||
public static HashMap<String, ItemStack> cerealSeeds = new HashMap<String, ItemStack>();
|
||||
public static final String[] cseedIdentifiers = new String[] { "cornSeedBag" };
|
||||
public static final String[] cseedIdentifiers = new String[]{"cornSeedBag"};
|
||||
public static HashMap<String, ItemStack> cerealItems = new HashMap<String, ItemStack>();
|
||||
public static final String[] cerealIdentifiers = new String[] { "cornItem" };
|
||||
public static final String[] cerealIdentifiers = new String[]{"cornItem"};
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return Proxies.common.isModLoaded("FarmCraftory");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFailMessage() {
|
||||
return "FarmCraftory not found";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doInit() {
|
||||
super.doInit();
|
||||
@@ -128,35 +129,4 @@ public class PluginFarmCraftory extends NativePlugin {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGuiHandler getGuiHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISaveEventHandler getSaveEventHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOreDictionaryHandler getDictionaryHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerItems() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerBackpackItems() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerCrates() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,7 +29,6 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.core.PluginInfo;
|
||||
import forestry.api.farming.Farmables;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.core.circuits.Circuit;
|
||||
@@ -81,8 +80,8 @@ import forestry.farming.triggers.TriggerLowFertilizer;
|
||||
import forestry.farming.triggers.TriggerLowLiquid;
|
||||
import forestry.farming.triggers.TriggerLowSoil;
|
||||
|
||||
@PluginInfo(pluginID = "Farming", name = "Farming", author = "SirSengir", url = Defaults.URL, description = "Adds automatic farms and harvesters for a wide variety of products.")
|
||||
public class PluginFarming extends NativePlugin {
|
||||
@Plugin(pluginID = "Farming", name = "Farming", author = "SirSengir", url = Defaults.URL, description = "Adds automatic farms and harvesters for a wide variety of products.")
|
||||
public class PluginFarming extends ForestryPlugin {
|
||||
|
||||
@SidedProxy(clientSide = "forestry.farming.proxy.ClientProxyFarming", serverSide = "forestry.farming.proxy.ProxyFarming")
|
||||
public static ProxyFarming proxy;
|
||||
@@ -96,11 +95,6 @@ public class PluginFarming extends NativePlugin {
|
||||
public static Trigger lowFertilizer50;
|
||||
public static Trigger lowFertilizer25;
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return !Config.disableFarming;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
super.preInit();
|
||||
|
||||
@@ -15,7 +15,6 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
import forestry.api.core.PluginInfo;
|
||||
import forestry.api.food.BeverageManager;
|
||||
import forestry.api.food.IBeverageEffect;
|
||||
import forestry.core.config.Config;
|
||||
@@ -33,13 +32,8 @@ import forestry.food.items.ItemBeverage;
|
||||
import forestry.food.items.ItemBeverage.BeverageInfo;
|
||||
import forestry.food.items.ItemInfuser;
|
||||
|
||||
@PluginInfo(pluginID = "Food", name = "Food", author = "SirSengir", url = Defaults.URL, description = "Adds food.")
|
||||
public class PluginFood extends NativePlugin {
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return !Config.disableFood;
|
||||
}
|
||||
@Plugin(pluginID = "Food", name = "Food", author = "SirSengir", url = Defaults.URL, description = "Adds food.")
|
||||
public class PluginFood extends ForestryPlugin {
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
|
||||
@@ -21,8 +21,6 @@ import ic2.api.item.IC2Items;
|
||||
import ic2.api.recipe.RecipeInputItemStack;
|
||||
import ic2.api.recipe.Recipes;
|
||||
|
||||
import forestry.api.core.IPlugin;
|
||||
import forestry.api.core.PluginInfo;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.core.GameMode;
|
||||
@@ -36,8 +34,8 @@ import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.RecipeUtil;
|
||||
import forestry.core.utils.StackUtils;
|
||||
|
||||
@PluginInfo(pluginID = "IC2", name = "IndustrialCraft2", author = "SirSengir", url = Defaults.URL, description = "Compatibility plugin for IC2.")
|
||||
public class PluginIC2 implements IPlugin {
|
||||
@Plugin(pluginID = "IC2", name = "IndustrialCraft2", author = "SirSengir", url = Defaults.URL, description = "Compatibility plugin for IC2.")
|
||||
public class PluginIC2 extends ForestryPlugin {
|
||||
|
||||
public static PluginIC2 instance;
|
||||
public static Configuration config;
|
||||
@@ -74,170 +72,155 @@ public class PluginIC2 implements IPlugin {
|
||||
return Proxies.common.isModLoaded("IC2");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFailMessage() {
|
||||
return "IndustrialCraft2 not found";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doInit() {
|
||||
config = Config.config;
|
||||
|
||||
if (!isAvailable()) return;
|
||||
initLiquidContainers();
|
||||
initRubberChain();
|
||||
initFermentation();
|
||||
|
||||
new Impl().init();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
// Remove some items from the recycler
|
||||
Recipes.recyclerBlacklist.add(new RecipeInputItemStack(ForestryItem.beeQueenGE.getItemStack()));
|
||||
Recipes.recyclerBlacklist.add(new RecipeInputItemStack(ForestryItem.beePrincessGE.getItemStack()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
protected void registerBackpackItems() {
|
||||
if (BackpackManager.backpackItems == null)
|
||||
return;
|
||||
|
||||
if (resin != null)
|
||||
BackpackManager.definitions.get("forester").addValidItem(resin);
|
||||
if (rubber != null)
|
||||
BackpackManager.definitions.get("forester").addValidItem(rubber);
|
||||
}
|
||||
|
||||
private static class Impl {
|
||||
private void init() {
|
||||
initLiquidContainers();
|
||||
initRubberChain();
|
||||
initFermentation();
|
||||
initCrates();
|
||||
@Override
|
||||
protected void registerCrates() {
|
||||
|
||||
Recipes.recyclerBlacklist.add(new RecipeInputItemStack(ForestryItem.beeQueenGE.getItemStack()));
|
||||
Recipes.recyclerBlacklist.add(new RecipeInputItemStack(ForestryItem.beePrincessGE.getItemStack()));
|
||||
|
||||
// Remove some items from the recycler
|
||||
registerBackpackItems();
|
||||
// Add crates for the IC2 items that exist.
|
||||
resin = IC2Items.getItem("resin");
|
||||
if (resin != null) {
|
||||
ForestryItem.cratedResin.registerItem(new ItemCrated(), "cratedResin");
|
||||
((ItemCrated) ForestryItem.cratedResin.item()).setContained(ForestryItem.cratedResin.getItemStack(), resin);
|
||||
}
|
||||
|
||||
private void initFermentation() {
|
||||
plantBall = IC2Items.getItem("plantBall");
|
||||
compressedPlantBall = IC2Items.getItem("compressedPlantBall");
|
||||
if (plantBall == null || compressedPlantBall == null) {
|
||||
Proxies.log.fine("No IC2 plantballs found.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Add extra recipes
|
||||
RecipeUtil.injectLeveledRecipe(plantBall, GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat") * 4, Defaults.LIQUID_BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(compressedPlantBall, GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat") * 5, Defaults.LIQUID_BIOMASS);
|
||||
rubber = IC2Items.getItem("rubber");
|
||||
if (rubber != null) {
|
||||
ForestryItem.cratedRubber.registerItem(new ItemCrated(), "cratedRubber");
|
||||
((ItemCrated) ForestryItem.cratedRubber.item()).setContained(ForestryItem.cratedRubber.getItemStack(), rubber);
|
||||
}
|
||||
|
||||
private void initLiquidContainers() {
|
||||
emptyCell = IC2Items.getItem("cell");
|
||||
if (emptyCell == null) {
|
||||
Proxies.log.fine("IC2 empty cell could not be found. Skipped adding IC2 liquid containers.");
|
||||
return;
|
||||
}
|
||||
|
||||
lavaCell = IC2Items.getItem("lavaCell");
|
||||
if (lavaCell != null)
|
||||
LiquidHelper.injectTinContainer(Defaults.LIQUID_LAVA, Defaults.BUCKET_VOLUME, lavaCell, emptyCell);
|
||||
|
||||
waterCell = IC2Items.getItem("waterCell");
|
||||
if (waterCell != null) {
|
||||
LiquidHelper.injectTinContainer(Defaults.LIQUID_WATER, Defaults.BUCKET_VOLUME, waterCell, emptyCell);
|
||||
|
||||
ItemStack bogEarthCan = GameMode.getGameMode().getStackSetting("recipe.output.bogearth.can");
|
||||
if (bogEarthCan.stackSize > 0)
|
||||
Proxies.common.addRecipe(bogEarthCan, "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', waterCell, 'Y', Blocks.sand);
|
||||
}
|
||||
scrap = IC2Items.getItem("scrap");
|
||||
if (scrap != null) {
|
||||
ForestryItem.cratedScrap.registerItem(new ItemCrated(), "cratedScrap");
|
||||
((ItemCrated) ForestryItem.cratedScrap.item()).setContained(ForestryItem.cratedScrap.getItemStack(), scrap);
|
||||
}
|
||||
|
||||
private void initRubberChain() {
|
||||
treetap = IC2Items.getItem("treetap");
|
||||
rubberwood = IC2Items.getItem("rubberWood");
|
||||
|
||||
resin = IC2Items.getItem("resin");
|
||||
if (resin != null)
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.propolis.getItemStack(), resin);
|
||||
else
|
||||
Proxies.log.fine("Missing IC2 resin, skipping centrifuge recipe for propolis to resin.");
|
||||
|
||||
rubbersapling = IC2Items.getItem("rubberSapling");
|
||||
if (rubbersapling != null) {
|
||||
RecipeUtil.injectLeveledRecipe(rubbersapling, GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Defaults.LIQUID_BIOMASS);
|
||||
BackpackManager.backpackItems[2].add(rubbersapling);
|
||||
} else {
|
||||
Proxies.log.fine("Missing IC2 rubber sapling, skipping fermenter recipe for converting rubber sapling to biomass.");
|
||||
}
|
||||
|
||||
if (rubbersapling != null && resin != null) {
|
||||
String saplingName = GameData.getBlockRegistry().getNameForObject(StackUtils.getBlock(rubbersapling));
|
||||
String resinName = GameData.getItemRegistry().getNameForObject(resin.getItem());
|
||||
String imc = String.format("farmArboreal@%s.%s.%s.%s",
|
||||
saplingName, rubbersapling.getItemDamage(),
|
||||
resinName, resin.getItemDamage());
|
||||
Proxies.log.finest("Sending IMC '%s'.", imc);
|
||||
FMLInterModComms.sendMessage(Defaults.MOD, "add-farmable-sapling", imc);
|
||||
}
|
||||
|
||||
rubberleaves = IC2Items.getItem("rubberLeaves");
|
||||
if (rubberleaves != null)
|
||||
BackpackManager.backpackItems[2].add(rubberleaves);
|
||||
else
|
||||
Proxies.log.fine("Missing IC2 rubber leaves");
|
||||
|
||||
fuelcanFilled = IC2Items.getItem("filledFuelCan");
|
||||
fuelcanEmpty = IC2Items.getItem("fuelCan");
|
||||
if (fuelcanEmpty != null && fuelcanFilled != null) {
|
||||
ItemStack fuelcanStack = new ItemStack(fuelcanFilled.getItem(), 1, 0);
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setInteger("value", 15288);
|
||||
fuelcanStack.setTagCompound(compound);
|
||||
RecipeManagers.bottlerManager.addRecipe(20, LiquidHelper.getLiquid(Defaults.LIQUID_ETHANOL, Defaults.BOTTLER_FUELCAN_VOLUME), fuelcanEmpty, fuelcanStack);
|
||||
} else {
|
||||
Proxies.log.fine("Missing IC2 fuelcanEmpty or fuelcanFilled, skipping bottler recipe for ethanol to filled fuel can.");
|
||||
}
|
||||
|
||||
// Rubber wood is added via ore dictionary.
|
||||
uuMatter = IC2Items.getItem("matter");
|
||||
if (uuMatter != null) {
|
||||
ForestryItem.cratedUUM.registerItem(new ItemCrated(), "cratedUUM");
|
||||
((ItemCrated) ForestryItem.cratedUUM.item()).setContained(ForestryItem.cratedUUM.getItemStack(), uuMatter);
|
||||
}
|
||||
|
||||
private void initCrates() {
|
||||
|
||||
// Add crates for the IC2 items that exist.
|
||||
|
||||
resin = IC2Items.getItem("resin");
|
||||
if (resin != null) {
|
||||
ForestryItem.cratedResin.registerItem(new ItemCrated(), "cratedResin");
|
||||
((ItemCrated) ForestryItem.cratedResin.item()).setContained(ForestryItem.cratedResin.getItemStack(), resin);
|
||||
}
|
||||
|
||||
rubber = IC2Items.getItem("rubber");
|
||||
if (rubber != null) {
|
||||
ForestryItem.cratedRubber.registerItem(new ItemCrated(), "cratedRubber");
|
||||
((ItemCrated) ForestryItem.cratedRubber.item()).setContained(ForestryItem.cratedRubber.getItemStack(), rubber);
|
||||
}
|
||||
|
||||
scrap = IC2Items.getItem("scrap");
|
||||
if (scrap != null) {
|
||||
ForestryItem.cratedScrap.registerItem(new ItemCrated(), "cratedScrap");
|
||||
((ItemCrated) ForestryItem.cratedScrap.item()).setContained(ForestryItem.cratedScrap.getItemStack(), scrap);
|
||||
}
|
||||
|
||||
uuMatter = IC2Items.getItem("matter");
|
||||
if (uuMatter != null) {
|
||||
ForestryItem.cratedUUM.registerItem(new ItemCrated(), "cratedUUM");
|
||||
((ItemCrated) ForestryItem.cratedUUM.item()).setContained(ForestryItem.cratedUUM.getItemStack(), uuMatter);
|
||||
}
|
||||
|
||||
silver = IC2Items.getItem("silverIngot");
|
||||
if (silver != null) {
|
||||
ForestryItem.cratedSilver.registerItem(new ItemCrated(), "cratedSilver");
|
||||
((ItemCrated) ForestryItem.cratedSilver.item()).setContained(ForestryItem.cratedSilver.getItemStack(), silver);
|
||||
}
|
||||
|
||||
brass = IC2Items.getItem("bronzeIngot");
|
||||
if (brass != null) {
|
||||
ForestryItem.cratedBrass.registerItem(new ItemCrated(), "cratedBrass");
|
||||
((ItemCrated) ForestryItem.cratedBrass.item()).setContained(ForestryItem.cratedBrass.getItemStack(), brass);
|
||||
}
|
||||
silver = IC2Items.getItem("silverIngot");
|
||||
if (silver != null) {
|
||||
ForestryItem.cratedSilver.registerItem(new ItemCrated(), "cratedSilver");
|
||||
((ItemCrated) ForestryItem.cratedSilver.item()).setContained(ForestryItem.cratedSilver.getItemStack(), silver);
|
||||
}
|
||||
|
||||
private void registerBackpackItems() {
|
||||
if (BackpackManager.backpackItems == null)
|
||||
return;
|
||||
|
||||
if (resin != null)
|
||||
BackpackManager.definitions.get("forester").addValidItem(resin);
|
||||
if (rubber != null)
|
||||
BackpackManager.definitions.get("forester").addValidItem(rubber);
|
||||
brass = IC2Items.getItem("bronzeIngot");
|
||||
if (brass != null) {
|
||||
ForestryItem.cratedBrass.registerItem(new ItemCrated(), "cratedBrass");
|
||||
((ItemCrated) ForestryItem.cratedBrass.item()).setContained(ForestryItem.cratedBrass.getItemStack(), brass);
|
||||
}
|
||||
}
|
||||
|
||||
private void initFermentation() {
|
||||
plantBall = IC2Items.getItem("plantBall");
|
||||
compressedPlantBall = IC2Items.getItem("compressedPlantBall");
|
||||
if (plantBall == null || compressedPlantBall == null) {
|
||||
Proxies.log.fine("No IC2 plantballs found.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Add extra recipes
|
||||
RecipeUtil.injectLeveledRecipe(plantBall, GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat") * 4, Defaults.LIQUID_BIOMASS);
|
||||
RecipeUtil.injectLeveledRecipe(compressedPlantBall, GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat") * 5, Defaults.LIQUID_BIOMASS);
|
||||
}
|
||||
|
||||
private void initLiquidContainers() {
|
||||
emptyCell = IC2Items.getItem("cell");
|
||||
if (emptyCell == null) {
|
||||
Proxies.log.fine("IC2 empty cell could not be found. Skipped adding IC2 liquid containers.");
|
||||
return;
|
||||
}
|
||||
|
||||
lavaCell = IC2Items.getItem("lavaCell");
|
||||
if (lavaCell != null)
|
||||
LiquidHelper.injectTinContainer(Defaults.LIQUID_LAVA, Defaults.BUCKET_VOLUME, lavaCell, emptyCell);
|
||||
|
||||
waterCell = IC2Items.getItem("waterCell");
|
||||
if (waterCell != null) {
|
||||
LiquidHelper.injectTinContainer(Defaults.LIQUID_WATER, Defaults.BUCKET_VOLUME, waterCell, emptyCell);
|
||||
|
||||
ItemStack bogEarthCan = GameMode.getGameMode().getStackSetting("recipe.output.bogearth.can");
|
||||
if (bogEarthCan.stackSize > 0)
|
||||
Proxies.common.addRecipe(bogEarthCan, "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', waterCell, 'Y', Blocks.sand);
|
||||
}
|
||||
}
|
||||
|
||||
private void initRubberChain() {
|
||||
treetap = IC2Items.getItem("treetap");
|
||||
rubberwood = IC2Items.getItem("rubberWood");
|
||||
|
||||
resin = IC2Items.getItem("resin");
|
||||
if (resin != null)
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.propolis.getItemStack(), resin);
|
||||
else
|
||||
Proxies.log.fine("Missing IC2 resin, skipping centrifuge recipe for propolis to resin.");
|
||||
|
||||
rubbersapling = IC2Items.getItem("rubberSapling");
|
||||
if (rubbersapling != null) {
|
||||
RecipeUtil.injectLeveledRecipe(rubbersapling, GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Defaults.LIQUID_BIOMASS);
|
||||
BackpackManager.backpackItems[2].add(rubbersapling);
|
||||
} else
|
||||
Proxies.log.fine("Missing IC2 rubber sapling, skipping fermenter recipe for converting rubber sapling to biomass.");
|
||||
|
||||
if (rubbersapling != null && resin != null) {
|
||||
String saplingName = GameData.getBlockRegistry().getNameForObject(StackUtils.getBlock(rubbersapling));
|
||||
String resinName = GameData.getItemRegistry().getNameForObject(resin.getItem());
|
||||
String imc = String.format("farmArboreal@%s.%s.%s.%s",
|
||||
saplingName, rubbersapling.getItemDamage(),
|
||||
resinName, resin.getItemDamage());
|
||||
Proxies.log.finest("Sending IMC '%s'.", imc);
|
||||
FMLInterModComms.sendMessage(Defaults.MOD, "add-farmable-sapling", imc);
|
||||
}
|
||||
|
||||
rubberleaves = IC2Items.getItem("rubberLeaves");
|
||||
if (rubberleaves != null)
|
||||
BackpackManager.backpackItems[2].add(rubberleaves);
|
||||
else
|
||||
Proxies.log.fine("Missing IC2 rubber leaves");
|
||||
|
||||
fuelcanFilled = IC2Items.getItem("filledFuelCan");
|
||||
fuelcanEmpty = IC2Items.getItem("fuelCan");
|
||||
if (fuelcanEmpty != null && fuelcanFilled != null) {
|
||||
ItemStack fuelcanStack = new ItemStack(fuelcanFilled.getItem(), 1, 0);
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setInteger("value", 15288);
|
||||
fuelcanStack.setTagCompound(compound);
|
||||
RecipeManagers.bottlerManager.addRecipe(20, LiquidHelper.getLiquid(Defaults.LIQUID_ETHANOL, Defaults.BOTTLER_FUELCAN_VOLUME), fuelcanEmpty, fuelcanStack);
|
||||
} else
|
||||
Proxies.log.fine("Missing IC2 fuelcanEmpty or fuelcanFilled, skipping bottler recipe for ethanol to filled fuel can.");
|
||||
|
||||
// Rubber wood is added via ore dictionary.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,7 +15,6 @@ import java.util.Locale;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
|
||||
@@ -25,7 +24,6 @@ import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import forestry.api.arboriculture.ITreeRoot;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.PluginInfo;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IClassification;
|
||||
@@ -43,7 +41,6 @@ import forestry.core.gadgets.MachineDefinition;
|
||||
import forestry.core.genetics.Allele;
|
||||
import forestry.core.genetics.Branch;
|
||||
import forestry.core.items.ItemForestryBlock;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
import forestry.core.utils.Utils;
|
||||
@@ -60,8 +57,8 @@ import forestry.lepidopterology.items.ItemButterflyGE;
|
||||
import forestry.lepidopterology.items.ItemFlutterlyzer;
|
||||
import forestry.lepidopterology.proxy.ProxyLepidopterology;
|
||||
|
||||
@PluginInfo(pluginID = "Lepidopterology", name = "Lepidopterology", author = "SirSengir", url = Defaults.URL, description = "Butterflies. Shiny.")
|
||||
public class PluginLepidopterology extends NativePlugin {
|
||||
@Plugin(pluginID = "Lepidopterology", name = "Lepidopterology", author = "SirSengir", url = Defaults.URL, description = "Butterflies. Shiny.")
|
||||
public class PluginLepidopterology extends ForestryPlugin {
|
||||
|
||||
@SidedProxy(clientSide = "forestry.lepidopterology.proxy.ClientProxyLepidopterology", serverSide = "forestry.lepidopterology.proxy.ProxyLepidopterology")
|
||||
public static ProxyLepidopterology proxy;
|
||||
@@ -82,39 +79,17 @@ public class PluginLepidopterology extends NativePlugin {
|
||||
public static IButterflyRoot butterflyInterface;
|
||||
public static MachineDefinition definitionChest;
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
super.preInit();
|
||||
|
||||
ForestryBlock.lepidopterology.registerBlock(new BlockBase(Material.iron), ItemForestryBlock.class, "lepidopterology");
|
||||
ForestryBlock.lepidopterology.block().setCreativeTab(Tabs.tabLepidopterology);
|
||||
|
||||
BlockBase lepidopterology = ((BlockBase) ForestryBlock.lepidopterology.block());
|
||||
|
||||
definitionChest = lepidopterology.addDefinition((new MachineDefinition(Defaults.DEFINITION_LEPICHEST_META, "forestry.LepiChest", TileLepidopteristChest.class,
|
||||
ShapedRecipeCustom.createShapedRecipe(
|
||||
ForestryBlock.lepidopterology.getItemStack(1, Defaults.DEFINITION_LEPICHEST_META),
|
||||
" # ",
|
||||
"XYX",
|
||||
"XXX",
|
||||
'#', Blocks.glass,
|
||||
'X', ForestryItem.butterflyGE.getItemStack(1, Defaults.WILDCARD),
|
||||
'Y', Blocks.chest))
|
||||
.setFaces(0, 1, 2, 3, 4, 4, 0, 7)));
|
||||
|
||||
AlleleManager.alleleRegistry.registerSpeciesRoot(PluginLepidopterology.butterflyInterface = new ButterflyHelper());
|
||||
createAlleles();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doInit() {
|
||||
super.doInit();
|
||||
|
||||
config = new Configuration();
|
||||
|
||||
Property property = config.get("entities.spawn.limit", CONFIG_CATEGORY, spawnConstraint);
|
||||
@@ -131,6 +106,17 @@ public class PluginLepidopterology extends NativePlugin {
|
||||
proxy.initializeRendering();
|
||||
registerTemplates();
|
||||
|
||||
BlockBase lepidopterology = ((BlockBase) ForestryBlock.lepidopterology.block());
|
||||
definitionChest = lepidopterology.addDefinition((new MachineDefinition(Defaults.DEFINITION_LEPICHEST_META, "forestry.LepiChest", TileLepidopteristChest.class,
|
||||
ShapedRecipeCustom.createShapedRecipe(
|
||||
ForestryBlock.lepidopterology.getItemStack(1, Defaults.DEFINITION_LEPICHEST_META),
|
||||
" # ",
|
||||
"XYX",
|
||||
"XXX",
|
||||
'#', Blocks.glass,
|
||||
'X', ForestryItem.butterflyGE.getItemStack(1, Defaults.WILDCARD),
|
||||
'Y', Blocks.chest))
|
||||
.setFaces(0, 1, 2, 3, 4, 4, 0, 7)));
|
||||
definitionChest.register();
|
||||
|
||||
((ITreeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees")).registerLeafTickHandler(new ButterflySpawner());
|
||||
@@ -146,14 +132,6 @@ public class PluginLepidopterology extends NativePlugin {
|
||||
ForestryItem.caterpillarGE.registerItem(new ItemButterflyGE(EnumFlutterType.CATERPILLAR), "caterpillarGE");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerBackpackItems() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerCrates() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
|
||||
@@ -19,7 +19,6 @@ import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
import forestry.api.core.PluginInfo;
|
||||
import forestry.api.mail.EnumPostage;
|
||||
import forestry.api.mail.PostManager;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
@@ -59,8 +58,8 @@ import forestry.mail.triggers.TriggerLowInput;
|
||||
import forestry.mail.triggers.TriggerLowPaper;
|
||||
import forestry.mail.triggers.TriggerLowStamps;
|
||||
|
||||
@PluginInfo(pluginID = "Mail", name = "Mail", author = "SirSengir", url = Defaults.URL, description = "Adds Forestry's mail and trade system.")
|
||||
public class PluginMail extends NativePlugin {
|
||||
@Plugin(pluginID = "Mail", name = "Mail", author = "SirSengir", url = Defaults.URL, description = "Adds Forestry's mail and trade system.")
|
||||
public class PluginMail extends ForestryPlugin {
|
||||
|
||||
@SidedProxy(clientSide = "forestry.mail.proxy.ClientProxyMail", serverSide = "forestry.mail.proxy.ProxyMail")
|
||||
public static ProxyMail proxy;
|
||||
@@ -78,11 +77,6 @@ public class PluginMail extends NativePlugin {
|
||||
public static MachineDefinition definitionPhilatelist;
|
||||
public static StampInfo[] stampDefinitions;
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return !Config.disableMail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
super.preInit();
|
||||
|
||||
@@ -10,25 +10,41 @@
|
||||
******************************************************************************/
|
||||
package forestry.plugins;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import forestry.Forestry;
|
||||
|
||||
import forestry.api.core.IPlugin;
|
||||
import forestry.core.interfaces.IOreDictionaryHandler;
|
||||
import forestry.core.interfaces.IPacketHandler;
|
||||
import forestry.core.interfaces.IPickupHandler;
|
||||
import forestry.core.interfaces.IResupplyHandler;
|
||||
import forestry.core.interfaces.ISaveEventHandler;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import java.io.File;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import net.minecraft.command.CommandHandler;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
public class PluginManager {
|
||||
|
||||
public static ArrayList<IPlugin> plugins = Lists.newArrayList();
|
||||
public static final String MODULE_CONFIG_FILE_NAME = "modules.cfg";
|
||||
public static final String CATEGORY_MODULES = "modules";
|
||||
|
||||
public static ArrayList<IGuiHandler> guiHandlers = Lists.newArrayList();
|
||||
public static ArrayList<IPacketHandler> packetHandlers = Lists.newArrayList();
|
||||
public static ArrayList<IPickupHandler> pickupHandlers = Lists.newArrayList();
|
||||
@@ -36,305 +52,227 @@ public class PluginManager {
|
||||
public static ArrayList<IResupplyHandler> resupplyHandlers = Lists.newArrayList();
|
||||
public static ArrayList<IOreDictionaryHandler> dictionaryHandlers = Lists.newArrayList();
|
||||
|
||||
public static void addPlugin(IPlugin plugin) {
|
||||
Proxies.log.fine("Loading plugin " + plugin.getClass().getSimpleName());
|
||||
plugins.add(plugin);
|
||||
private static final Set<Module> loadedModules = EnumSet.noneOf(Module.class);
|
||||
private static final Set<Module> unloadedModules = EnumSet.allOf(Module.class);
|
||||
private static Stage stage = Stage.SETUP;
|
||||
|
||||
if (plugin instanceof NativePlugin) {
|
||||
public enum Stage {
|
||||
|
||||
NativePlugin nplugin = (NativePlugin) plugin;
|
||||
IGuiHandler guiHandler = nplugin.getGuiHandler();
|
||||
if (guiHandler != null)
|
||||
guiHandlers.add(guiHandler);
|
||||
|
||||
IPacketHandler packetHandler = nplugin.getPacketHandler();
|
||||
if (packetHandler != null)
|
||||
packetHandlers.add(packetHandler);
|
||||
|
||||
IPickupHandler pickupHandler = nplugin.getPickupHandler();
|
||||
if (pickupHandler != null)
|
||||
pickupHandlers.add(pickupHandler);
|
||||
|
||||
ISaveEventHandler saveHandler = nplugin.getSaveEventHandler();
|
||||
if (saveHandler != null)
|
||||
saveEventHandlers.add(saveHandler);
|
||||
|
||||
IResupplyHandler resupplyHandler = nplugin.getResupplyHandler();
|
||||
if (resupplyHandler != null)
|
||||
resupplyHandlers.add(resupplyHandler);
|
||||
|
||||
IOreDictionaryHandler dictionaryHandler = nplugin.getDictionaryHandler();
|
||||
if (dictionaryHandler != null)
|
||||
dictionaryHandlers.add(dictionaryHandler);
|
||||
}
|
||||
|
||||
if (plugin instanceof IFuelHandler)
|
||||
GameRegistry.registerFuelHandler((IFuelHandler) plugin);
|
||||
}
|
||||
|
||||
public static void loadForestryPlugins() {
|
||||
addPlugin(new PluginCore());
|
||||
addPlugin(new PluginApiculture());
|
||||
addPlugin(new PluginArboriculture());
|
||||
addPlugin(new PluginEnergy());
|
||||
addPlugin(new PluginFactory());
|
||||
addPlugin(new PluginFarming());
|
||||
addPlugin(new PluginFood());
|
||||
addPlugin(new PluginLepidopterology());
|
||||
addPlugin(new PluginMail());
|
||||
addPlugin(new PluginStorage());
|
||||
addPlugin(new PluginBuildCraft());
|
||||
addPlugin(new PluginEE());
|
||||
addPlugin(new PluginFarmCraftory());
|
||||
addPlugin(new PluginIC2());
|
||||
addPlugin(new PluginNatura());
|
||||
}
|
||||
|
||||
public static void runPreInit() {
|
||||
for(IPlugin plugin : plugins) {
|
||||
if(plugin instanceof PluginCore) {
|
||||
plugin.preInit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(IPlugin plugin : plugins) {
|
||||
if(plugin instanceof PluginCore) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(plugin.isAvailable()) {
|
||||
plugin.preInit();
|
||||
} else {
|
||||
Proxies.log.fine("Skipped plugin " + plugin.getClass() + " because preconditions were not met.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void runInit() {
|
||||
for (IPlugin plugin : plugins) {
|
||||
if(plugin.isAvailable())
|
||||
plugin.doInit();
|
||||
}
|
||||
}
|
||||
|
||||
public static void runPostInit() {
|
||||
for (IPlugin plugin : plugins) {
|
||||
if (plugin.isAvailable())
|
||||
plugin.postInit();
|
||||
}
|
||||
}
|
||||
|
||||
/*public static void loadPlugins(File modLocation) {
|
||||
loadIncludedPlugins(modLocation);
|
||||
loadExternalPlugins(modLocation);
|
||||
SETUP, PRE_INIT, INIT, POST_INIT, INIT_DISABLED, FINISHED;
|
||||
}
|
||||
|
||||
private static void loadIncludedPlugins(File modLocation) {
|
||||
public enum Module {
|
||||
|
||||
ClassLoader classLoader = ForestryCore.class.getClassLoader();
|
||||
CORE(new PluginCore()),
|
||||
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(new PluginBuildCraft()),
|
||||
PROPOLIS_PIPE(new PluginPropolisPipe()),
|
||||
EQUIVELENT_EXCHANGE(new PluginEE()),
|
||||
FARM_CRAFTORY(new PluginFarmCraftory()),
|
||||
INDUSTRIALCRAFT(new PluginIC2()),
|
||||
NATURA(new PluginNatura()),;
|
||||
|
||||
// Internal plugin when Forestry is a jar or zip
|
||||
if (modLocation.isFile() && (modLocation.getName().endsWith(".jar") || modLocation.getName().endsWith(".zip")))
|
||||
loadPluginsFromFile(modLocation, classLoader);
|
||||
else if (modLocation.isDirectory())
|
||||
loadPluginsFromBin(modLocation, classLoader);
|
||||
private final ForestryPlugin instance;
|
||||
|
||||
}
|
||||
private Module(ForestryPlugin plugin) {
|
||||
this.instance = plugin;
|
||||
}
|
||||
|
||||
private static void loadExternalPlugins(File modLocation) {
|
||||
public ForestryPlugin instance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
File pluginDir = new File(Proxies.common.getForestryRoot() + "/mods");
|
||||
ClassLoader classLoader = ForestryCore.class.getClassLoader();
|
||||
|
||||
// Abort if the plugin directory is not there.
|
||||
if (!pluginDir.isDirectory())
|
||||
return;
|
||||
|
||||
File[] fileList = pluginDir.listFiles();
|
||||
if (fileList == null)
|
||||
return;
|
||||
|
||||
for (File file : fileList) {
|
||||
|
||||
if (!file.isFile())
|
||||
continue;
|
||||
|
||||
if (!file.getName().endsWith(".jar") && !file.getName().endsWith(".zip"))
|
||||
continue;
|
||||
|
||||
if (file.getName().equals(modLocation.getName()))
|
||||
continue;
|
||||
|
||||
loadPluginsFromFile(file, classLoader);
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
public boolean isEnabled() {
|
||||
return isModuleLoaded(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void loadPluginsFromFile(File file, ClassLoader classLoader) {
|
||||
public static Stage getStage() {
|
||||
return stage;
|
||||
}
|
||||
|
||||
String pluginName;
|
||||
public static EnumSet<Module> getLoadedModules() {
|
||||
return EnumSet.copyOf(loadedModules);
|
||||
}
|
||||
|
||||
try {
|
||||
ZipEntry entry = null;
|
||||
FileInputStream fileIO = new FileInputStream(file);
|
||||
ZipInputStream zipIO = new ZipInputStream(fileIO);
|
||||
public static boolean isModuleLoaded(Module module) {
|
||||
return loadedModules.contains(module);
|
||||
}
|
||||
|
||||
while (true) {
|
||||
entry = zipIO.getNextEntry();
|
||||
|
||||
if (entry == null) {
|
||||
fileIO.close();
|
||||
break;
|
||||
}
|
||||
|
||||
String entryName = entry.getName();
|
||||
File entryFile = new File(entryName);
|
||||
pluginName = entryFile.getName();
|
||||
if (!entry.isDirectory() && pluginName.startsWith("Plugin") && pluginName.endsWith(".class"))
|
||||
PluginManager.addPlugin(classLoader, pluginName, entryFile.getPath().replace(File.separatorChar, '.'));
|
||||
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
public static void addPlugin(ForestryPlugin plugin) {
|
||||
|
||||
}
|
||||
|
||||
private static String parseClassName(String binpath) {
|
||||
public static void runPreInit() {
|
||||
stage = Stage.SETUP;
|
||||
Locale locale = Locale.getDefault();
|
||||
Locale.setDefault(Locale.ENGLISH);
|
||||
|
||||
String[] tokens = binpath.split("[\\\\/]");
|
||||
String packageName = "";
|
||||
boolean inIdea = false;
|
||||
Configuration config = new Configuration(new File(Forestry.instance.getConfigFolder(), MODULE_CONFIG_FILE_NAME));
|
||||
|
||||
for (int i = 0; i < tokens.length; i++) {
|
||||
if (tokens[i] == null)
|
||||
break;
|
||||
if (tokens[i].equals("production") || tokens[i].equals("classes"))
|
||||
inIdea = true;
|
||||
if (!tokens[i].equals("bin") && !inIdea)
|
||||
config.load();
|
||||
config.addCustomCategoryComment(CATEGORY_MODULES, "Disabling these modules can greatly change how the mod functions.\n"
|
||||
+ "Your milage 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 == Module.CORE)
|
||||
continue;
|
||||
if (!isEnabled(config, m)) {
|
||||
it.remove();
|
||||
Proxies.log.info("Module disabled: {0}", m);
|
||||
continue;
|
||||
|
||||
// We are at bin, build the rest and return
|
||||
for (int j = (inIdea ? i + 2 : i + 1); j < tokens.length; j++) {
|
||||
if (packageName.length() > 0)
|
||||
packageName += ".";
|
||||
packageName += tokens[j];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return packageName;
|
||||
}
|
||||
|
||||
private static void loadPluginsFromBin(File bin, ClassLoader classLoader) {
|
||||
File[] fileList = bin.listFiles();
|
||||
|
||||
// ensure consistent sorting across all platforms
|
||||
Arrays.sort(fileList, new Comparator<File>() {
|
||||
@Override
|
||||
public int compare(File a, File b) {
|
||||
return a.getName().toLowerCase().compareTo(b.getName().toLowerCase());
|
||||
}
|
||||
});
|
||||
|
||||
for (File file : fileList) {
|
||||
String pluginName = file.getName();
|
||||
|
||||
if (file.isFile() && pluginName.startsWith("Plugin") && pluginName.endsWith(".class")) {
|
||||
PluginManager.addPlugin(classLoader, pluginName, parseClassName(file.getPath()));
|
||||
} else if (file.isDirectory()) {
|
||||
loadPluginsFromBin(file, classLoader);
|
||||
ForestryPlugin plugin = m.instance;
|
||||
if (!plugin.isAvailable()) {
|
||||
it.remove();
|
||||
Proxies.log.info("Module {0} failed to load: {1}", plugin, plugin.getFailMessage());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addPlugin(ClassLoader classLoader, String pluginName, String packageName) {
|
||||
|
||||
if (pluginName.equals("PluginManager.class") || pluginName.equals("PluginInfo.class"))
|
||||
return;
|
||||
|
||||
String pluginClassName = packageName.replace(".class", "").replace("minecraft.", "");
|
||||
|
||||
try {
|
||||
|
||||
Class<?> pluginClass = null;
|
||||
try {
|
||||
pluginClass = classLoader.loadClass(pluginClassName);
|
||||
} catch (Throwable error) {
|
||||
}
|
||||
|
||||
if (pluginClass == null) {
|
||||
pluginClass = Class.forName(pluginClassName);
|
||||
}
|
||||
|
||||
if (pluginClass != null) {
|
||||
|
||||
Class<?> clz = pluginClass;
|
||||
boolean isPlugin = false;
|
||||
do {
|
||||
for (Class<?> i : clz.getInterfaces()) {
|
||||
if (i == IPlugin.class) {
|
||||
isPlugin = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
clz = clz.getSuperclass();
|
||||
} while (clz != null && !isPlugin);
|
||||
|
||||
if (!isPlugin)
|
||||
return;
|
||||
|
||||
IPlugin plugin = (IPlugin) pluginClass.newInstance();
|
||||
if (plugin != null) {
|
||||
|
||||
Proxies.log.fine("Found plugin " + plugin.toString());
|
||||
plugins.add(plugin);
|
||||
|
||||
if (plugin instanceof NativePlugin) {
|
||||
|
||||
NativePlugin nplugin = (NativePlugin) plugin;
|
||||
IGuiHandler guiHandler = nplugin.getGuiHandler();
|
||||
if (guiHandler != null)
|
||||
guiHandlers.add(guiHandler);
|
||||
|
||||
IPacketHandler packetHandler = nplugin.getPacketHandler();
|
||||
if (packetHandler != null)
|
||||
packetHandlers.add(packetHandler);
|
||||
|
||||
IPickupHandler pickupHandler = nplugin.getPickupHandler();
|
||||
if (pickupHandler != null)
|
||||
pickupHandlers.add(pickupHandler);
|
||||
|
||||
ISaveEventHandler saveHandler = nplugin.getSaveEventHandler();
|
||||
if (saveHandler != null)
|
||||
saveEventHandlers.add(saveHandler);
|
||||
|
||||
IResupplyHandler resupplyHandler = nplugin.getResupplyHandler();
|
||||
if (resupplyHandler != null)
|
||||
resupplyHandlers.add(resupplyHandler);
|
||||
|
||||
IOreDictionaryHandler dictionaryHandler = nplugin.getDictionaryHandler();
|
||||
if (dictionaryHandler != null)
|
||||
dictionaryHandlers.add(dictionaryHandler);
|
||||
}
|
||||
|
||||
if (plugin instanceof IFuelHandler)
|
||||
GameRegistry.registerFuelHandler((IFuelHandler) plugin);
|
||||
|
||||
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();
|
||||
changed = true;
|
||||
Proxies.log.warning("Module {0} is missing dependancies: {1}", m, deps);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} while (changed);
|
||||
|
||||
} catch (Throwable ex) {
|
||||
// ex.printStackTrace();
|
||||
unloadedModules.removeAll(toLoad);
|
||||
loadedModules.addAll(toLoad);
|
||||
|
||||
if (config.hasChanged())
|
||||
config.save();
|
||||
|
||||
Locale.setDefault(locale);
|
||||
|
||||
stage = Stage.PRE_INIT;
|
||||
for (Module m : loadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
loadPlugin(plugin);
|
||||
Proxies.log.fine("Pre-Init Start: {0}", plugin);
|
||||
plugin.preInit();
|
||||
plugin.registerItems();
|
||||
Proxies.log.fine("Pre-Init Complete: {0}", plugin);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private static void loadPlugin(ForestryPlugin plugin) {
|
||||
Proxies.log.fine("Loading Plugin: {0}", plugin);
|
||||
|
||||
ForestryPlugin nplugin = (ForestryPlugin) plugin;
|
||||
IGuiHandler guiHandler = nplugin.getGuiHandler();
|
||||
if (guiHandler != null)
|
||||
guiHandlers.add(guiHandler);
|
||||
|
||||
IPacketHandler packetHandler = nplugin.getPacketHandler();
|
||||
if (packetHandler != null)
|
||||
packetHandlers.add(packetHandler);
|
||||
|
||||
IPickupHandler pickupHandler = nplugin.getPickupHandler();
|
||||
if (pickupHandler != null)
|
||||
pickupHandlers.add(pickupHandler);
|
||||
|
||||
ISaveEventHandler saveHandler = nplugin.getSaveEventHandler();
|
||||
if (saveHandler != null)
|
||||
saveEventHandlers.add(saveHandler);
|
||||
|
||||
IResupplyHandler resupplyHandler = nplugin.getResupplyHandler();
|
||||
if (resupplyHandler != null)
|
||||
resupplyHandlers.add(resupplyHandler);
|
||||
|
||||
IOreDictionaryHandler dictionaryHandler = nplugin.getDictionaryHandler();
|
||||
if (dictionaryHandler != null)
|
||||
dictionaryHandlers.add(dictionaryHandler);
|
||||
|
||||
IFuelHandler fuelHandler = nplugin.getFuelHandler();
|
||||
if (fuelHandler != null)
|
||||
GameRegistry.registerFuelHandler((fuelHandler));
|
||||
}
|
||||
|
||||
public static void runInit() {
|
||||
stage = Stage.INIT;
|
||||
for (Module m : loadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
Proxies.log.fine("Init Start: {0}", plugin);
|
||||
plugin.registerBackpackItems();
|
||||
plugin.registerCrates();
|
||||
plugin.doInit();
|
||||
Proxies.log.fine("Init Complete: {0}", plugin);
|
||||
}
|
||||
}
|
||||
|
||||
public static void runPostInit() {
|
||||
stage = Stage.POST_INIT;
|
||||
for (Module m : loadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
Proxies.log.fine("Post-Init Start: {0}", plugin);
|
||||
plugin.registerRecipes();
|
||||
plugin.postInit();
|
||||
Proxies.log.fine("Post-Init Complete: {0}", plugin);
|
||||
}
|
||||
|
||||
stage = Stage.INIT_DISABLED;
|
||||
for (Module m : unloadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
Proxies.log.fine("Disabled-Init Start: {0}", plugin);
|
||||
plugin.disabledInit();
|
||||
Proxies.log.fine("Disabled-Init Complete: {0}", plugin);
|
||||
}
|
||||
stage = Stage.FINISHED;
|
||||
}
|
||||
|
||||
public static void serverStarting(MinecraftServer server) {
|
||||
CommandHandler commandManager = (CommandHandler) server.getCommandManager();
|
||||
|
||||
for (Module m : loadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
ICommand[] commands = plugin.getConsoleCommands();
|
||||
if (commands == null)
|
||||
continue;
|
||||
for (ICommand command : commands)
|
||||
commandManager.registerCommand(command);
|
||||
}
|
||||
}
|
||||
|
||||
public static void processIMCMessages(ImmutableList<FMLInterModComms.IMCMessage> messages) {
|
||||
for (FMLInterModComms.IMCMessage message : messages)
|
||||
for (Module m : loadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
if (plugin.processIMCMessage(message))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void generateSurface(World world, Random rand, int chunkX, int chunkZ) {
|
||||
for (Module m : loadedModules) {
|
||||
ForestryPlugin plugin = m.instance;
|
||||
plugin.generateSurface(world, rand, chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isEnabled(Configuration config, Module m) {
|
||||
boolean defaultValue = true;
|
||||
Property prop = config.get(CATEGORY_MODULES, m.toString().toLowerCase(Locale.ENGLISH).replace('_', '.'), defaultValue);
|
||||
return prop.getBoolean(true);
|
||||
}
|
||||
}
|
||||
@@ -26,22 +26,27 @@ import forestry.core.config.Defaults;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
|
||||
public class PluginNatura extends NativePlugin {
|
||||
public class PluginNatura extends ForestryPlugin {
|
||||
|
||||
private static final String NATURA = "Natura";
|
||||
|
||||
|
||||
public static Block logNatura;
|
||||
public static Block logWillow;
|
||||
|
||||
|
||||
public static Block leavesNatura;
|
||||
public static Block saplingNatura;
|
||||
public static Block saplingNaturaRare;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return Proxies.common.isModLoaded(NATURA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFailMessage() {
|
||||
return "Natura not found";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doInit() {
|
||||
super.doInit();
|
||||
@@ -54,9 +59,9 @@ public class PluginNatura extends NativePlugin {
|
||||
|
||||
ArrayList<String> saplingItemKeys = new ArrayList<String>();
|
||||
|
||||
if(saplingNatura != null)
|
||||
if (saplingNatura != null)
|
||||
saplingItemKeys.add("florasapling");
|
||||
if(saplingNaturaRare != null)
|
||||
if (saplingNaturaRare != null)
|
||||
saplingItemKeys.add("Rare Sapling");
|
||||
|
||||
for (String key : saplingItemKeys) {
|
||||
@@ -65,27 +70,23 @@ public class PluginNatura extends NativePlugin {
|
||||
FMLInterModComms.sendMessage(Defaults.MOD, "add-farmable-sapling", String.format("farmArboreal@%s.-1", saplingName));
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void registerItems() {}
|
||||
@Override protected void registerBackpackItems() {}
|
||||
@Override protected void registerCrates() {}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
ItemStack seedBarley = GameRegistry.findItemStack(NATURA, "seedBarley", 1);
|
||||
ItemStack seedCotton = GameRegistry.findItemStack(NATURA, "seedCotton", 1);
|
||||
|
||||
|
||||
ArrayList<ItemStack> seedList = new ArrayList<ItemStack>();
|
||||
if (seedBarley != null)
|
||||
seedList.add(seedBarley);
|
||||
if (seedCotton != null)
|
||||
seedList.add(seedCotton);
|
||||
|
||||
|
||||
int amount = GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed");
|
||||
for (int i = 0; i < seedList.size(); ++i) {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { seedList.get(i) },
|
||||
for (int i = 0; i < seedList.size(); ++i)
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{seedList.get(i)},
|
||||
LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, amount));
|
||||
}
|
||||
|
||||
|
||||
ItemStack berryBlight = GameRegistry.findItemStack(NATURA, "berryBlight", 1);
|
||||
ItemStack berryDusk = GameRegistry.findItemStack(NATURA, "berryDusk", 1);
|
||||
ItemStack berrySky = GameRegistry.findItemStack(NATURA, "berrySting", 1);
|
||||
@@ -94,7 +95,7 @@ public class PluginNatura extends NativePlugin {
|
||||
ItemStack berryBlue = GameRegistry.findItemStack(NATURA, "berryBlue", 1);
|
||||
ItemStack berryBlack = GameRegistry.findItemStack(NATURA, "berryBlack", 1);
|
||||
ItemStack berryMalo = GameRegistry.findItemStack(NATURA, "berryMalo", 1);
|
||||
|
||||
|
||||
ArrayList<ItemStack> berries = new ArrayList<ItemStack>();
|
||||
if (berryBlight != null)
|
||||
berries.add(berryBlight);
|
||||
@@ -102,7 +103,7 @@ public class PluginNatura extends NativePlugin {
|
||||
berries.add(berryDusk);
|
||||
if (berrySky != null)
|
||||
berries.add(berrySky);
|
||||
if (berrySting!= null)
|
||||
if (berrySting != null)
|
||||
berries.add(berrySting);
|
||||
if (berryRasp != null)
|
||||
berries.add(berryRasp);
|
||||
@@ -112,13 +113,12 @@ public class PluginNatura extends NativePlugin {
|
||||
berries.add(berryBlack);
|
||||
if (berryMalo != null)
|
||||
berries.add(berryMalo);
|
||||
|
||||
|
||||
amount = GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple") / 25;
|
||||
amount = (amount > 1) ? amount : 1; // Produce at least 1 mb of juice.
|
||||
for (int i = 0; i < berries.size(); ++i) {
|
||||
RecipeManagers.squeezerManager.addRecipe(3, new ItemStack[] { berries.get(i) },
|
||||
for (int i = 0; i < berries.size(); ++i)
|
||||
RecipeManagers.squeezerManager.addRecipe(3, new ItemStack[]{berries.get(i)},
|
||||
LiquidHelper.getLiquid(Defaults.LIQUID_JUICE, amount));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,10 +8,8 @@
|
||||
package forestry.plugins;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import forestry.api.core.PluginInfo;
|
||||
import forestry.core.config.Configuration;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryItem;
|
||||
@@ -20,9 +18,10 @@ import forestry.core.proxy.Proxies;
|
||||
import forestry.pipes.GuiHandlerPipes;
|
||||
import forestry.pipes.network.PacketHandlerPipes;
|
||||
import forestry.pipes.proxy.ProxyPipes;
|
||||
import java.util.EnumSet;
|
||||
|
||||
@PluginInfo(pluginID = "Pipes", name = "Pipes", author = "SirSengir", url = Defaults.URL, description = "Adds the apiarist's pipe for beekeeping if apiculture is enabled and BuildCraft 6 is present.")
|
||||
public class PluginPropolisPipe extends NativePlugin {
|
||||
@Plugin(pluginID = "Pipes", name = "Pipes", author = "SirSengir", url = Defaults.URL, description = "Adds the apiarist's pipe for beekeeping if apiculture is enabled and BuildCraft 6 is present.")
|
||||
public class PluginPropolisPipe extends ForestryPlugin {
|
||||
|
||||
public static ProxyPipes proxy;
|
||||
|
||||
@@ -41,15 +40,26 @@ public class PluginPropolisPipe extends NativePlugin {
|
||||
return Proxies.common.isModLoaded("BuildCraft|Transport", PluginBuildCraft.validVersionRange);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFailMessage() {
|
||||
return "Buildcraft|Transport not found";
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<PluginManager.Module> getDependancies() {
|
||||
EnumSet<PluginManager.Module> deps = super.getDependancies();
|
||||
deps.add(PluginManager.Module.BUILDCRAFT);
|
||||
return deps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
|
||||
/*config = new Configuration();
|
||||
|
||||
propolisPipeItemId = Integer.parseInt(PluginPropolisPipe.config.get("propolisPipe", CONFIG_CATEGORY, 14000).Value);
|
||||
|
||||
config.save();*/
|
||||
propolisPipeItemId = Integer.parseInt(PluginPropolisPipe.config.get("propolisPipe", CONFIG_CATEGORY, 14000).Value);
|
||||
|
||||
config.save();*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,14 +68,14 @@ public class PluginPropolisPipe extends NativePlugin {
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
String proxyClass = "forestry.pipes.proxy.ProxyPipes";
|
||||
if (FMLCommonHandler.instance().getSide().isClient())
|
||||
proxyClass = "forestry.pipes.proxy.ClientProxyPipes";
|
||||
String proxyClass = "forestry.pipes.proxy.ProxyPipes";
|
||||
if (FMLCommonHandler.instance().getSide().isClient())
|
||||
proxyClass = "forestry.pipes.proxy.ClientProxyPipes";
|
||||
|
||||
proxy = (ProxyPipes) Proxies.common.instantiateIfModLoaded("BuildCraft|Transport", PluginBuildCraft.validVersionRange, proxyClass);
|
||||
proxy = (ProxyPipes) Proxies.common.instantiateIfModLoaded("BuildCraft|Transport", PluginBuildCraft.validVersionRange, proxyClass);
|
||||
|
||||
if (proxy == null)
|
||||
return;
|
||||
if (proxy == null)
|
||||
return;
|
||||
|
||||
proxy.initPropolisPipe();
|
||||
proxy.registerCraftingPropolis(ForestryItem.propolis.getItemStack());
|
||||
@@ -80,7 +90,7 @@ public class PluginPropolisPipe extends NativePlugin {
|
||||
public IPacketHandler getPacketHandler() {
|
||||
return new PacketHandlerPipes();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void registerItems() {
|
||||
}
|
||||
|
||||
@@ -49,13 +49,11 @@ import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.core.PluginInfo;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.api.storage.EnumBackpackType;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Configuration;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
@@ -78,8 +76,8 @@ import forestry.storage.items.ItemNaturalistBackpack;
|
||||
import forestry.storage.items.ItemNaturalistBackpack.BackpackDefinitionApiarist;
|
||||
import forestry.storage.items.ItemNaturalistBackpack.BackpackDefinitionLepidopterist;
|
||||
|
||||
@PluginInfo(pluginID = "Storage", name = "Storage", author = "SirSengir", url = Defaults.URL, description = "Adds backpacks and crates.")
|
||||
public class PluginStorage extends NativePlugin implements IOreDictionaryHandler {
|
||||
@Plugin(pluginID = "Storage", name = "Storage", author = "SirSengir", url = Defaults.URL, description = "Adds backpacks and crates.")
|
||||
public class PluginStorage extends ForestryPlugin implements IOreDictionaryHandler {
|
||||
|
||||
private final ArrayList<ItemStack> minerItems = new ArrayList<ItemStack>();
|
||||
private final ArrayList<ItemStack> diggerItems = new ArrayList<ItemStack>();
|
||||
@@ -90,22 +88,14 @@ public class PluginStorage extends NativePlugin implements IOreDictionaryHandler
|
||||
static String CONFIG_CATEGORY = "backpacks";
|
||||
Configuration config;
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return !Config.disableStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
BackpackManager.backpackInterface = new BackpackHelper();
|
||||
super.preInit();
|
||||
createBackpackArrays();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
super.postInit();
|
||||
|
||||
scanForItems();
|
||||
|
||||
config = new Configuration();
|
||||
|
||||
Reference in new issue
Block a user