Advertisement
HalestormXV

ItemPouch

Mar 21st, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. package com.halestormxv.item;
  2.  
  3. import com.halestormxv.Main.MainRegistry;
  4. import com.halestormxv.inventory.ContainerCelestialKeypouch;
  5. import com.halestormxv.inventory.InventoryKeyPouch;
  6.  
  7. import cpw.mods.fml.relauncher.SideOnly;
  8. import net.minecraft.entity.Entity;
  9. import net.minecraft.entity.player.EntityPlayer;
  10. import net.minecraft.inventory.ContainerPlayer;
  11. import net.minecraft.item.Item;
  12. import net.minecraft.item.ItemStack;
  13. import net.minecraft.world.World;
  14.  
  15. public class keyPouch extends Item
  16. {
  17. public keyPouch()
  18. {
  19. super();
  20. setMaxStackSize(1);
  21. }
  22.  
  23. // Without this method, your inventory will NOT work!!!
  24. @Override
  25. public int getMaxItemUseDuration(ItemStack stack) {
  26. return 1; // return any value greater than zero
  27. }
  28.  
  29. @Override
  30. public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player)
  31. {
  32. if (!world.isRemote)
  33. {
  34. // If player not sneaking, open the inventory gui
  35. if (!player.isSneaking()) {
  36. player.openGui(MainRegistry.instance, CelestialCraft_items.guiIDKeyPouch, world, 0, 0, 0);
  37. }
  38.  
  39. // Otherwise, stealthily place some diamonds in there for a nice surprise next time you open it up :)
  40. //else {
  41. // new InventoryKeyPouch(player.getHeldItem()).setInventorySlotContents(0, new ItemStack(Item.,4));
  42. //}
  43. }
  44.  
  45. return itemstack;
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement