2014-05-02 21:31:20 +02:00
|
|
|
/*******************************************************************************
|
2014-08-07 08:29:25 +02:00
|
|
|
* 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
|
2014-08-07 02:56:58 -07:00
|
|
|
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
2015-01-26 22:26:21 -08:00
|
|
|
*
|
2014-08-07 08:29:25 +02:00
|
|
|
* Various Contributors including, but not limited to:
|
|
|
|
|
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
2014-05-02 21:31:20 +02:00
|
|
|
******************************************************************************/
|
|
|
|
|
package forestry;
|
|
|
|
|
|
2015-01-26 22:26:21 -08:00
|
|
|
import java.io.File;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
|
|
2014-05-02 21:31:20 +02:00
|
|
|
import cpw.mods.fml.common.Mod;
|
|
|
|
|
import cpw.mods.fml.common.Mod.EventHandler;
|
|
|
|
|
import cpw.mods.fml.common.SidedProxy;
|
|
|
|
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
|
|
|
|
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
|
2014-08-25 17:19:29 -07:00
|
|
|
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
|
|
|
|
|
import cpw.mods.fml.common.event.FMLMissingMappingsEvent.MissingMapping;
|
2014-05-02 21:31:20 +02:00
|
|
|
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
|
|
|
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|
|
|
|
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
2014-08-25 17:19:29 -07:00
|
|
|
import cpw.mods.fml.common.registry.GameRegistry;
|
|
|
|
|
import cpw.mods.fml.common.registry.GameRegistry.Type;
|
2015-01-26 22:26:21 -08:00
|
|
|
|
2014-05-02 21:31:20 +02:00
|
|
|
import forestry.api.fuels.EngineBronzeFuel;
|
|
|
|
|
import forestry.api.fuels.EngineCopperFuel;
|
|
|
|
|
import forestry.api.fuels.FermenterFuel;
|
|
|
|
|
import forestry.api.fuels.FuelManager;
|
2014-09-18 02:23:08 -07:00
|
|
|
import forestry.api.fuels.GeneratorFuel;
|
2014-05-02 21:31:20 +02:00
|
|
|
import forestry.api.fuels.MoistenerFuel;
|
|
|
|
|
import forestry.api.fuels.RainSubstrate;
|
|
|
|
|
import forestry.core.ForestryCore;
|
|
|
|
|
import forestry.core.config.Defaults;
|
2014-08-25 17:19:29 -07:00
|
|
|
import forestry.core.config.ForestryItem;
|
2014-05-02 21:31:20 +02:00
|
|
|
import forestry.core.config.Version;
|
|
|
|
|
import forestry.core.network.PacketHandler;
|
2014-08-25 17:19:29 -07:00
|
|
|
import forestry.core.proxy.Proxies;
|
2014-05-02 21:31:20 +02:00
|
|
|
import forestry.core.utils.FluidMap;
|
|
|
|
|
import forestry.core.utils.ItemStackMap;
|
2014-08-25 17:19:29 -07:00
|
|
|
import forestry.core.utils.StringUtil;
|
2014-05-02 21:31:20 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Forestry Minecraft Mod
|
|
|
|
|
*
|
|
|
|
|
* @author SirSengir
|
|
|
|
|
*/
|
|
|
|
|
@Mod(
|
|
|
|
|
modid = Defaults.MOD,
|
|
|
|
|
name = "Forestry",
|
|
|
|
|
version = Version.VERSION,
|
2015-04-18 12:40:13 -07:00
|
|
|
dependencies = "required-after:Forge@[10.13.0.1207,);"
|
2015-01-26 22:26:21 -08:00
|
|
|
+ "after:Buildcraft|Core@[6.1.7,);"
|
|
|
|
|
+ "after:ExtrabiomesXL;"
|
|
|
|
|
+ "after:BiomesOPlenty;"
|
2015-04-05 21:06:19 -07:00
|
|
|
+ "after:IC2@[2.0.140,);"
|
|
|
|
|
+ "after:Natura@[2.2.0,);")
|
2014-05-02 21:31:20 +02:00
|
|
|
//, certificateFingerprint = Version.FINGERPRINT)
|
|
|
|
|
public class Forestry {
|
|
|
|
|
|
|
|
|
|
@Mod.Instance(Defaults.MOD)
|
|
|
|
|
public static Forestry instance;
|
2014-09-20 22:43:13 -07:00
|
|
|
private File configFolder;
|
2014-05-02 21:31:20 +02:00
|
|
|
|
2014-12-23 01:16:29 -08:00
|
|
|
private static final Map<String, ForestryItem> mappedItems = new HashMap<String, ForestryItem>();
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
|
mappedItems.put("Forestry:builderBackpack", ForestryItem.builderBackpack);
|
|
|
|
|
mappedItems.put("Forestry:builderBackpackT2", ForestryItem.builderBackpackT2);
|
|
|
|
|
mappedItems.put("Forestry:adventurerBackpack", ForestryItem.adventurerBackpack);
|
|
|
|
|
mappedItems.put("Forestry:adventurerBackpackT2", ForestryItem.adventurerBackpackT2);
|
|
|
|
|
mappedItems.put("Forestry:shortMead", ForestryItem.beverage);
|
|
|
|
|
mappedItems.put("Forestry:waterCan", ForestryItem.canWater);
|
|
|
|
|
mappedItems.put("Forestry:biofuelCan", ForestryItem.canEthanol);
|
|
|
|
|
mappedItems.put("Forestry:biomassCan", ForestryItem.canBiomass);
|
|
|
|
|
mappedItems.put("Forestry:bucketBiofuel", ForestryItem.bucketEthanol);
|
|
|
|
|
mappedItems.put("Forestry:refractoryBiofuel", ForestryItem.refractoryEthanol);
|
|
|
|
|
mappedItems.put("Forestry:waxCapsuleBiofuel", ForestryItem.waxCapsuleEthanol);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 21:31:20 +02:00
|
|
|
public Forestry() {
|
|
|
|
|
FuelManager.fermenterFuel = new ItemStackMap<FermenterFuel>();
|
|
|
|
|
FuelManager.moistenerResource = new ItemStackMap<MoistenerFuel>();
|
|
|
|
|
FuelManager.rainSubstrate = new ItemStackMap<RainSubstrate>();
|
|
|
|
|
FuelManager.bronzeEngineFuel = new FluidMap<EngineBronzeFuel>();
|
|
|
|
|
FuelManager.copperEngineFuel = new ItemStackMap<EngineCopperFuel>();
|
2014-09-20 22:43:13 -07:00
|
|
|
FuelManager.generatorFuel = new FluidMap<GeneratorFuel>();
|
2014-05-02 21:31:20 +02:00
|
|
|
}
|
2015-01-26 22:26:21 -08:00
|
|
|
|
2014-05-02 21:31:20 +02:00
|
|
|
@SidedProxy(clientSide = "forestry.core.ForestryClient", serverSide = "forestry.core.ForestryCore")
|
|
|
|
|
public static ForestryCore core = new ForestryCore();
|
|
|
|
|
public static PacketHandler packetHandler;
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void preInit(FMLPreInitializationEvent event) {
|
|
|
|
|
packetHandler = new PacketHandler();
|
2014-09-20 22:43:13 -07:00
|
|
|
|
|
|
|
|
configFolder = new File(event.getModConfigurationDirectory(), "forestry");
|
2014-05-02 21:31:20 +02:00
|
|
|
|
|
|
|
|
core.preInit(event.getSourceFile(), this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void init(FMLInitializationEvent event) {
|
|
|
|
|
core.init(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void postInit(FMLPostInitializationEvent event) {
|
|
|
|
|
core.postInit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void serverStarting(FMLServerStartingEvent event) {
|
|
|
|
|
core.serverStarting(event.getServer());
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-20 22:43:13 -07:00
|
|
|
public File getConfigFolder() {
|
|
|
|
|
return configFolder;
|
|
|
|
|
}
|
2014-05-02 21:31:20 +02:00
|
|
|
/*@EventHandler
|
|
|
|
|
public void fingerprintWarning(FMLFingerprintViolationEvent event) {
|
|
|
|
|
Proxies.log.info("Fingerprint of the mod jar is invalid. The jar file was tampered with.");
|
|
|
|
|
FMLInterModComms.sendMessage("Railcraft", "securityViolation", "Fingerprint of jar file did not match.");
|
|
|
|
|
FMLInterModComms.sendMessage("Thaumcraft", "securityViolation", "Fingerprint of jar file did not match.");
|
|
|
|
|
FMLInterModComms.sendMessage("IC2", "securityViolation", "Fingerprint of jar file did not match.");
|
|
|
|
|
}*/
|
2014-09-20 22:43:13 -07:00
|
|
|
|
2014-05-02 21:31:20 +02:00
|
|
|
@EventHandler
|
|
|
|
|
public void processIMCMessages(IMCEvent event) {
|
|
|
|
|
core.processIMCMessages(event.getMessages());
|
|
|
|
|
}
|
2014-08-25 17:19:29 -07:00
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void missingMapping(FMLMissingMappingsEvent event) {
|
2015-01-26 22:26:21 -08:00
|
|
|
for (MissingMapping mapping : event.get()) {
|
2014-08-25 17:19:29 -07:00
|
|
|
if (mapping.type == Type.BLOCK) {
|
|
|
|
|
Block block = GameRegistry.findBlock(Defaults.MOD, StringUtil.cleanTags(mapping.name));
|
|
|
|
|
if (block != null) {
|
|
|
|
|
mapping.remap(block);
|
|
|
|
|
Proxies.log.warning("Remapping block " + mapping.name + " to " + StringUtil.cleanBlockName(block));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Block block = GameRegistry.findBlock(Defaults.MOD, StringUtil.cleanTags(mapping.name));
|
|
|
|
|
if (block != null) {
|
|
|
|
|
mapping.remap(Item.getItemFromBlock(block));
|
|
|
|
|
Proxies.log.warning("Remapping item " + mapping.name + " to " + StringUtil.cleanBlockName(block));
|
2014-12-23 01:16:29 -08:00
|
|
|
} else {
|
|
|
|
|
ForestryItem mappedItem = mappedItems.get(mapping.name);
|
|
|
|
|
if (mappedItem != null) {
|
|
|
|
|
mapping.remap(mappedItem.item());
|
|
|
|
|
Proxies.log.warning("Remapping item " + mapping.name + " to " + mappedItem.name());
|
|
|
|
|
}
|
2014-09-05 09:27:35 +02:00
|
|
|
}
|
2014-08-25 17:19:29 -07:00
|
|
|
}
|
2015-01-26 22:26:21 -08:00
|
|
|
}
|
2014-08-25 17:19:29 -07:00
|
|
|
}
|
2014-05-02 21:31:20 +02:00
|
|
|
}
|