Package baubles.api

Source Code of baubles.api.BaublesApi

package baubles.api;

import java.lang.reflect.Method;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import cpw.mods.fml.common.FMLLog;

/**
* @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;
  }
 
}
TOP

Related Classes of baubles.api.BaublesApi

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.