aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/forestry/Forestry.java
blob: 698e6a8d01c709b00e969ff439ab448448b2c376 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package gtPlusPlus.xmod.forestry;

import static cpw.mods.fml.common.registry.GameRegistry.findBlock;
import static cpw.mods.fml.common.registry.GameRegistry.findItem;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
import net.minecraft.block.Block;
import net.minecraft.item.Item;

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;

import cofh.mod.ChildMod;
import cpw.mods.fml.common.*;
import cpw.mods.fml.common.Mod.CustomProperty;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;

@ChildMod(parent = CORE.MODID, mod = @Mod(modid = "Gregtech++|CompatForestry",
name = "GT++ Compat: Forestry",
version = CORE.VERSION,
dependencies = "after:Miscutils;after:Forestry",
customProperties = @CustomProperty(k = "cofhversion", v = "true")))
public class Forestry {

	private static final String name = "Forestry";

	@EventHandler
	public void load(FMLInitializationEvent e) {

		try {
			initForestry();
		} catch (Throwable $) {
			ModContainer This = FMLCommonHandler.instance().findContainerFor(this);
			LogManager.getLogger(This.getModId()).log(Level.ERROR, "There was a problem loading " + This.getName(), $);
		}
	}

	private static void initForestry() {

		Item item;

		item = findItem(name, "sapling");
		Block block = findBlock(name, "saplingGE");
		if (item != null && block != null) {
			//ForestrySapling sapling = new ForestrySapling(item, block);
			//MFRRegistry.registerPlantable(sapling);
			//MFRRegistry.registerFertilizable(sapling);
		} else
			//Utils.LOG_WARNING("Forestry sapling/block null!");

		block = findBlock(name, "soil");
		if (block != null) {
			//ForestryBogEarth bog = new ForestryBogEarth(block);
			//MFRRegistry.registerPlantable(bog);
			//MFRRegistry.registerFertilizable(bog);
			//MFRRegistry.registerHarvestable(bog);
			//MFRRegistry.registerFruit(bog);
		} else
			//Utils.LOG_WARNING("Forestry bog earth null!");

		for (int i = 1; true; ++i) {
			block = findBlock(name, "log" + i);
			l: if (block == null) {
				if (i > 1)
					Utils.LOG_WARNING("Forestry logs null at " + i + ".");
				else {
					block = findBlock(name, "logs");
					if (block != null) {
						break l;
					}
					Utils.LOG_WARNING("Forestry logs null!");
				}
				break;
			}
			//MFRRegistry.registerHarvestable(new HarvestableWood(block));
			//MFRRegistry.registerFruitLogBlock(block);
		}

		for (int i = 1; true; ++i) {
			block = findBlock(name, "fireproofLog" + i);
			l: if (block == null) {
				if (i > 1)
					Utils.LOG_WARNING("Forestry logs null at " + i + ".");
				else {
					block = findBlock(name, "logsFireproof");
					if (block != null) {
						break l;
					}
					Utils.LOG_WARNING("Forestry logs null!");
				}
				break;
			}
			//MFRRegistry.registerHarvestable(new HarvestableWood(block));
			//MFRRegistry.registerFruitLogBlock(block);
		}

		block = findBlock(name, "leaves");
		if (block != null) {
			//ForestryLeaf leaf = new ForestryLeaf(block);
			//MFRRegistry.registerFertilizable(leaf);
			//MFRRegistry.registerHarvestable(leaf);
			//MFRRegistry.registerFruit(leaf);
		} else
			Utils.LOG_WARNING("Forestry leaves null!");

		block = findBlock(name, "pods");
		item = findItem(name, "grafterProven");
		if (block != null) {
			//ForestryPod pod = new ForestryPod(block, item);
			//MFRRegistry.registerFertilizable(pod);
			//MFRRegistry.registerHarvestable(pod);
			//MFRRegistry.registerFruit(pod);
		} else
			Utils.LOG_WARNING("Forestry pods null!");
	}

	@EventHandler
	public static void postInit(FMLPostInitializationEvent e) {
		//MFRRegistry.registerLiquidDrinkHandler("bioethanol", new DrinkHandlerBiofuel());
		//TileEntityUnifier.updateUnifierLiquids();
	}

}