summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2015-04-29 18:31:21 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2015-04-29 18:31:21 +0100
commitceb1aaa90b769d4a38e2fc8bca0e966087a56db6 (patch)
tree6e6be9eedbb06a5d8d0ec88187563d89f836555b
parent265f0ebc8136d1d8a4fcaa6d75a5c803148afeaf (diff)
downloadkinniutils-ceb1aaa90b769d4a38e2fc8bca0e966087a56db6.tar.bz2
Beginning of test filter item
-rw-r--r--src/main/java/net/flarn/kinniutils/item/ItemTestFilter.java87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/main/java/net/flarn/kinniutils/item/ItemTestFilter.java b/src/main/java/net/flarn/kinniutils/item/ItemTestFilter.java
new file mode 100644
index 0000000..bc66f90
--- /dev/null
+++ b/src/main/java/net/flarn/kinniutils/item/ItemTestFilter.java
@@ -0,0 +1,87 @@
+package net.flarn.kinniutils.item;
+
+import baubles.api.BaubleType;
+import baubles.api.IBauble;
+import baubles.common.container.InventoryBaubles;
+import baubles.common.lib.PlayerHandler;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.world.World;
+
+/**
+ * Created by dsilvers on 29/04/15.
+ */
+public class ItemTestFilter extends Item implements IBauble {
+ public ItemTestFilter () {
+ super();
+ setMaxStackSize(1);
+ setHasSubtypes(false);
+ setMaxDamage(0);
+ setCreativeTab(CreativeTabs.tabDecorations);
+ }
+
+ @Override
+ public BaubleType getBaubleType(ItemStack itemstack) {
+ return BaubleType.AMULET;
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
+ if(!par2World.isRemote) {
+ InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(par3EntityPlayer);
+ for(int i = 0; i < baubles.getSizeInventory(); i++)
+ if(baubles.getStackInSlot(i) == null && baubles.isItemValidForSlot(i, par1ItemStack)) {
+ baubles.setInventorySlotContents(i, par1ItemStack.copy());
+ if(!par3EntityPlayer.capabilities.isCreativeMode){
+ par3EntityPlayer.inventory.setInventorySlotContents(par3EntityPlayer.inventory.currentItem, null);
+ }
+ onEquipped(par1ItemStack, par3EntityPlayer);
+ break;
+ }
+ }
+
+ return par1ItemStack;
+ }
+
+ @Override
+ public void onWornTick(ItemStack itemstack, EntityLivingBase player) {
+ //filter?
+ }
+
+ @Override
+ public boolean hasEffect(ItemStack par1ItemStack, int a) {
+ return true;
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack par1ItemStack) {
+ return EnumRarity.rare;
+ }
+
+ @Override
+ public void onEquipped(ItemStack itemstack, EntityLivingBase player) {
+ if (!player.worldObj.isRemote) {
+ player.worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 1.3f);
+ }
+ }
+
+ @Override
+ public void onUnequipped(ItemStack itemstack, EntityLivingBase player) {
+ }
+
+ @Override
+ public boolean canEquip(ItemStack itemstack, EntityLivingBase player) {
+ return true;
+ }
+
+ @Override
+ public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) {
+ return true;
+ }
+}