From a11c98c6cad501e081837ec8fa2e323edaeb1ca3 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 24 May 2018 15:52:43 -0400 Subject: Initial commit --- .../src/main/java/baubles/api/BaublesApi.java | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 TF2 Crates/src/main/java/baubles/api/BaublesApi.java (limited to 'TF2 Crates/src/main/java/baubles/api/BaublesApi.java') diff --git a/TF2 Crates/src/main/java/baubles/api/BaublesApi.java b/TF2 Crates/src/main/java/baubles/api/BaublesApi.java new file mode 100755 index 0000000..9824262 --- /dev/null +++ b/TF2 Crates/src/main/java/baubles/api/BaublesApi.java @@ -0,0 +1,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; + } + +} -- cgit v1.2.3