mrkirby153

Untitled

Oct 28th, 2012
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. package aster101.capsuels;
  2.  
  3. import java.util.List;
  4.  
  5. import cpw.mods.fml.common.Mod.Instance;
  6.  
  7. import net.minecraft.src.Entity;
  8. import net.minecraft.src.EntityPlayer;
  9. import net.minecraft.src.Item;
  10. import net.minecraft.src.ItemStack;
  11. import net.minecraft.src.World;
  12.  
  13. public class ItemDeEnergyser extends ItemEnergyser{
  14. public int numOfUses = 10;
  15.  
  16. public ItemDeEnergyser(int par1) {
  17. super(par1);
  18. }
  19.  
  20. @Override
  21. public void addInformation(ItemStack par1ItemStack, List par2List) {
  22. par2List.add("This item removes energy");
  23. par2List.add("from its surroundings.");
  24. if(numOfUses > 5){
  25. par2List.add(Capsuels.COLOR_CODE + "a" + numOfUses + "/10 Uses left.");
  26. }else{
  27. par2List.add(Capsuels.COLOR_CODE + "4" + numOfUses + "/10 Uses left");
  28. }
  29. }
  30.  
  31. @Override
  32. public boolean doesContainerItemLeaveCraftingGrid(ItemStack par1ItemStack) {
  33. return false;
  34. }
  35. @Override
  36. public boolean hasEffect(ItemStack par1ItemStack) {
  37. return false;
  38. }
  39. @Override
  40. public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,
  41. EntityPlayer par3EntityPlayer) {
  42. int posX = (int) (par3EntityPlayer.posX-1);
  43. int posY = (int) (par3EntityPlayer.posY -1);
  44. int posZ = (int) par3EntityPlayer.posZ;
  45.  
  46. if(!par2World.isAirBlock(posX, posY, posZ)&& !par3EntityPlayer.isJumping&& !(par2World.getBlockId(posX, posY, posZ) == 7)&& !(par2World.getBlockId(posX, posY, posZ) == 89)){
  47. par2World.setBlockAndMetadata(posX, posY, posZ, 80, 0);
  48. // --numOfUses;
  49. par1ItemStack.damageItem(1, par3EntityPlayer);
  50. // par1ItemStack.getItemDamageForDisplay();
  51. }
  52. /*
  53. if(numOfUses == 0){
  54. par3EntityPlayer.destroyCurrentEquippedItem();
  55. numOfUses = 10;
  56. }
  57. */
  58.  
  59. return par1ItemStack;
  60. }
  61.  
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment