aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/detrav/utils/GTppHelper.java
blob: 0978c2817e6e39d0a940e3a7691bdd0bfb31ed1d (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
package com.detrav.utils;

import cpw.mods.fml.common.Loader;
import gtPlusPlus.core.block.base.BlockBaseOre;
import gtPlusPlus.core.material.Material;
import net.minecraft.block.Block;

import java.util.HashMap;

/**
 * Created by bartimaeusnek on 19.04.2018.
 */
public class GTppHelper {
	public static HashMap<Short,Material> decodeoresGTpp = new HashMap<Short,Material>();
	public static HashMap<Material,Short> encodeoresGTpp = new HashMap<Material,Short>();
	
	public static void generate_OreIDs() {
		for (short n=0;n<gtPlusPlus.core.material.ORES.class.getFields().length;++n) {
			try {
				Short i = (short) (n+1);
				Material m = ((Material)gtPlusPlus.core.material.ORES.class.getFields()[n].get(gtPlusPlus.core.material.ORES.class.getFields()[n]));
				decodeoresGTpp.put(i,m);
				encodeoresGTpp.put(m,i);
			} catch (Exception e) {
			}
			
		}
	}


	public static boolean isGTppBlock(Block tBlock){
		return tBlock instanceof BlockBaseOre;
	}


	public static short getGTppMeta(Block tBlock){
			return (short) (GTppHelper.encodeoresGTpp.get(((BlockBaseOre) tBlock).getMaterialEx()) +7000);
	}

	public static String getGTppVeinName(Block tBlock){
			return tBlock.getLocalizedName();
	}

}