Advertisement
HalestormXV

CustomSlot

Mar 21st, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.06 KB | None | 0 0
  1. package com.halestormxv.inventory;
  2.  
  3. import com.halestormxv.item.CelestialCraft_items;
  4. import com.halestormxv.item.keyPouch;
  5.  
  6. import net.minecraft.inventory.IInventory;
  7. import net.minecraft.inventory.Slot;
  8. import net.minecraft.item.ItemStack;
  9.  
  10. /*
  11. Making the custom slot is very simple, if you're going that route:
  12. */
  13. public class CelestialKeypouchSlot extends Slot
  14. {
  15.     public CelestialKeypouchSlot(IInventory inv, int index, int xPos, int yPos)
  16.     {
  17.         super(inv, index, xPos, yPos);
  18.     }
  19.  
  20.     // This is the only method we need to override so that
  21.     // we can't place our inventory-storing Item within
  22.     // its own inventory (thus making it permanently inaccessible)
  23.     // as well as preventing abuse of storing backpacks within backpacks
  24.     /**
  25.      * Check if the stack is a valid item for this slot.
  26.      */
  27.     @Override
  28.     public boolean isItemValid(ItemStack itemstack)
  29.     {
  30.         //Only allows Celestial Keys into the Bag and disallows the Key Pouch into itself.
  31.         return !(itemstack.getItem() instanceof keyPouch || !(itemstack.getItem() == CelestialCraft_items.celKeys));
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement