aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/bloodasp/galacticgreg/api/ModContainer.java
blob: 9cea43b754e6e0424119681b5307a12d53bc1a67 (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
package bloodasp.galacticgreg.api;

import java.util.ArrayList;
import java.util.List;

/**
 * Defines a Mod where this Generator shall be active.
 * Note: This will only work (obviously) for Dimensions where either:
 * - Gregtech has a hook in the OreGen
 * or
 * - For mods which are addons to GalactiCraft
 *
 */
public class ModContainer {
	private String _mModName;
	private List<ModDimensionDef> _mDimensionLookup;
	private boolean _mEnabled = false;
	
	
	/**Internal function
	 * 
	 * @return The state if the Registry could find the mod or not
	 */
	public boolean getEnabled()
	{
		return _mEnabled;
	}
	
	/** Internal function
	 * 
	 * Never set this to true. This is an internal marker which is set by the registry if the mod could be found or not
	 * @param pEnabled
	 */
	public void setEnabled(boolean pEnabled)
	{
		_mEnabled = pEnabled;
	}
	
	
	/** 
	 * Define a new Mod where GT OreGen shall be enabled
	 * @param pModName The modID. Make sure to use the proper mod-id, or it won't load correctly
	 */
	public ModContainer(String pModName)
	{
		_mModName = pModName;
		_mDimensionLookup = new ArrayList<ModDimensionDef>();
	}
	
	
	/** Internal function
	 * 
	 * @return The mods name
	 */
	public String getModName()
	{
		return _mModName;
	}
	
	/** Internal function
	 * 
	 * @return The list of attached dimensions for this mod
	 */
	public List<ModDimensionDef> getDimensionList()
	{
		return _mDimensionLookup;
	}
	
	/**
	 * Adds a new dimension to this modcontainer.
	 * Make sure you've added all blocks there first
	 * @param pDimDef The dimension definition to be added
	 * @return true if it could be added, false if not
	 */
	public boolean addDimensionDef(ModDimensionDef pDimDef)
	{
		for (ModDimensionDef mdd : _mDimensionLookup)
		{
			if (mdd.getChunkProviderName().equals(pDimDef.getChunkProviderName()))
			{
				// Cannot add DimensionDefinition; The Given chunk-provider name is already taken!
				return false;
			}
		}
		
		// Set the parent modName of this dimension. This will finalize it
		pDimDef.setParentModName(_mModName);
		_mDimensionLookup.add(pDimDef);
		return true;
	}
}