Program: 174532
Project: 174532
Buggy source:
/** 
 * Methods related to entity interaction.				
 */
public boolean processInteract(EntityPlayer player,EnumHand hand){
  if (!this.world.isRemote) {
    if (hand == EnumHand.MAIN_HAND) {
      ItemStack stack=player.getHeldItemMainhand();
      if (stack.getItem() == ModItems.GEM_STAFF) {
        if (this.isTamed()) {
          if (player.isSneaking()) {
            this.setSelected(!this.isSelected());
            this.playObeySound();
          }
 else {
            if (this.isOwner(player)) {
              this.setSitting(player);
              this.playObeySound();
            }
 else {
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              return true;
            }
          }
        }
 else {
          this.setOwnerId(player.getUniqueID());
          this.setLeader(player);
          this.setServitude(EntityGem.SERVE_HUMAN);
          this.navigator.clearPathEntity();
          this.setAttackTarget(null);
          this.setHealth(this.getMaxHealth());
          this.playTameEffect();
          this.world.setEntityState(this,(byte)7);
          this.playObeySound();
          player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
          return true;
        }
      }
 else       if (stack.getItem() == ModItems.CRACKED_BLUE_DIAMOND_GEM || stack.getItem() == ModItems.CRACKED_YELLOW_DIAMOND_GEM || stack.getItem() == ModItems.BLUE_DIAMOND_GEM || stack.getItem() == ModItems.YELLOW_DIAMOND_GEM) {
        if (this.getServitude() != EntityGem.SERVE_HUMAN) {
          this.setOwnerId(player.getUniqueID());
          this.setLeader(player);
          this.setServitude(EntityGem.SERVE_HUMAN);
          this.navigator.clearPathEntity();
          this.setAttackTarget(null);
          this.setHealth(this.getMaxHealth());
          this.playTameEffect();
          this.world.setEntityState(this,(byte)7);
          this.playObeySound();
          player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
          return true;
        }
      }
 else       if (stack.getItem() == ModItems.TRANSFER_CONTRACT) {
        if (this.isTamed()) {
          if (this.isOwner(player)) {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
 else {
            ItemTransferContract contract=(ItemTransferContract)stack.getItem();
            if (this.isOwnerId(contract.getOwner(stack))) {
              if (contract.getOwner(stack).equals(this.getOwnerId())) {
                if (this.leader.equals(this.getOwnerId())) {
                  this.setLeader(player);
                }
                this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
              }
 else {
                for (                UUID ownerId : this.jointOwners) {
                  if (contract.getOwner(stack).equals(ownerId)) {
                    if (this.leader.equals(this.getOwnerId())) {
                      this.setLeader(player);
                    }
                    try {
                      this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                    }
 catch (                    Exception e) {
                    }
                    ownerId=EntityPlayer.getUUID(player.getGameProfile());
                  }
                }
              }
              this.playObeySound();
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              this.setOwnerId(EntityPlayer.getUUID(player.getGameProfile()));
              if (!player.capabilities.isCreativeMode) {
                stack.shrink(1);
              }
              return true;
            }
 else {
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              return true;
            }
          }
        }
      }
 else       if (stack.getItem() == ModItems.JOINT_CONTRACT) {
        if (this.isTamed()) {
          if (this.isOwner(player)) {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
 else {
            ItemJointContract contract=(ItemJointContract)stack.getItem();
            if (this.isOwnerId(contract.getOwner(stack))) {
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
              for (              UUID ownerId : this.jointOwners) {
                try {
                  this.world.getPlayerEntityByUUID(ownerId).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                }
 catch (                Exception e) {
                }
              }
              this.jointOwners.add(EntityPlayer.getUUID(player.getGameProfile()));
              this.playObeySound();
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              if (!player.capabilities.isCreativeMode) {
                stack.shrink(1);
              }
              return true;
            }
 else {
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              return true;
            }
          }
        }
      }
 else       if (stack.getItem() == ModItems.LIBERATION_CONTRACT) {
        if (this.isTamed()) {
          ItemLiberationContract contract=(ItemLiberationContract)stack.getItem();
          if (this.isOwnerId(contract.getOwner(stack))) {
            if (contract.getOwner(stack).equals(this.getOwnerId())) {
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
            }
 else {
              for (              UUID ownerId : this.jointOwners) {
                if (contract.getOwner(stack).equals(ownerId)) {
                  try {
                    this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                  }
 catch (                  Exception e) {
                  }
                  ownerId=EntityPlayer.getUUID(player.getGameProfile());
                }
              }
            }
            this.playObeySound();
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
            this.setServitude(EntityGem.SERVE_NONE);
            this.setOwnerId((UUID)null);
            this.setLeader((UUID)null);
            return true;
          }
 else {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
        }
      }
 else       if (stack.getItem() == ModItems.AUTONOMY_CONTRACT) {
        if (this.isTamed()) {
          ItemAutonomyContract contract=(ItemAutonomyContract)stack.getItem();
          if (this.isOwnerId(contract.getOwner(stack))) {
            if (contract.getOwner(stack).equals(this.getOwnerId())) {
              if (this.leader.equals(this.getOwnerId())) {
                this.setLeader(player);
              }
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
            }
 else {
              for (              UUID ownerId : this.jointOwners) {
                if (contract.getOwner(stack).equals(ownerId)) {
                  if (this.leader.equals(this.getOwnerId())) {
                    this.setLeader(player);
                  }
                  try {
                    this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                  }
 catch (                  Exception e) {
                  }
                  ownerId=EntityPlayer.getUUID(player.getGameProfile());
                }
              }
            }
            this.playObeySound();
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
            this.setOwnerId((UUID)null);
            this.setLeader((UUID)null);
            this.setServitude(EntityGem.SERVE_ITSELF);
            return true;
          }
 else {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
        }
      }
 else       if (stack.getItem() == ModItems.WAR_DECLARATION) {
        if (this.isTamed()) {
          ItemWarDeclaration contract=(ItemWarDeclaration)stack.getItem();
          if (this.isOwnerId(contract.getOwner(stack))) {
            if (contract.getOwner(stack).equals(this.getOwnerId())) {
              if (this.leader.equals(this.getOwnerId())) {
                this.setLeader(player);
              }
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
            }
 else {
              for (              UUID ownerId : this.jointOwners) {
                if (contract.getOwner(stack).equals(ownerId)) {
                  if (this.leader.equals(this.getOwnerId())) {
                    this.setLeader(player);
                  }
                  try {
                    this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                  }
 catch (                  Exception e) {
                  }
                  ownerId=EntityPlayer.getUUID(player.getGameProfile());
                }
              }
            }
            this.playObeySound();
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
            this.setKillsPlayers(true);
            return true;
          }
 else {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
        }
      }
 else       if (stack.getItem() == ModItems.PEACE_TREATY) {
        if (this.isTamed()) {
          ItemPeaceTreaty contract=(ItemPeaceTreaty)stack.getItem();
          if (this.isOwnerId(contract.getOwner(stack))) {
            if (contract.getOwner(stack).equals(this.getOwnerId())) {
              if (this.leader.equals(this.getOwnerId())) {
                this.setLeader(player);
              }
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
            }
 else {
              for (              UUID ownerId : this.jointOwners) {
                if (contract.getOwner(stack).equals(ownerId)) {
                  if (this.leader.equals(this.getOwnerId())) {
                    this.setLeader(player);
                  }
                  try {
                    this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                  }
 catch (                  Exception e) {
                  }
                  ownerId=EntityPlayer.getUUID(player.getGameProfile());
                }
              }
            }
            this.playObeySound();
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
            this.setKillsPlayers(false);
            return true;
          }
 else {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
        }
      }
 else       if (stack.getItem() == Items.DYE && this.canChangeUniformColorByDefault() && player.isSneaking()) {
        if (this.isTamed() && this.isOwner(player)) {
          this.setUniformColor(15 - stack.getItemDamage());
          return true;
        }
      }
 else       if (stack.getItem() == Items.DYE && this.canChangeInsigniaColorByDefault()) {
        if (this.isTamed()) {
          if (this.isOwner(player)) {
            this.setInsigniaColor(15 - stack.getItemDamage());
            return true;
          }
        }
      }
 else       if (this.isSoldier) {
        return super.processInteract(player,hand) || this.setAttackWeapon(player,hand,stack);
      }
    }
  }
  return super.processInteract(player,hand);
}

Fixed version (ground truth):
/** 
 * Methods related to entity interaction.				
 */
public boolean processInteract(EntityPlayer player,EnumHand hand){
  if (!this.world.isRemote) {
    if (hand == EnumHand.MAIN_HAND) {
      ItemStack stack=player.getHeldItemMainhand();
      if (stack.getItem() == ModItems.GEM_STAFF) {
        if (this.isTamed()) {
          if (player.isSneaking()) {
            if (this.isOwnedBy(player)) {
              this.setSelected(!this.isSelected());
            }
            this.alternateInteract(player);
            this.playObeySound();
          }
 else {
            if (this.isOwner(player)) {
              this.setSitting(player);
              this.playObeySound();
            }
 else {
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              return true;
            }
          }
        }
 else {
          this.setOwnerId(player.getUniqueID());
          this.setLeader(player);
          this.setServitude(EntityGem.SERVE_HUMAN);
          this.navigator.clearPathEntity();
          this.setAttackTarget(null);
          this.setHealth(this.getMaxHealth());
          this.playTameEffect();
          this.world.setEntityState(this,(byte)7);
          this.playObeySound();
          player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
          return true;
        }
      }
 else       if (stack.getItem() == ModItems.CRACKED_BLUE_DIAMOND_GEM || stack.getItem() == ModItems.CRACKED_YELLOW_DIAMOND_GEM || stack.getItem() == ModItems.BLUE_DIAMOND_GEM || stack.getItem() == ModItems.YELLOW_DIAMOND_GEM) {
        if (this.getServitude() != EntityGem.SERVE_HUMAN) {
          this.setOwnerId(player.getUniqueID());
          this.setLeader(player);
          this.setServitude(EntityGem.SERVE_HUMAN);
          this.navigator.clearPathEntity();
          this.setAttackTarget(null);
          this.setHealth(this.getMaxHealth());
          this.playTameEffect();
          this.world.setEntityState(this,(byte)7);
          this.playObeySound();
          player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
          return true;
        }
      }
 else       if (stack.getItem() == ModItems.TRANSFER_CONTRACT) {
        if (this.isTamed()) {
          if (this.isOwner(player)) {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
 else {
            ItemTransferContract contract=(ItemTransferContract)stack.getItem();
            if (this.isOwnerId(contract.getOwner(stack))) {
              if (contract.getOwner(stack).equals(this.getOwnerId())) {
                if (this.leader.equals(this.getOwnerId())) {
                  this.setLeader(player);
                }
                this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
              }
 else {
                for (                UUID ownerId : this.jointOwners) {
                  if (contract.getOwner(stack).equals(ownerId)) {
                    if (this.leader.equals(this.getOwnerId())) {
                      this.setLeader(player);
                    }
                    try {
                      this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                    }
 catch (                    Exception e) {
                    }
                    ownerId=EntityPlayer.getUUID(player.getGameProfile());
                  }
                }
              }
              this.playObeySound();
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              this.setOwnerId(EntityPlayer.getUUID(player.getGameProfile()));
              if (!player.capabilities.isCreativeMode) {
                stack.shrink(1);
              }
              return true;
            }
 else {
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              return true;
            }
          }
        }
      }
 else       if (stack.getItem() == ModItems.JOINT_CONTRACT) {
        if (this.isTamed()) {
          if (this.isOwner(player)) {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
 else {
            ItemJointContract contract=(ItemJointContract)stack.getItem();
            if (this.isOwnerId(contract.getOwner(stack))) {
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
              for (              UUID ownerId : this.jointOwners) {
                try {
                  this.world.getPlayerEntityByUUID(ownerId).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                }
 catch (                Exception e) {
                }
              }
              this.jointOwners.add(EntityPlayer.getUUID(player.getGameProfile()));
              this.playObeySound();
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              if (!player.capabilities.isCreativeMode) {
                stack.shrink(1);
              }
              return true;
            }
 else {
              player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
              return true;
            }
          }
        }
      }
 else       if (stack.getItem() == ModItems.LIBERATION_CONTRACT) {
        if (this.isTamed()) {
          ItemLiberationContract contract=(ItemLiberationContract)stack.getItem();
          if (this.isOwnerId(contract.getOwner(stack))) {
            if (contract.getOwner(stack).equals(this.getOwnerId())) {
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
            }
 else {
              for (              UUID ownerId : this.jointOwners) {
                if (contract.getOwner(stack).equals(ownerId)) {
                  try {
                    this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                  }
 catch (                  Exception e) {
                  }
                  ownerId=EntityPlayer.getUUID(player.getGameProfile());
                }
              }
            }
            this.playObeySound();
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
            this.setServitude(EntityGem.SERVE_NONE);
            this.setOwnerId((UUID)null);
            this.setLeader((UUID)null);
            return true;
          }
 else {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
        }
      }
 else       if (stack.getItem() == ModItems.AUTONOMY_CONTRACT) {
        if (this.isTamed()) {
          ItemAutonomyContract contract=(ItemAutonomyContract)stack.getItem();
          if (this.isOwnerId(contract.getOwner(stack))) {
            if (contract.getOwner(stack).equals(this.getOwnerId())) {
              if (this.leader.equals(this.getOwnerId())) {
                this.setLeader(player);
              }
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
            }
 else {
              for (              UUID ownerId : this.jointOwners) {
                if (contract.getOwner(stack).equals(ownerId)) {
                  if (this.leader.equals(this.getOwnerId())) {
                    this.setLeader(player);
                  }
                  try {
                    this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                  }
 catch (                  Exception e) {
                  }
                  ownerId=EntityPlayer.getUUID(player.getGameProfile());
                }
              }
            }
            this.playObeySound();
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
            this.setOwnerId((UUID)null);
            this.setLeader((UUID)null);
            this.setServitude(EntityGem.SERVE_ITSELF);
            return true;
          }
 else {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
        }
      }
 else       if (stack.getItem() == ModItems.WAR_DECLARATION) {
        if (this.isTamed()) {
          ItemWarDeclaration contract=(ItemWarDeclaration)stack.getItem();
          if (this.isOwnerId(contract.getOwner(stack))) {
            if (contract.getOwner(stack).equals(this.getOwnerId())) {
              if (this.leader.equals(this.getOwnerId())) {
                this.setLeader(player);
              }
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
            }
 else {
              for (              UUID ownerId : this.jointOwners) {
                if (contract.getOwner(stack).equals(ownerId)) {
                  if (this.leader.equals(this.getOwnerId())) {
                    this.setLeader(player);
                  }
                  try {
                    this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                  }
 catch (                  Exception e) {
                  }
                  ownerId=EntityPlayer.getUUID(player.getGameProfile());
                }
              }
            }
            this.playObeySound();
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
            this.setKillsPlayers(true);
            return true;
          }
 else {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
        }
      }
 else       if (stack.getItem() == ModItems.PEACE_TREATY) {
        if (this.isTamed()) {
          ItemPeaceTreaty contract=(ItemPeaceTreaty)stack.getItem();
          if (this.isOwnerId(contract.getOwner(stack))) {
            if (contract.getOwner(stack).equals(this.getOwnerId())) {
              if (this.leader.equals(this.getOwnerId())) {
                this.setLeader(player);
              }
              this.getOwner().sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
            }
 else {
              for (              UUID ownerId : this.jointOwners) {
                if (contract.getOwner(stack).equals(ownerId)) {
                  if (this.leader.equals(this.getOwnerId())) {
                    this.setLeader(player);
                  }
                  try {
                    this.world.getPlayerEntityByUUID(EntityPlayer.getUUID(player.getGameProfile())).sendMessage(new TextComponentTranslation("String_Node_Str",this.getName(),player.getName()));
                  }
 catch (                  Exception e) {
                  }
                  ownerId=EntityPlayer.getUUID(player.getGameProfile());
                }
              }
            }
            this.playObeySound();
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            if (!player.capabilities.isCreativeMode) {
              stack.shrink(1);
            }
            this.setKillsPlayers(false);
            return true;
          }
 else {
            player.sendMessage(new TextComponentTranslation("String_Node_Str",this.getName()));
            return true;
          }
        }
      }
 else       if (stack.getItem() == Items.DYE && this.canChangeUniformColorByDefault() && player.isSneaking()) {
        if (this.isTamed() && this.isOwner(player)) {
          this.setUniformColor(15 - stack.getItemDamage());
          return true;
        }
      }
 else       if (stack.getItem() == Items.DYE && this.canChangeInsigniaColorByDefault()) {
        if (this.isTamed()) {
          if (this.isOwner(player)) {
            this.setInsigniaColor(15 - stack.getItemDamage());
            return true;
          }
        }
      }
 else       if (this.isSoldier) {
        return super.processInteract(player,hand) || this.setAttackWeapon(player,hand,stack);
      }
    }
  }
  return super.processInteract(player,hand);
}