blob: 9824262d445a870bd15003d75e331bb3db62f628 (
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
|
package baubles.api;
import java.lang.reflect.Method;
import cpw.mods.fml.common.FMLLog;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
/**
* @author Azanor
*/
public class BaublesApi {
static Method getBaubles;
/**
* Retrieves the baubles inventory for the supplied player
*/
public static IInventory getBaubles(EntityPlayer player) {
IInventory ot = null;
try {
if (getBaubles == null) {
Class<?> fake =
Class.forName("baubles.common.lib.PlayerHandler");
getBaubles = fake.getMethod("getPlayerBaubles",
EntityPlayer.class);
}
ot = (IInventory) getBaubles.invoke(null, player);
} catch (Exception ex) {
FMLLog.warning(
"[Baubles API] Could not invoke baubles.common.lib.PlayerHandler method getPlayerBaubles");
}
return ot;
}
}
|