Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean interact(EntityPlayer par1EntityPlayer)
- {
- ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();
- if (this.isTamed())
- {
- if (itemstack != null)
- {
- if (itemstack.getItem() instanceof ItemFood)
- {
- ItemFood itemfood = (ItemFood)itemstack.getItem();
- if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < 20.0F)
- {
- if (!par1EntityPlayer.capabilities.isCreativeMode)
- {
- --itemstack.stackSize;
- }
- this.heal((float)itemfood.getHealAmount(itemstack));
- if (itemstack.stackSize <= 0)
- {
- par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
- }
- return true;
- }
- }
- }
- if (this.isOwner(par1EntityPlayer) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack) && !this.isGUIItem(itemstack))
- {
- this.aiSit.setSitting(!this.isSitting());
- System.out.println("sit");
- this.isJumping = false;
- this.setAttackTarget((EntityLivingBase)null);
- }
- if (itemstack != null && this.isOwner(par1EntityPlayer) && !this.worldObj.isRemote && itemstack.getItem() == Items.bone) {
- FMLNetworkHandler.openGui(par1EntityPlayer, Main.instance, GUIHandler.CAT_GUI, worldObj, 0, 0, 0);
- System.out.println("ITWORKS");
- }
- }
- else if (itemstack != null && itemstack.getItem() == Items.fish)
- {
- if (!par1EntityPlayer.capabilities.isCreativeMode)
- {
- --itemstack.stackSize;
- }
- if (itemstack.stackSize <= 0)
- {
- par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
- }
- if (!this.worldObj.isRemote)
- {
- if (this.rand.nextInt(3) == 0)
- {
- this.setTamed(true);
- this.navigator.clearPathEntity();
- this.setAttackTarget((EntityLivingBase)null);
- this.aiSit.setSitting(true);
- this.setHealth(10.0F);
- this.setOwnerId(par1EntityPlayer.getUniqueID().toString());
- this.playTameEffect(true);
- this.worldObj.setEntityState(this, (byte)7);
- }
- else
- {
- this.playTameEffect(false);
- this.worldObj.setEntityState(this, (byte)6);
- }
- }
- return true;
- }
- return super.interact(par1EntityPlayer);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement