Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.09 KB | None | 0 0
  1. public boolean interact(EntityPlayer par1EntityPlayer)
  2. {
  3. ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();
  4.  
  5. if (this.isTamed())
  6. {
  7. if (itemstack != null)
  8. {
  9. if (itemstack.getItem() instanceof ItemFood)
  10. {
  11. ItemFood itemfood = (ItemFood)itemstack.getItem();
  12.  
  13. if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < 20.0F)
  14. {
  15. if (!par1EntityPlayer.capabilities.isCreativeMode)
  16. {
  17. --itemstack.stackSize;
  18. }
  19.  
  20. this.heal((float)itemfood.getHealAmount(itemstack));
  21.  
  22. if (itemstack.stackSize <= 0)
  23. {
  24. par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
  25. }
  26.  
  27. return true;
  28. }
  29. }
  30. }
  31.  
  32. if (this.isOwner(par1EntityPlayer) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack) && !this.isGUIItem(itemstack))
  33. {
  34. this.aiSit.setSitting(!this.isSitting());
  35. System.out.println("sit");
  36. this.isJumping = false;
  37. this.setAttackTarget((EntityLivingBase)null);
  38. }
  39.  
  40. if (itemstack != null && this.isOwner(par1EntityPlayer) && !this.worldObj.isRemote && itemstack.getItem() == Items.bone) {
  41. FMLNetworkHandler.openGui(par1EntityPlayer, Main.instance, GUIHandler.CAT_GUI, worldObj, 0, 0, 0);
  42. System.out.println("ITWORKS");
  43. }
  44. }
  45. else if (itemstack != null && itemstack.getItem() == Items.fish)
  46. {
  47. if (!par1EntityPlayer.capabilities.isCreativeMode)
  48. {
  49. --itemstack.stackSize;
  50. }
  51.  
  52. if (itemstack.stackSize <= 0)
  53. {
  54. par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
  55. }
  56.  
  57. if (!this.worldObj.isRemote)
  58. {
  59. if (this.rand.nextInt(3) == 0)
  60. {
  61. this.setTamed(true);
  62. this.navigator.clearPathEntity();
  63. this.setAttackTarget((EntityLivingBase)null);
  64. this.aiSit.setSitting(true);
  65. this.setHealth(10.0F);
  66. this.setOwnerId(par1EntityPlayer.getUniqueID().toString());
  67. this.playTameEffect(true);
  68. this.worldObj.setEntityState(this, (byte)7);
  69.  
  70. }
  71. else
  72. {
  73. this.playTameEffect(false);
  74. this.worldObj.setEntityState(this, (byte)6);
  75. }
  76. }
  77.  
  78. return true;
  79. }
  80.  
  81. return super.interact(par1EntityPlayer);
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement