summaryrefslogtreecommitdiff
path: root/TF2 Crates/src/main/java/baubles/api
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2018-05-24 15:52:43 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2018-05-24 15:52:43 -0400
commita11c98c6cad501e081837ec8fa2e323edaeb1ca3 (patch)
treeab97a3e81bfa3eec2ff530ec55ff4a69e48f49e3 /TF2 Crates/src/main/java/baubles/api
Initial commitmaster
Diffstat (limited to 'TF2 Crates/src/main/java/baubles/api')
-rwxr-xr-xTF2 Crates/src/main/java/baubles/api/BaubleType.java5
-rwxr-xr-xTF2 Crates/src/main/java/baubles/api/BaublesApi.java38
-rwxr-xr-xTF2 Crates/src/main/java/baubles/api/IBauble.java48
-rwxr-xr-xTF2 Crates/src/main/java/baubles/api/package-info.java4
4 files changed, 95 insertions, 0 deletions
diff --git a/TF2 Crates/src/main/java/baubles/api/BaubleType.java b/TF2 Crates/src/main/java/baubles/api/BaubleType.java
new file mode 100755
index 0000000..861f306
--- /dev/null
+++ b/TF2 Crates/src/main/java/baubles/api/BaubleType.java
@@ -0,0 +1,5 @@
+package baubles.api;
+
+public enum BaubleType {
+ RING, AMULET, BELT
+}
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;
+ }
+
+}
diff --git a/TF2 Crates/src/main/java/baubles/api/IBauble.java b/TF2 Crates/src/main/java/baubles/api/IBauble.java
new file mode 100755
index 0000000..bbf1d19
--- /dev/null
+++ b/TF2 Crates/src/main/java/baubles/api/IBauble.java
@@ -0,0 +1,48 @@
+package baubles.api;
+
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.item.ItemStack;
+
+/**
+ *
+ * This interface should be extended by items that can be worn in bauble
+ * slots
+ *
+ * @author Azanor
+ */
+
+public interface IBauble {
+
+ /**
+ * This method return the type of bauble this is. Type is used to
+ * determine the slots it can go into.
+ */
+ public BaubleType getBaubleType(ItemStack itemstack);
+
+ /**
+ * This method is called once per tick if the bauble is being worn by a
+ * player
+ */
+ public void onWornTick(ItemStack itemstack, EntityLivingBase player);
+
+ /**
+ * This method is called when the bauble is equipped by a player
+ */
+ public void onEquipped(ItemStack itemstack, EntityLivingBase player);
+
+ /**
+ * This method is called when the bauble is unequipped by a player
+ */
+ public void onUnequipped(ItemStack itemstack, EntityLivingBase player);
+
+ /**
+ * can this bauble be placed in a bauble slot
+ */
+ public boolean canEquip(ItemStack itemstack, EntityLivingBase player);
+
+ /**
+ * Can this bauble be removed from a bauble slot
+ */
+ public boolean canUnequip(ItemStack itemstack,
+ EntityLivingBase player);
+}
diff --git a/TF2 Crates/src/main/java/baubles/api/package-info.java b/TF2 Crates/src/main/java/baubles/api/package-info.java
new file mode 100755
index 0000000..3530abc
--- /dev/null
+++ b/TF2 Crates/src/main/java/baubles/api/package-info.java
@@ -0,0 +1,4 @@
+@API(owner = "Baubles", apiVersion = "1.0.1.10", provides = "Baubles|API")
+package baubles.api;
+
+import cpw.mods.fml.common.API;